From dad7b3a1ab5979cc80c900a2e176415de447e837 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 25 Jul 2010 14:56:40 +0100 Subject: first commit diff --git a/README b/README new file mode 100644 index 0000000..e69de29 -- cgit v0.9.2-21-gd62e From 2b8775bc56a1016198010e50a0329db82144c1cc Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 25 Jul 2010 15:03:39 +0100 Subject: Current source - 38.0 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..983f982 --- /dev/null +++ b/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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/Makefile b/Makefile new file mode 100755 index 0000000..90fed1c --- /dev/null +++ b/Makefile @@ -0,0 +1,88 @@ +SOURCES := powder.c http.c md5.c update.c +HEADERS := font.h hmap.h http.h md5.h icon.h update.h version.h + +CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -fgnu89-inline +OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations +LFLAGS := -lSDL -lm -lbz2 +LFLAGS_MTW32 := -lpthreadGC2 +LFLAGS_MT := $(LFLAGS) -lpthread +MFLAGS_MT := -march=k8 -DX86 -DX86_SSE3 -DMT -msse3 +MFLAGS_SSE3 := -march=k8 -DX86 -DX86_SSE3 -msse3 +MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2 +MFLAGS_SSE := -march=pentium3 -DX86 -DX86_SSE + +LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 +WIN32_TARG := powder-sse.exe powder-sse2.exe + +powder: $(SOURCES) $(HEADERS) + gcc -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 + +powder-sse3: $(SOURCES) $(HEADERS) + gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 + strip $@ +powder-mt: $(SOURCES) $(HEADERS) + gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -DLIN32 + strip $@ +powder-sse2: $(SOURCES) $(HEADERS) + gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN32 + strip $@ +powder-sse: $(SOURCES) $(HEADERS) + gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32 + strip $@ + +powder-64-sse3: $(SOURCES) $(HEADERS) + gcc -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 + strip $@ +powder-64-sse2: $(SOURCES) $(HEADERS) + gcc -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64 + strip $@ + +powder-res.o: powder-res.rc powder.ico + i586-mingw32msvc-windres powder-res.rc powder-res.o + +powder-sse3.exe: $(SOURCES) $(HEADERS) powder-res.o + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ +powder-mt.exe: $(SOURCES) $(HEADERS) powder-res.o + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_MT) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS_MTW32) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ +powder-sse2.exe: $(SOURCES) $(HEADERS) powder-res.o + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ +powder-sse.exe: $(SOURCES) $(HEADERS) powder-res.o + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ +powder-x: $(SOURCES) $(HEADERS) + gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa + strip $@ +powder-x-mt: $(SOURCES) $(HEADERS) + gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa +powder-src.tar.bz2: *.c *.h *.rc *.ico Makefile + mkdir powder-src + cp *.c *.h *.rc *.ico Makefile powder-src/ + tar cfj powder-src.tar.bz2 powder-src + rm -rf powder-src + +release: $(LINUX_TARG) $(WIN32_TARG) powder-src.tar.bz2 + tar cfz powder-linux.tar.gz $(LINUX_TARG) + cp /usr/i586-mingw32msvc/bin/SDL.dll . + zip powder-win32.zip $(WIN32_TARG) SDL.dll + mkdir -p release + mv powder-linux.tar.gz release/ + mv powder-win32.zip release/ + mv powder-src.tar.bz2 release/ + cp powder-sse.exe powder.exe + rm -f release/powder.zip + zip release/powder.zip powder.exe SDL.dll + cp powder-64-sse2 release/powder64 + rm -f release/powder64.gz + gzip release/powder64 + rm -f release/powder.gz + cp powder-sse release/powder + gzip release/powder + cd release; tar czf powder-bin.tar.gz powder.gz powder64.gz powder-linux.tar.gz powder-win32.zip powder.zip; cd .. + rm -f $(LINUX_TARG) $(WIN32_TARG) SDL.dll powder.exe diff --git a/Resources/Font-Data b/Resources/Font-Data new file mode 100644 index 0000000..1abf887 Binary files /dev/null and b/Resources/Font-Data differ diff --git a/Resources/Font-Pointers b/Resources/Font-Pointers new file mode 100644 index 0000000..4826cc6 Binary files /dev/null and b/Resources/Font-Pointers differ diff --git a/Resources/Icon-16.png b/Resources/Icon-16.png new file mode 100755 index 0000000..5e1e1fb Binary files /dev/null and b/Resources/Icon-16.png differ diff --git a/Resources/Icon-32.png b/Resources/Icon-32.png new file mode 100755 index 0000000..1f056bd Binary files /dev/null and b/Resources/Icon-32.png differ diff --git a/Resources/powder.icns b/Resources/powder.icns new file mode 100755 index 0000000..56df7eb Binary files /dev/null and b/Resources/powder.icns differ diff --git a/Resources/powder.ico b/Resources/powder.ico new file mode 100755 index 0000000..cd3f6e0 Binary files /dev/null and b/Resources/powder.ico differ diff --git a/font.h b/font.h new file mode 100755 index 0000000..1eb1b54 --- /dev/null +++ b/font.h @@ -0,0 +1,27 @@ +/** + * Powder Toy - Font Data + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +#define FONT_H 10 +char font_data[] = { + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc7, 0x31, 0x0c, 0x02, 0x70, 0x04, 0x00, 0x00, 0x05, 0xcc, 0x74, 0x23, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x19, 0xcc, 0xe0, 0x3f, 0xcc, 0xf0, 0x2f, 0xcc, 0x90, 0x09, 0x00, 0x00, 0x00, 0x06, 0x30, 0xd0, 0x3f, 0x33, 0xe1, 0x07, 0xf4, 0x12, 0x33, 0xff, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x2d, 0xce, 0xcc, 0xe1, 0x1d, 0xc0, 0x03, 0x74, 0x4b, 0x33, 0xb3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7d, 0x30, 0x0c, 0x13, 0xd0, 0x32, 0xb3, 0x33, 0x1c, 0x7d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x4c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x34, 0x1d, 0x07, 0x03, 0x07, 0x1d, 0x34, 0x00, 0x00, 0x00, 0x04, 0x07, 0x1d, 0x34, 0x30, 0x34, 0x1d, 0x07, 0x00, 0x00, 0x00, 0x06, 0x44, 0xd0, 0x1c, 0x64, 0xf0, 0x3f, 0x64, 0xd0, 0x1c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x02, 0x30, 0xe0, 0x2f, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x06, 0x80, 0x02, 0x0c, 0xa0, 0x00, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, 0xe0, 0x39, 0x07, 0x33, 0x32, 0x03, 0xb3, 0x38, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x30, 0xf0, 0x60, 0x03, 0x0c, 0x30, 0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x41, 0x03, 0x0a, 0x2c, 0x70, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0x71, 0x34, 0x01, 0x03, 0x1e, 0x00, 0x33, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xc0, 0x03, 0x37, 0x1c, 0x73, 0x34, 0xbf, 0x03, 0x30, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x00, 0x57, 0xe0, 0x2f, 0x00, 0x13, 0x30, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd3, 0x00, 0x07, 0xf0, 0x1f, 0x03, 0x33, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x07, 0x34, 0x80, 0x03, 0x0e, 0x38, 0xd0, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xd3, 0x1f, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xc3, 0x3f, 0x40, 0x23, 0x30, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x70, 0x04, 0x40, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc0, 0xc3, 0x0b, 0x1b, 0xc0, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x0f, 0x90, 0x83, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfd, 0x71, 0x30, 0x81, 0x03, 0x0e, 0x34, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0x0f, 0x1d, 0x30, 0xe7, 0x37, 0x73, 0x1c, 0xe3, 0x2f, 0x07, 0x00, 0xfd, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x74, 0xd0, 0x1d, 0x47, 0x33, 0x30, 0xff, 0x33, 0x30, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xbf, 0x30, 0x38, 0x43, 0xf3, 0x1f, 0x43, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x31, 0x00, 0x03, 0x70, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x33, 0x30, 0x03, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x32, 0x00, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x10, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x10, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x30, 0x3e, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x47, 0x33, 0x30, 0x03, 0xf3, 0x3f, 0x03, 0x33, 0x30, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x06, 0xd0, 0x01, 0x0c, 0xc0, 0x00, 0x0c, 0xc0, 0x10, 0x0d, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0xc3, 0x34, 0x70, 0x03, 0xbc, 0x00, 0xb3, 0xc0, 0xb0, 0x70, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x30, 0x10, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x1f, 0x3d, 0x7b, 0x3b, 0xe3, 0x32, 0x83, 0x30, 0x03, 0x30, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0xcd, 0x03, 0x73, 0xc3, 0x8c, 0x32, 0xc3, 0xcd, 0xc0, 0x33, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xc7, 0x71, 0xd0, 0x0c, 0x30, 0x03, 0xcd, 0xd1, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x73, 0x34, 0xff, 0x31, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xd3, 0x71, 0xd0, 0x0c, 0x30, 0xc3, 0xcd, 0xd1, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x31, 0x34, 0x03, 0xf3, 0x0f, 0xd7, 0x30, 0x34, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x31, 0x07, 0xd0, 0x0f, 0x90, 0x23, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x13, 0x13, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xcc, 0x00, 0x33, 0xc0, 0x0c, 0x30, 0x03, 0xcd, 0xd2, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x33, 0x30, 0x03, 0xb3, 0x38, 0xcd, 0xc1, 0x0d, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x43, 0x30, 0xc7, 0x34, 0xcd, 0x1c, 0xed, 0x1e, 0x2c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0x4c, 0xc3, 0x81, 0x3b, 0xd0, 0x03, 0xdc, 0x42, 0xc3, 0x31, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0xb3, 0x38, 0xdc, 0x40, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xd0, 0x02, 0x2c, 0xc0, 0x02, 0x2d, 0xc0, 0x06, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x2f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x30, 0x80, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x37, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x47, 0x30, 0xfc, 0x0c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x07, 0x0c, 0xf0, 0xc7, 0x35, 0xc3, 0x0c, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc3, 0x25, 0x03, 0x4c, 0xd2, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd0, 0x00, 0x83, 0x8f, 0x33, 0xc3, 0x1c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xbf, 0x0c, 0xd0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3d, 0x07, 0x03, 0x2f, 0x03, 0x03, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xcb, 0x32, 0xc3, 0xf4, 0x03, 0x4c, 0x30, 0x7e, 0x00, 0x00, 0x05, 0x03, 0x0c, 0xf0, 0xc7, 0x39, 0xc3, 0x0c, 0x73, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x1c, 0x00, 0x0d, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x30, 0x00, 0x34, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x05, 0x03, 0x0c, 0x31, 0xce, 0x0e, 0x1f, 0xcc, 0x31, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x47, 0x3d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x9b, 0x71, 0x37, 0x33, 0x33, 0x32, 0x43, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x0c, 0x33, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x31, 0xc3, 0x4c, 0xd3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x4c, 0xf3, 0xc7, 0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xdf, 0x31, 0xc3, 0x4c, 0xd3, 0x0f, 0x30, 0xc0, 0x00, 0x05, 0x03, 0x00, 0x30, 0x7f, 0xc7, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xc7, 0x10, 0x3c, 0x04, 0xf3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x1c, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x70, 0xdc, 0x30, 0xc3, 0x4c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xd3, 0xdc, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x33, 0x32, 0x33, 0x73, 0x37, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcd, 0x32, 0x7d, 0x8c, 0x73, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xc7, 0x74, 0x43, 0x07, 0x0c, 0x1f, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x4f, 0x2c, 0x2c, 0x2c, 0xf1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x04, 0x38, 0x0c, 0x0c, 0x03, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x02, 0x32, 0x33, 0x33, 0x13, 0x00, 0x04, 0x0b, 0x0c, 0x0c, 0x30, 0x0c, 0x0c, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x72, 0x37, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, 0x07, 0xff, 0x1f, 0xff, 0x7f, 0xff, 0x1b, 0xbf, 0x01, 0x1b, 0x00, 0x0c, 0x00, 0x40, 0xff, 0x00, 0x00, 0xf8, 0xf0, 0x3f, 0xee, 0x2c, 0x30, 0xcb, 0x0b, 0x30, 0x42, 0xc3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xf3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xff, 0x3f, 0x00, 0x0c, 0xc2, 0x00, 0x00, 0xcb, 0x00, 0x00, 0xee, 0xc0, 0xff, 0xf8, 0xb0, 0xc0, 0xff, 0x2c, 0xc0, 0x00, 0x0c, 0xcf, 0x00, 0x0c, 0xc0, 0x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, 0xdc, 0xf0, 0x70, 0x38, 0xc0, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x1f, 0x00, 0xad, 0x07, 0xb0, 0xc5, 0x00, 0x17, 0x0c, 0x70, 0xd0, 0x00, 0x0c, 0x03, 0xbc, 0xef, 0xb3, 0x11, 0xe0, 0x07, 0x05, 0x3c, 0x52, 0xc8, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xc0, 0x3f, 0x00, 0xfc, 0x03, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0xc0, 0x30, 0xc0, 0xff, 0x3f, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0xff, 0x0f, 0xfc, 0xff, 0x3f, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb8, 0xe0, 0x2f, 0xff, 0xe3, 0x2f, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0xff, 0x2f, 0xfd, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0xf8, 0xff, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x01, 0x00, 0x02, 0x00, 0xc8, 0x07, 0x10, 0xc3, 0x00, 0x31, 0x0d, 0x00, 0xfd, 0x01, 0x00, 0x74, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x0a, 0x40, 0x05, 0x80, 0xff, 0x8b, 0x1e, 0xd0, 0x2e, 0x00, 0xf0, 0x00, 0xe0, 0xff, 0x0b, 0x00, 0x0f, 0x00, 0xb8, 0x03, 0xb0, 0xe2, 0xff, 0x02, 0x50, 0x01, 0x08, 0xff, 0x07, 0x03, 0x1e, 0x03, 0x73, 0x03, 0xef, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x2f, 0xe0, 0x1b, 0x0c, 0x1d, 0x00, 0xff, 0x03, 0xbe, 0xf0, 0xc1, 0x01, 0xad, 0x34, 0xc0, 0x36, 0x0b, 0x30, 0xdc, 0xe4, 0x07, 0xfd, 0x1b, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0xa0, 0xaa, 0x00, 0xa8, 0xc2, 0x0f, 0x2a, 0xff, 0x03, 0xca, 0x3f, 0x80, 0xfc, 0x0f, 0x20, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x07, 0xaa, 0xea, 0x1f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xaa, 0xea, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x03, 0x00, 0xd0, 0x03, 0x00, 0xf4, 0xab, 0xaa, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xf4, 0xab, 0xaa, 0xd0, 0x03, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x09, 0xfe, 0xff, 0xe3, 0xff, 0x0f, 0xaa, 0x3e, 0x0a, 0xf8, 0x2e, 0xe0, 0xbf, 0x80, 0xff, 0xaa, 0xfe, 0xff, 0xe2, 0xff, 0x02, 0x02, 0x00, 0x00, 0x09, 0x00, 0x80, 0x04, 0xd0, 0xe2, 0xff, 0x02, 0x00, 0x00, 0xff, 0x6f, 0x00, 0x40, 0xe6, 0xaf, 0x50, 0x00, 0x09, 0x00, 0x20, 0x00, 0x64, 0x00, 0x09, 0xe0, 0x3f, 0x70, 0x60, 0x63, 0xc0, 0xe4, 0x80, 0xc2, 0x03, 0x07, 0x0f, 0x1e, 0x6c, 0xff, 0x27, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x09, 0x44, 0x44, 0x00, 0x12, 0x41, 0x88, 0x04, 0x21, 0x21, 0x84, 0x48, 0x20, 0x23, 0xc2, 0xcc, 0x08, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x1d, 0x00, 0x78, 0x00, 0xb4, 0x07, 0xf0, 0x2f, 0xc0, 0xfb, 0x00, 0xbe, 0x02, 0xf4, 0x07, 0xfd, 0xff, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0x00, 0x19, 0x00, 0xa8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf0, 0xdc, 0xcb, 0x03, 0x00, 0xff, 0xff, 0x4f, 0x07, 0x40, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0xff, 0x3f, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0x07, 0x00, 0xbd, 0x02, 0xe8, 0xb3, 0xe0, 0x3c, 0xac, 0xc3, 0x03, 0x0f, 0x3c, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x0b, 0xc0, 0xc8, 0xc0, 0x91, 0x1b, 0xcd, 0x36, 0xe7, 0x00, 0x47, 0x03, 0xa7, 0x80, 0x36, 0xfd, 0xff, 0xc1, 0x9b, 0xf9, 0xb8, 0xb8, 0xb8, 0xb7, 0x99, 0xf7, 0xff, 0xff, 0x0f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x03, 0x00, 0xfc, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0xff, 0x3f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0xcf, 0xff, 0xff, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1f, 0xcb, 0x30, 0xc3, 0x3f, 0xc7, 0x00, 0x7e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0xc3, 0xfc, 0x33, 0x0c, 0x24, 0xc3, 0xc0, 0x31, 0x0c, 0x06, 0xc3, 0x30, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0xff, 0x3f, 0x30, 0x00, 0x03, 0xc3, 0x30, 0x30, 0x3f, 0xff, 0xff, 0x3f, 0x3c, 0x00, 0xff, 0xff, 0xff, 0x0c, 0x0c, 0xc3, 0xc0, 0x00, 0x0c, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x3c, 0x00, 0xc0, 0x03, 0xf0, 0x3f, 0x00, 0xff, 0x03, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xb8, 0xec, 0x9b, 0xf9, 0xbf, 0xf8, 0xbf, 0x99, 0xef, 0xb8, 0x2c, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x87, 0x87, 0xc3, 0x30, 0x0c, 0xe3, 0xde, 0x01, 0x03, 0x74, 0xbb, 0x0c, 0xc3, 0x30, 0x2c, 0x2d, 0x0d, 0x05, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x34, 0xc3, 0x0c, 0x73, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x39, 0xc0, 0x00, 0x43, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0x60, 0x60, 0x60, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0xb8, 0x00, 0x23, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x36, 0xc6, 0xfc, 0x03, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xcb, 0x00, 0x7f, 0x40, 0x13, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xcb, 0x10, 0x2f, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x0f, 0x30, 0x60, 0x60, 0xc0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0x7d, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xc6, 0xe0, 0x03, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x03, 0xc0, 0xf0, 0x3c, 0xcf, 0xf3, 0x3c, 0x03, 0x00, 0x03, 0x00, 0xcc, 0xf3, 0x3c, 0xcf, 0xf3, 0x30, 0x00, 0x05, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x30, 0xc0, 0x0f, 0x30, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0xd0, 0x7f, 0x40, 0xff, 0x1f, 0xfc, 0xff, 0x43, 0xff, 0x1f, 0x40, 0x15, 0x00, 0x00, 0x00, 0x0a, 0xe4, 0x06, 0x90, 0x91, 0x01, 0x06, 0x24, 0x30, 0x90, 0x1b, 0x46, 0x6e, 0x96, 0xb9, 0x91, 0xe4, 0x06, 0x0c, 0x18, 0x90, 0x40, 0x46, 0x06, 0x90, 0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x02, 0xc2, 0xab, 0xaa, 0x3e, 0x20, 0xe0, 0xab, 0xaa, 0x3e, 0x02, 0xc2, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x02, 0xc0, 0x30, 0x00, 0x0c, 0x03, 0xf0, 0xff, 0x00, 0xfe, 0x0b, 0xd0, 0x7f, 0x00, 0xa4, 0x01, 0x00, 0x0a, 0x00, 0xa0, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x81, 0x24, 0x10, 0x85, 0x00, 0x20, 0x66, 0x40, 0x15, 0x45, 0x62, 0x90, 0x4d, 0xd0, 0xf1, 0x23, 0x01, 0xfd, 0x41, 0x41, 0x07, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x00, 0xf8, 0x02, 0xd0, 0x7f, 0x00, 0xfe, 0x0b, 0xf0, 0xff, 0x00, 0xff, 0x0f, 0xd0, 0x7f, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0xd4, 0x01, 0xd0, 0x06, 0x40, 0x7f, 0x00, 0xfd, 0x01, 0xf4, 0x07, 0xd0, 0x1f, 0x00, 0x7f, 0x00, 0xd0, 0x01, 0x00, 0x0a, 0x40, 0x15, 0x00, 0xfe, 0x0b, 0x88, 0x2f, 0x52, 0xf0, 0x50, 0x01, 0x0a, 0xd4, 0xaf, 0x7f, 0xfd, 0xf5, 0xc7, 0x0b, 0x3e, 0x70, 0xd0, 0x00, 0xa4, 0x01, 0x0a, 0x80, 0x2f, 0x80, 0x5f, 0x2f, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x01, 0x34, 0x34, 0xc0, 0x01, 0x07, 0x0d, 0xd0, 0x75, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xf4, 0x01, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xe0, 0xef, 0x00, 0xbb, 0x0b, 0xa0, 0xaa, 0x00, 0xaa, 0x0a, 0x80, 0x19, 0x00, 0x64, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x2d, 0x80, 0xe7, 0x0b, 0xbe, 0xf8, 0xfa, 0x02, 0xfe, 0x0b, 0x80, 0x2f, 0x00, 0x50, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xaf, 0x2f, 0xbe, 0xe0, 0xdb, 0x02, 0x78, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x50, 0xfe, 0x5b, 0xfd, 0xff, 0x47, 0xff, 0x1f, 0xe0, 0xbf, 0x00, 0xfe, 0x0b, 0xf0, 0xf5, 0x40, 0x01, 0x14, 0x0a, 0x40, 0x1a, 0x00, 0x09, 0x06, 0x20, 0x80, 0x00, 0x02, 0x08, 0xfc, 0xff, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x0a, 0xf0, 0xff, 0x00, 0xaa, 0x0a, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe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 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, +}; +short font_ptrs[] = { + 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2, 0x01c0, 0x01ce, 0x01d7, 0x01e5, 0x01f5, 0x0205, 0x0218, 0x0228, 0x0231, 0x023c, 0x0247, 0x0257, 0x0267, 0x0272, 0x0280, 0x0289, 0x0299, 0x02a9, 0x02b7, 0x02c7, 0x02d7, 0x02e7, 0x02f7, 0x0307, 0x0317, 0x0327, 0x0337, 0x0340, 0x034b, 0x035b, 0x036b, 0x037b, 0x038b, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x042b, 0x043b, 0x044e, 0x045e, 0x0473, 0x0486, 0x0499, 0x04a9, 0x04bc, 0x04cc, 0x04dc, 0x04ec, 0x04ff, 0x050f, 0x0524, 0x0537, 0x0547, 0x055a, 0x0565, 0x0573, 0x057e, 0x0589, 0x0599, 0x05a2, 0x05b0, 0x05be, 0x05cc, 0x05da, 0x05e8, 0x05f3, 0x0601, 0x060f, 0x061a, 0x0625, 0x0633, 0x063e, 0x064e, 0x065c, 0x066a, 0x0678, 0x0686, 0x068f, 0x069d, 0x06a8, 0x06b6, 0x06c4, 0x06d4, 0x06e2, 0x06f0, 0x06fe, 0x0709, 0x070f, 0x071a, 0x072a, 0x0735, 0x074a, 0x0769, 0x0788, 0x07a2, 0x07c1, 0x07db, 0x07f5, 0x080f, 0x0829, 0x0843, 0x085d, 0x0877, 0x0896, 0x08a6, 0x08c0, 0x08da, 0x08f4, 0x090e, 0x0923, 0x0940, 0x095d, 0x097c, 0x099b, 0x09b3, 0x09cb, 0x09e3, 0x09fb, 0x0a13, 0x0a2b, 0x0a43, 0x0a5b, 0x0a73, 0x0a8b, 0x0aa3, 0x0abd, 0x0ada, 0x0af7, 0x0b0c, 0x0b26, 0x0b40, 0x0b5a, 0x0b74, 0x0b8c, 0x0b97, 0x0ba0, 0x0ba9, 0x0bb7, 0x0bc5, 0x0bd3, 0x0be1, 0x0bef, 0x0bfd, 0x0c0b, 0x0c19, 0x0c27, 0x0c35, 0x0c43, 0x0c4e, 0x0c57, 0x0c60, 0x0c6e, 0x0c7e, 0x0c8e, 0x0ca8, 0x0cc2, 0x0cdc, 0x0cf6, 0x0d10, 0x0d2a, 0x0d44, 0x0d5e, 0x0d78, 0x0d92, 0x0dac, 0x0dc6, 0x0de0, 0x0dfa, 0x0e14, 0x0e2e, 0x0e46, 0x0e56, 0x0e66, 0x0e76, 0x0e86, 0x0e96, 0x0ea6, 0x0eb6, 0x0ec6, 0x0ed6, 0x0ee6, 0x0ef6, 0x0f06, 0x0f16, 0x0f26, 0x0f36, 0x0f46, 0x0f56, 0x0f66, 0x0f76, 0x0f86, 0x0f96, 0x0fa6, 0x0fb6, 0x0fc6, 0x0fd6, 0x0fe6, 0x0ff6, 0x1006, 0x1016, 0x1026, 0x1036, 0x1046, 0x1056, 0x1066, 0x1076, 0x1086, 0x1096, 0x10a6, 0x10b6, 0x10c6, 0x10d6, 0x10e6, 0x10f6, 0x1106, 0x1116, 0x1126, 0x1136, +}; \ No newline at end of file diff --git a/hmap.h b/hmap.h new file mode 100755 index 0000000..a356fd2 --- /dev/null +++ b/hmap.h @@ -0,0 +1,21 @@ +/** + * Powder Toy - Heatmap Data + * + * Copyright (c) 2010 Simon Robertshaw + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +unsigned char color_data[] = {0xD9,0xFF,0xFE,0xD4,0xFB,0xFC,0xCF,0xF6,0xF9,0xC9,0xF1,0xF6,0xC2,0xEB,0xF4,0xBB,0xE5,0xF0,0xB3,0xDE,0xED,0xAA,0xD6,0xE9,0xA1,0xCF,0xE5,0x98,0xC7,0xE2,0x8E,0xBF,0xDD,0x85,0xB6,0xD9,0x7B,0xAD,0xD5,0x71,0xA5,0xD0,0x67,0x9C,0xCC,0x5D,0x93,0xC7,0x53,0x8A,0xC3,0x4A,0x82,0xBE,0x41,0x79,0xB9,0x38,0x71,0xB5,0x30,0x69,0xB0,0x28,0x61,0xAC,0x21,0x5A,0xA8,0x1B,0x53,0xA3,0x16,0x4D,0x9F,0x12,0x47,0x9B,0x0F,0x42,0x98,0x0F,0x3D,0x94,0x0F,0x39,0x90,0x0F,0x34,0x8C,0x0F,0x30,0x89,0x0F,0x2C,0x85,0x0F,0x28,0x81,0x0F,0x24,0x7D,0x0F,0x20,0x7A,0x0F,0x1D,0x76,0x0F,0x1A,0x72,0x0F,0x16,0x6F,0x0F,0x13,0x6B,0x0F,0x11,0x67,0x10,0x0E,0x64,0x12,0x0C,0x60,0x15,0x0A,0x5D,0x18,0x08,0x59,0x1B,0x06,0x56,0x1D,0x04,0x53,0x20,0x03,0x4F,0x23,0x02,0x4C,0x26,0x01,0x49,0x29,0x01,0x46,0x2C,0x00,0x43,0x2F,0x00,0x40,0x30,0x00,0x3F,0x31,0x00,0x3F,0x31,0x00,0x3E,0x32,0x00,0x3E,0x32,0x00,0x3D,0x33,0x00,0x3D,0x33,0x00,0x3C,0x34,0x00,0x3C,0x34,0x00,0x3B,0x35,0x01,0x3B,0x36,0x01,0x3B,0x36,0x01,0x3A,0x37,0x01,0x3A,0x37,0x01,0x39,0x38,0x01,0x39,0x39,0x01,0x38,0x39,0x02,0x38,0x3A,0x02,0x37,0x3B,0x02,0x37,0x3B,0x02,0x36,0x3C,0x02,0x36,0x3C,0x03,0x35,0x3D,0x03,0x35,0x3E,0x03,0x34,0x3F,0x03,0x34,0x3F,0x04,0x34,0x40,0x04,0x33,0x41,0x04,0x33,0x41,0x04,0x32,0x42,0x05,0x32,0x43,0x05,0x31,0x43,0x05,0x31,0x44,0x06,0x30,0x45,0x06,0x30,0x46,0x06,0x30,0x46,0x07,0x2F,0x47,0x07,0x2F,0x48,0x08,0x2E,0x49,0x08,0x2E,0x49,0x08,0x2E,0x4A,0x09,0x2D,0x4B,0x09,0x2D,0x4C,0x09,0x2C,0x4C,0x0A,0x2C,0x4D,0x0A,0x2B,0x4E,0x0B,0x2B,0x4F,0x0B,0x2B,0x4F,0x0C,0x2A,0x50,0x0C,0x2A,0x51,0x0D,0x29,0x52,0x0D,0x29,0x53,0x0D,0x29,0x53,0x0E,0x28,0x54,0x0E,0x28,0x55,0x0F,0x27,0x56,0x0F,0x27,0x57,0x10,0x27,0x58,0x10,0x26,0x58,0x11,0x26,0x59,0x11,0x26,0x5A,0x12,0x25,0x5B,0x13,0x25,0x5C,0x13,0x24,0x5D,0x14,0x24,0x5D,0x14,0x24,0x5E,0x15,0x23,0x5F,0x15,0x23,0x60,0x16,0x23,0x61,0x16,0x22,0x62,0x17,0x22,0x62,0x18,0x22,0x63,0x18,0x21,0x64,0x19,0x21,0x65,0x19,0x21,0x66,0x1A,0x20,0x67,0x1B,0x20,0x67,0x1B,0x20,0x68,0x1C,0x1F,0x69,0x1C,0x1F,0x6A,0x1D,0x1F,0x6B,0x1E,0x1E,0x6C,0x1E,0x1E,0x6D,0x1F,0x1E,0x6D,0x1F,0x1D,0x6E,0x20,0x1D,0x6F,0x21,0x1D,0x70,0x21,0x1C,0x71,0x22,0x1C,0x72,0x23,0x1C,0x73,0x23,0x1B,0x73,0x24,0x1B,0x74,0x25,0x1B,0x75,0x25,0x1A,0x76,0x26,0x1A,0x77,0x27,0x1A,0x78,0x27,0x1A,0x78,0x28,0x19,0x79,0x29,0x19,0x7A,0x29,0x19,0x7B,0x2A,0x18,0x7C,0x2B,0x18,0x7D,0x2B,0x18,0x7E,0x2C,0x18,0x7E,0x2D,0x17,0x7F,0x2D,0x17,0x80,0x2E,0x17,0x81,0x2F,0x16,0x82,0x2F,0x16,0x82,0x30,0x16,0x83,0x31,0x16,0x84,0x31,0x15,0x85,0x32,0x15,0x86,0x33,0x15,0x87,0x33,0x15,0x87,0x34,0x14,0x88,0x35,0x14,0x89,0x36,0x14,0x8A,0x36,0x14,0x8A,0x37,0x13,0x8B,0x38,0x13,0x8C,0x38,0x13,0x8D,0x39,0x13,0x8E,0x3A,0x13,0x8E,0x3A,0x12,0x8F,0x3B,0x12,0x90,0x3C,0x12,0x91,0x3C,0x12,0x91,0x3D,0x11,0x92,0x3E,0x11,0x93,0x3E,0x11,0x94,0x3F,0x11,0x94,0x40,0x11,0x95,0x40,0x10,0x96,0x41,0x10,0x97,0x42,0x10,0x97,0x42,0x10,0x98,0x43,0x10,0x99,0x44,0x0F,0x99,0x44,0x0F,0x9A,0x45,0x0F,0x9A,0x45,0x0F,0x9B,0x46,0x0F,0x9C,0x47,0x0F,0x9C,0x47,0x0E,0x9D,0x48,0x0E,0x9D,0x48,0x0E,0x9E,0x49,0x0E,0x9E,0x49,0x0E,0x9F,0x4A,0x0D,0xA0,0x4B,0x0D,0xA0,0x4B,0x0D,0xA1,0x4C,0x0D,0xA1,0x4C,0x0D,0xA2,0x4D,0x0C,0xA2,0x4E,0x0C,0xA3,0x4E,0x0C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0xE5,0xFE,0xF9,0xE7,0xFE,0xF9,0xE8,0xFE,0xF9,0xE9,0xFE,0xFA,0xEB,0xFE,0xFA,0xEC,0xFE,0xFA,0xED,0xFE,0xFB,0xEF,0xFE,0xFB,0xF0,0xFE,0xFB,0xF1,0xFE,0xFC,0xF2,0xFF,0xFC,0xF3,0xFF,0xFC,0xF5,0xFF,0xFC,0xF6,0xFF,0xFD,0xF7,0xFF,0xFD,0xF8,0xFF,0xFD,0xF9,0xFF,0xFE,0xFA,0xFF,0xFE,0xFB,0xFF,0xFE,0xFC,0xFF,0xFE,0xFC,0xFF,0xFF,0xFD,0xFF,0xFF,0xFE}; +unsigned char plasma_data[] = {0x00,0x00,0x00,0x03,0x00,0x00,0x05,0x00,0x00,0x09,0x00,0x00,0x0E,0x00,0x00,0x12,0x00,0x00,0x17,0x00,0x00,0x1C,0x00,0x00,0x22,0x00,0x00,0x27,0x00,0x00,0x2C,0x00,0x00,0x32,0x00,0x00,0x37,0x00,0x00,0x3C,0x00,0x00,0x41,0x00,0x00,0x45,0x00,0x00,0x4A,0x00,0x00,0x4D,0x00,0x00,0x51,0x00,0x00,0x53,0x00,0x00,0x55,0x00,0x00,0x55,0x00,0x02,0x55,0x02,0x03,0x55,0x03,0x06,0x55,0x03,0x07,0x55,0x05,0x09,0x55,0x06,0x0C,0x55,0x06,0x0F,0x55,0x07,0x10,0x55,0x09,0x13,0x55,0x0A,0x16,0x55,0x0C,0x1A,0x55,0x0C,0x1D,0x54,0x0E,0x20,0x53,0x10,0x23,0x54,0x11,0x26,0x53,0x13,0x2A,0x52,0x14,0x2E,0x51,0x15,0x31,0x50,0x17,0x35,0x50,0x19,0x38,0x4E,0x1A,0x3D,0x4D,0x1C,0x40,0x4D,0x1D,0x44,0x4C,0x1F,0x47,0x4B,0x21,0x4C,0x4A,0x23,0x4F,0x49,0x24,0x54,0x48,0x25,0x57,0x47,0x28,0x5B,0x46,0x29,0x5F,0x45,0x2B,0x62,0x44,0x2D,0x66,0x44,0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No newline at end of file diff --git a/http.c b/http.c new file mode 100755 index 0000000..74bafa2 --- /dev/null +++ b/http.c @@ -0,0 +1,913 @@ +/** + * Powder Toy - HTTP Library + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + + +#include +#include +#include +#ifndef MACOSX +#include +#endif +#include +#ifdef WIN32 +#define _WIN32_WINNT 0x0501 +//#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "version.h" +#include "http.h" +#include "md5.h" + +#ifdef WIN32 +#define PERROR SOCKET_ERROR +#define PERRNO WSAGetLastError() +#define PEAGAIN WSAEWOULDBLOCK +#define PEINTR WSAEINTR +#define PEINPROGRESS WSAEINPROGRESS +#define PEALREADY WSAEALREADY +#define PCLOSE closesocket +#else +#define PERROR -1 +#define PERRNO errno +#define PEAGAIN EAGAIN +#define PEINTR EINTR +#define PEINPROGRESS EINPROGRESS +#define PEALREADY EALREADY +#define PCLOSE close +#endif + +static int http_up = 0; +static long http_timeout = 15; +static int http_use_proxy = 0; +static struct sockaddr_in http_proxy; + +static char *mystrdup(char *s) +{ + char *x; + if(s) { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; + } + return s; +} + +static int splituri(char *uri, char **host, char **path) +{ + char *p=uri,*q,*x,*y; + if(!strncmp(p, "http://", 7)) + p += 7; + q = strchr(p, '/'); + if(!q) + q = p + strlen(p); + x = malloc(q-p+1); + if(*q) + y = mystrdup(q); + else + y = mystrdup("/"); + strncpy(x, p, q-p); + x[q-p] = 0; + if(q==p || x[q-p-1]==':') { + free(x); + free(y); + return 1; + } + *host = x; + *path = y; + return 0; +} + +static char *getserv(char *host) +{ + char *q, *x = mystrdup(host); + q = strchr(x, ':'); + if(q) + *q = 0; + return x; +} + +static char *getport(char *host) +{ + char *p, *q; + q = strchr(host, ':'); + if(q) + p = mystrdup(q+1); + else + p = mystrdup("80"); + return p; +} + +static int resolve(char *dns, char *srv, struct sockaddr_in *addr) +{ + struct addrinfo hnt, *res = 0; + if(http_use_proxy) { + memcpy(addr, &http_proxy, sizeof(struct sockaddr_in)); + return 0; + } + memset(&hnt, 0, sizeof(hnt)); + hnt.ai_family = AF_INET; + hnt.ai_socktype = SOCK_STREAM; + if(getaddrinfo(dns, srv, &hnt, &res)) + return 1; + if(res) { + if(res->ai_family != AF_INET) { + freeaddrinfo(res); + return 1; + } + memcpy(addr, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); + return 0; + } + return 1; +} + +void http_init(char *proxy) +{ + char *host, *port; +#ifdef WIN32 + WSADATA wsadata; + if(!WSAStartup(MAKEWORD(2,2), &wsadata)) + http_up = 1; +#else + signal(SIGPIPE, SIG_IGN); + http_up = 1; +#endif + if(proxy) { + host = getserv(proxy); + port = getport(proxy); + if(resolve(host, port, &http_proxy)) + http_up = 0; + else + http_use_proxy = 1; + free(host); + free(port); + } +} + +void http_done(void) +{ +#ifdef WIN32 + WSACleanup(); +#endif + http_up = 0; +} + +#define CHUNK 4096 + +#define HTS_STRT 0 +#define HTS_RSLV 1 +#define HTS_CONN 2 +#define HTS_IDLE 3 +#define HTS_XMIT 4 +#define HTS_RECV 5 +#define HTS_DONE 6 +struct http_ctx { + int state; + time_t last; + int keep; + int ret; + char *host, *path; + char *thdr; + int thlen; + char *txd; + int txdl; + struct sockaddr_in addr; + char *tbuf; + int tlen, tptr; + char *hbuf; + int hlen, hptr; + char *rbuf; + int rlen, rptr; + int chunked, chunkhdr, rxtogo, contlen, cclose; + int fd; + char *fdhost; +}; +void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep) +{ + struct http_ctx *cx = ctx; + if(!ctx) { + ctx = calloc(1, sizeof(struct http_ctx)); + cx = ctx; + cx->fd = PERROR; + } + + if(!cx->hbuf) { + cx->hbuf = malloc(256); + cx->hlen = 256; + } + + if(!http_up) { + cx->ret = 604; + cx->state = HTS_DONE; + return ctx; + } + + if(cx->state!=HTS_STRT && cx->state!=HTS_IDLE) { + fprintf(stderr, "HTTP: unclean request restart state.\n"); + exit(1); + } + + cx->keep = keep; + cx->ret = 600; + if(splituri(uri, &cx->host, &cx->path)) { + cx->ret = 601; + cx->state = HTS_DONE; + return ctx; + } + if(http_use_proxy) { + free(cx->path); + cx->path = mystrdup(uri); + } + if(cx->fdhost && strcmp(cx->host, cx->fdhost)) { + free(cx->fdhost); + cx->fdhost = NULL; + PCLOSE(cx->fd); + cx->fd = PERROR; + cx->state = HTS_STRT; + } + if(data) { + if(!dlen) + dlen = strlen(data); + cx->txd = malloc(dlen); + memcpy(cx->txd, data, dlen); + cx->txdl = dlen; + } else + cx->txdl = 0; + + cx->contlen = 0; + cx->chunked = 0; + cx->chunkhdr = 0; + cx->rxtogo = 0; + cx->cclose = 0; + + cx->tptr = 0; + cx->tlen = 0; + + cx->last = time(NULL); + + return ctx; +} + +void http_async_add_header(void *ctx, char *name, char *data) +{ + struct http_ctx *cx = ctx; + cx->thdr = realloc(cx->thdr, cx->thlen + strlen(name) + strlen(data) + 4); + cx->thlen += sprintf(cx->thdr+cx->thlen, "%s: %s\n", name, data); +} + +static void process_header(struct http_ctx *cx, char *str) +{ + char *p; + if(cx->chunkhdr) { + p = strchr(str, ';'); + if(p) + *p = 0; + cx->rxtogo = strtoul(str, NULL, 16); + cx->chunkhdr = 0; + if(!cx->rxtogo) + cx->chunked = 0; + } + if(!str[0]) { + cx->rxtogo = cx->contlen; + cx->chunkhdr = cx->chunked; + if(!cx->contlen && !cx->chunked && cx->ret!=100) + cx->state = HTS_DONE; + return; + } + if(!strncmp(str, "HTTP/", 5)) { + p = strchr(str, ' '); + if(!p) { + cx->ret = 603; + cx->state = HTS_DONE; + return; + } + p++; + cx->ret = atoi(p); + return; + } + if(!strncmp(str, "Content-Length: ", 16)) { + cx->contlen = atoi(str+16); + return; + } + if(!strcmp(str, "Transfer-Encoding: chunked")) { + cx->chunked = 1; + return; + } + if(!strcmp(str, "Connection: close")) { + cx->cclose = 1; + return; + } +} + +static void process_byte(struct http_ctx *cx, char ch) +{ + if(cx->rxtogo) { + cx->rxtogo--; + + if(!cx->rbuf) { + cx->rbuf = malloc(256); + cx->rlen = 256; + } + if(cx->rptr >= cx->rlen-1) { + cx->rlen *= 2; + cx->rbuf = realloc(cx->rbuf, cx->rlen); + } + cx->rbuf[cx->rptr++] = ch; + + if(!cx->rxtogo && !cx->chunked) + cx->state = HTS_DONE; + } else { + if(ch == '\n') { + cx->hbuf[cx->hptr] = 0; + process_header(cx, cx->hbuf); + cx->hptr = 0; + } else if(ch != '\r') { + if(cx->hptr >= cx->hlen-1) { + cx->hlen *= 2; + cx->hbuf = realloc(cx->hbuf, cx->hlen); + } + cx->hbuf[cx->hptr++] = ch; + } + } +} + +int http_async_req_status(void *ctx) +{ + struct http_ctx *cx = ctx; + char *dns,*srv,buf[CHUNK]; + int tmp, i; + time_t now = time(NULL); +#ifdef WIN32 + unsigned long tmp2; +#endif + + switch(cx->state) { + case HTS_STRT: + dns = getserv(cx->host); + srv = getport(cx->host); + if(resolve(dns, srv, &cx->addr)) { + free(dns); + free(srv); + cx->state = HTS_DONE; + cx->ret = 602; + return 1; + } + free(dns); + free(srv); + cx->state = HTS_RSLV; + return 0; + case HTS_RSLV: + cx->state = HTS_CONN; + cx->last = now; + return 0; + case HTS_CONN: + if(cx->fd == PERROR) { + cx->fd = socket(AF_INET, SOCK_STREAM, 0); + if(cx->fd == PERROR) + goto fail; + cx->fdhost = mystrdup(cx->host); +#ifdef WIN32 + tmp2 = 1; + if(ioctlsocket(cx->fd, FIONBIO, &tmp2) == SOCKET_ERROR) + goto fail; +#else + tmp = fcntl(cx->fd, F_GETFL); + if(tmp < 0) + goto fail; + if(fcntl(cx->fd, F_SETFL, tmp|O_NONBLOCK) < 0) + goto fail; +#endif + } + if(!connect(cx->fd, (struct sockaddr *)&cx->addr, sizeof(cx->addr))) + cx->state = HTS_IDLE; +#ifdef WIN32 + else if(PERRNO==WSAEISCONN) + cx->state = HTS_IDLE; +#endif +#ifdef MACOSX + else if(PERRNO==EISCONN) + cx->state = HTS_IDLE; +#endif + else if(PERRNO!=PEINPROGRESS && PERRNO!=PEALREADY +#ifdef WIN32 + && PERRNO!=PEAGAIN && PERRNO!=WSAEINVAL +#endif + ) + goto fail; + if(now-cx->last>http_timeout) + goto timeout; + return 0; + case HTS_IDLE: + if(cx->txdl) { + // generate POST + cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 121 + cx->txdl + cx->thlen); + cx->tptr = 0; + cx->tlen = 0; + cx->tlen += sprintf(cx->tbuf+cx->tlen, "POST %s HTTP/1.1\n", cx->path); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host); + if(!cx->keep) + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n"); + if(cx->thdr) { + memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen); + cx->tlen += cx->thlen; + free(cx->thdr); + cx->thdr = NULL; + cx->thlen = 0; + } + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Content-Length: %d\n", cx->txdl); +#ifdef BETA + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); +#else + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dS%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); +#endif + cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n"); + memcpy(cx->tbuf+cx->tlen, cx->txd, cx->txdl); + cx->tlen += cx->txdl; + free(cx->txd); + cx->txd = NULL; + cx->txdl = 0; + } else { + // generate GET + cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 89 + cx->thlen); + cx->tptr = 0; + cx->tlen = 0; + cx->tlen += sprintf(cx->tbuf+cx->tlen, "GET %s HTTP/1.1\n", cx->path); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host); + if(cx->thdr) { + memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen); + cx->tlen += cx->thlen; + free(cx->thdr); + cx->thdr = NULL; + cx->thlen = 0; + } + if(!cx->keep) + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n"); +#ifdef BETA + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); +#else + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dS%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); +#endif + cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n"); + } + cx->state = HTS_XMIT; + cx->last = now; + return 0; + case HTS_XMIT: + tmp = send(cx->fd, cx->tbuf+cx->tptr, cx->tlen-cx->tptr, 0); + if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR) + goto fail; + if(tmp!=PERROR) { + cx->tptr += tmp; + if(cx->tptr == cx->tlen) { + cx->tptr = 0; + cx->tlen = 0; + if(cx->tbuf) + free(cx->tbuf); + cx->state = HTS_RECV; + } + cx->last = now; + } + if(now-cx->last>http_timeout) + goto timeout; + return 0; + case HTS_RECV: + tmp = recv(cx->fd, buf, CHUNK, 0); + if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR) + goto fail; + if(tmp!=PERROR) { + for(i=0;istate == HTS_DONE) + return 1; + } + cx->last = now; + } + if(now-cx->last>http_timeout) + goto timeout; + return 0; + case HTS_DONE: + return 1; + } + return 0; + +fail: + cx->ret = 600; + cx->state = HTS_DONE; + return 1; + +timeout: + cx->ret = 605; + cx->state = HTS_DONE; + return 1; +} + +char *http_async_req_stop(void *ctx, int *ret, int *len) +{ + struct http_ctx *cx = ctx; + char *rxd; + + if(cx->state != HTS_DONE) + while(!http_async_req_status(ctx)) ; + + if(cx->host) { + free(cx->host); + cx->host = NULL; + } + if(cx->path) { + free(cx->path); + cx->path = NULL; + } + if(cx->txd) { + free(cx->txd); + cx->txd = NULL; + cx->txdl = 0; + } + if(cx->hbuf) { + free(cx->hbuf); + cx->hbuf = NULL; + } + if(cx->thdr) { + free(cx->thdr); + cx->thdr = NULL; + cx->thlen = 0; + } + + if(ret) + *ret = cx->ret; + if(len) + *len = cx->rptr; + if(cx->rbuf) + cx->rbuf[cx->rptr] = 0; + rxd = cx->rbuf; + cx->rbuf = NULL; + cx->rlen = 0; + cx->rptr = 0; + cx->contlen = 0; + + if(!cx->keep) + http_async_req_close(ctx); + else if(cx->cclose) { + PCLOSE(cx->fd); + cx->fd = PERROR; + if(cx->fdhost) { + free(cx->fdhost); + cx->fdhost = NULL; + } + cx->state = HTS_STRT; + } else + cx->state = HTS_IDLE; + + return rxd; +} + +void http_async_get_length(void *ctx, int *total, int *done) +{ + struct http_ctx *cx = ctx; + if(done) + *done = cx->rptr; + if(total) + *total = cx->contlen; +} + +void http_async_req_close(void *ctx) +{ + struct http_ctx *cx = ctx; + void *tmp; + if(cx->host) { + cx->keep = 1; + tmp = http_async_req_stop(ctx, NULL, NULL); + if(tmp) + free(tmp); + } + if(cx->fdhost) + free(cx->fdhost); + PCLOSE(cx->fd); + free(ctx); +} + +char *http_simple_get(char *uri, int *ret, int *len) +{ + void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0); + if(!ctx) { + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; + } + return http_async_req_stop(ctx, ret, len); +} +static char hex[] = "0123456789abcdef"; +void http_auth_headers(void *ctx, char *user, char *pass) +{ + char *tmp; + int i; + unsigned char hash[16]; + unsigned int m; + struct md5_context md5; + + if(user) { + http_async_add_header(ctx, "X-Auth-User", user); + if(pass) { + md5_init(&md5); + md5_update(&md5, (unsigned char *)user, strlen(user)); + md5_update(&md5, (unsigned char *)"-", 1); + m = 0; + + md5_update(&md5, (unsigned char *)pass, strlen(pass)); + md5_final(hash, &md5); + tmp = malloc(33); + for(i=0;i<16;i++) { + tmp[i*2] = hex[hash[i]>>4]; + tmp[i*2+1] = hex[hash[i]&15]; + } + tmp[32] = 0; + http_async_add_header(ctx, "X-Auth-Hash", tmp); + free(tmp); + } + } +} +char *http_auth_get(char *uri, char *user, char *pass, int *ret, int *len) +{ + void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0); + + if(!ctx) { + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; + } + return http_async_req_stop(ctx, ret, len); +} + +char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len) +{ + void *ctx = http_async_req_start(NULL, uri, data, dlen, 0); + if(!ctx) { + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; + } + return http_async_req_stop(ctx, ret, len); +} + +char *http_ret_text(int ret) +{ + switch(ret) { + case 100: return "Continue"; + case 101: return "Switching Protocols"; + case 102: return "Processing"; + + case 200: return "OK"; + case 201: return "Created"; + case 202: return "Accepted"; + case 203: return "Non-Authoritative Information"; + case 204: return "No Content"; + case 205: return "Reset Content"; + case 206: return "Partial Content"; + case 207: return "Multi-Status"; + + case 300: return "Multiple Choices"; + case 301: return "Moved Permanently"; + case 302: return "Found"; + case 303: return "See Other"; + case 304: return "Not Modified"; + case 305: return "Use Proxy"; + case 306: return "Switch Proxy"; + case 307: return "Temporary Redirect"; + + case 400: return "Bad Request"; + case 401: return "Unauthorized"; + case 402: return "Payment Required"; + case 403: return "Forbidden"; + case 404: return "Not Found"; + case 405: return "Method Not Allowed"; + case 406: return "Not Acceptable"; + case 407: return "Proxy Authentication Required"; + case 408: return "Request Timeout"; + case 409: return "Conflict"; + case 410: return "Gone"; + case 411: return "Length Required"; + case 412: return "Precondition Failed"; + case 413: return "Request Entity Too Large"; + case 414: return "Request URI Too Long"; + case 415: return "Unsupported Media Type"; + case 416: return "Requested Range Not Satisfiable"; + case 417: return "Expectation Failed"; + case 422: return "Unprocessable Entity"; + case 423: return "Locked"; + case 424: return "Failed Dependency"; + case 425: return "Unordered Collection"; + case 426: return "Upgrade Required"; + + case 500: return "Internal Server Error"; + case 501: return "Not Implemented"; + case 502: return "Bad Gateway"; + case 503: return "Service Unavailable"; + case 504: return "Gateway Timeout"; + case 505: return "HTTP Version Not Supported"; + case 506: return "Variant Also Negotiates"; + case 507: return "Insufficient Storage"; + case 509: return "Bandwidth Limit Exceeded"; + case 510: return "Not Extended"; + + case 600: return "Internal Client Error"; + case 601: return "Unsupported Protocol"; + case 602: return "Server Not Found"; + case 603: return "Malformed Response"; + case 604: return "Network Not Available"; + case 605: return "Request Timed Out"; + default: return "Unknown Status Code"; + } +} +char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, int *ret, int *len) +{ + void *ctx; + char *data = NULL, *tmp, *p; + int dlen = 0, i, j; + unsigned char hash[16]; + unsigned char boundary[32], ch; + int blen = 0; + unsigned int map[62], m; + struct md5_context md5; + //struct md5_context md52; + int own_plen = 0; + + if(names) { + if(!plens) { + own_plen = 1; + for(i=0;names[i];i++) ; + plens = calloc(i, sizeof(int)); + for(i=0;names[i];i++) + plens[i] = strlen(parts[i]); + } + + retry: + if(blen >= 31) + goto fail; + memset(map, 0, 62*sizeof(int)); + for(i=0;names[i];i++) { + for(j=0;j='0' && ch<='9') + map[ch-'0']++; + else if(ch>='A' && ch<='Z') + map[ch-'A'+10]++; + else if(ch>='a' && ch<='z') + map[ch-'a'+36]++; + } + } + m = ~0; + j = 61; + for(i=0;i<62;i++) + if(map[i]>4]; + tmp[i*2+1] = hex[hash[i]&15]; + } + tmp[32] = 0; + http_async_add_header(ctx, "X-Auth-Hash", tmp); + free(tmp); + } + } + + if(data) { + tmp = malloc(32+strlen((char *)boundary)); + sprintf(tmp, "multipart/form-data, boundary=%s", boundary); + http_async_add_header(ctx, "Content-type", tmp); + free(tmp); + free(data); + } + + if(own_plen) + free(plens); + return http_async_req_stop(ctx, ret, len); + +fail: + if(data) + free(data); + if(own_plen) + free(plens); + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; +} diff --git a/http.h b/http.h new file mode 100755 index 0000000..2ad7ccc --- /dev/null +++ b/http.h @@ -0,0 +1,43 @@ +/** + * Powder Toy - HTTP Library (Header) + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +#ifndef HTTP_H +#define HTTP_H + +void http_init(char *proxy); +void http_done(void); + +char *http_simple_get(char *uri, int *ret, int *len); +char *http_auth_get(char *uri, char *user, char *pass, int *ret, int *len); +char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len); + +void http_auth_headers(void *ctx, char *user, char *pass); + +void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep); +void http_async_add_header(void *ctx, char *name, char *data); +int http_async_req_status(void *ctx); +void http_async_get_length(void *ctx, int *total, int *done); +char *http_async_req_stop(void *ctx, int *ret, int *len); +void http_async_req_close(void *ctx); + +char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, int *ret, int *len); + +char *http_ret_text(int ret); + +#endif diff --git a/icon.h b/icon.h new file mode 100755 index 0000000..89b2c7f --- /dev/null +++ b/icon.h @@ -0,0 +1,22 @@ +/** + * Powder Toy - Main source + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +static unsigned char app_icon[] = { 0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0x68,0x79,0x91,0xFF,0xD3,0xD9,0xE0,0xFF,0x68,0x79,0x91,0xFF,0xD3,0xD9,0xE0,0xFF,0x68,0x79,0x91,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x05,0x06,0x06,0xFF,0x09,0x09,0x0A,0xFF,0x2F,0x08,0x08,0xFF,0x56,0x06,0x07,0xFF,0x23,0x06,0x06,0xFF,0x85,0x02,0x06,0xFF,0xE5,0x02,0x07,0xFF,0xF2,0x1E,0x08,0xFF,0xED,0x0A,0x08,0xFF,0x60,0x07,0x08,0xFF,0x5F,0x08,0x08,0xFF,0x68,0x08,0x08,0xFF,0x18,0x07,0x08,0xFF,0x05,0x04,0x04,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0xB6,0x00,0x00,0xFF,0xD3,0x00,0x00,0xFF,0xEE,0x00,0x00,0xFF,0xF9,0x00,0x00,0xFF,0x91,0x00,0x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,0x30,0xD5,0xFF,0x1F,0x30,0xD5,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x79,0x79,0x79,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF }; +static unsigned char app_icon_w32[] = { 0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x44,0x47,0x49,0x00,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x44,0x46,0x48,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x86,0x88,0x8A,0xFF,0xD8,0xDE,0xE6,0xFF,0xD1,0xD7,0xDF,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x81,0x84,0x88,0xFF,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x83,0x85,0x89,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1E,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x14,0x00,0x00,0xFF,0xE1,0x01,0x00,0xFF,0xF4,0x03,0x00,0xFF,0x24,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x86,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x0F,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x36,0x01,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x00,0x00,0xFF,0xE7,0x0A,0x01,0xFF,0xFF,0x07,0x01,0xFF,0x41,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x00,0x00,0xFF,0x16,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x0B,0x00,0x00,0xFF,0x55,0x02,0x00,0xFF,0x04,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x39,0x00,0x00,0xFF,0xF8,0x1B,0x02,0xFF,0xFF,0x2F,0x03,0xFF,0x52,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1C,0x00,0x00,0xFF,0x5C,0x01,0x00,0xFF,0x09,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x36,0x01,0x00,0xFF,0xAE,0x04,0x01,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x50,0x00,0x00,0xFF,0xFE,0x44,0x02,0xFF,0xFF,0x5C,0x03,0xFF,0x60,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x12,0x00,0x00,0xFF,0x9F,0x02,0x00,0xFF,0x49,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x73,0x04,0x00,0xFF,0xEC,0x09,0x01,0xFF,0x2B,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x13,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x04,0x00,0x00,0xFF,0x04,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x4E,0x06,0x00,0xFF,0xFF,0xC1,0x08,0xFF,0xFD,0x9A,0x07,0xFF,0x49,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8B,0x01,0x00,0xFF,0xD5,0x03,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0xB7,0x0D,0x01,0xFF,0xFF,0x0F,0x02,0xFF,0xDE,0x00,0x00,0xFF,0xAB,0x00,0x00,0xFF,0xA5,0x01,0x00,0xFF,0x3D,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8B,0x35,0x03,0xFF,0xFF,0xF0,0x0E,0xFF,0xDF,0x4B,0x01,0xFF,0x14,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x55,0x00,0x00,0xFF,0xFF,0x05,0x01,0xFF,0x73,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1B,0x00,0x00,0xFF,0xE5,0x0F,0x01,0xFF,0xFF,0x0D,0x02,0xFF,0xFF,0x04,0x01,0xFF,0xFF,0x03,0x00,0xFF,0xFF,0x01,0x00,0xFF,0x8F,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1B,0x00,0x00,0xFF,0xD9,0x47,0x03,0xFF,0xFF,0x92,0x06,0xFF,0xAF,0x12,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x20,0x00,0x00,0xFF,0xE5,0x08,0x01,0xFF,0xD1,0x04,0x01,0xFF,0x0E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x30,0x01,0x00,0xFF,0xF6,0x47,0x04,0xFF,0xFF,0x1F,0x02,0xFF,0xFF,0x03,0x01,0xFF,0xFF,0x06,0x01,0xFF,0xFF,0x03,0x00,0xFF,0xC7,0x01,0x00,0xFF,0x1F,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x06,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x38,0x02,0x00,0xFF,0xFB,0x72,0x07,0xFF,0xFF,0x5A,0x03,0xFF,0x73,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xA1,0x02,0x00,0xFF,0xFF,0x0C,0x03,0xFF,0x7B,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3B,0x06,0x00,0xFF,0xFF,0xBB,0x0C,0xFF,0xFF,0x56,0x04,0xFF,0xFF,0x00,0x01,0xFF,0xFF,0x10,0x03,0xFF,0xFF,0x02,0x01,0xFF,0xDE,0x01,0x00,0xFF,0x34,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x05,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3B,0x03,0x00,0xFF,0xFC,0x83,0x06,0xFF,0xFF,0x71,0x03,0xFF,0x83,0x05,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFB,0x18,0x03,0xFF,0xFF,0x0E,0x02,0xFF,0xB9,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x21,0x01,0x00,0xFF,0xE8,0xB9,0x0F,0xFF,0xFF,0x8F,0x0C,0xFF,0xFF,0x02,0x00,0xFF,0xFF,0x3C,0x04,0xFF,0xFF,0x16,0x02,0xFF,0xFD,0x00,0x00,0xFF,0x63,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x40,0x0B,0x00,0xFF,0xFE,0xAD,0x06,0xFF,0xFF,0xC9,0x06,0xFF,0xCC,0x45,0x02,0xFF,0x08,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x49,0x03,0xFF,0xFF,0x7E,0x03,0xFF,0xFF,0x45,0x01,0xFF,0x67,0x05,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x09,0x00,0x00,0xFF,0xCC,0xA0,0x08,0xFF,0xFB,0xAA,0x0A,0xFF,0xC9,0x00,0x00,0xFF,0xFE,0x6B,0x03,0xFF,0xFF,0x79,0x02,0xFF,0xF9,0x0A,0x00,0xFF,0x4C,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x08,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3F,0x14,0x00,0xFF,0xFC,0xDF,0x10,0xFF,0xFF,0xFF,0x10,0xFF,0xFA,0xCD,0x14,0xFF,0x46,0x0C,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x7F,0x03,0xFF,0xFF,0xFF,0x06,0xFF,0xFF,0xE7,0x03,0xFF,0xD5,0x39,0x01,0xFF,0x0E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x06,0x00,0xFF,0xEA,0xCF,0x17,0xFF,0xE2,0xA6,0x10,0xFF,0x32,0x00,0x00,0xFF,0xCB,0x80,0x06,0xFF,0xFF,0xF4,0x09,0xFF,0xD8,0x44,0x00,0xFF,0x10,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x44,0x21,0x00,0xFF,0xFD,0xE9,0x1C,0xFF,0xFF,0xD6,0x09,0xFF,0xFF,0xFF,0x28,0xFF,0xB4,0x75,0x04,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x8D,0x03,0xFF,0xFF,0xFF,0x41,0xFF,0xFF,0xFF,0x3F,0xFF,0xFF,0x7E,0x01,0xFF,0x4C,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x49,0x30,0x04,0xFF,0xFF,0xFC,0x5A,0xFF,0xB0,0x7E,0x14,0xFF,0x00,0x00,0x00,0xFF,0x89,0x66,0x0F,0xFF,0xFF,0xFF,0x6B,0xFF,0xE6,0xA7,0x1E,0xFF,0x1E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x6F,0x5A,0x18,0xFF,0xFF,0xFE,0x70,0xFF,0xCD,0x6C,0x04,0xFF,0xE8,0xB5,0x27,0xFF,0xFE,0xF3,0x60,0xFF,0x6E,0x3D,0x08,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xDB,0x8A,0x26,0xFF,0xFF,0xFF,0xD5,0xFF,0xFF,0xFF,0xD8,0xFF,0xFF,0xCF,0x3A,0xFF,0x94,0x12,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x15,0x0A,0x01,0xFF,0xBF,0xAC,0x7E,0xFF,0xFF,0xFF,0xDE,0xFF,0x82,0x5F,0x20,0xFF,0x00,0x00,0x00,0xFF,0x67,0x5B,0x28,0xFF,0xFF,0xFF,0xF3,0xFF,0xFF,0xF1,0xAA,0xFF,0x5D,0x2E,0x07,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x18,0x0D,0x02,0xFF,0xD0,0xC0,0x90,0xFF,0xFF,0xFF,0xF4,0xFF,0x92,0x61,0x27,0xFF,0x72,0x3F,0x0F,0xFF,0xFF,0xFF,0xE2,0xFF,0xFA,0xE5,0xAE,0xFF,0x80,0x4B,0x19,0xFF,0x02,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF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0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x8B,0x78,0x4E,0xFF,0x00,0x00,0x00,0xFF,0xCC,0xAE,0x7E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x8F,0x74,0x38,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x24,0x14,0x03,0xFF,0x8C,0x7E,0x44,0xFF,0xA2,0x8E,0x5D,0xFF,0x5B,0x37,0x17,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x71,0x46,0x1E,0xFF,0xCB,0xA4,0x71,0xFF,0xAC,0x93,0x66,0xFF,0x17,0x0E,0x04,0xFF,0x00,0x00,0x00,0xFF,0x30,0x23,0x0A,0xFF,0xBF,0xA4,0x60,0xFF,0xC4,0xAC,0x78,0xFF,0x43,0x34,0x1A,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x5C,0x3D,0x18,0xFF,0xC9,0xA9,0x6F,0xFF,0xB8,0x94,0x63,0xFF,0x2A,0x19,0x07,0xFF,0x00,0x00,0x00,0xFF,0x53,0x3B,0x16,0xFF,0xC7,0xB6,0x70,0xFF,0xBD,0xA2,0x66,0xFF,0x2C,0x1C,0x09,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x47,0x14,0x14,0xFF,0x47,0x14,0x14,0xFF,0x00,0x00,0x00,0xFF,0x1F,0x30,0xD6,0xFF,0x1F,0x30,0xD6,0xFF,0x00,0x00,0x00,0xFF,0xF7,0x0F,0x00,0xFF,0xF7,0x0F,0x00,0xFF,0x00,0x00,0x00,0xFF,0xC8,0x47,0x0E,0xFF,0xC8,0x47,0x0E,0xFF,0x00,0x00,0x00,0xFF,0x20,0xE6,0x0F,0xFF,0x20,0xE6,0x0F,0xFF,0x00,0x00,0x00,0xFF,0xEB,0xF5,0x22,0xFF,0xEB,0xF5,0x22,0xFF,0x00,0x00,0x00,0xFF,0x40,0x40,0x40,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0x79,0x79,0x79,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x44,0x46,0x48,0x00,0x7A,0x7D,0x81,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x83,0x86,0x8A,0xFF,0x86,0x89,0x8C,0xFF,0x89,0x8C,0x8F,0xFF,0x87,0x8A,0x8F,0xFF,0x85,0x87,0x8B,0xFF,0x82,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x44,0x46,0x48,0x00,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00 }; \ No newline at end of file diff --git a/md5.c b/md5.c new file mode 100755 index 0000000..874d2c1 --- /dev/null +++ b/md5.c @@ -0,0 +1,224 @@ +// based on public-domain code from Colin Plumb (1993) +#include +#include "md5.h" + +static unsigned getu32(const unsigned char *addr) +{ + return (((((unsigned long)addr[3] << 8) | addr[2]) << 8) | addr[1]) << 8 | addr[0]; +} + +static void putu32(unsigned data, unsigned char *addr) +{ + addr[0] = (unsigned char)data; + addr[1] = (unsigned char)(data >> 8); + addr[2] = (unsigned char)(data >> 16); + addr[3] = (unsigned char)(data >> 24); +} + +void md5_init(struct md5_context *ctx) +{ + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bits[0] = 0; + ctx->bits[1] = 0; +} + +void md5_update(struct md5_context *ctx, unsigned char const *buf, unsigned len) +{ + unsigned t; + + // update bit count + t = ctx->bits[0]; + if((ctx->bits[0] = (t + ((unsigned)len << 3)) & 0xffffffff) < t) + ctx->bits[1]++; // carry + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; + + // use leading data to top up the buffer + + if(t) { + unsigned char *p = ctx->in + t; + + t = 64-t; + if (len < t) { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + md5_transform(ctx->buf, ctx->in); + buf += t; + len -= t; + } + + // following 64-byte chunks + + while(len >= 64) { + memcpy(ctx->in, buf, 64); + md5_transform(ctx->buf, ctx->in); + buf += 64; + len -= 64; + } + + // save rest of bytes for later + + memcpy(ctx->in, buf, len); +} + +void md5_final(unsigned char digest[16], struct md5_context *ctx) +{ + unsigned count; + unsigned char *p; + + // #bytes mod64 + count = (ctx->bits[0] >> 3) & 0x3F; + + // first char of padding = 0x80 + p = ctx->in + count; + *p++ = 0x80; + + // calculate # of bytes to pad + count = 64 - 1 - count; + + // Pad out to 56 mod 64 + if(count < 8) { + // we need to finish a whole block before padding + memset(p, 0, count); + md5_transform(ctx->buf, ctx->in); + memset(ctx->in, 0, 56); + } else { + // just pad to 56 bytes + memset(p, 0, count-8); + } + + // append length & final transform + putu32(ctx->bits[0], ctx->in + 56); + putu32(ctx->bits[1], ctx->in + 60); + + md5_transform(ctx->buf, ctx->in); + putu32(ctx->buf[0], digest); + putu32(ctx->buf[1], digest + 4); + putu32(ctx->buf[2], digest + 8); + putu32(ctx->buf[3], digest + 12); + memset(ctx, 0, sizeof(ctx)); +} + +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w &= 0xffffffff, w = w<>(32-s), w += x ) + +void md5_transform(unsigned buf[4], const unsigned char inraw[64]) +{ + unsigned a, b, c, d; + unsigned in[16]; + int i; + + for (i = 0; i < 16; ++i) + in[i] = getu32 (inraw + 4 * i); + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} + +static char hex[] = "0123456789abcdef"; +void md5_ascii(char *result, unsigned char const *buf, unsigned len) +{ + struct md5_context md5; + unsigned char hash[16]; + int i; + + if(len==0) + len = strlen((char *)buf); + + md5_init(&md5); + md5_update(&md5, buf, len); + md5_final(hash, &md5); + + for(i=0;i<16;i++) { + result[i*2] = hex[(hash[i]>>4)&0xF]; + result[i*2+1] = hex[hash[i]&0x0F]; + } + result[32] = 0; +} diff --git a/md5.h b/md5.h new file mode 100755 index 0000000..3f675d6 --- /dev/null +++ b/md5.h @@ -0,0 +1,17 @@ +#ifndef MD5_H +#define MD5_H + +struct md5_context { + unsigned buf[4]; + unsigned bits[2]; + unsigned char in[64]; +}; + +void md5_init(struct md5_context *context); +void md5_update(struct md5_context *context, unsigned char const *buf, unsigned len); +void md5_final(unsigned char digest[16], struct md5_context *context); +void md5_transform(unsigned buf[4], const unsigned char in[64]); + +void md5_ascii(char *result, unsigned char const *buf, unsigned len); + +#endif diff --git a/powder.c b/powder.c new file mode 100755 index 0000000..3102a8f --- /dev/null +++ b/powder.c @@ -0,0 +1,8429 @@ +/** + * Powder Toy - Main source + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#ifdef OCL +#include +#endif +//#include +#ifdef MT +#include +#include +#endif + +#ifdef WIN32 +#include +#else +#include +#include +#endif + + +#include "version.h" +#include "http.h" +#include "md5.h" +#include "update.h" + +#define SERVER "powder.hardwired.org.uk" + +#undef PLOSS + +#ifdef MENUV3 +#define MENUSIZE 40 +#else +#define MENUSIZE 20 +#endif +#define BARSIZE 14 +#define XRES 612 +#define YRES 384 +#define NPART XRES*YRES + +#define ZSIZE_D 16 +#define ZFACTOR_D 8 +unsigned char ZFACTOR = 256/ZSIZE_D;//ZFACTOR_D; +unsigned char ZSIZE = ZSIZE_D; + +#define CELL 4 +#define ISTP (CELL/2) +#define CFDS (4.0f/CELL) + +typedef unsigned char uint8; + +#ifdef HEAT_ENABLE +#include "hmap.h" +#endif + +#ifdef PIX16 +#define PIXELSIZE 2 +typedef unsigned short pixel; +#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) +#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) +#define PIXR(x) (((x)>>8)&0xF8) +#define PIXG(x) (((x)>>3)&0xFC) +#define PIXB(x) (((x)<<3)&0xF8) +#else +#define PIXELSIZE 4 +typedef unsigned int pixel; +#ifdef PIX32BGR +#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) +#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) +#define PIXR(x) ((x)&0xFF) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)>>16) +#else +#ifdef PIX32BGRA +#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) +#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) +#define PIXR(x) (((x)>>8)&0xFF) +#define PIXG(x) (((x)>>16)&0xFF) +#define PIXB(x) (((x)>>24)) +#else +#define PIXPACK(x) (x) +#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) +#define PIXR(x) ((x)>>16) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)&0xFF) +#endif +#endif +#endif + +char *it_msg = +"\brThe Powder Toy\n" +"\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" +"\n" +"\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" +"\bgPick your material from the menu using mouse left/right buttons.\n" +"Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" +"Shift+drag will create straight lines of particles.\n" +"Ctrl+drag will result in filled rectangles.\n" +"Ctrl+Shift+click will flood-fill a closed area.\n" +"Middle click or Alt+Click to \"sample\" the particles.\n" +"\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" +"Use 'S' to save parts of the window as 'stamps'.\n" +"'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" +"'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" +"Use the mouse scroll wheel to change the tool size for particles.\n" +"'Q' will quit the application.\n" +"The spacebar can be used to pause physics.\n" +"'P' will take a screenshot and save it into the current directory.\n" +"\n" +"\brhttp://powder.hardwired.org.uk/\n" +"\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" +"\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powder.hardwired.org.uk\bg)\n" +"\n" +"\bgSpecial thanks to Brian Ledbetter for maintaining ports & server development in the past." +"\nand CW for hosting the original server.\n" +#ifdef WIN32 +"\nThanks to Akuryo for Windows icons.\n" +#endif +"\n" +"\bgTo use online features such as saving, you need to register at: http://powder.hardwired.org.uk/Register.html" +; + +typedef struct { + int start, inc; + pixel *vid; +} upstruc; + +#ifdef BETA +char *old_ver_msg_beta = "A new beta is available - click here!"; +#endif +char *old_ver_msg = "A new version is available - click here!"; +#ifdef HEAT_ENABLE +float mheat = 0.0f; +#endif + +int do_open = 0; +int sys_pause = 0; +int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. + +int amd = 0; + +unsigned char fire_r[YRES/CELL][XRES/CELL]; +unsigned char fire_g[YRES/CELL][XRES/CELL]; +unsigned char fire_b[YRES/CELL][XRES/CELL]; + +#define MAXSIGNS 16 + +struct sign { + int x,y,ju; + char text[256]; +} signs[MAXSIGNS]; + +/*********************************************************** + * AIR FLOW SIMULATOR * + ***********************************************************/ + +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; +unsigned cmode = 3; + +float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; +float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; +#define TSTEPP 0.3f +#define TSTEPV 0.4f +#define VADV 0.3f +#define VLOSS 0.999f +#define PLOSS 0.9999f +int numCores = 1; +float kernel[9]; +void make_kernel(void) +{ + int i, j; + float s = 0.0f; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) { + kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); + s += kernel[(i+1)+3*(j+1)]; + } + s = 1.0f / s; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + kernel[(i+1)+3*(j+1)] *= s; +} + +int core_count(){ + int numCPU = 1; +#ifdef MT +#ifdef WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + numCPU = sysinfo.dwNumberOfProcessors; +#else +#ifdef MACOSX + numCPU = 4; +#else + numCPU = sysconf( _SC_NPROCESSORS_ONLN ); +#endif +#endif + + printf("Cpus: %d\n", numCPU); + if(numCPU>1) + printf("Multithreading enabled\n"); + else + printf("Multithreading disabled\n"); +#endif + return numCPU; +} + +void update_air(void) +{ + int x, y, i, j; + float dp, dx, dy, f, tx, ty; + + for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; + if(dp < -256.0f) dp = -256.0f; + if(dx > 256.0f) dx = 256.0f; + if(dx < -256.0f) dx = -256.0f; + if(dy > 256.0f) dy = 256.0f; + if(dy < -256.0f) dy = -256.0f; + + ovx[y][x] = dx; + ovy[y][x] = dy; + opv[y][x] = dp; + } + memcpy(vx, ovx, sizeof(vx)); + memcpy(vy, ovy, sizeof(vy)); + memcpy(pv, opv, sizeof(pv)); +} + +void *update_air_th(void *arg) +{ + update_air(); + return NULL; +} + +unsigned clamp_flt(float f, float min, float max) +{ + if(fmax) + return 255; + return (int)(255.0f*(f-min)/(max-min)); +} + +float restrict_flt(float f, float min, float max){ + if(fmax) + return max; + return f; +} + +void draw_air(pixel *vid) +{ + int x, y, i, j; + pixel c; + + if(cmode == 2) + return; + + for(y=0; y 0.0f) + c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); + else + c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); + } else + c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), + clamp_flt(pv[y][x], 0.0f, 8.0f), + clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); + for(j=0; j=XRES || ny>=YRES) + return 0; + if(x==nx && y==ny) + return 1; + r = pmap[ny][nx]; + if(r && (r>>8)>8].type; + + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE)){ + return 1; + } + + if((r&0xFF)==PT_VOID){ + parts[i].type=PT_NONE; + return 0; + } + if((r&0xFF)==PT_BHOL){ + parts[i].type=PT_NONE; +#ifdef HEAT_ENABLE + if(!legacy_enable){ + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; + } +#endif + return 0; + } + + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]){ + return 1; + } + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE){ + return 0; + } + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])){ + return 0; + } + + if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; + if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + return 0; + if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) + return 0; + + if(parts[i].type==PT_CNCT && y>8)>= 8; + parts[r].x += x-nx; + parts[r].y += y-ny; + } + + return 1; +} + +void kill_part(int i) +{ + int x, y; + parts[i].type = PT_NONE; + + x = (int)(parts[i].x+0.5f); + y = (int)(parts[i].y+0.5f); + + if(x>=0 && y>=0 && x=XRES || y>=YRES) + return -1; + +#ifdef HEAT_ENABLE + if(t==SPC_HEAT||t==SPC_COOL){ + if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + } + if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP){ + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + } + return pmap[y][x]>>8; + } else { + return -1; + } + } +#endif + if(t==SPC_AIR){ + pv[y/CELL][x/CELL] += 0.03f; + if(y+CELL>8].type = PT_SPRK; + parts[pmap[y][x]>>8].life = 4; + parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; + pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; + return pmap[y][x]>>8; + } + + if(p==-1) { + if(pmap[y][x]) + return -1; + if(pfree == -1) + return -1; + i = pfree; + pfree = parts[i].life; + } else + i = p; + + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; +#ifdef HEAT_ENABLE + parts[i].temp = ptypes[t].heat; +#endif + if(t==PT_ACID){ + parts[i].life = 75; + } + //Testing + /*if(t==PT_WOOD){ + parts[i].life = 150; + }*/ + //End Testing + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_PLSM) + parts[i].life = rand()%150+50; + if(t==PT_LAVA) + parts[i].life = rand()%120+240; + if(t==PT_NEUT) { + float r = (rand()%128+128)/127.0f; + float a = (rand()%360)*3.14159f/180.0f; + parts[i].life = rand()%480+480; + parts[i].vx = r*cosf(a); + parts[i].vy = r*sinf(a); + } + if(t==PT_PHOT) { + float r = (rand()%3-1)*3; + float a = (rand()%3-1)*3; + parts[i].life = 680; + if(a==0.0f&&r==0.0f){ + parts[i].life = 0; + parts[i].type = PT_NONE; + return -1; + } else { + parts[i].vx = a; + parts[i].vy = r; + } + //} else { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + //} + } + + pmap[y][x] = t|(i<<8); + + return i; +} + +void delete_part(int x, int y) +{ + unsigned i; + + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + i = pmap[y][x]; + if(!i || (i>>8)>=NPART) + return; + + kill_part(i>>8); + pmap[y][x] = 0; // just in case +} + +void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + if(a!=255) { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + 255*PIXR(t)) >> 8; + g = (a*g + 255*PIXG(t)) >> 8; + b = (a*b + 255*PIXB(t)) >> 8; + if(r>255) + r = 255; + if(g>255) + g = 255; + if(b>255) + b = 255; + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); + +int is_wire(int x, int y) +{ + return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; +} +int is_wire_off(int x, int y) +{ + return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; +} + +void set_emap(int x, int y) +{ + int x1, x2; + + if(!is_wire_off(x, y)) + return; + + // go left as far as possible + x1 = x2 = x; + while(x1>0) { + if(!is_wire_off(x1-1, y)) + break; + x1--; + } + while(x21 && x1==x2 && + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + set_emap(x1, y-2); + else if(y>0) + for(x=x1; x<=x2; x++) + if(is_wire_off(x, y-1)) { + if(x==x1 || x==x2 || y>=YRES/CELL-1 || + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + set_emap(x, y-1); + } + + if(y=XRES || y>=YRES || + bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) { + kill_part(i); + continue; + } + + vx[y/CELL][x/CELL] *= ptypes[t].airloss; + vy[y/CELL][x/CELL] *= ptypes[t].airloss; + vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + if(t==PT_GASS) { + if(pv[y/CELL][x/CELL]<3.5f) + pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); + if(y+CELL2.5f) { + parts[i].life = rand()%80+180; + rt = parts[i].type = PT_FIRE; +#ifdef HEAT_ENABLE + parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); +#endif + pv[y/CELL][x/CELL] += 0.25f * CFDS; + t = PT_FIRE; + } + + parts[i].vx *= ptypes[t].loss; + parts[i].vy *= ptypes[t].loss; + + if(t==PT_DFRM && !parts[i].life) { + if(pv[y/CELL][x/CELL]>1.0f) { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].life = rand()%80+300; + } + } else { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + + if(ptypes[t].diffusion) { + parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + } + + // interpolator +#ifdef WIN32 + mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#else + mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#endif + if(mv < ISTP) { + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + } else { + dx = parts[i].vx*ISTP/mv; + dy = parts[i].vy*ISTP/mv; + ix = parts[i].x; + iy = parts[i].y; + while(1) { + mv -= ISTP; + if(mv <= 0.0f) { + // nothing found + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + break; + } + ix += dx; + iy += dy; + nx = (int)(ix+0.5f); + ny = (int)(iy+0.5f); + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) { + parts[i].x = ix; + parts[i].y = iy; + break; + } + } + } + + a = nt = 0; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx4.0f) + t = parts[i].type = PT_DSTW; + if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) + t = parts[i].type = PT_OILL; + if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) + t = parts[i].type = PT_GASS; +#ifdef HEAT_ENABLE + } +#endif + if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) + t = parts[i].type = PT_BRMT; + if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) + t = parts[i].type = PT_BGLA; + if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) + t = parts[i].type = PT_SNOW; + if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) { + t = PT_NEUT; + create_part(i, x, y, t); + } + + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1){ + nearp = nearest_part(i, PT_ETRD); + if(nearp!=-1){ + create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[nearp].type = PT_SPRK; + parts[nearp].life = 9; + parts[nearp].ctype = PT_ETRD; + } + } + +#ifdef HEAT_ENABLE + if(!legacy_enable){ + int ctemp = pv[y/CELL][x/CELL]*2; + c_heat = 0.0f; + h_count = 0; + if(ptypes[t].hconduct>(rand()%250)){ + for(nx=-1; nx<2; nx++) { + for(ny=-1; ny<2; ny++) { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE){ + h_count++; + c_heat += parts[r>>8].temp; + } + } + } + } + pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); + for(nx=-1; nx<2; nx++) { + for(ny=-1; ny<2; ny++) { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE){ + parts[r>>8].temp = parts[i].temp; + } + } + } + } + if(pt>=pstates[t].btemp&&pstates[t].burn) { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid){ + if(t==PT_LAVA&&parts[i].ctype){ + parts[i].life = 0; + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp){ + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } else { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)){ + if(pstates[t].liquid==PT_LAVA){ + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } else if(t==PT_ICEI&&parts[i].ctype){ + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } else { + t = parts[i].type = pstates[t].liquid; + } + }else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS){ + t = parts[i].type = pstates[t].liquid; + }else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)){ + if(t==PT_SLTW&&1>rand()%6){ + t = parts[i].type = PT_SALT; + } else { + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f){ + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA){ + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } + } + if(t==PT_CSCN&&parts[i].temp>24.0f){ + pt = parts[i].temp -= 2.5f; + } + if(t==PT_HSCN&&parts[i].temp>24.0f){ + pt = parts[i].temp -= 2.5f; + } + #endif + + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK) { + nx = x % CELL; + if(nx == 0) + nx = x/CELL - 1; + else if(nx == CELL-1) + nx = x/CELL + 1; + else + nx = x/CELL; + ny = y % CELL; + if(ny == 0) + ny = y/CELL - 1; + else if(ny == CELL-1) + ny = y/CELL + 1; + else + ny = y/CELL; + if(nx>=0 && ny>=0 && nx0){ + int ttx = (rand()%3)-1; + r = pmap[y-1][x+ttx]; + if(parts[i].life>50){ + if((pmap[y-1][x+ttx]&0xFF)==PT_NONE){ + create_part(-1, x+ttx, y-1, PT_WOOD); + parts[pmap[y-1][x+ttx]>>8].life = parts[i].life-1; + parts[pmap[y-1][x+ttx]>>8].vx = ttx; + } + if((pmap[y-1][x+ttx-1]&0xFF)==PT_NONE){ + create_part(-1, x+ttx-1, y-1, PT_WOOD); + parts[pmap[y-1][x+ttx-1]>>8].life = 0; + } + if((pmap[y-1][x+ttx+1]&0xFF)==PT_NONE){ + create_part(-1, x+ttx+1, y-1, PT_WOOD); + parts[pmap[y-1][x+ttx+1]>>8].life = 0; + } + parts[i].life = 0; + } else if(parts[i].life>10) { + //int ttx = (rand()%3)-parts[i].vx; + //create_part(-1, x+ttx, y-1, PT_WOOD); + //r = pmap[y-1][x+ttx]; + //parts[r>>8].life = parts[i].life-1; + //parts[i].life = 0; + } + } else*/ + if(t==PT_THDR){ + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT) && parts[r>>8].ctype!=PT_SPRK ){ + t = parts[i].type = PT_NONE; + parts[r>>8].ctype = parts[r>>8].type; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + } else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) { + pv[y/CELL][x/CELL] += 100.0f; + if(legacy_enable&&1>(rand()%200)){ + parts[i].life = rand()%50+120; + t = parts[i].type = PT_FIRE; + } else { + t = parts[i].type = PT_NONE; + } + } + } + } else if(t==PT_ICEI || t==PT_SNOW) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } +#ifndef HEAT_ENABLE + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; +#else + if(legacy_enable){ + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; + } +#endif + } + } + else if(t==PT_HSCN||t==PT_CSCN) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) { + parts[i].temp = 200.0f; + } + } + } + //PLANT + else if(t==PT_PLNT) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR && 1>(rand()%250)) { + t = parts[i].type = PT_PLNT; + parts[r>>8].type = PT_PLNT; + } else if((r&0xFF)==PT_LAVA && 1>(rand()%250)){ + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WATR||t==PT_DSTW) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10)) { +#ifndef HEAT_ENABLE + t = parts[i].type = PT_WTRV; + //parts[r>>8].type = PT_WTRV; +#else + if(legacy_enable){ + t = parts[i].type = PT_WTRV; + } +#endif + } else if((r&0xFF)==PT_SALT && 1>(rand()%250)) { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)){ + t = parts[i].type = PT_WATR; + } + if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)){ + t = parts[i].type = PT_SLTW; + } +#ifdef HEAT_ENABLE + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)){ +#else + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ +#endif + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_SLTW) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10)) { +#ifndef HEAT_ENABLE + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; +#else + if(legacy_enable){ + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; + } +#endif + } else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) { + //t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } +#ifdef HEAT_ENABLE + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)){ +#else + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ +#endif + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WTRV) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; +#ifdef HEAT_ENABLE + if(legacy_enable){ +#endif + if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000)) { + t = parts[i].type = PT_WATR; + parts[r>>8].type = PT_WATR; + } +#ifdef HEAT_ENABLE + } +#endif + +#ifdef HEAT_ENABLE + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)){ +#else + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ +#endif + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000)) { +#ifndef HEAT_ENABLE + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; +#else + if(legacy_enable){ + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; + } +#endif + } + } + } + // END PLANT + // ACID + else if(t==PT_ACID) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)!=PT_ACID){ + if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD){ + t = parts[i].type = PT_FIRE; + parts[i].life = 4; + parts[r>>8].type = PT_FIRE; + parts[r>>8].life = 4; + } else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) { + parts[i].life--; + parts[r>>8].type = PT_NONE; + } else if (parts[i].life==50){ + parts[i].life = 0; + t = parts[i].type = PT_NONE; + } + } + } + } + //END ACID :D + else if(t==PT_NEUT) { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) { + if(33>rand()%100) { + create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); + } else { + create_part(r>>8, x+nx, y+ny, PT_NEUT); + parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; + parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; + } + pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + fe ++; + } + if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + parts[r>>8].type = PT_DUST; + if((r&0xFF)==PT_WATR && 15>(rand()%100)) + parts[r>>8].type = PT_DSTW; + if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) + parts[r>>8].type = PT_DFRM; + if((r&0xFF)==PT_NITR && 15>(rand()%1000)) + parts[r>>8].type = PT_OILL; + if((r&0xFF)==PT_OILL && 5>(rand()%1000)) + parts[r>>8].type = PT_GASS; + if((r&0xFF)==PT_PLNT && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + } + } + else if(t==PT_PHOT){ + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=0; nx<1; nx++) + for(ny=0; ny<1; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + // } else if(((r&0xFF)!=PT_PHOT&&(r&0xFF)!=PT_NONE&&(r&0xFF)!=PT_CLNE)) { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + // }// else if((r&0xFF)!=PT_PLEX){ + // parts[i].life = 4; + // parts[i].type = PT_FIRE + //} + } + } + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) + continue; + rt = parts[r>>8].type; + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { + parts[r>>8].type = PT_FIRE; +#ifdef HEAT_ENABLE + parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); +#endif + parts[r>>8].life = rand()%80+180; + if(ptypes[rt].explosive) + pv[y/CELL][x/CELL] += 0.25f * CFDS; //LOL + continue; + } + lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; + if(lpv < 1) lpv = 1; +#ifndef HEAT_ENABLE + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && (t!=PT_FIRE || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && + ptypes[rt].meltable*lpv>(rand()%1000)) { + if(t!=PT_LAVA || parts[i].life>0) { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } else { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) { + parts[i].life = 0; + t = parts[i].type = PT_METL; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) { + kill_part(r>>8); + if(t==PT_FIRE) { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + //t = parts[i].type = PT_METL; + goto killed; + } + } +#else + if(legacy_enable){ + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && + ptypes[rt].meltable*lpv>(rand()%1000)) { + if(t!=PT_LAVA || parts[i].life>0) { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } else { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) { + parts[i].life = 0; + t = parts[i].type = PT_METL; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) { + kill_part(r>>8); + if(t==PT_FIRE) { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + //t = parts[i].type = PT_METL; + goto killed; + } + } + } +#endif + //Bitches now know about my semi-conductor :( + if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN)){ + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; +#ifdef HEAT_ENABLE + if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) + parts[r>>8].temp = parts[r>>8].temp+10.0f; +#endif + } + } + if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp>100.0f)){ + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp<100.0f)){ + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 6; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 5; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5){ + if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN){ + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + } + killed: + if(parts[i].type == PT_NONE) + continue; + } + + if(t==PT_CLNE) { + if(!parts[i].ctype) { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx=XRES-CELL || + ny=YRES-CELL) { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + continue; + } + + rt = parts[i].flags & FLAG_STAGNANT; + parts[i].flags &= ~FLAG_STAGNANT; + if(!try_move(i, x, y, nx, ny)) { + parts[i].x = lx; + parts[i].y = ly; + if(ptypes[t].falldown) { + if(nx!=x && try_move(i, x, y, nx, y)) { + parts[i].x = ix; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else if(ny!=y && try_move(i, x, y, x, ny)) { + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else { + r = (rand()%2)*2-1; + if(ny!=y && try_move(i, x, y, x+r, ny)) { + parts[i].x += r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else if(ny!=y && try_move(i, x, y, x-r, ny)) { + parts[i].x -= r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else if(nx!=x && try_move(i, x, y, nx, y+r)) { + parts[i].x = ix; + parts[i].y += r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else if(nx!=x && try_move(i, x, y, nx, y-r)) { + parts[i].x = ix; + parts[i].y -= r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) { + s = 0; + if(!rt || nt) + rt = 50; + else + rt = 10; + for(j=x+r; j>=0 && j>=x-rt && j0) + r = 1; + else + r = -1; + if(s) + for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny(rand()%1000)) { + kill_part(i); + continue; + } else if(try_move(i, x, y, 2*x-nx, ny)) { + parts[i].x = (float)(2*x-nx); + parts[i].y = (float)iy; + parts[i].vx *= ptypes[t].collision; + } else if(try_move(i, x, y, nx, 2*y-ny)) { + parts[i].x = (float)ix; + parts[i].y = (float)(2*y-ny); + parts[i].vy *= ptypes[t].collision; + } else { + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + } + } + + justdraw: + + nx = (int)(parts[i].x+0.5f); + ny = (int)(parts[i].y+0.5f); + + if(nx=XRES-CELL || + ny=YRES-CELL) { + kill_part(i); + continue; + } +#ifdef HEAT_ENABLE + if(cmode!=CM_HEAT){ + +#endif + if(t==PT_ACID) { + if(parts[i].life>255) parts[i].life = 255; + if(parts[i].life<47) parts[i].life = 48; + s = (255/((parts[i].life-46)*28));//if(parts[i].life<=49) parts[i].life = 50; + if(s==0) s = 1; + cr = PIXR(ptypes[t].pcolors)/s; + cg = PIXG(ptypes[t].pcolors)/s; + cb = PIXB(ptypes[t].pcolors)/s; + //vid[ny*(XRES+BARSIZE)+nx] = //(cr<<16)+(cb<<18)+cg;//ptypes[t].pcolors/-(parts[i].life-255); + blendpixel(vid, nx, ny, cr, cg, cb, 255);//(parts[i].life-46)*28 + if(cmode==4){ + blendpixel(vid, nx+1, ny, cr, cg, cb, 223); + blendpixel(vid, nx-1, ny, cr, cg, cb, 223); + blendpixel(vid, nx, ny+1, cr, cg, cb, 223); + blendpixel(vid, nx, ny-1, cr, cg, cb, 223); + + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); + } + }else if(t==PT_NEUT) { + if(cmode == 3||cmode==4) { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 8; + cb = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } else { + cr = 0x20; + cg = 0xE0; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + }else if(t==PT_PHOT) { + if(cmode == 3||cmode==4) { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 12; + cb = 12; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } else { + cr = 0xFF; + cg = 0xFF; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_THDR) { + if(cmode == 3||cmode==4) { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 16; + cb = 20; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } else { + cr = 0xFF; + cg = 0xFF; + cb = 0xA0; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLSM) { + float ttemp = parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = plasma_data[caddress]; + uint8 G = plasma_data[caddress+1]; + uint8 B = plasma_data[caddress+2]; + if(cmode == 3||cmode==4) { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } else { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_FIRE && parts[i].life) { + if(cmode == 3||cmode==4) { + cr = parts[i].life / 4; + cg = parts[i].life / 16; + cb = parts[i].life / 32; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } else { + cr = parts[i].life * 8; + cg = parts[i].life * 2; + cb = parts[i].life; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_LAVA && parts[i].life) { + cr = parts[i].life * 2 + 0xE0; + cg = parts[i].life * 1 + 0x50; + cb = parts[i].life/2 + 0x10; + if(cr>255) cr = 255; + if(cg>192) cg = 192; + if(cb>128) cb = 128; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 64); + blendpixel(vid, nx-1, ny, cr, cg, cb, 64); + blendpixel(vid, nx, ny+1, cr, cg, cb, 64); + blendpixel(vid, nx, ny-1, cr, cg, cb, 64); + if(cmode == 3||cmode==4) { + cr /= 32; + cg /= 32; + cb /= 32; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } else if(t==PT_LAVA || t==PT_SPRK) { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + if(cmode == 3 || cmode==4) { + if(t == PT_LAVA) { + cr = 3; + cg = i%2; + cb = 0; + } else { + cr = 8; + cg = 12; + cb = 16; + } + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } else + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; +#ifdef HEAT_ENABLE + } else { + float ttemp = parts[i].temp+(-MIN_TEMP); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); + uint8 R = color_data[caddress]; + uint8 G = color_data[caddress+1]; + uint8 B = color_data[caddress+2]; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); + //blendpixel(vid, nx+1, ny, R, G, B, 255); + } +#endif + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID){ + uint8 R = PIXR(ptypes[t].pcolors); + uint8 G = PIXG(ptypes[t].pcolors); + uint8 B = PIXB(ptypes[t].pcolors); + + //if(vid[(ny-1)*YRES+(nx-1)]!=0){ + // blendpixel(vid, nx, ny-1, R, G, B, 46); + //} + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + + } + +} + +void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb){ + blendpixel(vid, x+1, y, cr, cg, cb, 112); + blendpixel(vid, x-1, y, cr, cg, cb, 112); + blendpixel(vid, x, y+1, cr, cg, cb, 112); + blendpixel(vid, x, y-1, cr, cg, cb, 112); + + blendpixel(vid, x+1, y-1, cr, cg, cb, 64); + blendpixel(vid, x-1, y-1, cr, cg, cb, 64); + blendpixel(vid, x+1, y+1, cr, cg, cb, 64); + blendpixel(vid, x-1, y+1, cr, cg, cb, 64); +} + +void update_particles_i_th(void *arg){ + upstruc *newup = (upstruc*)arg; + update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); + return; +} + +void update_particles(pixel *vid) +{ + int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; + float lx, ly; +#ifdef MT + int pt = 0, pc = 0; + pthread_t *InterThreads; +#endif + + memset(pmap, 0, sizeof(pmap)); + r = rand()%2; + for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) { + if(emap[y][x]) { + cr = cg = cb = 128; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) { + for(j=0; j 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==13) { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } else { + for(y=0; y>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) { + if(emap[y][x]) { + cr = cg = cb = 128; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) { + for(j=0; j 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==9){ + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } + +#ifdef MT + if(numCores > 1) { + InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); + for(pc = 0; pc=XRES || ny<0 || ny>=YRES) + break; + addpixel(vid, nx, ny, 255, 255, 255, 64); + i = nx/CELL; + j = ny/CELL; + lx += vx[j][i]*0.125f; + ly += vy[j][i]*0.125f; + if(bmap[j][i]==5 && i!=x && j!=y) + break; + } + drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); + } + +} + +void update_particles_th(void *arg) +{ + update_particles((pixel*)arg); + return; +} + +/*********************************************************** + * SDL OUTPUT * + ***********************************************************/ + +int sdl_scale = 1; +SDL_Surface *sdl_scrn; +SDLMod sdl_mod; +int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; + +#include "icon.h" +void sdl_seticon(void) +{ +#ifdef WIN32 + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else +#ifdef MACOSX + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else + SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#endif +#endif +} + +void sdl_open(void) +{ + if(SDL_Init(SDL_INIT_VIDEO)<0) { + fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); + exit(1); + } + atexit(SDL_Quit); +#ifdef PIX16 + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); +#else + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); +#endif + if(!sdl_scrn) { + fprintf(stderr, "Creating window: %s\n", SDL_GetError()); + exit(1); + } + SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); + sdl_seticon(); + SDL_EnableUNICODE(1); + //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); +} + +void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0;jpitch/PIXELSIZE; + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} + +void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + int i,k; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0;jpitch/PIXELSIZE; + } + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} +void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) +{ + if(sdl_scale == 2) + sdl_blit_2(x, y, w, h, src, pitch); + else + sdl_blit_1(x, y, w, h, src, pitch); +} + +int frame_idx=0; +void dump_frame(pixel *src, int w, int h, int pitch) +{ + char frame_name[32]; + int j,i; + unsigned char c[3]; + FILE *f; + sprintf(frame_name,"frame%04d.ppm",frame_idx); + f=fopen(frame_name,"wb"); + fprintf(f,"P6\n%d %d\n255\n",w,h); + for(j=0;j=0 && x=0 && yPT_NUM) + return 2; + if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) + return 3; + i = XRES*YRES; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) + return 1; + size = i; + } else + d = c; + + if(size < XRES*YRES) { + if(bzip2) + free(d); + return 1; + } + + sy = 0; + for(y=0;y+scl<=YRES;y+=scl) { + sx = 0; + for(x=0;x+scl<=XRES;x+=scl) { + a = 0; + r = g = b = 0; + for(j=0;j=PT_NUM) + goto corrupt; + r += PIXR(ptypes[t].pcolors); + g += PIXG(ptypes[t].pcolors); + b += PIXB(ptypes[t].pcolors); + a ++; + } + } + if(a) { + a = 256/a; + r = (r*a)>>8; + g = (g*a)>>8; + b = (b*a)>>8; + } + drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); + sx++; + } + sy++; + } + + if(bzip2) + free(d); + return 0; + +corrupt: + if(bzip2) + free(d); + return 1; +} + +static char *mystrdup(char *s) +{ + char *x; + if(s) { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; + } + return s; +} + +void *build_save(int *size, int x0, int y0, int w, int h) +{ +#ifdef HEAT_ENABLE + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; +#else + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*6+MAXSIGNS*262), *c; +#endif + int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); + int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + // save the required air state + for(y=by0; y255) i=255; + d[p++] = i; + } + for(y=by0; y255) i=255; + d[p++] = i; + } + + // save the particle map + for(i=0; i=x0 && x=y0 && y255) x=255; + if(y<0) y=0; + if(y>255) y=255; + d[p++] = x; + d[p++] = y; + } + } + for(j=0; j255) tttemp=255; + d[p++] = tttemp; + } + } +#endif + for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; + d[p++] = (signs[i].y-y0); + d[p++] = (signs[i].y-y0)>>8; + d[p++] = signs[i].ju; + x = strlen(signs[i].text); + d[p++] = x; + memcpy(d+p, signs[i].text, x); + p+=x; + } + + i = (p*101+99)/100 + 612; + c = malloc(i); + c[0] = 0x66; + c[1] = 0x75; + c[2] = 0x43; + c[3] = legacy_enable; + c[4] = SAVE_VERSION; + c[5] = CELL; + c[6] = bw; + c[7] = bh; + c[8] = p; + c[9] = p >> 8; + c[10] = p >> 16; + c[11] = p >> 24; + + i -= 12; + + if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) { + free(d); + free(c); + return NULL; + } + free(d); + + *size = i+12; + return c; +} + +int parse_save(void *save, int size, int replace, int x0, int y0) +{ + unsigned char *d,*c=save; + int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; + int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; + int fp[NPART], nf=0; + + if(size<16) + return 1; + if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) + return 1; + if(c[4]>SAVE_VERSION) + return 2; + ver = c[4]; + +#ifdef HEAT_ENABLE + if(ver<34){ + legacy_enable = 1; + } else { + if(c[3]==1||c[3]==0) + legacy_enable = c[3]; + else + legacy_beta = 1; + } +#endif + + bw = c[6]; + bh = c[7]; + if(bx0+bw > XRES/CELL) + bx0 = XRES/CELL - bw; + if(by0+bh > YRES/CELL) + by0 = YRES/CELL - bh; + if(bx0 < 0) + bx0 = 0; + if(by0 < 0) + by0 = 0; + + if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) + return 3; + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + return 1; + size = i; + + if(size < bw*bh) + return 1; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + if(replace) { + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(signs, 0, sizeof(signs)); + memset(parts, 0, sizeof(particle)*NPART); + memset(pmap, 0, sizeof(pmap)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(pv, 0, sizeof(pv)); + } + + // make a catalog of free parts + memset(pmap, 0, sizeof(pmap)); + for(i=0; i= size) + goto corrupt; + fvx[y][x] = (d[p++]-127.0f)/64.0f; + } + for(y=by0; y= size) + goto corrupt; + fvy[y][x] = (d[p++]-127.0f)/64.0f; + } + + // load the particle map + i = 0; + pty = p; + for(y=y0;y= size) + goto corrupt; + j=d[p++]; + if(j >= PT_NUM) + goto corrupt; + if(j) { + if(pmap[y][x]) { + k = pmap[y][x]>>8; + parts[k].type = j; + parts[k].x = (float)x; + parts[k].y = (float)y; + m[(x-x0)+(y-y0)*w] = k+1; + } else if(i < nf) { + parts[fp[i]].type = j; + parts[fp[i]].x = (float)x; + parts[fp[i]].y = (float)y; + m[(x-x0)+(y-y0)*w] = fp[i]+1; + i++; + } else + m[(x-x0)+(y-y0)*w] = NPART+1; + } + } + + // load particle properties + for(j=0; j= size) + goto corrupt; + if(i < NPART) { + parts[i].vx = (d[p++]-127.0f)/16.0f; + parts[i].vy = (d[p++]-127.0f)/16.0f; + } else + p += 2; + } + } + for(j=0; j= size) + goto corrupt; + if(i <= NPART) + parts[i-1].life = d[p++]*4; + else + p++; + } + } +#ifdef HEAT_ENABLE + for(j=0; j=34&&legacy_beta==0){ + if(p >= size){ + goto corrupt; + } + if(i <= NPART) { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } else { + p++; + } + } else { + parts[i-1].temp = ptypes[parts[i-1].type].heat; + } + } + } +#endif + for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) { + if(p >= size) + goto corrupt; + if(i <= NPART) + parts[i-1].ctype = d[p++]; + else + p++; + } + } + + if(p >= size) + goto version1; + j = d[p++]; + for(i=0; i size) + goto corrupt; + for(k=0; k size) + goto corrupt; + if(kSAVE_VERSION) + return NULL; + + bw = c[6]; + bh = c[7]; + w = bw*CELL; + h = bh*CELL; + + if(c[5]!=CELL) + return NULL; + + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return NULL; + fb = calloc(w*h, PIXELSIZE); + if(!fb) { + free(d); + return NULL; + } + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + goto corrupt; + size = i; + + if(size < bw*bh) + goto corrupt; + + k = 0; + for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) + goto corrupt; + + for(y=0;y= size) + goto corrupt; + j=d[p++]; + if(j0) + fb[y*w+x] = ptypes[j].pcolors; + } + + free(d); + *width = w; + *height = h; + return fb; + +corrupt: + free(d); + free(fb); + return NULL; +} + +/* NO, I DON'T THINK SO + #include "fbi.h" + + pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) + { + unsigned char *tmp; + pixel *res; + int i; + + tmp = malloc(width*height*3); + if(!tmp) + return NULL; + res = malloc(width*height*PIXELSIZE); + if(!res) { + free(tmp); + return NULL; + } + + i = width*height*3; + if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { + free(res); + free(tmp); + return NULL; + } + + for(i=0; i1) { + r = (r+c/2)/c; + g = (g+c/2)/c; + b = (b+c/2)/c; + } + q[y*w+x] = PIXRGB(r, g, b); + } + *qw = w; + *qh = h; + return q; +} + +#define GRID_X 5 +#define GRID_Y 4 +#define GRID_P 3 +#define GRID_S 6 +#define GRID_Z 3 + +void stamp_gen_thumb(int i) +{ + char fn[64]; + void *data; + int size, factor_x, factor_y; + pixel *tmp; + + if(stamps[i].thumb) { + free(stamps[i].thumb); + stamps[i].thumb = NULL; + } + + sprintf(fn, "stamps" PATH_SEP "%s.stm", stamps[i].name); + data = file_load(fn, &size); + + if(data) { + stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); + if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) { + factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); + factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); + if(factor_y > factor_x) + factor_x = factor_y; + tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); + free(stamps[i].thumb); + stamps[i].thumb = tmp; + } + } + + free(data); +} + +void stamp_save(int x, int y, int w, int h) +{ + FILE *f; + int n; + char fn[64], sn[16]; + void *s=build_save(&n, x, y, w, h); + +#ifdef WIN32 + _mkdir("stamps"); +#else + mkdir("stamps", 0755); +#endif + + stamp_gen_name(sn); + sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); + + f = fopen(fn, "wb"); + if(!f) + return; + fwrite(s, n, 1, f); + fclose(f); + + free(s); + + if(stamps[STAMP_MAX-1].thumb) + free(stamps[STAMP_MAX-1].thumb); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); + memset(stamps, 0, sizeof(struct stamp_info)); + if(stamp_count0) { + memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); + memcpy(stamps, &tmp, sizeof(struct stamp_info)); + + stamp_update(); + } + + return data; +} + +void stamp_init(void) +{ + int i; + FILE *f; + + memset(stamps, 0, sizeof(stamps)); + + f=fopen("stamps" PATH_SEP "stamps.def", "rb"); + if(!f) + return; + for(i=0; i=XRES+BARSIZE || y>=YRES+MENUSIZE) + return; + if(a!=255) { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +{ + int i, j, w, bn = 0, ba = 0; + char *rp = font_data + font_ptrs[c]; + w = *(rp++); + for(j=0; j>= 2; + bn -= 2; + } + return x + w; +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) +{ + int sx = x; + for(;*s;s++) { + if(*s == '\n') { + x = sx; + y += FONT_H+2; + } else if(*s == '\b') { + switch(s[1]) { + case 'w': + r = g = b = 255; + break; + case 'g': + r = g = b = 192; + break; + case 'o': + r = 255; + g = 216; + b = 32; + break; + case 'r': + r = 255; + g = b = 0; + break; + case 'b': + r = g = 0; + b = 255; + break; + } + s++; + } else + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + return x; +} + +void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) +{ + int i; + for(i=0; i<=w; i++) { + drawpixel(vid, x+i, y, r, g, b, a); + drawpixel(vid, x+i, y+h, r, g, b, a); + } + for(i=1; i=w && x+textwidth(s)>=w+5) + break; + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + if(*s) + for(i=0; i<3; i++) + x = drawchar(vid, x, y, '.', r, g, b, a); + return x; +} + +int textnwidth(char *s, int n) +{ + int x = 0; + for(;*s;s++) { + if(!n) + break; + x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + n--; + } + return x-1; +} +int textwidthx(char *s, int w) +{ + int x=0,n=0,cw; + for(;*s;s++) { + cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + if(x+(cw/2) >= w) + break; + x += cw; + n++; + } + return n; +} + +/*********************************************************** + * MAIN PROGRAM * + ***********************************************************/ + +void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) +{ + int x, y, i, j, c; + int bo = b; + if(iswall==1){ + b = b-100; + x = (2+32*((b-22)/1)); + y = YRES+2+40; + switch(b){ + case WL_WALLELEC: + for(j=1; j<15; j++){ + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } else { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) { + for(i=1; i<6+j; i++) { + if(!(i&j&1)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) { + if(i&j&1) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<13; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) { + for(i=14; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + default: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) { + for(j=4; j<12; j++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } else { + x = 2+32*(b/2); + y = YRES+2+20*(b%2); + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) { + for(j=4; j<12; j++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + if(bo==sl || bo==sr) { + c = 0; + if(bo==sl) + c |= PIXPACK(0xFF0000); + if(bo==sr) + c |= PIXPACK(0x0000FF); + for(i=0; i<30; i++) { + vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; + } + for(j=0; j<18; j++) { + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; + } + } +} + +int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) +{ + int i, j, c; + if(b>=121){ + b = b-100; + //x = (2+32*((b-22)/1)); + //y = YRES+2+40; + switch(b){ + case WL_WALLELEC: + for(j=1; j<15; j++){ + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } else { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) { + for(i=1; i<6+j; i++) { + if(!(i&j&1)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) { + if(i&j&1) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<13; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) { + for(i=14; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + case 40: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + default: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) { + for(j=4; j<12; j++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } else { + //x = 2+32*(b/2); + //y = YRES+2+20*(b%2); + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) { + for(j=4; j<12; j++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + return 26; +} + +void draw_menu(pixel *vid_buf, int i, int hover){ + + //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); +#ifdef MENUV3 + drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + if(hover==i){ + fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); + } else { + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + } +#else + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); +#endif +} + +void menu_ui(pixel *vid_buf, int i, int *sl, int *sr){ + int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; + pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); + fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + rows = ceil((float)msections[i].itemcount/16.0f); + height = (ceil((float)msections[i].itemcount/16.0f)*18); + width = restrict_flt(msections[i].itemcount*31, 0, 16*31); + //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); + h = -1; + x = XRES-BARSIZE-26; + y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; + sy = y; + //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); + fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); + fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); + drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); + if(i==SC_WALL){ + for(n = 122; n<122+UI_WALLCOUNT; n++){ + if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM){ + if(x-26<=60){ + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } else if(i==SC_SPECIAL){ + for(n = 122; n<122+UI_WALLCOUNT; n++){ + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM){ + if(x-26<=60){ + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } else { + for(n = 0; n=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1){ + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); + } else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } else { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } else if(i==SC_SPECIAL){ + for(n = 122; n<122+UI_WALLCOUNT; n++){ + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM){ + if(x-26<=20){ + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(!bq && mx>=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } else { + for(n = 0; n=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1){ + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); + } else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } else { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + if(b==1&&h!=-1){ + *sl = h; + } + if(b==4&&h!=-1){ + *sr = h; + } + } + +int create_parts(int x, int y, int r, int c) +{ + int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; + + if(c == 125) { + i = x / CELL; + j = y / CELL; + for(v=-1;v<2;v++) + for(u=-1;u<2;u++) + if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) { + y += sy; + if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) { + if(cp) + create_parts(y, x, r, c); + else + create_parts(x, y, r, c); + } + e -= 1.0f; + } + } +} + +void create_box(int x1, int y1, int x2, int y2, int c) +{ + int i, j; + if(x1>x2) { + i = x2; + x2 = x1; + x1 = i; + } + if(y1>y2) { + j = y2; + y2 = y1; + y1 = j; + } + for(j=y1; j<=y2; j++) + for(i=x1; i<=x2; i++) + create_parts(i, j, 1, c); +} + +int flood_parts(int x, int y, int c, int cm, int bm) +{ + int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT){ + c = c-100; + } + if(cm==-1) { + if(c==0) { + cm = pmap[y][x]&0xFF; + if(!cm) + return 0; + } else + cm = 0; + } + if(bm==-1) { + if(c==30) { + bm = bmap[y/CELL][x/CELL]; + if(!bm) + return 0; + if(bm==1) + cm = 0xFF; + } else + bm = 0; + } + + if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) + return 1; + + // go left as far as possible + x1 = x2 = x; + while(x1>=CELL) { + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + break; + x1--; + } + while(x2=CELL+dy) + for(x=x1; x<=x2; x++) + if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) + if(!flood_parts(x, y-dy, co, cm, bm)) + return 0; + if(y=XRES || y>=YRES) + return; + c = vid[y*(XRES+BARSIZE)+x]; + c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); + if(c<512) + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); + else + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); +} + +void xor_line(int x1, int y1, int x2, int y2, pixel *vid) +{ + int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) { + y += sy; + e -= 1.0f; + } + } +} + +void draw_svf_ui(pixel *vid_buf) +{ + int c; + + drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); + drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + c = svf_open ? 255 : 128; + drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); + drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); + + c = svf_login ? 255 : 128; + drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); + if(svf_open) + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); + else + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); + drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); + if(svf_open && svf_own) + drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); + + c = (svf_login && svf_open) ? 255 : 128; + + drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + + if(svf_myvote==1 && (svf_login && svf_open)){ + fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); + } else if(svf_myvote==-1 && (svf_login && svf_open)){ + fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); + } + + drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); + drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); + + drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); + if(svf_tags[0]) + drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); + else + drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); + +#ifdef HEAT_ENABLE + drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); +#else + drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-364, 14, c, c, c, 255); +#endif + + drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); + drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); + if(svf_login) + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); + else + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); + drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); + + if(sys_pause) { + fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); + } else { + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); + drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + +#ifdef HEAT_ENABLE + if(!legacy_enable) { + fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); + } else { + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } +#endif + + switch(cmode) { + case 0: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); + break; + case 1: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); + break; + case 2: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); + break; + case 3: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); + break; + case 4: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); + break; +#ifdef HEAT_ENABLE + case 5: + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + break; +#endif + } + drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + + if(svf_admin) { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); + } else if(svf_mod) { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + }//else if(amd) + // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? +} + +typedef struct ui_edit { + int x, y, w, nx; + char str[256],*def; + int focus, cursor, hide; +} ui_edit; +void ui_edit_draw(pixel *vid_buf, ui_edit *ed) +{ + int cx, i; + char echo[256], *str; + + if(ed->hide) { + for(i=0;ed->str[i];i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } else + str = ed->str; + + if(ed->str[0]) { + drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } else if(!ed->focus) + drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); + if(ed->focus) { + cx = textnwidth(str, ed->cursor); + for(i=-3; i<9; i++) + drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); + } +} +char *shift_0="`1234567890-=[]\\;',./"; +char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; +void ui_edit_process(int mx, int my, int mb, ui_edit *ed) +{ + char ch, ts[2], echo[256], *str; + int l, i; +#ifdef RAWINPUT + char *p; +#endif + + if(mb) { + if(ed->hide) { + for(i=0;ed->str[i];i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } else + str = ed->str; + + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } else + ed->focus = 0; + } + if(ed->focus && sdl_key) { + if(ed->hide) { + for(i=0;ed->str[i];i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } else + str = ed->str; + + l = strlen(ed->str); + switch(sdl_key) { + case SDLK_HOME: + ed->cursor = 0; + break; + case SDLK_END: + ed->cursor = l; + break; + case SDLK_LEFT: + if(ed->cursor > 0) + ed->cursor --; + break; + case SDLK_RIGHT: + if(ed->cursor < l) + ed->cursor ++; + break; + case SDLK_DELETE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + ed->str[ed->cursor] = 0; + else if(ed->cursor < l) + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + break; + case SDLK_BACKSPACE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) { + if(ed->cursor > 0) + memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); + ed->cursor = 0; + } else if(ed->cursor > 0) { + ed->cursor--; + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + } + break; + default: +#ifdef RAWINPUT + if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) { + ch = sdl_key; + if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) { + if(ch>='a' && ch<='z') + ch &= ~0x20; + p = strchr(shift_0, ch); + if(p) + ch = shift_1[p-shift_0]; + } + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#else + if(sdl_ascii>=' ' && sdl_ascii<127) { + ch = sdl_ascii; + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#endif + break; + } + } +} + typedef struct ui_checkbox { + int x, y; + int focus, checked; + } ui_checkbox; + void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) + { + int w = 12; + if(ed->checked) { + drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); + } + if(ed->focus){ + drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); + } else { + drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); + } + } + void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) + { + int w = 12; + + if(mb && !mbq) { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w){ + ed->checked = (ed->checked)?0:1; + } + } else { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w){ + ed->focus = 1; + } else { + ed->focus = 0; + } + } + } + +void error_ui(pixel *vid_buf, int err, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + char *msg; + + msg = malloc(strlen(txt)+16); + if(err) + sprintf(msg, "%03d %s", err, txt); + else + sprintf(msg, "%s", txt); + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + if(err) + drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); + else + drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + free(msg); + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_ui(pixel *vid_buf, char *top, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); + drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_box(pixel *vid_buf, char *msg) +{ + int w = textwidth(msg)+16; + int x0=(XRES-w)/2,y0=(YRES-24)/2; + + clearrect(vid_buf, x0-2, y0-2, w+4, 28); + drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); +} + +int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + int ret = 0; + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); + drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); + drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); + drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) { + ret = 1; + break; + } + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) { + ret = 1; + break; + } + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + return ret; +} + +int execute_tagop(pixel *vid_buf, char *op, char *tag) +{ + int status; + char *result; + + char *names[] = {"ID", "Tag", NULL}; + char *parts[2]; + + char *uri = malloc(strlen(SERVER)+strlen(op)+36); + sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); + + parts[0] = svf_id; + parts[1] = tag; + + result = http_multipart_post( + uri, + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + free(uri); + + if(status!=200) { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 1; + } + if(result && strncmp(result, "OK", 2)) { + error_ui(vid_buf, 0, result); + free(result); + return 1; + } + + if(result[2]) { + strncpy(svf_tags, result+3, 255); + svf_id[15] = 0; + } + + if(result) + free(result); + + return 0; +} + +struct strlist { + char *str; + struct strlist *next; +}; +void strlist_add(struct strlist **list, char *str) +{ + struct strlist *item = malloc(sizeof(struct strlist)); + item->str = mystrdup(str); + item->next = *list; + *list = item; +} +int strlist_find(struct strlist **list, char *str) +{ + struct strlist *item; + for(item=*list;item;item=item->next) + if(!strcmp(item->str, str)) + return 1; + return 0; +} +void strlist_free(struct strlist **list) +{ + struct strlist *item; + while(*list) { + item = *list; + *list = (*list)->next; + free(item); + } +} + +void tag_list_ui(pixel *vid_buf) +{ + int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; + char *p,*q,s; + char *tag=NULL, *op=NULL; + ui_edit ed; + struct strlist *vote=NULL,*down=NULL; + + ed.x = x0+25; + ed.y = y0+221; + ed.w = 158; + ed.nx = 1; + ed.def = "[new tag]"; + ed.focus = 0; + ed.hide = 0; + ed.cursor = 0; + strcpy(ed.str, ""); + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + op = tag = NULL; + + drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 256); + drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); + p = svf_tags; + s = svf_tags[0] ? ' ' : 0; + y = 36 + y0; + while(s) { + q = strchr(p, ' '); + if(!q) + q = p+strlen(p); + s = *q; + *q = 0; + if(svf_own || svf_admin || svf_mod) { + drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); + d = 14; + if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) { + if(!ed1.focus) + break; + ed1.focus = 0; + ed2.focus = 1; + } + if(sdl_key==SDLK_ESCAPE) { + if(!ed1.focus && !ed2.focus) + return; + ed1.focus = 0; + ed2.focus = 0; + } + } + + strcpy(svf_user, ed1.str); + md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); + + res = http_multipart_post( + "http://" SERVER "/Login.api", + NULL, NULL, NULL, + svf_user, svf_pass, + &err, NULL); + if(err != 200) { + error_ui(vid_buf, err, http_ret_text(err)); + if(res) + free(res); + goto fail; + } + if(res && !strncmp(res, "OK", 2)) { + if(!strcmp(res, "OK ADMIN")){ + svf_admin = 1; + svf_mod = 0; + } else if(!strcmp(res, "OK MOD")){ + svf_admin = 0; + svf_mod = 1; + } else { + svf_admin = 0; + svf_mod = 0; + } + free(res); + svf_login = 1; + return; + } + if(!res) + res = mystrdup("Unspecified Error"); + error_ui(vid_buf, 0, res); + free(res); + +fail: + strcpy(svf_user, ""); + strcpy(svf_pass, ""); + svf_login = 0; + svf_own = 0; + svf_admin = 0; + svf_mod = 0; +} + +void execute_delete(pixel *vid_buf, char *id) +{ + int status; + char *result; + + char *names[] = {"ID", NULL}; + char *parts[1]; + + parts[0] = id; + + result = http_multipart_post( + "http://" SERVER "/Delete.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result) + free(result); +} + +int execute_vote(pixel *vid_buf, char *id, char *action) +{ + int status; + char *result; + + char *names[] = {"ID", "Action", NULL}; + char *parts[2]; + + parts[0] = id; + parts[1] = action; + + result = http_multipart_post( + "http://" SERVER "/Vote.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 0; + } + if(result && strncmp(result, "OK", 2)) { + error_ui(vid_buf, 0, result); + free(result); + return 0; + } + + if(result) + free(result); + return 1; +} + +static char hex[] = "0123456789ABCDEF"; +void strcaturl(char *dst, char *src) +{ + char *d; + unsigned char *s; + + for(d=dst; *d; d++) ; + + for(s=(unsigned char *)src; *s; s++) { + if((*s>='0' && *s<='9') || + (*s>='a' && *s<='z') || + (*s>='A' && *s<='Z')) + *(d++) = *s; + else { + *(d++) = '%'; + *(d++) = hex[*s>>4]; + *(d++) = hex[*s&15]; + } + } + *d = 0; +} + +#define THUMB_CACHE_SIZE 256 + +char *thumb_cache_id[THUMB_CACHE_SIZE]; +void *thumb_cache_data[THUMB_CACHE_SIZE]; +int thumb_cache_size[THUMB_CACHE_SIZE]; +int thumb_cache_lru[THUMB_CACHE_SIZE]; + +void thumb_cache_inval(char *id) +{ + int i,j; + for(i=0;i= THUMB_CACHE_SIZE) + return; + free(thumb_cache_id[i]); + free(thumb_cache_data[i]); + thumb_cache_id[i] = NULL; + for(j=0;j thumb_cache_lru[i]) + thumb_cache_lru[j]--; +} +void thumb_cache_add(char *id, void *thumb, int size) +{ + int i,m=-1,j=-1; + thumb_cache_inval(id); + for(i=0;i m) { + m = thumb_cache_lru[i]; + j = i; + } + } + if(i >= THUMB_CACHE_SIZE) { + thumb_cache_inval(thumb_cache_id[j]); + i = j; + } + for(j=0;j= THUMB_CACHE_SIZE) + return 0; + for(j=0;j=GRID_X*GRID_Y) + break; + if(votes) { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } else { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+5); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } else if(!strncmp(str, "TAG ", 4)) { + if(j >= TAG_MAX) { + str = p; + continue; + } + q = strchr(str+4, ' '); + if(!q) { + str = p; + continue; + } + *(q++) = 0; + tag_names[j] = mystrdup(str+4); + tag_votes[j] = atoi(q); + j++; + } else { + if(i>=GRID_X*GRID_Y) + break; + if(votes) { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } else { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + str = p; + } + if(*str) + i++; + return i; +} + +#define IMGCONNS 3 +#define TIMEOUT 100 +#define HTTP_TIMEOUT 10 + +int search_own = 0; +int search_date = 0; +int search_page = 0; +char search_expr[256] = ""; + +int search_ui(pixel *vid_buf) +{ + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; + float ry; + time_t http_last_use=HTTP_TIMEOUT; + ui_edit ed; + + + void *http = NULL; + int active = 0; + char *last = NULL; + int search = 0; + int lasttime = TIMEOUT; + char *uri; + int status; + char *results; + char *tmp, ts[64]; + + void *img_http[IMGCONNS]; + char *img_id[IMGCONNS]; + void *thumb, *data; + int thlen, dlen; + + memset(img_http, 0, sizeof(img_http)); + memset(img_id, 0, sizeof(img_id)); + + memset(search_ids, 0, sizeof(search_ids)); + memset(search_names, 0, sizeof(search_names)); + memset(search_scoreup, 0, sizeof(search_scoreup)); + memset(search_scoredown, 0, sizeof(search_scoredown)); + memset(search_publish, 0, sizeof(search_publish)); + memset(search_owners, 0, sizeof(search_owners)); + memset(search_thumbs, 0, sizeof(search_thumbs)); + memset(search_thsizes, 0, sizeof(search_thsizes)); + + do_open = 0; + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = 65; + ed.y = 13; + ed.w = XRES-200; + ed.nx = 1; + ed.def = "[search terms]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(search_expr); + strcpy(ed.str, search_expr); + + sdl_wheel = 0; + + while(!sdl_poll()) { + uih = 0; + bq = b; + mxq = mx; + myq = my; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + if(mx!=mxq || my!=myq || sdl_wheel || b) + mmt = 0; + else if(mmt 9) { + drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); + drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); + } + + ui_edit_draw(vid_buf, &ed); + + if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) { + if(search_page) { + search_page --; + lasttime = TIMEOUT; + } + sdl_wheel = 0; + uih = 1; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) { + lasttime = TIMEOUT; + search_page ++; + page_count = exp_res; + } + sdl_wheel = 0; + uih = 1; + } + + tp = -1; + if(is_p1) { + drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); + for(gj=0;gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14);gj++) + for(gi=0;giTAG_MAX || !tag_names[pos]) + break; + if(tag_votes[0]) + i = 127+(128*tag_votes[pos])/tag_votes[0]; + else + i = 192; + w = textwidth(tag_names[pos]); + if(w>XRES/GRID_X-5) + w = XRES/GRID_X-5; + gx = (XRES/GRID_X)*gi; + gy = gj*14 + 46; + if(mx>=gx && mx=gy && my XRES/GRID_X-10) { + tmp = malloc(strlen(search_names[pos])+4); + strcpy(tmp, search_names[pos]); + j = textwidthx(tmp, XRES/GRID_X-15); + strcpy(tmp+j, "..."); + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); + free(tmp); + } else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); + j = textwidth(search_owners[pos]); + if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && + my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) { + st = 1; + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); + } else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); + if(search_thumbs[pos]) + render_thumb(search_thumbs[pos], search_thsizes[pos], 1, vid_buf, gx, gy, GRID_S); + own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); + if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) + mp = pos; + if(own) { + if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) { + mp = -1; + dp = pos; + } + } + if(mp==pos && !st) + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); + else + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); + if(own) { + if(dp == pos) + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); + else + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); + } + if(!search_publish[pos]){ + drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); + drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } + if(view_own || svf_admin || svf_mod) { + sprintf(ts+1, "%d", search_votes[pos]); + ts[0] = 0xBB; + for(j=1; ts[j]; j++) + ts[j] = 0xBC; + ts[j-1] = 0xB9; + ts[j] = 0xBA; + ts[j+1] = 0; + w = gx+XRES/GRID_S-2-textwidth(ts); + h = gy+YRES/GRID_S-11; + drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); + for(j=0; ts[j]; j++) + ts[j] -= 14; + drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); + sprintf(ts, "%d", search_votes[pos]); + for(j=0; ts[j]; j++) + ts[j] += 127; + drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); + } + if(search_scoreup[pos]>0||search_scoredown[pos]>0){ + lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); + + if(((YRES/GRID_S+3)/2)>lv){ + ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); + if(lv<8){ + ry = ry/(8-lv); + } + nyu = search_scoreup[pos]*ry; + nyd = search_scoredown[pos]*ry; + } else { + ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); + nyu = search_scoreup[pos]/ry; + nyd = search_scoredown[pos]/ry; + } + + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); + + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); + } + } + + if(mp!=-1 && mmt>=TIMEOUT/5 && !st) { + gi = mp % GRID_X; + gj = mp / GRID_X; + if(is_p1) + gj += GRID_Y-GRID_P; + gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; + gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; + i = w = textwidth(search_names[mp]); + h = YRES/GRID_Z+30; + if(w=XRES-2) gx=XRES-3-w; + if(gy<32) gy=32; + if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; + clearrect(vid_buf, gx-2, gy-3, w+4, h); + drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); + if(search_thumbs[mp]) + render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); + drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); + drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); + } + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(sdl_key==SDLK_RETURN) { + if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) + lasttime = TIMEOUT; + else if(search_ids[0] && !search_ids[1]) { + bq = 0; + b = 1; + mp = 0; + } + } + if(sdl_key==SDLK_ESCAPE) + goto finish; + + if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) { + search_own = !search_own; + lasttime = TIMEOUT; + } + if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) { + search_date = !search_date; + lasttime = TIMEOUT; + } + + if(b && !bq && dp!=-1) + if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) { + execute_delete(vid_buf, search_ids[dp]); + lasttime = TIMEOUT; + if(last) { + free(last); + last = NULL; + } + } + + if(b && !bq && tp!=-1) { + strncpy(ed.str, tag_names[tp], 255); + lasttime = TIMEOUT; + } + + if(b && !bq && mp!=-1 && st) { + sprintf(ed.str, "user:%s", search_owners[mp]); + lasttime = TIMEOUT; + } + + if(do_open==1){ + mp = 0; + } + + if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) { + fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); + info_box(vid_buf, "Loading..."); + + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + data = http_simple_get(uri, &status, &dlen); + free(uri); + + if(status == 200) { + status = parse_save(data, dlen, 1, 0, 0); + switch(status) { + case 1: + error_ui(vid_buf, 0, "Simulation corrupted"); + break; + case 2: + error_ui(vid_buf, 0, "Simulation from a newer version"); + break; + case 3: + error_ui(vid_buf, 0, "Simulation on a too large grid"); + break; + } + if(!status) { + char *tnames[] = {"ID", NULL}; + char *tparts[1]; + int tplens[1]; + if(svf_last) + free(svf_last); + svf_last = data; + svf_lsize = dlen; + + tparts[0] = search_ids[mp]; + tplens[0] = strlen(search_ids[mp]); + data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); + + svf_open = 1; + svf_own = svf_login && !strcmp(search_owners[mp], svf_user); + svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); + + strcpy(svf_id, search_ids[mp]); + strcpy(svf_name, search_names[mp]); + if(status == 200) { + if(data) { + strncpy(svf_tags, data, 255); + svf_tags[255] = 0; + } else + svf_tags[0] = 0; + } else { + svf_tags[0] = 0; + } + + if(svf_login){ + char *names[] = {"ID", NULL}; + char *parts[1]; + parts[0] = search_ids[mp]; + data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); + if(status == 200){ + if(data){ + if(!strcmp(data, "Up")){ + svf_myvote = 1; + } else if(!strcmp(data, "Down")){ + svf_myvote = -1; + } else { + svf_myvote = 0; + } + } else { + svf_myvote = 0; + } + } else { + svf_myvote = 0; + } + } + } else { + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + } + } else + error_ui(vid_buf, status, http_ret_text(status)); + + if(data) + free(data); + goto finish; + } + + if(!last) + search = 1; + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) { + search = 1; + if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) { + search_page = 0; + page_count = 0; + } + free(last); + last = NULL; + } else + search = 0; + + if(search && lasttime>=TIMEOUT) { + lasttime = 0; + last = mystrdup(ed.str); + last_own = search_own; + last_date = search_date; + last_page = search_page; + active = 1; + uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); + if(search_own || svf_admin || svf_mod) + tmp = "&ShowVotes=true"; + else + tmp = ""; + if(!search_own && !search_date && !*last) { + if(search_page) { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); + } else { + exp_res = GRID_X*GRID_P; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); + } + } else { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); + } + strcaturl(uri, last); + if(search_own) { + strcaturl(uri, " user:"); + strcaturl(uri, svf_user); + } + if(search_date) + strcaturl(uri, " sort:date"); + http = http_async_req_start(http, uri, NULL, 0, 1); + if(svf_login){ + http_auth_headers(http, svf_user, svf_pass); + } + http_last_use = time(NULL); + free(uri); + } + + if(active && http_async_req_status(http)) { + http_last_use = time(NULL); + results = http_async_req_stop(http, &status, NULL); + view_own = last_own; + if(status == 200) + page_count = search_results(results, last_own||svf_admin||svf_mod); + is_p1 = (exp_res < GRID_X*GRID_Y); + free(results); + active = 0; + } + + if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) { + http_async_req_close(http); + http = NULL; + } + + for(i=0;i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) { + if(stamp_page) { + stamp_page --; + } + sdl_wheel = 0; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; +} + +void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) +{ + char t[2]; + t[0] = ch; + t[1] = 0; + if(flag) { + fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); + } else { + drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); + } +} + +void render_signs(pixel *vid_buf) +{ + int i, j, x, y, w, h, dx, dy; + for(i=0; i 18) ? -1 : 1; + for(j=0; j<4; j++) { + drawpixel(vid_buf, x, y, 192, 192, 192, 255); + x+=dx; + y+=dy; + } + } +} + +void add_sign_ui(pixel *vid_buf, int mx, int my) +{ + int i, w, h, x, y, nm=0, ju; + int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; + ui_edit ed; + + // check if it is an existing sign + for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) + break; + } + // else look for empty spot + if(i >= MAXSIGNS) { + nm = 1; + for(i=0; i= MAXSIGNS) + return; + + if(nm) { + signs[i].x = mx; + signs[i].y = my; + signs[i].ju = 1; + } + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = x0+25; + ed.y = y0+25; + ed.w = 158; + ed.nx = 1; + ed.def = "[message]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(signs[i].text); + strcpy(ed.str, signs[i].text); + ju = signs[i].ju; + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed); + drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); + draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); + draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); + draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); + + if(!nm) { + drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); + drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); + drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); + } + + drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) + ju = 0; + if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) + ju = 1; + if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) + ju = 2; + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) { + signs[i].text[0] = 0; + return; + } + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) { + if(!ed.focus) + return; + ed.focus = 0; + } + } + + strcpy(signs[i].text, ed.str); + signs[i].ju = ju; +} + +/*********************************************************** + * CONFIG FILE * + ***********************************************************/ + +char http_proxy[256] = ""; + +void save_string(FILE *f, char *str) +{ + int li = strlen(str); + unsigned char lb[2]; + lb[0] = li; + lb[1] = li >> 8; + fwrite(lb, 2, 1, f); + fwrite(str, li, 1, f); +} + +int load_string(FILE *f, char *str, int max) +{ + int li; + unsigned char lb[2]; + fread(lb, 2, 1, f); + li = lb[0] | (lb[1] << 8); + if(li > max) { + str[0] = 0; + return 1; + } + fread(str, li, 1, f); + str[li] = 0; + return 0; +} + +unsigned char last_major=0, last_minor=0, update_flag=0; + +void save_presets(int do_update) +{ + FILE *f=fopen("powder.def", "wb"); + unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; + unsigned char tmp = sdl_scale; + if(!f) + return; + fwrite(sig, 1, 4, f); + save_string(f, svf_user); + save_string(f, svf_pass); + fwrite(&tmp, 1, 1, f); + tmp = cmode; + fwrite(&tmp, 1, 1, f); + tmp = svf_admin; + fwrite(&tmp, 1, 1, f); + tmp = svf_mod; + fwrite(&tmp, 1, 1, f); + save_string(f, http_proxy); + tmp = SAVE_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = MINOR_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = do_update; + fwrite(&tmp, 1, 1, f); + fclose(f); +} + +void load_presets(void) +{ + FILE *f=fopen("powder.def", "rb"); + unsigned char sig[4], tmp; + if(!f) + return; + fread(sig, 1, 4, f); + if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66){ + if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F){ + if(fseek(f, -3, SEEK_END)){ + remove("powder.def"); + return; + } + if(fread(sig, 1, 3, f) != 3){ + remove("powder.def"); + goto fail; + } + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; + } + fclose(f); + remove("powder.def"); + return; + } + if(load_string(f, svf_user, 63)) + goto fail; + if(load_string(f, svf_pass, 63)) + goto fail; + svf_login = !!svf_user[0]; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + sdl_scale = (tmp == 2) ? 2 : 1; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; +#ifdef HEAT_ENABLE + cmode = tmp%6; +#else + cmode = tmp%5; +#endif + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_admin = tmp; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_mod = tmp; + if(load_string(f, http_proxy, 255)) + goto fail; + if(fread(sig, 1, 3, f) != 3) + goto fail; + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; +fail: + fclose(f); +} + +void dim_copy(pixel *dst, pixel *src) +{ + int i,r,g,b; + for(i=0;i0) + r--; + if(g>0) + g--; + if(b>0) + b--; + dst[i] = PIXRGB(r,g,b); + } +} + +unsigned int fire_alpha[CELL*3][CELL*3]; +void prepare_alpha(void) +{ + int x,y,i,j; + float temp[CELL*3][CELL*3]; + memset(temp, 0, sizeof(temp)); + for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; + fire_g[j][i] = g>4 ? g-4 : 0; + fire_b[j][i] = b>4 ? b-4 : 0; + } +} + +int zoom_en = 0; +int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; +int zoom_wx=0, zoom_wy=0; +void render_zoom(pixel *img) +{ + int x, y, i, j; + pixel pix; + drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); + drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); + clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); + for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) { + xor_pixel(x+i, y+j, vid); + if(j) xor_pixel(x+i, y-j, vid); + if(i) xor_pixel(x-i, y+j, vid); + if(i&&j) xor_pixel(x-i, y-j, vid); + } + } else { + int tc; + c = (r/CELL) * CELL; + x = (x/CELL) * CELL; + y = (y/CELL) * CELL; + + tc = !((c%(CELL*2))==0); + + x -= c/2; + y -= c/2; + + x += tc*(CELL/2); + y += tc*(CELL/2); + + for(i=0; i2){ + pthread_t pth; + pthread_create(&pth,NULL,update_air_th,""); + } else { + update_air(); + } +#else + update_air(); +#endif + } + if(cmode==0 || cmode==1) { + draw_air(vid_buf); + } else if(cmode==2) { + memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); + memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); + } else { + memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + } + update_particles(vid_buf); + + if(cmode==2) { + if(!fire_fc) { + dim_copy(fire_bg, vid_buf); + } else { + memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); + } + fire_fc = (fire_fc+1) % 3; + } + if(cmode==3||cmode==4) + render_fire(vid_buf); + + render_signs(vid_buf); + + //clearrect(vid_buf, 0, YRES, XRES, MENUSIZE); + memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); + //memset(vid_buf+(x+1+(XRES+BARSIZE)*(y+i)), 0, PIXELSIZE*(w-1)); + clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); + + // Old Menu, you will be missed; but not forgotten :( + /* for(i=0; iSAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) + old_version = 1; +#else + if(sscanf(ver_data, "%d.%d", &major, &minor)==2) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) + old_version = 1; +#endif + free(ver_data); + } + http_ver_check = NULL; + } + do_check = (do_check+1) & 15; + } + + if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) + if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")){ + break; + } + //break; + if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) { + if(load_mode) { + free(load_img); + free(load_data); + load_mode = 0; + load_data = NULL; + load_img = NULL; + } + if(it > 50) + it = 50; + if(sdl_key=='k' && stamps[1].name[0]) { + j = stamp_ui(vid_buf); + if(j>=0) + load_data = stamp_load(j, &load_size); + else + load_data = NULL; + } else + load_data = stamp_load(0, &load_size); + if(load_data) { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + if(sdl_key=='s') { + if(it > 50) + it = 50; + save_mode = 1; + } + if(sdl_key=='1'){ + set_cmode(0); + } + if(sdl_key=='2'){ + set_cmode(1); + } + if(sdl_key=='3'){ + set_cmode(2); + } + if(sdl_key=='4'){ + set_cmode(3); + } + if(sdl_key=='5'){ + set_cmode(4); + } + if(sdl_key=='6'){ + set_cmode(5); + } + if(sdl_key==SDLK_SPACE) + sys_pause = !sys_pause; + if(sdl_key=='p') + dump_frame(vid_buf, XRES, YRES, XRES); + if(sdl_key=='c') { +#ifdef HEAT_ENABLE + set_cmode((cmode+1) % 6); +#else + set_cmode((cmode+1) % 5); +#endif + if(it > 50) + it = 50; + } +#ifdef INTERNAL + if(sdl_key=='v') + vs = !vs; + if(vs) + dump_frame(vid_buf, XRES, YRES, XRES); +#endif + + if(sdl_wheel) { + if(sdl_zoom_trig==1){ + ZSIZE += sdl_wheel; + if(ZSIZE>32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + sdl_wheel = 0; + } else { + bs += sdl_wheel; + if(bs>16) + bs = 16; + if(bs<0) + bs = 0; + sdl_wheel = 0; + /*if(su >= PT_NUM) { + if(sl < PT_NUM) + su = sl; + if(sr < PT_NUM) + su = sr; + }*/ + } + } + + bq = b; + b = SDL_GetMouseState(&x, &y); + + for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy + && x0 && y0 && x>8)>=NPART || !cr)){ +#ifdef BETA + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); +#else + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); +#endif + } else { + sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + } + } +#endif + mx = x; + my = y; + if(update_flag) { + info_box(vid_buf, "Finalizing update..."); + if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) { + update_cleanup(); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } else { + if(update_finish()) + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + else + info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); + } + update_flag = 0; + } + + if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && + x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) { + tmp = malloc(64); +#ifdef BETA + if(is_beta){ + sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); + } else { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); + } +#else + sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); +#endif + if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) { + free(tmp); + tmp = download_ui(vid_buf, my_uri, &i); + if(tmp) { + save_presets(1); + if(update_start(tmp, i)) { + update_cleanup(); + save_presets(0); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } else + return 0; + } + } else + free(tmp); + } + if(y>=sdl_scale*(YRES+(MENUSIZE-20))) { + if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0){ + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0){ + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0){ + db = (svf_myvote==1) ? 273 : 274; + if(da < 51) + da ++; + } +#ifdef HEAT_ENABLE + else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) { +#else + else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-365))*sdl_scale) && svf_login && svf_open) { +#endif + db = svf_own ? 257 : 256; + if(da < 51) + da ++; +#ifdef HEAT_ENABLE + } else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) { + db = 270; + if(da < 51) + da ++; +#endif + } else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) { + db = 266; + if(da < 51) + da ++; + } else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) { + db = 259; + if(svf_open && svf_own && x<=55*sdl_scale) + db = 258; + if(da < 51) + da ++; + } else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) { + db = svf_login ? 261 : 260; + if(svf_admin) { + db = 268; + } else if(svf_mod) { + db = 271; + } + if(da < 51) + da ++; + } else if(x>=sdl_scale && x<=17*sdl_scale) { + db = 262; + if(da < 51) + da ++; + } else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) { + db = sys_pause ? 264 : 263; + if(da < 51) + da ++; + } else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) { + db = 267; + if(da < 51) + da ++; + } else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) { + db = 265; + if(da < 51) + da ++; + } else if(da > 0) + da --; + } else + if(da > 0) + da --; + + if(!sdl_zoom_trig && zoom_en==1) + zoom_en = 0; + + if(sdl_key==Z_keysym && zoom_en==2) + zoom_en = 1; + + if(load_mode) { + load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); + load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); + if(load_x+load_w>XRES) load_x=XRES-load_w; + if(load_y+load_h>YRES) load_y=YRES-load_h; + if(load_x<0) load_x=0; + if(load_y<0) load_y=0; + if(bq==1 && !b) { + parse_save(load_data, load_size, 0, load_x, load_y); + free(load_data); + free(load_img); + load_mode = 0; + } else if(bq==4 && !b) { + free(load_data); + free(load_img); + load_mode = 0; + } + } else if(save_mode==1) { + save_x = (mx/sdl_scale)/CELL; + save_y = (my/sdl_scale)/CELL; + if(save_x >= XRES/CELL) save_x = XRES/CELL-1; + if(save_y >= YRES/CELL) save_y = YRES/CELL-1; + save_w = 1; + save_h = 1; + if(b==1) + save_mode = 2; + else if(b==4) + save_mode = 0; + } else if(save_mode==2) { + save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; + save_h = (my/sdl_scale+CELL/2)/CELL - save_y; + if(save_w>XRES/CELL) save_w = XRES/CELL; + if(save_h>YRES/CELL) save_h = YRES/CELL; + if(save_w<1) save_w = 1; + if(save_h<1) save_h = 1; + if(!b) { + stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + save_mode = 0; + } + } else if(sdl_zoom_trig && zoom_en<2) { + x /= sdl_scale; + y /= sdl_scale; + x -= ZSIZE/2; + y -= ZSIZE/2; + if(x<0) x=0; + if(y<0) y=0; + if(x>XRES-ZSIZE) x=XRES-ZSIZE; + if(y>YRES-ZSIZE) y=YRES-ZSIZE; + zoom_x = x; + zoom_y = y; + zoom_wx = (x 50) + it = 50; + x /= sdl_scale; + y /= sdl_scale; + if(y>=YRES+(MENUSIZE-20)) { + if(!lb) { + if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0){ + if(execute_vote(vid_buf, svf_id, "Up")){ + svf_myvote = 1; + } + } + if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0){ + if(execute_vote(vid_buf, svf_id, "Down")){ + svf_myvote = -1; + } + } +#ifdef HEAT_ENABLE + if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) +#else + if(x>=219 && x<=(XRES+BARSIZE-(510-365)) && svf_login && svf_open) +#endif + tag_list_ui(vid_buf); +#ifdef HEAT_ENABLE + if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) { + legacy_enable = !legacy_enable; + } +#endif + if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) { + memset(signs, 0, sizeof(signs)); + memset(pv, 0, sizeof(pv)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(fvx, 0, sizeof(fvx)); + memset(fvy, 0, sizeof(fvy)); + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(parts, 0, sizeof(particle)*NPART); + for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) { + login_ui(vid_buf); + if(svf_login) + save_presets(0); + } + if(x>=37 && x<=187 && svf_login) { + if(!svf_open || !svf_own || x>51) { + if(save_name_ui(vid_buf)) + execute_save(vid_buf); + } else + execute_save(vid_buf); + while(!sdl_poll()) + if(!SDL_GetMouseState(&x, &y)) + break; + b = bq = 0; + } + if(x>=1 && x<=17) { + search_ui(vid_buf); + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + } + if(x>=19 && x<=35 && svf_last && svf_open) + parse_save(svf_last, svf_lsize, 1, 0, 0); + if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { +#ifdef HEAT_ENABLE + if(b & SDL_BUTTON_LMASK) + set_cmode((cmode+1) % 6); + if(b & SDL_BUTTON_RMASK) + set_cmode((cmode+5) % 6); +#else + if(b & SDL_BUTTON_LMASK) + set_cmode((cmode+1) % 5); + if(b & SDL_BUTTON_RMASK) + set_cmode((cmode+4) % 5); +#endif + save_presets(0); + } + if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) + sys_pause = !sys_pause; + lb = 0; + } + } else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)){ + c = sl = cr&0xFF; + } else { + //Something + } + } + //create_parts(x, y, bs, SPC_AIR); + lx = x; + ly = y; + lb = 0; + lm = 0; + } else { + create_parts(x, y, bs, c); + lx = x; + ly = y; + lb = b; + lm = 0; + } + } + } + } else { + if(lb && lm) { + x /= sdl_scale; + y /= sdl_scale; + c = (lb&1) ? sl : sr; + su = c; + if(lm == 1) { + if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) + create_line(lx, ly, x, y, bs, c); + } else + create_box(lx, ly, x, y, c); + lm = 0; + } + lb = 0; + } + + if(load_mode) { + draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); + xor_rect(vid_buf, load_x, load_y, load_w, load_h); + } + + if(save_mode) { + xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + da = 51; + db = 269; + } + + if(zoom_en!=1 && !load_mode && !save_mode) + render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); + + if(zoom_en) + render_zoom(vid_buf); + + if(da) + switch(db) { + case 256: + drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); + break; + case 257: + drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); + break; + case 258: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); + break; + case 259: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); + break; + case 260: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); + break; + case 261: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); + break; + case 262: + drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); + break; + case 263: + drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); + break; + case 264: + drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); + break; + case 265: + drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); + break; + case 266: + drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); + break; + case 267: + drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); + break; + case 268: + drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); + break; + case 269: + drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); + break; + case 270: + drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); + break; + case 271: + drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); + break; + case 272: + drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); + break; + case 273: + drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); + break; + case 274: + drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); + break; + case 275: + drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); + break; + default: + drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); + } + if(itc) { + itc--; + drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); + } + if(it) { + it--; + //if(fbi_img) + //draw_image(vid_buf, fbi_img, (XRES-FBI_W)/2, (YRES-FBI_H)/2+25, FBI_W, FBI_H, it>12?64:it*5); + drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); + } + + if(old_version) { + clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); +#ifdef BETA + if(is_beta){ + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); + } else { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); + } +#else + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); +#endif + drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); + } + /*#ifdef MT + pthread_join(pth2,NULL); + #endif*/ + + if(hud_enable){ + currentTime = SDL_GetTicks(); + if(currentTime-past>=16) { + past = SDL_GetTicks(); + FPS++; + } + if(currentTime-pastFPS>=1000) { +#ifdef BETA + sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#else + sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#endif + FPSB = FPS; + FPS = 0; + pastFPS = currentTime; + } +#ifdef HEAT_ENABLE + if(sdl_zoom_trig){ + if(x +#ifndef MACOSX +#include +#endif +#include + +#ifdef WIN32 +#include +#else +#include +#include +#endif +#ifdef MACOSX +#include +#include +#include +#endif + +#include "update.h" + +static char *exe_name(void) +{ +#if defined WIN32 + char *name= (char *)malloc(64), max=64, res; + while((res = (char)GetModuleFileName(NULL, name, max)) >= max) { +#elif defined MACOSX + char *fn=malloc(64),*name=malloc(PATH_MAX), max=64, res; + if(_NSGetExecutablePath(fn, &max) != 0) { + fn = realloc(fn, max); + _NSGetExecutablePath(fn, &max); + } + if(realpath(fn, name) == NULL) { + free(fn); + free(name); + return NULL; + } + res = 1; +#else + char fn[64], *name=malloc(64), max=64, res; + sprintf(fn, "/proc/self/exe"); + memset(name, 0, max); + while((res = readlink(fn, name, max)) >= max-1) { +#endif +#ifndef MACOSX + max *= 2; + name = realloc(name, max); + memset(name, 0, max); + } +#endif + if(res <= 0) { + free(name); + return NULL; + } + return name; +} + +int update_start(char *data, int len) +{ + char *self=exe_name(), *temp; +#ifdef WIN32 + char *p; +#endif + FILE *f; + int res = 1; + + if(!self) + return 1; + +#ifdef WIN32 + temp = malloc(strlen(self)+12); + strcpy(temp, self); + p = temp + strlen(temp) - 4; + if(_stricmp(p, ".exe")) + p += 4; + strcpy(p, "_update.exe"); + + if(!MoveFile(self, temp)) + goto fail; + + f = fopen(self, "wb"); + if(!f) + goto fail; + if(fwrite(data, 1, len, f) != len) { + fclose(f); + DeleteFile(self); + goto fail; + } + fclose(f); + + if((int)ShellExecute(NULL, "open", self, NULL, NULL, SW_SHOWNORMAL) <= 32) { + DeleteFile(self); + goto fail; + } + + return 0; +#else + temp = malloc(strlen(self)+8); + strcpy(temp, self); + strcat(temp, "-update"); + + f = fopen(temp, "w"); + if(!f) + goto fail; + if(fwrite(data, 1, len, f) != len) { + fclose(f); + unlink(temp); + goto fail; + } + fclose(f); + + if(chmod(temp, 0755)) { + unlink(temp); + goto fail; + } + + if(rename(temp, self)) { + unlink(temp); + goto fail; + } + + execl(self, "powder-update", NULL); +#endif + +fail: + free(temp); + free(self); + return res; +} + +int update_finish(void) +{ +#ifdef WIN32 + char *temp, *self=exe_name(), *p; + int timeout = 60, err; + + temp = malloc(strlen(self)+12); + strcpy(temp, self); + p = temp + strlen(temp) - 4; + if(_stricmp(p, ".exe")) + p += 4; + strcpy(p, "_update.exe"); + + while(!DeleteFile(temp)) { + err = GetLastError(); + if(err == ERROR_FILE_NOT_FOUND) { + // just as well, then + free(temp); + return 0; + } + Sleep(500); + timeout--; + if(timeout <= 0) { + free(temp); + return 1; + } + } + free(temp); +#endif + return 0; +} + +void update_cleanup(void) +{ +#ifdef WIN32 + update_finish(); +#endif +} diff --git a/update.h b/update.h new file mode 100755 index 0000000..6398d4d --- /dev/null +++ b/update.h @@ -0,0 +1,27 @@ +/** + * Powder Toy - Main source + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +#ifndef UPDATE_H +#define UPDATE_H + +int update_start(char *data, int len); +int update_finish(void); +void update_cleanup(void); + +#endif diff --git a/version.h b/version.h new file mode 100755 index 0000000..64ce64e --- /dev/null +++ b/version.h @@ -0,0 +1,31 @@ +/** + * Powder Toy - Version (Header) + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +#ifndef VERSION_H +#define VERSION_H + +#define SAVE_VERSION 38 +#define MINOR_VERSION 0 +#define IDENT_VERSION "S" //Change this if you're not Simon! It should be a single letter. + +#define MENUV3 +//#define BETA +#define HEAT_ENABLE + +#endif -- cgit v0.9.2-21-gd62e From 19665ff2998eb0f340bad15990473dc68d0737a7 Mon Sep 17 00:00:00 2001 From: triclops200 Date: Mon, 26 Jul 2010 02:33:12 +0800 Subject: Changed plasma's heat value to a realistic 115 This is actually a conservative change seeing as if it was helium plasma it would've been 19 diff --git a/powder.c b/powder.c index 3102a8f..8e21845 100755 --- a/powder.c +++ b/powder.c @@ -619,7 +619,7 @@ const struct part_type ptypes[] = { {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_OTHER, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable."}, {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f, 251, "Plasma, extremely hot."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f, 115, "Plasma, extremely hot."}, {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_OTHER, -250.0f, 46, "Nitrogen Ice."}, }; -- cgit v0.9.2-21-gd62e From 6cd3ba00ea8432b6097d512fbb8a48bacfcb9543 Mon Sep 17 00:00:00 2001 From: triclops200 Date: Mon, 26 Jul 2010 02:47:08 +0800 Subject: Changed glass's specific heat to 150. diff --git a/powder.c b/powder.c index 8e21845..2bf88fe 100755 --- a/powder.c +++ b/powder.c @@ -615,7 +615,7 @@ const struct part_type ptypes[] = { {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f, 170, "Liquid Rubidium."}, {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_OTHER, R_TEMP+0.0f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_OTHER, R_TEMP+0.0f, 251, "Solid. Meltable. Shatters under pressure"}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_OTHER, R_TEMP+0.0f, 150, "Solid. Meltable. Shatters under pressure"}, {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_OTHER, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable."}, {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, -- cgit v0.9.2-21-gd62e From d12bf45aafb99438c60788a1c11e9ef533ac2c37 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 27 Jul 2010 14:13:16 +0100 Subject: Added copy/cut and paste, speed improvements for the 'nearest_part' function diff --git a/Resources/powder-res.rc b/Resources/powder-res.rc new file mode 100644 index 0000000..569b629 --- /dev/null +++ b/Resources/powder-res.rc @@ -0,0 +1,2 @@ +#define IDI_ICON1 101 +IDI_ICON1 ICON DISCARDABLE "powder.ico" -- cgit v0.9.2-21-gd62e From 7e2d1ed3c093c8aef4844c55a810adf57a0bed22 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 27 Jul 2010 14:20:11 +0100 Subject: Added copy/cut and paste, speed improvements for the 'nearest_part' function diff --git a/powder.c b/powder.c index 2bf88fe..4b52a6d 100755 --- a/powder.c +++ b/powder.c @@ -26,9 +26,6 @@ #include #include #include -#ifdef OCL -#include -#endif //#include #ifdef MT #include @@ -64,7 +61,7 @@ #define ZSIZE_D 16 #define ZFACTOR_D 8 -unsigned char ZFACTOR = 256/ZSIZE_D;//ZFACTOR_D; +unsigned char ZFACTOR = 256/ZSIZE_D; unsigned char ZSIZE = ZSIZE_D; #define CELL 4 @@ -115,6 +112,7 @@ char *it_msg = "\brThe Powder Toy\n" "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" "\n" +"\bgControl+C/V/X are Copy, Paste and cut respectively.\n" "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" "\bgPick your material from the menu using mouse left/right buttons.\n" "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" @@ -137,11 +135,7 @@ char *it_msg = "\n" "\bgSpecial thanks to Brian Ledbetter for maintaining ports & server development in the past." "\nand CW for hosting the original server.\n" -#ifdef WIN32 -"\nThanks to Akuryo for Windows icons.\n" -#endif -"\n" -"\bgTo use online features such as saving, you need to register at: http://powder.hardwired.org.uk/Register.html" +"\bgTo use online features such as saving, you need to register at: \brhttp://powder.hardwired.org.uk/Register.html" ; typedef struct { @@ -1110,7 +1104,7 @@ int nearest_part(int ci, int t){ int cy = (int)parts[ci].y; for(i=0; i= YRES/CELL) save_y = YRES/CELL-1; save_w = 1; save_h = 1; - if(b==1) + if(b==1){ save_mode = 2; - else if(b==4) + } else if(b==4){ save_mode = 0; + copy_mode = 0; + } } else if(save_mode==2) { save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; save_h = (my/sdl_scale+CELL/2)/CELL - save_y; @@ -8071,8 +8103,21 @@ int main(int argc, char *argv[]) if(save_w<1) save_w = 1; if(save_h<1) save_h = 1; if(!b) { - stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - save_mode = 0; + if(copy_mode==1){ + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + } else if(copy_mode==2){ + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + } else { + stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + save_mode = 0; + } } } else if(sdl_zoom_trig && zoom_en<2) { x /= sdl_scale; diff --git a/version.h b/version.h index 64ce64e..449eb61 100755 --- a/version.h +++ b/version.h @@ -21,11 +21,11 @@ #define VERSION_H #define SAVE_VERSION 38 -#define MINOR_VERSION 0 -#define IDENT_VERSION "S" //Change this if you're not Simon! It should be a single letter. +#define MINOR_VERSION 1 +#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. #define MENUV3 -//#define BETA +#define BETA #define HEAT_ENABLE #endif -- cgit v0.9.2-21-gd62e From 4bf0a27495ec92319aa210baf4e8a7d920001f5e Mon Sep 17 00:00:00 2001 From: triclops200 Date: Tue, 27 Jul 2010 15:44:53 +0800 Subject: Fixed a bug with neon creating infinate pressure diff --git a/powder.c b/powder.c index 4b52a6d..1917ee6 100755 --- a/powder.c +++ b/powder.c @@ -1182,7 +1182,7 @@ void update_particles_i(pixel *vid, int start, int inc){ vy[y/CELL][x/CELL] *= ptypes[t].airloss; vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - if(t==PT_GASS) { + if(t==PT_GASS||t==PT_NEON) { if(pv[y/CELL][x/CELL]<3.5f) pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); if(y+CELL Date: Wed, 28 Jul 2010 06:48:18 -0700 Subject: Add NOBL - triclops200 diff --git a/powder.c b/powder.c old mode 100755 new mode 100644 index 1917ee6..2328919 --- a/powder.c +++ b/powder.c @@ -1,8474 +1,8499 @@ -/** - * Powder Toy - Main source - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * Copyright (c) 2010 Simon Robertshaw - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -//#include -#ifdef MT -#include -#include -#endif - -#ifdef WIN32 -#include -#else -#include -#include -#endif - - -#include "version.h" -#include "http.h" -#include "md5.h" -#include "update.h" - -#define SERVER "powder.hardwired.org.uk" - -#undef PLOSS - -#ifdef MENUV3 -#define MENUSIZE 40 -#else -#define MENUSIZE 20 -#endif -#define BARSIZE 14 -#define XRES 612 -#define YRES 384 -#define NPART XRES*YRES - -#define ZSIZE_D 16 -#define ZFACTOR_D 8 -unsigned char ZFACTOR = 256/ZSIZE_D; -unsigned char ZSIZE = ZSIZE_D; - -#define CELL 4 -#define ISTP (CELL/2) -#define CFDS (4.0f/CELL) - -typedef unsigned char uint8; - -#ifdef HEAT_ENABLE -#include "hmap.h" -#endif - -#ifdef PIX16 -#define PIXELSIZE 2 -typedef unsigned short pixel; -#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) -#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) -#define PIXR(x) (((x)>>8)&0xF8) -#define PIXG(x) (((x)>>3)&0xFC) -#define PIXB(x) (((x)<<3)&0xF8) -#else -#define PIXELSIZE 4 -typedef unsigned int pixel; -#ifdef PIX32BGR -#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) -#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) -#define PIXR(x) ((x)&0xFF) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)>>16) -#else -#ifdef PIX32BGRA -#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) -#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) -#define PIXR(x) (((x)>>8)&0xFF) -#define PIXG(x) (((x)>>16)&0xFF) -#define PIXB(x) (((x)>>24)) -#else -#define PIXPACK(x) (x) -#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) -#define PIXR(x) ((x)>>16) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)&0xFF) -#endif -#endif -#endif - -char *it_msg = -"\brThe Powder Toy\n" -"\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" -"\n" -"\bgControl+C/V/X are Copy, Paste and cut respectively.\n" -"\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" -"\bgPick your material from the menu using mouse left/right buttons.\n" -"Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" -"Shift+drag will create straight lines of particles.\n" -"Ctrl+drag will result in filled rectangles.\n" -"Ctrl+Shift+click will flood-fill a closed area.\n" -"Middle click or Alt+Click to \"sample\" the particles.\n" -"\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" -"Use 'S' to save parts of the window as 'stamps'.\n" -"'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" -"'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" -"Use the mouse scroll wheel to change the tool size for particles.\n" -"'Q' will quit the application.\n" -"The spacebar can be used to pause physics.\n" -"'P' will take a screenshot and save it into the current directory.\n" -"\n" -"\brhttp://powder.hardwired.org.uk/\n" -"\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" -"\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powder.hardwired.org.uk\bg)\n" -"\n" -"\bgSpecial thanks to Brian Ledbetter for maintaining ports & server development in the past." -"\nand CW for hosting the original server.\n" -"\bgTo use online features such as saving, you need to register at: \brhttp://powder.hardwired.org.uk/Register.html" -; - -typedef struct { - int start, inc; - pixel *vid; -} upstruc; - -#ifdef BETA -char *old_ver_msg_beta = "A new beta is available - click here!"; -#endif -char *old_ver_msg = "A new version is available - click here!"; -#ifdef HEAT_ENABLE -float mheat = 0.0f; -#endif - -int do_open = 0; -int sys_pause = 0; -int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. - -int amd = 0; - -unsigned char fire_r[YRES/CELL][XRES/CELL]; -unsigned char fire_g[YRES/CELL][XRES/CELL]; -unsigned char fire_b[YRES/CELL][XRES/CELL]; - -#define MAXSIGNS 16 - -struct sign { - int x,y,ju; - char text[256]; -} signs[MAXSIGNS]; - -/*********************************************************** - * AIR FLOW SIMULATOR * - ***********************************************************/ - -unsigned char bmap[YRES/CELL][XRES/CELL]; -unsigned char emap[YRES/CELL][XRES/CELL]; -unsigned cmode = 3; - -float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; -float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; -#define TSTEPP 0.3f -#define TSTEPV 0.4f -#define VADV 0.3f -#define VLOSS 0.999f -#define PLOSS 0.9999f -int numCores = 1; -float kernel[9]; -void make_kernel(void) -{ - int i, j; - float s = 0.0f; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) { - kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); - s += kernel[(i+1)+3*(j+1)]; - } - s = 1.0f / s; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - kernel[(i+1)+3*(j+1)] *= s; -} - -int core_count(){ - int numCPU = 1; -#ifdef MT -#ifdef WIN32 - SYSTEM_INFO sysinfo; - GetSystemInfo( &sysinfo ); - numCPU = sysinfo.dwNumberOfProcessors; -#else -#ifdef MACOSX - numCPU = 4; -#else - numCPU = sysconf( _SC_NPROCESSORS_ONLN ); -#endif -#endif - - printf("Cpus: %d\n", numCPU); - if(numCPU>1) - printf("Multithreading enabled\n"); - else - printf("Multithreading disabled\n"); -#endif - return numCPU; -} - -void update_air(void) -{ - int x, y, i, j; - float dp, dx, dy, f, tx, ty; - - for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; - if(dp < -256.0f) dp = -256.0f; - if(dx > 256.0f) dx = 256.0f; - if(dx < -256.0f) dx = -256.0f; - if(dy > 256.0f) dy = 256.0f; - if(dy < -256.0f) dy = -256.0f; - - ovx[y][x] = dx; - ovy[y][x] = dy; - opv[y][x] = dp; - } - memcpy(vx, ovx, sizeof(vx)); - memcpy(vy, ovy, sizeof(vy)); - memcpy(pv, opv, sizeof(pv)); -} - -void *update_air_th(void *arg) -{ - update_air(); - return NULL; -} - -unsigned clamp_flt(float f, float min, float max) -{ - if(fmax) - return 255; - return (int)(255.0f*(f-min)/(max-min)); -} - -float restrict_flt(float f, float min, float max){ - if(fmax) - return max; - return f; -} - -void draw_air(pixel *vid) -{ - int x, y, i, j; - pixel c; - - if(cmode == 2) - return; - - for(y=0; y 0.0f) - c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); - else - c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); - } else - c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), - clamp_flt(pv[y][x], 0.0f, 8.0f), - clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); - for(j=0; j=XRES || ny>=YRES) - return 0; - if(x==nx && y==ny) - return 1; - r = pmap[ny][nx]; - if(r && (r>>8)>8].type; - - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE)){ - return 1; - } - - if((r&0xFF)==PT_VOID){ - parts[i].type=PT_NONE; - return 0; - } - if((r&0xFF)==PT_BHOL){ - parts[i].type=PT_NONE; -#ifdef HEAT_ENABLE - if(!legacy_enable){ - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; - } -#endif - return 0; - } - - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]){ - return 1; - } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE){ - return 0; - } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])){ - return 0; - } - - if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; - if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) - return 0; - if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) - return 0; - - if(parts[i].type==PT_CNCT && y>8)>= 8; - parts[r].x += x-nx; - parts[r].y += y-ny; - } - - return 1; -} - -void kill_part(int i) -{ - int x, y; - parts[i].type = PT_NONE; - - x = (int)(parts[i].x+0.5f); - y = (int)(parts[i].y+0.5f); - - if(x>=0 && y>=0 && x=XRES || y>=YRES) - return -1; - -#ifdef HEAT_ENABLE - if(t==SPC_HEAT||t==SPC_COOL){ - if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); - } - if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP){ - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); - } - return pmap[y][x]>>8; - } else { - return -1; - } - } -#endif - if(t==SPC_AIR){ - pv[y/CELL][x/CELL] += 0.03f; - if(y+CELL>8].type = PT_SPRK; - parts[pmap[y][x]>>8].life = 4; - parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; - pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; - return pmap[y][x]>>8; - } - - if(p==-1) { - if(pmap[y][x]) - return -1; - if(pfree == -1) - return -1; - i = pfree; - pfree = parts[i].life; - } else - i = p; - - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = t; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 0; - parts[i].ctype = 0; -#ifdef HEAT_ENABLE - parts[i].temp = ptypes[t].heat; -#endif - if(t==PT_ACID){ - parts[i].life = 75; - } - //Testing - /*if(t==PT_WOOD){ - parts[i].life = 150; - }*/ - //End Testing - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_PLSM) - parts[i].life = rand()%150+50; - if(t==PT_LAVA) - parts[i].life = rand()%120+240; - if(t==PT_NEUT) { - float r = (rand()%128+128)/127.0f; - float a = (rand()%360)*3.14159f/180.0f; - parts[i].life = rand()%480+480; - parts[i].vx = r*cosf(a); - parts[i].vy = r*sinf(a); - } - if(t==PT_PHOT) { - float r = (rand()%3-1)*3; - float a = (rand()%3-1)*3; - parts[i].life = 680; - if(a==0.0f&&r==0.0f){ - parts[i].life = 0; - parts[i].type = PT_NONE; - return -1; - } else { - parts[i].vx = a; - parts[i].vy = r; - } - //} else { - // parts[i].life = 0; - // parts[i].type = PT_NONE; - //} - } - - pmap[y][x] = t|(i<<8); - - return i; -} - -void delete_part(int x, int y) -{ - unsigned i; - - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - i = pmap[y][x]; - if(!i || (i>>8)>=NPART) - return; - - kill_part(i>>8); - pmap[y][x] = 0; // just in case -} - -void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -{ - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - if(a!=255) { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -{ - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + 255*PIXR(t)) >> 8; - g = (a*g + 255*PIXG(t)) >> 8; - b = (a*b + 255*PIXB(t)) >> 8; - if(r>255) - r = 255; - if(g>255) - g = 255; - if(b>255) - b = 255; - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); - -int is_wire(int x, int y) -{ - return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; -} -int is_wire_off(int x, int y) -{ - return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; -} - -void set_emap(int x, int y) -{ - int x1, x2; - - if(!is_wire_off(x, y)) - return; - - // go left as far as possible - x1 = x2 = x; - while(x1>0) { - if(!is_wire_off(x1-1, y)) - break; - x1--; - } - while(x21 && x1==x2 && - is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && - !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) - set_emap(x1, y-2); - else if(y>0) - for(x=x1; x<=x2; x++) - if(is_wire_off(x, y-1)) { - if(x==x1 || x==x2 || y>=YRES/CELL-1 || - is_wire(x-1, y-1) || is_wire(x+1, y-1) || - is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) - set_emap(x, y-1); - } - - if(y=XRES || y>=YRES || - bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) { - kill_part(i); - continue; - } - - vx[y/CELL][x/CELL] *= ptypes[t].airloss; - vy[y/CELL][x/CELL] *= ptypes[t].airloss; - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - if(t==PT_GASS||t==PT_NEON) { - if(pv[y/CELL][x/CELL]<3.5f) - pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); - if(y+CELL2.5f) { - parts[i].life = rand()%80+180; - rt = parts[i].type = PT_FIRE; -#ifdef HEAT_ENABLE - parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); -#endif - pv[y/CELL][x/CELL] += 0.25f * CFDS; - t = PT_FIRE; - } - - parts[i].vx *= ptypes[t].loss; - parts[i].vy *= ptypes[t].loss; - - if(t==PT_DFRM && !parts[i].life) { - if(pv[y/CELL][x/CELL]>1.0f) { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - parts[i].life = rand()%80+300; - } - } else { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - - if(ptypes[t].diffusion) { - parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - } - - // interpolator -#ifdef WIN32 - mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#else - mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#endif - if(mv < ISTP) { - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - } else { - dx = parts[i].vx*ISTP/mv; - dy = parts[i].vy*ISTP/mv; - ix = parts[i].x; - iy = parts[i].y; - while(1) { - mv -= ISTP; - if(mv <= 0.0f) { - // nothing found - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - break; - } - ix += dx; - iy += dy; - nx = (int)(ix+0.5f); - ny = (int)(iy+0.5f); - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) { - parts[i].x = ix; - parts[i].y = iy; - break; - } - } - } - - a = nt = 0; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx4.0f) - t = parts[i].type = PT_DSTW; - if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) - t = parts[i].type = PT_OILL; - if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) - t = parts[i].type = PT_GASS; -#ifdef HEAT_ENABLE - } -#endif - if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) - t = parts[i].type = PT_BRMT; - if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) - t = parts[i].type = PT_BGLA; - if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) - t = parts[i].type = PT_SNOW; - if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) { - t = PT_NEUT; - create_part(i, x, y, t); - } - - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1){ - nearp = nearest_part(i, PT_ETRD); - if(nearp!=-1){ - create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[nearp].type = PT_SPRK; - parts[nearp].life = 9; - parts[nearp].ctype = PT_ETRD; - } - } - -#ifdef HEAT_ENABLE - if(!legacy_enable){ - int ctemp = pv[y/CELL][x/CELL]*2; - c_heat = 0.0f; - h_count = 0; - if(ptypes[t].hconduct>(rand()%250)){ - for(nx=-1; nx<2; nx++) { - for(ny=-1; ny<2; ny++) { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE){ - h_count++; - c_heat += parts[r>>8].temp; - } - } - } - } - pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); - for(nx=-1; nx<2; nx++) { - for(ny=-1; ny<2; ny++) { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE){ - parts[r>>8].temp = parts[i].temp; - } - } - } - } - if(pt>=pstates[t].btemp&&pstates[t].burn) { - t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - } - else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid){ - if(t==PT_LAVA&&parts[i].ctype){ - parts[i].life = 0; - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp){ - parts[i].ctype = parts[i].type; - t = parts[i].type = PT_ICEI; - } else { - parts[i].life = 0; - t = parts[i].type = pstates[t].solid; - } - } else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)){ - if(pstates[t].liquid==PT_LAVA){ - parts[i].life = rand()%120+240; - parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; - parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; - t = parts[i].type = pstates[t].liquid; - } else if(t==PT_ICEI&&parts[i].ctype){ - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } else { - t = parts[i].type = pstates[t].liquid; - } - }else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS){ - t = parts[i].type = pstates[t].liquid; - }else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)){ - if(t==PT_SLTW&&1>rand()%6){ - t = parts[i].type = PT_SALT; - } else { - t = parts[i].type = pstates[t].gas; - pv[y/CELL][x/CELL] += 0.50f; - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - } - } - if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f){ - float atemp = parts[i].temp + (-MIN_TEMP); - pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; - } - if(t==PT_LAVA){ - parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - } - pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - } - } - if(t==PT_CSCN&&parts[i].temp>24.0f){ - pt = parts[i].temp -= 2.5f; - } - if(t==PT_HSCN&&parts[i].temp>24.0f){ - pt = parts[i].temp -= 2.5f; - } - #endif - - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK) { - nx = x % CELL; - if(nx == 0) - nx = x/CELL - 1; - else if(nx == CELL-1) - nx = x/CELL + 1; - else - nx = x/CELL; - ny = y % CELL; - if(ny == 0) - ny = y/CELL - 1; - else if(ny == CELL-1) - ny = y/CELL + 1; - else - ny = y/CELL; - if(nx>=0 && ny>=0 && nx0){ - int ttx = (rand()%3)-1; - r = pmap[y-1][x+ttx]; - if(parts[i].life>50){ - if((pmap[y-1][x+ttx]&0xFF)==PT_NONE){ - create_part(-1, x+ttx, y-1, PT_WOOD); - parts[pmap[y-1][x+ttx]>>8].life = parts[i].life-1; - parts[pmap[y-1][x+ttx]>>8].vx = ttx; - } - if((pmap[y-1][x+ttx-1]&0xFF)==PT_NONE){ - create_part(-1, x+ttx-1, y-1, PT_WOOD); - parts[pmap[y-1][x+ttx-1]>>8].life = 0; - } - if((pmap[y-1][x+ttx+1]&0xFF)==PT_NONE){ - create_part(-1, x+ttx+1, y-1, PT_WOOD); - parts[pmap[y-1][x+ttx+1]>>8].life = 0; - } - parts[i].life = 0; - } else if(parts[i].life>10) { - //int ttx = (rand()%3)-parts[i].vx; - //create_part(-1, x+ttx, y-1, PT_WOOD); - //r = pmap[y-1][x+ttx]; - //parts[r>>8].life = parts[i].life-1; - //parts[i].life = 0; - } - } else*/ - if(t==PT_THDR){ - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT) && parts[r>>8].ctype!=PT_SPRK ){ - t = parts[i].type = PT_NONE; - parts[r>>8].ctype = parts[r>>8].type; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - } else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) { - pv[y/CELL][x/CELL] += 100.0f; - if(legacy_enable&&1>(rand()%200)){ - parts[i].life = rand()%50+120; - t = parts[i].type = PT_FIRE; - } else { - t = parts[i].type = PT_NONE; - } - } - } - } else if(t==PT_ICEI || t==PT_SNOW) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } -#ifndef HEAT_ENABLE - if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) { - t = parts[i].type = PT_ICEI; - parts[r>>8].type = PT_ICEI; - } - if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) - t = parts[i].type = PT_WATR; -#else - if(legacy_enable){ - if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) { - t = parts[i].type = PT_ICEI; - parts[r>>8].type = PT_ICEI; - } - if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) - t = parts[i].type = PT_WATR; - } -#endif - } - } - else if(t==PT_HSCN||t==PT_CSCN) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) { - parts[i].temp = 200.0f; - } - } - } - //PLANT - else if(t==PT_PLNT) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR && 1>(rand()%250)) { - t = parts[i].type = PT_PLNT; - parts[r>>8].type = PT_PLNT; - } else if((r&0xFF)==PT_LAVA && 1>(rand()%250)){ - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_WATR||t==PT_DSTW) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10)) { -#ifndef HEAT_ENABLE - t = parts[i].type = PT_WTRV; - //parts[r>>8].type = PT_WTRV; -#else - if(legacy_enable){ - t = parts[i].type = PT_WTRV; - } -#endif - } else if((r&0xFF)==PT_SALT && 1>(rand()%250)) { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)){ - t = parts[i].type = PT_WATR; - } - if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)){ - t = parts[i].type = PT_SLTW; - } -#ifdef HEAT_ENABLE - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)){ -#else - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ -#endif - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_SLTW) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10)) { -#ifndef HEAT_ENABLE - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; -#else - if(legacy_enable){ - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; - } -#endif - } else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) { - //t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } -#ifdef HEAT_ENABLE - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)){ -#else - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ -#endif - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_WTRV) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; -#ifdef HEAT_ENABLE - if(legacy_enable){ -#endif - if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000)) { - t = parts[i].type = PT_WATR; - parts[r>>8].type = PT_WATR; - } -#ifdef HEAT_ENABLE - } -#endif - -#ifdef HEAT_ENABLE - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)){ -#else - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ -#endif - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000)) { -#ifndef HEAT_ENABLE - t = parts[i].type = PT_WATR; - if(1>(rand()%1000)) - parts[r>>8].type = PT_WATR; -#else - if(legacy_enable){ - t = parts[i].type = PT_WATR; - if(1>(rand()%1000)) - parts[r>>8].type = PT_WATR; - } -#endif - } - } - } - // END PLANT - // ACID - else if(t==PT_ACID) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)!=PT_ACID){ - if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD){ - t = parts[i].type = PT_FIRE; - parts[i].life = 4; - parts[r>>8].type = PT_FIRE; - parts[r>>8].life = 4; - } else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) { - parts[i].life--; - parts[r>>8].type = PT_NONE; - } else if (parts[i].life==50){ - parts[i].life = 0; - t = parts[i].type = PT_NONE; - } - } - } - } - //END ACID :D - else if(t==PT_NEUT) { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) { - if(33>rand()%100) { - create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); - } else { - create_part(r>>8, x+nx, y+ny, PT_NEUT); - parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; - parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; - } - pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough - fe ++; - } - if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) - parts[r>>8].type = PT_DUST; - if((r&0xFF)==PT_WATR && 15>(rand()%100)) - parts[r>>8].type = PT_DSTW; - if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) - parts[r>>8].type = PT_DFRM; - if((r&0xFF)==PT_NITR && 15>(rand()%1000)) - parts[r>>8].type = PT_OILL; - if((r&0xFF)==PT_OILL && 5>(rand()%1000)) - parts[r>>8].type = PT_GASS; - if((r&0xFF)==PT_PLNT && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - } - } - else if(t==PT_PHOT){ - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=0; nx<1; nx++) - for(ny=0; ny<1; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - // } else if(((r&0xFF)!=PT_PHOT&&(r&0xFF)!=PT_NONE&&(r&0xFF)!=PT_CLNE)) { - // parts[i].life = 0; - // parts[i].type = PT_NONE; - // }// else if((r&0xFF)!=PT_PLEX){ - // parts[i].life = 4; - // parts[i].type = PT_FIRE - //} - } - } - if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) - continue; - rt = parts[r>>8].type; - if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && - ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { - parts[r>>8].type = PT_FIRE; -#ifdef HEAT_ENABLE - parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); -#endif - parts[r>>8].life = rand()%80+180; - if(ptypes[rt].explosive) - pv[y/CELL][x/CELL] += 0.25f * CFDS; //LOL - continue; - } - lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; - if(lpv < 1) lpv = 1; -#ifndef HEAT_ENABLE - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && (t!=PT_FIRE || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && - ptypes[rt].meltable*lpv>(rand()%1000)) { - if(t!=PT_LAVA || parts[i].life>0) { - parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; - parts[r>>8].type = PT_LAVA; - parts[r>>8].life = rand()%120+240; - } else { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) { - parts[r>>8].type = PT_WATR; - if(t==PT_FIRE) { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) { - parts[i].life = 0; - t = parts[i].type = PT_METL; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) { - kill_part(r>>8); - if(t==PT_FIRE) { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - //t = parts[i].type = PT_METL; - goto killed; - } - } -#else - if(legacy_enable){ - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && - ptypes[rt].meltable*lpv>(rand()%1000)) { - if(t!=PT_LAVA || parts[i].life>0) { - parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; - parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; - parts[r>>8].type = PT_LAVA; - parts[r>>8].life = rand()%120+240; - } else { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) { - parts[r>>8].type = PT_WATR; - if(t==PT_FIRE) { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) { - parts[i].life = 0; - t = parts[i].type = PT_METL; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) { - kill_part(r>>8); - if(t==PT_FIRE) { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - //t = parts[i].type = PT_METL; - goto killed; - } - } - } -#endif - //Bitches now know about my semi-conductor :( - if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN)){ - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; -#ifdef HEAT_ENABLE - if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) - parts[r>>8].temp = parts[r>>8].temp+10.0f; -#endif - } - } - if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp>100.0f)){ - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp<100.0f)){ - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 6; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 5; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5){ - if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN){ - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - } - killed: - if(parts[i].type == PT_NONE) - continue; - } - - if(t==PT_CLNE) { - if(!parts[i].ctype) { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx=XRES-CELL || - ny=YRES-CELL) { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - continue; - } - - rt = parts[i].flags & FLAG_STAGNANT; - parts[i].flags &= ~FLAG_STAGNANT; - if(!try_move(i, x, y, nx, ny)) { - parts[i].x = lx; - parts[i].y = ly; - if(ptypes[t].falldown) { - if(nx!=x && try_move(i, x, y, nx, y)) { - parts[i].x = ix; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else if(ny!=y && try_move(i, x, y, x, ny)) { - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else { - r = (rand()%2)*2-1; - if(ny!=y && try_move(i, x, y, x+r, ny)) { - parts[i].x += r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else if(ny!=y && try_move(i, x, y, x-r, ny)) { - parts[i].x -= r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else if(nx!=x && try_move(i, x, y, nx, y+r)) { - parts[i].x = ix; - parts[i].y += r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else if(nx!=x && try_move(i, x, y, nx, y-r)) { - parts[i].x = ix; - parts[i].y -= r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) { - s = 0; - if(!rt || nt) - rt = 50; - else - rt = 10; - for(j=x+r; j>=0 && j>=x-rt && j0) - r = 1; - else - r = -1; - if(s) - for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; - if(nxy+ISTP) ny=y+ISTP; - if(ny(rand()%1000)) { - kill_part(i); - continue; - } else if(try_move(i, x, y, 2*x-nx, ny)) { - parts[i].x = (float)(2*x-nx); - parts[i].y = (float)iy; - parts[i].vx *= ptypes[t].collision; - } else if(try_move(i, x, y, nx, 2*y-ny)) { - parts[i].x = (float)ix; - parts[i].y = (float)(2*y-ny); - parts[i].vy *= ptypes[t].collision; - } else { - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - } - } - - justdraw: - - nx = (int)(parts[i].x+0.5f); - ny = (int)(parts[i].y+0.5f); - - if(nx=XRES-CELL || - ny=YRES-CELL) { - kill_part(i); - continue; - } -#ifdef HEAT_ENABLE - if(cmode!=CM_HEAT){ - -#endif - if(t==PT_ACID) { - if(parts[i].life>255) parts[i].life = 255; - if(parts[i].life<47) parts[i].life = 48; - s = (255/((parts[i].life-46)*28));//if(parts[i].life<=49) parts[i].life = 50; - if(s==0) s = 1; - cr = PIXR(ptypes[t].pcolors)/s; - cg = PIXG(ptypes[t].pcolors)/s; - cb = PIXB(ptypes[t].pcolors)/s; - //vid[ny*(XRES+BARSIZE)+nx] = //(cr<<16)+(cb<<18)+cg;//ptypes[t].pcolors/-(parts[i].life-255); - blendpixel(vid, nx, ny, cr, cg, cb, 255);//(parts[i].life-46)*28 - if(cmode==4){ - blendpixel(vid, nx+1, ny, cr, cg, cb, 223); - blendpixel(vid, nx-1, ny, cr, cg, cb, 223); - blendpixel(vid, nx, ny+1, cr, cg, cb, 223); - blendpixel(vid, nx, ny-1, cr, cg, cb, 223); - - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); - } - }else if(t==PT_NEUT) { - if(cmode == 3||cmode==4) { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 8; - cb = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } else { - cr = 0x20; - cg = 0xE0; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - }else if(t==PT_PHOT) { - if(cmode == 3||cmode==4) { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 12; - cb = 12; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } else { - cr = 0xFF; - cg = 0xFF; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_THDR) { - if(cmode == 3||cmode==4) { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 16; - cb = 20; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } else { - cr = 0xFF; - cg = 0xFF; - cb = 0xA0; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_PLSM) { - float ttemp = parts[i].life; - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = plasma_data[caddress]; - uint8 G = plasma_data[caddress+1]; - uint8 B = plasma_data[caddress+2]; - if(cmode == 3||cmode==4) { - cr = R/8; - cg = G/8; - cb = B/8; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } else { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_FIRE && parts[i].life) { - if(cmode == 3||cmode==4) { - cr = parts[i].life / 4; - cg = parts[i].life / 16; - cb = parts[i].life / 32; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } else { - cr = parts[i].life * 8; - cg = parts[i].life * 2; - cb = parts[i].life; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_LAVA && parts[i].life) { - cr = parts[i].life * 2 + 0xE0; - cg = parts[i].life * 1 + 0x50; - cb = parts[i].life/2 + 0x10; - if(cr>255) cr = 255; - if(cg>192) cg = 192; - if(cb>128) cb = 128; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 64); - blendpixel(vid, nx-1, ny, cr, cg, cb, 64); - blendpixel(vid, nx, ny+1, cr, cg, cb, 64); - blendpixel(vid, nx, ny-1, cr, cg, cb, 64); - if(cmode == 3||cmode==4) { - cr /= 32; - cg /= 32; - cb /= 32; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } else if(t==PT_LAVA || t==PT_SPRK) { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - if(cmode == 3 || cmode==4) { - if(t == PT_LAVA) { - cr = 3; - cg = i%2; - cb = 0; - } else { - cr = 8; - cg = 12; - cb = 16; - } - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } else - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; -#ifdef HEAT_ENABLE - } else { - float ttemp = parts[i].temp+(-MIN_TEMP); - int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); - uint8 R = color_data[caddress]; - uint8 G = color_data[caddress+1]; - uint8 B = color_data[caddress+2]; - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); - //blendpixel(vid, nx+1, ny, R, G, B, 255); - } -#endif - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID){ - uint8 R = PIXR(ptypes[t].pcolors); - uint8 G = PIXG(ptypes[t].pcolors); - uint8 B = PIXB(ptypes[t].pcolors); - - //if(vid[(ny-1)*YRES+(nx-1)]!=0){ - // blendpixel(vid, nx, ny-1, R, G, B, 46); - //} - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); - } - - } - -} - -void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb){ - blendpixel(vid, x+1, y, cr, cg, cb, 112); - blendpixel(vid, x-1, y, cr, cg, cb, 112); - blendpixel(vid, x, y+1, cr, cg, cb, 112); - blendpixel(vid, x, y-1, cr, cg, cb, 112); - - blendpixel(vid, x+1, y-1, cr, cg, cb, 64); - blendpixel(vid, x-1, y-1, cr, cg, cb, 64); - blendpixel(vid, x+1, y+1, cr, cg, cb, 64); - blendpixel(vid, x-1, y+1, cr, cg, cb, 64); -} - -void update_particles_i_th(void *arg){ - upstruc *newup = (upstruc*)arg; - update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); - return; -} - -void update_particles(pixel *vid) -{ - int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; - float lx, ly; -#ifdef MT - int pt = 0, pc = 0; - pthread_t *InterThreads; -#endif - - memset(pmap, 0, sizeof(pmap)); - r = rand()%2; - for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) { - if(emap[y][x]) { - cr = cg = cb = 128; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) { - for(j=0; j 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==13) { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(emap[y][x] && !sys_pause) - emap[y][x] --; - } - } - } else { - for(y=0; y>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) { - if(emap[y][x]) { - cr = cg = cb = 128; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) { - for(j=0; j 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==9){ - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(emap[y][x] && !sys_pause) - emap[y][x] --; - } - } - } - -#ifdef MT - if(numCores > 1) { - InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); - for(pc = 0; pc=XRES || ny<0 || ny>=YRES) - break; - addpixel(vid, nx, ny, 255, 255, 255, 64); - i = nx/CELL; - j = ny/CELL; - lx += vx[j][i]*0.125f; - ly += vy[j][i]*0.125f; - if(bmap[j][i]==5 && i!=x && j!=y) - break; - } - drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); - } - -} - -void update_particles_th(void *arg) -{ - update_particles((pixel*)arg); - return; -} - -/*********************************************************** - * SDL OUTPUT * - ***********************************************************/ - -int sdl_scale = 1; -SDL_Surface *sdl_scrn; -SDLMod sdl_mod; -int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; - -#include "icon.h" -void sdl_seticon(void) -{ -#ifdef WIN32 - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else -#ifdef MACOSX - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else - SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#endif -#endif -} - -void sdl_open(void) -{ - if(SDL_Init(SDL_INIT_VIDEO)<0) { - fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); - exit(1); - } - atexit(SDL_Quit); -#ifdef PIX16 - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); -#else - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); -#endif - if(!sdl_scrn) { - fprintf(stderr, "Creating window: %s\n", SDL_GetError()); - exit(1); - } - SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); - sdl_seticon(); - SDL_EnableUNICODE(1); - //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); -} - -void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0;jpitch/PIXELSIZE; - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} - -void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - int i,k; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0;jpitch/PIXELSIZE; - } - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} -void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) -{ - if(sdl_scale == 2) - sdl_blit_2(x, y, w, h, src, pitch); - else - sdl_blit_1(x, y, w, h, src, pitch); -} - -int frame_idx=0; -void dump_frame(pixel *src, int w, int h, int pitch) -{ - char frame_name[32]; - int j,i; - unsigned char c[3]; - FILE *f; - sprintf(frame_name,"frame%04d.ppm",frame_idx); - f=fopen(frame_name,"wb"); - fprintf(f,"P6\n%d %d\n255\n",w,h); - for(j=0;j=0 && x=0 && yPT_NUM) - return 2; - if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) - return 3; - i = XRES*YRES; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) - return 1; - size = i; - } else - d = c; - - if(size < XRES*YRES) { - if(bzip2) - free(d); - return 1; - } - - sy = 0; - for(y=0;y+scl<=YRES;y+=scl) { - sx = 0; - for(x=0;x+scl<=XRES;x+=scl) { - a = 0; - r = g = b = 0; - for(j=0;j=PT_NUM) - goto corrupt; - r += PIXR(ptypes[t].pcolors); - g += PIXG(ptypes[t].pcolors); - b += PIXB(ptypes[t].pcolors); - a ++; - } - } - if(a) { - a = 256/a; - r = (r*a)>>8; - g = (g*a)>>8; - b = (b*a)>>8; - } - drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); - sx++; - } - sy++; - } - - if(bzip2) - free(d); - return 0; - -corrupt: - if(bzip2) - free(d); - return 1; -} - -static char *mystrdup(char *s) -{ - char *x; - if(s) { - x = malloc(strlen(s)+1); - strcpy(x, s); - return x; - } - return s; -} - -void *build_save(int *size, int x0, int y0, int w, int h) -{ -#ifdef HEAT_ENABLE - unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; -#else - unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*6+MAXSIGNS*262), *c; -#endif - int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); - int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - // save the required air state - for(y=by0; y255) i=255; - d[p++] = i; - } - for(y=by0; y255) i=255; - d[p++] = i; - } - - // save the particle map - for(i=0; i=x0 && x=y0 && y255) x=255; - if(y<0) y=0; - if(y>255) y=255; - d[p++] = x; - d[p++] = y; - } - } - for(j=0; j255) tttemp=255; - d[p++] = tttemp; - } - } -#endif - for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; - d[p++] = (signs[i].y-y0); - d[p++] = (signs[i].y-y0)>>8; - d[p++] = signs[i].ju; - x = strlen(signs[i].text); - d[p++] = x; - memcpy(d+p, signs[i].text, x); - p+=x; - } - - i = (p*101+99)/100 + 612; - c = malloc(i); - c[0] = 0x66; - c[1] = 0x75; - c[2] = 0x43; - c[3] = legacy_enable; - c[4] = SAVE_VERSION; - c[5] = CELL; - c[6] = bw; - c[7] = bh; - c[8] = p; - c[9] = p >> 8; - c[10] = p >> 16; - c[11] = p >> 24; - - i -= 12; - - if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) { - free(d); - free(c); - return NULL; - } - free(d); - - *size = i+12; - return c; -} - -int parse_save(void *save, int size, int replace, int x0, int y0) -{ - unsigned char *d,*c=save; - int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; - int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; - int fp[NPART], nf=0; - - if(size<16) - return 1; - if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) - return 1; - if(c[4]>SAVE_VERSION) - return 2; - ver = c[4]; - -#ifdef HEAT_ENABLE - if(ver<34){ - legacy_enable = 1; - } else { - if(c[3]==1||c[3]==0) - legacy_enable = c[3]; - else - legacy_beta = 1; - } -#endif - - bw = c[6]; - bh = c[7]; - if(bx0+bw > XRES/CELL) - bx0 = XRES/CELL - bw; - if(by0+bh > YRES/CELL) - by0 = YRES/CELL - bh; - if(bx0 < 0) - bx0 = 0; - if(by0 < 0) - by0 = 0; - - if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) - return 3; - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - return 1; - size = i; - - if(size < bw*bh) - return 1; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - if(replace) { - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(signs, 0, sizeof(signs)); - memset(parts, 0, sizeof(particle)*NPART); - memset(pmap, 0, sizeof(pmap)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(pv, 0, sizeof(pv)); - } - - // make a catalog of free parts - memset(pmap, 0, sizeof(pmap)); - for(i=0; i= size) - goto corrupt; - fvx[y][x] = (d[p++]-127.0f)/64.0f; - } - for(y=by0; y= size) - goto corrupt; - fvy[y][x] = (d[p++]-127.0f)/64.0f; - } - - // load the particle map - i = 0; - pty = p; - for(y=y0;y= size) - goto corrupt; - j=d[p++]; - if(j >= PT_NUM) - goto corrupt; - if(j) { - if(pmap[y][x]) { - k = pmap[y][x]>>8; - parts[k].type = j; - parts[k].x = (float)x; - parts[k].y = (float)y; - m[(x-x0)+(y-y0)*w] = k+1; - } else if(i < nf) { - parts[fp[i]].type = j; - parts[fp[i]].x = (float)x; - parts[fp[i]].y = (float)y; - m[(x-x0)+(y-y0)*w] = fp[i]+1; - i++; - } else - m[(x-x0)+(y-y0)*w] = NPART+1; - } - } - - // load particle properties - for(j=0; j= size) - goto corrupt; - if(i < NPART) { - parts[i].vx = (d[p++]-127.0f)/16.0f; - parts[i].vy = (d[p++]-127.0f)/16.0f; - } else - p += 2; - } - } - for(j=0; j= size) - goto corrupt; - if(i <= NPART) - parts[i-1].life = d[p++]*4; - else - p++; - } - } -#ifdef HEAT_ENABLE - for(j=0; j=34&&legacy_beta==0){ - if(p >= size){ - goto corrupt; - } - if(i <= NPART) { - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; - } else { - p++; - } - } else { - parts[i-1].temp = ptypes[parts[i-1].type].heat; - } - } - } -#endif - for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) { - if(p >= size) - goto corrupt; - if(i <= NPART) - parts[i-1].ctype = d[p++]; - else - p++; - } - } - - if(p >= size) - goto version1; - j = d[p++]; - for(i=0; i size) - goto corrupt; - for(k=0; k size) - goto corrupt; - if(kSAVE_VERSION) - return NULL; - - bw = c[6]; - bh = c[7]; - w = bw*CELL; - h = bh*CELL; - - if(c[5]!=CELL) - return NULL; - - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return NULL; - fb = calloc(w*h, PIXELSIZE); - if(!fb) { - free(d); - return NULL; - } - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - goto corrupt; - size = i; - - if(size < bw*bh) - goto corrupt; - - k = 0; - for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) - goto corrupt; - - for(y=0;y= size) - goto corrupt; - j=d[p++]; - if(j0) - fb[y*w+x] = ptypes[j].pcolors; - } - - free(d); - *width = w; - *height = h; - return fb; - -corrupt: - free(d); - free(fb); - return NULL; -} - -/* NO, I DON'T THINK SO - #include "fbi.h" - - pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) - { - unsigned char *tmp; - pixel *res; - int i; - - tmp = malloc(width*height*3); - if(!tmp) - return NULL; - res = malloc(width*height*PIXELSIZE); - if(!res) { - free(tmp); - return NULL; - } - - i = width*height*3; - if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { - free(res); - free(tmp); - return NULL; - } - - for(i=0; i1) { - r = (r+c/2)/c; - g = (g+c/2)/c; - b = (b+c/2)/c; - } - q[y*w+x] = PIXRGB(r, g, b); - } - *qw = w; - *qh = h; - return q; -} - -#define GRID_X 5 -#define GRID_Y 4 -#define GRID_P 3 -#define GRID_S 6 -#define GRID_Z 3 - -void stamp_gen_thumb(int i) -{ - char fn[64]; - void *data; - int size, factor_x, factor_y; - pixel *tmp; - - if(stamps[i].thumb) { - free(stamps[i].thumb); - stamps[i].thumb = NULL; - } - - sprintf(fn, "stamps" PATH_SEP "%s.stm", stamps[i].name); - data = file_load(fn, &size); - - if(data) { - stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); - if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) { - factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); - factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); - if(factor_y > factor_x) - factor_x = factor_y; - tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); - free(stamps[i].thumb); - stamps[i].thumb = tmp; - } - } - - free(data); -} - -int clipboard_ready = 0; -void *clipboard_data = 0; -int clipboard_length = 0; - -void stamp_save(int x, int y, int w, int h) -{ - FILE *f; - int n; - char fn[64], sn[16]; - void *s=build_save(&n, x, y, w, h); - -#ifdef WIN32 - _mkdir("stamps"); -#else - mkdir("stamps", 0755); -#endif - - stamp_gen_name(sn); - sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); - - f = fopen(fn, "wb"); - if(!f) - return; - fwrite(s, n, 1, f); - fclose(f); - - free(s); - - if(stamps[STAMP_MAX-1].thumb) - free(stamps[STAMP_MAX-1].thumb); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); - memset(stamps, 0, sizeof(struct stamp_info)); - if(stamp_count0) { - memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); - memcpy(stamps, &tmp, sizeof(struct stamp_info)); - - stamp_update(); - } - - return data; -} - -void stamp_init(void) -{ - int i; - FILE *f; - - memset(stamps, 0, sizeof(stamps)); - - f=fopen("stamps" PATH_SEP "stamps.def", "rb"); - if(!f) - return; - for(i=0; i=XRES+BARSIZE || y>=YRES+MENUSIZE) - return; - if(a!=255) { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) -{ - int i, j, w, bn = 0, ba = 0; - char *rp = font_data + font_ptrs[c]; - w = *(rp++); - for(j=0; j>= 2; - bn -= 2; - } - return x + w; -} - -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) -{ - int sx = x; - for(;*s;s++) { - if(*s == '\n') { - x = sx; - y += FONT_H+2; - } else if(*s == '\b') { - switch(s[1]) { - case 'w': - r = g = b = 255; - break; - case 'g': - r = g = b = 192; - break; - case 'o': - r = 255; - g = 216; - b = 32; - break; - case 'r': - r = 255; - g = b = 0; - break; - case 'b': - r = g = 0; - b = 255; - break; - } - s++; - } else - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - return x; -} - -void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) -{ - int i; - for(i=0; i<=w; i++) { - drawpixel(vid, x+i, y, r, g, b, a); - drawpixel(vid, x+i, y+h, r, g, b, a); - } - for(i=1; i=w && x+textwidth(s)>=w+5) - break; - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - if(*s) - for(i=0; i<3; i++) - x = drawchar(vid, x, y, '.', r, g, b, a); - return x; -} - -int textnwidth(char *s, int n) -{ - int x = 0; - for(;*s;s++) { - if(!n) - break; - x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - n--; - } - return x-1; -} -int textwidthx(char *s, int w) -{ - int x=0,n=0,cw; - for(;*s;s++) { - cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - if(x+(cw/2) >= w) - break; - x += cw; - n++; - } - return n; -} - -/*********************************************************** - * MAIN PROGRAM * - ***********************************************************/ - -void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) -{ - int x, y, i, j, c; - int bo = b; - if(iswall==1){ - b = b-100; - x = (2+32*((b-22)/1)); - y = YRES+2+40; - switch(b){ - case WL_WALLELEC: - for(j=1; j<15; j++){ - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } else { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) { - for(i=1; i<6+j; i++) { - if(!(i&j&1)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) { - if(i&j&1) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<13; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) { - for(i=14; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - default: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) { - for(j=4; j<12; j++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } else { - x = 2+32*(b/2); - y = YRES+2+20*(b%2); - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) { - for(j=4; j<12; j++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - if(bo==sl || bo==sr) { - c = 0; - if(bo==sl) - c |= PIXPACK(0xFF0000); - if(bo==sr) - c |= PIXPACK(0x0000FF); - for(i=0; i<30; i++) { - vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; - } - for(j=0; j<18; j++) { - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; - } - } -} - -int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) -{ - int i, j, c; - if(b>=121){ - b = b-100; - //x = (2+32*((b-22)/1)); - //y = YRES+2+40; - switch(b){ - case WL_WALLELEC: - for(j=1; j<15; j++){ - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } else { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) { - for(i=1; i<6+j; i++) { - if(!(i&j&1)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) { - if(i&j&1) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<13; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) { - for(i=14; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - case 40: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - default: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) { - for(j=4; j<12; j++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } else { - //x = 2+32*(b/2); - //y = YRES+2+20*(b%2); - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) { - for(j=4; j<12; j++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - return 26; -} - -void draw_menu(pixel *vid_buf, int i, int hover){ - - //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); -#ifdef MENUV3 - drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - if(hover==i){ - fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); - } else { - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); - } -#else - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); -#endif -} - -void menu_ui(pixel *vid_buf, int i, int *sl, int *sr){ - int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; - pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); - fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); - memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - rows = ceil((float)msections[i].itemcount/16.0f); - height = (ceil((float)msections[i].itemcount/16.0f)*18); - width = restrict_flt(msections[i].itemcount*31, 0, 16*31); - //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); - h = -1; - x = XRES-BARSIZE-26; - y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; - sy = y; - //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); - fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); - fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); - drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); - if(i==SC_WALL){ - for(n = 122; n<122+UI_WALLCOUNT; n++){ - if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM){ - if(x-26<=60){ - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } else if(i==SC_SPECIAL){ - for(n = 122; n<122+UI_WALLCOUNT; n++){ - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM){ - if(x-26<=60){ - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } else { - for(n = 0; n=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1){ - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); - } else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } else { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } else if(i==SC_SPECIAL){ - for(n = 122; n<122+UI_WALLCOUNT; n++){ - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM){ - if(x-26<=20){ - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } else { - for(n = 0; n=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1){ - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); - } else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } else { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - if(b==1&&h!=-1){ - *sl = h; - } - if(b==4&&h!=-1){ - *sr = h; - } - } - -int create_parts(int x, int y, int r, int c) -{ - int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; - - if(c == 125) { - i = x / CELL; - j = y / CELL; - for(v=-1;v<2;v++) - for(u=-1;u<2;u++) - if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) { - y += sy; - if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) { - if(cp) - create_parts(y, x, r, c); - else - create_parts(x, y, r, c); - } - e -= 1.0f; - } - } -} - -void create_box(int x1, int y1, int x2, int y2, int c) -{ - int i, j; - if(x1>x2) { - i = x2; - x2 = x1; - x1 = i; - } - if(y1>y2) { - j = y2; - y2 = y1; - y1 = j; - } - for(j=y1; j<=y2; j++) - for(i=x1; i<=x2; i++) - create_parts(i, j, 1, c); -} - -int flood_parts(int x, int y, int c, int cm, int bm) -{ - int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT){ - c = c-100; - } - if(cm==-1) { - if(c==0) { - cm = pmap[y][x]&0xFF; - if(!cm) - return 0; - } else - cm = 0; - } - if(bm==-1) { - if(c==30) { - bm = bmap[y/CELL][x/CELL]; - if(!bm) - return 0; - if(bm==1) - cm = 0xFF; - } else - bm = 0; - } - - if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) - return 1; - - // go left as far as possible - x1 = x2 = x; - while(x1>=CELL) { - if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) - break; - x1--; - } - while(x2=CELL+dy) - for(x=x1; x<=x2; x++) - if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) - if(!flood_parts(x, y-dy, co, cm, bm)) - return 0; - if(y=XRES || y>=YRES) - return; - c = vid[y*(XRES+BARSIZE)+x]; - c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); - if(c<512) - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); - else - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); -} - -void xor_line(int x1, int y1, int x2, int y2, pixel *vid) -{ - int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) { - y += sy; - e -= 1.0f; - } - } -} - -void draw_svf_ui(pixel *vid_buf) -{ - int c; - - drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); - drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - c = svf_open ? 255 : 128; - drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); - drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); - - c = svf_login ? 255 : 128; - drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); - if(svf_open) - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); - else - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); - drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); - if(svf_open && svf_own) - drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); - - c = (svf_login && svf_open) ? 255 : 128; - - drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - - if(svf_myvote==1 && (svf_login && svf_open)){ - fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); - } else if(svf_myvote==-1 && (svf_login && svf_open)){ - fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); - } - - drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); - drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); - - drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); - if(svf_tags[0]) - drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); - else - drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); - -#ifdef HEAT_ENABLE - drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); -#else - drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-364, 14, c, c, c, 255); -#endif - - drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); - drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); - if(svf_login) - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); - else - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); - drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); - - if(sys_pause) { - fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); - } else { - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); - drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - -#ifdef HEAT_ENABLE - if(!legacy_enable) { - fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); - } else { - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } -#endif - - switch(cmode) { - case 0: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); - break; - case 1: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); - break; - case 2: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); - break; - case 3: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); - break; - case 4: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); - break; -#ifdef HEAT_ENABLE - case 5: - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - break; -#endif - } - drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - - if(svf_admin) { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); - } else if(svf_mod) { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - }//else if(amd) - // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? -} - -typedef struct ui_edit { - int x, y, w, nx; - char str[256],*def; - int focus, cursor, hide; -} ui_edit; -void ui_edit_draw(pixel *vid_buf, ui_edit *ed) -{ - int cx, i; - char echo[256], *str; - - if(ed->hide) { - for(i=0;ed->str[i];i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } else - str = ed->str; - - if(ed->str[0]) { - drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); - drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); - } else if(!ed->focus) - drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); - if(ed->focus) { - cx = textnwidth(str, ed->cursor); - for(i=-3; i<9; i++) - drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); - } -} -char *shift_0="`1234567890-=[]\\;',./"; -char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; -void ui_edit_process(int mx, int my, int mb, ui_edit *ed) -{ - char ch, ts[2], echo[256], *str; - int l, i; -#ifdef RAWINPUT - char *p; -#endif - - if(mb) { - if(ed->hide) { - for(i=0;ed->str[i];i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } else - str = ed->str; - - if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) { - ed->focus = 1; - ed->cursor = 0; - ed->str[0] = 0; - } else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) { - ed->focus = 1; - ed->cursor = textwidthx(str, mx-ed->x); - } else - ed->focus = 0; - } - if(ed->focus && sdl_key) { - if(ed->hide) { - for(i=0;ed->str[i];i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } else - str = ed->str; - - l = strlen(ed->str); - switch(sdl_key) { - case SDLK_HOME: - ed->cursor = 0; - break; - case SDLK_END: - ed->cursor = l; - break; - case SDLK_LEFT: - if(ed->cursor > 0) - ed->cursor --; - break; - case SDLK_RIGHT: - if(ed->cursor < l) - ed->cursor ++; - break; - case SDLK_DELETE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - ed->str[ed->cursor] = 0; - else if(ed->cursor < l) - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - break; - case SDLK_BACKSPACE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) { - if(ed->cursor > 0) - memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); - ed->cursor = 0; - } else if(ed->cursor > 0) { - ed->cursor--; - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - } - break; - default: -#ifdef RAWINPUT - if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) { - ch = sdl_key; - if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) { - if(ch>='a' && ch<='z') - ch &= ~0x20; - p = strchr(shift_0, ch); - if(p) - ch = shift_1[p-shift_0]; - } - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#else - if(sdl_ascii>=' ' && sdl_ascii<127) { - ch = sdl_ascii; - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#endif - break; - } - } -} - typedef struct ui_checkbox { - int x, y; - int focus, checked; - } ui_checkbox; - void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) - { - int w = 12; - if(ed->checked) { - drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); - } - if(ed->focus){ - drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); - } else { - drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); - } - } - void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) - { - int w = 12; - - if(mb && !mbq) { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w){ - ed->checked = (ed->checked)?0:1; - } - } else { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w){ - ed->focus = 1; - } else { - ed->focus = 0; - } - } - } - -void error_ui(pixel *vid_buf, int err, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - char *msg; - - msg = malloc(strlen(txt)+16); - if(err) - sprintf(msg, "%03d %s", err, txt); - else - sprintf(msg, "%s", txt); - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - if(err) - drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); - else - drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - free(msg); - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_ui(pixel *vid_buf, char *top, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); - drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_box(pixel *vid_buf, char *msg) -{ - int w = textwidth(msg)+16; - int x0=(XRES-w)/2,y0=(YRES-24)/2; - - clearrect(vid_buf, x0-2, y0-2, w+4, 28); - drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); -} - -int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - int ret = 0; - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); - drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); - drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); - drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) { - ret = 1; - break; - } - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) { - ret = 1; - break; - } - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - return ret; -} - -int execute_tagop(pixel *vid_buf, char *op, char *tag) -{ - int status; - char *result; - - char *names[] = {"ID", "Tag", NULL}; - char *parts[2]; - - char *uri = malloc(strlen(SERVER)+strlen(op)+36); - sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); - - parts[0] = svf_id; - parts[1] = tag; - - result = http_multipart_post( - uri, - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - free(uri); - - if(status!=200) { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 1; - } - if(result && strncmp(result, "OK", 2)) { - error_ui(vid_buf, 0, result); - free(result); - return 1; - } - - if(result[2]) { - strncpy(svf_tags, result+3, 255); - svf_id[15] = 0; - } - - if(result) - free(result); - - return 0; -} - -struct strlist { - char *str; - struct strlist *next; -}; -void strlist_add(struct strlist **list, char *str) -{ - struct strlist *item = malloc(sizeof(struct strlist)); - item->str = mystrdup(str); - item->next = *list; - *list = item; -} -int strlist_find(struct strlist **list, char *str) -{ - struct strlist *item; - for(item=*list;item;item=item->next) - if(!strcmp(item->str, str)) - return 1; - return 0; -} -void strlist_free(struct strlist **list) -{ - struct strlist *item; - while(*list) { - item = *list; - *list = (*list)->next; - free(item); - } -} - -void tag_list_ui(pixel *vid_buf) -{ - int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; - char *p,*q,s; - char *tag=NULL, *op=NULL; - ui_edit ed; - struct strlist *vote=NULL,*down=NULL; - - ed.x = x0+25; - ed.y = y0+221; - ed.w = 158; - ed.nx = 1; - ed.def = "[new tag]"; - ed.focus = 0; - ed.hide = 0; - ed.cursor = 0; - strcpy(ed.str, ""); - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - op = tag = NULL; - - drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 256); - drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); - p = svf_tags; - s = svf_tags[0] ? ' ' : 0; - y = 36 + y0; - while(s) { - q = strchr(p, ' '); - if(!q) - q = p+strlen(p); - s = *q; - *q = 0; - if(svf_own || svf_admin || svf_mod) { - drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); - d = 14; - if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) { - if(!ed1.focus) - break; - ed1.focus = 0; - ed2.focus = 1; - } - if(sdl_key==SDLK_ESCAPE) { - if(!ed1.focus && !ed2.focus) - return; - ed1.focus = 0; - ed2.focus = 0; - } - } - - strcpy(svf_user, ed1.str); - md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); - - res = http_multipart_post( - "http://" SERVER "/Login.api", - NULL, NULL, NULL, - svf_user, svf_pass, - &err, NULL); - if(err != 200) { - error_ui(vid_buf, err, http_ret_text(err)); - if(res) - free(res); - goto fail; - } - if(res && !strncmp(res, "OK", 2)) { - if(!strcmp(res, "OK ADMIN")){ - svf_admin = 1; - svf_mod = 0; - } else if(!strcmp(res, "OK MOD")){ - svf_admin = 0; - svf_mod = 1; - } else { - svf_admin = 0; - svf_mod = 0; - } - free(res); - svf_login = 1; - return; - } - if(!res) - res = mystrdup("Unspecified Error"); - error_ui(vid_buf, 0, res); - free(res); - -fail: - strcpy(svf_user, ""); - strcpy(svf_pass, ""); - svf_login = 0; - svf_own = 0; - svf_admin = 0; - svf_mod = 0; -} - -void execute_delete(pixel *vid_buf, char *id) -{ - int status; - char *result; - - char *names[] = {"ID", NULL}; - char *parts[1]; - - parts[0] = id; - - result = http_multipart_post( - "http://" SERVER "/Delete.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return; - } - if(result && strncmp(result, "OK", 2)) { - error_ui(vid_buf, 0, result); - free(result); - return; - } - - if(result) - free(result); -} - -int execute_vote(pixel *vid_buf, char *id, char *action) -{ - int status; - char *result; - - char *names[] = {"ID", "Action", NULL}; - char *parts[2]; - - parts[0] = id; - parts[1] = action; - - result = http_multipart_post( - "http://" SERVER "/Vote.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 0; - } - if(result && strncmp(result, "OK", 2)) { - error_ui(vid_buf, 0, result); - free(result); - return 0; - } - - if(result) - free(result); - return 1; -} - -static char hex[] = "0123456789ABCDEF"; -void strcaturl(char *dst, char *src) -{ - char *d; - unsigned char *s; - - for(d=dst; *d; d++) ; - - for(s=(unsigned char *)src; *s; s++) { - if((*s>='0' && *s<='9') || - (*s>='a' && *s<='z') || - (*s>='A' && *s<='Z')) - *(d++) = *s; - else { - *(d++) = '%'; - *(d++) = hex[*s>>4]; - *(d++) = hex[*s&15]; - } - } - *d = 0; -} - -#define THUMB_CACHE_SIZE 256 - -char *thumb_cache_id[THUMB_CACHE_SIZE]; -void *thumb_cache_data[THUMB_CACHE_SIZE]; -int thumb_cache_size[THUMB_CACHE_SIZE]; -int thumb_cache_lru[THUMB_CACHE_SIZE]; - -void thumb_cache_inval(char *id) -{ - int i,j; - for(i=0;i= THUMB_CACHE_SIZE) - return; - free(thumb_cache_id[i]); - free(thumb_cache_data[i]); - thumb_cache_id[i] = NULL; - for(j=0;j thumb_cache_lru[i]) - thumb_cache_lru[j]--; -} -void thumb_cache_add(char *id, void *thumb, int size) -{ - int i,m=-1,j=-1; - thumb_cache_inval(id); - for(i=0;i m) { - m = thumb_cache_lru[i]; - j = i; - } - } - if(i >= THUMB_CACHE_SIZE) { - thumb_cache_inval(thumb_cache_id[j]); - i = j; - } - for(j=0;j= THUMB_CACHE_SIZE) - return 0; - for(j=0;j=GRID_X*GRID_Y) - break; - if(votes) { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } else { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str+5); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } else if(!strncmp(str, "TAG ", 4)) { - if(j >= TAG_MAX) { - str = p; - continue; - } - q = strchr(str+4, ' '); - if(!q) { - str = p; - continue; - } - *(q++) = 0; - tag_names[j] = mystrdup(str+4); - tag_votes[j] = atoi(q); - j++; - } else { - if(i>=GRID_X*GRID_Y) - break; - if(votes) { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } else { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - str = p; - } - if(*str) - i++; - return i; -} - -#define IMGCONNS 3 -#define TIMEOUT 100 -#define HTTP_TIMEOUT 10 - -int search_own = 0; -int search_date = 0; -int search_page = 0; -char search_expr[256] = ""; - -int search_ui(pixel *vid_buf) -{ - int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; - int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; - float ry; - time_t http_last_use=HTTP_TIMEOUT; - ui_edit ed; - - - void *http = NULL; - int active = 0; - char *last = NULL; - int search = 0; - int lasttime = TIMEOUT; - char *uri; - int status; - char *results; - char *tmp, ts[64]; - - void *img_http[IMGCONNS]; - char *img_id[IMGCONNS]; - void *thumb, *data; - int thlen, dlen; - - memset(img_http, 0, sizeof(img_http)); - memset(img_id, 0, sizeof(img_id)); - - memset(search_ids, 0, sizeof(search_ids)); - memset(search_names, 0, sizeof(search_names)); - memset(search_scoreup, 0, sizeof(search_scoreup)); - memset(search_scoredown, 0, sizeof(search_scoredown)); - memset(search_publish, 0, sizeof(search_publish)); - memset(search_owners, 0, sizeof(search_owners)); - memset(search_thumbs, 0, sizeof(search_thumbs)); - memset(search_thsizes, 0, sizeof(search_thsizes)); - - do_open = 0; - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = 65; - ed.y = 13; - ed.w = XRES-200; - ed.nx = 1; - ed.def = "[search terms]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(search_expr); - strcpy(ed.str, search_expr); - - sdl_wheel = 0; - - while(!sdl_poll()) { - uih = 0; - bq = b; - mxq = mx; - myq = my; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - if(mx!=mxq || my!=myq || sdl_wheel || b) - mmt = 0; - else if(mmt 9) { - drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); - drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); - } - - ui_edit_draw(vid_buf, &ed); - - if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) { - if(search_page) { - search_page --; - lasttime = TIMEOUT; - } - sdl_wheel = 0; - uih = 1; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) { - lasttime = TIMEOUT; - search_page ++; - page_count = exp_res; - } - sdl_wheel = 0; - uih = 1; - } - - tp = -1; - if(is_p1) { - drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); - for(gj=0;gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14);gj++) - for(gi=0;giTAG_MAX || !tag_names[pos]) - break; - if(tag_votes[0]) - i = 127+(128*tag_votes[pos])/tag_votes[0]; - else - i = 192; - w = textwidth(tag_names[pos]); - if(w>XRES/GRID_X-5) - w = XRES/GRID_X-5; - gx = (XRES/GRID_X)*gi; - gy = gj*14 + 46; - if(mx>=gx && mx=gy && my XRES/GRID_X-10) { - tmp = malloc(strlen(search_names[pos])+4); - strcpy(tmp, search_names[pos]); - j = textwidthx(tmp, XRES/GRID_X-15); - strcpy(tmp+j, "..."); - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); - free(tmp); - } else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); - j = textwidth(search_owners[pos]); - if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && - my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) { - st = 1; - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); - } else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); - if(search_thumbs[pos]) - render_thumb(search_thumbs[pos], search_thsizes[pos], 1, vid_buf, gx, gy, GRID_S); - own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); - if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) - mp = pos; - if(own) { - if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) { - mp = -1; - dp = pos; - } - } - if(mp==pos && !st) - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); - else - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); - if(own) { - if(dp == pos) - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); - else - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); - } - if(!search_publish[pos]){ - drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); - drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); - } - if(view_own || svf_admin || svf_mod) { - sprintf(ts+1, "%d", search_votes[pos]); - ts[0] = 0xBB; - for(j=1; ts[j]; j++) - ts[j] = 0xBC; - ts[j-1] = 0xB9; - ts[j] = 0xBA; - ts[j+1] = 0; - w = gx+XRES/GRID_S-2-textwidth(ts); - h = gy+YRES/GRID_S-11; - drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); - for(j=0; ts[j]; j++) - ts[j] -= 14; - drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); - sprintf(ts, "%d", search_votes[pos]); - for(j=0; ts[j]; j++) - ts[j] += 127; - drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); - } - if(search_scoreup[pos]>0||search_scoredown[pos]>0){ - lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); - - if(((YRES/GRID_S+3)/2)>lv){ - ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); - if(lv<8){ - ry = ry/(8-lv); - } - nyu = search_scoreup[pos]*ry; - nyd = search_scoredown[pos]*ry; - } else { - ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); - nyu = search_scoreup[pos]/ry; - nyd = search_scoredown[pos]/ry; - } - - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); - - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); - } - } - - if(mp!=-1 && mmt>=TIMEOUT/5 && !st) { - gi = mp % GRID_X; - gj = mp / GRID_X; - if(is_p1) - gj += GRID_Y-GRID_P; - gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; - gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; - i = w = textwidth(search_names[mp]); - h = YRES/GRID_Z+30; - if(w=XRES-2) gx=XRES-3-w; - if(gy<32) gy=32; - if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; - clearrect(vid_buf, gx-2, gy-3, w+4, h); - drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); - if(search_thumbs[mp]) - render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); - drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); - drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); - } - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(sdl_key==SDLK_RETURN) { - if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) - lasttime = TIMEOUT; - else if(search_ids[0] && !search_ids[1]) { - bq = 0; - b = 1; - mp = 0; - } - } - if(sdl_key==SDLK_ESCAPE) - goto finish; - - if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) { - search_own = !search_own; - lasttime = TIMEOUT; - } - if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) { - search_date = !search_date; - lasttime = TIMEOUT; - } - - if(b && !bq && dp!=-1) - if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) { - execute_delete(vid_buf, search_ids[dp]); - lasttime = TIMEOUT; - if(last) { - free(last); - last = NULL; - } - } - - if(b && !bq && tp!=-1) { - strncpy(ed.str, tag_names[tp], 255); - lasttime = TIMEOUT; - } - - if(b && !bq && mp!=-1 && st) { - sprintf(ed.str, "user:%s", search_owners[mp]); - lasttime = TIMEOUT; - } - - if(do_open==1){ - mp = 0; - } - - if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) { - fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); - info_box(vid_buf, "Loading..."); - - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - data = http_simple_get(uri, &status, &dlen); - free(uri); - - if(status == 200) { - status = parse_save(data, dlen, 1, 0, 0); - switch(status) { - case 1: - error_ui(vid_buf, 0, "Simulation corrupted"); - break; - case 2: - error_ui(vid_buf, 0, "Simulation from a newer version"); - break; - case 3: - error_ui(vid_buf, 0, "Simulation on a too large grid"); - break; - } - if(!status) { - char *tnames[] = {"ID", NULL}; - char *tparts[1]; - int tplens[1]; - if(svf_last) - free(svf_last); - svf_last = data; - svf_lsize = dlen; - - tparts[0] = search_ids[mp]; - tplens[0] = strlen(search_ids[mp]); - data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); - - svf_open = 1; - svf_own = svf_login && !strcmp(search_owners[mp], svf_user); - svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); - - strcpy(svf_id, search_ids[mp]); - strcpy(svf_name, search_names[mp]); - if(status == 200) { - if(data) { - strncpy(svf_tags, data, 255); - svf_tags[255] = 0; - } else - svf_tags[0] = 0; - } else { - svf_tags[0] = 0; - } - - if(svf_login){ - char *names[] = {"ID", NULL}; - char *parts[1]; - parts[0] = search_ids[mp]; - data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); - if(status == 200){ - if(data){ - if(!strcmp(data, "Up")){ - svf_myvote = 1; - } else if(!strcmp(data, "Down")){ - svf_myvote = -1; - } else { - svf_myvote = 0; - } - } else { - svf_myvote = 0; - } - } else { - svf_myvote = 0; - } - } - } else { - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - } - } else - error_ui(vid_buf, status, http_ret_text(status)); - - if(data) - free(data); - goto finish; - } - - if(!last) - search = 1; - else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) { - search = 1; - if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) { - search_page = 0; - page_count = 0; - } - free(last); - last = NULL; - } else - search = 0; - - if(search && lasttime>=TIMEOUT) { - lasttime = 0; - last = mystrdup(ed.str); - last_own = search_own; - last_date = search_date; - last_page = search_page; - active = 1; - uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); - if(search_own || svf_admin || svf_mod) - tmp = "&ShowVotes=true"; - else - tmp = ""; - if(!search_own && !search_date && !*last) { - if(search_page) { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); - } else { - exp_res = GRID_X*GRID_P; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); - } - } else { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); - } - strcaturl(uri, last); - if(search_own) { - strcaturl(uri, " user:"); - strcaturl(uri, svf_user); - } - if(search_date) - strcaturl(uri, " sort:date"); - http = http_async_req_start(http, uri, NULL, 0, 1); - if(svf_login){ - http_auth_headers(http, svf_user, svf_pass); - } - http_last_use = time(NULL); - free(uri); - } - - if(active && http_async_req_status(http)) { - http_last_use = time(NULL); - results = http_async_req_stop(http, &status, NULL); - view_own = last_own; - if(status == 200) - page_count = search_results(results, last_own||svf_admin||svf_mod); - is_p1 = (exp_res < GRID_X*GRID_Y); - free(results); - active = 0; - } - - if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) { - http_async_req_close(http); - http = NULL; - } - - for(i=0;i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) { - if(stamp_page) { - stamp_page --; - } - sdl_wheel = 0; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; -} - -void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) -{ - char t[2]; - t[0] = ch; - t[1] = 0; - if(flag) { - fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); - } else { - drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); - } -} - -void render_signs(pixel *vid_buf) -{ - int i, j, x, y, w, h, dx, dy; - for(i=0; i 18) ? -1 : 1; - for(j=0; j<4; j++) { - drawpixel(vid_buf, x, y, 192, 192, 192, 255); - x+=dx; - y+=dy; - } - } -} - -void add_sign_ui(pixel *vid_buf, int mx, int my) -{ - int i, w, h, x, y, nm=0, ju; - int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; - ui_edit ed; - - // check if it is an existing sign - for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) - break; - } - // else look for empty spot - if(i >= MAXSIGNS) { - nm = 1; - for(i=0; i= MAXSIGNS) - return; - - if(nm) { - signs[i].x = mx; - signs[i].y = my; - signs[i].ju = 1; - } - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = x0+25; - ed.y = y0+25; - ed.w = 158; - ed.nx = 1; - ed.def = "[message]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(signs[i].text); - strcpy(ed.str, signs[i].text); - ju = signs[i].ju; - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 80); - drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); - ui_edit_draw(vid_buf, &ed); - drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); - draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); - draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); - draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); - - if(!nm) { - drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); - drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); - drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); - } - - drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) - ju = 0; - if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) - ju = 1; - if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) - ju = 2; - - if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) { - signs[i].text[0] = 0; - return; - } - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) { - if(!ed.focus) - return; - ed.focus = 0; - } - } - - strcpy(signs[i].text, ed.str); - signs[i].ju = ju; -} - -/*********************************************************** - * CONFIG FILE * - ***********************************************************/ - -char http_proxy[256] = ""; - -void save_string(FILE *f, char *str) -{ - int li = strlen(str); - unsigned char lb[2]; - lb[0] = li; - lb[1] = li >> 8; - fwrite(lb, 2, 1, f); - fwrite(str, li, 1, f); -} - -int load_string(FILE *f, char *str, int max) -{ - int li; - unsigned char lb[2]; - fread(lb, 2, 1, f); - li = lb[0] | (lb[1] << 8); - if(li > max) { - str[0] = 0; - return 1; - } - fread(str, li, 1, f); - str[li] = 0; - return 0; -} - -unsigned char last_major=0, last_minor=0, update_flag=0; - -void save_presets(int do_update) -{ - FILE *f=fopen("powder.def", "wb"); - unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; - unsigned char tmp = sdl_scale; - if(!f) - return; - fwrite(sig, 1, 4, f); - save_string(f, svf_user); - save_string(f, svf_pass); - fwrite(&tmp, 1, 1, f); - tmp = cmode; - fwrite(&tmp, 1, 1, f); - tmp = svf_admin; - fwrite(&tmp, 1, 1, f); - tmp = svf_mod; - fwrite(&tmp, 1, 1, f); - save_string(f, http_proxy); - tmp = SAVE_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = MINOR_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = do_update; - fwrite(&tmp, 1, 1, f); - fclose(f); -} - -void load_presets(void) -{ - FILE *f=fopen("powder.def", "rb"); - unsigned char sig[4], tmp; - if(!f) - return; - fread(sig, 1, 4, f); - if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66){ - if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F){ - if(fseek(f, -3, SEEK_END)){ - remove("powder.def"); - return; - } - if(fread(sig, 1, 3, f) != 3){ - remove("powder.def"); - goto fail; - } - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; - } - fclose(f); - remove("powder.def"); - return; - } - if(load_string(f, svf_user, 63)) - goto fail; - if(load_string(f, svf_pass, 63)) - goto fail; - svf_login = !!svf_user[0]; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - sdl_scale = (tmp == 2) ? 2 : 1; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; -#ifdef HEAT_ENABLE - cmode = tmp%6; -#else - cmode = tmp%5; -#endif - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_admin = tmp; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_mod = tmp; - if(load_string(f, http_proxy, 255)) - goto fail; - if(fread(sig, 1, 3, f) != 3) - goto fail; - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; -fail: - fclose(f); -} - -void dim_copy(pixel *dst, pixel *src) -{ - int i,r,g,b; - for(i=0;i0) - r--; - if(g>0) - g--; - if(b>0) - b--; - dst[i] = PIXRGB(r,g,b); - } -} - -unsigned int fire_alpha[CELL*3][CELL*3]; -void prepare_alpha(void) -{ - int x,y,i,j; - float temp[CELL*3][CELL*3]; - memset(temp, 0, sizeof(temp)); - for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; - fire_g[j][i] = g>4 ? g-4 : 0; - fire_b[j][i] = b>4 ? b-4 : 0; - } -} - -int zoom_en = 0; -int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; -int zoom_wx=0, zoom_wy=0; -void render_zoom(pixel *img) -{ - int x, y, i, j; - pixel pix; - drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); - drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); - clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); - for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) { - xor_pixel(x+i, y+j, vid); - if(j) xor_pixel(x+i, y-j, vid); - if(i) xor_pixel(x-i, y+j, vid); - if(i&&j) xor_pixel(x-i, y-j, vid); - } - } else { - int tc; - c = (r/CELL) * CELL; - x = (x/CELL) * CELL; - y = (y/CELL) * CELL; - - tc = !((c%(CELL*2))==0); - - x -= c/2; - y -= c/2; - - x += tc*(CELL/2); - y += tc*(CELL/2); - - for(i=0; i2){ - pthread_t pth; - pthread_create(&pth,NULL,update_air_th,""); - } else { - update_air(); - } -#else - update_air(); -#endif - } - if(cmode==0 || cmode==1) { - draw_air(vid_buf); - } else if(cmode==2) { - memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); - memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); - } else { - memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); - } - update_particles(vid_buf); - - if(cmode==2) { - if(!fire_fc) { - dim_copy(fire_bg, vid_buf); - } else { - memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); - } - fire_fc = (fire_fc+1) % 3; - } - if(cmode==3||cmode==4) - render_fire(vid_buf); - - render_signs(vid_buf); - - //clearrect(vid_buf, 0, YRES, XRES, MENUSIZE); - memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); - //memset(vid_buf+(x+1+(XRES+BARSIZE)*(y+i)), 0, PIXELSIZE*(w-1)); - clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); - - // Old Menu, you will be missed; but not forgotten :( - /* for(i=0; iSAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) - old_version = 1; -#else - if(sscanf(ver_data, "%d.%d", &major, &minor)==2) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) - old_version = 1; -#endif - free(ver_data); - } - http_ver_check = NULL; - } - do_check = (do_check+1) & 15; - } - - if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) - if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")){ - break; - } - //break; - if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) { - if(load_mode) { - free(load_img); - free(load_data); - load_mode = 0; - load_data = NULL; - load_img = NULL; - } - if(it > 50) - it = 50; - if(sdl_key=='k' && stamps[1].name[0]) { - j = stamp_ui(vid_buf); - if(j>=0) - load_data = stamp_load(j, &load_size); - else - load_data = NULL; - } else - load_data = stamp_load(0, &load_size); - if(load_data) { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - if(sdl_key=='s') { - if(it > 50) - it = 50; - save_mode = 1; - } - if(sdl_key=='1'){ - set_cmode(0); - } - if(sdl_key=='2'){ - set_cmode(1); - } - if(sdl_key=='3'){ - set_cmode(2); - } - if(sdl_key=='4'){ - set_cmode(3); - } - if(sdl_key=='5'){ - set_cmode(4); - } - if(sdl_key=='6'){ - set_cmode(5); - } - if(sdl_key==SDLK_SPACE) - sys_pause = !sys_pause; - if(sdl_key=='p') - dump_frame(vid_buf, XRES, YRES, XRES); - if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))){ - if(clipboard_ready==1){ - load_data = malloc(clipboard_length); - memcpy(load_data, clipboard_data, clipboard_length); - load_size = clipboard_length; - if(load_data) { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - } - if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))){ - save_mode = 1; - copy_mode = 2; - } - if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))){ - save_mode = 1; - copy_mode = 1; - } else if(sdl_key=='c') { -#ifdef HEAT_ENABLE - set_cmode((cmode+1) % 6); -#else - set_cmode((cmode+1) % 5); -#endif - if(it > 50) - it = 50; - } -#ifdef INTERNAL - if(sdl_key=='v') - vs = !vs; - if(vs) - dump_frame(vid_buf, XRES, YRES, XRES); -#endif - - if(sdl_wheel) { - if(sdl_zoom_trig==1){ - ZSIZE += sdl_wheel; - if(ZSIZE>32) - ZSIZE = 32; - if(ZSIZE<2) - ZSIZE = 2; - ZFACTOR = 256/ZSIZE; - sdl_wheel = 0; - } else { - bs += sdl_wheel; - if(bs>16) - bs = 16; - if(bs<0) - bs = 0; - sdl_wheel = 0; - /*if(su >= PT_NUM) { - if(sl < PT_NUM) - su = sl; - if(sr < PT_NUM) - su = sr; - }*/ - } - } - - bq = b; - b = SDL_GetMouseState(&x, &y); - - for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy - && x0 && y0 && x>8)>=NPART || !cr)){ -#ifdef BETA - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); -#else - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); -#endif - } else { - sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); - } - } -#endif - mx = x; - my = y; - if(update_flag) { - info_box(vid_buf, "Finalizing update..."); - if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) { - update_cleanup(); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } else { - if(update_finish()) - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - else - info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); - } - update_flag = 0; - } - - if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && - x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) { - tmp = malloc(64); -#ifdef BETA - if(is_beta){ - sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); - } else { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); - } -#else - sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); -#endif - if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) { - free(tmp); - tmp = download_ui(vid_buf, my_uri, &i); - if(tmp) { - save_presets(1); - if(update_start(tmp, i)) { - update_cleanup(); - save_presets(0); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } else - return 0; - } - } else - free(tmp); - } - if(y>=sdl_scale*(YRES+(MENUSIZE-20))) { - if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0){ - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0){ - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0){ - db = (svf_myvote==1) ? 273 : 274; - if(da < 51) - da ++; - } -#ifdef HEAT_ENABLE - else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) { -#else - else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-365))*sdl_scale) && svf_login && svf_open) { -#endif - db = svf_own ? 257 : 256; - if(da < 51) - da ++; -#ifdef HEAT_ENABLE - } else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) { - db = 270; - if(da < 51) - da ++; -#endif - } else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) { - db = 266; - if(da < 51) - da ++; - } else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) { - db = 259; - if(svf_open && svf_own && x<=55*sdl_scale) - db = 258; - if(da < 51) - da ++; - } else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) { - db = svf_login ? 261 : 260; - if(svf_admin) { - db = 268; - } else if(svf_mod) { - db = 271; - } - if(da < 51) - da ++; - } else if(x>=sdl_scale && x<=17*sdl_scale) { - db = 262; - if(da < 51) - da ++; - } else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) { - db = sys_pause ? 264 : 263; - if(da < 51) - da ++; - } else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) { - db = 267; - if(da < 51) - da ++; - } else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) { - db = 265; - if(da < 51) - da ++; - } else if(da > 0) - da --; - } else - if(da > 0) - da --; - - if(!sdl_zoom_trig && zoom_en==1) - zoom_en = 0; - - if(sdl_key==Z_keysym && zoom_en==2) - zoom_en = 1; - - if(load_mode) { - load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); - load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); - if(load_x+load_w>XRES) load_x=XRES-load_w; - if(load_y+load_h>YRES) load_y=YRES-load_h; - if(load_x<0) load_x=0; - if(load_y<0) load_y=0; - if(bq==1 && !b) { - parse_save(load_data, load_size, 0, load_x, load_y); - free(load_data); - free(load_img); - load_mode = 0; - } else if(bq==4 && !b) { - free(load_data); - free(load_img); - load_mode = 0; - } - } else if(save_mode==1) { - save_x = (mx/sdl_scale)/CELL; - save_y = (my/sdl_scale)/CELL; - if(save_x >= XRES/CELL) save_x = XRES/CELL-1; - if(save_y >= YRES/CELL) save_y = YRES/CELL-1; - save_w = 1; - save_h = 1; - if(b==1){ - save_mode = 2; - } else if(b==4){ - save_mode = 0; - copy_mode = 0; - } - } else if(save_mode==2) { - save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; - save_h = (my/sdl_scale+CELL/2)/CELL - save_y; - if(save_w>XRES/CELL) save_w = XRES/CELL; - if(save_h>YRES/CELL) save_h = YRES/CELL; - if(save_w<1) save_w = 1; - if(save_h<1) save_h = 1; - if(!b) { - if(copy_mode==1){ - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - } else if(copy_mode==2){ - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - } else { - stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - save_mode = 0; - } - } - } else if(sdl_zoom_trig && zoom_en<2) { - x /= sdl_scale; - y /= sdl_scale; - x -= ZSIZE/2; - y -= ZSIZE/2; - if(x<0) x=0; - if(y<0) y=0; - if(x>XRES-ZSIZE) x=XRES-ZSIZE; - if(y>YRES-ZSIZE) y=YRES-ZSIZE; - zoom_x = x; - zoom_y = y; - zoom_wx = (x 50) - it = 50; - x /= sdl_scale; - y /= sdl_scale; - if(y>=YRES+(MENUSIZE-20)) { - if(!lb) { - if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0){ - if(execute_vote(vid_buf, svf_id, "Up")){ - svf_myvote = 1; - } - } - if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0){ - if(execute_vote(vid_buf, svf_id, "Down")){ - svf_myvote = -1; - } - } -#ifdef HEAT_ENABLE - if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) -#else - if(x>=219 && x<=(XRES+BARSIZE-(510-365)) && svf_login && svf_open) -#endif - tag_list_ui(vid_buf); -#ifdef HEAT_ENABLE - if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) { - legacy_enable = !legacy_enable; - } -#endif - if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) { - memset(signs, 0, sizeof(signs)); - memset(pv, 0, sizeof(pv)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(fvx, 0, sizeof(fvx)); - memset(fvy, 0, sizeof(fvy)); - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(parts, 0, sizeof(particle)*NPART); - for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) { - login_ui(vid_buf); - if(svf_login) - save_presets(0); - } - if(x>=37 && x<=187 && svf_login) { - if(!svf_open || !svf_own || x>51) { - if(save_name_ui(vid_buf)) - execute_save(vid_buf); - } else - execute_save(vid_buf); - while(!sdl_poll()) - if(!SDL_GetMouseState(&x, &y)) - break; - b = bq = 0; - } - if(x>=1 && x<=17) { - search_ui(vid_buf); - memset(fire_bg, 0, XRES*YRES*PIXELSIZE); - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - } - if(x>=19 && x<=35 && svf_last && svf_open) - parse_save(svf_last, svf_lsize, 1, 0, 0); - if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { -#ifdef HEAT_ENABLE - if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 6); - if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+5) % 6); -#else - if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 5); - if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+4) % 5); -#endif - save_presets(0); - } - if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) - sys_pause = !sys_pause; - lb = 0; - } - } else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)){ - c = sl = cr&0xFF; - } else { - //Something - } - } - //create_parts(x, y, bs, SPC_AIR); - lx = x; - ly = y; - lb = 0; - lm = 0; - } else { - create_parts(x, y, bs, c); - lx = x; - ly = y; - lb = b; - lm = 0; - } - } - } - } else { - if(lb && lm) { - x /= sdl_scale; - y /= sdl_scale; - c = (lb&1) ? sl : sr; - su = c; - if(lm == 1) { - if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) - create_line(lx, ly, x, y, bs, c); - } else - create_box(lx, ly, x, y, c); - lm = 0; - } - lb = 0; - } - - if(load_mode) { - draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); - xor_rect(vid_buf, load_x, load_y, load_w, load_h); - } - - if(save_mode) { - xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - da = 51; - db = 269; - } - - if(zoom_en!=1 && !load_mode && !save_mode) - render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); - - if(zoom_en) - render_zoom(vid_buf); - - if(da) - switch(db) { - case 256: - drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); - break; - case 257: - drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); - break; - case 258: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); - break; - case 259: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); - break; - case 260: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); - break; - case 261: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); - break; - case 262: - drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); - break; - case 263: - drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); - break; - case 264: - drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); - break; - case 265: - drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); - break; - case 266: - drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); - break; - case 267: - drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); - break; - case 268: - drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); - break; - case 269: - drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); - break; - case 270: - drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); - break; - case 271: - drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); - break; - case 272: - drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); - break; - case 273: - drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); - break; - case 274: - drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); - break; - case 275: - drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); - break; - default: - drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); - } - if(itc) { - itc--; - drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); - } - if(it) { - it--; - //if(fbi_img) - //draw_image(vid_buf, fbi_img, (XRES-FBI_W)/2, (YRES-FBI_H)/2+25, FBI_W, FBI_H, it>12?64:it*5); - drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); - } - - if(old_version) { - clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); -#ifdef BETA - if(is_beta){ - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); - } else { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); - } -#else - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); -#endif - drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); - } - /*#ifdef MT - pthread_join(pth2,NULL); - #endif*/ - - if(hud_enable){ - currentTime = SDL_GetTicks(); - if(currentTime-past>=16) { - past = SDL_GetTicks(); - FPS++; - } - if(currentTime-pastFPS>=1000) { -#ifdef BETA - sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#else - sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#endif - FPSB = FPS; - FPS = 0; - pastFPS = currentTime; - } -#ifdef HEAT_ENABLE - if(sdl_zoom_trig){ - if(x +#include +#include +#include +#include +#include +#include +//#include +#ifdef MT +#include +#include +#endif + +#ifdef WIN32 +#include +#else +#include +#include +#endif + + +#include "version.h" +#include "http.h" +#include "md5.h" +#include "update.h" + +#define SERVER "powder.hardwired.org.uk" + +#undef PLOSS + +#ifdef MENUV3 +#define MENUSIZE 40 +#else +#define MENUSIZE 20 +#endif +#define BARSIZE 14 +#define XRES 612 +#define YRES 384 +#define NPART XRES*YRES + +#define ZSIZE_D 16 +#define ZFACTOR_D 8 +unsigned char ZFACTOR = 256/ZSIZE_D; +unsigned char ZSIZE = ZSIZE_D; + +#define CELL 4 +#define ISTP (CELL/2) +#define CFDS (4.0f/CELL) + +typedef unsigned char uint8; + +#ifdef HEAT_ENABLE +#include "hmap.h" +#endif + +#ifdef PIX16 +#define PIXELSIZE 2 +typedef unsigned short pixel; +#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) +#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) +#define PIXR(x) (((x)>>8)&0xF8) +#define PIXG(x) (((x)>>3)&0xFC) +#define PIXB(x) (((x)<<3)&0xF8) +#else +#define PIXELSIZE 4 +typedef unsigned int pixel; +#ifdef PIX32BGR +#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) +#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) +#define PIXR(x) ((x)&0xFF) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)>>16) +#else +#ifdef PIX32BGRA +#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) +#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) +#define PIXR(x) (((x)>>8)&0xFF) +#define PIXG(x) (((x)>>16)&0xFF) +#define PIXB(x) (((x)>>24)) +#else +#define PIXPACK(x) (x) +#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) +#define PIXR(x) ((x)>>16) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)&0xFF) +#endif +#endif +#endif + +char *it_msg = +"\brThe Powder Toy\n" +"\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" +"\n" +"\bgControl+C/V/X are Copy, Paste and cut respectively.\n" +"\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" +"\bgPick your material from the menu using mouse left/right buttons.\n" +"Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" +"Shift+drag will create straight lines of particles.\n" +"Ctrl+drag will result in filled rectangles.\n" +"Ctrl+Shift+click will flood-fill a closed area.\n" +"Middle click or Alt+Click to \"sample\" the particles.\n" +"\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" +"Use 'S' to save parts of the window as 'stamps'.\n" +"'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" +"'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" +"Use the mouse scroll wheel to change the tool size for particles.\n" +"'Q' will quit the application.\n" +"The spacebar can be used to pause physics.\n" +"'P' will take a screenshot and save it into the current directory.\n" +"\n" +"\brhttp://powder.hardwired.org.uk/\n" +"\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" +"\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powder.hardwired.org.uk\bg)\n" +"\n" +"\bgSpecial thanks to Brian Ledbetter for maintaining ports & server development in the past." +"\nand CW for hosting the original server.\n" +"\bgTo use online features such as saving, you need to register at: \brhttp://powder.hardwired.org.uk/Register.html" +; + +typedef struct { + int start, inc; + pixel *vid; +} upstruc; + +#ifdef BETA +char *old_ver_msg_beta = "A new beta is available - click here!"; +#endif +char *old_ver_msg = "A new version is available - click here!"; +#ifdef HEAT_ENABLE +float mheat = 0.0f; +#endif + +int do_open = 0; +int sys_pause = 0; +int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. + +int amd = 0; + +unsigned char fire_r[YRES/CELL][XRES/CELL]; +unsigned char fire_g[YRES/CELL][XRES/CELL]; +unsigned char fire_b[YRES/CELL][XRES/CELL]; + +#define MAXSIGNS 16 + +struct sign { + int x,y,ju; + char text[256]; +} signs[MAXSIGNS]; + +/*********************************************************** + * AIR FLOW SIMULATOR * + ***********************************************************/ + +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; +unsigned cmode = 3; + +float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; +float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; +#define TSTEPP 0.3f +#define TSTEPV 0.4f +#define VADV 0.3f +#define VLOSS 0.999f +#define PLOSS 0.9999f +int numCores = 1; +float kernel[9]; +void make_kernel(void) +{ + int i, j; + float s = 0.0f; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) { + kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); + s += kernel[(i+1)+3*(j+1)]; + } + s = 1.0f / s; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + kernel[(i+1)+3*(j+1)] *= s; +} + +int core_count(){ + int numCPU = 1; +#ifdef MT +#ifdef WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + numCPU = sysinfo.dwNumberOfProcessors; +#else +#ifdef MACOSX + numCPU = 4; +#else + numCPU = sysconf( _SC_NPROCESSORS_ONLN ); +#endif +#endif + + printf("Cpus: %d\n", numCPU); + if(numCPU>1) + printf("Multithreading enabled\n"); + else + printf("Multithreading disabled\n"); +#endif + return numCPU; +} + +void update_air(void) +{ + int x, y, i, j; + float dp, dx, dy, f, tx, ty; + + for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; + if(dp < -256.0f) dp = -256.0f; + if(dx > 256.0f) dx = 256.0f; + if(dx < -256.0f) dx = -256.0f; + if(dy > 256.0f) dy = 256.0f; + if(dy < -256.0f) dy = -256.0f; + + ovx[y][x] = dx; + ovy[y][x] = dy; + opv[y][x] = dp; + } + memcpy(vx, ovx, sizeof(vx)); + memcpy(vy, ovy, sizeof(vy)); + memcpy(pv, opv, sizeof(pv)); +} + +void *update_air_th(void *arg) +{ + update_air(); + return NULL; +} + +unsigned clamp_flt(float f, float min, float max) +{ + if(fmax) + return 255; + return (int)(255.0f*(f-min)/(max-min)); +} + +float restrict_flt(float f, float min, float max){ + if(fmax) + return max; + return f; +} + +void draw_air(pixel *vid) +{ + int x, y, i, j; + pixel c; + + if(cmode == 2) + return; + + for(y=0; y 0.0f) + c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); + else + c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); + } else + c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), + clamp_flt(pv[y][x], 0.0f, 8.0f), + clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); + for(j=0; j=XRES || ny>=YRES) + return 0; + if(x==nx && y==ny) + return 1; + r = pmap[ny][nx]; + if(r && (r>>8)>8].type; + + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE)){ + return 1; + } + + if((r&0xFF)==PT_VOID){ + parts[i].type=PT_NONE; + return 0; + } + if((r&0xFF)==PT_BHOL){ + parts[i].type=PT_NONE; +#ifdef HEAT_ENABLE + if(!legacy_enable){ + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; + } +#endif + return 0; + } + + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]){ + return 1; + } + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE){ + return 0; + } + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])){ + return 0; + } + + if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; + if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + return 0; + if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) + return 0; + + if(parts[i].type==PT_CNCT && y>8)>= 8; + parts[r].x += x-nx; + parts[r].y += y-ny; + } + + return 1; +} + +void kill_part(int i) +{ + int x, y; + parts[i].type = PT_NONE; + + x = (int)(parts[i].x+0.5f); + y = (int)(parts[i].y+0.5f); + + if(x>=0 && y>=0 && x=XRES || y>=YRES) + return -1; + +#ifdef HEAT_ENABLE + if(t==SPC_HEAT||t==SPC_COOL){ + if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + } + if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP){ + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + } + return pmap[y][x]>>8; + } else { + return -1; + } + } +#endif + if(t==SPC_AIR){ + pv[y/CELL][x/CELL] += 0.03f; + if(y+CELL>8].type = PT_SPRK; + parts[pmap[y][x]>>8].life = 4; + parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; + pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; + return pmap[y][x]>>8; + } + + if(p==-1) { + if(pmap[y][x]) + return -1; + if(pfree == -1) + return -1; + i = pfree; + pfree = parts[i].life; + } else + i = p; + + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; +#ifdef HEAT_ENABLE + parts[i].temp = ptypes[t].heat; +#endif + if(t==PT_ACID){ + parts[i].life = 75; + } + //Testing + /*if(t==PT_WOOD){ + parts[i].life = 150; + }*/ + //End Testing + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_PLSM) + parts[i].life = rand()%150+50; + if(t==PT_LAVA) + parts[i].life = rand()%120+240; + if(t==PT_NBLE) + parts[i].life = 0; + if(t==PT_NEUT) { + float r = (rand()%128+128)/127.0f; + float a = (rand()%360)*3.14159f/180.0f; + parts[i].life = rand()%480+480; + parts[i].vx = r*cosf(a); + parts[i].vy = r*sinf(a); + } + if(t==PT_PHOT) { + float r = (rand()%3-1)*3; + float a = (rand()%3-1)*3; + parts[i].life = 680; + if(a==0.0f&&r==0.0f){ + parts[i].life = 0; + parts[i].type = PT_NONE; + return -1; + } else { + parts[i].vx = a; + parts[i].vy = r; + } + //} else { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + //} + } + + pmap[y][x] = t|(i<<8); + + return i; +} + +void delete_part(int x, int y) +{ + unsigned i; + + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + i = pmap[y][x]; + if(!i || (i>>8)>=NPART) + return; + + kill_part(i>>8); + pmap[y][x] = 0; // just in case +} + +void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + if(a!=255) { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + 255*PIXR(t)) >> 8; + g = (a*g + 255*PIXG(t)) >> 8; + b = (a*b + 255*PIXB(t)) >> 8; + if(r>255) + r = 255; + if(g>255) + g = 255; + if(b>255) + b = 255; + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); + +int is_wire(int x, int y) +{ + return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; +} +int is_wire_off(int x, int y) +{ + return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; +} + +void set_emap(int x, int y) +{ + int x1, x2; + + if(!is_wire_off(x, y)) + return; + + // go left as far as possible + x1 = x2 = x; + while(x1>0) { + if(!is_wire_off(x1-1, y)) + break; + x1--; + } + while(x21 && x1==x2 && + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + set_emap(x1, y-2); + else if(y>0) + for(x=x1; x<=x2; x++) + if(is_wire_off(x, y-1)) { + if(x==x1 || x==x2 || y>=YRES/CELL-1 || + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + set_emap(x, y-1); + } + + if(y=XRES || y>=YRES || + bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) { + kill_part(i); + continue; + } + + vx[y/CELL][x/CELL] *= ptypes[t].airloss; + vy[y/CELL][x/CELL] *= ptypes[t].airloss; + vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + if(t==PT_GASS||t==PT_NBLE) { + if(pv[y/CELL][x/CELL]<3.5f) + pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); + if(y+CELL2.5f) { + parts[i].life = rand()%80+180; + rt = parts[i].type = PT_FIRE; +#ifdef HEAT_ENABLE + parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); +#endif + pv[y/CELL][x/CELL] += 0.25f * CFDS; + t = PT_FIRE; + } + + parts[i].vx *= ptypes[t].loss; + parts[i].vy *= ptypes[t].loss; + + if(t==PT_DFRM && !parts[i].life) { + if(pv[y/CELL][x/CELL]>1.0f) { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].life = rand()%80+300; + } + } else { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + + if(ptypes[t].diffusion) { + parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + } + + // interpolator +#ifdef WIN32 + mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#else + mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#endif + if(mv < ISTP) { + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + } else { + dx = parts[i].vx*ISTP/mv; + dy = parts[i].vy*ISTP/mv; + ix = parts[i].x; + iy = parts[i].y; + while(1) { + mv -= ISTP; + if(mv <= 0.0f) { + // nothing found + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + break; + } + ix += dx; + iy += dy; + nx = (int)(ix+0.5f); + ny = (int)(iy+0.5f); + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) { + parts[i].x = ix; + parts[i].y = iy; + break; + } + } + } + + a = nt = 0; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx4.0f) + t = parts[i].type = PT_DSTW; + if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) + t = parts[i].type = PT_OILL; + if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) + t = parts[i].type = PT_GASS; +#ifdef HEAT_ENABLE + } +#endif + if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) + t = parts[i].type = PT_BRMT; + if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) + t = parts[i].type = PT_BGLA; + if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) + t = parts[i].type = PT_SNOW; + if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) { + t = PT_NEUT; + create_part(i, x, y, t); + } + + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1){ + nearp = nearest_part(i, PT_ETRD); + if(nearp!=-1){ + create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[nearp].type = PT_SPRK; + parts[nearp].life = 9; + parts[nearp].ctype = PT_ETRD; + } + } + +#ifdef HEAT_ENABLE + if(!legacy_enable){ + int ctemp = pv[y/CELL][x/CELL]*2; + c_heat = 0.0f; + h_count = 0; + if(ptypes[t].hconduct>(rand()%250)){ + for(nx=-1; nx<2; nx++) { + for(ny=-1; ny<2; ny++) { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE){ + h_count++; + c_heat += parts[r>>8].temp; + } + } + } + } + pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); + for(nx=-1; nx<2; nx++) { + for(ny=-1; ny<2; ny++) { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE){ + parts[r>>8].temp = parts[i].temp; + } + } + } + } + if(pt>=pstates[t].btemp&&pstates[t].burn) { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid){ + if(t==PT_LAVA&&parts[i].ctype){ + parts[i].life = 0; + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp){ + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } else { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)){ + if(pstates[t].liquid==PT_LAVA){ + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } else if(t==PT_ICEI&&parts[i].ctype){ + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } else { + t = parts[i].type = pstates[t].liquid; + } + }else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS){ + t = parts[i].type = pstates[t].liquid; + }else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)){ + if(t==PT_SLTW&&1>rand()%6){ + t = parts[i].type = PT_SALT; + } else { + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f){ + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA){ + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } + } + if(t==PT_CSCN&&parts[i].temp>24.0f){ + pt = parts[i].temp -= 2.5f; + } + if(t==PT_HSCN&&parts[i].temp>24.0f){ + pt = parts[i].temp -= 2.5f; + } + #endif + + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) { + nx = x % CELL; + if(nx == 0) + nx = x/CELL - 1; + else if(nx == CELL-1) + nx = x/CELL + 1; + else + nx = x/CELL; + ny = y % CELL; + if(ny == 0) + ny = y/CELL - 1; + else if(ny == CELL-1) + ny = y/CELL + 1; + else + ny = y/CELL; + if(nx>=0 && ny>=0 && nx0){ + int ttx = (rand()%3)-1; + r = pmap[y-1][x+ttx]; + if(parts[i].life>50){ + if((pmap[y-1][x+ttx]&0xFF)==PT_NONE){ + create_part(-1, x+ttx, y-1, PT_WOOD); + parts[pmap[y-1][x+ttx]>>8].life = parts[i].life-1; + parts[pmap[y-1][x+ttx]>>8].vx = ttx; + } + if((pmap[y-1][x+ttx-1]&0xFF)==PT_NONE){ + create_part(-1, x+ttx-1, y-1, PT_WOOD); + parts[pmap[y-1][x+ttx-1]>>8].life = 0; + } + if((pmap[y-1][x+ttx+1]&0xFF)==PT_NONE){ + create_part(-1, x+ttx+1, y-1, PT_WOOD); + parts[pmap[y-1][x+ttx+1]>>8].life = 0; + } + parts[i].life = 0; + } else if(parts[i].life>10) { + //int ttx = (rand()%3)-parts[i].vx; + //create_part(-1, x+ttx, y-1, PT_WOOD); + //r = pmap[y-1][x+ttx]; + //parts[r>>8].life = parts[i].life-1; + //parts[i].life = 0; + } + } else*/ + if(t==PT_THDR){ + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ){ + t = parts[i].type = PT_NONE; + parts[r>>8].ctype = parts[r>>8].type; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + } else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) { + pv[y/CELL][x/CELL] += 100.0f; + if(legacy_enable&&1>(rand()%200)){ + parts[i].life = rand()%50+120; + t = parts[i].type = PT_FIRE; + } else { + t = parts[i].type = PT_NONE; + } + } + } + } else if(t==PT_ICEI || t==PT_SNOW) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } +#ifndef HEAT_ENABLE + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; +#else + if(legacy_enable){ + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; + } +#endif + } + } + else if(t==PT_HSCN||t==PT_CSCN) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) { + parts[i].temp = 200.0f; + } + } + } + //PLANT + else if(t==PT_PLNT) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR && 1>(rand()%250)) { + t = parts[i].type = PT_PLNT; + parts[r>>8].type = PT_PLNT; + } else if((r&0xFF)==PT_LAVA && 1>(rand()%250)){ + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WATR||t==PT_DSTW) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10)) { +#ifndef HEAT_ENABLE + t = parts[i].type = PT_WTRV; + //parts[r>>8].type = PT_WTRV; +#else + if(legacy_enable){ + t = parts[i].type = PT_WTRV; + } +#endif + } else if((r&0xFF)==PT_SALT && 1>(rand()%250)) { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)){ + t = parts[i].type = PT_WATR; + } + if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)){ + t = parts[i].type = PT_SLTW; + } +#ifdef HEAT_ENABLE + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)){ +#else + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ +#endif + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_SLTW) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10)) { +#ifndef HEAT_ENABLE + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; +#else + if(legacy_enable){ + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; + } +#endif + } else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) { + //t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } +#ifdef HEAT_ENABLE + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)){ +#else + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ +#endif + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WTRV) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; +#ifdef HEAT_ENABLE + if(legacy_enable){ +#endif + if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000)) { + t = parts[i].type = PT_WATR; + parts[r>>8].type = PT_WATR; + } +#ifdef HEAT_ENABLE + } +#endif + +#ifdef HEAT_ENABLE + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)){ +#else + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ +#endif + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000)) { +#ifndef HEAT_ENABLE + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; +#else + if(legacy_enable){ + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; + } +#endif + } + } + } + // END PLANT + // ACID + else if(t==PT_ACID) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)!=PT_ACID){ + if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD){ + t = parts[i].type = PT_FIRE; + parts[i].life = 4; + parts[r>>8].type = PT_FIRE; + parts[r>>8].life = 4; + } else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) { + parts[i].life--; + parts[r>>8].type = PT_NONE; + } else if (parts[i].life==50){ + parts[i].life = 0; + t = parts[i].type = PT_NONE; + } + } + } + } + //END ACID :D + else if(t==PT_NEUT) { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) { + if(33>rand()%100) { + create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); + } else { + create_part(r>>8, x+nx, y+ny, PT_NEUT); + parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; + parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; + } + pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + fe ++; + } + if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + parts[r>>8].type = PT_DUST; + if((r&0xFF)==PT_WATR && 15>(rand()%100)) + parts[r>>8].type = PT_DSTW; + if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) + parts[r>>8].type = PT_DFRM; + if((r&0xFF)==PT_NITR && 15>(rand()%1000)) + parts[r>>8].type = PT_OILL; + if((r&0xFF)==PT_OILL && 5>(rand()%1000)) + parts[r>>8].type = PT_GASS; + if((r&0xFF)==PT_PLNT && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + } + } + else if(t==PT_PHOT){ + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=0; nx<1; nx++) + for(ny=0; ny<1; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + // } else if(((r&0xFF)!=PT_PHOT&&(r&0xFF)!=PT_NONE&&(r&0xFF)!=PT_CLNE)) { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + // }// else if((r&0xFF)!=PT_PLEX){ + // parts[i].life = 4; + // parts[i].type = PT_FIRE + //} + } + } + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) + continue; + rt = parts[r>>8].type; + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { + parts[r>>8].type = PT_FIRE; +#ifdef HEAT_ENABLE + parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); +#endif + parts[r>>8].life = rand()%80+180; + if(ptypes[rt].explosive) + pv[y/CELL][x/CELL] += 0.25f * CFDS; //LOL + continue; + } + lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; + if(lpv < 1) lpv = 1; +#ifndef HEAT_ENABLE + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && (t!=PT_FIRE || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && + ptypes[rt].meltable*lpv>(rand()%1000)) { + if(t!=PT_LAVA || parts[i].life>0) { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } else { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) { + parts[i].life = 0; + t = parts[i].type = PT_METL; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) { + kill_part(r>>8); + if(t==PT_FIRE) { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + //t = parts[i].type = PT_METL; + goto killed; + } + } +#else + if(legacy_enable){ + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && + ptypes[rt].meltable*lpv>(rand()%1000)) { + if(t!=PT_LAVA || parts[i].life>0) { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } else { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) { + parts[i].life = 0; + t = parts[i].type = PT_METL; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) { + kill_part(r>>8); + if(t==PT_FIRE) { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + //t = parts[i].type = PT_METL; + goto killed; + } + } + } +#endif + //Bitches now know about my semi-conductor :( + if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN)){ + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; +#ifdef HEAT_ENABLE + if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) + parts[r>>8].temp = parts[r>>8].temp+10.0f; +#endif + } + } + if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp>100.0f)){ + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp<100.0f)){ + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 6; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 5; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5){ + if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN){ + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE) + { + parts[i].temp = 3500; + } + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) + { + parts[i].life = rand()%150+50; + parts[i].type = PT_PLSM; + parts[i].ctype = PT_NBLE; + parts[i].temp = 3500; + pv[y/CELL][x/CELL] += 1; + } +} + killed: + if(parts[i].type == PT_NONE) + continue; + } + + if(t==PT_CLNE) { + if(!parts[i].ctype) { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx=XRES-CELL || + ny=YRES-CELL) { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + continue; + } + + rt = parts[i].flags & FLAG_STAGNANT; + parts[i].flags &= ~FLAG_STAGNANT; + if(!try_move(i, x, y, nx, ny)) { + parts[i].x = lx; + parts[i].y = ly; + if(ptypes[t].falldown) { + if(nx!=x && try_move(i, x, y, nx, y)) { + parts[i].x = ix; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else if(ny!=y && try_move(i, x, y, x, ny)) { + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else { + r = (rand()%2)*2-1; + if(ny!=y && try_move(i, x, y, x+r, ny)) { + parts[i].x += r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else if(ny!=y && try_move(i, x, y, x-r, ny)) { + parts[i].x -= r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else if(nx!=x && try_move(i, x, y, nx, y+r)) { + parts[i].x = ix; + parts[i].y += r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else if(nx!=x && try_move(i, x, y, nx, y-r)) { + parts[i].x = ix; + parts[i].y -= r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) { + s = 0; + if(!rt || nt) + rt = 50; + else + rt = 10; + for(j=x+r; j>=0 && j>=x-rt && j0) + r = 1; + else + r = -1; + if(s) + for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny(rand()%1000)) { + kill_part(i); + continue; + } else if(try_move(i, x, y, 2*x-nx, ny)) { + parts[i].x = (float)(2*x-nx); + parts[i].y = (float)iy; + parts[i].vx *= ptypes[t].collision; + } else if(try_move(i, x, y, nx, 2*y-ny)) { + parts[i].x = (float)ix; + parts[i].y = (float)(2*y-ny); + parts[i].vy *= ptypes[t].collision; + } else { + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + } + } + + justdraw: + + nx = (int)(parts[i].x+0.5f); + ny = (int)(parts[i].y+0.5f); + + if(nx=XRES-CELL || + ny=YRES-CELL) { + kill_part(i); + continue; + } +#ifdef HEAT_ENABLE + if(cmode!=CM_HEAT){ + +#endif + if(t==PT_ACID) { + if(parts[i].life>255) parts[i].life = 255; + if(parts[i].life<47) parts[i].life = 48; + s = (255/((parts[i].life-46)*28));//if(parts[i].life<=49) parts[i].life = 50; + if(s==0) s = 1; + cr = PIXR(ptypes[t].pcolors)/s; + cg = PIXG(ptypes[t].pcolors)/s; + cb = PIXB(ptypes[t].pcolors)/s; + //vid[ny*(XRES+BARSIZE)+nx] = //(cr<<16)+(cb<<18)+cg;//ptypes[t].pcolors/-(parts[i].life-255); + blendpixel(vid, nx, ny, cr, cg, cb, 255);//(parts[i].life-46)*28 + if(cmode==4){ + blendpixel(vid, nx+1, ny, cr, cg, cb, 223); + blendpixel(vid, nx-1, ny, cr, cg, cb, 223); + blendpixel(vid, nx, ny+1, cr, cg, cb, 223); + blendpixel(vid, nx, ny-1, cr, cg, cb, 223); + + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); + } + }else if(t==PT_NEUT) { + if(cmode == 3||cmode==4) { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 8; + cb = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } else { + cr = 0x20; + cg = 0xE0; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + }else if(t==PT_PHOT) { + if(cmode == 3||cmode==4) { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 12; + cb = 12; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } else { + cr = 0xFF; + cg = 0xFF; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_THDR) { + if(cmode == 3||cmode==4) { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 16; + cb = 20; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } else { + cr = 0xFF; + cg = 0xFF; + cb = 0xA0; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLSM) { + float ttemp = parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = plasma_data[caddress]; + uint8 G = plasma_data[caddress+1]; + uint8 B = plasma_data[caddress+2]; + if(cmode == 3||cmode==4) { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } else { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_FIRE && parts[i].life) { + if(cmode == 3||cmode==4) { + cr = parts[i].life / 4; + cg = parts[i].life / 16; + cb = parts[i].life / 32; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } else { + cr = parts[i].life * 8; + cg = parts[i].life * 2; + cb = parts[i].life; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_LAVA && parts[i].life) { + cr = parts[i].life * 2 + 0xE0; + cg = parts[i].life * 1 + 0x50; + cb = parts[i].life/2 + 0x10; + if(cr>255) cr = 255; + if(cg>192) cg = 192; + if(cb>128) cb = 128; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 64); + blendpixel(vid, nx-1, ny, cr, cg, cb, 64); + blendpixel(vid, nx, ny+1, cr, cg, cb, 64); + blendpixel(vid, nx, ny-1, cr, cg, cb, 64); + if(cmode == 3||cmode==4) { + cr /= 32; + cg /= 32; + cb /= 32; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } else if(t==PT_LAVA || t==PT_SPRK) { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + if(cmode == 3 || cmode==4) { + if(t == PT_LAVA) { + cr = 3; + cg = i%2; + cb = 0; + } else { + cr = 8; + cg = 12; + cb = 16; + } + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } else + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; +#ifdef HEAT_ENABLE + } else { + float ttemp = parts[i].temp+(-MIN_TEMP); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); + uint8 R = color_data[caddress]; + uint8 G = color_data[caddress+1]; + uint8 B = color_data[caddress+2]; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); + //blendpixel(vid, nx+1, ny, R, G, B, 255); + } +#endif + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID){ + uint8 R = PIXR(ptypes[t].pcolors); + uint8 G = PIXG(ptypes[t].pcolors); + uint8 B = PIXB(ptypes[t].pcolors); + + //if(vid[(ny-1)*YRES+(nx-1)]!=0){ + // blendpixel(vid, nx, ny-1, R, G, B, 46); + //} + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + + } + +} + +void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb){ + blendpixel(vid, x+1, y, cr, cg, cb, 112); + blendpixel(vid, x-1, y, cr, cg, cb, 112); + blendpixel(vid, x, y+1, cr, cg, cb, 112); + blendpixel(vid, x, y-1, cr, cg, cb, 112); + + blendpixel(vid, x+1, y-1, cr, cg, cb, 64); + blendpixel(vid, x-1, y-1, cr, cg, cb, 64); + blendpixel(vid, x+1, y+1, cr, cg, cb, 64); + blendpixel(vid, x-1, y+1, cr, cg, cb, 64); +} + +void update_particles_i_th(void *arg){ + upstruc *newup = (upstruc*)arg; + update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); + return; +} + +void update_particles(pixel *vid) +{ + int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; + float lx, ly; +#ifdef MT + int pt = 0, pc = 0; + pthread_t *InterThreads; +#endif + + memset(pmap, 0, sizeof(pmap)); + r = rand()%2; + for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) { + if(emap[y][x]) { + cr = cg = cb = 128; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) { + for(j=0; j 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==13) { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } else { + for(y=0; y>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) { + if(emap[y][x]) { + cr = cg = cb = 128; + cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) { + for(j=0; j 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(bmap[y][x]==9){ + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; + cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } + +#ifdef MT + if(numCores > 1) { + InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); + for(pc = 0; pc=XRES || ny<0 || ny>=YRES) + break; + addpixel(vid, nx, ny, 255, 255, 255, 64); + i = nx/CELL; + j = ny/CELL; + lx += vx[j][i]*0.125f; + ly += vy[j][i]*0.125f; + if(bmap[j][i]==5 && i!=x && j!=y) + break; + } + drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); + } + +} + +void update_particles_th(void *arg) +{ + update_particles((pixel*)arg); + return; +} + +/*********************************************************** + * SDL OUTPUT * + ***********************************************************/ + +int sdl_scale = 1; +SDL_Surface *sdl_scrn; +SDLMod sdl_mod; +int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; + +#include "icon.h" +void sdl_seticon(void) +{ +#ifdef WIN32 + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else +#ifdef MACOSX + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else + SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#endif +#endif +} + +void sdl_open(void) +{ + if(SDL_Init(SDL_INIT_VIDEO)<0) { + fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); + exit(1); + } + atexit(SDL_Quit); +#ifdef PIX16 + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); +#else + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); +#endif + if(!sdl_scrn) { + fprintf(stderr, "Creating window: %s\n", SDL_GetError()); + exit(1); + } + SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); + sdl_seticon(); + SDL_EnableUNICODE(1); + //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); +} + +void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0;jpitch/PIXELSIZE; + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} + +void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + int i,k; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0;jpitch/PIXELSIZE; + } + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} +void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) +{ + if(sdl_scale == 2) + sdl_blit_2(x, y, w, h, src, pitch); + else + sdl_blit_1(x, y, w, h, src, pitch); +} + +int frame_idx=0; +void dump_frame(pixel *src, int w, int h, int pitch) +{ + char frame_name[32]; + int j,i; + unsigned char c[3]; + FILE *f; + sprintf(frame_name,"frame%04d.ppm",frame_idx); + f=fopen(frame_name,"wb"); + fprintf(f,"P6\n%d %d\n255\n",w,h); + for(j=0;j=0 && x=0 && yPT_NUM) + return 2; + if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) + return 3; + i = XRES*YRES; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) + return 1; + size = i; + } else + d = c; + + if(size < XRES*YRES) { + if(bzip2) + free(d); + return 1; + } + + sy = 0; + for(y=0;y+scl<=YRES;y+=scl) { + sx = 0; + for(x=0;x+scl<=XRES;x+=scl) { + a = 0; + r = g = b = 0; + for(j=0;j=PT_NUM) + goto corrupt; + r += PIXR(ptypes[t].pcolors); + g += PIXG(ptypes[t].pcolors); + b += PIXB(ptypes[t].pcolors); + a ++; + } + } + if(a) { + a = 256/a; + r = (r*a)>>8; + g = (g*a)>>8; + b = (b*a)>>8; + } + drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); + sx++; + } + sy++; + } + + if(bzip2) + free(d); + return 0; + +corrupt: + if(bzip2) + free(d); + return 1; +} + +static char *mystrdup(char *s) +{ + char *x; + if(s) { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; + } + return s; +} + +void *build_save(int *size, int x0, int y0, int w, int h) +{ +#ifdef HEAT_ENABLE + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; +#else + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*6+MAXSIGNS*262), *c; +#endif + int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); + int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + // save the required air state + for(y=by0; y255) i=255; + d[p++] = i; + } + for(y=by0; y255) i=255; + d[p++] = i; + } + + // save the particle map + for(i=0; i=x0 && x=y0 && y255) x=255; + if(y<0) y=0; + if(y>255) y=255; + d[p++] = x; + d[p++] = y; + } + } + for(j=0; j255) tttemp=255; + d[p++] = tttemp; + } + } +#endif + for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; + d[p++] = (signs[i].y-y0); + d[p++] = (signs[i].y-y0)>>8; + d[p++] = signs[i].ju; + x = strlen(signs[i].text); + d[p++] = x; + memcpy(d+p, signs[i].text, x); + p+=x; + } + + i = (p*101+99)/100 + 612; + c = malloc(i); + c[0] = 0x66; + c[1] = 0x75; + c[2] = 0x43; + c[3] = legacy_enable; + c[4] = SAVE_VERSION; + c[5] = CELL; + c[6] = bw; + c[7] = bh; + c[8] = p; + c[9] = p >> 8; + c[10] = p >> 16; + c[11] = p >> 24; + + i -= 12; + + if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) { + free(d); + free(c); + return NULL; + } + free(d); + + *size = i+12; + return c; +} + +int parse_save(void *save, int size, int replace, int x0, int y0) +{ + unsigned char *d,*c=save; + int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; + int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; + int fp[NPART], nf=0; + + if(size<16) + return 1; + if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) + return 1; + if(c[4]>SAVE_VERSION) + return 2; + ver = c[4]; + +#ifdef HEAT_ENABLE + if(ver<34){ + legacy_enable = 1; + } else { + if(c[3]==1||c[3]==0) + legacy_enable = c[3]; + else + legacy_beta = 1; + } +#endif + + bw = c[6]; + bh = c[7]; + if(bx0+bw > XRES/CELL) + bx0 = XRES/CELL - bw; + if(by0+bh > YRES/CELL) + by0 = YRES/CELL - bh; + if(bx0 < 0) + bx0 = 0; + if(by0 < 0) + by0 = 0; + + if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) + return 3; + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + return 1; + size = i; + + if(size < bw*bh) + return 1; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + if(replace) { + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(signs, 0, sizeof(signs)); + memset(parts, 0, sizeof(particle)*NPART); + memset(pmap, 0, sizeof(pmap)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(pv, 0, sizeof(pv)); + } + + // make a catalog of free parts + memset(pmap, 0, sizeof(pmap)); + for(i=0; i= size) + goto corrupt; + fvx[y][x] = (d[p++]-127.0f)/64.0f; + } + for(y=by0; y= size) + goto corrupt; + fvy[y][x] = (d[p++]-127.0f)/64.0f; + } + + // load the particle map + i = 0; + pty = p; + for(y=y0;y= size) + goto corrupt; + j=d[p++]; + if(j >= PT_NUM) + goto corrupt; + if(j) { + if(pmap[y][x]) { + k = pmap[y][x]>>8; + parts[k].type = j; + parts[k].x = (float)x; + parts[k].y = (float)y; + m[(x-x0)+(y-y0)*w] = k+1; + } else if(i < nf) { + parts[fp[i]].type = j; + parts[fp[i]].x = (float)x; + parts[fp[i]].y = (float)y; + m[(x-x0)+(y-y0)*w] = fp[i]+1; + i++; + } else + m[(x-x0)+(y-y0)*w] = NPART+1; + } + } + + // load particle properties + for(j=0; j= size) + goto corrupt; + if(i < NPART) { + parts[i].vx = (d[p++]-127.0f)/16.0f; + parts[i].vy = (d[p++]-127.0f)/16.0f; + } else + p += 2; + } + } + for(j=0; j= size) + goto corrupt; + if(i <= NPART) + parts[i-1].life = d[p++]*4; + else + p++; + } + } +#ifdef HEAT_ENABLE + for(j=0; j=34&&legacy_beta==0){ + if(p >= size){ + goto corrupt; + } + if(i <= NPART) { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } else { + p++; + } + } else { + parts[i-1].temp = ptypes[parts[i-1].type].heat; + } + } + } +#endif + for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) { + if(p >= size) + goto corrupt; + if(i <= NPART) + parts[i-1].ctype = d[p++]; + else + p++; + } + } + + if(p >= size) + goto version1; + j = d[p++]; + for(i=0; i size) + goto corrupt; + for(k=0; k size) + goto corrupt; + if(kSAVE_VERSION) + return NULL; + + bw = c[6]; + bh = c[7]; + w = bw*CELL; + h = bh*CELL; + + if(c[5]!=CELL) + return NULL; + + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return NULL; + fb = calloc(w*h, PIXELSIZE); + if(!fb) { + free(d); + return NULL; + } + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + goto corrupt; + size = i; + + if(size < bw*bh) + goto corrupt; + + k = 0; + for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) + goto corrupt; + + for(y=0;y= size) + goto corrupt; + j=d[p++]; + if(j0) + fb[y*w+x] = ptypes[j].pcolors; + } + + free(d); + *width = w; + *height = h; + return fb; + +corrupt: + free(d); + free(fb); + return NULL; +} + +/* NO, I DON'T THINK SO + #include "fbi.h" + + pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) + { + unsigned char *tmp; + pixel *res; + int i; + + tmp = malloc(width*height*3); + if(!tmp) + return NULL; + res = malloc(width*height*PIXELSIZE); + if(!res) { + free(tmp); + return NULL; + } + + i = width*height*3; + if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { + free(res); + free(tmp); + return NULL; + } + + for(i=0; i1) { + r = (r+c/2)/c; + g = (g+c/2)/c; + b = (b+c/2)/c; + } + q[y*w+x] = PIXRGB(r, g, b); + } + *qw = w; + *qh = h; + return q; +} + +#define GRID_X 5 +#define GRID_Y 4 +#define GRID_P 3 +#define GRID_S 6 +#define GRID_Z 3 + +void stamp_gen_thumb(int i) +{ + char fn[64]; + void *data; + int size, factor_x, factor_y; + pixel *tmp; + + if(stamps[i].thumb) { + free(stamps[i].thumb); + stamps[i].thumb = NULL; + } + + sprintf(fn, "stamps" PATH_SEP "%s.stm", stamps[i].name); + data = file_load(fn, &size); + + if(data) { + stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); + if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) { + factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); + factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); + if(factor_y > factor_x) + factor_x = factor_y; + tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); + free(stamps[i].thumb); + stamps[i].thumb = tmp; + } + } + + free(data); +} + +int clipboard_ready = 0; +void *clipboard_data = 0; +int clipboard_length = 0; + +void stamp_save(int x, int y, int w, int h) +{ + FILE *f; + int n; + char fn[64], sn[16]; + void *s=build_save(&n, x, y, w, h); + +#ifdef WIN32 + _mkdir("stamps"); +#else + mkdir("stamps", 0755); +#endif + + stamp_gen_name(sn); + sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); + + f = fopen(fn, "wb"); + if(!f) + return; + fwrite(s, n, 1, f); + fclose(f); + + free(s); + + if(stamps[STAMP_MAX-1].thumb) + free(stamps[STAMP_MAX-1].thumb); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); + memset(stamps, 0, sizeof(struct stamp_info)); + if(stamp_count0) { + memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); + memcpy(stamps, &tmp, sizeof(struct stamp_info)); + + stamp_update(); + } + + return data; +} + +void stamp_init(void) +{ + int i; + FILE *f; + + memset(stamps, 0, sizeof(stamps)); + + f=fopen("stamps" PATH_SEP "stamps.def", "rb"); + if(!f) + return; + for(i=0; i=XRES+BARSIZE || y>=YRES+MENUSIZE) + return; + if(a!=255) { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +{ + int i, j, w, bn = 0, ba = 0; + char *rp = font_data + font_ptrs[c]; + w = *(rp++); + for(j=0; j>= 2; + bn -= 2; + } + return x + w; +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) +{ + int sx = x; + for(;*s;s++) { + if(*s == '\n') { + x = sx; + y += FONT_H+2; + } else if(*s == '\b') { + switch(s[1]) { + case 'w': + r = g = b = 255; + break; + case 'g': + r = g = b = 192; + break; + case 'o': + r = 255; + g = 216; + b = 32; + break; + case 'r': + r = 255; + g = b = 0; + break; + case 'b': + r = g = 0; + b = 255; + break; + } + s++; + } else + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + return x; +} + +void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) +{ + int i; + for(i=0; i<=w; i++) { + drawpixel(vid, x+i, y, r, g, b, a); + drawpixel(vid, x+i, y+h, r, g, b, a); + } + for(i=1; i=w && x+textwidth(s)>=w+5) + break; + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + if(*s) + for(i=0; i<3; i++) + x = drawchar(vid, x, y, '.', r, g, b, a); + return x; +} + +int textnwidth(char *s, int n) +{ + int x = 0; + for(;*s;s++) { + if(!n) + break; + x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + n--; + } + return x-1; +} +int textwidthx(char *s, int w) +{ + int x=0,n=0,cw; + for(;*s;s++) { + cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + if(x+(cw/2) >= w) + break; + x += cw; + n++; + } + return n; +} + +/*********************************************************** + * MAIN PROGRAM * + ***********************************************************/ + +void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) +{ + int x, y, i, j, c; + int bo = b; + if(iswall==1){ + b = b-100; + x = (2+32*((b-22)/1)); + y = YRES+2+40; + switch(b){ + case WL_WALLELEC: + for(j=1; j<15; j++){ + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } else { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) { + for(i=1; i<6+j; i++) { + if(!(i&j&1)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) { + if(i&j&1) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<13; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) { + for(i=14; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + default: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) { + for(j=4; j<12; j++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } else { + x = 2+32*(b/2); + y = YRES+2+20*(b%2); + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) { + for(j=4; j<12; j++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + if(bo==sl || bo==sr) { + c = 0; + if(bo==sl) + c |= PIXPACK(0xFF0000); + if(bo==sr) + c |= PIXPACK(0x0000FF); + for(i=0; i<30; i++) { + vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; + } + for(j=0; j<18; j++) { + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; + } + } +} + +int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) +{ + int i, j, c; + if(b>=121){ + b = b-100; + //x = (2+32*((b-22)/1)); + //y = YRES+2+40; + switch(b){ + case WL_WALLELEC: + for(j=1; j<15; j++){ + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } else { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) { + for(i=1; i<6+j; i++) { + if(!(i&j&1)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) { + if(i&j&1) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<13; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) { + for(i=14; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + if(!(i%2) && !(j%2)) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + case 40: + for(j=1; j<15; j+=2) { + for(i=1+(1&(j>>1)); i<27; i+=2) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + default: + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) { + for(j=4; j<12; j++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } else { + //x = 2+32*(b/2); + //y = YRES+2+20*(b%2); + for(j=1; j<15; j++) { + for(i=1; i<27; i++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) { + for(j=4; j<12; j++) { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) { + c = 255; + } else { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + return 26; +} + +void draw_menu(pixel *vid_buf, int i, int hover){ + + //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); +#ifdef MENUV3 + drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + if(hover==i){ + fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); + } else { + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + } +#else + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); +#endif +} + +void menu_ui(pixel *vid_buf, int i, int *sl, int *sr){ + int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; + pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); + fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + rows = ceil((float)msections[i].itemcount/16.0f); + height = (ceil((float)msections[i].itemcount/16.0f)*18); + width = restrict_flt(msections[i].itemcount*31, 0, 16*31); + //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); + h = -1; + x = XRES-BARSIZE-26; + y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; + sy = y; + //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); + fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); + fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); + drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); + if(i==SC_WALL){ + for(n = 122; n<122+UI_WALLCOUNT; n++){ + if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM){ + if(x-26<=60){ + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } else if(i==SC_SPECIAL){ + for(n = 122; n<122+UI_WALLCOUNT; n++){ + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM){ + if(x-26<=60){ + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } else { + for(n = 0; n=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1){ + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); + } else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } else { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } else if(i==SC_SPECIAL){ + for(n = 122; n<122+UI_WALLCOUNT; n++){ + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM){ + if(x-26<=20){ + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(!bq && mx>=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } else { + for(n = 0; n=x+32 && mx=y && my< y+15){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } else if(n==*sl){ + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } else if(n==*sr){ + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1){ + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); + } else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } else { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + if(b==1&&h!=-1){ + *sl = h; + } + if(b==4&&h!=-1){ + *sr = h; + } + } + +int create_parts(int x, int y, int r, int c) +{ + int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; + + if(c == 125) { + i = x / CELL; + j = y / CELL; + for(v=-1;v<2;v++) + for(u=-1;u<2;u++) + if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) { + y += sy; + if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) { + if(cp) + create_parts(y, x, r, c); + else + create_parts(x, y, r, c); + } + e -= 1.0f; + } + } +} + +void create_box(int x1, int y1, int x2, int y2, int c) +{ + int i, j; + if(x1>x2) { + i = x2; + x2 = x1; + x1 = i; + } + if(y1>y2) { + j = y2; + y2 = y1; + y1 = j; + } + for(j=y1; j<=y2; j++) + for(i=x1; i<=x2; i++) + create_parts(i, j, 1, c); +} + +int flood_parts(int x, int y, int c, int cm, int bm) +{ + int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT){ + c = c-100; + } + if(cm==-1) { + if(c==0) { + cm = pmap[y][x]&0xFF; + if(!cm) + return 0; + } else + cm = 0; + } + if(bm==-1) { + if(c==30) { + bm = bmap[y/CELL][x/CELL]; + if(!bm) + return 0; + if(bm==1) + cm = 0xFF; + } else + bm = 0; + } + + if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) + return 1; + + // go left as far as possible + x1 = x2 = x; + while(x1>=CELL) { + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + break; + x1--; + } + while(x2=CELL+dy) + for(x=x1; x<=x2; x++) + if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) + if(!flood_parts(x, y-dy, co, cm, bm)) + return 0; + if(y=XRES || y>=YRES) + return; + c = vid[y*(XRES+BARSIZE)+x]; + c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); + if(c<512) + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); + else + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); +} + +void xor_line(int x1, int y1, int x2, int y2, pixel *vid) +{ + int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) { + y += sy; + e -= 1.0f; + } + } +} + +void draw_svf_ui(pixel *vid_buf) +{ + int c; + + drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); + drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + c = svf_open ? 255 : 128; + drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); + drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); + + c = svf_login ? 255 : 128; + drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); + if(svf_open) + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); + else + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); + drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); + if(svf_open && svf_own) + drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); + + c = (svf_login && svf_open) ? 255 : 128; + + drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + + if(svf_myvote==1 && (svf_login && svf_open)){ + fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); + } else if(svf_myvote==-1 && (svf_login && svf_open)){ + fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); + } + + drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); + drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); + + drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); + if(svf_tags[0]) + drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); + else + drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); + +#ifdef HEAT_ENABLE + drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); +#else + drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-364, 14, c, c, c, 255); +#endif + + drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); + drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); + if(svf_login) + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); + else + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); + drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); + + if(sys_pause) { + fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); + } else { + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); + drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + +#ifdef HEAT_ENABLE + if(!legacy_enable) { + fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); + } else { + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } +#endif + + switch(cmode) { + case 0: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); + break; + case 1: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); + break; + case 2: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); + break; + case 3: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); + break; + case 4: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); + break; +#ifdef HEAT_ENABLE + case 5: + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + break; +#endif + } + drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + + if(svf_admin) { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); + } else if(svf_mod) { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + }//else if(amd) + // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? +} + +typedef struct ui_edit { + int x, y, w, nx; + char str[256],*def; + int focus, cursor, hide; +} ui_edit; +void ui_edit_draw(pixel *vid_buf, ui_edit *ed) +{ + int cx, i; + char echo[256], *str; + + if(ed->hide) { + for(i=0;ed->str[i];i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } else + str = ed->str; + + if(ed->str[0]) { + drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } else if(!ed->focus) + drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); + if(ed->focus) { + cx = textnwidth(str, ed->cursor); + for(i=-3; i<9; i++) + drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); + } +} +char *shift_0="`1234567890-=[]\\;',./"; +char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; +void ui_edit_process(int mx, int my, int mb, ui_edit *ed) +{ + char ch, ts[2], echo[256], *str; + int l, i; +#ifdef RAWINPUT + char *p; +#endif + + if(mb) { + if(ed->hide) { + for(i=0;ed->str[i];i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } else + str = ed->str; + + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } else + ed->focus = 0; + } + if(ed->focus && sdl_key) { + if(ed->hide) { + for(i=0;ed->str[i];i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } else + str = ed->str; + + l = strlen(ed->str); + switch(sdl_key) { + case SDLK_HOME: + ed->cursor = 0; + break; + case SDLK_END: + ed->cursor = l; + break; + case SDLK_LEFT: + if(ed->cursor > 0) + ed->cursor --; + break; + case SDLK_RIGHT: + if(ed->cursor < l) + ed->cursor ++; + break; + case SDLK_DELETE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + ed->str[ed->cursor] = 0; + else if(ed->cursor < l) + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + break; + case SDLK_BACKSPACE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) { + if(ed->cursor > 0) + memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); + ed->cursor = 0; + } else if(ed->cursor > 0) { + ed->cursor--; + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + } + break; + default: +#ifdef RAWINPUT + if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) { + ch = sdl_key; + if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) { + if(ch>='a' && ch<='z') + ch &= ~0x20; + p = strchr(shift_0, ch); + if(p) + ch = shift_1[p-shift_0]; + } + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#else + if(sdl_ascii>=' ' && sdl_ascii<127) { + ch = sdl_ascii; + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#endif + break; + } + } +} + typedef struct ui_checkbox { + int x, y; + int focus, checked; + } ui_checkbox; + void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) + { + int w = 12; + if(ed->checked) { + drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); + } + if(ed->focus){ + drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); + } else { + drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); + } + } + void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) + { + int w = 12; + + if(mb && !mbq) { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w){ + ed->checked = (ed->checked)?0:1; + } + } else { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w){ + ed->focus = 1; + } else { + ed->focus = 0; + } + } + } + +void error_ui(pixel *vid_buf, int err, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + char *msg; + + msg = malloc(strlen(txt)+16); + if(err) + sprintf(msg, "%03d %s", err, txt); + else + sprintf(msg, "%s", txt); + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + if(err) + drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); + else + drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + free(msg); + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_ui(pixel *vid_buf, char *top, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); + drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_box(pixel *vid_buf, char *msg) +{ + int w = textwidth(msg)+16; + int x0=(XRES-w)/2,y0=(YRES-24)/2; + + clearrect(vid_buf, x0-2, y0-2, w+4, 28); + drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); +} + +int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + int ret = 0; + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); + drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); + drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); + drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) { + ret = 1; + break; + } + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) { + ret = 1; + break; + } + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + return ret; +} + +int execute_tagop(pixel *vid_buf, char *op, char *tag) +{ + int status; + char *result; + + char *names[] = {"ID", "Tag", NULL}; + char *parts[2]; + + char *uri = malloc(strlen(SERVER)+strlen(op)+36); + sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); + + parts[0] = svf_id; + parts[1] = tag; + + result = http_multipart_post( + uri, + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + free(uri); + + if(status!=200) { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 1; + } + if(result && strncmp(result, "OK", 2)) { + error_ui(vid_buf, 0, result); + free(result); + return 1; + } + + if(result[2]) { + strncpy(svf_tags, result+3, 255); + svf_id[15] = 0; + } + + if(result) + free(result); + + return 0; +} + +struct strlist { + char *str; + struct strlist *next; +}; +void strlist_add(struct strlist **list, char *str) +{ + struct strlist *item = malloc(sizeof(struct strlist)); + item->str = mystrdup(str); + item->next = *list; + *list = item; +} +int strlist_find(struct strlist **list, char *str) +{ + struct strlist *item; + for(item=*list;item;item=item->next) + if(!strcmp(item->str, str)) + return 1; + return 0; +} +void strlist_free(struct strlist **list) +{ + struct strlist *item; + while(*list) { + item = *list; + *list = (*list)->next; + free(item); + } +} + +void tag_list_ui(pixel *vid_buf) +{ + int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; + char *p,*q,s; + char *tag=NULL, *op=NULL; + ui_edit ed; + struct strlist *vote=NULL,*down=NULL; + + ed.x = x0+25; + ed.y = y0+221; + ed.w = 158; + ed.nx = 1; + ed.def = "[new tag]"; + ed.focus = 0; + ed.hide = 0; + ed.cursor = 0; + strcpy(ed.str, ""); + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + op = tag = NULL; + + drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 256); + drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); + p = svf_tags; + s = svf_tags[0] ? ' ' : 0; + y = 36 + y0; + while(s) { + q = strchr(p, ' '); + if(!q) + q = p+strlen(p); + s = *q; + *q = 0; + if(svf_own || svf_admin || svf_mod) { + drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); + d = 14; + if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) { + if(!ed1.focus) + break; + ed1.focus = 0; + ed2.focus = 1; + } + if(sdl_key==SDLK_ESCAPE) { + if(!ed1.focus && !ed2.focus) + return; + ed1.focus = 0; + ed2.focus = 0; + } + } + + strcpy(svf_user, ed1.str); + md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); + + res = http_multipart_post( + "http://" SERVER "/Login.api", + NULL, NULL, NULL, + svf_user, svf_pass, + &err, NULL); + if(err != 200) { + error_ui(vid_buf, err, http_ret_text(err)); + if(res) + free(res); + goto fail; + } + if(res && !strncmp(res, "OK", 2)) { + if(!strcmp(res, "OK ADMIN")){ + svf_admin = 1; + svf_mod = 0; + } else if(!strcmp(res, "OK MOD")){ + svf_admin = 0; + svf_mod = 1; + } else { + svf_admin = 0; + svf_mod = 0; + } + free(res); + svf_login = 1; + return; + } + if(!res) + res = mystrdup("Unspecified Error"); + error_ui(vid_buf, 0, res); + free(res); + +fail: + strcpy(svf_user, ""); + strcpy(svf_pass, ""); + svf_login = 0; + svf_own = 0; + svf_admin = 0; + svf_mod = 0; +} + +void execute_delete(pixel *vid_buf, char *id) +{ + int status; + char *result; + + char *names[] = {"ID", NULL}; + char *parts[1]; + + parts[0] = id; + + result = http_multipart_post( + "http://" SERVER "/Delete.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result) + free(result); +} + +int execute_vote(pixel *vid_buf, char *id, char *action) +{ + int status; + char *result; + + char *names[] = {"ID", "Action", NULL}; + char *parts[2]; + + parts[0] = id; + parts[1] = action; + + result = http_multipart_post( + "http://" SERVER "/Vote.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 0; + } + if(result && strncmp(result, "OK", 2)) { + error_ui(vid_buf, 0, result); + free(result); + return 0; + } + + if(result) + free(result); + return 1; +} + +static char hex[] = "0123456789ABCDEF"; +void strcaturl(char *dst, char *src) +{ + char *d; + unsigned char *s; + + for(d=dst; *d; d++) ; + + for(s=(unsigned char *)src; *s; s++) { + if((*s>='0' && *s<='9') || + (*s>='a' && *s<='z') || + (*s>='A' && *s<='Z')) + *(d++) = *s; + else { + *(d++) = '%'; + *(d++) = hex[*s>>4]; + *(d++) = hex[*s&15]; + } + } + *d = 0; +} + +#define THUMB_CACHE_SIZE 256 + +char *thumb_cache_id[THUMB_CACHE_SIZE]; +void *thumb_cache_data[THUMB_CACHE_SIZE]; +int thumb_cache_size[THUMB_CACHE_SIZE]; +int thumb_cache_lru[THUMB_CACHE_SIZE]; + +void thumb_cache_inval(char *id) +{ + int i,j; + for(i=0;i= THUMB_CACHE_SIZE) + return; + free(thumb_cache_id[i]); + free(thumb_cache_data[i]); + thumb_cache_id[i] = NULL; + for(j=0;j thumb_cache_lru[i]) + thumb_cache_lru[j]--; +} +void thumb_cache_add(char *id, void *thumb, int size) +{ + int i,m=-1,j=-1; + thumb_cache_inval(id); + for(i=0;i m) { + m = thumb_cache_lru[i]; + j = i; + } + } + if(i >= THUMB_CACHE_SIZE) { + thumb_cache_inval(thumb_cache_id[j]); + i = j; + } + for(j=0;j= THUMB_CACHE_SIZE) + return 0; + for(j=0;j=GRID_X*GRID_Y) + break; + if(votes) { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } else { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+5); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } else if(!strncmp(str, "TAG ", 4)) { + if(j >= TAG_MAX) { + str = p; + continue; + } + q = strchr(str+4, ' '); + if(!q) { + str = p; + continue; + } + *(q++) = 0; + tag_names[j] = mystrdup(str+4); + tag_votes[j] = atoi(q); + j++; + } else { + if(i>=GRID_X*GRID_Y) + break; + if(votes) { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } else { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + str = p; + } + if(*str) + i++; + return i; +} + +#define IMGCONNS 3 +#define TIMEOUT 100 +#define HTTP_TIMEOUT 10 + +int search_own = 0; +int search_date = 0; +int search_page = 0; +char search_expr[256] = ""; + +int search_ui(pixel *vid_buf) +{ + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; + float ry; + time_t http_last_use=HTTP_TIMEOUT; + ui_edit ed; + + + void *http = NULL; + int active = 0; + char *last = NULL; + int search = 0; + int lasttime = TIMEOUT; + char *uri; + int status; + char *results; + char *tmp, ts[64]; + + void *img_http[IMGCONNS]; + char *img_id[IMGCONNS]; + void *thumb, *data; + int thlen, dlen; + + memset(img_http, 0, sizeof(img_http)); + memset(img_id, 0, sizeof(img_id)); + + memset(search_ids, 0, sizeof(search_ids)); + memset(search_names, 0, sizeof(search_names)); + memset(search_scoreup, 0, sizeof(search_scoreup)); + memset(search_scoredown, 0, sizeof(search_scoredown)); + memset(search_publish, 0, sizeof(search_publish)); + memset(search_owners, 0, sizeof(search_owners)); + memset(search_thumbs, 0, sizeof(search_thumbs)); + memset(search_thsizes, 0, sizeof(search_thsizes)); + + do_open = 0; + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = 65; + ed.y = 13; + ed.w = XRES-200; + ed.nx = 1; + ed.def = "[search terms]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(search_expr); + strcpy(ed.str, search_expr); + + sdl_wheel = 0; + + while(!sdl_poll()) { + uih = 0; + bq = b; + mxq = mx; + myq = my; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + if(mx!=mxq || my!=myq || sdl_wheel || b) + mmt = 0; + else if(mmt 9) { + drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); + drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); + } + + ui_edit_draw(vid_buf, &ed); + + if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) { + if(search_page) { + search_page --; + lasttime = TIMEOUT; + } + sdl_wheel = 0; + uih = 1; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) { + lasttime = TIMEOUT; + search_page ++; + page_count = exp_res; + } + sdl_wheel = 0; + uih = 1; + } + + tp = -1; + if(is_p1) { + drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); + for(gj=0;gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14);gj++) + for(gi=0;giTAG_MAX || !tag_names[pos]) + break; + if(tag_votes[0]) + i = 127+(128*tag_votes[pos])/tag_votes[0]; + else + i = 192; + w = textwidth(tag_names[pos]); + if(w>XRES/GRID_X-5) + w = XRES/GRID_X-5; + gx = (XRES/GRID_X)*gi; + gy = gj*14 + 46; + if(mx>=gx && mx=gy && my XRES/GRID_X-10) { + tmp = malloc(strlen(search_names[pos])+4); + strcpy(tmp, search_names[pos]); + j = textwidthx(tmp, XRES/GRID_X-15); + strcpy(tmp+j, "..."); + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); + free(tmp); + } else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); + j = textwidth(search_owners[pos]); + if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && + my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) { + st = 1; + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); + } else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); + if(search_thumbs[pos]) + render_thumb(search_thumbs[pos], search_thsizes[pos], 1, vid_buf, gx, gy, GRID_S); + own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); + if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) + mp = pos; + if(own) { + if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) { + mp = -1; + dp = pos; + } + } + if(mp==pos && !st) + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); + else + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); + if(own) { + if(dp == pos) + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); + else + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); + } + if(!search_publish[pos]){ + drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); + drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } + if(view_own || svf_admin || svf_mod) { + sprintf(ts+1, "%d", search_votes[pos]); + ts[0] = 0xBB; + for(j=1; ts[j]; j++) + ts[j] = 0xBC; + ts[j-1] = 0xB9; + ts[j] = 0xBA; + ts[j+1] = 0; + w = gx+XRES/GRID_S-2-textwidth(ts); + h = gy+YRES/GRID_S-11; + drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); + for(j=0; ts[j]; j++) + ts[j] -= 14; + drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); + sprintf(ts, "%d", search_votes[pos]); + for(j=0; ts[j]; j++) + ts[j] += 127; + drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); + } + if(search_scoreup[pos]>0||search_scoredown[pos]>0){ + lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); + + if(((YRES/GRID_S+3)/2)>lv){ + ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); + if(lv<8){ + ry = ry/(8-lv); + } + nyu = search_scoreup[pos]*ry; + nyd = search_scoredown[pos]*ry; + } else { + ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); + nyu = search_scoreup[pos]/ry; + nyd = search_scoredown[pos]/ry; + } + + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); + + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); + } + } + + if(mp!=-1 && mmt>=TIMEOUT/5 && !st) { + gi = mp % GRID_X; + gj = mp / GRID_X; + if(is_p1) + gj += GRID_Y-GRID_P; + gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; + gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; + i = w = textwidth(search_names[mp]); + h = YRES/GRID_Z+30; + if(w=XRES-2) gx=XRES-3-w; + if(gy<32) gy=32; + if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; + clearrect(vid_buf, gx-2, gy-3, w+4, h); + drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); + if(search_thumbs[mp]) + render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); + drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); + drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); + } + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(sdl_key==SDLK_RETURN) { + if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) + lasttime = TIMEOUT; + else if(search_ids[0] && !search_ids[1]) { + bq = 0; + b = 1; + mp = 0; + } + } + if(sdl_key==SDLK_ESCAPE) + goto finish; + + if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) { + search_own = !search_own; + lasttime = TIMEOUT; + } + if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) { + search_date = !search_date; + lasttime = TIMEOUT; + } + + if(b && !bq && dp!=-1) + if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) { + execute_delete(vid_buf, search_ids[dp]); + lasttime = TIMEOUT; + if(last) { + free(last); + last = NULL; + } + } + + if(b && !bq && tp!=-1) { + strncpy(ed.str, tag_names[tp], 255); + lasttime = TIMEOUT; + } + + if(b && !bq && mp!=-1 && st) { + sprintf(ed.str, "user:%s", search_owners[mp]); + lasttime = TIMEOUT; + } + + if(do_open==1){ + mp = 0; + } + + if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) { + fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); + info_box(vid_buf, "Loading..."); + + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + data = http_simple_get(uri, &status, &dlen); + free(uri); + + if(status == 200) { + status = parse_save(data, dlen, 1, 0, 0); + switch(status) { + case 1: + error_ui(vid_buf, 0, "Simulation corrupted"); + break; + case 2: + error_ui(vid_buf, 0, "Simulation from a newer version"); + break; + case 3: + error_ui(vid_buf, 0, "Simulation on a too large grid"); + break; + } + if(!status) { + char *tnames[] = {"ID", NULL}; + char *tparts[1]; + int tplens[1]; + if(svf_last) + free(svf_last); + svf_last = data; + svf_lsize = dlen; + + tparts[0] = search_ids[mp]; + tplens[0] = strlen(search_ids[mp]); + data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); + + svf_open = 1; + svf_own = svf_login && !strcmp(search_owners[mp], svf_user); + svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); + + strcpy(svf_id, search_ids[mp]); + strcpy(svf_name, search_names[mp]); + if(status == 200) { + if(data) { + strncpy(svf_tags, data, 255); + svf_tags[255] = 0; + } else + svf_tags[0] = 0; + } else { + svf_tags[0] = 0; + } + + if(svf_login){ + char *names[] = {"ID", NULL}; + char *parts[1]; + parts[0] = search_ids[mp]; + data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); + if(status == 200){ + if(data){ + if(!strcmp(data, "Up")){ + svf_myvote = 1; + } else if(!strcmp(data, "Down")){ + svf_myvote = -1; + } else { + svf_myvote = 0; + } + } else { + svf_myvote = 0; + } + } else { + svf_myvote = 0; + } + } + } else { + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + } + } else + error_ui(vid_buf, status, http_ret_text(status)); + + if(data) + free(data); + goto finish; + } + + if(!last) + search = 1; + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) { + search = 1; + if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) { + search_page = 0; + page_count = 0; + } + free(last); + last = NULL; + } else + search = 0; + + if(search && lasttime>=TIMEOUT) { + lasttime = 0; + last = mystrdup(ed.str); + last_own = search_own; + last_date = search_date; + last_page = search_page; + active = 1; + uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); + if(search_own || svf_admin || svf_mod) + tmp = "&ShowVotes=true"; + else + tmp = ""; + if(!search_own && !search_date && !*last) { + if(search_page) { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); + } else { + exp_res = GRID_X*GRID_P; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); + } + } else { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); + } + strcaturl(uri, last); + if(search_own) { + strcaturl(uri, " user:"); + strcaturl(uri, svf_user); + } + if(search_date) + strcaturl(uri, " sort:date"); + http = http_async_req_start(http, uri, NULL, 0, 1); + if(svf_login){ + http_auth_headers(http, svf_user, svf_pass); + } + http_last_use = time(NULL); + free(uri); + } + + if(active && http_async_req_status(http)) { + http_last_use = time(NULL); + results = http_async_req_stop(http, &status, NULL); + view_own = last_own; + if(status == 200) + page_count = search_results(results, last_own||svf_admin||svf_mod); + is_p1 = (exp_res < GRID_X*GRID_Y); + free(results); + active = 0; + } + + if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) { + http_async_req_close(http); + http = NULL; + } + + for(i=0;i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) { + if(stamp_page) { + stamp_page --; + } + sdl_wheel = 0; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; +} + +void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) +{ + char t[2]; + t[0] = ch; + t[1] = 0; + if(flag) { + fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); + } else { + drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); + } +} + +void render_signs(pixel *vid_buf) +{ + int i, j, x, y, w, h, dx, dy; + for(i=0; i 18) ? -1 : 1; + for(j=0; j<4; j++) { + drawpixel(vid_buf, x, y, 192, 192, 192, 255); + x+=dx; + y+=dy; + } + } +} + +void add_sign_ui(pixel *vid_buf, int mx, int my) +{ + int i, w, h, x, y, nm=0, ju; + int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; + ui_edit ed; + + // check if it is an existing sign + for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) + break; + } + // else look for empty spot + if(i >= MAXSIGNS) { + nm = 1; + for(i=0; i= MAXSIGNS) + return; + + if(nm) { + signs[i].x = mx; + signs[i].y = my; + signs[i].ju = 1; + } + + while(!sdl_poll()) { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = x0+25; + ed.y = y0+25; + ed.w = 158; + ed.nx = 1; + ed.def = "[message]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(signs[i].text); + strcpy(ed.str, signs[i].text); + ju = signs[i].ju; + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed); + drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); + draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); + draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); + draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); + + if(!nm) { + drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); + drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); + drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); + } + + drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) + ju = 0; + if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) + ju = 1; + if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) + ju = 2; + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) { + signs[i].text[0] = 0; + return; + } + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) { + if(!ed.focus) + return; + ed.focus = 0; + } + } + + strcpy(signs[i].text, ed.str); + signs[i].ju = ju; +} + +/*********************************************************** + * CONFIG FILE * + ***********************************************************/ + +char http_proxy[256] = ""; + +void save_string(FILE *f, char *str) +{ + int li = strlen(str); + unsigned char lb[2]; + lb[0] = li; + lb[1] = li >> 8; + fwrite(lb, 2, 1, f); + fwrite(str, li, 1, f); +} + +int load_string(FILE *f, char *str, int max) +{ + int li; + unsigned char lb[2]; + fread(lb, 2, 1, f); + li = lb[0] | (lb[1] << 8); + if(li > max) { + str[0] = 0; + return 1; + } + fread(str, li, 1, f); + str[li] = 0; + return 0; +} + +unsigned char last_major=0, last_minor=0, update_flag=0; + +void save_presets(int do_update) +{ + FILE *f=fopen("powder.def", "wb"); + unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; + unsigned char tmp = sdl_scale; + if(!f) + return; + fwrite(sig, 1, 4, f); + save_string(f, svf_user); + save_string(f, svf_pass); + fwrite(&tmp, 1, 1, f); + tmp = cmode; + fwrite(&tmp, 1, 1, f); + tmp = svf_admin; + fwrite(&tmp, 1, 1, f); + tmp = svf_mod; + fwrite(&tmp, 1, 1, f); + save_string(f, http_proxy); + tmp = SAVE_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = MINOR_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = do_update; + fwrite(&tmp, 1, 1, f); + fclose(f); +} + +void load_presets(void) +{ + FILE *f=fopen("powder.def", "rb"); + unsigned char sig[4], tmp; + if(!f) + return; + fread(sig, 1, 4, f); + if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66){ + if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F){ + if(fseek(f, -3, SEEK_END)){ + remove("powder.def"); + return; + } + if(fread(sig, 1, 3, f) != 3){ + remove("powder.def"); + goto fail; + } + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; + } + fclose(f); + remove("powder.def"); + return; + } + if(load_string(f, svf_user, 63)) + goto fail; + if(load_string(f, svf_pass, 63)) + goto fail; + svf_login = !!svf_user[0]; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + sdl_scale = (tmp == 2) ? 2 : 1; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; +#ifdef HEAT_ENABLE + cmode = tmp%6; +#else + cmode = tmp%5; +#endif + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_admin = tmp; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_mod = tmp; + if(load_string(f, http_proxy, 255)) + goto fail; + if(fread(sig, 1, 3, f) != 3) + goto fail; + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; +fail: + fclose(f); +} + +void dim_copy(pixel *dst, pixel *src) +{ + int i,r,g,b; + for(i=0;i0) + r--; + if(g>0) + g--; + if(b>0) + b--; + dst[i] = PIXRGB(r,g,b); + } +} + +unsigned int fire_alpha[CELL*3][CELL*3]; +void prepare_alpha(void) +{ + int x,y,i,j; + float temp[CELL*3][CELL*3]; + memset(temp, 0, sizeof(temp)); + for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; + fire_g[j][i] = g>4 ? g-4 : 0; + fire_b[j][i] = b>4 ? b-4 : 0; + } +} + +int zoom_en = 0; +int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; +int zoom_wx=0, zoom_wy=0; +void render_zoom(pixel *img) +{ + int x, y, i, j; + pixel pix; + drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); + drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); + clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); + for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) { + xor_pixel(x+i, y+j, vid); + if(j) xor_pixel(x+i, y-j, vid); + if(i) xor_pixel(x-i, y+j, vid); + if(i&&j) xor_pixel(x-i, y-j, vid); + } + } else { + int tc; + c = (r/CELL) * CELL; + x = (x/CELL) * CELL; + y = (y/CELL) * CELL; + + tc = !((c%(CELL*2))==0); + + x -= c/2; + y -= c/2; + + x += tc*(CELL/2); + y += tc*(CELL/2); + + for(i=0; i2){ + pthread_t pth; + pthread_create(&pth,NULL,update_air_th,""); + } else { + update_air(); + } +#else + update_air(); +#endif + } + if(cmode==0 || cmode==1) { + draw_air(vid_buf); + } else if(cmode==2) { + memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); + memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); + } else { + memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + } + update_particles(vid_buf); + + if(cmode==2) { + if(!fire_fc) { + dim_copy(fire_bg, vid_buf); + } else { + memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); + } + fire_fc = (fire_fc+1) % 3; + } + if(cmode==3||cmode==4) + render_fire(vid_buf); + + render_signs(vid_buf); + + //clearrect(vid_buf, 0, YRES, XRES, MENUSIZE); + memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); + //memset(vid_buf+(x+1+(XRES+BARSIZE)*(y+i)), 0, PIXELSIZE*(w-1)); + clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); + + // Old Menu, you will be missed; but not forgotten :( + /* for(i=0; iSAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) + old_version = 1; +#else + if(sscanf(ver_data, "%d.%d", &major, &minor)==2) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) + old_version = 1; +#endif + free(ver_data); + } + http_ver_check = NULL; + } + do_check = (do_check+1) & 15; + } + + if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) + if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")){ + break; + } + //break; + if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) { + if(load_mode) { + free(load_img); + free(load_data); + load_mode = 0; + load_data = NULL; + load_img = NULL; + } + if(it > 50) + it = 50; + if(sdl_key=='k' && stamps[1].name[0]) { + j = stamp_ui(vid_buf); + if(j>=0) + load_data = stamp_load(j, &load_size); + else + load_data = NULL; + } else + load_data = stamp_load(0, &load_size); + if(load_data) { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + if(sdl_key=='s') { + if(it > 50) + it = 50; + save_mode = 1; + } + if(sdl_key=='1'){ + set_cmode(0); + } + if(sdl_key=='2'){ + set_cmode(1); + } + if(sdl_key=='3'){ + set_cmode(2); + } + if(sdl_key=='4'){ + set_cmode(3); + } + if(sdl_key=='5'){ + set_cmode(4); + } + if(sdl_key=='6'){ + set_cmode(5); + } + if(sdl_key==SDLK_SPACE) + sys_pause = !sys_pause; + if(sdl_key=='p') + dump_frame(vid_buf, XRES, YRES, XRES); + if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))){ + if(clipboard_ready==1){ + load_data = malloc(clipboard_length); + memcpy(load_data, clipboard_data, clipboard_length); + load_size = clipboard_length; + if(load_data) { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + } + if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))){ + save_mode = 1; + copy_mode = 2; + } + if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))){ + save_mode = 1; + copy_mode = 1; + } else if(sdl_key=='c') { +#ifdef HEAT_ENABLE + set_cmode((cmode+1) % 6); +#else + set_cmode((cmode+1) % 5); +#endif + if(it > 50) + it = 50; + } +#ifdef INTERNAL + if(sdl_key=='v') + vs = !vs; + if(vs) + dump_frame(vid_buf, XRES, YRES, XRES); +#endif + + if(sdl_wheel) { + if(sdl_zoom_trig==1){ + ZSIZE += sdl_wheel; + if(ZSIZE>32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + sdl_wheel = 0; + } else { + bs += sdl_wheel; + if(bs>16) + bs = 16; + if(bs<0) + bs = 0; + sdl_wheel = 0; + /*if(su >= PT_NUM) { + if(sl < PT_NUM) + su = sl; + if(sr < PT_NUM) + su = sr; + }*/ + } + } + + bq = b; + b = SDL_GetMouseState(&x, &y); + + for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy + && x0 && y0 && x>8)>=NPART || !cr)){ +#ifdef BETA + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); +#else + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); +#endif + } else { + sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + } + } +#endif + mx = x; + my = y; + if(update_flag) { + info_box(vid_buf, "Finalizing update..."); + if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) { + update_cleanup(); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } else { + if(update_finish()) + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + else + info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); + } + update_flag = 0; + } + + if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && + x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) { + tmp = malloc(64); +#ifdef BETA + if(is_beta){ + sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); + } else { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); + } +#else + sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); +#endif + if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) { + free(tmp); + tmp = download_ui(vid_buf, my_uri, &i); + if(tmp) { + save_presets(1); + if(update_start(tmp, i)) { + update_cleanup(); + save_presets(0); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } else + return 0; + } + } else + free(tmp); + } + if(y>=sdl_scale*(YRES+(MENUSIZE-20))) { + if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0){ + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0){ + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0){ + db = (svf_myvote==1) ? 273 : 274; + if(da < 51) + da ++; + } +#ifdef HEAT_ENABLE + else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) { +#else + else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-365))*sdl_scale) && svf_login && svf_open) { +#endif + db = svf_own ? 257 : 256; + if(da < 51) + da ++; +#ifdef HEAT_ENABLE + } else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) { + db = 270; + if(da < 51) + da ++; +#endif + } else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) { + db = 266; + if(da < 51) + da ++; + } else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) { + db = 259; + if(svf_open && svf_own && x<=55*sdl_scale) + db = 258; + if(da < 51) + da ++; + } else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) { + db = svf_login ? 261 : 260; + if(svf_admin) { + db = 268; + } else if(svf_mod) { + db = 271; + } + if(da < 51) + da ++; + } else if(x>=sdl_scale && x<=17*sdl_scale) { + db = 262; + if(da < 51) + da ++; + } else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) { + db = sys_pause ? 264 : 263; + if(da < 51) + da ++; + } else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) { + db = 267; + if(da < 51) + da ++; + } else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) { + db = 265; + if(da < 51) + da ++; + } else if(da > 0) + da --; + } else + if(da > 0) + da --; + + if(!sdl_zoom_trig && zoom_en==1) + zoom_en = 0; + + if(sdl_key==Z_keysym && zoom_en==2) + zoom_en = 1; + + if(load_mode) { + load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); + load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); + if(load_x+load_w>XRES) load_x=XRES-load_w; + if(load_y+load_h>YRES) load_y=YRES-load_h; + if(load_x<0) load_x=0; + if(load_y<0) load_y=0; + if(bq==1 && !b) { + parse_save(load_data, load_size, 0, load_x, load_y); + free(load_data); + free(load_img); + load_mode = 0; + } else if(bq==4 && !b) { + free(load_data); + free(load_img); + load_mode = 0; + } + } else if(save_mode==1) { + save_x = (mx/sdl_scale)/CELL; + save_y = (my/sdl_scale)/CELL; + if(save_x >= XRES/CELL) save_x = XRES/CELL-1; + if(save_y >= YRES/CELL) save_y = YRES/CELL-1; + save_w = 1; + save_h = 1; + if(b==1){ + save_mode = 2; + } else if(b==4){ + save_mode = 0; + copy_mode = 0; + } + } else if(save_mode==2) { + save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; + save_h = (my/sdl_scale+CELL/2)/CELL - save_y; + if(save_w>XRES/CELL) save_w = XRES/CELL; + if(save_h>YRES/CELL) save_h = YRES/CELL; + if(save_w<1) save_w = 1; + if(save_h<1) save_h = 1; + if(!b) { + if(copy_mode==1){ + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + } else if(copy_mode==2){ + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + } else { + stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + save_mode = 0; + } + } + } else if(sdl_zoom_trig && zoom_en<2) { + x /= sdl_scale; + y /= sdl_scale; + x -= ZSIZE/2; + y -= ZSIZE/2; + if(x<0) x=0; + if(y<0) y=0; + if(x>XRES-ZSIZE) x=XRES-ZSIZE; + if(y>YRES-ZSIZE) y=YRES-ZSIZE; + zoom_x = x; + zoom_y = y; + zoom_wx = (x 50) + it = 50; + x /= sdl_scale; + y /= sdl_scale; + if(y>=YRES+(MENUSIZE-20)) { + if(!lb) { + if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0){ + if(execute_vote(vid_buf, svf_id, "Up")){ + svf_myvote = 1; + } + } + if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0){ + if(execute_vote(vid_buf, svf_id, "Down")){ + svf_myvote = -1; + } + } +#ifdef HEAT_ENABLE + if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) +#else + if(x>=219 && x<=(XRES+BARSIZE-(510-365)) && svf_login && svf_open) +#endif + tag_list_ui(vid_buf); +#ifdef HEAT_ENABLE + if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) { + legacy_enable = !legacy_enable; + } +#endif + if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) { + memset(signs, 0, sizeof(signs)); + memset(pv, 0, sizeof(pv)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(fvx, 0, sizeof(fvx)); + memset(fvy, 0, sizeof(fvy)); + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(parts, 0, sizeof(particle)*NPART); + for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) { + login_ui(vid_buf); + if(svf_login) + save_presets(0); + } + if(x>=37 && x<=187 && svf_login) { + if(!svf_open || !svf_own || x>51) { + if(save_name_ui(vid_buf)) + execute_save(vid_buf); + } else + execute_save(vid_buf); + while(!sdl_poll()) + if(!SDL_GetMouseState(&x, &y)) + break; + b = bq = 0; + } + if(x>=1 && x<=17) { + search_ui(vid_buf); + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + } + if(x>=19 && x<=35 && svf_last && svf_open) + parse_save(svf_last, svf_lsize, 1, 0, 0); + if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { +#ifdef HEAT_ENABLE + if(b & SDL_BUTTON_LMASK) + set_cmode((cmode+1) % 6); + if(b & SDL_BUTTON_RMASK) + set_cmode((cmode+5) % 6); +#else + if(b & SDL_BUTTON_LMASK) + set_cmode((cmode+1) % 5); + if(b & SDL_BUTTON_RMASK) + set_cmode((cmode+4) % 5); +#endif + save_presets(0); + } + if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) + sys_pause = !sys_pause; + lb = 0; + } + } else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)){ + c = sl = cr&0xFF; + } else { + //Something + } + } + //create_parts(x, y, bs, SPC_AIR); + lx = x; + ly = y; + lb = 0; + lm = 0; + } else { + create_parts(x, y, bs, c); + lx = x; + ly = y; + lb = b; + lm = 0; + } + } + } + } else { + if(lb && lm) { + x /= sdl_scale; + y /= sdl_scale; + c = (lb&1) ? sl : sr; + su = c; + if(lm == 1) { + if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) + create_line(lx, ly, x, y, bs, c); + } else + create_box(lx, ly, x, y, c); + lm = 0; + } + lb = 0; + } + + if(load_mode) { + draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); + xor_rect(vid_buf, load_x, load_y, load_w, load_h); + } + + if(save_mode) { + xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + da = 51; + db = 269; + } + + if(zoom_en!=1 && !load_mode && !save_mode) + render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); + + if(zoom_en) + render_zoom(vid_buf); + + if(da) + switch(db) { + case 256: + drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); + break; + case 257: + drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); + break; + case 258: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); + break; + case 259: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); + break; + case 260: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); + break; + case 261: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); + break; + case 262: + drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); + break; + case 263: + drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); + break; + case 264: + drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); + break; + case 265: + drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); + break; + case 266: + drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); + break; + case 267: + drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); + break; + case 268: + drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); + break; + case 269: + drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); + break; + case 270: + drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); + break; + case 271: + drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); + break; + case 272: + drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); + break; + case 273: + drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); + break; + case 274: + drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); + break; + case 275: + drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); + break; + default: + drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); + } + if(itc) { + itc--; + drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); + } + if(it) { + it--; + //if(fbi_img) + //draw_image(vid_buf, fbi_img, (XRES-FBI_W)/2, (YRES-FBI_H)/2+25, FBI_W, FBI_H, it>12?64:it*5); + drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); + } + + if(old_version) { + clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); +#ifdef BETA + if(is_beta){ + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); + } else { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); + } +#else + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); +#endif + drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); + } + /*#ifdef MT + pthread_join(pth2,NULL); + #endif*/ + + if(hud_enable){ + currentTime = SDL_GetTicks(); + if(currentTime-past>=16) { + past = SDL_GetTicks(); + FPS++; + } + if(currentTime-pastFPS>=1000) { +#ifdef BETA + sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#else + sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#endif + FPSB = FPS; + FPS = 0; + pastFPS = currentTime; + } +#ifdef HEAT_ENABLE + if(sdl_zoom_trig){ + if(x Date: Fri, 30 Jul 2010 22:48:33 +0100 Subject: Changes to HUD in Zoom mode, NBLE fixes, BTRY added, LCRY added. diff --git a/powder.c b/powder.c index 2328919..b594bd7 100644 --- a/powder.c +++ b/powder.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include //#include @@ -558,7 +558,9 @@ struct menu_section msections[] = { #define PT_ETRD 50 #define PT_NICE 51 #define PT_NBLE 52 -#define PT_NUM 53 +#define PT_BTRY 53 +#define PT_LCRY 54 +#define PT_NUM 55 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -612,13 +614,14 @@ const struct part_type ptypes[] = { {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_OTHER, R_TEMP+0.0f, 150, "Sand, Heavy particles. Meltable."}, {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_OTHER, R_TEMP+0.0f, 150, "Solid. Meltable. Shatters under pressure"}, {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_OTHER, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable."}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_OTHER, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f, 115, "Plasma, extremely hot."}, {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_OTHER, -250.0f, 46, "Nitrogen Ice."}, {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, - + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Generates Electricity."}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, }; #ifdef HEAT_ENABLE @@ -681,7 +684,8 @@ const struct part_state pstates[] = { /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, -209.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - + /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2000.0f}, + /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; #endif static const unsigned char can_move[PT_NUM][PT_NUM] = { @@ -689,63 +693,65 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = { /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ - /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N */ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B */ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L */ - /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* PLSM */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* ETRD */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* NICE */ {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* NBLE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L */ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C */ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r */ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y */ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* W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,0,0,0}, + /* BTRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* LCRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, }; #define FLAG_STAGNANT 1 @@ -1143,15 +1149,16 @@ void update_particles_i(pixel *vid, int start, int inc){ goto justdraw; if(parts[i].life&&t!=PT_ACID&&t!=PT_WOOD&&t!=PT_NBLE) { - parts[i].life--; - if(parts[i].life<=0 && t!=PT_WIRE && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_HSCN && t!=PT_CSCN && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD) { + if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) + parts[i].life--; + if(parts[i].life<=0 && t!=PT_WIRE && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_HSCN && t!=PT_CSCN && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY) { kill_part(i); continue; } if(parts[i].life<=0 && t==PT_SPRK) { t = parts[i].ctype; #ifdef HEAT_ENABLE - if(t!=PT_WIRE&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM) + if(t!=PT_WIRE&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM&&t!=PT_BTRY&&t!=PT_NBLE) parts[i].temp = R_TEMP; #endif if(!t) @@ -1746,8 +1753,7 @@ void update_particles_i(pixel *vid, int start, int inc){ if((r&0xFF)==PT_PLNT && 5>(rand()%100)) parts[r>>8].type = PT_WOOD; } - } - else if(t==PT_PHOT){ + } else if(t==PT_PHOT){ rt = 3 + (int)pv[y/CELL][x/CELL]; for(nx=0; nx<1; nx++) for(ny=0; ny<1; ny++) @@ -1760,13 +1766,46 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[i].vx *= 0.995; parts[i].vy *= 0.995; } - // } else if(((r&0xFF)!=PT_PHOT&&(r&0xFF)!=PT_NONE&&(r&0xFF)!=PT_CLNE)) { - // parts[i].life = 0; - // parts[i].type = PT_NONE; - // }// else if((r&0xFF)!=PT_PLEX){ - // parts[i].life = 4; - // parts[i].type = PT_FIRE - //} + } + } else if(t==PT_LCRY){ + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK){ + if(parts[r>>8].ctype==PT_PSCN) { + parts[i].life = 10; + } else if(parts[r>>8].ctype==PT_NSCN) { + parts[i].life = 9; + } + } + if(rt==PT_LCRY){ + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0){ + parts[i].life = 9; + } else if(parts[i].life==0&&parts[r>>8].life==10){ + parts[i].life = 10; + } + } + } + } else if(t==PT_BTRY){ + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0) { + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + parts[r>>8].type = PT_SPRK; + } } } if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) { @@ -1886,7 +1925,6 @@ void update_particles_i(pixel *vid, int start, int inc){ } } #endif - //Bitches now know about my semi-conductor :( if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN)){ @@ -1937,19 +1975,15 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[r>>8].ctype = rt; } } - if(t==PT_SPRK&&parts[i].ctype==PT_NBLE) - { - parts[i].temp = 3500; - } - if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) - { + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) + { parts[i].life = rand()%150+50; parts[i].type = PT_PLSM; parts[i].ctype = PT_NBLE; parts[i].temp = 3500; pv[y/CELL][x/CELL] += 1; - } -} + } + } killed: if(parts[i].type == PT_NONE) continue; @@ -2201,7 +2235,32 @@ void update_particles_i(pixel *vid, int start, int inc){ blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } else if(t==PT_PLSM) { + } else if(t==PT_LCRY) { + if(cmode == 3||cmode==4) { + //cr = R/8; + //cg = G/8; + //cb = B/8; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); + //x = nx/CELL; + //y = ny/CELL; + //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } else { + cr = 0x50+(parts[i].life*10); + cg = 0x50+(parts[i].life*10); + cb = 0x50+(parts[i].life*10); + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + }else if(t==PT_PLSM) { float ttemp = parts[i].life; int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); uint8 R = plasma_data[caddress]; @@ -8479,7 +8538,7 @@ int main(int argc, char *argv[]) pastFPS = currentTime; } #ifdef HEAT_ENABLE - if(sdl_zoom_trig){ + if(sdl_zoom_trig||zoom_en){ if(x Date: Sat, 31 Jul 2010 12:05:51 +0100 Subject: Menu sections enhancements, new glyphs for new sections diff --git a/font.h b/font.h index 1eb1b54..68ac684 100755 --- a/font.h +++ b/font.h @@ -20,8 +20,8 @@ */ #define FONT_H 10 char font_data[] = { - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc7, 0x31, 0x0c, 0x02, 0x70, 0x04, 0x00, 0x00, 0x05, 0xcc, 0x74, 0x23, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x19, 0xcc, 0xe0, 0x3f, 0xcc, 0xf0, 0x2f, 0xcc, 0x90, 0x09, 0x00, 0x00, 0x00, 0x06, 0x30, 0xd0, 0x3f, 0x33, 0xe1, 0x07, 0xf4, 0x12, 0x33, 0xff, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x2d, 0xce, 0xcc, 0xe1, 0x1d, 0xc0, 0x03, 0x74, 0x4b, 0x33, 0xb3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7d, 0x30, 0x0c, 0x13, 0xd0, 0x32, 0xb3, 0x33, 0x1c, 0x7d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x4c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x34, 0x1d, 0x07, 0x03, 0x07, 0x1d, 0x34, 0x00, 0x00, 0x00, 0x04, 0x07, 0x1d, 0x34, 0x30, 0x34, 0x1d, 0x07, 0x00, 0x00, 0x00, 0x06, 0x44, 0xd0, 0x1c, 0x64, 0xf0, 0x3f, 0x64, 0xd0, 0x1c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x02, 0x30, 0xe0, 0x2f, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x06, 0x80, 0x02, 0x0c, 0xa0, 0x00, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, 0xe0, 0x39, 0x07, 0x33, 0x32, 0x03, 0xb3, 0x38, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x30, 0xf0, 0x60, 0x03, 0x0c, 0x30, 0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x41, 0x03, 0x0a, 0x2c, 0x70, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0x71, 0x34, 0x01, 0x03, 0x1e, 0x00, 0x33, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xc0, 0x03, 0x37, 0x1c, 0x73, 0x34, 0xbf, 0x03, 0x30, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x00, 0x57, 0xe0, 0x2f, 0x00, 0x13, 0x30, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd3, 0x00, 0x07, 0xf0, 0x1f, 0x03, 0x33, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x07, 0x34, 0x80, 0x03, 0x0e, 0x38, 0xd0, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xd3, 0x1f, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xc3, 0x3f, 0x40, 0x23, 0x30, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x70, 0x04, 0x40, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc0, 0xc3, 0x0b, 0x1b, 0xc0, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x0f, 0x90, 0x83, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfd, 0x71, 0x30, 0x81, 0x03, 0x0e, 0x34, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0x0f, 0x1d, 0x30, 0xe7, 0x37, 0x73, 0x1c, 0xe3, 0x2f, 0x07, 0x00, 0xfd, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x74, 0xd0, 0x1d, 0x47, 0x33, 0x30, 0xff, 0x33, 0x30, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xbf, 0x30, 0x38, 0x43, 0xf3, 0x1f, 0x43, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x31, 0x00, 0x03, 0x70, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x33, 0x30, 0x03, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x32, 0x00, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x10, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x10, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x30, 0x3e, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x47, 0x33, 0x30, 0x03, 0xf3, 0x3f, 0x03, 0x33, 0x30, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x06, 0xd0, 0x01, 0x0c, 0xc0, 0x00, 0x0c, 0xc0, 0x10, 0x0d, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0xc3, 0x34, 0x70, 0x03, 0xbc, 0x00, 0xb3, 0xc0, 0xb0, 0x70, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x30, 0x10, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x1f, 0x3d, 0x7b, 0x3b, 0xe3, 0x32, 0x83, 0x30, 0x03, 0x30, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0xcd, 0x03, 0x73, 0xc3, 0x8c, 0x32, 0xc3, 0xcd, 0xc0, 0x33, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xc7, 0x71, 0xd0, 0x0c, 0x30, 0x03, 0xcd, 0xd1, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x73, 0x34, 0xff, 0x31, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xd3, 0x71, 0xd0, 0x0c, 0x30, 0xc3, 0xcd, 0xd1, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x31, 0x34, 0x03, 0xf3, 0x0f, 0xd7, 0x30, 0x34, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x31, 0x07, 0xd0, 0x0f, 0x90, 0x23, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x13, 0x13, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xcc, 0x00, 0x33, 0xc0, 0x0c, 0x30, 0x03, 0xcd, 0xd2, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x33, 0x30, 0x03, 0xb3, 0x38, 0xcd, 0xc1, 0x0d, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x43, 0x30, 0xc7, 0x34, 0xcd, 0x1c, 0xed, 0x1e, 0x2c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0x4c, 0xc3, 0x81, 0x3b, 0xd0, 0x03, 0xdc, 0x42, 0xc3, 0x31, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0xb3, 0x38, 0xdc, 0x40, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xd0, 0x02, 0x2c, 0xc0, 0x02, 0x2d, 0xc0, 0x06, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x2f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x30, 0x80, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x37, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x47, 0x30, 0xfc, 0x0c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x07, 0x0c, 0xf0, 0xc7, 0x35, 0xc3, 0x0c, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc3, 0x25, 0x03, 0x4c, 0xd2, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd0, 0x00, 0x83, 0x8f, 0x33, 0xc3, 0x1c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xbf, 0x0c, 0xd0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3d, 0x07, 0x03, 0x2f, 0x03, 0x03, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xcb, 0x32, 0xc3, 0xf4, 0x03, 0x4c, 0x30, 0x7e, 0x00, 0x00, 0x05, 0x03, 0x0c, 0xf0, 0xc7, 0x39, 0xc3, 0x0c, 0x73, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x1c, 0x00, 0x0d, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x30, 0x00, 0x34, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x05, 0x03, 0x0c, 0x31, 0xce, 0x0e, 0x1f, 0xcc, 0x31, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x47, 0x3d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x9b, 0x71, 0x37, 0x33, 0x33, 0x32, 0x43, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x0c, 0x33, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x31, 0xc3, 0x4c, 0xd3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x4c, 0xf3, 0xc7, 0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xdf, 0x31, 0xc3, 0x4c, 0xd3, 0x0f, 0x30, 0xc0, 0x00, 0x05, 0x03, 0x00, 0x30, 0x7f, 0xc7, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xc7, 0x10, 0x3c, 0x04, 0xf3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x1c, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x70, 0xdc, 0x30, 0xc3, 0x4c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xd3, 0xdc, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x33, 0x32, 0x33, 0x73, 0x37, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcd, 0x32, 0x7d, 0x8c, 0x73, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xc7, 0x74, 0x43, 0x07, 0x0c, 0x1f, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x4f, 0x2c, 0x2c, 0x2c, 0xf1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x04, 0x38, 0x0c, 0x0c, 0x03, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x02, 0x32, 0x33, 0x33, 0x13, 0x00, 0x04, 0x0b, 0x0c, 0x0c, 0x30, 0x0c, 0x0c, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x72, 0x37, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, 0x07, 0xff, 0x1f, 0xff, 0x7f, 0xff, 0x1b, 0xbf, 0x01, 0x1b, 0x00, 0x0c, 0x00, 0x40, 0xff, 0x00, 0x00, 0xf8, 0xf0, 0x3f, 0xee, 0x2c, 0x30, 0xcb, 0x0b, 0x30, 0x42, 0xc3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xf3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xff, 0x3f, 0x00, 0x0c, 0xc2, 0x00, 0x00, 0xcb, 0x00, 0x00, 0xee, 0xc0, 0xff, 0xf8, 0xb0, 0xc0, 0xff, 0x2c, 0xc0, 0x00, 0x0c, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xcc, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0x0d, 0x00, 0x70, 0x00, 0x00, 0xf3, 0xff, 0xd3, 0x03, 0xe0, 0x3c, 0x3f, 0x38, 0x03, 0xd0, 0x33, 0xff, 0x38, 0x03, 0xe0, 0xf0, 0xff, 0x03, 0x0c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x8b, 0xf7, 0x0c, 0x13, 0x9f, 0x3b, 0x37, 0x00, 0xc0, 0x23, 0xff, 0xff, 0x8b, 0x03, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0x03, 0x2c, 0x0d, 0x00, 0x37, 0x00, 0xc0, 0xf3, 0xff, 0x3c, 0xff, 0xcf, 0x03, 0x00, 0xdc, 0x00, 0x70, 0x38, 0xc0, 0x02, 0xfd, 0x07, 0x0a, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xf0, 0xff, 0xc0, 0xff, 0x3f, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0xfc, 0xff, 0x03, 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0x80, 0xff, 0x2f, 0xfd, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0xf8, 0xff, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x01, 0x00, 0x02, 0x00, 0xc8, 0x07, 0x10, 0xc3, 0x00, 0x31, 0x0d, 0x00, 0xfd, 0x01, 0x00, 0x74, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x0a, 0x40, 0x05, 0x80, 0xff, 0x8b, 0x1e, 0xd0, 0x2e, 0x00, 0xf0, 0x00, 0xe0, 0xff, 0x0b, 0x00, 0x0f, 0x00, 0xb8, 0x03, 0xb0, 0xe2, 0xff, 0x02, 0x50, 0x01, 0x08, 0xff, 0x07, 0x03, 0x1e, 0x03, 0x73, 0x03, 0xef, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x2f, 0xe0, 0x1b, 0x0c, 0x1d, 0x00, 0xff, 0x03, 0xbe, 0xf0, 0xc1, 0x01, 0xad, 0x34, 0xc0, 0x36, 0x0b, 0x30, 0xdc, 0xe4, 0x07, 0xfd, 0x1b, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0xa0, 0xaa, 0x00, 0xa8, 0xc2, 0x0f, 0x2a, 0xff, 0x03, 0xca, 0x3f, 0x80, 0xfc, 0x0f, 0x20, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x07, 0xaa, 0xea, 0x1f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xaa, 0xea, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x03, 0x00, 0xd0, 0x03, 0x00, 0xf4, 0xab, 0xaa, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xf4, 0xab, 0xaa, 0xd0, 0x03, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x09, 0xfe, 0xff, 0xe3, 0xff, 0x0f, 0xaa, 0x3e, 0x0a, 0xf8, 0x2e, 0xe0, 0xbf, 0x80, 0xff, 0xaa, 0xfe, 0xff, 0xe2, 0xff, 0x02, 0x02, 0x00, 0x00, 0x09, 0x00, 0x80, 0x04, 0xd0, 0xe2, 0xff, 0x02, 0x00, 0x00, 0xff, 0x6f, 0x00, 0x40, 0xe6, 0xaf, 0x50, 0x00, 0x09, 0x00, 0x20, 0x00, 0x64, 0x00, 0x09, 0xe0, 0x3f, 0x70, 0x60, 0x63, 0xc0, 0xe4, 0x80, 0xc2, 0x03, 0x07, 0x0f, 0x1e, 0x6c, 0xff, 0x27, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x09, 0x44, 0x44, 0x00, 0x12, 0x41, 0x88, 0x04, 0x21, 0x21, 0x84, 0x48, 0x20, 0x23, 0xc2, 0xcc, 0x08, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x1d, 0x00, 0x78, 0x00, 0xb4, 0x07, 0xf0, 0x2f, 0xc0, 0xfb, 0x00, 0xbe, 0x02, 0xf4, 0x07, 0xfd, 0xff, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0x00, 0x19, 0x00, 0xa8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf0, 0xdc, 0xcb, 0x03, 0x00, 0xff, 0xff, 0x4f, 0x07, 0x40, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0xff, 0x3f, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0x07, 0x00, 0xbd, 0x02, 0xe8, 0xb3, 0xe0, 0x3c, 0xac, 0xc3, 0x03, 0x0f, 0x3c, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x0b, 0xc0, 0xc8, 0xc0, 0x91, 0x1b, 0xcd, 0x36, 0xe7, 0x00, 0x47, 0x03, 0xa7, 0x80, 0x36, 0xfd, 0xff, 0xc1, 0x9b, 0xf9, 0xb8, 0xb8, 0xb8, 0xb7, 0x99, 0xf7, 0xff, 0xff, 0x0f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x03, 0x00, 0xfc, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0xff, 0x3f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0xcf, 0xff, 0xff, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1f, 0xcb, 0x30, 0xc3, 0x3f, 0xc7, 0x00, 0x7e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0xc3, 0xfc, 0x33, 0x0c, 0x24, 0xc3, 0xc0, 0x31, 0x0c, 0x06, 0xc3, 0x30, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0xff, 0x3f, 0x30, 0x00, 0x03, 0xc3, 0x30, 0x30, 0x3f, 0xff, 0xff, 0x3f, 0x3c, 0x00, 0xff, 0xff, 0xff, 0x0c, 0x0c, 0xc3, 0xc0, 0x00, 0x0c, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x3c, 0x00, 0xc0, 0x03, 0xf0, 0x3f, 0x00, 0xff, 0x03, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xb8, 0xec, 0x9b, 0xf9, 0xbf, 0xf8, 0xbf, 0x99, 0xef, 0xb8, 0x2c, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x87, 0x87, 0xc3, 0x30, 0x0c, 0xe3, 0xde, 0x01, 0x03, 0x74, 0xbb, 0x0c, 0xc3, 0x30, 0x2c, 0x2d, 0x0d, 0x05, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x34, 0xc3, 0x0c, 0x73, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x39, 0xc0, 0x00, 0x43, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0x60, 0x60, 0x60, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0xb8, 0x00, 0x23, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x36, 0xc6, 0xfc, 0x03, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xcb, 0x00, 0x7f, 0x40, 0x13, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xcb, 0x10, 0x2f, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x0f, 0x30, 0x60, 0x60, 0xc0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0x7d, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xc6, 0xe0, 0x03, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x03, 0xc0, 0xf0, 0x3c, 0xcf, 0xf3, 0x3c, 0x03, 0x00, 0x03, 0x00, 0xcc, 0xf3, 0x3c, 0xcf, 0xf3, 0x30, 0x00, 0x05, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x30, 0xc0, 0x0f, 0x30, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0xd0, 0x7f, 0x40, 0xff, 0x1f, 0xfc, 0xff, 0x43, 0xff, 0x1f, 0x40, 0x15, 0x00, 0x00, 0x00, 0x0a, 0xe4, 0x06, 0x90, 0x91, 0x01, 0x06, 0x24, 0x30, 0x90, 0x1b, 0x46, 0x6e, 0x96, 0xb9, 0x91, 0xe4, 0x06, 0x0c, 0x18, 0x90, 0x40, 0x46, 0x06, 0x90, 0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x02, 0xc2, 0xab, 0xaa, 0x3e, 0x20, 0xe0, 0xab, 0xaa, 0x3e, 0x02, 0xc2, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x02, 0xc0, 0x30, 0x00, 0x0c, 0x03, 0xf0, 0xff, 0x00, 0xfe, 0x0b, 0xd0, 0x7f, 0x00, 0xa4, 0x01, 0x00, 0x0a, 0x00, 0xa0, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x81, 0x24, 0x10, 0x85, 0x00, 0x20, 0x66, 0x40, 0x15, 0x45, 0x62, 0x90, 0x4d, 0xd0, 0xf1, 0x23, 0x01, 0xfd, 0x41, 0x41, 0x07, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x00, 0xf8, 0x02, 0xd0, 0x7f, 0x00, 0xfe, 0x0b, 0xf0, 0xff, 0x00, 0xff, 0x0f, 0xd0, 0x7f, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0xd4, 0x01, 0xd0, 0x06, 0x40, 0x7f, 0x00, 0xfd, 0x01, 0xf4, 0x07, 0xd0, 0x1f, 0x00, 0x7f, 0x00, 0xd0, 0x01, 0x00, 0x0a, 0x40, 0x15, 0x00, 0xfe, 0x0b, 0x88, 0x2f, 0x52, 0xf0, 0x50, 0x01, 0x0a, 0xd4, 0xaf, 0x7f, 0xfd, 0xf5, 0xc7, 0x0b, 0x3e, 0x70, 0xd0, 0x00, 0xa4, 0x01, 0x0a, 0x80, 0x2f, 0x80, 0x5f, 0x2f, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x01, 0x34, 0x34, 0xc0, 0x01, 0x07, 0x0d, 0xd0, 0x75, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xf4, 0x01, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xe0, 0xef, 0x00, 0xbb, 0x0b, 0xa0, 0xaa, 0x00, 0xaa, 0x0a, 0x80, 0x19, 0x00, 0x64, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x2d, 0x80, 0xe7, 0x0b, 0xbe, 0xf8, 0xfa, 0x02, 0xfe, 0x0b, 0x80, 0x2f, 0x00, 0x50, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xaf, 0x2f, 0xbe, 0xe0, 0xdb, 0x02, 0x78, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0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c0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc7, 0x31, 0x0c, 0x02, 0x70, 0x04, 0x00, 0x00, 0x05, 0xcc, 0x74, 0x23, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x19, 0xcc, 0xe0, 0x3f, 0xcc, 0xf0, 0x2f, 0xcc, 0x90, 0x09, 0x00, 0x00, 0x00, 0x06, 0x30, 0xd0, 0x3f, 0x33, 0xe1, 0x07, 0xf4, 0x12, 0x33, 0xff, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x2d, 0xce, 0xcc, 0xe1, 0x1d, 0xc0, 0x03, 0x74, 0x4b, 0x33, 0xb3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7d, 0x30, 0x0c, 0x13, 0xd0, 0x32, 0xb3, 0x33, 0x1c, 0x7d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x4c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x34, 0x1d, 0x07, 0x03, 0x07, 0x1d, 0x34, 0x00, 0x00, 0x00, 0x04, 0x07, 0x1d, 0x34, 0x30, 0x34, 0x1d, 0x07, 0x00, 0x00, 0x00, 0x06, 0x44, 0xd0, 0x1c, 0x64, 0xf0, 0x3f, 0x64, 0xd0, 0x1c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x02, 0x30, 0xe0, 0x2f, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x06, 0x80, 0x02, 0x0c, 0xa0, 0x00, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, 0xe0, 0x39, 0x07, 0x33, 0x32, 0x03, 0xb3, 0x38, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x30, 0xf0, 0x60, 0x03, 0x0c, 0x30, 0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x41, 0x03, 0x0a, 0x2c, 0x70, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0x71, 0x34, 0x01, 0x03, 0x1e, 0x00, 0x33, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xc0, 0x03, 0x37, 0x1c, 0x73, 0x34, 0xbf, 0x03, 0x30, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x00, 0x57, 0xe0, 0x2f, 0x00, 0x13, 0x30, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd3, 0x00, 0x07, 0xf0, 0x1f, 0x03, 0x33, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x07, 0x34, 0x80, 0x03, 0x0e, 0x38, 0xd0, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xd3, 0x1f, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xc3, 0x3f, 0x40, 0x23, 0x30, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x70, 0x04, 0x40, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc0, 0xc3, 0x0b, 0x1b, 0xc0, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x0f, 0x90, 0x83, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfd, 0x71, 0x30, 0x81, 0x03, 0x0e, 0x34, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0x0f, 0x1d, 0x30, 0xe7, 0x37, 0x73, 0x1c, 0xe3, 0x2f, 0x07, 0x00, 0xfd, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x74, 0xd0, 0x1d, 0x47, 0x33, 0x30, 0xff, 0x33, 0x30, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xbf, 0x30, 0x38, 0x43, 0xf3, 0x1f, 0x43, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x31, 0x00, 0x03, 0x70, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x33, 0x30, 0x03, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x32, 0x00, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x10, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x10, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x30, 0x3e, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x47, 0x33, 0x30, 0x03, 0xf3, 0x3f, 0x03, 0x33, 0x30, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x06, 0xd0, 0x01, 0x0c, 0xc0, 0x00, 0x0c, 0xc0, 0x10, 0x0d, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0xc3, 0x34, 0x70, 0x03, 0xbc, 0x00, 0xb3, 0xc0, 0xb0, 0x70, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x30, 0x10, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x1f, 0x3d, 0x7b, 0x3b, 0xe3, 0x32, 0x83, 0x30, 0x03, 0x30, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0xcd, 0x03, 0x73, 0xc3, 0x8c, 0x32, 0xc3, 0xcd, 0xc0, 0x33, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xc7, 0x71, 0xd0, 0x0c, 0x30, 0x03, 0xcd, 0xd1, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x73, 0x34, 0xff, 0x31, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xd3, 0x71, 0xd0, 0x0c, 0x30, 0xc3, 0xcd, 0xd1, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x31, 0x34, 0x03, 0xf3, 0x0f, 0xd7, 0x30, 0x34, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x31, 0x07, 0xd0, 0x0f, 0x90, 0x23, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x13, 0x13, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xcc, 0x00, 0x33, 0xc0, 0x0c, 0x30, 0x03, 0xcd, 0xd2, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x33, 0x30, 0x03, 0xb3, 0x38, 0xcd, 0xc1, 0x0d, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x43, 0x30, 0xc7, 0x34, 0xcd, 0x1c, 0xed, 0x1e, 0x2c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0x4c, 0xc3, 0x81, 0x3b, 0xd0, 0x03, 0xdc, 0x42, 0xc3, 0x31, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0xb3, 0x38, 0xdc, 0x40, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xd0, 0x02, 0x2c, 0xc0, 0x02, 0x2d, 0xc0, 0x06, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x2f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x30, 0x80, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x37, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x47, 0x30, 0xfc, 0x0c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x07, 0x0c, 0xf0, 0xc7, 0x35, 0xc3, 0x0c, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc3, 0x25, 0x03, 0x4c, 0xd2, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd0, 0x00, 0x83, 0x8f, 0x33, 0xc3, 0x1c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xbf, 0x0c, 0xd0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3d, 0x07, 0x03, 0x2f, 0x03, 0x03, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xcb, 0x32, 0xc3, 0xf4, 0x03, 0x4c, 0x30, 0x7e, 0x00, 0x00, 0x05, 0x03, 0x0c, 0xf0, 0xc7, 0x39, 0xc3, 0x0c, 0x73, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x1c, 0x00, 0x0d, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x30, 0x00, 0x34, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x05, 0x03, 0x0c, 0x31, 0xce, 0x0e, 0x1f, 0xcc, 0x31, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x47, 0x3d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x9b, 0x71, 0x37, 0x33, 0x33, 0x32, 0x43, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x0c, 0x33, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x31, 0xc3, 0x4c, 0xd3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x4c, 0xf3, 0xc7, 0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xdf, 0x31, 0xc3, 0x4c, 0xd3, 0x0f, 0x30, 0xc0, 0x00, 0x05, 0x03, 0x00, 0x30, 0x7f, 0xc7, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xc7, 0x10, 0x3c, 0x04, 0xf3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x1c, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x70, 0xdc, 0x30, 0xc3, 0x4c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xd3, 0xdc, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x33, 0x32, 0x33, 0x73, 0x37, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcd, 0x32, 0x7d, 0x8c, 0x73, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xc7, 0x74, 0x43, 0x07, 0x0c, 0x1f, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x4f, 0x2c, 0x2c, 0x2c, 0xf1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x04, 0x38, 0x0c, 0x0c, 0x03, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x02, 0x32, 0x33, 0x33, 0x13, 0x00, 0x04, 0x0b, 0x0c, 0x0c, 0x30, 0x0c, 0x0c, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x72, 0x37, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, 0x07, 0xff, 0x1f, 0xff, 0x7f, 0xff, 0x1b, 0xbf, 0x01, 0x1b, 0x00, 0x0c, 0x00, 0x40, 0xff, 0x00, 0x00, 0xf8, 0xf0, 0x3f, 0xee, 0x2c, 0x30, 0xcb, 0x0b, 0x30, 0x42, 0xc3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xf3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xff, 0x3f, 0x00, 0x0c, 0xc2, 0x00, 0x00, 0xcb, 0x00, 0x00, 0xee, 0xc0, 0xff, 0xf8, 0xb0, 0xc0, 0xff, 0x2c, 0xc0, 0x00, 0x0c, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xcc, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0x0d, 0x00, 0x70, 0x00, 0x00, 0xf3, 0xff, 0xd3, 0x03, 0xe0, 0x3c, 0x3f, 0x38, 0x03, 0xd0, 0x33, 0xff, 0x38, 0x03, 0xe0, 0xf0, 0xff, 0x03, 0x0c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x8b, 0xf7, 0x0c, 0x13, 0x9f, 0x3b, 0x37, 0x00, 0xc0, 0x23, 0xff, 0xff, 0x8b, 0x03, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0x03, 0x2c, 0x0d, 0x00, 0x37, 0x00, 0xc0, 0xf3, 0xff, 0x3c, 0xff, 0xcf, 0x03, 0x00, 0xdc, 0x00, 0x70, 0x38, 0xc0, 0x02, 0xfd, 0x07, 0x0a, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xf0, 0xff, 0xc0, 0xff, 0x3f, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0xfc, 0xff, 0x03, 0xff, 0x0f, 0xc0, 0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fd, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0xf8, 0xff, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x01, 0x00, 0x02, 0x00, 0xc8, 0x07, 0x10, 0xc3, 0x00, 0x31, 0x0d, 0x00, 0xfd, 0x01, 0x00, 0x74, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x0a, 0x40, 0x05, 0x80, 0xff, 0x8b, 0x1e, 0xd0, 0x2e, 0x00, 0xf0, 0x00, 0xe0, 0xff, 0x0b, 0x00, 0x0f, 0x00, 0xb8, 0x03, 0xb0, 0xe2, 0xff, 0x02, 0x50, 0x01, 0x08, 0xff, 0x07, 0x03, 0x1e, 0x03, 0x73, 0x03, 0xef, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x2f, 0xe0, 0x1b, 0x0c, 0x1d, 0x00, 0xff, 0x03, 0xbe, 0xf0, 0xc1, 0x01, 0xad, 0x34, 0xc0, 0x36, 0x0b, 0x30, 0xdc, 0xe4, 0x07, 0xfd, 0x1b, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0xa0, 0xaa, 0x00, 0xa8, 0xc2, 0x0f, 0x2a, 0xff, 0x03, 0xca, 0x3f, 0x80, 0xfc, 0x0f, 0x20, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x07, 0xaa, 0xea, 0x1f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xaa, 0xea, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x03, 0x00, 0xd0, 0x03, 0x00, 0xf4, 0xab, 0xaa, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xf4, 0xab, 0xaa, 0xd0, 0x03, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x09, 0xfe, 0xff, 0xe3, 0xff, 0x0f, 0xaa, 0x3e, 0x0a, 0xf8, 0x2e, 0xe0, 0xbf, 0x80, 0xff, 0xaa, 0xfe, 0xff, 0xe2, 0xff, 0x02, 0x02, 0x00, 0x00, 0x09, 0x00, 0x80, 0x04, 0xd0, 0xe2, 0xff, 0x02, 0x00, 0x00, 0xff, 0x6f, 0x00, 0x40, 0xe6, 0xaf, 0x50, 0x00, 0x09, 0x00, 0x20, 0x00, 0x64, 0x00, 0x09, 0xe0, 0x3f, 0x70, 0x60, 0x63, 0xc0, 0xe4, 0x80, 0xc2, 0x03, 0x07, 0x0f, 0x1e, 0x6c, 0xff, 0x27, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x09, 0x44, 0x44, 0x00, 0x12, 0x41, 0x88, 0x04, 0x21, 0x21, 0x84, 0x48, 0x20, 0x23, 0xc2, 0xcc, 0x08, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x1d, 0x00, 0x78, 0x00, 0xb4, 0x07, 0xf0, 0x2f, 0xc0, 0xfb, 0x00, 0xbe, 0x02, 0xf4, 0x07, 0xfd, 0xff, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0x00, 0x19, 0x00, 0xa8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf0, 0xdc, 0xcb, 0x03, 0x00, 0xff, 0xff, 0x4f, 0x07, 0x40, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0xff, 0x3f, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0x07, 0x00, 0xbd, 0x02, 0xe8, 0xb3, 0xe0, 0x3c, 0xac, 0xc3, 0x03, 0x0f, 0x3c, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x0b, 0xc0, 0xc8, 0xc0, 0x91, 0x1b, 0xcd, 0x36, 0xe7, 0x00, 0x47, 0x03, 0xa7, 0x80, 0x36, 0xfd, 0xff, 0xc1, 0x9b, 0xf9, 0xb8, 0xb8, 0xb8, 0xb7, 0x99, 0xf7, 0xff, 0xff, 0x0f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x03, 0x00, 0xfc, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0xff, 0x3f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0xcf, 0xff, 0xff, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1f, 0xcb, 0x30, 0xc3, 0x3f, 0xc7, 0x00, 0x7e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0xc3, 0xfc, 0x33, 0x0c, 0x24, 0xc3, 0xc0, 0x31, 0x0c, 0x06, 0xc3, 0x30, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0xff, 0x3f, 0x30, 0x00, 0x03, 0xc3, 0x30, 0x30, 0x3f, 0xff, 0xff, 0x3f, 0x3c, 0x00, 0xff, 0xff, 0xff, 0x0c, 0x0c, 0xc3, 0xc0, 0x00, 0x0c, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x3c, 0x00, 0xc0, 0x03, 0xf0, 0x3f, 0x00, 0xff, 0x03, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xb8, 0xec, 0x9b, 0xf9, 0xbf, 0xf8, 0xbf, 0x99, 0xef, 0xb8, 0x2c, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x87, 0x87, 0xc3, 0x30, 0x0c, 0xe3, 0xde, 0x01, 0x03, 0x74, 0xbb, 0x0c, 0xc3, 0x30, 0x2c, 0x2d, 0x0d, 0x05, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x34, 0xc3, 0x0c, 0x73, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x39, 0xc0, 0x00, 0x43, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0x60, 0x60, 0x60, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0xb8, 0x00, 0x23, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x36, 0xc6, 0xfc, 0x03, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xcb, 0x00, 0x7f, 0x40, 0x13, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xcb, 0x10, 0x2f, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x0f, 0x30, 0x60, 0x60, 0xc0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0x7d, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xc6, 0xe0, 0x03, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x03, 0xc0, 0xf0, 0x3c, 0xcf, 0xf3, 0x3c, 0x03, 0x00, 0x03, 0x00, 0xcc, 0xf3, 0x3c, 0xcf, 0xf3, 0x30, 0x00, 0x05, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x30, 0xc0, 0x0f, 0x30, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0xd0, 0x7f, 0x40, 0xff, 0x1f, 0xfc, 0xff, 0x43, 0xff, 0x1f, 0x40, 0x15, 0x00, 0x00, 0x00, 0x0a, 0xe4, 0x06, 0x90, 0x91, 0x01, 0x06, 0x24, 0x30, 0x90, 0x1b, 0x46, 0x6e, 0x96, 0xb9, 0x91, 0xe4, 0x06, 0x0c, 0x18, 0x90, 0x40, 0x46, 0x06, 0x90, 0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x02, 0xc2, 0xab, 0xaa, 0x3e, 0x20, 0xe0, 0xab, 0xaa, 0x3e, 0x02, 0xc2, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x02, 0xc0, 0x30, 0x00, 0x0c, 0x03, 0xf0, 0xff, 0x00, 0xfe, 0x0b, 0xd0, 0x7f, 0x00, 0xa4, 0x01, 0x00, 0x0a, 0x00, 0xa0, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x81, 0x24, 0x10, 0x85, 0x00, 0x20, 0x66, 0x40, 0x15, 0x45, 0x62, 0x90, 0x4d, 0xd0, 0xf1, 0x23, 0x01, 0xfd, 0x41, 0x41, 0x07, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x00, 0xf8, 0x02, 0xd0, 0x7f, 0x00, 0xfe, 0x0b, 0xf0, 0xff, 0x00, 0xff, 0x0f, 0xd0, 0x7f, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0xd4, 0x01, 0xd0, 0x06, 0x40, 0x7f, 0x00, 0xfd, 0x01, 0xf4, 0x07, 0xd0, 0x1f, 0x00, 0x7f, 0x00, 0xd0, 0x01, 0x00, 0x0a, 0x40, 0x15, 0x00, 0xfe, 0x0b, 0x88, 0x2f, 0x52, 0xf0, 0x50, 0x01, 0x0a, 0xd4, 0xaf, 0x7f, 0xfd, 0xf5, 0xc7, 0x0b, 0x3e, 0x70, 0xd0, 0x00, 0xa4, 0x01, 0x0a, 0x80, 0x2f, 0x80, 0x5f, 0x2f, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x01, 0x34, 0x34, 0xc0, 0x01, 0x07, 0x0d, 0xd0, 0x75, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xf4, 0x01, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xe0, 0xef, 0x00, 0xbb, 0x0b, 0xa0, 0xaa, 0x00, 0xaa, 0x0a, 0x80, 0x19, 0x00, 0x64, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x2d, 0x80, 0xe7, 0x0b, 0xbe, 0xf8, 0xfa, 0x02, 0xfe, 0x0b, 0x80, 0x2f, 0x00, 0x50, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xaf, 0x2f, 0xbe, 0xe0, 0xdb, 0x02, 0x78, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 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0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, }; short font_ptrs[] = { - 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2, 0x01c0, 0x01ce, 0x01d7, 0x01e5, 0x01f5, 0x0205, 0x0218, 0x0228, 0x0231, 0x023c, 0x0247, 0x0257, 0x0267, 0x0272, 0x0280, 0x0289, 0x0299, 0x02a9, 0x02b7, 0x02c7, 0x02d7, 0x02e7, 0x02f7, 0x0307, 0x0317, 0x0327, 0x0337, 0x0340, 0x034b, 0x035b, 0x036b, 0x037b, 0x038b, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x042b, 0x043b, 0x044e, 0x045e, 0x0473, 0x0486, 0x0499, 0x04a9, 0x04bc, 0x04cc, 0x04dc, 0x04ec, 0x04ff, 0x050f, 0x0524, 0x0537, 0x0547, 0x055a, 0x0565, 0x0573, 0x057e, 0x0589, 0x0599, 0x05a2, 0x05b0, 0x05be, 0x05cc, 0x05da, 0x05e8, 0x05f3, 0x0601, 0x060f, 0x061a, 0x0625, 0x0633, 0x063e, 0x064e, 0x065c, 0x066a, 0x0678, 0x0686, 0x068f, 0x069d, 0x06a8, 0x06b6, 0x06c4, 0x06d4, 0x06e2, 0x06f0, 0x06fe, 0x0709, 0x070f, 0x071a, 0x072a, 0x0735, 0x074a, 0x0769, 0x0788, 0x07a2, 0x07c1, 0x07db, 0x07f5, 0x080f, 0x0829, 0x0843, 0x085d, 0x0877, 0x0896, 0x08a6, 0x08c0, 0x08da, 0x08f4, 0x090e, 0x0923, 0x0940, 0x095d, 0x097c, 0x099b, 0x09b3, 0x09cb, 0x09e3, 0x09fb, 0x0a13, 0x0a2b, 0x0a43, 0x0a5b, 0x0a73, 0x0a8b, 0x0aa3, 0x0abd, 0x0ada, 0x0af7, 0x0b0c, 0x0b26, 0x0b40, 0x0b5a, 0x0b74, 0x0b8c, 0x0b97, 0x0ba0, 0x0ba9, 0x0bb7, 0x0bc5, 0x0bd3, 0x0be1, 0x0bef, 0x0bfd, 0x0c0b, 0x0c19, 0x0c27, 0x0c35, 0x0c43, 0x0c4e, 0x0c57, 0x0c60, 0x0c6e, 0x0c7e, 0x0c8e, 0x0ca8, 0x0cc2, 0x0cdc, 0x0cf6, 0x0d10, 0x0d2a, 0x0d44, 0x0d5e, 0x0d78, 0x0d92, 0x0dac, 0x0dc6, 0x0de0, 0x0dfa, 0x0e14, 0x0e2e, 0x0e46, 0x0e56, 0x0e66, 0x0e76, 0x0e86, 0x0e96, 0x0ea6, 0x0eb6, 0x0ec6, 0x0ed6, 0x0ee6, 0x0ef6, 0x0f06, 0x0f16, 0x0f26, 0x0f36, 0x0f46, 0x0f56, 0x0f66, 0x0f76, 0x0f86, 0x0f96, 0x0fa6, 0x0fb6, 0x0fc6, 0x0fd6, 0x0fe6, 0x0ff6, 0x1006, 0x1016, 0x1026, 0x1036, 0x1046, 0x1056, 0x1066, 0x1076, 0x1086, 0x1096, 0x10a6, 0x10b6, 0x10c6, 0x10d6, 0x10e6, 0x10f6, 0x1106, 0x1116, 0x1126, 0x1136, + 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2, 0x01c0, 0x01ce, 0x01d7, 0x01e5, 0x01f5, 0x0205, 0x0218, 0x0228, 0x0231, 0x023c, 0x0247, 0x0257, 0x0267, 0x0272, 0x0280, 0x0289, 0x0299, 0x02a9, 0x02b7, 0x02c7, 0x02d7, 0x02e7, 0x02f7, 0x0307, 0x0317, 0x0327, 0x0337, 0x0340, 0x034b, 0x035b, 0x036b, 0x037b, 0x038b, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x042b, 0x043b, 0x044e, 0x045e, 0x0473, 0x0486, 0x0499, 0x04a9, 0x04bc, 0x04cc, 0x04dc, 0x04ec, 0x04ff, 0x050f, 0x0524, 0x0537, 0x0547, 0x055a, 0x0565, 0x0573, 0x057e, 0x0589, 0x0599, 0x05a2, 0x05b0, 0x05be, 0x05cc, 0x05da, 0x05e8, 0x05f3, 0x0601, 0x060f, 0x061a, 0x0625, 0x0633, 0x063e, 0x064e, 0x065c, 0x066a, 0x0678, 0x0686, 0x068f, 0x069d, 0x06a8, 0x06b6, 0x06c4, 0x06d4, 0x06e2, 0x06f0, 0x06fe, 0x0709, 0x070f, 0x071a, 0x072a, 0x0735, 0x074a, 0x0769, 0x0788, 0x07a2, 0x07c1, 0x07db, 0x07f5, 0x080f, 0x0829, 0x0843, 0x085d, 0x0877, 0x0896, 0x08a6, 0x08c0, 0x08da, 0x08f4, 0x090e, 0x0923, 0x0940, 0x095d, 0x097c, 0x099b, 0x09b3, 0x09cb, 0x09e3, 0x09fb, 0x0a13, 0x0a2b, 0x0a43, 0x0a5b, 0x0a73, 0x0a8b, 0x0aa3, 0x0abd, 0x0ada, 0x0af7, 0x0b0c, 0x0b26, 0x0b40, 0x0b5a, 0x0b74, 0x0b8c, 0x0b97, 0x0ba0, 0x0ba9, 0x0bb7, 0x0bc5, 0x0bd3, 0x0be1, 0x0bef, 0x0bfd, 0x0c0b, 0x0c19, 0x0c27, 0x0c35, 0x0c43, 0x0c4e, 0x0c57, 0x0c60, 0x0c6e, 0x0c7e, 0x0c8e, 0x0ca8, 0x0cc2, 0x0cdc, 0x0cf6, 0x0d10, 0x0d2a, 0x0d44, 0x0d5e, 0x0d78, 0x0d92, 0x0dac, 0x0dc6, 0x0de0, 0x0dfa, 0x0e14, 0x0e2e, 0x0e46, 0x0e60, 0x0e7a, 0x0e8a, 0x0e9a, 0x0eaa, 0x0eba, 0x0eca, 0x0eda, 0x0eea, 0x0efa, 0x0f0a, 0x0f1a, 0x0f2a, 0x0f3a, 0x0f4a, 0x0f5a, 0x0f6a, 0x0f7a, 0x0f8a, 0x0f9a, 0x0faa, 0x0fba, 0x0fca, 0x0fda, 0x0fea, 0x0ffa, 0x100a, 0x101a, 0x102a, 0x103a, 0x104a, 0x105a, 0x106a, 0x107a, 0x108a, 0x109a, 0x10aa, 0x10ba, 0x10ca, 0x10da, 0x10ea, 0x10fa, 0x110a, 0x111a, 0x112a, 0x113a, 0x114a, }; \ No newline at end of file diff --git a/powder.c b/powder.c index b594bd7..18c92ef 100644 --- a/powder.c +++ b/powder.c @@ -453,14 +453,15 @@ const struct menu_wall mwalls[] = { }; #define SC_WALL 0 -#define SC_SPECIAL 6 -#define SC_OTHER 7 +#define SC_SPECIAL 8 +#define SC_POWDERS 5 +#define SC_SOLIDS 6 #define SC_ELEC 1 #define SC_EXPLOSIVE 2 #define SC_GAS 3 #define SC_LIQUID 4 -#define SC_NUCLEAR 5 -#define SC_TOTAL 8 +#define SC_NUCLEAR 7 +#define SC_TOTAL 9 struct menu_section msections[] = { {"\xC1", "Walls", 0}, @@ -468,10 +469,10 @@ struct menu_section msections[] = { {"\xC3", "Explosives", 0}, {"\xC5", "Gasses", 0}, {"\xC4", "Liquids", 0}, + {"\xD0", "Powders", 0}, + {"\xD1", "Solids", 0}, {"\xC6", "Radioactive", 0}, {"\xCC", "Special", 0}, - {"\xC0", "Other", 0}, - }; #define CM_HEAT 5 @@ -567,40 +568,40 @@ struct menu_section msections[] = { #define MIN_TEMP -273 const struct part_type ptypes[] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description - {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_OTHER, R_TEMP+0.0f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_OTHER, R_TEMP+0.0f, 70, "Very light dust. Flammable."}, + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Very light dust. Flammable."}, {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Flammable."}, {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_OTHER, R_TEMP+0.0f, 150, "Heavy particles. Meltable."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Heavy particles. Meltable."}, {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 97, "Light dust. Explosive."}, {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 50, "Liquid. Pressure sensitive explosive."}, {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Solid. Duplicates any particles it touches."}, {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 88, "Solid. Pressure sensitive explosive."}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_OTHER, R_TEMP+0.0f, 75, "Solid. Deforms and disappears under pressure."}, - {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_OTHER, R_TEMP+-50.0f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms and disappears under pressure."}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+-50.0f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Conducts electricity. Meltable."}, {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_OTHER, R_TEMP+-30.0f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_OTHER, R_TEMP+0.0f, 164, "Solid. Flammable."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP+-30.0f, 46, "Light particles."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f, 164, "Solid. Flammable."}, {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 60, "Neutrons. Interact with matter in odd ways."}, {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_OTHER, R_TEMP+0.0f, 65, "Plant, drinks water and grows."}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 65, "Plant, drinks water and grows."}, {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f, 34, "Dissolves almost everything."}, {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Hole, will drain away any particles."}, {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_OTHER, R_TEMP+0.0f, 100, "Concrete, stronger than stone."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f, 100, "Concrete, stronger than stone."}, {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_OTHER, R_TEMP+0.0f, 110, "Salt, dissolves in water."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 110, "Salt, dissolves in water."}, {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f, 75, "Saltwater, conducts electricity, difficult to freeze."}, {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. - {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_OTHER, R_TEMP+0.0f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_OTHER, R_TEMP+0.0f, 211, "Broken metal."}, + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 251, "Breakable metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f, 211, "Broken metal."}, {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f, 251, "Photons. Travel in straight lines."}, {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f, 251, "Heavy particles. Generates heat under pressure."}, - {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_OTHER, R_TEMP+0.0f, 44, "Wax. Melts at moderately high temperatures."}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 44, "Wax. Melts at moderately high temperatures."}, {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f, 44, "Liquid Wax."}, {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "P-Type Silicon, Will transfer current to any conductor."}, {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, @@ -611,14 +612,14 @@ const struct part_type ptypes[] = { {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f, 170, "Liquid Rubidium."}, {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_OTHER, R_TEMP+0.0f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_OTHER, R_TEMP+0.0f, 150, "Solid. Meltable. Shatters under pressure"}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Sand, Heavy particles. Meltable."}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 150, "Solid. Meltable. Shatters under pressure"}, {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_OTHER, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f, 115, "Plasma, extremely hot."}, {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_OTHER, -250.0f, 46, "Nitrogen Ice."}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, -250.0f, 46, "Nitrogen Ice."}, {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Generates Electricity."}, {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, -- cgit v0.9.2-21-gd62e From 27b3fc9549fa9e3dc7e11f1d828291feebbec92e Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 31 Jul 2010 12:09:15 +0100 Subject: Updates font files missed in the last commit diff --git a/Resources/Font-Data b/Resources/Font-Data index 1abf887..a384152 100644 Binary files a/Resources/Font-Data and b/Resources/Font-Data differ diff --git a/Resources/Font-Pointers b/Resources/Font-Pointers index 4826cc6..621258b 100644 Binary files a/Resources/Font-Pointers and b/Resources/Font-Pointers differ -- cgit v0.9.2-21-gd62e From 66c815ab38c560399ff837951582f4e97f07056e Mon Sep 17 00:00:00 2001 From: FacialTurd Date: Sat, 31 Jul 2010 06:10:33 -0700 Subject: Battery "Bug" - triclops diff --git a/powder.c b/powder.c index 18c92ef..eb3d138 100644 --- a/powder.c +++ b/powder.c @@ -1802,7 +1802,7 @@ void update_particles_i(pixel *vid, int start, int inc){ if((r>>8)>=NPART || !r) continue; rt = parts[r>>8].type; - if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0) { + if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) { parts[r>>8].life = 4; parts[r>>8].ctype = rt; parts[r>>8].type = PT_SPRK; -- cgit v0.9.2-21-gd62e From 74502a4b55bc4d5d77c7690e3ca2bc83c0f9e2fd Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 8 Aug 2010 20:48:18 +0100 Subject: Adds Switch, Insulator (triclops), updates info screen. Add background to text on HUD and 'h' toggles HUD visibility diff --git a/powder.c b/powder.c old mode 100644 new mode 100755 index eb3d138..b5e456c --- a/powder.c +++ b/powder.c @@ -3,6 +3,8 @@ * * Copyright (c) 2008 - 2010 Stanislaw Skowronek. * Copyright (c) 2010 Simon Robertshaw + * Copyright (c) 2010 Skresanov Savely + * Copyright (c) 2010 Bryan Who? * * 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 @@ -26,11 +28,6 @@ #include #include #include -//#include -#ifdef MT -#include -#include -#endif #ifdef WIN32 #include @@ -44,8 +41,9 @@ #include "http.h" #include "md5.h" #include "update.h" +#include "hmap.h" -#define SERVER "powder.hardwired.org.uk" +#define SERVER "powdertoy.co.uk" #undef PLOSS @@ -70,10 +68,6 @@ unsigned char ZSIZE = ZSIZE_D; typedef unsigned char uint8; -#ifdef HEAT_ENABLE -#include "hmap.h" -#endif - #ifdef PIX16 #define PIXELSIZE 2 typedef unsigned short pixel; @@ -129,13 +123,14 @@ char *it_msg = "The spacebar can be used to pause physics.\n" "'P' will take a screenshot and save it into the current directory.\n" "\n" -"\brhttp://powder.hardwired.org.uk/\n" +"\brhttp://powdertoy.co.uk/\n" "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" -"\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powder.hardwired.org.uk\bg)\n" +"\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" +"\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" +"\bgCopyright (c) 2010 Bryan Who? (New elements)\n" "\n" -"\bgSpecial thanks to Brian Ledbetter for maintaining ports & server development in the past." -"\nand CW for hosting the original server.\n" -"\bgTo use online features such as saving, you need to register at: \brhttp://powder.hardwired.org.uk/Register.html" +"\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" +"\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" ; typedef struct { @@ -147,9 +142,7 @@ typedef struct { char *old_ver_msg_beta = "A new beta is available - click here!"; #endif char *old_ver_msg = "A new version is available - click here!"; -#ifdef HEAT_ENABLE float mheat = 0.0f; -#endif int do_open = 0; int sys_pause = 0; @@ -399,14 +392,11 @@ struct part_type { int hardness; int menu; int menusection; -//#ifdef HEAT_ENABLE //Locked on float heat; unsigned char hconduct; -//#endif const char *descs; }; -#ifdef HEAT_ENABLE struct part_state { char state; int solid; @@ -418,7 +408,6 @@ struct part_state { int burn; float btemp; }; -#endif struct menu_section { char *icon; @@ -544,7 +533,7 @@ struct menu_section msections[] = { #define PT_PSCN 35 #define PT_NSCN 36 #define PT_LNTG 37 -#define PT_FOAM 38 +#define PT_INSL 38 #define PT_BHOL 39 #define PT_WHOL 40 #define PT_RBDM 41 @@ -561,7 +550,9 @@ struct menu_section msections[] = { #define PT_NBLE 52 #define PT_BTRY 53 #define PT_LCRY 54 -#define PT_NUM 55 +#define PT_SWCH 55 +#define PT_SMKE 56 +#define PT_NUM 57 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -606,7 +597,7 @@ const struct part_type ptypes[] = { {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "P-Type Silicon, Will transfer current to any conductor."}, {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -205.0f, 70, "Liquid Nitrogen. Very cold."}, - {"FOAM", PIXPACK(0xD0D08A), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 2, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f, 1, "Foam, Very good thermal insulator"}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 2, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f, 0, "Insulator, does not conduct heat or electricity."}, {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f, 255, "Black hole, sucks in other particles and heats up."}, {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f, 255, "White hole, pushes other particles away."}, {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, @@ -623,15 +614,16 @@ const struct part_type ptypes[] = { {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Generates Electricity."}, {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 0, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, }; -#ifdef HEAT_ENABLE #define ST_NONE 0 #define ST_SOLID 1 #define ST_LIQUID 2 #define ST_GAS 3 const struct part_state pstates[] = { - // Name Solid Frzp Liquid Mpnt Gas Bpoint + // Name Solid Frzp Liquid Mpnt Gas Bpoint /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WATR */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, @@ -687,8 +679,9 @@ const struct part_state pstates[] = { /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2000.0f}, /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; -#endif static const unsigned char can_move[PT_NUM][PT_NUM] = { /* A B */ /* A 0 1 | B ligher than A */ @@ -698,61 +691,63 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = { /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C */ /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r */ /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0}, - /* METL */ {0,1,1,1,0,0,1,1,1,0,1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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* NICE */ {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + /* NBLE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* BTRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* LCRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0}, }; #define FLAG_STAGNANT 1 @@ -760,9 +755,7 @@ typedef struct { int type; int life, ctype; float x, y, vx, vy; -#ifdef HEAT_ENABLE float temp; -#endif int flags; } particle; particle *parts; @@ -794,7 +787,7 @@ int try_move(int i, int x, int y, int nx, int ny) if(r && (r>>8)>8].type; - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE)){ + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))){ return 1; } @@ -804,11 +797,9 @@ int try_move(int i, int x, int y, int nx, int ny) } if((r&0xFF)==PT_BHOL){ parts[i].type=PT_NONE; -#ifdef HEAT_ENABLE if(!legacy_enable){ parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; } -#endif return 0; } @@ -875,7 +866,6 @@ int create_part(int p, int x, int y, int t) if(x<0 || y<0 || x>=XRES || y>=YRES) return -1; -#ifdef HEAT_ENABLE if(t==SPC_HEAT||t==SPC_COOL){ if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8>=PT_NUM)?PT_NONE:pmr>>8].type; +} int nearest_part(int ci, int t){ int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); int ndistance = 0; @@ -1131,13 +1121,11 @@ int nearest_part(int ci, int t){ } void create_line(int x1, int y1, int x2, int y2, int r, int c); void update_particles_i(pixel *vid, int start, int inc){ - int i, j, x, y, t, nx, ny, r, a, cr,cg,cb, s, rt, fe, nt, lpv, nearp; + int i, j, x, y, t, nx, ny, r, a, cr,cg,cb, s, rt, fe, nt, lpv, nearp, pavg; float mv, dx, dy, ix, iy, lx, ly; -#ifdef HEAT_ENABLE float pt = R_TEMP; float c_heat = 0.0f; int h_count = 0; -#endif int starti = (start*-1); for(i=start; i<(NPART-starti); i+=inc) if(parts[i].type) { @@ -1149,7 +1137,7 @@ void update_particles_i(pixel *vid, int start, int inc){ if(sys_pause) goto justdraw; - if(parts[i].life&&t!=PT_ACID&&t!=PT_WOOD&&t!=PT_NBLE) { + if(parts[i].life && t!=PT_ACID && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH) { if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) parts[i].life--; if(parts[i].life<=0 && t!=PT_WIRE && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_HSCN && t!=PT_CSCN && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY) { @@ -1158,10 +1146,8 @@ void update_particles_i(pixel *vid, int start, int inc){ } if(parts[i].life<=0 && t==PT_SPRK) { t = parts[i].ctype; -#ifdef HEAT_ENABLE if(t!=PT_WIRE&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM&&t!=PT_BTRY&&t!=PT_NBLE) parts[i].temp = R_TEMP; -#endif if(!t) t = PT_WIRE; parts[i].type = t; @@ -1223,9 +1209,7 @@ void update_particles_i(pixel *vid, int start, int inc){ if((ptypes[t].explosive&2) && pv[y/CELL][x/CELL]>2.5f) { parts[i].life = rand()%80+180; rt = parts[i].type = PT_FIRE; -#ifdef HEAT_ENABLE parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); -#endif pv[y/CELL][x/CELL] += 0.25f * CFDS; t = PT_FIRE; } @@ -1298,18 +1282,14 @@ void update_particles_i(pixel *vid, int start, int inc){ if((pmap[y+ny][x+nx]&0xFF)!=t) nt = 1; } -#ifdef HEAT_ENABLE if(legacy_enable){ -#endif if(t==PT_WTRV && pv[y/CELL][x/CELL]>4.0f) t = parts[i].type = PT_DSTW; if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) t = parts[i].type = PT_OILL; if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) t = parts[i].type = PT_GASS; -#ifdef HEAT_ENABLE } -#endif if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) @@ -1334,7 +1314,6 @@ void update_particles_i(pixel *vid, int start, int inc){ } } -#ifdef HEAT_ENABLE if(!legacy_enable){ int ctemp = pv[y/CELL][x/CELL]*2; c_heat = 0.0f; @@ -1346,7 +1325,7 @@ void update_particles_i(pixel *vid, int start, int inc){ r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE){ + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0){ h_count++; c_heat += parts[r>>8].temp; } @@ -1360,7 +1339,7 @@ void update_particles_i(pixel *vid, int start, int inc){ r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE){ + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0){ parts[r>>8].temp = parts[i].temp; } } @@ -1424,7 +1403,6 @@ void update_particles_i(pixel *vid, int start, int inc){ if(t==PT_HSCN&&parts[i].temp>24.0f){ pt = parts[i].temp -= 2.5f; } - #endif if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) { nx = x % CELL; @@ -1460,32 +1438,6 @@ void update_particles_i(pixel *vid, int start, int inc){ set_emap(nx, ny); fe = 0; - /*if(t==PT_WOOD && parts[i].life>0){ - int ttx = (rand()%3)-1; - r = pmap[y-1][x+ttx]; - if(parts[i].life>50){ - if((pmap[y-1][x+ttx]&0xFF)==PT_NONE){ - create_part(-1, x+ttx, y-1, PT_WOOD); - parts[pmap[y-1][x+ttx]>>8].life = parts[i].life-1; - parts[pmap[y-1][x+ttx]>>8].vx = ttx; - } - if((pmap[y-1][x+ttx-1]&0xFF)==PT_NONE){ - create_part(-1, x+ttx-1, y-1, PT_WOOD); - parts[pmap[y-1][x+ttx-1]>>8].life = 0; - } - if((pmap[y-1][x+ttx+1]&0xFF)==PT_NONE){ - create_part(-1, x+ttx+1, y-1, PT_WOOD); - parts[pmap[y-1][x+ttx+1]>>8].life = 0; - } - parts[i].life = 0; - } else if(parts[i].life>10) { - //int ttx = (rand()%3)-parts[i].vx; - //create_part(-1, x+ttx, y-1, PT_WOOD); - //r = pmap[y-1][x+ttx]; - //parts[r>>8].life = parts[i].life-1; - //parts[i].life = 0; - } - } else*/ if(t==PT_THDR){ for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) @@ -1521,14 +1473,6 @@ void update_particles_i(pixel *vid, int start, int inc){ t = parts[i].type = PT_SLTW; parts[r>>8].type = PT_SLTW; } -#ifndef HEAT_ENABLE - if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) { - t = parts[i].type = PT_ICEI; - parts[r>>8].type = PT_ICEI; - } - if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) - t = parts[i].type = PT_WATR; -#else if(legacy_enable){ if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) { t = parts[i].type = PT_ICEI; @@ -1537,7 +1481,6 @@ void update_particles_i(pixel *vid, int start, int inc){ if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) t = parts[i].type = PT_WATR; } -#endif } } else if(t==PT_HSCN||t==PT_CSCN) { @@ -1581,15 +1524,8 @@ void update_particles_i(pixel *vid, int start, int inc){ r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10)) { -#ifndef HEAT_ENABLE + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) { t = parts[i].type = PT_WTRV; - //parts[r>>8].type = PT_WTRV; -#else - if(legacy_enable){ - t = parts[i].type = PT_WTRV; - } -#endif } else if((r&0xFF)==PT_SALT && 1>(rand()%250)) { t = parts[i].type = PT_SLTW; parts[r>>8].type = PT_SLTW; @@ -1600,17 +1536,11 @@ void update_particles_i(pixel *vid, int start, int inc){ if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)){ t = parts[i].type = PT_SLTW; } -#ifdef HEAT_ENABLE if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)){ -#else - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ -#endif parts[i].life = 4; t = parts[i].type = PT_FIRE; } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; } } else if(t==PT_SLTW) { @@ -1621,34 +1551,19 @@ void update_particles_i(pixel *vid, int start, int inc){ r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10)) { -#ifndef HEAT_ENABLE - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; -#else - if(legacy_enable){ + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) { t = parts[i].type = PT_SALT; parts[r>>8].type = PT_WTRV; - } -#endif } else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) { - //t = parts[i].type = PT_SLTW; parts[r>>8].type = PT_SLTW; } -#ifdef HEAT_ENABLE if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)){ -#else - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ -#endif parts[i].life = 4; t = parts[i].type = PT_FIRE; } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; } - } - else if(t==PT_WTRV) { + } else if(t==PT_WTRV) { for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && @@ -1656,44 +1571,23 @@ void update_particles_i(pixel *vid, int start, int inc){ r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; -#ifdef HEAT_ENABLE - if(legacy_enable){ -#endif - if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000)) { + if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) { t = parts[i].type = PT_WATR; parts[r>>8].type = PT_WATR; } -#ifdef HEAT_ENABLE - } -#endif -#ifdef HEAT_ENABLE if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)){ -#else - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && 1>(rand()%500)){ -#endif parts[i].life = 4; t = parts[i].type = PT_FIRE; } - if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000)) { -#ifndef HEAT_ENABLE + if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) { t = parts[i].type = PT_WATR; if(1>(rand()%1000)) parts[r>>8].type = PT_WATR; -#else - if(legacy_enable){ - t = parts[i].type = PT_WATR; - if(1>(rand()%1000)) - parts[r>>8].type = PT_WATR; - } -#endif } } - } - // END PLANT - // ACID - else if(t==PT_ACID) { + } else if(t==PT_ACID) { for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && x+nx>8].type; - if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL) || t!=PT_SPRK) && (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { parts[r>>8].type = PT_FIRE; -#ifdef HEAT_ENABLE parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); -#endif parts[r>>8].life = rand()%80+180; if(ptypes[rt].explosive) - pv[y/CELL][x/CELL] += 0.25f * CFDS; //LOL + pv[y/CELL][x/CELL] += 0.25f * CFDS; continue; } lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; if(lpv < 1) lpv = 1; -#ifndef HEAT_ENABLE - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && (t!=PT_FIRE || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && - ptypes[rt].meltable*lpv>(rand()%1000)) { - if(t!=PT_LAVA || parts[i].life>0) { - parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; - parts[r>>8].type = PT_LAVA; - parts[r>>8].life = rand()%120+240; - } else { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) { - parts[r>>8].type = PT_WATR; - if(t==PT_FIRE) { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) { - parts[i].life = 0; - t = parts[i].type = PT_METL; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) { - kill_part(r>>8); - if(t==PT_FIRE) { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - //t = parts[i].type = PT_METL; - goto killed; - } - } -#else if(legacy_enable){ if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && ptypes[rt].meltable*lpv>(rand()%1000)) { @@ -1919,28 +1764,25 @@ void update_particles_i(pixel *vid, int start, int inc){ if(t==PT_LAVA) { parts[i].life = 0; t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - //t = parts[i].type = PT_METL; + parts[i].ctype = PT_NONE; goto killed; } } } -#endif + pavg = parts_avg(i, r>>8); if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN)){ + if(!(rt==PT_PSCN&&parts[i].ctype==PT_NSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp>=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ){ parts[r>>8].type = PT_SPRK; parts[r>>8].life = 4; parts[r>>8].ctype = rt; -#ifdef HEAT_ENABLE if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) parts[r>>8].temp = parts[r>>8].temp+10.0f; -#endif } } if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)>8].temp>100.0f)){ + if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_HSCN||(parts[i].ctype==PT_PSCN&&parts[r>>8].temp>100.0f))&&pavg != PT_INSL){ parts[r>>8].type = PT_SPRK; parts[r>>8].life = 4; parts[r>>8].ctype = rt; @@ -1948,7 +1790,7 @@ void update_particles_i(pixel *vid, int start, int inc){ } if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)>8].temp<100.0f)){ + if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_CSCN||(parts[i].ctype==PT_PSCN&&parts[r>>8].temp<100.0f))&&pavg != PT_INSL){ parts[r>>8].type = PT_SPRK; parts[r>>8].life = 4; parts[r>>8].ctype = rt; @@ -1983,7 +1825,12 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[i].ctype = PT_NBLE; parts[i].temp = 3500; pv[y/CELL][x/CELL] += 1; - } + } + if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) + { + parts[i].type = PT_SWCH; + parts[i].life = 10; + } } killed: if(parts[i].type == PT_NONE) @@ -2005,9 +1852,36 @@ void update_particles_i(pixel *vid, int start, int inc){ } if(t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1) { - parts[i].type = PT_NBLE; - parts[i].life = 0; + parts[i].type = PT_NBLE; + parts[i].life = 0; + } + //if (t==PT_FIRE && parts[i].life <=1) + //{ + // parts[i].type = PT_SMKE; + // parts[i].life = 0; + //} + if(t==PT_SWCH) + { + for(nx=-2; nx<3; nx++){ + for(ny=-2; ny<3; ny++){ + r =pmap[y+ny][x+nx]; + pavg = parts_avg(i, r>>8); + if(parts[r>>8].type == PT_SPRK&&abs(nx)+abs(ny)<4) + { + if(parts[r>>8].ctype == PT_PSCN&&pavg != PT_INSL) + parts[i].life = 10; + if(parts[r>>8].ctype == PT_NSCN&&pavg != PT_INSL) + parts[i].life = 0; + if(!(parts[r>>8].ctype == PT_PSCN||parts[r>>8].ctype == PT_NSCN)&&parts[i].life == 10&&pavg != PT_INSL){ + parts[i].type = PT_SPRK; + parts[i].ctype = PT_SWCH; + parts[i].life = 4; + } + } + } + } } + nx = (int)(parts[i].x+0.5f); ny = (int)(parts[i].y+0.5f); @@ -2138,20 +2012,16 @@ void update_particles_i(pixel *vid, int start, int inc){ kill_part(i); continue; } -#ifdef HEAT_ENABLE if(cmode!=CM_HEAT){ - -#endif if(t==PT_ACID) { if(parts[i].life>255) parts[i].life = 255; if(parts[i].life<47) parts[i].life = 48; - s = (255/((parts[i].life-46)*28));//if(parts[i].life<=49) parts[i].life = 50; + s = (255/((parts[i].life-46)*28)); if(s==0) s = 1; cr = PIXR(ptypes[t].pcolors)/s; cg = PIXG(ptypes[t].pcolors)/s; cb = PIXB(ptypes[t].pcolors)/s; - //vid[ny*(XRES+BARSIZE)+nx] = //(cr<<16)+(cb<<18)+cg;//ptypes[t].pcolors/-(parts[i].life-255); - blendpixel(vid, nx, ny, cr, cg, cb, 255);//(parts[i].life-46)*28 + blendpixel(vid, nx, ny, cr, cg, cb, 255); if(cmode==4){ blendpixel(vid, nx+1, ny, cr, cg, cb, 223); blendpixel(vid, nx-1, ny, cr, cg, cb, 223); @@ -2211,6 +2081,10 @@ void update_particles_i(pixel *vid, int start, int inc){ blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } + } else if(t==PT_SWCH && parts[i].life == 10) { + x = nx; + y = ny; + blendpixel(vid,x,y,17,217,24,255); } else if(t==PT_THDR) { if(cmode == 3||cmode==4) { vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; @@ -2362,7 +2236,6 @@ void update_particles_i(pixel *vid, int start, int inc){ } } else vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; -#ifdef HEAT_ENABLE } else { float ttemp = parts[i].temp+(-MIN_TEMP); int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); @@ -2372,7 +2245,6 @@ void update_particles_i(pixel *vid, int start, int inc){ vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); //blendpixel(vid, nx+1, ny, R, G, B, 255); } -#endif if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID){ uint8 R = PIXR(ptypes[t].pcolors); uint8 G = PIXG(ptypes[t].pcolors); @@ -3127,11 +2999,7 @@ static char *mystrdup(char *s) void *build_save(int *size, int x0, int y0, int w, int h) { -#ifdef HEAT_ENABLE unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; -#else - unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*6+MAXSIGNS*262), *c; -#endif int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; @@ -3198,7 +3066,6 @@ void *build_save(int *size, int x0, int y0, int w, int h) if(i) d[p++] = (parts[i-1].life+3)/4; } -#ifdef HEAT_ENABLE for(j=0; j 50) it = 50; } @@ -8017,7 +7832,6 @@ int main(int argc, char *argv[]) x = (((x/sdl_scale-zoom_wx)/ZFACTOR)+zoom_x)*sdl_scale; y = (((y/sdl_scale-zoom_wy)/ZFACTOR)+zoom_y)*sdl_scale; } -#ifdef HEAT_ENABLE if(y>0 && y0 && x=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) { -#else - else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-365))*sdl_scale) && svf_login && svf_open) { -#endif db = svf_own ? 257 : 256; if(da < 51) da ++; -#ifdef HEAT_ENABLE } else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) { db = 270; if(da < 51) da ++; -#endif } else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) { db = 266; if(da < 51) @@ -8237,17 +8044,11 @@ int main(int argc, char *argv[]) svf_myvote = -1; } } -#ifdef HEAT_ENABLE if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) -#else - if(x>=219 && x<=(XRES+BARSIZE-(510-365)) && svf_login && svf_open) -#endif tag_list_ui(vid_buf); -#ifdef HEAT_ENABLE if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) { legacy_enable = !legacy_enable; } -#endif if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) { memset(signs, 0, sizeof(signs)); memset(pv, 0, sizeof(pv)); @@ -8263,10 +8064,7 @@ int main(int argc, char *argv[]) parts[NPART-1].life = -1; pfree = 0; -#ifdef HEAT_ENABLE - legacy_enable = 0; -#endif - + legacy_enable = 0; svf_myvote = 0; svf_open = 0; svf_publish = 0; @@ -8306,17 +8104,10 @@ int main(int argc, char *argv[]) if(x>=19 && x<=35 && svf_last && svf_open) parse_save(svf_last, svf_lsize, 1, 0, 0); if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { -#ifdef HEAT_ENABLE if(b & SDL_BUTTON_LMASK) set_cmode((cmode+1) % 6); if(b & SDL_BUTTON_RMASK) set_cmode((cmode+5) % 6); -#else - if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 5); - if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+4) % 5); -#endif save_presets(0); } if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) @@ -8538,18 +8329,20 @@ int main(int argc, char *argv[]) FPS = 0; pastFPS = currentTime; } -#ifdef HEAT_ENABLE if(sdl_zoom_trig||zoom_en){ - if(x Date: Mon, 9 Aug 2010 19:21:09 +0100 Subject: Change behaviour of 2 elements: GLAS is not impervious to ACID, fixes invisible plasma bug with battery diff --git a/powder.c b/powder.c index b5e456c..14a4331 100755 --- a/powder.c +++ b/powder.c @@ -604,7 +604,7 @@ const struct part_type ptypes[] = { {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f, 170, "Liquid Rubidium."}, {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 150, "Solid. Meltable. Shatters under pressure"}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 150, "Solid. Meltable. Shatters under pressure"}, {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, @@ -1347,7 +1347,7 @@ void update_particles_i(pixel *vid, int start, int inc){ } if(pt>=pstates[t].btemp&&pstates[t].burn) { t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE) + if(t==PT_FIRE||t==PT_PLSM) parts[i].life = rand()%50+120; } else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid){ -- cgit v0.9.2-21-gd62e From af573753cff935bc4086f5551656f48f8c4e83d4 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 9 Aug 2010 19:26:58 +0100 Subject: Correction of Bryans full name diff --git a/powder.c b/powder.c index 14a4331..1b77a8a 100755 --- a/powder.c +++ b/powder.c @@ -4,7 +4,7 @@ * Copyright (c) 2008 - 2010 Stanislaw Skowronek. * Copyright (c) 2010 Simon Robertshaw * Copyright (c) 2010 Skresanov Savely - * Copyright (c) 2010 Bryan Who? + * Copyright (c) 2010 Bryan Hoyle * * 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 @@ -127,7 +127,7 @@ char *it_msg = "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" -"\bgCopyright (c) 2010 Bryan Who? (New elements)\n" +"\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" "\n" "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" -- cgit v0.9.2-21-gd62e From b33438254d78377f10ccd10a10db590c80807962 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 11 Aug 2010 12:12:29 +0100 Subject: Fixes to makefile and fixes error in particle_avg function. diff --git a/Makefile b/Makefile index 90fed1c..3ea7ded 100755 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ SOURCES := powder.c http.c md5.c update.c HEADERS := font.h hmap.h http.h md5.h icon.h update.h version.h -CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -fgnu89-inline +CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations LFLAGS := -lSDL -lm -lbz2 LFLAGS_MTW32 := -lpthreadGC2 @@ -10,79 +10,81 @@ MFLAGS_MT := -march=k8 -DX86 -DX86_SSE3 -DMT -msse3 MFLAGS_SSE3 := -march=k8 -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2 MFLAGS_SSE := -march=pentium3 -DX86 -DX86_SSE - +COMPILER := gcc LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 WIN32_TARG := powder-sse.exe powder-sse2.exe powder: $(SOURCES) $(HEADERS) - gcc -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 + $(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 powder-sse3: $(SOURCES) $(HEADERS) - gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 - strip $@ + $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 + strip $@ powder-mt: $(SOURCES) $(HEADERS) - gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -DLIN32 - strip $@ + $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -DLIN32 + strip $@ powder-sse2: $(SOURCES) $(HEADERS) - gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN32 - strip $@ + $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) +$(MFLAGS_SSE2) $(SOURCES) -DLIN32 + strip $@ powder-sse: $(SOURCES) $(HEADERS) - gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32 - strip $@ + $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32 + strip $@ powder-64-sse3: $(SOURCES) $(HEADERS) - gcc -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 - strip $@ + $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 powder-64-sse2: $(SOURCES) $(HEADERS) - gcc -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64 - strip $@ + $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64 + strip $@ powder-res.o: powder-res.rc powder.ico - i586-mingw32msvc-windres powder-res.rc powder-res.o + i586-mingw32msvc-windres powder-res.rc powder-res.o powder-sse3.exe: $(SOURCES) $(HEADERS) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 - strip $@ - chmod 0644 $@ + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ powder-mt.exe: $(SOURCES) $(HEADERS) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_MT) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS_MTW32) -mwindows -DWIN32 - strip $@ - chmod 0644 $@ + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_MT) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS_MTW32) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ powder-sse2.exe: $(SOURCES) $(HEADERS) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 - strip $@ - chmod 0644 $@ + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) +powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ powder-sse.exe: $(SOURCES) $(HEADERS) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 - strip $@ - chmod 0644 $@ + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ powder-x: $(SOURCES) $(HEADERS) - gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa - strip $@ + gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa + strip $@ powder-x-mt: $(SOURCES) $(HEADERS) - gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa + gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa powder-src.tar.bz2: *.c *.h *.rc *.ico Makefile - mkdir powder-src - cp *.c *.h *.rc *.ico Makefile powder-src/ - tar cfj powder-src.tar.bz2 powder-src - rm -rf powder-src + mkdir powder-src + cp *.c *.h *.rc *.ico Makefile powder-src/ + tar cfj powder-src.tar.bz2 powder-src + rm -rf powder-src release: $(LINUX_TARG) $(WIN32_TARG) powder-src.tar.bz2 - tar cfz powder-linux.tar.gz $(LINUX_TARG) - cp /usr/i586-mingw32msvc/bin/SDL.dll . - zip powder-win32.zip $(WIN32_TARG) SDL.dll - mkdir -p release - mv powder-linux.tar.gz release/ - mv powder-win32.zip release/ - mv powder-src.tar.bz2 release/ - cp powder-sse.exe powder.exe - rm -f release/powder.zip - zip release/powder.zip powder.exe SDL.dll - cp powder-64-sse2 release/powder64 - rm -f release/powder64.gz - gzip release/powder64 - rm -f release/powder.gz - cp powder-sse release/powder - gzip release/powder - cd release; tar czf powder-bin.tar.gz powder.gz powder64.gz powder-linux.tar.gz powder-win32.zip powder.zip; cd .. - rm -f $(LINUX_TARG) $(WIN32_TARG) SDL.dll powder.exe + tar cfz powder-linux.tar.gz $(LINUX_TARG) + cp /usr/i586-mingw32msvc/bin/SDL.dll . + zip powder-win32.zip $(WIN32_TARG) SDL.dll + mkdir -p release + mv powder-linux.tar.gz release/ + mv powder-win32.zip release/ + mv powder-src.tar.bz2 +release/ + cp powder-sse.exe powder.exe + rm -f release/powder.zip + zip release/powder.zip powder.exe SDL.dll + cp powder-64-sse2 release/powder64 + rm -f release/powder64.gz + gzip release/powder64 + rm -f release/powder.gz + cp powder-sse release/powder + gzip release/powder + cd release; tar czf powder-bin.tar.gz powder.gz powder64.gz powder-linux.tar.gz powder-win32.zip powder.zip; cd .. + rm -f $(LINUX_TARG) $(WIN32_TARG) SDL.dll powder.exe \ No newline at end of file diff --git a/powder.c b/powder.c index 1b77a8a..f8a9baa 100755 --- a/powder.c +++ b/powder.c @@ -1099,7 +1099,7 @@ void set_emap(int x, int y) } int parts_avg(int ci, int ni){ int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; - return parts[(pmr>>8>=PT_NUM)?PT_NONE:pmr>>8].type; + return parts[(pmr>>8>=NPART)?PT_NONE:pmr>>8].type; } int nearest_part(int ci, int t){ int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); -- cgit v0.9.2-21-gd62e From ab8f1ff8edcba965acfab6554daf5b41ab5aa457 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 11 Aug 2010 13:48:32 +0100 Subject: Fix makefile diff --git a/Makefile b/Makefile index 3ea7ded..9d8360f 100755 --- a/Makefile +++ b/Makefile @@ -15,76 +15,74 @@ LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 WIN32_TARG := powder-sse.exe powder-sse2.exe powder: $(SOURCES) $(HEADERS) - $(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 + $(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 powder-sse3: $(SOURCES) $(HEADERS) - $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 - strip $@ + $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 + strip $@ powder-mt: $(SOURCES) $(HEADERS) - $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -DLIN32 - strip $@ + $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -DLIN32 + strip $@ powder-sse2: $(SOURCES) $(HEADERS) - $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) -$(MFLAGS_SSE2) $(SOURCES) -DLIN32 - strip $@ + $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN32 + strip $@ powder-sse: $(SOURCES) $(HEADERS) - $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32 - strip $@ + $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32 + strip $@ powder-64-sse3: $(SOURCES) $(HEADERS) - $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 + $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 + strip $@ powder-64-sse2: $(SOURCES) $(HEADERS) - $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64 - strip $@ + $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64 + strip $@ powder-res.o: powder-res.rc powder.ico - i586-mingw32msvc-windres powder-res.rc powder-res.o + i586-mingw32msvc-windres powder-res.rc powder-res.o powder-sse3.exe: $(SOURCES) $(HEADERS) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 - strip $@ - chmod 0644 $@ + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ powder-mt.exe: $(SOURCES) $(HEADERS) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_MT) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS_MTW32) -mwindows -DWIN32 - strip $@ - chmod 0644 $@ + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_MT) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS_MTW32) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ powder-sse2.exe: $(SOURCES) $(HEADERS) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) -powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 - strip $@ - chmod 0644 $@ + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ powder-sse.exe: $(SOURCES) $(HEADERS) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 - strip $@ - chmod 0644 $@ + i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 + strip $@ + chmod 0644 $@ powder-x: $(SOURCES) $(HEADERS) - gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa - strip $@ + gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa + strip $@ powder-x-mt: $(SOURCES) $(HEADERS) - gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa + gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa powder-src.tar.bz2: *.c *.h *.rc *.ico Makefile - mkdir powder-src - cp *.c *.h *.rc *.ico Makefile powder-src/ - tar cfj powder-src.tar.bz2 powder-src - rm -rf powder-src + mkdir powder-src + cp *.c *.h *.rc *.ico Makefile powder-src/ + tar cfj powder-src.tar.bz2 powder-src + rm -rf powder-src release: $(LINUX_TARG) $(WIN32_TARG) powder-src.tar.bz2 - tar cfz powder-linux.tar.gz $(LINUX_TARG) - cp /usr/i586-mingw32msvc/bin/SDL.dll . - zip powder-win32.zip $(WIN32_TARG) SDL.dll - mkdir -p release - mv powder-linux.tar.gz release/ - mv powder-win32.zip release/ - mv powder-src.tar.bz2 -release/ - cp powder-sse.exe powder.exe - rm -f release/powder.zip - zip release/powder.zip powder.exe SDL.dll - cp powder-64-sse2 release/powder64 - rm -f release/powder64.gz - gzip release/powder64 - rm -f release/powder.gz - cp powder-sse release/powder - gzip release/powder - cd release; tar czf powder-bin.tar.gz powder.gz powder64.gz powder-linux.tar.gz powder-win32.zip powder.zip; cd .. - rm -f $(LINUX_TARG) $(WIN32_TARG) SDL.dll powder.exe \ No newline at end of file + tar cfz powder-linux.tar.gz $(LINUX_TARG) + cp /usr/i586-mingw32msvc/bin/SDL.dll ./ + zip powder-win32.zip $(WIN32_TARG) SDL.dll + mkdir -p release + mv powder-linux.tar.gz release/ + mv powder-win32.zip release/ + mv powder-src.tar.bz2 release/ + cp powder-sse.exe powder.exe + rm -f release/powder.zip + zip release/powder.zip powder.exe SDL.dll + cp powder-64-sse2 release/powder64 + rm -f release/powder64.gz + gzip release/powder64 + rm -f release/powder.gz + cp powder-sse release/powder + gzip release/powder + cd release; tar czf powder-bin.tar.gz powder.gz powder64.gz powder-linux.tar.gz powder-win32.zip powder.zip; cd .. + rm -f $(LINUX_TARG) $(WIN32_TARG) SDL.dll powder.exe \ No newline at end of file -- cgit v0.9.2-21-gd62e From d215842080aaf21003879edeed6151387412fa9d Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 11 Aug 2010 18:06:14 +0100 Subject: Stickman - courtesy of savask diff --git a/powder.c b/powder.c index f8a9baa..3b4dfac 100755 --- a/powder.c +++ b/powder.c @@ -550,9 +550,10 @@ struct menu_section msections[] = { #define PT_NBLE 52 #define PT_BTRY 53 #define PT_LCRY 54 -#define PT_SWCH 55 -#define PT_SMKE 56 -#define PT_NUM 57 +#define PT_STKM 55 +#define PT_SWCH 56 +#define PT_SMKE 57 +#define PT_NUM 58 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -614,6 +615,7 @@ const struct part_type ptypes[] = { {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Generates Electricity."}, {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 0, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, }; @@ -679,6 +681,7 @@ const struct part_state pstates[] = { /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2000.0f}, /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; @@ -687,66 +690,67 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = { /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ - /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L */ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C */ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r */ - /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0}, - /* ETRD */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* NICE */ {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - /* NBLE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* BTRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* LCRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S*/ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M*/ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K*/ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y M H E*/ + /* N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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0}, }; @@ -759,6 +763,8 @@ typedef struct { int flags; } particle; particle *parts; +float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index +int isplayer = 0; //It shows is player spawned or not void menu_count(void){ int i=0; @@ -802,6 +808,11 @@ int try_move(int i, int x, int y, int nx, int ny) } return 0; } + + if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide + { + return 1; + } if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]){ return 1; @@ -934,14 +945,19 @@ int create_part(int p, int x, int y, int t) } else i = p; - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = t; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 0; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; + if(t!=PT_STKM) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; +#ifdef HEAT_ENABLE + parts[i].temp = ptypes[t].heat; +#endif + } if(t==PT_ACID){ parts[i].life = 75; } @@ -983,7 +999,46 @@ int create_part(int p, int x, int y, int t) //} } - pmap[y][x] = t|(i<<8); + if(t!=PT_STKM) + pmap[y][x] = t|(i<<8); + else + { + if(isplayer==0) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; +#ifdef HEAT_ENABLE + parts[i].temp = ptypes[t].heat; +#endif + player[2] = PT_DUST; + player[3] = x-1; //Setting legs positions + player[4] = y+6; + player[5] = x-1; + player[6] = y+6; + + player[7] = x-3; + player[8] = y+12; + player[9] = x-3; + player[10] = y+12; + + player[11] = x+1; + player[12] = y+6; + player[13] = x+1; + player[14] = y+6; + + player[15] = x+3; + player[16] = y+12; + player[17] = x+3; + player[18] = y+12; + + isplayer = 1; + } + } return i; } @@ -1016,6 +1071,55 @@ void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } +int sign(float i) //Signum function +{ + if (i<0) + return -1; + if (i>0) + return 1; + return 0; +} + +void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a) //Draws a line +{ + int dx, dy, i, sx, sy, check, e, x, y; + + dx = abs(x1-x2); + dy = abs(y1-y2); + sx = sign(x2-x1); + sy = sign(y2-y1); + x = x1; + y = y1; + check = 0; + + if (dy>dx) + { + dx = dx+dy; + dy = dx-dy; + dx = dx-dy; + check = 1; + } + + e = (dy<<2)-dx; + for (i=0; i<=dx; i++) + { + vid[x+y*a] =PIXRGB(r, g, b); + if (e>=0) + { + if (check==1) + x = x+sx; + else + y = y+sy; + e = e-(dx<<2); + } + if (check==1) + y = y+sy; + else + x = x+sx; + e = e+(dy<<2); + } +} + void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) { pixel t; @@ -1099,7 +1203,11 @@ void set_emap(int x, int y) } int parts_avg(int ci, int ni){ int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; - return parts[(pmr>>8>=NPART)?PT_NONE:pmr>>8].type; + if((pmr>>8)>8].type; + } else { + return PT_NONE; + } } int nearest_part(int ci, int t){ int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); @@ -1122,7 +1230,7 @@ int nearest_part(int ci, int t){ void create_line(int x1, int y1, int x2, int y2, int r, int c); void update_particles_i(pixel *vid, int start, int inc){ int i, j, x, y, t, nx, ny, r, a, cr,cg,cb, s, rt, fe, nt, lpv, nearp, pavg; - float mv, dx, dy, ix, iy, lx, ly; + float mv, dx, dy, ix, iy, lx, ly, d, pp; float pt = R_TEMP; float c_heat = 0.0f; int h_count = 0; @@ -1137,7 +1245,7 @@ void update_particles_i(pixel *vid, int start, int inc){ if(sys_pause) goto justdraw; - if(parts[i].life && t!=PT_ACID && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH) { + if(parts[i].life && t!=PT_ACID && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM) { if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) parts[i].life--; if(parts[i].life<=0 && t!=PT_WIRE && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_HSCN && t!=PT_CSCN && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY) { @@ -1169,14 +1277,14 @@ void update_particles_i(pixel *vid, int start, int inc){ if(x<0 || y<0 || x>=XRES || y>=YRES || - bmap[y/CELL][x/CELL]==1 || + ((bmap[y/CELL][x/CELL]==1 || bmap[y/CELL][x/CELL]==8 || bmap[y/CELL][x/CELL]==9 || (bmap[y/CELL][x/CELL]==2) || (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) { + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) { kill_part(i); continue; } @@ -1837,6 +1945,316 @@ void update_particles_i(pixel *vid, int start, int inc){ continue; } + if(t==PT_STKM) + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; player[10] += 2; player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; player[18] += 2; player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; player[10] += 1; player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; player[18] += 1; player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; player[10] += 2; player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; player[18] += 2; player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; player[10] += 1; player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; player[18] += 1; player[13] -= 1; + } + + } + } + + //Searching for particles near head + //r = 10; + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(pmap[ny+y][nx+x] && (pmap[ny+y][nx+x]&0xFF)!=0xFF + && pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID + //&& (abs(nx-x)+abs(ny-y))>8); + } + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + if(pstates[pmap[ny][nx]&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + parts[pmap[ny][nx]>>8].vx = parts[pmap[ny][nx]>>8].vx + 5*((((int)player[1])&0x02) == 0x02) + - 5*(((int)(player[1])&0x01) == 0x01); + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; player[10] += 1; player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = 0; ny<=2+(int)parts[i].vy; ny++) + { + r = pmap[(int)(player[8]-ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] -= ny+1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + r = pmap[(int)(player[16]-ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] -= ny+1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+1.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && (r&0xFF)!=0xFF) //If on charge + { + parts[i].life -= (int)(rand()/1000)+38; + } + + if ((r&0xFF)!=0xFF) //If hot + { + if(parts[r>>8].temp>=50) + { + parts[i].life -= 5; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+1.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && (r&0xFF)!=0xFF) //If on charge + { + parts[i].life -= (int)(rand()/1000)+38; + } + + if((r&0xFF)!=0xFF) //If hot + { + if(parts[r>>8].temp>=50) + { + parts[i].life -= 5; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } + if(t==PT_CLNE) { if(!parts[i].ctype) { for(nx=-1; nx<2; nx++) @@ -1844,7 +2262,7 @@ void update_particles_i(pixel *vid, int start, int inc){ if(x+nx>=0 && y+ny>0 && x+nx255) parts[i].life = 255; if(parts[i].life<47) parts[i].life = 48; @@ -2296,6 +2732,7 @@ void update_particles(pixel *vid) pthread_t *InterThreads; #endif + isplayer = 0; //Needed for player spawning memset(pmap, 0, sizeof(pmap)); r = rand()%2; for(j=0; j= PT_NUM) goto corrupt; - if(j) { + if(j && !(isplayer == 1 && j==PT_STKM)) { if(pmap[y][x]) { k = pmap[y][x]>>8; parts[k].type = j; @@ -3270,6 +3739,31 @@ int parse_save(void *save, int size, int replace, int x0, int y0) if(i < NPART) { parts[i].vx = (d[p++]-127.0f)/16.0f; parts[i].vy = (d[p++]-127.0f)/16.0f; + if(parts[i].type == PT_STKM) + { + player[2] = PT_DUST; + + player[3] = parts[i].x-1; //Setting legs positions + player[4] = parts[i].y+6; + player[5] = parts[i].x-1; + player[6] = parts[i].y+6; + + player[7] = parts[i].x-3; + player[8] = parts[i].y+12; + player[9] = parts[i].x-3; + player[10] = parts[i].y+12; + + player[11] = parts[i].x+1; + player[12] = parts[i].y+6; + player[13] = parts[i].x+1; + player[14] = parts[i].y+6; + + player[15] = parts[i].x+3; + player[16] = parts[i].y+12; + player[17] = parts[i].x+3; + player[18] = parts[i].y+12; + + } } else p += 2; } @@ -3463,7 +3957,25 @@ pixel *prerender_save(void *save, int size, int *width, int *height) goto corrupt; j=d[p++]; if(j0) - fb[y*w+x] = ptypes[j].pcolors; + { + if(j==PT_STKM) //Stickman should be drawed another way + { + //Stickman drawing + for(k=-2; k<=1; k++) + { + fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); + fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); + fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); + fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); + } + draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); + draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); + draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); + draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); + } + else + fb[y*w+x] = ptypes[j].pcolors; + } } free(d); @@ -8349,4 +8861,4 @@ int main(int argc, char *argv[]) http_done(); return 0; -} \ No newline at end of file +} -- cgit v0.9.2-21-gd62e From 51c8a487bb6a69f157997a621d521ff2f59a9625 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 11 Aug 2010 19:15:20 +0100 Subject: Fix Stickman crashes, update version number diff --git a/powder.c b/powder.c index 3b4dfac..5ac8e33 100755 --- a/powder.c +++ b/powder.c @@ -2060,6 +2060,8 @@ void update_particles_i(pixel *vid, int start, int inc){ for(nx = -2; nx <= 2; nx++) for(ny = 0; ny>=-2; ny--) { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; if(pmap[ny+y][nx+x] && (pmap[ny+y][nx+x]&0xFF)!=0xFF && pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID //&& (abs(nx-x)+abs(ny-y))>8)>8)>8)>8)>8)>8].temp>=50) { @@ -2232,12 +2237,12 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[i].life -= 1; r = pmap[(int)(player[16]+1.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && (r&0xFF)!=0xFF) //If on charge + if((r&0xFF)==PT_SPRK && r && (r>>8)>8)>8].temp>=50) { @@ -2262,7 +2267,8 @@ void update_particles_i(pixel *vid, int start, int inc){ if(x+nx>=0 && y+ny>0 && x+nx Date: Wed, 11 Aug 2010 20:40:24 +0100 Subject: Fixes stickman wall bug and version number diff --git a/powder.c b/powder.c index 5ac8e33..deb0239 100755 --- a/powder.c +++ b/powder.c @@ -2151,7 +2151,7 @@ void update_particles_i(pixel *vid, int start, int inc){ r = pmap[(int)(player[8]-ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) //For left leg - if (r && (r>>8)>8) Date: Thu, 12 Aug 2010 19:11:32 +0100 Subject: Bugfixes for Switch and Stickman, enable Smoke, Speed improvements for search diff --git a/powder.c b/powder.c index deb0239..1bda64d 100755 --- a/powder.c +++ b/powder.c @@ -3,7 +3,6 @@ * * Copyright (c) 2008 - 2010 Stanislaw Skowronek. * Copyright (c) 2010 Simon Robertshaw - * Copyright (c) 2010 Skresanov Savely * Copyright (c) 2010 Bryan Hoyle * * This program is free software; you can redistribute it and/or modify @@ -598,7 +597,7 @@ const struct part_type ptypes[] = { {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "P-Type Silicon, Will transfer current to any conductor."}, {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -205.0f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 2, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f, 0, "Insulator, does not conduct heat or electricity."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f, 0, "Insulator, does not conduct heat or electricity."}, {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f, 255, "Black hole, sucks in other particles and heats up."}, {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f, 255, "White hole, pushes other particles away."}, {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, @@ -760,6 +759,7 @@ typedef struct { int life, ctype; float x, y, vx, vy; float temp; + float pavg[2]; int flags; } particle; particle *parts; @@ -945,6 +945,9 @@ int create_part(int p, int x, int y, int t) } else i = p; + if(t==PT_GLAS){ + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + } if(t!=PT_STKM) { parts[i].x = (float)x; @@ -1203,7 +1206,7 @@ void set_emap(int x, int y) } int parts_avg(int ci, int ni){ int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; - if((pmr>>8)>8) < NPART && (pmr>>8) >= 0){ return parts[pmr>>8].type; } else { return PT_NONE; @@ -1400,8 +1403,15 @@ void update_particles_i(pixel *vid, int start, int inc){ } if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; - if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) - t = parts[i].type = PT_BGLA; + //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) + // t = parts[i].type = PT_BGLA; + if(t==PT_GLAS){ + parts[i].pavg[0] = parts[i].pavg[1]; + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f){ + parts[i].type = PT_BGLA; + } + } if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) t = parts[i].type = PT_SNOW; if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) { @@ -1802,14 +1812,16 @@ void update_particles_i(pixel *vid, int start, int inc){ if((r>>8)>=NPART || !r) continue; rt = parts[r>>8].type; + if(parts_avg(i,r>>8) != PT_INSL){ if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) { parts[r>>8].life = 4; parts[r>>8].ctype = rt; parts[r>>8].type = PT_SPRK; } } + } } - if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) { + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)) || t ==PT_SWCH) { for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && @@ -1877,7 +1889,33 @@ void update_particles_i(pixel *vid, int start, int inc){ } } } + if(rt==PT_SWCH && t==PT_SPRK){ + if(parts[r>>8].life<10&&parts[r>>8].life>0) + parts[r>>8].life--; + pavg = parts_avg(r>>8, i); + if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) + parts[r>>8].life = 10; + if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) + parts[r>>8].life = 9; + if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL){ + parts[r>>8].type = PT_SPRK; + parts[r>>8].ctype = PT_SWCH; + parts[r>>8].life = 4; + } + } + pavg = parts_avg(i, r>>8); + if(t==PT_SWCH&&pavg!= PT_INSL){ + if(parts[r>>8].type == PT_SWCH){ + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0){ + parts[i].life = 9; + } else if(parts[i].life==0&&parts[r>>8].life==10){ + parts[i].life = 10; + } + } + + } pavg = parts_avg(i, r>>8); + if(pavg != PT_INSL){ if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ){ @@ -1926,6 +1964,7 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[r>>8].ctype = rt; } } + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) { parts[i].life = rand()%150+50; @@ -1940,6 +1979,7 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[i].life = 10; } } + } killed: if(parts[i].type == PT_NONE) continue; @@ -2054,6 +2094,12 @@ void update_particles_i(pixel *vid, int start, int inc){ } } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); //Searching for particles near head //r = 10; @@ -2094,17 +2140,16 @@ void update_particles_i(pixel *vid, int start, int inc){ { ny -= 2*(rand()%2)+1; r = pmap[ny][nx]; - if(r && (r>>8)>8].vx = parts[pmap[ny][nx]>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - - 5*(((int)(player[1])&0x01) == 0x01); + if(!((r>>8)>=NPART)){ + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + } } } @@ -2221,7 +2266,7 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[i].life -= (int)(rand()/1000)+38; } - if (r && (r>>8)0 && (r>>8)>8].temp>=50) { @@ -2242,7 +2287,7 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[i].life -= (int)(rand()/1000)+38; } - if(r && (r>>8)0 && (r>>8)>8].temp>=50) { @@ -2279,31 +2324,10 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[i].type = PT_NBLE; parts[i].life = 0; } - //if (t==PT_FIRE && parts[i].life <=1) - //{ - // parts[i].type = PT_SMKE; - // parts[i].life = 0; - //} - if(t==PT_SWCH) + if (t==PT_FIRE && parts[i].life <=1) { - for(nx=-2; nx<3; nx++){ - for(ny=-2; ny<3; ny++){ - r =pmap[y+ny][x+nx]; - pavg = parts_avg(i, r>>8); - if(parts[r>>8].type == PT_SPRK&&abs(nx)+abs(ny)<4) - { - if(parts[r>>8].ctype == PT_PSCN&&pavg != PT_INSL) - parts[i].life = 10; - if(parts[r>>8].ctype == PT_NSCN&&pavg != PT_INSL) - parts[i].life = 0; - if(!(parts[r>>8].ctype == PT_PSCN||parts[r>>8].ctype == PT_NSCN)&&parts[i].life == 10&&pavg != PT_INSL){ - parts[i].type = PT_SPRK; - parts[i].ctype = PT_SWCH; - parts[i].life = 4; - } - } - } - } + t = parts[i].type = PT_SMKE; + parts[i].life = rand()%20+250; } nx = (int)(parts[i].x+0.5f); @@ -2527,6 +2551,28 @@ void update_particles_i(pixel *vid, int start, int inc){ x = nx; y = ny; blendpixel(vid,x,y,17,217,24,255); + } else if(t==PT_SMKE) { + if(cmode == 3||cmode==4) { + x = nx/CELL; + y = ny/CELL; + cg = 10; + cb = 10; + cr = 10; + cg += fire_g[y][x]; if(cg > 50) cg = 50; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > 50) cb = 50; fire_b[y][x] = cb; + cr += fire_r[y][x]; if(cr > 50) cr = 50; fire_r[y][x] = cr; + } else { + for(x=-3;x<4;x++){ + for(y=-3;y<4;y++){ + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,100,100,100,30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,100,100,100,10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,100,100,100,20); + } + } + } } else if(t==PT_THDR) { if(cmode == 3||cmode==4) { vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; @@ -6724,6 +6770,8 @@ int search_ui(pixel *vid_buf) { int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; + int thumb_drawn[GRID_X*GRID_Y]; + pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); float ry; time_t http_last_use=HTTP_TIMEOUT; ui_edit ed; @@ -6744,17 +6792,21 @@ int search_ui(pixel *vid_buf) void *thumb, *data; int thlen, dlen; + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + memset(img_http, 0, sizeof(img_http)); memset(img_id, 0, sizeof(img_id)); memset(search_ids, 0, sizeof(search_ids)); memset(search_names, 0, sizeof(search_names)); - memset(search_scoreup, 0, sizeof(search_scoreup)); - memset(search_scoredown, 0, sizeof(search_scoredown)); + memset(search_scoreup, 0, sizeof(search_scoreup)); + memset(search_scoredown, 0, sizeof(search_scoredown)); memset(search_publish, 0, sizeof(search_publish)); memset(search_owners, 0, sizeof(search_owners)); memset(search_thumbs, 0, sizeof(search_thumbs)); memset(search_thsizes, 0, sizeof(search_thsizes)); + + memset(thumb_drawn, 0, sizeof(thumb_drawn)); do_open = 0; @@ -6789,9 +6841,11 @@ int search_ui(pixel *vid_buf) mmt = 0; else if(mmt=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) mp = pos; @@ -7150,9 +7206,9 @@ int search_ui(pixel *vid_buf) goto finish; } - if(!last) + if(!last){ search = 1; - else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) { + } else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) { search = 1; if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) { search_page = 0; @@ -7194,6 +7250,7 @@ int search_ui(pixel *vid_buf) } if(search_date) strcaturl(uri, " sort:date"); + http = http_async_req_start(http, uri, NULL, 0, 1); if(svf_login){ http_auth_headers(http, svf_user, svf_pass); @@ -7206,8 +7263,11 @@ int search_ui(pixel *vid_buf) http_last_use = time(NULL); results = http_async_req_stop(http, &status, NULL); view_own = last_own; - if(status == 200) + if(status == 200){ page_count = search_results(results, last_own||svf_admin||svf_mod); + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + } is_p1 = (exp_res < GRID_X*GRID_Y); free(results); active = 0; @@ -8684,7 +8744,7 @@ int main(int argc, char *argv[]) } else if((sdl_mod & (KMOD_LALT||KMOD_RALT)) || b==SDL_BUTTON_MIDDLE){ if(y>0 && y0 && x>8)>=NPART || !cr)){ c = sl = cr&0xFF; } else { @@ -8867,4 +8927,4 @@ int main(int argc, char *argv[]) http_done(); return 0; -} +} \ No newline at end of file diff --git a/version.h b/version.h index 872531a..4bb0d65 100755 --- a/version.h +++ b/version.h @@ -21,7 +21,7 @@ #define VERSION_H #define SAVE_VERSION 40 -#define MINOR_VERSION 2 +#define MINOR_VERSION 3 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. #define MENUV3 -- cgit v0.9.2-21-gd62e From c93561a2e5c4f04aef524e4e846474a379b46321 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 12 Aug 2010 19:22:43 +0100 Subject: Bugfixes for Switch and Stickman, enable Smoke, Speed improvements for search diff --git a/powder.c b/powder.c index 1bda64d..90b11be 100755 --- a/powder.c +++ b/powder.c @@ -3,6 +3,7 @@ * * Copyright (c) 2008 - 2010 Stanislaw Skowronek. * Copyright (c) 2010 Simon Robertshaw + * Copyright (c) 2010 Skresanov Savely * Copyright (c) 2010 Bryan Hoyle * * This program is free software; you can redistribute it and/or modify -- cgit v0.9.2-21-gd62e From 1a629e91004f504098c8f30733b18d9c8f2f2b75 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 12 Aug 2010 20:10:59 +0100 Subject: Switch fix diff --git a/powder.c b/powder.c index 90b11be..a09af36 100755 --- a/powder.c +++ b/powder.c @@ -1823,6 +1823,11 @@ void update_particles_i(pixel *vid, int start, int inc){ } } if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)) || t ==PT_SWCH) { + if(t==PT_SWCH) + if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) + { + parts[i].life--; + } for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && @@ -1891,8 +1896,6 @@ void update_particles_i(pixel *vid, int start, int inc){ } } if(rt==PT_SWCH && t==PT_SPRK){ - if(parts[r>>8].life<10&&parts[r>>8].life>0) - parts[r>>8].life--; pavg = parts_avg(r>>8, i); if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) parts[r>>8].life = 10; @@ -1905,17 +1908,6 @@ void update_particles_i(pixel *vid, int start, int inc){ } } pavg = parts_avg(i, r>>8); - if(t==PT_SWCH&&pavg!= PT_INSL){ - if(parts[r>>8].type == PT_SWCH){ - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0){ - parts[i].life = 9; - } else if(parts[i].life==0&&parts[r>>8].life==10){ - parts[i].life = 10; - } - } - - } - pavg = parts_avg(i, r>>8); if(pavg != PT_INSL){ if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8) Date: Thu, 12 Aug 2010 20:21:00 +0100 Subject: More Switch fix diff --git a/powder.c b/powder.c index a09af36..ce4549c 100755 --- a/powder.c +++ b/powder.c @@ -1895,6 +1895,16 @@ void update_particles_i(pixel *vid, int start, int inc){ } } } + pavg = parts_avg(i, r>>8); + if(t==PT_SWCH&&pavg!= PT_INSL){ + if(parts[r>>8].type == PT_SWCH){ + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0){ + parts[i].life = 9; + } else if(parts[i].life==0&&parts[r>>8].life==10){ + parts[i].life = 10; + } + } + } if(rt==PT_SWCH && t==PT_SPRK){ pavg = parts_avg(r>>8, i); if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) -- cgit v0.9.2-21-gd62e From c77c550eac5dc4cc8538b778be57fbf1be5cbe6d Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 13 Aug 2010 12:02:24 +0100 Subject: Fix stickman spawning bug, allows INSL to burn diff --git a/powder.c b/powder.c index ce4549c..8f9c6e8 100755 --- a/powder.c +++ b/powder.c @@ -598,7 +598,7 @@ const struct part_type ptypes[] = { {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "P-Type Silicon, Will transfer current to any conductor."}, {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -205.0f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f, 0, "Insulator, does not conduct heat or electricity."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f, 0, "Insulator, does not conduct heat or electricity."}, {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f, 255, "Black hole, sucks in other particles and heats up."}, {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f, 255, "White hole, pushes other particles away."}, {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, @@ -2151,6 +2151,8 @@ void update_particles_i(pixel *vid, int start, int inc){ else { create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)||(r>>8)<0) parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); } } -- cgit v0.9.2-21-gd62e From e02d78c85d41bb8add66e80a84f8b7b3e3270033 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 13 Aug 2010 12:15:07 +0100 Subject: Fixes my tragic attempt at logic. diff --git a/powder.c b/powder.c index 8f9c6e8..5a34b56 100755 --- a/powder.c +++ b/powder.c @@ -2152,8 +2152,8 @@ void update_particles_i(pixel *vid, int start, int inc){ { create_part(-1, nx, ny, player[2]); r = pmap[ny][nx]; - if(!((r>>8)>=NPART)||(r>>8)<0) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + if( ((r>>8) < NPART) && (r>>8)>=0 ) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); } } } -- cgit v0.9.2-21-gd62e From 48bfba2677292e4502b25f718d252ca009efce5e Mon Sep 17 00:00:00 2001 From: savask Date: Fri, 13 Aug 2010 19:09:24 +0800 Subject: Fixed bug with checking for dangerous particle near foot. Collide code a liitle more logical now. diff --git a/powder.c b/powder.c index 5a34b56..0d4a8f5 100755 --- a/powder.c +++ b/powder.c @@ -2196,9 +2196,9 @@ void update_particles_i(pixel *vid, int start, int inc){ } //Collision checks - for(ny = 0; ny<=2+(int)parts[i].vy; ny++) + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) { - r = pmap[(int)(player[8]-ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) //For left leg if (r && (r&0xFF)!=PT_STKM) @@ -2214,13 +2214,13 @@ void update_particles_i(pixel *vid, int start, int inc){ } else { - player[8] -= ny+1; + player[8] += ny-1; parts[i].vy -= 0.5*parts[i].vy; } player[9] = player[7]; } - r = pmap[(int)(player[16]-ny)][(int)(player[15]+0.5)]; + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; //For right leg if (r && (r&0xFF)!=PT_STKM) @@ -2236,7 +2236,7 @@ void update_particles_i(pixel *vid, int start, int inc){ } else { - player[16] -= ny+1; + player[16] += ny-1; parts[i].vy -= 0.5*parts[i].vy; } player[17] = player[15]; @@ -2265,7 +2265,7 @@ void update_particles_i(pixel *vid, int start, int inc){ } //If legs touch something - r = pmap[(int)(player[8]+1.5)][(int)(player[7]+0.5)]; + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; if((r&0xFF)==PT_SPRK && r && (r>>8)>8) Date: Fri, 13 Aug 2010 22:45:31 +0800 Subject: Added dynamic signs. {t} - temperature, {p} - pressure diff --git a/powder.c b/powder.c index 0d4a8f5..4d49b41 100755 --- a/powder.c +++ b/powder.c @@ -7494,11 +7494,20 @@ int stamp_ui(pixel *vid_buf) void get_sign_pos(int i, int *x0, int *y0, int *w, int *h) { - *w = textwidth(signs[i].text) + 5; - *h = 14; - *x0 = (signs[i].ju == 2) ? signs[i].x - *w : - (signs[i].ju == 1) ? signs[i].x - *w/2 : signs[i].x; - *y0 = (signs[i].y > 18) ? signs[i].y - 18 : signs[i].y + 4; + //Changing width if sign have special content + if(strcmp(signs[i].text, "{p}")==0) + *w = textwidth("Pressure: -000.00"); + + if(strcmp(signs[i].text, "{t}")==0) + *w = textwidth("Temp: 0000.00"); + + //Ususal width + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + *w = textwidth(signs[i].text) + 5; + *h = 14; + *x0 = (signs[i].ju == 2) ? signs[i].x - *w : + (signs[i].ju == 1) ? signs[i].x - *w/2 : signs[i].x; + *y0 = (signs[i].y > 18) ? signs[i].y - 18 : signs[i].y + 4; } void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) @@ -7518,12 +7527,32 @@ void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) void render_signs(pixel *vid_buf) { int i, j, x, y, w, h, dx, dy; + char buff[30]; //Buffer for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature + else + sprintf(buff, "Temp: 0.00"); //...tempirature + drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); + } + + //Usual text + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); x = signs[i].x; y = signs[i].y; dx = 1 - signs[i].ju; -- cgit v0.9.2-21-gd62e From 5960855c328f09538bc04d95c11f1e16b1a3af8e Mon Sep 17 00:00:00 2001 From: savask Date: Sat, 14 Aug 2010 00:48:09 +0800 Subject: Fixed bugs with LN2. Now cold (-30) harms stick man. diff --git a/powder.c b/powder.c index 4d49b41..c003ccd 100755 --- a/powder.c +++ b/powder.c @@ -2042,7 +2042,8 @@ void update_particles_i(pixel *vid, int start, int inc){ //Go left if (((int)(player[0])&0x01) == 0x01) { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID) + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { @@ -2071,7 +2072,8 @@ void update_particles_i(pixel *vid, int start, int inc){ //Go right if (((int)(player[0])&0x02) == 0x02) { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID) + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { @@ -2111,13 +2113,10 @@ void update_particles_i(pixel *vid, int start, int inc){ { if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) continue; - if(pmap[ny+y][nx+x] && (pmap[ny+y][nx+x]&0xFF)!=0xFF - && pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID - //&& (abs(nx-x)+abs(ny-y))>8); } + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) { parts[i].life -= (102-parts[i].life)/2; @@ -2203,7 +2203,7 @@ void update_particles_i(pixel *vid, int start, int inc){ //For left leg if (r && (r&0xFF)!=PT_STKM) { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS) //Liquid checks + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks { if(parts[i].y<(player[8]-10)) parts[i].vy = 1; @@ -2225,7 +2225,7 @@ void update_particles_i(pixel *vid, int start, int inc){ //For right leg if (r && (r&0xFF)!=PT_STKM) { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS) + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) { if(parts[i].y<(player[16]-10)) parts[i].vy = 1; @@ -2271,11 +2271,11 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[i].life -= (int)(rand()/1000)+38; } - if (r>0 && (r>>8)0 && (r>>8)>8].temp>=50) + if(parts[r>>8].temp>=50 || parts[r>>8].temp<=-30) { - parts[i].life -= 5; + parts[i].life -= 2; player[16] -= 1; } } @@ -2292,11 +2292,11 @@ void update_particles_i(pixel *vid, int start, int inc){ parts[i].life -= (int)(rand()/1000)+38; } - if(r>0 && (r>>8)0 && (r>>8)>8].temp>=50) + if(parts[r>>8].temp>=50 || parts[r>>8].temp<=-30) { - parts[i].life -= 5; + parts[i].life -= 2; player[8] -= 1; } } -- cgit v0.9.2-21-gd62e From 854f10924d992d6b0b42150650760685a87c73a7 Mon Sep 17 00:00:00 2001 From: savask Date: Sat, 14 Aug 2010 01:11:03 +0800 Subject: Fixed WHOL and BHOL bug. diff --git a/powder.c b/powder.c index c003ccd..b9e362c 100755 --- a/powder.c +++ b/powder.c @@ -2107,13 +2107,13 @@ void update_particles_i(pixel *vid, int start, int inc){ set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); //Searching for particles near head - //r = 10; for(nx = -2; nx <= 2; nx++) for(ny = 0; ny>=-2; ny--) { if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM) + if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) { player[2] = pmap[ny+y][nx+x]&0xFF; //Current element -- cgit v0.9.2-21-gd62e From 1a724d6f7fd8625986e47ccd13bfb45316c6e7ab Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 15 Aug 2010 12:28:27 +0100 Subject: INSL burnable, pretty water vapour diff --git a/powder.c b/powder.c index b9e362c..a83c041 100755 --- a/powder.c +++ b/powder.c @@ -617,7 +617,7 @@ const struct part_type ptypes[] = { {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 0, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, }; #define ST_NONE 0 @@ -2575,7 +2575,29 @@ void update_particles_i(pixel *vid, int start, int inc){ blendpixel(vid,x+nx,y+ny,100,100,100,10); if (abs(x)+abs(y) == 2) blendpixel(vid,x+nx,y+ny,100,100,100,20); - } + } + } + } + } else if(t==PT_WTRV) { + if(cmode == 3||cmode==4) { + x = nx/CELL; + y = ny/CELL; + cg = PIXG(ptypes[t].pcolors)/3; + cb = PIXB(ptypes[t].pcolors)/3; + cr = PIXR(ptypes[t].pcolors)/3; + cg += fire_g[y][x]; if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; fire_g[y][x] = cg; + cb += fire_b[y][x]; if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; fire_b[y][x] = cb; + cr += fire_r[y][x]; if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; fire_r[y][x] = cr; + } else { + for(x=-3;x<4;x++){ + for(y=-3;y<4;y++){ + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); + } } } } else if(t==PT_THDR) { -- cgit v0.9.2-21-gd62e From 077fbb56ae234b5da54386805f4b77f938618dc2 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 15 Aug 2010 12:54:56 +0100 Subject: Few changes to source and makefile diff --git a/Makefile b/Makefile index 9d8360f..e5b5f9e 100755 --- a/Makefile +++ b/Makefile @@ -10,12 +10,15 @@ MFLAGS_MT := -march=k8 -DX86 -DX86_SSE3 -DMT -msse3 MFLAGS_SSE3 := -march=k8 -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2 MFLAGS_SSE := -march=pentium3 -DX86 -DX86_SSE +FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -O2 -march=k8 -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lpthread -lbz2 COMPILER := gcc LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 WIN32_TARG := powder-sse.exe powder-sse2.exe powder: $(SOURCES) $(HEADERS) $(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 +powder-debug: $(SOURCES) $(HEADERS) + $(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) powder-sse3: $(SOURCES) $(HEADERS) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 @@ -57,7 +60,7 @@ powder-sse.exe: $(SOURCES) $(HEADERS) powder-res.o strip $@ chmod 0644 $@ powder-x: $(SOURCES) $(HEADERS) - gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa + gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -ggdb strip $@ powder-x-mt: $(SOURCES) $(HEADERS) gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa diff --git a/powder.c b/powder.c index a83c041..6ef7608 100755 --- a/powder.c +++ b/powder.c @@ -328,7 +328,7 @@ void *update_air_th(void *arg) return NULL; } -unsigned clamp_flt(float f, float min, float max) +inline unsigned clamp_flt(float f, float min, float max) { if(fmax) @@ -871,7 +871,7 @@ void kill_part(int i) pfree = i; } -int create_part(int p, int x, int y, int t) +inline int create_part(int p, int x, int y, int t) { int i; @@ -1061,7 +1061,7 @@ void delete_part(int x, int y) pmap[y][x] = 0; // just in case } -void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) { pixel t; if(x<0 || y<0 || x>=XRES || y>=YRES) @@ -1205,7 +1205,7 @@ void set_emap(int x, int y) set_emap(x, y+1); } } -int parts_avg(int ci, int ni){ +inline int parts_avg(int ci, int ni){ int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; if((pmr>>8) < NPART && (pmr>>8) >= 0){ return parts[pmr>>8].type; @@ -3457,7 +3457,7 @@ void *build_thumb(int *size, int bzip2) return d; } -void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl) { unsigned char *d,*c=thumb; @@ -4339,7 +4339,7 @@ void del_stamp(int d) #include "font.h" -void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) { pixel t; if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) @@ -4353,7 +4353,7 @@ void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } -int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) { int i, j, w, bn = 0, ba = 0; char *rp = font_data + font_ptrs[c]; -- cgit v0.9.2-21-gd62e From 08a1f64d20726eba11a71296183b11dab2c6dc03 Mon Sep 17 00:00:00 2001 From: savask Date: Sun, 15 Aug 2010 21:08:42 +0800 Subject: Stick man HP now is visible if mouse is in his head. diff --git a/powder.c b/powder.c index 6ef7608..5d223c9 100755 --- a/powder.c +++ b/powder.c @@ -2468,6 +2468,16 @@ void update_particles_i(pixel *vid, int start, int inc){ if(cmode!=CM_HEAT){ if(t==PT_STKM) //Just draw head here { + char buff[10]; //Buffer for HP + int mx, my; //Mouse position + + SDL_GetMouseState(&mx, &my); //Get mouse state for check + if(mx>(nx-3) && mx<(nx+3) && my<(ny+3) && my>(ny-3)) + { + sprintf(buff, "%3d", (int)parts[i].life); + drawtext(vid, mx-8-2*(parts[i].life<100)-2*(parts[i].life<10), my-12, buff, 255, 255, 255, 255); + } + for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p { s = XRES+BARSIZE; @@ -3510,7 +3520,7 @@ int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int p g += PIXG(ptypes[t].pcolors); b += PIXB(ptypes[t].pcolors); a ++; - } + } } if(a) { a = 256/a; @@ -3518,6 +3528,7 @@ int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int p g = (g*a)>>8; b = (b*a)>>8; } + drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); sx++; } -- cgit v0.9.2-21-gd62e From 47189f6c163d7b21a0f2b362ad50f9489ec088fe Mon Sep 17 00:00:00 2001 From: savask Date: Mon, 16 Aug 2010 01:01:20 +0800 Subject: Now stick man is visible in heat view. Bug with zoom fixed. Added 2 variables: mousex and mousey. They hold cursor position. diff --git a/powder.c b/powder.c index 5d223c9..6c0415a 100755 --- a/powder.c +++ b/powder.c @@ -766,6 +766,7 @@ typedef struct { particle *parts; float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index int isplayer = 0; //It shows is player spawned or not +int mousex, mousey = 0; //They contain mouse position void menu_count(void){ int i=0; @@ -2469,27 +2470,25 @@ void update_particles_i(pixel *vid, int start, int inc){ if(t==PT_STKM) //Just draw head here { char buff[10]; //Buffer for HP - int mx, my; //Mouse position - SDL_GetMouseState(&mx, &my); //Get mouse state for check - if(mx>(nx-3) && mx<(nx+3) && my<(ny+3) && my>(ny-3)) + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head { - sprintf(buff, "%3d", (int)parts[i].life); - drawtext(vid, mx-8-2*(parts[i].life<100)-2*(parts[i].life<10), my-12, buff, 255, 255, 255, 255); + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); } for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; - vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; - vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; - vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; - } - draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); - draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); - draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); - draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; + vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; + vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; + vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; + } + draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); + draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); + draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); + draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); isplayer = 1; //It's a secret. Tssss... } @@ -2767,8 +2766,35 @@ void update_particles_i(pixel *vid, int start, int inc){ uint8 R = color_data[caddress]; uint8 G = color_data[caddress+1]; uint8 B = color_data[caddress+2]; - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); - //blendpixel(vid, nx+1, ny, R, G, B, 255); + + if(t==PT_STKM) //Stick man should be visible in heat mode + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); + vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); + vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); + vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); + } + draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); + draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); + draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); + draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); + } + else + { + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); + //blendpixel(vid, nx+1, ny, R, G, B, 255); + } } if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID){ uint8 R = PIXR(ptypes[t].pcolors); @@ -8860,7 +8886,10 @@ int main(int argc, char *argv[]) } if(zoom_en!=1 && !load_mode && !save_mode) + { render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); + mousex = mx/sdl_scale; mousey = my/sdl_scale; + } if(zoom_en) render_zoom(vid_buf); -- cgit v0.9.2-21-gd62e From 13e71cee6d60b692fb057ede892330a4082c3447 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 15 Aug 2010 21:35:40 +0100 Subject: Particle Flags, Removed some HEAT_ENABLES diff --git a/powder.c b/powder.c index 6c0415a..f8d7f86 100755 --- a/powder.c +++ b/powder.c @@ -395,6 +395,7 @@ struct part_type { float heat; unsigned char hconduct; const char *descs; + unsigned char props; }; struct part_state { @@ -558,6 +559,13 @@ struct menu_section msections[] = { #define R_TEMP 22 #define MAX_TEMP 3500 #define MIN_TEMP -273 + +static unsigned char TYPE_PART = 0b0001 << 4; +static unsigned char TYPE_LIQUID = 0b0010 << 4; +static unsigned char TYPE_SOLID = 0b0100 << 4; +static unsigned char TYPE_GAS = 0b1000 << 4; +static unsigned char PROP_CONDUCTS = 0b0001 >> 4; + const struct part_type ptypes[] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, @@ -959,9 +967,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].vy = 0; parts[i].life = 0; parts[i].ctype = 0; -#ifdef HEAT_ENABLE parts[i].temp = ptypes[t].heat; -#endif } if(t==PT_ACID){ parts[i].life = 75; @@ -1017,9 +1023,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].vy = 0; parts[i].life = 100; parts[i].ctype = 0; -#ifdef HEAT_ENABLE parts[i].temp = ptypes[t].heat; -#endif player[2] = PT_DUST; player[3] = x-1; //Setting legs positions player[4] = y+6; -- cgit v0.9.2-21-gd62e From 3bc93478bb2ba0a8ffb2e976f4acd65e743c1a7c Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 15 Aug 2010 21:38:35 +0100 Subject: props -> properties diff --git a/powder.c b/powder.c index f8d7f86..8d63d6f 100755 --- a/powder.c +++ b/powder.c @@ -395,7 +395,7 @@ struct part_type { float heat; unsigned char hconduct; const char *descs; - unsigned char props; + unsigned char properties; }; struct part_state { -- cgit v0.9.2-21-gd62e From c86c224265e9f1048e996f1461f10fa6782da065 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 05:05:08 +0800 Subject: added gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c66d7cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.*.swp +powder-64-sse3 +powder.def +powder-debug +gmon.out -- cgit v0.9.2-21-gd62e From 6bd48d059f3c10c2a3a9e080e3bb91bebab283de Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 17:20:12 +0800 Subject: formatted source code diff --git a/font.h b/font.h old mode 100755 new mode 100644 index 68ac684..ffed995 --- a/font.h +++ b/font.h @@ -19,9 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #define FONT_H 10 -char font_data[] = { - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc7, 0x31, 0x0c, 0x02, 0x70, 0x04, 0x00, 0x00, 0x05, 0xcc, 0x74, 0x23, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x19, 0xcc, 0xe0, 0x3f, 0xcc, 0xf0, 0x2f, 0xcc, 0x90, 0x09, 0x00, 0x00, 0x00, 0x06, 0x30, 0xd0, 0x3f, 0x33, 0xe1, 0x07, 0xf4, 0x12, 0x33, 0xff, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x2d, 0xce, 0xcc, 0xe1, 0x1d, 0xc0, 0x03, 0x74, 0x4b, 0x33, 0xb3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7d, 0x30, 0x0c, 0x13, 0xd0, 0x32, 0xb3, 0x33, 0x1c, 0x7d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x4c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x34, 0x1d, 0x07, 0x03, 0x07, 0x1d, 0x34, 0x00, 0x00, 0x00, 0x04, 0x07, 0x1d, 0x34, 0x30, 0x34, 0x1d, 0x07, 0x00, 0x00, 0x00, 0x06, 0x44, 0xd0, 0x1c, 0x64, 0xf0, 0x3f, 0x64, 0xd0, 0x1c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x02, 0x30, 0xe0, 0x2f, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x06, 0x80, 0x02, 0x0c, 0xa0, 0x00, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, 0xe0, 0x39, 0x07, 0x33, 0x32, 0x03, 0xb3, 0x38, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x30, 0xf0, 0x60, 0x03, 0x0c, 0x30, 0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x41, 0x03, 0x0a, 0x2c, 0x70, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0x71, 0x34, 0x01, 0x03, 0x1e, 0x00, 0x33, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xc0, 0x03, 0x37, 0x1c, 0x73, 0x34, 0xbf, 0x03, 0x30, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x00, 0x57, 0xe0, 0x2f, 0x00, 0x13, 0x30, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd3, 0x00, 0x07, 0xf0, 0x1f, 0x03, 0x33, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x07, 0x34, 0x80, 0x03, 0x0e, 0x38, 0xd0, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xd3, 0x1f, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xc3, 0x3f, 0x40, 0x23, 0x30, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x70, 0x04, 0x40, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc0, 0xc3, 0x0b, 0x1b, 0xc0, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x0f, 0x90, 0x83, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfd, 0x71, 0x30, 0x81, 0x03, 0x0e, 0x34, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0x0f, 0x1d, 0x30, 0xe7, 0x37, 0x73, 0x1c, 0xe3, 0x2f, 0x07, 0x00, 0xfd, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x74, 0xd0, 0x1d, 0x47, 0x33, 0x30, 0xff, 0x33, 0x30, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xbf, 0x30, 0x38, 0x43, 0xf3, 0x1f, 0x43, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x31, 0x00, 0x03, 0x70, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x33, 0x30, 0x03, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x32, 0x00, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x10, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x10, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x30, 0x3e, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x47, 0x33, 0x30, 0x03, 0xf3, 0x3f, 0x03, 0x33, 0x30, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x06, 0xd0, 0x01, 0x0c, 0xc0, 0x00, 0x0c, 0xc0, 0x10, 0x0d, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0xc3, 0x34, 0x70, 0x03, 0xbc, 0x00, 0xb3, 0xc0, 0xb0, 0x70, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x30, 0x10, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x1f, 0x3d, 0x7b, 0x3b, 0xe3, 0x32, 0x83, 0x30, 0x03, 0x30, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0xcd, 0x03, 0x73, 0xc3, 0x8c, 0x32, 0xc3, 0xcd, 0xc0, 0x33, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xc7, 0x71, 0xd0, 0x0c, 0x30, 0x03, 0xcd, 0xd1, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x73, 0x34, 0xff, 0x31, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xd3, 0x71, 0xd0, 0x0c, 0x30, 0xc3, 0xcd, 0xd1, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x31, 0x34, 0x03, 0xf3, 0x0f, 0xd7, 0x30, 0x34, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x31, 0x07, 0xd0, 0x0f, 0x90, 0x23, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x13, 0x13, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xcc, 0x00, 0x33, 0xc0, 0x0c, 0x30, 0x03, 0xcd, 0xd2, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x33, 0x30, 0x03, 0xb3, 0x38, 0xcd, 0xc1, 0x0d, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x43, 0x30, 0xc7, 0x34, 0xcd, 0x1c, 0xed, 0x1e, 0x2c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0x4c, 0xc3, 0x81, 0x3b, 0xd0, 0x03, 0xdc, 0x42, 0xc3, 0x31, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0xb3, 0x38, 0xdc, 0x40, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xd0, 0x02, 0x2c, 0xc0, 0x02, 0x2d, 0xc0, 0x06, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x2f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x30, 0x80, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x37, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x47, 0x30, 0xfc, 0x0c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x07, 0x0c, 0xf0, 0xc7, 0x35, 0xc3, 0x0c, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc3, 0x25, 0x03, 0x4c, 0xd2, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd0, 0x00, 0x83, 0x8f, 0x33, 0xc3, 0x1c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xbf, 0x0c, 0xd0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3d, 0x07, 0x03, 0x2f, 0x03, 0x03, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xcb, 0x32, 0xc3, 0xf4, 0x03, 0x4c, 0x30, 0x7e, 0x00, 0x00, 0x05, 0x03, 0x0c, 0xf0, 0xc7, 0x39, 0xc3, 0x0c, 0x73, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x1c, 0x00, 0x0d, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x30, 0x00, 0x34, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x05, 0x03, 0x0c, 0x31, 0xce, 0x0e, 0x1f, 0xcc, 0x31, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x47, 0x3d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x9b, 0x71, 0x37, 0x33, 0x33, 0x32, 0x43, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x0c, 0x33, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x31, 0xc3, 0x4c, 0xd3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x4c, 0xf3, 0xc7, 0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xdf, 0x31, 0xc3, 0x4c, 0xd3, 0x0f, 0x30, 0xc0, 0x00, 0x05, 0x03, 0x00, 0x30, 0x7f, 0xc7, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xc7, 0x10, 0x3c, 0x04, 0xf3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x1c, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x70, 0xdc, 0x30, 0xc3, 0x4c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xd3, 0xdc, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x33, 0x32, 0x33, 0x73, 0x37, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcd, 0x32, 0x7d, 0x8c, 0x73, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xc7, 0x74, 0x43, 0x07, 0x0c, 0x1f, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x4f, 0x2c, 0x2c, 0x2c, 0xf1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x04, 0x38, 0x0c, 0x0c, 0x03, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x02, 0x32, 0x33, 0x33, 0x13, 0x00, 0x04, 0x0b, 0x0c, 0x0c, 0x30, 0x0c, 0x0c, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x72, 0x37, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, 0x07, 0xff, 0x1f, 0xff, 0x7f, 0xff, 0x1b, 0xbf, 0x01, 0x1b, 0x00, 0x0c, 0x00, 0x40, 0xff, 0x00, 0x00, 0xf8, 0xf0, 0x3f, 0xee, 0x2c, 0x30, 0xcb, 0x0b, 0x30, 0x42, 0xc3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xf3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xff, 0x3f, 0x00, 0x0c, 0xc2, 0x00, 0x00, 0xcb, 0x00, 0x00, 0xee, 0xc0, 0xff, 0xf8, 0xb0, 0xc0, 0xff, 0x2c, 0xc0, 0x00, 0x0c, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xcc, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0x0d, 0x00, 0x70, 0x00, 0x00, 0xf3, 0xff, 0xd3, 0x03, 0xe0, 0x3c, 0x3f, 0x38, 0x03, 0xd0, 0x33, 0xff, 0x38, 0x03, 0xe0, 0xf0, 0xff, 0x03, 0x0c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x8b, 0xf7, 0x0c, 0x13, 0x9f, 0x3b, 0x37, 0x00, 0xc0, 0x23, 0xff, 0xff, 0x8b, 0x03, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0x03, 0x2c, 0x0d, 0x00, 0x37, 0x00, 0xc0, 0xf3, 0xff, 0x3c, 0xff, 0xcf, 0x03, 0x00, 0xdc, 0x00, 0x70, 0x38, 0xc0, 0x02, 0xfd, 0x07, 0x0a, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xf0, 0xff, 0xc0, 0xff, 0x3f, 0xfc,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 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0xff, 0x2f, 0xfd, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0xf8, 0xff, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x01, 0x00, 0x02, 0x00, 0xc8, 0x07, 0x10, 0xc3, 0x00, 0x31, 0x0d, 0x00, 0xfd, 0x01, 0x00, 0x74, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x0a, 0x40, 0x05, 0x80, 0xff, 0x8b, 0x1e, 0xd0, 0x2e, 0x00, 0xf0, 0x00, 0xe0, 0xff, 0x0b, 0x00, 0x0f, 0x00, 0xb8, 0x03, 0xb0, 0xe2, 0xff, 0x02, 0x50, 0x01, 0x08, 0xff, 0x07, 0x03, 0x1e, 0x03, 0x73, 0x03, 0xef, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x2f, 0xe0, 0x1b, 0x0c, 0x1d, 0x00, 0xff, 0x03, 0xbe, 0xf0, 0xc1, 0x01, 0xad, 0x34, 0xc0, 0x36, 0x0b, 0x30, 0xdc, 0xe4, 0x07, 0xfd, 0x1b, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0xa0, 0xaa, 0x00, 0xa8, 0xc2, 0x0f, 0x2a, 0xff, 0x03, 0xca, 0x3f, 0x80, 0xfc, 0x0f, 0x20, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x07, 0xaa, 0xea, 0x1f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xaa, 0xea, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x03, 0x00, 0xd0, 0x03, 0x00, 0xf4, 0xab, 0xaa, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xf4, 0xab, 0xaa, 0xd0, 0x03, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x09, 0xfe, 0xff, 0xe3, 0xff, 0x0f, 0xaa, 0x3e, 0x0a, 0xf8, 0x2e, 0xe0, 0xbf, 0x80, 0xff, 0xaa, 0xfe, 0xff, 0xe2, 0xff, 0x02, 0x02, 0x00, 0x00, 0x09, 0x00, 0x80, 0x04, 0xd0, 0xe2, 0xff, 0x02, 0x00, 0x00, 0xff, 0x6f, 0x00, 0x40, 0xe6, 0xaf, 0x50, 0x00, 0x09, 0x00, 0x20, 0x00, 0x64, 0x00, 0x09, 0xe0, 0x3f, 0x70, 0x60, 0x63, 0xc0, 0xe4, 0x80, 0xc2, 0x03, 0x07, 0x0f, 0x1e, 0x6c, 0xff, 0x27, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x09, 0x44, 0x44, 0x00, 0x12, 0x41, 0x88, 0x04, 0x21, 0x21, 0x84, 0x48, 0x20, 0x23, 0xc2, 0xcc, 0x08, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x1d, 0x00, 0x78, 0x00, 0xb4, 0x07, 0xf0, 0x2f, 0xc0, 0xfb, 0x00, 0xbe, 0x02, 0xf4, 0x07, 0xfd, 0xff, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0x00, 0x19, 0x00, 0xa8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf0, 0xdc, 0xcb, 0x03, 0x00, 0xff, 0xff, 0x4f, 0x07, 0x40, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0xff, 0x3f, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0x07, 0x00, 0xbd, 0x02, 0xe8, 0xb3, 0xe0, 0x3c, 0xac, 0xc3, 0x03, 0x0f, 0x3c, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x0b, 0xc0, 0xc8, 0xc0, 0x91, 0x1b, 0xcd, 0x36, 0xe7, 0x00, 0x47, 0x03, 0xa7, 0x80, 0x36, 0xfd, 0xff, 0xc1, 0x9b, 0xf9, 0xb8, 0xb8, 0xb8, 0xb7, 0x99, 0xf7, 0xff, 0xff, 0x0f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x03, 0x00, 0xfc, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0xff, 0x3f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0xcf, 0xff, 0xff, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1f, 0xcb, 0x30, 0xc3, 0x3f, 0xc7, 0x00, 0x7e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0xc3, 0xfc, 0x33, 0x0c, 0x24, 0xc3, 0xc0, 0x31, 0x0c, 0x06, 0xc3, 0x30, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0xff, 0x3f, 0x30, 0x00, 0x03, 0xc3, 0x30, 0x30, 0x3f, 0xff, 0xff, 0x3f, 0x3c, 0x00, 0xff, 0xff, 0xff, 0x0c, 0x0c, 0xc3, 0xc0, 0x00, 0x0c, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x3c, 0x00, 0xc0, 0x03, 0xf0, 0x3f, 0x00, 0xff, 0x03, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xb8, 0xec, 0x9b, 0xf9, 0xbf, 0xf8, 0xbf, 0x99, 0xef, 0xb8, 0x2c, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x87, 0x87, 0xc3, 0x30, 0x0c, 0xe3, 0xde, 0x01, 0x03, 0x74, 0xbb, 0x0c, 0xc3, 0x30, 0x2c, 0x2d, 0x0d, 0x05, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x34, 0xc3, 0x0c, 0x73, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x39, 0xc0, 0x00, 0x43, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0x60, 0x60, 0x60, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0xb8, 0x00, 0x23, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x36, 0xc6, 0xfc, 0x03, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xcb, 0x00, 0x7f, 0x40, 0x13, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xcb, 0x10, 0x2f, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x0f, 0x30, 0x60, 0x60, 0xc0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0x7d, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xc6, 0xe0, 0x03, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x03, 0xc0, 0xf0, 0x3c, 0xcf, 0xf3, 0x3c, 0x03, 0x00, 0x03, 0x00, 0xcc, 0xf3, 0x3c, 0xcf, 0xf3, 0x30, 0x00, 0x05, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x30, 0xc0, 0x0f, 0x30, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0xd0, 0x7f, 0x40, 0xff, 0x1f, 0xfc, 0xff, 0x43, 0xff, 0x1f, 0x40, 0x15, 0x00, 0x00, 0x00, 0x0a, 0xe4, 0x06, 0x90, 0x91, 0x01, 0x06, 0x24, 0x30, 0x90, 0x1b, 0x46, 0x6e, 0x96, 0xb9, 0x91, 0xe4, 0x06, 0x0c, 0x18, 0x90, 0x40, 0x46, 0x06, 0x90, 0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x02, 0xc2, 0xab, 0xaa, 0x3e, 0x20, 0xe0, 0xab, 0xaa, 0x3e, 0x02, 0xc2, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x02, 0xc0, 0x30, 0x00, 0x0c, 0x03, 0xf0, 0xff, 0x00, 0xfe, 0x0b, 0xd0, 0x7f, 0x00, 0xa4, 0x01, 0x00, 0x0a, 0x00, 0xa0, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x81, 0x24, 0x10, 0x85, 0x00, 0x20, 0x66, 0x40, 0x15, 0x45, 0x62, 0x90, 0x4d, 0xd0, 0xf1, 0x23, 0x01, 0xfd, 0x41, 0x41, 0x07, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x00, 0xf8, 0x02, 0xd0, 0x7f, 0x00, 0xfe, 0x0b, 0xf0, 0xff, 0x00, 0xff, 0x0f, 0xd0, 0x7f, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0xd4, 0x01, 0xd0, 0x06, 0x40, 0x7f, 0x00, 0xfd, 0x01, 0xf4, 0x07, 0xd0, 0x1f, 0x00, 0x7f, 0x00, 0xd0, 0x01, 0x00, 0x0a, 0x40, 0x15, 0x00, 0xfe, 0x0b, 0x88, 0x2f, 0x52, 0xf0, 0x50, 0x01, 0x0a, 0xd4, 0xaf, 0x7f, 0xfd, 0xf5, 0xc7, 0x0b, 0x3e, 0x70, 0xd0, 0x00, 0xa4, 0x01, 0x0a, 0x80, 0x2f, 0x80, 0x5f, 0x2f, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x01, 0x34, 0x34, 0xc0, 0x01, 0x07, 0x0d, 0xd0, 0x75, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xf4, 0x01, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xe0, 0xef, 0x00, 0xbb, 0x0b, 0xa0, 0xaa, 0x00, 0xaa, 0x0a, 0x80, 0x19, 0x00, 0x64, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x2d, 0x80, 0xe7, 0x0b, 0xbe, 0xf8, 0xfa, 0x02, 0xfe, 0x0b, 0x80, 0x2f, 0x00, 0x50, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xaf, 0x2f, 0xbe, 0xe0, 0xdb, 0x02, 0x78, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x50, 0xfe, 0x5b, 0xfd, 0xff, 0x47, 0xff, 0x1f, 0xe0, 0xbf, 0x00, 0xfe, 0x0b, 0xf0, 0xf5, 0x40, 0x01, 0x14, 0x0a, 0x40, 0x1a, 0x00, 0x09, 0x06, 0x20, 0x80, 0x00, 0x02, 0x08, 0xfc, 0xff, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x0a, 0xf0, 0xff, 0x00, 0xaa, 0x0a, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xff, 0xed, 0xff, 0xe1, 0xdf, 0xe1, 0x2f, 0xe1, 0xef, 0xe2, 0x2f, 0xef, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x0a, 0xc0, 0x31, 0x00, 0x30, 0x01, 0x40, 0x34, 0x00, 0xcc, 0x00, 0x00, 0x0a, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xff, 0x2f, 0xfe, 0xff, 0xfb, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x80, 0xff, 0x2f, 0xfc, 0xff, 0xc3, 0x07, 0x3d, 0x3c, 0xc0, 0xc3, 0x03, 0x3c, 0x7c, 0xd0, 0xc3, 0xff, 0x3f, 0xf8, 0xff, 0x02, 0x00, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x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 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, +char font_data[] = +{ + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc7, 0x31, 0x0c, 0x02, 0x70, 0x04, 0x00, 0x00, 0x05, 0xcc, 0x74, 0x23, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x19, 0xcc, 0xe0, 0x3f, 0xcc, 0xf0, 0x2f, 0xcc, 0x90, 0x09, 0x00, 0x00, 0x00, 0x06, 0x30, 0xd0, 0x3f, 0x33, 0xe1, 0x07, 0xf4, 0x12, 0x33, 0xff, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x2d, 0xce, 0xcc, 0xe1, 0x1d, 0xc0, 0x03, 0x74, 0x4b, 0x33, 0xb3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7d, 0x30, 0x0c, 0x13, 0xd0, 0x32, 0xb3, 0x33, 0x1c, 0x7d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x4c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x34, 0x1d, 0x07, 0x03, 0x07, 0x1d, 0x34, 0x00, 0x00, 0x00, 0x04, 0x07, 0x1d, 0x34, 0x30, 0x34, 0x1d, 0x07, 0x00, 0x00, 0x00, 0x06, 0x44, 0xd0, 0x1c, 0x64, 0xf0, 0x3f, 0x64, 0xd0, 0x1c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x02, 0x30, 0xe0, 0x2f, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x06, 0x80, 0x02, 0x0c, 0xa0, 0x00, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, 0xe0, 0x39, 0x07, 0x33, 0x32, 0x03, 0xb3, 0x38, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x30, 0xf0, 0x60, 0x03, 0x0c, 0x30, 0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x41, 0x03, 0x0a, 0x2c, 0x70, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0x71, 0x34, 0x01, 0x03, 0x1e, 0x00, 0x33, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xc0, 0x03, 0x37, 0x1c, 0x73, 0x34, 0xbf, 0x03, 0x30, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x00, 0x57, 0xe0, 0x2f, 0x00, 0x13, 0x30, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd3, 0x00, 0x07, 0xf0, 0x1f, 0x03, 0x33, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x07, 0x34, 0x80, 0x03, 0x0e, 0x38, 0xd0, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xd3, 0x1f, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xc3, 0x3f, 0x40, 0x23, 0x30, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x70, 0x04, 0x40, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc0, 0xc3, 0x0b, 0x1b, 0xc0, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x0f, 0x90, 0x83, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfd, 0x71, 0x30, 0x81, 0x03, 0x0e, 0x34, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0x0f, 0x1d, 0x30, 0xe7, 0x37, 0x73, 0x1c, 0xe3, 0x2f, 0x07, 0x00, 0xfd, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x74, 0xd0, 0x1d, 0x47, 0x33, 0x30, 0xff, 0x33, 0x30, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xbf, 0x30, 0x38, 0x43, 0xf3, 0x1f, 0x43, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x31, 0x00, 0x03, 0x70, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x33, 0x30, 0x03, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x32, 0x00, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x10, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x10, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x30, 0x3e, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x47, 0x33, 0x30, 0x03, 0xf3, 0x3f, 0x03, 0x33, 0x30, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x06, 0xd0, 0x01, 0x0c, 0xc0, 0x00, 0x0c, 0xc0, 0x10, 0x0d, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0xc3, 0x34, 0x70, 0x03, 0xbc, 0x00, 0xb3, 0xc0, 0xb0, 0x70, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x30, 0x10, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x1f, 0x3d, 0x7b, 0x3b, 0xe3, 0x32, 0x83, 0x30, 0x03, 0x30, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0xcd, 0x03, 0x73, 0xc3, 0x8c, 0x32, 0xc3, 0xcd, 0xc0, 0x33, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xc7, 0x71, 0xd0, 0x0c, 0x30, 0x03, 0xcd, 0xd1, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x73, 0x34, 0xff, 0x31, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xd3, 0x71, 0xd0, 0x0c, 0x30, 0xc3, 0xcd, 0xd1, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x31, 0x34, 0x03, 0xf3, 0x0f, 0xd7, 0x30, 0x34, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x31, 0x07, 0xd0, 0x0f, 0x90, 0x23, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x13, 0x13, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xcc, 0x00, 0x33, 0xc0, 0x0c, 0x30, 0x03, 0xcd, 0xd2, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x33, 0x30, 0x03, 0xb3, 0x38, 0xcd, 0xc1, 0x0d, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x43, 0x30, 0xc7, 0x34, 0xcd, 0x1c, 0xed, 0x1e, 0x2c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0x4c, 0xc3, 0x81, 0x3b, 0xd0, 0x03, 0xdc, 0x42, 0xc3, 0x31, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0xb3, 0x38, 0xdc, 0x40, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xd0, 0x02, 0x2c, 0xc0, 0x02, 0x2d, 0xc0, 0x06, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x2f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x30, 0x80, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x37, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x47, 0x30, 0xfc, 0x0c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x07, 0x0c, 0xf0, 0xc7, 0x35, 0xc3, 0x0c, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc3, 0x25, 0x03, 0x4c, 0xd2, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd0, 0x00, 0x83, 0x8f, 0x33, 0xc3, 0x1c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xbf, 0x0c, 0xd0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3d, 0x07, 0x03, 0x2f, 0x03, 0x03, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xcb, 0x32, 0xc3, 0xf4, 0x03, 0x4c, 0x30, 0x7e, 0x00, 0x00, 0x05, 0x03, 0x0c, 0xf0, 0xc7, 0x39, 0xc3, 0x0c, 0x73, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x1c, 0x00, 0x0d, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x30, 0x00, 0x34, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x05, 0x03, 0x0c, 0x31, 0xce, 0x0e, 0x1f, 0xcc, 0x31, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x47, 0x3d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x9b, 0x71, 0x37, 0x33, 0x33, 0x32, 0x43, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x0c, 0x33, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x31, 0xc3, 0x4c, 0xd3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x4c, 0xf3, 0xc7, 0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xdf, 0x31, 0xc3, 0x4c, 0xd3, 0x0f, 0x30, 0xc0, 0x00, 0x05, 0x03, 0x00, 0x30, 0x7f, 0xc7, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xc7, 0x10, 0x3c, 0x04, 0xf3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x1c, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x70, 0xdc, 0x30, 0xc3, 0x4c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xd3, 0xdc, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x33, 0x32, 0x33, 0x73, 0x37, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcd, 0x32, 0x7d, 0x8c, 0x73, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xc7, 0x74, 0x43, 0x07, 0x0c, 0x1f, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x4f, 0x2c, 0x2c, 0x2c, 0xf1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x04, 0x38, 0x0c, 0x0c, 0x03, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x02, 0x32, 0x33, 0x33, 0x13, 0x00, 0x04, 0x0b, 0x0c, 0x0c, 0x30, 0x0c, 0x0c, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x72, 0x37, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, 0x07, 0xff, 0x1f, 0xff, 0x7f, 0xff, 0x1b, 0xbf, 0x01, 0x1b, 0x00, 0x0c, 0x00, 0x40, 0xff, 0x00, 0x00, 0xf8, 0xf0, 0x3f, 0xee, 0x2c, 0x30, 0xcb, 0x0b, 0x30, 0x42, 0xc3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xf3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xff, 0x3f, 0x00, 0x0c, 0xc2, 0x00, 0x00, 0xcb, 0x00, 0x00, 0xee, 0xc0, 0xff, 0xf8, 0xb0, 0xc0, 0xff, 0x2c, 0xc0, 0x00, 0x0c, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xcc, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0x0d, 0x00, 0x70, 0x00, 0x00, 0xf3, 0xff, 0xd3, 0x03, 0xe0, 0x3c, 0x3f, 0x38, 0x03, 0xd0, 0x33, 0xff, 0x38, 0x03, 0xe0, 0xf0, 0xff, 0x03, 0x0c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x8b, 0xf7, 0x0c, 0x13, 0x9f, 0x3b, 0x37, 0x00, 0xc0, 0x23, 0xff, 0xff, 0x8b, 0x03, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0x03, 0x2c, 0x0d, 0x00, 0x37, 0x00, 0xc0, 0xf3, 0xff, 0x3c, 0xff, 0xcf, 0x03, 0x00, 0xdc, 0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 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb8, 0xe0, 0x2f, 0xff, 0xe3, 0x2f, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0xff, 0x2f, 0xfd, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0xf8, 0xff, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x01, 0x00, 0x02, 0x00, 0xc8, 0x07, 0x10, 0xc3, 0x00, 0x31, 0x0d, 0x00, 0xfd, 0x01, 0x00, 0x74, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x0a, 0x40, 0x05, 0x80, 0xff, 0x8b, 0x1e, 0xd0, 0x2e, 0x00, 0xf0, 0x00, 0xe0, 0xff, 0x0b, 0x00, 0x0f, 0x00, 0xb8, 0x03, 0xb0, 0xe2, 0xff, 0x02, 0x50, 0x01, 0x08, 0xff, 0x07, 0x03, 0x1e, 0x03, 0x73, 0x03, 0xef, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x2f, 0xe0, 0x1b, 0x0c, 0x1d, 0x00, 0xff, 0x03, 0xbe, 0xf0, 0xc1, 0x01, 0xad, 0x34, 0xc0, 0x36, 0x0b, 0x30, 0xdc, 0xe4, 0x07, 0xfd, 0x1b, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0xa0, 0xaa, 0x00, 0xa8, 0xc2, 0x0f, 0x2a, 0xff, 0x03, 0xca, 0x3f, 0x80, 0xfc, 0x0f, 0x20, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x07, 0xaa, 0xea, 0x1f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xaa, 0xea, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x03, 0x00, 0xd0, 0x03, 0x00, 0xf4, 0xab, 0xaa, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xf4, 0xab, 0xaa, 0xd0, 0x03, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x09, 0xfe, 0xff, 0xe3, 0xff, 0x0f, 0xaa, 0x3e, 0x0a, 0xf8, 0x2e, 0xe0, 0xbf, 0x80, 0xff, 0xaa, 0xfe, 0xff, 0xe2, 0xff, 0x02, 0x02, 0x00, 0x00, 0x09, 0x00, 0x80, 0x04, 0xd0, 0xe2, 0xff, 0x02, 0x00, 0x00, 0xff, 0x6f, 0x00, 0x40, 0xe6, 0xaf, 0x50, 0x00, 0x09, 0x00, 0x20, 0x00, 0x64, 0x00, 0x09, 0xe0, 0x3f, 0x70, 0x60, 0x63, 0xc0, 0xe4, 0x80, 0xc2, 0x03, 0x07, 0x0f, 0x1e, 0x6c, 0xff, 0x27, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x09, 0x44, 0x44, 0x00, 0x12, 0x41, 0x88, 0x04, 0x21, 0x21, 0x84, 0x48, 0x20, 0x23, 0xc2, 0xcc, 0x08, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x1d, 0x00, 0x78, 0x00, 0xb4, 0x07, 0xf0, 0x2f, 0xc0, 0xfb, 0x00, 0xbe, 0x02, 0xf4, 0x07, 0xfd, 0xff, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0x00, 0x19, 0x00, 0xa8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf0, 0xdc, 0xcb, 0x03, 0x00, 0xff, 0xff, 0x4f, 0x07, 0x40, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0xff, 0x3f, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0x07, 0x00, 0xbd, 0x02, 0xe8, 0xb3, 0xe0, 0x3c, 0xac, 0xc3, 0x03, 0x0f, 0x3c, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x0b, 0xc0, 0xc8, 0xc0, 0x91, 0x1b, 0xcd, 0x36, 0xe7, 0x00, 0x47, 0x03, 0xa7, 0x80, 0x36, 0xfd, 0xff, 0xc1, 0x9b, 0xf9, 0xb8, 0xb8, 0xb8, 0xb7, 0x99, 0xf7, 0xff, 0xff, 0x0f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x03, 0x00, 0xfc, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0xff, 0x3f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0xcf, 0xff, 0xff, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1f, 0xcb, 0x30, 0xc3, 0x3f, 0xc7, 0x00, 0x7e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0xc3, 0xfc, 0x33, 0x0c, 0x24, 0xc3, 0xc0, 0x31, 0x0c, 0x06, 0xc3, 0x30, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0xff, 0x3f, 0x30, 0x00, 0x03, 0xc3, 0x30, 0x30, 0x3f, 0xff, 0xff, 0x3f, 0x3c, 0x00, 0xff, 0xff, 0xff, 0x0c, 0x0c, 0xc3, 0xc0, 0x00, 0x0c, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x3c, 0x00, 0xc0, 0x03, 0xf0, 0x3f, 0x00, 0xff, 0x03, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xb8, 0xec, 0x9b, 0xf9, 0xbf, 0xf8, 0xbf, 0x99, 0xef, 0xb8, 0x2c, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x87, 0x87, 0xc3, 0x30, 0x0c, 0xe3, 0xde, 0x01, 0x03, 0x74, 0xbb, 0x0c, 0xc3, 0x30, 0x2c, 0x2d, 0x0d, 0x05, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x34, 0xc3, 0x0c, 0x73, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x39, 0xc0, 0x00, 0x43, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0x60, 0x60, 0x60, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0xb8, 0x00, 0x23, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x36, 0xc6, 0xfc, 0x03, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xcb, 0x00, 0x7f, 0x40, 0x13, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xcb, 0x10, 0x2f, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x0f, 0x30, 0x60, 0x60, 0xc0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0x7d, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xc6, 0xe0, 0x03, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x03, 0xc0, 0xf0, 0x3c, 0xcf, 0xf3, 0x3c, 0x03, 0x00, 0x03, 0x00, 0xcc, 0xf3, 0x3c, 0xcf, 0xf3, 0x30, 0x00, 0x05, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x30, 0xc0, 0x0f, 0x30, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0xd0, 0x7f, 0x40, 0xff, 0x1f, 0xfc, 0xff, 0x43, 0xff, 0x1f, 0x40, 0x15, 0x00, 0x00, 0x00, 0x0a, 0xe4, 0x06, 0x90, 0x91, 0x01, 0x06, 0x24, 0x30, 0x90, 0x1b, 0x46, 0x6e, 0x96, 0xb9, 0x91, 0xe4, 0x06, 0x0c, 0x18, 0x90, 0x40, 0x46, 0x06, 0x90, 0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x02, 0xc2, 0xab, 0xaa, 0x3e, 0x20, 0xe0, 0xab, 0xaa, 0x3e, 0x02, 0xc2, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x02, 0xc0, 0x30, 0x00, 0x0c, 0x03, 0xf0, 0xff, 0x00, 0xfe, 0x0b, 0xd0, 0x7f, 0x00, 0xa4, 0x01, 0x00, 0x0a, 0x00, 0xa0, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x81, 0x24, 0x10, 0x85, 0x00, 0x20, 0x66, 0x40, 0x15, 0x45, 0x62, 0x90, 0x4d, 0xd0, 0xf1, 0x23, 0x01, 0xfd, 0x41, 0x41, 0x07, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x00, 0xf8, 0x02, 0xd0, 0x7f, 0x00, 0xfe, 0x0b, 0xf0, 0xff, 0x00, 0xff, 0x0f, 0xd0, 0x7f, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0xd4, 0x01, 0xd0, 0x06, 0x40, 0x7f, 0x00, 0xfd, 0x01, 0xf4, 0x07, 0xd0, 0x1f, 0x00, 0x7f, 0x00, 0xd0, 0x01, 0x00, 0x0a, 0x40, 0x15, 0x00, 0xfe, 0x0b, 0x88, 0x2f, 0x52, 0xf0, 0x50, 0x01, 0x0a, 0xd4, 0xaf, 0x7f, 0xfd, 0xf5, 0xc7, 0x0b, 0x3e, 0x70, 0xd0, 0x00, 0xa4, 0x01, 0x0a, 0x80, 0x2f, 0x80, 0x5f, 0x2f, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x01, 0x34, 0x34, 0xc0, 0x01, 0x07, 0x0d, 0xd0, 0x75, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xf4, 0x01, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xe0, 0xef, 0x00, 0xbb, 0x0b, 0xa0, 0xaa, 0x00, 0xaa, 0x0a, 0x80, 0x19, 0x00, 0x64, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x2d, 0x80, 0xe7, 0x0b, 0xbe, 0xf8, 0xfa, 0x02, 0xfe, 0x0b, 0x80, 0x2f, 0x00, 0x50, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xaf, 0x2f, 0xbe, 0xe0, 0xdb, 0x02, 0x78, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x50, 0xfe, 0x5b, 0xfd, 0xff, 0x47, 0xff, 0x1f, 0xe0, 0xbf, 0x00, 0xfe, 0x0b, 0xf0, 0xf5, 0x40, 0x01, 0x14, 0x0a, 0x40, 0x1a, 0x00, 0x09, 0x06, 0x20, 0x80, 0x00, 0x02, 0x08, 0xfc, 0xff, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x0a, 0xf0, 0xff, 0x00, 0xaa, 0x0a, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xff, 0xed, 0xff, 0xe1, 0xdf, 0xe1, 0x2f, 0xe1, 0xef, 0xe2, 0x2f, 0xef, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x0a, 0xc0, 0x31, 0x00, 0x30, 0x01, 0x40, 0x34, 0x00, 0xcc, 0x00, 0x00, 0x0a, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xff, 0x2f, 0xfe, 0xff, 0xfb, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x80, 0xff, 0x2f, 0xfc, 0xff, 0xc3, 0x07, 0x3d, 0x3c, 0xc0, 0xc3, 0x03, 0x3c, 0x7c, 0xd0, 0xc3, 0xff, 0x3f, 0xf8, 0xff, 0x02, 0x00, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30,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x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, }; -short font_ptrs[] = { - 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2, 0x01c0, 0x01ce, 0x01d7, 0x01e5, 0x01f5, 0x0205, 0x0218, 0x0228, 0x0231, 0x023c, 0x0247, 0x0257, 0x0267, 0x0272, 0x0280, 0x0289, 0x0299, 0x02a9, 0x02b7, 0x02c7, 0x02d7, 0x02e7, 0x02f7, 0x0307, 0x0317, 0x0327, 0x0337, 0x0340, 0x034b, 0x035b, 0x036b, 0x037b, 0x038b, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x042b, 0x043b, 0x044e, 0x045e, 0x0473, 0x0486, 0x0499, 0x04a9, 0x04bc, 0x04cc, 0x04dc, 0x04ec, 0x04ff, 0x050f, 0x0524, 0x0537, 0x0547, 0x055a, 0x0565, 0x0573, 0x057e, 0x0589, 0x0599, 0x05a2, 0x05b0, 0x05be, 0x05cc, 0x05da, 0x05e8, 0x05f3, 0x0601, 0x060f, 0x061a, 0x0625, 0x0633, 0x063e, 0x064e, 0x065c, 0x066a, 0x0678, 0x0686, 0x068f, 0x069d, 0x06a8, 0x06b6, 0x06c4, 0x06d4, 0x06e2, 0x06f0, 0x06fe, 0x0709, 0x070f, 0x071a, 0x072a, 0x0735, 0x074a, 0x0769, 0x0788, 0x07a2, 0x07c1, 0x07db, 0x07f5, 0x080f, 0x0829, 0x0843, 0x085d, 0x0877, 0x0896, 0x08a6, 0x08c0, 0x08da, 0x08f4, 0x090e, 0x0923, 0x0940, 0x095d, 0x097c, 0x099b, 0x09b3, 0x09cb, 0x09e3, 0x09fb, 0x0a13, 0x0a2b, 0x0a43, 0x0a5b, 0x0a73, 0x0a8b, 0x0aa3, 0x0abd, 0x0ada, 0x0af7, 0x0b0c, 0x0b26, 0x0b40, 0x0b5a, 0x0b74, 0x0b8c, 0x0b97, 0x0ba0, 0x0ba9, 0x0bb7, 0x0bc5, 0x0bd3, 0x0be1, 0x0bef, 0x0bfd, 0x0c0b, 0x0c19, 0x0c27, 0x0c35, 0x0c43, 0x0c4e, 0x0c57, 0x0c60, 0x0c6e, 0x0c7e, 0x0c8e, 0x0ca8, 0x0cc2, 0x0cdc, 0x0cf6, 0x0d10, 0x0d2a, 0x0d44, 0x0d5e, 0x0d78, 0x0d92, 0x0dac, 0x0dc6, 0x0de0, 0x0dfa, 0x0e14, 0x0e2e, 0x0e46, 0x0e60, 0x0e7a, 0x0e8a, 0x0e9a, 0x0eaa, 0x0eba, 0x0eca, 0x0eda, 0x0eea, 0x0efa, 0x0f0a, 0x0f1a, 0x0f2a, 0x0f3a, 0x0f4a, 0x0f5a, 0x0f6a, 0x0f7a, 0x0f8a, 0x0f9a, 0x0faa, 0x0fba, 0x0fca, 0x0fda, 0x0fea, 0x0ffa, 0x100a, 0x101a, 0x102a, 0x103a, 0x104a, 0x105a, 0x106a, 0x107a, 0x108a, 0x109a, 0x10aa, 0x10ba, 0x10ca, 0x10da, 0x10ea, 0x10fa, 0x110a, 0x111a, 0x112a, 0x113a, 0x114a, +short font_ptrs[] = +{ + 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2, 0x01c0, 0x01ce, 0x01d7, 0x01e5, 0x01f5, 0x0205, 0x0218, 0x0228, 0x0231, 0x023c, 0x0247, 0x0257, 0x0267, 0x0272, 0x0280, 0x0289, 0x0299, 0x02a9, 0x02b7, 0x02c7, 0x02d7, 0x02e7, 0x02f7, 0x0307, 0x0317, 0x0327, 0x0337, 0x0340, 0x034b, 0x035b, 0x036b, 0x037b, 0x038b, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x042b, 0x043b, 0x044e, 0x045e, 0x0473, 0x0486, 0x0499, 0x04a9, 0x04bc, 0x04cc, 0x04dc, 0x04ec, 0x04ff, 0x050f, 0x0524, 0x0537, 0x0547, 0x055a, 0x0565, 0x0573, 0x057e, 0x0589, 0x0599, 0x05a2, 0x05b0, 0x05be, 0x05cc, 0x05da, 0x05e8, 0x05f3, 0x0601, 0x060f, 0x061a, 0x0625, 0x0633, 0x063e, 0x064e, 0x065c, 0x066a, 0x0678, 0x0686, 0x068f, 0x069d, 0x06a8, 0x06b6, 0x06c4, 0x06d4, 0x06e2, 0x06f0, 0x06fe, 0x0709, 0x070f, 0x071a, 0x072a, 0x0735, 0x074a, 0x0769, 0x0788, 0x07a2, 0x07c1, 0x07db, 0x07f5, 0x080f, 0x0829, 0x0843, 0x085d, 0x0877, 0x0896, 0x08a6, 0x08c0, 0x08da, 0x08f4, 0x090e, 0x0923, 0x0940, 0x095d, 0x097c, 0x099b, 0x09b3, 0x09cb, 0x09e3, 0x09fb, 0x0a13, 0x0a2b, 0x0a43, 0x0a5b, 0x0a73, 0x0a8b, 0x0aa3, 0x0abd, 0x0ada, 0x0af7, 0x0b0c, 0x0b26, 0x0b40, 0x0b5a, 0x0b74, 0x0b8c, 0x0b97, 0x0ba0, 0x0ba9, 0x0bb7, 0x0bc5, 0x0bd3, 0x0be1, 0x0bef, 0x0bfd, 0x0c0b, 0x0c19, 0x0c27, 0x0c35, 0x0c43, 0x0c4e, 0x0c57, 0x0c60, 0x0c6e, 0x0c7e, 0x0c8e, 0x0ca8, 0x0cc2, 0x0cdc, 0x0cf6, 0x0d10, 0x0d2a, 0x0d44, 0x0d5e, 0x0d78, 0x0d92, 0x0dac, 0x0dc6, 0x0de0, 0x0dfa, 0x0e14, 0x0e2e, 0x0e46, 0x0e60, 0x0e7a, 0x0e8a, 0x0e9a, 0x0eaa, 0x0eba, 0x0eca, 0x0eda, 0x0eea, 0x0efa, 0x0f0a, 0x0f1a, 0x0f2a, 0x0f3a, 0x0f4a, 0x0f5a, 0x0f6a, 0x0f7a, 0x0f8a, 0x0f9a, 0x0faa, 0x0fba, 0x0fca, 0x0fda, 0x0fea, 0x0ffa, 0x100a, 0x101a, 0x102a, 0x103a, 0x104a, 0x105a, 0x106a, 0x107a, 0x108a, 0x109a, 0x10aa, 0x10ba, 0x10ca, 0x10da, 0x10ea, 0x10fa, 0x110a, 0x111a, 0x112a, 0x113a, 0x114a, }; \ No newline at end of file diff --git a/http.c b/http.c old mode 100755 new mode 100644 index 74bafa2..85ba9f0 --- a/http.c +++ b/http.c @@ -72,10 +72,11 @@ static struct sockaddr_in http_proxy; static char *mystrdup(char *s) { char *x; - if(s) { - x = malloc(strlen(s)+1); - strcpy(x, s); - return x; + if(s) + { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; } return s; } @@ -84,21 +85,22 @@ static int splituri(char *uri, char **host, char **path) { char *p=uri,*q,*x,*y; if(!strncmp(p, "http://", 7)) - p += 7; + p += 7; q = strchr(p, '/'); if(!q) - q = p + strlen(p); + q = p + strlen(p); x = malloc(q-p+1); if(*q) - y = mystrdup(q); + y = mystrdup(q); else - y = mystrdup("/"); + y = mystrdup("/"); strncpy(x, p, q-p); x[q-p] = 0; - if(q==p || x[q-p-1]==':') { - free(x); - free(y); - return 1; + if(q==p || x[q-p-1]==':') + { + free(x); + free(y); + return 1; } *host = x; *path = y; @@ -110,7 +112,7 @@ static char *getserv(char *host) char *q, *x = mystrdup(host); q = strchr(x, ':'); if(q) - *q = 0; + *q = 0; return x; } @@ -119,32 +121,35 @@ static char *getport(char *host) char *p, *q; q = strchr(host, ':'); if(q) - p = mystrdup(q+1); + p = mystrdup(q+1); else - p = mystrdup("80"); + p = mystrdup("80"); return p; } static int resolve(char *dns, char *srv, struct sockaddr_in *addr) { struct addrinfo hnt, *res = 0; - if(http_use_proxy) { - memcpy(addr, &http_proxy, sizeof(struct sockaddr_in)); - return 0; + if(http_use_proxy) + { + memcpy(addr, &http_proxy, sizeof(struct sockaddr_in)); + return 0; } memset(&hnt, 0, sizeof(hnt)); hnt.ai_family = AF_INET; hnt.ai_socktype = SOCK_STREAM; if(getaddrinfo(dns, srv, &hnt, &res)) - return 1; - if(res) { - if(res->ai_family != AF_INET) { - freeaddrinfo(res); - return 1; - } - memcpy(addr, res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); - return 0; + return 1; + if(res) + { + if(res->ai_family != AF_INET) + { + freeaddrinfo(res); + return 1; + } + memcpy(addr, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); + return 0; } return 1; } @@ -155,20 +160,21 @@ void http_init(char *proxy) #ifdef WIN32 WSADATA wsadata; if(!WSAStartup(MAKEWORD(2,2), &wsadata)) - http_up = 1; + http_up = 1; #else signal(SIGPIPE, SIG_IGN); http_up = 1; #endif - if(proxy) { - host = getserv(proxy); - port = getport(proxy); - if(resolve(host, port, &http_proxy)) - http_up = 0; - else - http_use_proxy = 1; - free(host); - free(port); + if(proxy) + { + host = getserv(proxy); + port = getport(proxy); + if(resolve(host, port, &http_proxy)) + http_up = 0; + else + http_use_proxy = 1; + free(host); + free(port); } } @@ -189,7 +195,8 @@ void http_done(void) #define HTS_XMIT 4 #define HTS_RECV 5 #define HTS_DONE 6 -struct http_ctx { +struct http_ctx +{ int state; time_t last; int keep; @@ -213,54 +220,63 @@ struct http_ctx { void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep) { struct http_ctx *cx = ctx; - if(!ctx) { - ctx = calloc(1, sizeof(struct http_ctx)); - cx = ctx; - cx->fd = PERROR; + if(!ctx) + { + ctx = calloc(1, sizeof(struct http_ctx)); + cx = ctx; + cx->fd = PERROR; } - if(!cx->hbuf) { - cx->hbuf = malloc(256); - cx->hlen = 256; + if(!cx->hbuf) + { + cx->hbuf = malloc(256); + cx->hlen = 256; } - if(!http_up) { - cx->ret = 604; - cx->state = HTS_DONE; - return ctx; + if(!http_up) + { + cx->ret = 604; + cx->state = HTS_DONE; + return ctx; } - if(cx->state!=HTS_STRT && cx->state!=HTS_IDLE) { - fprintf(stderr, "HTTP: unclean request restart state.\n"); - exit(1); + if(cx->state!=HTS_STRT && cx->state!=HTS_IDLE) + { + fprintf(stderr, "HTTP: unclean request restart state.\n"); + exit(1); } cx->keep = keep; cx->ret = 600; - if(splituri(uri, &cx->host, &cx->path)) { - cx->ret = 601; - cx->state = HTS_DONE; - return ctx; - } - if(http_use_proxy) { - free(cx->path); - cx->path = mystrdup(uri); - } - if(cx->fdhost && strcmp(cx->host, cx->fdhost)) { - free(cx->fdhost); - cx->fdhost = NULL; - PCLOSE(cx->fd); - cx->fd = PERROR; - cx->state = HTS_STRT; - } - if(data) { - if(!dlen) - dlen = strlen(data); - cx->txd = malloc(dlen); - memcpy(cx->txd, data, dlen); - cx->txdl = dlen; - } else - cx->txdl = 0; + if(splituri(uri, &cx->host, &cx->path)) + { + cx->ret = 601; + cx->state = HTS_DONE; + return ctx; + } + if(http_use_proxy) + { + free(cx->path); + cx->path = mystrdup(uri); + } + if(cx->fdhost && strcmp(cx->host, cx->fdhost)) + { + free(cx->fdhost); + cx->fdhost = NULL; + PCLOSE(cx->fd); + cx->fd = PERROR; + cx->state = HTS_STRT; + } + if(data) + { + if(!dlen) + dlen = strlen(data); + cx->txd = malloc(dlen); + memcpy(cx->txd, data, dlen); + cx->txdl = dlen; + } + else + cx->txdl = 0; cx->contlen = 0; cx->chunked = 0; @@ -286,76 +302,92 @@ void http_async_add_header(void *ctx, char *name, char *data) static void process_header(struct http_ctx *cx, char *str) { char *p; - if(cx->chunkhdr) { - p = strchr(str, ';'); - if(p) - *p = 0; - cx->rxtogo = strtoul(str, NULL, 16); - cx->chunkhdr = 0; - if(!cx->rxtogo) - cx->chunked = 0; - } - if(!str[0]) { - cx->rxtogo = cx->contlen; - cx->chunkhdr = cx->chunked; - if(!cx->contlen && !cx->chunked && cx->ret!=100) - cx->state = HTS_DONE; - return; - } - if(!strncmp(str, "HTTP/", 5)) { - p = strchr(str, ' '); - if(!p) { - cx->ret = 603; - cx->state = HTS_DONE; - return; - } - p++; - cx->ret = atoi(p); - return; - } - if(!strncmp(str, "Content-Length: ", 16)) { - cx->contlen = atoi(str+16); - return; - } - if(!strcmp(str, "Transfer-Encoding: chunked")) { - cx->chunked = 1; - return; - } - if(!strcmp(str, "Connection: close")) { - cx->cclose = 1; - return; + if(cx->chunkhdr) + { + p = strchr(str, ';'); + if(p) + *p = 0; + cx->rxtogo = strtoul(str, NULL, 16); + cx->chunkhdr = 0; + if(!cx->rxtogo) + cx->chunked = 0; + } + if(!str[0]) + { + cx->rxtogo = cx->contlen; + cx->chunkhdr = cx->chunked; + if(!cx->contlen && !cx->chunked && cx->ret!=100) + cx->state = HTS_DONE; + return; + } + if(!strncmp(str, "HTTP/", 5)) + { + p = strchr(str, ' '); + if(!p) + { + cx->ret = 603; + cx->state = HTS_DONE; + return; + } + p++; + cx->ret = atoi(p); + return; + } + if(!strncmp(str, "Content-Length: ", 16)) + { + cx->contlen = atoi(str+16); + return; + } + if(!strcmp(str, "Transfer-Encoding: chunked")) + { + cx->chunked = 1; + return; + } + if(!strcmp(str, "Connection: close")) + { + cx->cclose = 1; + return; } } static void process_byte(struct http_ctx *cx, char ch) { - if(cx->rxtogo) { - cx->rxtogo--; - - if(!cx->rbuf) { - cx->rbuf = malloc(256); - cx->rlen = 256; - } - if(cx->rptr >= cx->rlen-1) { - cx->rlen *= 2; - cx->rbuf = realloc(cx->rbuf, cx->rlen); - } - cx->rbuf[cx->rptr++] = ch; - - if(!cx->rxtogo && !cx->chunked) - cx->state = HTS_DONE; - } else { - if(ch == '\n') { - cx->hbuf[cx->hptr] = 0; - process_header(cx, cx->hbuf); - cx->hptr = 0; - } else if(ch != '\r') { - if(cx->hptr >= cx->hlen-1) { - cx->hlen *= 2; - cx->hbuf = realloc(cx->hbuf, cx->hlen); - } - cx->hbuf[cx->hptr++] = ch; - } + if(cx->rxtogo) + { + cx->rxtogo--; + + if(!cx->rbuf) + { + cx->rbuf = malloc(256); + cx->rlen = 256; + } + if(cx->rptr >= cx->rlen-1) + { + cx->rlen *= 2; + cx->rbuf = realloc(cx->rbuf, cx->rlen); + } + cx->rbuf[cx->rptr++] = ch; + + if(!cx->rxtogo && !cx->chunked) + cx->state = HTS_DONE; + } + else + { + if(ch == '\n') + { + cx->hbuf[cx->hptr] = 0; + process_header(cx, cx->hbuf); + cx->hptr = 0; + } + else if(ch != '\r') + { + if(cx->hptr >= cx->hlen-1) + { + cx->hlen *= 2; + cx->hbuf = realloc(cx->hbuf, cx->hlen); + } + cx->hbuf[cx->hptr++] = ch; + } } } @@ -369,152 +401,164 @@ int http_async_req_status(void *ctx) unsigned long tmp2; #endif - switch(cx->state) { + switch(cx->state) + { case HTS_STRT: - dns = getserv(cx->host); - srv = getport(cx->host); - if(resolve(dns, srv, &cx->addr)) { - free(dns); - free(srv); - cx->state = HTS_DONE; - cx->ret = 602; - return 1; - } - free(dns); - free(srv); - cx->state = HTS_RSLV; - return 0; + dns = getserv(cx->host); + srv = getport(cx->host); + if(resolve(dns, srv, &cx->addr)) + { + free(dns); + free(srv); + cx->state = HTS_DONE; + cx->ret = 602; + return 1; + } + free(dns); + free(srv); + cx->state = HTS_RSLV; + return 0; case HTS_RSLV: - cx->state = HTS_CONN; - cx->last = now; - return 0; + cx->state = HTS_CONN; + cx->last = now; + return 0; case HTS_CONN: - if(cx->fd == PERROR) { - cx->fd = socket(AF_INET, SOCK_STREAM, 0); - if(cx->fd == PERROR) - goto fail; - cx->fdhost = mystrdup(cx->host); + if(cx->fd == PERROR) + { + cx->fd = socket(AF_INET, SOCK_STREAM, 0); + if(cx->fd == PERROR) + goto fail; + cx->fdhost = mystrdup(cx->host); #ifdef WIN32 - tmp2 = 1; - if(ioctlsocket(cx->fd, FIONBIO, &tmp2) == SOCKET_ERROR) - goto fail; + tmp2 = 1; + if(ioctlsocket(cx->fd, FIONBIO, &tmp2) == SOCKET_ERROR) + goto fail; #else - tmp = fcntl(cx->fd, F_GETFL); - if(tmp < 0) - goto fail; - if(fcntl(cx->fd, F_SETFL, tmp|O_NONBLOCK) < 0) - goto fail; + tmp = fcntl(cx->fd, F_GETFL); + if(tmp < 0) + goto fail; + if(fcntl(cx->fd, F_SETFL, tmp|O_NONBLOCK) < 0) + goto fail; #endif - } - if(!connect(cx->fd, (struct sockaddr *)&cx->addr, sizeof(cx->addr))) - cx->state = HTS_IDLE; + } + if(!connect(cx->fd, (struct sockaddr *)&cx->addr, sizeof(cx->addr))) + cx->state = HTS_IDLE; #ifdef WIN32 - else if(PERRNO==WSAEISCONN) - cx->state = HTS_IDLE; + else if(PERRNO==WSAEISCONN) + cx->state = HTS_IDLE; #endif #ifdef MACOSX - else if(PERRNO==EISCONN) - cx->state = HTS_IDLE; + else if(PERRNO==EISCONN) + cx->state = HTS_IDLE; #endif - else if(PERRNO!=PEINPROGRESS && PERRNO!=PEALREADY + else if(PERRNO!=PEINPROGRESS && PERRNO!=PEALREADY #ifdef WIN32 - && PERRNO!=PEAGAIN && PERRNO!=WSAEINVAL + && PERRNO!=PEAGAIN && PERRNO!=WSAEINVAL #endif - ) - goto fail; - if(now-cx->last>http_timeout) - goto timeout; - return 0; + ) + goto fail; + if(now-cx->last>http_timeout) + goto timeout; + return 0; case HTS_IDLE: - if(cx->txdl) { - // generate POST - cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 121 + cx->txdl + cx->thlen); - cx->tptr = 0; - cx->tlen = 0; - cx->tlen += sprintf(cx->tbuf+cx->tlen, "POST %s HTTP/1.1\n", cx->path); - cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host); - if(!cx->keep) - cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n"); - if(cx->thdr) { - memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen); - cx->tlen += cx->thlen; - free(cx->thdr); - cx->thdr = NULL; - cx->thlen = 0; - } - cx->tlen += sprintf(cx->tbuf+cx->tlen, "Content-Length: %d\n", cx->txdl); + if(cx->txdl) + { + // generate POST + cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 121 + cx->txdl + cx->thlen); + cx->tptr = 0; + cx->tlen = 0; + cx->tlen += sprintf(cx->tbuf+cx->tlen, "POST %s HTTP/1.1\n", cx->path); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host); + if(!cx->keep) + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n"); + if(cx->thdr) + { + memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen); + cx->tlen += cx->thlen; + free(cx->thdr); + cx->thdr = NULL; + cx->thlen = 0; + } + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Content-Length: %d\n", cx->txdl); #ifdef BETA - cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); #else - cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dS%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dS%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); #endif - cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n"); - memcpy(cx->tbuf+cx->tlen, cx->txd, cx->txdl); - cx->tlen += cx->txdl; - free(cx->txd); - cx->txd = NULL; - cx->txdl = 0; - } else { - // generate GET - cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 89 + cx->thlen); - cx->tptr = 0; - cx->tlen = 0; - cx->tlen += sprintf(cx->tbuf+cx->tlen, "GET %s HTTP/1.1\n", cx->path); - cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host); - if(cx->thdr) { - memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen); - cx->tlen += cx->thlen; - free(cx->thdr); - cx->thdr = NULL; - cx->thlen = 0; - } - if(!cx->keep) - cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n"); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n"); + memcpy(cx->tbuf+cx->tlen, cx->txd, cx->txdl); + cx->tlen += cx->txdl; + free(cx->txd); + cx->txd = NULL; + cx->txdl = 0; + } + else + { + // generate GET + cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 89 + cx->thlen); + cx->tptr = 0; + cx->tlen = 0; + cx->tlen += sprintf(cx->tbuf+cx->tlen, "GET %s HTTP/1.1\n", cx->path); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host); + if(cx->thdr) + { + memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen); + cx->tlen += cx->thlen; + free(cx->thdr); + cx->thdr = NULL; + cx->thlen = 0; + } + if(!cx->keep) + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n"); #ifdef BETA - cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); #else - cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dS%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dS%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); #endif - cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n"); - } - cx->state = HTS_XMIT; - cx->last = now; - return 0; + cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n"); + } + cx->state = HTS_XMIT; + cx->last = now; + return 0; case HTS_XMIT: - tmp = send(cx->fd, cx->tbuf+cx->tptr, cx->tlen-cx->tptr, 0); - if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR) - goto fail; - if(tmp!=PERROR) { - cx->tptr += tmp; - if(cx->tptr == cx->tlen) { - cx->tptr = 0; - cx->tlen = 0; - if(cx->tbuf) - free(cx->tbuf); - cx->state = HTS_RECV; - } - cx->last = now; - } - if(now-cx->last>http_timeout) - goto timeout; - return 0; + tmp = send(cx->fd, cx->tbuf+cx->tptr, cx->tlen-cx->tptr, 0); + if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR) + goto fail; + if(tmp!=PERROR) + { + cx->tptr += tmp; + if(cx->tptr == cx->tlen) + { + cx->tptr = 0; + cx->tlen = 0; + if(cx->tbuf) + free(cx->tbuf); + cx->state = HTS_RECV; + } + cx->last = now; + } + if(now-cx->last>http_timeout) + goto timeout; + return 0; case HTS_RECV: - tmp = recv(cx->fd, buf, CHUNK, 0); - if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR) - goto fail; - if(tmp!=PERROR) { - for(i=0;istate == HTS_DONE) - return 1; - } - cx->last = now; - } - if(now-cx->last>http_timeout) - goto timeout; - return 0; + tmp = recv(cx->fd, buf, CHUNK, 0); + if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR) + goto fail; + if(tmp!=PERROR) + { + for(i=0; istate == HTS_DONE) + return 1; + } + cx->last = now; + } + if(now-cx->last>http_timeout) + goto timeout; + return 0; case HTS_DONE: - return 1; + return 1; } return 0; @@ -535,37 +579,42 @@ char *http_async_req_stop(void *ctx, int *ret, int *len) char *rxd; if(cx->state != HTS_DONE) - while(!http_async_req_status(ctx)) ; + while(!http_async_req_status(ctx)) ; - if(cx->host) { - free(cx->host); - cx->host = NULL; + if(cx->host) + { + free(cx->host); + cx->host = NULL; } - if(cx->path) { - free(cx->path); - cx->path = NULL; + if(cx->path) + { + free(cx->path); + cx->path = NULL; } - if(cx->txd) { - free(cx->txd); - cx->txd = NULL; - cx->txdl = 0; + if(cx->txd) + { + free(cx->txd); + cx->txd = NULL; + cx->txdl = 0; } - if(cx->hbuf) { - free(cx->hbuf); - cx->hbuf = NULL; + if(cx->hbuf) + { + free(cx->hbuf); + cx->hbuf = NULL; } - if(cx->thdr) { - free(cx->thdr); - cx->thdr = NULL; - cx->thlen = 0; + if(cx->thdr) + { + free(cx->thdr); + cx->thdr = NULL; + cx->thlen = 0; } if(ret) - *ret = cx->ret; + *ret = cx->ret; if(len) - *len = cx->rptr; + *len = cx->rptr; if(cx->rbuf) - cx->rbuf[cx->rptr] = 0; + cx->rbuf[cx->rptr] = 0; rxd = cx->rbuf; cx->rbuf = NULL; cx->rlen = 0; @@ -573,17 +622,20 @@ char *http_async_req_stop(void *ctx, int *ret, int *len) cx->contlen = 0; if(!cx->keep) - http_async_req_close(ctx); - else if(cx->cclose) { - PCLOSE(cx->fd); - cx->fd = PERROR; - if(cx->fdhost) { - free(cx->fdhost); - cx->fdhost = NULL; - } - cx->state = HTS_STRT; - } else - cx->state = HTS_IDLE; + http_async_req_close(ctx); + else if(cx->cclose) + { + PCLOSE(cx->fd); + cx->fd = PERROR; + if(cx->fdhost) + { + free(cx->fdhost); + cx->fdhost = NULL; + } + cx->state = HTS_STRT; + } + else + cx->state = HTS_IDLE; return rxd; } @@ -592,23 +644,24 @@ void http_async_get_length(void *ctx, int *total, int *done) { struct http_ctx *cx = ctx; if(done) - *done = cx->rptr; + *done = cx->rptr; if(total) - *total = cx->contlen; + *total = cx->contlen; } void http_async_req_close(void *ctx) { struct http_ctx *cx = ctx; void *tmp; - if(cx->host) { - cx->keep = 1; - tmp = http_async_req_stop(ctx, NULL, NULL); - if(tmp) - free(tmp); + if(cx->host) + { + cx->keep = 1; + tmp = http_async_req_stop(ctx, NULL, NULL); + if(tmp) + free(tmp); } if(cx->fdhost) - free(cx->fdhost); + free(cx->fdhost); PCLOSE(cx->fd); free(ctx); } @@ -616,55 +669,60 @@ void http_async_req_close(void *ctx) char *http_simple_get(char *uri, int *ret, int *len) { void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0); - if(!ctx) { - if(ret) - *ret = 600; - if(len) - *len = 0; - return NULL; + if(!ctx) + { + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; } return http_async_req_stop(ctx, ret, len); } static char hex[] = "0123456789abcdef"; void http_auth_headers(void *ctx, char *user, char *pass) { - char *tmp; + char *tmp; int i; unsigned char hash[16]; unsigned int m; struct md5_context md5; - - if(user) { - http_async_add_header(ctx, "X-Auth-User", user); - if(pass) { - md5_init(&md5); - md5_update(&md5, (unsigned char *)user, strlen(user)); - md5_update(&md5, (unsigned char *)"-", 1); - m = 0; - - md5_update(&md5, (unsigned char *)pass, strlen(pass)); - md5_final(hash, &md5); - tmp = malloc(33); - for(i=0;i<16;i++) { - tmp[i*2] = hex[hash[i]>>4]; - tmp[i*2+1] = hex[hash[i]&15]; - } - tmp[32] = 0; - http_async_add_header(ctx, "X-Auth-Hash", tmp); - free(tmp); - } + + if(user) + { + http_async_add_header(ctx, "X-Auth-User", user); + if(pass) + { + md5_init(&md5); + md5_update(&md5, (unsigned char *)user, strlen(user)); + md5_update(&md5, (unsigned char *)"-", 1); + m = 0; + + md5_update(&md5, (unsigned char *)pass, strlen(pass)); + md5_final(hash, &md5); + tmp = malloc(33); + for(i=0; i<16; i++) + { + tmp[i*2] = hex[hash[i]>>4]; + tmp[i*2+1] = hex[hash[i]&15]; + } + tmp[32] = 0; + http_async_add_header(ctx, "X-Auth-Hash", tmp); + free(tmp); + } } } char *http_auth_get(char *uri, char *user, char *pass, int *ret, int *len) { - void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0); + void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0); - if(!ctx) { - if(ret) - *ret = 600; - if(len) - *len = 0; - return NULL; + if(!ctx) + { + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; } return http_async_req_stop(ctx, ret, len); } @@ -672,83 +730,144 @@ char *http_auth_get(char *uri, char *user, char *pass, int *ret, int *len) char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len) { void *ctx = http_async_req_start(NULL, uri, data, dlen, 0); - if(!ctx) { - if(ret) - *ret = 600; - if(len) - *len = 0; - return NULL; + if(!ctx) + { + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; } return http_async_req_stop(ctx, ret, len); } char *http_ret_text(int ret) { - switch(ret) { - case 100: return "Continue"; - case 101: return "Switching Protocols"; - case 102: return "Processing"; - - case 200: return "OK"; - case 201: return "Created"; - case 202: return "Accepted"; - case 203: return "Non-Authoritative Information"; - case 204: return "No Content"; - case 205: return "Reset Content"; - case 206: return "Partial Content"; - case 207: return "Multi-Status"; - - case 300: return "Multiple Choices"; - case 301: return "Moved Permanently"; - case 302: return "Found"; - case 303: return "See Other"; - case 304: return "Not Modified"; - case 305: return "Use Proxy"; - case 306: return "Switch Proxy"; - case 307: return "Temporary Redirect"; - - case 400: return "Bad Request"; - case 401: return "Unauthorized"; - case 402: return "Payment Required"; - case 403: return "Forbidden"; - case 404: return "Not Found"; - case 405: return "Method Not Allowed"; - case 406: return "Not Acceptable"; - case 407: return "Proxy Authentication Required"; - case 408: return "Request Timeout"; - case 409: return "Conflict"; - case 410: return "Gone"; - case 411: return "Length Required"; - case 412: return "Precondition Failed"; - case 413: return "Request Entity Too Large"; - case 414: return "Request URI Too Long"; - case 415: return "Unsupported Media Type"; - case 416: return "Requested Range Not Satisfiable"; - case 417: return "Expectation Failed"; - case 422: return "Unprocessable Entity"; - case 423: return "Locked"; - case 424: return "Failed Dependency"; - case 425: return "Unordered Collection"; - case 426: return "Upgrade Required"; - - case 500: return "Internal Server Error"; - case 501: return "Not Implemented"; - case 502: return "Bad Gateway"; - case 503: return "Service Unavailable"; - case 504: return "Gateway Timeout"; - case 505: return "HTTP Version Not Supported"; - case 506: return "Variant Also Negotiates"; - case 507: return "Insufficient Storage"; - case 509: return "Bandwidth Limit Exceeded"; - case 510: return "Not Extended"; - - case 600: return "Internal Client Error"; - case 601: return "Unsupported Protocol"; - case 602: return "Server Not Found"; - case 603: return "Malformed Response"; - case 604: return "Network Not Available"; - case 605: return "Request Timed Out"; - default: return "Unknown Status Code"; + switch(ret) + { + case 100: + return "Continue"; + case 101: + return "Switching Protocols"; + case 102: + return "Processing"; + + case 200: + return "OK"; + case 201: + return "Created"; + case 202: + return "Accepted"; + case 203: + return "Non-Authoritative Information"; + case 204: + return "No Content"; + case 205: + return "Reset Content"; + case 206: + return "Partial Content"; + case 207: + return "Multi-Status"; + + case 300: + return "Multiple Choices"; + case 301: + return "Moved Permanently"; + case 302: + return "Found"; + case 303: + return "See Other"; + case 304: + return "Not Modified"; + case 305: + return "Use Proxy"; + case 306: + return "Switch Proxy"; + case 307: + return "Temporary Redirect"; + + case 400: + return "Bad Request"; + case 401: + return "Unauthorized"; + case 402: + return "Payment Required"; + case 403: + return "Forbidden"; + case 404: + return "Not Found"; + case 405: + return "Method Not Allowed"; + case 406: + return "Not Acceptable"; + case 407: + return "Proxy Authentication Required"; + case 408: + return "Request Timeout"; + case 409: + return "Conflict"; + case 410: + return "Gone"; + case 411: + return "Length Required"; + case 412: + return "Precondition Failed"; + case 413: + return "Request Entity Too Large"; + case 414: + return "Request URI Too Long"; + case 415: + return "Unsupported Media Type"; + case 416: + return "Requested Range Not Satisfiable"; + case 417: + return "Expectation Failed"; + case 422: + return "Unprocessable Entity"; + case 423: + return "Locked"; + case 424: + return "Failed Dependency"; + case 425: + return "Unordered Collection"; + case 426: + return "Upgrade Required"; + + case 500: + return "Internal Server Error"; + case 501: + return "Not Implemented"; + case 502: + return "Bad Gateway"; + case 503: + return "Service Unavailable"; + case 504: + return "Gateway Timeout"; + case 505: + return "HTTP Version Not Supported"; + case 506: + return "Variant Also Negotiates"; + case 507: + return "Insufficient Storage"; + case 509: + return "Bandwidth Limit Exceeded"; + case 510: + return "Not Extended"; + + case 600: + return "Internal Client Error"; + case 601: + return "Unsupported Protocol"; + case 602: + return "Server Not Found"; + case 603: + return "Malformed Response"; + case 604: + return "Network Not Available"; + case 605: + return "Request Timed Out"; + default: + return "Unknown Status Code"; } } char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, int *ret, int *len) @@ -761,153 +880,172 @@ char *http_multipart_post(char *uri, char **names, char **parts, int *plens, cha int blen = 0; unsigned int map[62], m; struct md5_context md5; - //struct md5_context md52; + //struct md5_context md52; int own_plen = 0; - if(names) { - if(!plens) { - own_plen = 1; - for(i=0;names[i];i++) ; - plens = calloc(i, sizeof(int)); - for(i=0;names[i];i++) - plens[i] = strlen(parts[i]); - } - - retry: - if(blen >= 31) - goto fail; - memset(map, 0, 62*sizeof(int)); - for(i=0;names[i];i++) { - for(j=0;j='0' && ch<='9') - map[ch-'0']++; - else if(ch>='A' && ch<='Z') - map[ch-'A'+10]++; - else if(ch>='a' && ch<='z') - map[ch-'a'+36]++; - } - } - m = ~0; - j = 61; - for(i=0;i<62;i++) - if(map[i]= 31) + goto fail; + memset(map, 0, 62*sizeof(int)); + for(i=0; names[i]; i++) + { + for(j=0; j='0' && ch<='9') + map[ch-'0']++; + else if(ch>='A' && ch<='Z') + map[ch-'A'+10]++; + else if(ch>='a' && ch<='z') + map[ch-'a'+36]++; + } + } + m = ~0; + j = 61; + for(i=0; i<62; i++) + if(map[i]>4]; - tmp[i*2+1] = hex[hash[i]&15]; - } - tmp[32] = 0; - http_async_add_header(ctx, "X-Auth-Hash", tmp); - free(tmp); - } - } - - if(data) { - tmp = malloc(32+strlen((char *)boundary)); - sprintf(tmp, "multipart/form-data, boundary=%s", boundary); - http_async_add_header(ctx, "Content-type", tmp); - free(tmp); - free(data); + goto fail; + + if(user) + { + http_async_add_header(ctx, "X-Auth-User", user); + if(pass) + { + md5_init(&md5); + md5_update(&md5, (unsigned char *)user, strlen(user)); + md5_update(&md5, (unsigned char *)"-", 1); + m = 0; + if(names) + { + for(i=0; names[i]; i++) + { + //md5_update(&md5, (unsigned char *)parts[i], plens[i]); //WHY? + //md5_update(&md5, (unsigned char *)"-", 1); + p = strchr(names[i], ':'); + if(p) + m += (p - names[i]) + 1; + else + m += strlen(names[i])+1; + } + + tmp = malloc(m); + m = 0; + for(i=0; names[i]; i++) + { + p = strchr(names[i], ':'); + if(m) + { + tmp[m] = ' '; + m ++; + } + if(p) + { + memcpy(tmp+m, names[i], p-names[i]); + m += p - names[i]; + } + else + { + strcpy(tmp+m, names[i]); + m += strlen(names[i]); + } + } + tmp[m] = 0; + http_async_add_header(ctx, "X-Auth-Objects", tmp); + free(tmp); + } + + md5_update(&md5, (unsigned char *)pass, strlen(pass)); + md5_final(hash, &md5); + tmp = malloc(33); + for(i=0; i<16; i++) + { + tmp[i*2] = hex[hash[i]>>4]; + tmp[i*2+1] = hex[hash[i]&15]; + } + tmp[32] = 0; + http_async_add_header(ctx, "X-Auth-Hash", tmp); + free(tmp); + } + } + + if(data) + { + tmp = malloc(32+strlen((char *)boundary)); + sprintf(tmp, "multipart/form-data, boundary=%s", boundary); + http_async_add_header(ctx, "Content-type", tmp); + free(tmp); + free(data); } if(own_plen) - free(plens); + free(plens); return http_async_req_stop(ctx, ret, len); fail: if(data) - free(data); + free(data); if(own_plen) - free(plens); + free(plens); if(ret) - *ret = 600; + *ret = 600; if(len) - *len = 0; + *len = 0; return NULL; } diff --git a/md5.c b/md5.c old mode 100755 new mode 100644 index 874d2c1..2e348e6 --- a/md5.c +++ b/md5.c @@ -33,34 +33,37 @@ void md5_update(struct md5_context *ctx, unsigned char const *buf, unsigned len) // update bit count t = ctx->bits[0]; if((ctx->bits[0] = (t + ((unsigned)len << 3)) & 0xffffffff) < t) - ctx->bits[1]++; // carry + ctx->bits[1]++; // carry ctx->bits[1] += len >> 29; t = (t >> 3) & 0x3f; // use leading data to top up the buffer - if(t) { - unsigned char *p = ctx->in + t; - - t = 64-t; - if (len < t) { - memcpy(p, buf, len); - return; - } - memcpy(p, buf, t); - md5_transform(ctx->buf, ctx->in); - buf += t; - len -= t; + if(t) + { + unsigned char *p = ctx->in + t; + + t = 64-t; + if (len < t) + { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + md5_transform(ctx->buf, ctx->in); + buf += t; + len -= t; } // following 64-byte chunks - while(len >= 64) { - memcpy(ctx->in, buf, 64); - md5_transform(ctx->buf, ctx->in); - buf += 64; - len -= 64; + while(len >= 64) + { + memcpy(ctx->in, buf, 64); + md5_transform(ctx->buf, ctx->in); + buf += 64; + len -= 64; } // save rest of bytes for later @@ -84,14 +87,17 @@ void md5_final(unsigned char digest[16], struct md5_context *ctx) count = 64 - 1 - count; // Pad out to 56 mod 64 - if(count < 8) { - // we need to finish a whole block before padding - memset(p, 0, count); - md5_transform(ctx->buf, ctx->in); - memset(ctx->in, 0, 56); - } else { - // just pad to 56 bytes - memset(p, 0, count-8); + if(count < 8) + { + // we need to finish a whole block before padding + memset(p, 0, count); + md5_transform(ctx->buf, ctx->in); + memset(ctx->in, 0, 56); + } + else + { + // just pad to 56 bytes + memset(p, 0, count-8); } // append length & final transform @@ -121,7 +127,7 @@ void md5_transform(unsigned buf[4], const unsigned char inraw[64]) int i; for (i = 0; i < 16; ++i) - in[i] = getu32 (inraw + 4 * i); + in[i] = getu32 (inraw + 4 * i); a = buf[0]; b = buf[1]; @@ -210,15 +216,16 @@ void md5_ascii(char *result, unsigned char const *buf, unsigned len) int i; if(len==0) - len = strlen((char *)buf); + len = strlen((char *)buf); md5_init(&md5); md5_update(&md5, buf, len); md5_final(hash, &md5); - for(i=0;i<16;i++) { - result[i*2] = hex[(hash[i]>>4)&0xF]; - result[i*2+1] = hex[hash[i]&0x0F]; + for(i=0; i<16; i++) + { + result[i*2] = hex[(hash[i]>>4)&0xF]; + result[i*2+1] = hex[hash[i]&0x0F]; } result[32] = 0; } diff --git a/md5.h b/md5.h old mode 100755 new mode 100644 index 3f675d6..2ae3ae8 --- a/md5.h +++ b/md5.h @@ -1,10 +1,11 @@ #ifndef MD5_H #define MD5_H -struct md5_context { - unsigned buf[4]; - unsigned bits[2]; - unsigned char in[64]; +struct md5_context +{ + unsigned buf[4]; + unsigned bits[2]; + unsigned char in[64]; }; void md5_init(struct md5_context *context); diff --git a/powder.c b/powder.c old mode 100755 new mode 100644 index 8d63d6f..ffc6568 --- a/powder.c +++ b/powder.c @@ -103,39 +103,40 @@ typedef unsigned int pixel; #endif char *it_msg = -"\brThe Powder Toy\n" -"\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" -"\n" -"\bgControl+C/V/X are Copy, Paste and cut respectively.\n" -"\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" -"\bgPick your material from the menu using mouse left/right buttons.\n" -"Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" -"Shift+drag will create straight lines of particles.\n" -"Ctrl+drag will result in filled rectangles.\n" -"Ctrl+Shift+click will flood-fill a closed area.\n" -"Middle click or Alt+Click to \"sample\" the particles.\n" -"\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" -"Use 'S' to save parts of the window as 'stamps'.\n" -"'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" -"'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" -"Use the mouse scroll wheel to change the tool size for particles.\n" -"'Q' will quit the application.\n" -"The spacebar can be used to pause physics.\n" -"'P' will take a screenshot and save it into the current directory.\n" -"\n" -"\brhttp://powdertoy.co.uk/\n" -"\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" -"\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" -"\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" -"\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" -"\n" -"\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" -"\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" -; - -typedef struct { - int start, inc; - pixel *vid; + "\brThe Powder Toy\n" + "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" + "\n" + "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" + "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" + "\bgPick your material from the menu using mouse left/right buttons.\n" + "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" + "Shift+drag will create straight lines of particles.\n" + "Ctrl+drag will result in filled rectangles.\n" + "Ctrl+Shift+click will flood-fill a closed area.\n" + "Middle click or Alt+Click to \"sample\" the particles.\n" + "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" + "Use 'S' to save parts of the window as 'stamps'.\n" + "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" + "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" + "Use the mouse scroll wheel to change the tool size for particles.\n" + "'Q' will quit the application.\n" + "The spacebar can be used to pause physics.\n" + "'P' will take a screenshot and save it into the current directory.\n" + "\n" + "\brhttp://powdertoy.co.uk/\n" + "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" + "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" + "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" + "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" + "\n" + "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" + "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" + ; + +typedef struct +{ + int start, inc; + pixel *vid; } upstruc; #ifdef BETA @@ -156,7 +157,8 @@ unsigned char fire_b[YRES/CELL][XRES/CELL]; #define MAXSIGNS 16 -struct sign { +struct sign +{ int x,y,ju; char text[256]; } signs[MAXSIGNS]; @@ -185,138 +187,148 @@ void make_kernel(void) int i, j; float s = 0.0f; for(j=-1; j<2; j++) - for(i=-1; i<2; i++) { - kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); - s += kernel[(i+1)+3*(j+1)]; - } + for(i=-1; i<2; i++) + { + kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); + s += kernel[(i+1)+3*(j+1)]; + } s = 1.0f / s; for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - kernel[(i+1)+3*(j+1)] *= s; + for(i=-1; i<2; i++) + kernel[(i+1)+3*(j+1)] *= s; } -int core_count(){ - int numCPU = 1; +int core_count() +{ + int numCPU = 1; #ifdef MT #ifdef WIN32 - SYSTEM_INFO sysinfo; - GetSystemInfo( &sysinfo ); - numCPU = sysinfo.dwNumberOfProcessors; + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + numCPU = sysinfo.dwNumberOfProcessors; #else #ifdef MACOSX - numCPU = 4; + numCPU = 4; #else - numCPU = sysconf( _SC_NPROCESSORS_ONLN ); + numCPU = sysconf( _SC_NPROCESSORS_ONLN ); #endif #endif - - printf("Cpus: %d\n", numCPU); - if(numCPU>1) - printf("Multithreading enabled\n"); - else - printf("Multithreading disabled\n"); + + printf("Cpus: %d\n", numCPU); + if(numCPU>1) + printf("Multithreading enabled\n"); + else + printf("Multithreading disabled\n"); #endif - return numCPU; + return numCPU; } void update_air(void) { int x, y, i, j; float dp, dx, dy, f, tx, ty; - + for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; - if(dp < -256.0f) dp = -256.0f; - if(dx > 256.0f) dx = 256.0f; - if(dx < -256.0f) dx = -256.0f; - if(dy > 256.0f) dy = 256.0f; - if(dy < -256.0f) dy = -256.0f; - - ovx[y][x] = dx; - ovy[y][x] = dy; - opv[y][x] = dp; - } + for(x=0; x0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; + if(dp < -256.0f) dp = -256.0f; + if(dx > 256.0f) dx = 256.0f; + if(dx < -256.0f) dx = -256.0f; + if(dy > 256.0f) dy = 256.0f; + if(dy < -256.0f) dy = -256.0f; + + ovx[y][x] = dx; + ovy[y][x] = dy; + opv[y][x] = dp; + } memcpy(vx, ovx, sizeof(vx)); memcpy(vy, ovy, sizeof(vy)); memcpy(pv, opv, sizeof(pv)); @@ -324,57 +336,62 @@ void update_air(void) void *update_air_th(void *arg) { - update_air(); - return NULL; + update_air(); + return NULL; } inline unsigned clamp_flt(float f, float min, float max) { if(fmax) - return 255; + return 255; return (int)(255.0f*(f-min)/(max-min)); } -inline float restrict_flt(float f, float min, float max){ - if(fmax) - return max; - return f; + return max; + return f; } void draw_air(pixel *vid) { int x, y, i, j; pixel c; - + if(cmode == 2) - return; - + return; + for(y=0; y 0.0f) - c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); - else - c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); - } else - c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), - clamp_flt(pv[y][x], 0.0f, 8.0f), - clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); - for(j=0; j 0.0f) + c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); + else + c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); + } + else + c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), + clamp_flt(pv[y][x], 0.0f, 8.0f), + clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); + for(j=0; j> 4; -const struct part_type ptypes[] = { - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description - {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Very light dust. Flammable."}, - {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Flammable."}, - {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Heavy particles. Meltable."}, - {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, - {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 97, "Light dust. Explosive."}, - {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 50, "Liquid. Pressure sensitive explosive."}, - {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Solid. Duplicates any particles it touches."}, - {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 88, "Solid. Pressure sensitive explosive."}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms and disappears under pressure."}, - {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+-50.0f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, - {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Conducts electricity. Meltable."}, - {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP+-30.0f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f, 164, "Solid. Flammable."}, - {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 65, "Plant, drinks water and grows."}, - {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f, 34, "Dissolves almost everything."}, - {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Hole, will drain away any particles."}, - {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f, 100, "Concrete, stronger than stone."}, - {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 110, "Salt, dissolves in water."}, - {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f, 75, "Saltwater, conducts electricity, difficult to freeze."}, - {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. - {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f, 211, "Broken metal."}, - {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f, 251, "Heavy particles. Generates heat under pressure."}, - {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 44, "Wax. Melts at moderately high temperatures."}, - {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f, 44, "Liquid Wax."}, - {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "P-Type Silicon, Will transfer current to any conductor."}, - {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -205.0f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f, 0, "Insulator, does not conduct heat or electricity."}, - {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f, 255, "Black hole, sucks in other particles and heats up."}, - {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f, 255, "White hole, pushes other particles away."}, - {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, - {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f, 170, "Liquid Rubidium."}, - {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 150, "Solid. Meltable. Shatters under pressure"}, - {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f, 115, "Plasma, extremely hot."}, - {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, -250.0f, 46, "Nitrogen Ice."}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, - {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Generates Electricity."}, - {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, - {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, +const struct part_type ptypes[] = +{ + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Very light dust. Flammable."}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Flammable."}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f, 88, "Ignites flammable materials. Heats air."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Heavy particles. Meltable."}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 97, "Light dust. Explosive."}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 50, "Liquid. Pressure sensitive explosive."}, + {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Solid. Duplicates any particles it touches."}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 88, "Solid. Pressure sensitive explosive."}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms and disappears under pressure."}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+-50.0f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, + {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Conducts electricity. Meltable."}, + {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electricity. Conducted by metal and water."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP+-30.0f, 46, "Light particles."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f, 164, "Solid. Flammable."}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 60, "Neutrons. Interact with matter in odd ways."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 65, "Plant, drinks water and grows."}, + {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f, 34, "Dissolves almost everything."}, + {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Hole, will drain away any particles."}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f, 48, "Steam, heats up air, produced from hot water."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f, 100, "Concrete, stronger than stone."}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 23, "Distilled water, does not conduct electricity."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 110, "Salt, dissolves in water."}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f, 75, "Saltwater, conducts electricity, difficult to freeze."}, + {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 251, "Breakable metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f, 211, "Broken metal."}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f, 251, "Photons. Travel in straight lines."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f, 251, "Heavy particles. Generates heat under pressure."}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 44, "Wax. Melts at moderately high temperatures."}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f, 44, "Liquid Wax."}, + {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "P-Type Silicon, Will transfer current to any conductor."}, + {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -205.0f, 70, "Liquid Nitrogen. Very cold."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f, 0, "Insulator, does not conduct heat or electricity."}, + {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f, 255, "Black hole, sucks in other particles and heats up."}, + {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f, 255, "White hole, pushes other particles away."}, + {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f, 170, "Liquid Rubidium."}, + {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Sand, Heavy particles. Meltable."}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 150, "Solid. Meltable. Shatters under pressure"}, + {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f, 115, "Plasma, extremely hot."}, + {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, -250.0f, 46, "Nitrogen Ice."}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Generates Electricity."}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, }; #define ST_NONE 0 #define ST_SOLID 1 #define ST_LIQUID 2 #define ST_GAS 3 -const struct part_state pstates[] = { - // Name Solid Frzp Liquid Mpnt Gas Bpoint - /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WATR */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, - /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GASS, 50.0f, PT_NONE, 0.0f}, - /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2500.0f}, - /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 710.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LAVA */ {ST_LIQUID, PT_METL, 700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, - /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, - /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_OILL, -40.0f, PT_NONE, 50.0f, PT_FIRE, 300.0f}, - /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, - /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 500.0f}, - /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 300.0f}, - /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WTRV */ {ST_GAS, PT_ICEI, 0.0f, PT_DSTW, 98.0f, PT_NONE, 100.0f, PT_NONE, 0.0f}, - /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 850.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DSTW */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, - /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 900.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SLTW */ {ST_LIQUID, PT_ICEI, -40.0f, PT_NONE, 0.0f, PT_WTRV, 110.0f, PT_NONE, 0.0f}, - /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2100.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 46.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* MWAX */ {ST_LIQUID, PT_WAX, 45.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, - /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LNTG */ {ST_SOLID, PT_NICE, -210.0f, PT_NONE, 0.0f, PT_NONE, -195.8f, PT_NONE, 0.0f}, - /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 39.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, - /* LRBD */ {ST_LIQUID, PT_RBDM, 38.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, - /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, -209.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2000.0f}, - /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, +const struct part_state pstates[] = +{ + // Name Solid Frzp Liquid Mpnt Gas Bpoint + /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WATR */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, + /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GASS, 50.0f, PT_NONE, 0.0f}, + /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2500.0f}, + /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 710.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LAVA */ {ST_LIQUID, PT_METL, 700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_OILL, -40.0f, PT_NONE, 50.0f, PT_FIRE, 300.0f}, + /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 500.0f}, + /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 300.0f}, + /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WTRV */ {ST_GAS, PT_ICEI, 0.0f, PT_DSTW, 98.0f, PT_NONE, 100.0f, PT_NONE, 0.0f}, + /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 850.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DSTW */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, + /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 900.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SLTW */ {ST_LIQUID, PT_ICEI, -40.0f, PT_NONE, 0.0f, PT_WTRV, 110.0f, PT_NONE, 0.0f}, + /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2100.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 46.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* MWAX */ {ST_LIQUID, PT_WAX, 45.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LNTG */ {ST_SOLID, PT_NICE, -210.0f, PT_NONE, 0.0f, PT_NONE, -195.8f, PT_NONE, 0.0f}, + /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 39.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, + /* LRBD */ {ST_LIQUID, PT_RBDM, 38.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, + /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, -209.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2000.0f}, + /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; -static const unsigned char can_move[PT_NUM][PT_NUM] = { - /* A B */ - /* A 0 1 | B ligher than A */ - /* B 1 0 | A heavier than B */ - - /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S*/ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M*/ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K*/ - /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y M H E*/ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1}, - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0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0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - /* NBLE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* BTRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* LCRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* STKM */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0}, +static const unsigned char can_move[PT_NUM][PT_NUM] = +{ + /* A B */ + /* A 0 1 | B ligher than A */ + /* B 1 0 | A heavier than B */ + + /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S*/ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M*/ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K*/ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y M H E*/ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1}, + /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, + /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0}, + /* METL */ {0,1,1,1,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0}, + /* LAVA */ {0,1,1,1,1,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,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,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0}, }; #define FLAG_STAGNANT 1 -typedef struct { +typedef struct +{ int type; int life, ctype; float x, y, vx, vy; - float temp; - float pavg[2]; + float temp; + float pavg[2]; int flags; } particle; particle *parts; @@ -776,13 +802,15 @@ float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is int isplayer = 0; //It shows is player spawned or not int mousex, mousey = 0; //They contain mouse position -void menu_count(void){ - int i=0; - msections[SC_WALL].itemcount = UI_WALLCOUNT-4; - msections[SC_SPECIAL].itemcount = 4; - for(i=0; i=XRES || ny>=YRES) - return 0; + return 0; if(x==nx && y==ny) - return 1; + return 1; r = pmap[ny][nx]; if(r && (r>>8)>8].type; - - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))){ - return 1; - } - - if((r&0xFF)==PT_VOID){ - parts[i].type=PT_NONE; - return 0; - } - if((r&0xFF)==PT_BHOL){ - parts[i].type=PT_NONE; - if(!legacy_enable){ - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; - } - return 0; - } - - if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide - { - return 1; - } - - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]){ - return 1; - } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE){ - return 0; - } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])){ - return 0; - } - + r = (r&~0xFF) | parts[r>>8].type; + + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) + { + return 1; + } + + if((r&0xFF)==PT_VOID) + { + parts[i].type=PT_NONE; + return 0; + } + if((r&0xFF)==PT_BHOL) + { + parts[i].type=PT_NONE; + if(!legacy_enable) + { + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; + } + return 0; + } + + if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide + { + return 1; + } + + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) + { + return 1; + } + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) + { + return 0; + } + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) + { + return 0; + } + if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; + return 0; if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) - return 0; + return 0; if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) - return 0; - - if(parts[i].type==PT_CNCT && y= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) + return 0; + + if(parts[i].type==PT_CNCT && y>8)>= 8; - parts[r].x += x-nx; - parts[r].y += y-ny; + if(r && (r>>8)>= 8; + parts[r].x += x-nx; + parts[r].y += y-ny; } - + return 1; } @@ -869,13 +906,13 @@ void kill_part(int i) { int x, y; parts[i].type = PT_NONE; - + x = (int)(parts[i].x+0.5f); y = (int)(parts[i].y+0.5f); - + if(x>=0 && y>=0 && x=XRES || y>=YRES) - return -1; - - if(t==SPC_HEAT||t==SPC_COOL){ - if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); - } - if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP){ - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); - } - return pmap[y][x]>>8; - } else { - return -1; - } - } - if(t==SPC_AIR){ - pv[y/CELL][x/CELL] += 0.03f; - if(y+CELL>8].type = PT_SPRK; - parts[pmap[y][x]>>8].life = 4; - parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; - pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; - return pmap[y][x]>>8; - } - - if(p==-1) { - if(pmap[y][x]) - return -1; - if(pfree == -1) - return -1; - i = pfree; - pfree = parts[i].life; - } else - i = p; - - if(t==PT_GLAS){ - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - } + return -1; + + if(t==SPC_HEAT||t==SPC_COOL) + { + if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + } + if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) + { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + } + return pmap[y][x]>>8; + } + else + { + return -1; + } + } + if(t==SPC_AIR) + { + pv[y/CELL][x/CELL] += 0.03f; + if(y+CELL>8].type = PT_SPRK; + parts[pmap[y][x]>>8].life = 4; + parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; + pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; + return pmap[y][x]>>8; + } + + if(p==-1) + { + if(pmap[y][x]) + return -1; + if(pfree == -1) + return -1; + i = pfree; + pfree = parts[i].life; + } + else + i = p; + + if(t==PT_GLAS) + { + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + } if(t!=PT_STKM) { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = t; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 0; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - } - if(t==PT_ACID){ - parts[i].life = 75; - } - //Testing - /*if(t==PT_WOOD){ - parts[i].life = 150; - }*/ - //End Testing + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + } + if(t==PT_ACID) + { + parts[i].life = 75; + } + //Testing + /*if(t==PT_WOOD){ + parts[i].life = 150; + }*/ + //End Testing if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_PLSM) - parts[i].life = rand()%150+50; + parts[i].life = rand()%50+120; + if(t==PT_PLSM) + parts[i].life = rand()%150+50; if(t==PT_LAVA) - parts[i].life = rand()%120+240; + parts[i].life = rand()%120+240; if(t==PT_NBLE) - parts[i].life = 0; - if(t==PT_NEUT) { - float r = (rand()%128+128)/127.0f; - float a = (rand()%360)*3.14159f/180.0f; - parts[i].life = rand()%480+480; - parts[i].vx = r*cosf(a); - parts[i].vy = r*sinf(a); - } - if(t==PT_PHOT) { - float r = (rand()%3-1)*3; - float a = (rand()%3-1)*3; - parts[i].life = 680; - if(a==0.0f&&r==0.0f){ - parts[i].life = 0; - parts[i].type = PT_NONE; - return -1; - } else { - parts[i].vx = a; - parts[i].vy = r; - } - //} else { - // parts[i].life = 0; - // parts[i].type = PT_NONE; - //} - } - + parts[i].life = 0; + if(t==PT_NEUT) + { + float r = (rand()%128+128)/127.0f; + float a = (rand()%360)*3.14159f/180.0f; + parts[i].life = rand()%480+480; + parts[i].vx = r*cosf(a); + parts[i].vy = r*sinf(a); + } + if(t==PT_PHOT) + { + float r = (rand()%3-1)*3; + float a = (rand()%3-1)*3; + parts[i].life = 680; + if(a==0.0f&&r==0.0f) + { + parts[i].life = 0; + parts[i].type = PT_NONE; + return -1; + } + else + { + parts[i].vx = a; + parts[i].vy = r; + } + //} else { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + //} + } + if(t!=PT_STKM) - pmap[y][x] = t|(i<<8); + pmap[y][x] = t|(i<<8); else { - if(isplayer==0) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - player[2] = PT_DUST; - player[3] = x-1; //Setting legs positions - player[4] = y+6; - player[5] = x-1; - player[6] = y+6; - - player[7] = x-3; - player[8] = y+12; - player[9] = x-3; - player[10] = y+12; - - player[11] = x+1; - player[12] = y+6; - player[13] = x+1; - player[14] = y+6; - - player[15] = x+3; - player[16] = y+12; - player[17] = x+3; - player[18] = y+12; - - isplayer = 1; - } - } - + if(isplayer==0) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + player[2] = PT_DUST; + player[3] = x-1; //Setting legs positions + player[4] = y+6; + player[5] = x-1; + player[6] = y+6; + + player[7] = x-3; + player[8] = y+12; + player[9] = x-3; + player[10] = y+12; + + player[11] = x+1; + player[12] = y+6; + player[13] = x+1; + player[14] = y+6; + + player[15] = x+3; + player[16] = y+12; + player[17] = x+3; + player[18] = y+12; + + isplayer = 1; + } + } + return i; } void delete_part(int x, int y) { unsigned i; - + if(x<0 || y<0 || x>=XRES || y>=YRES) - return; + return; i = pmap[y][x]; if(!i || (i>>8)>=NPART) - return; - + return; + kill_part(i>>8); pmap[y][x] = 0; // just in case } @@ -1070,78 +1127,79 @@ inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) { pixel t; if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - if(a!=255) { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; } vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } int sign(float i) //Signum function { - if (i<0) - return -1; - if (i>0) - return 1; - return 0; -} + if (i<0) + return -1; + if (i>0) + return 1; + return 0; +} void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a) //Draws a line { - int dx, dy, i, sx, sy, check, e, x, y; - - dx = abs(x1-x2); - dy = abs(y1-y2); - sx = sign(x2-x1); - sy = sign(y2-y1); - x = x1; - y = y1; - check = 0; - - if (dy>dx) - { - dx = dx+dy; - dy = dx-dy; - dx = dx-dy; - check = 1; - } - - e = (dy<<2)-dx; - for (i=0; i<=dx; i++) - { - vid[x+y*a] =PIXRGB(r, g, b); - if (e>=0) - { - if (check==1) - x = x+sx; - else - y = y+sy; - e = e-(dx<<2); - } - if (check==1) - y = y+sy; - else - x = x+sx; - e = e+(dy<<2); - } + int dx, dy, i, sx, sy, check, e, x, y; + + dx = abs(x1-x2); + dy = abs(y1-y2); + sx = sign(x2-x1); + sy = sign(y2-y1); + x = x1; + y = y1; + check = 0; + + if (dy>dx) + { + dx = dx+dy; + dy = dx-dy; + dx = dx-dy; + check = 1; + } + + e = (dy<<2)-dx; + for (i=0; i<=dx; i++) + { + vid[x+y*a] =PIXRGB(r, g, b); + if (e>=0) + { + if (check==1) + x = x+sx; + else + y = y+sy; + e = e-(dx<<2); + } + if (check==1) + y = y+sy; + else + x = x+sx; + e = e+(dy<<2); + } } void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) { pixel t; if(x<0 || y<0 || x>=XRES || y>=YRES) - return; + return; t = vid[y*(XRES+BARSIZE)+x]; r = (a*r + 255*PIXR(t)) >> 8; g = (a*g + 255*PIXG(t)) >> 8; b = (a*b + 255*PIXB(t)) >> 8; if(r>255) - r = 255; + r = 255; if(g>255) - g = 255; + g = 255; if(b>255) b = 255; vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); @@ -1161,1685 +1219,2060 @@ int is_wire_off(int x, int y) void set_emap(int x, int y) { int x1, x2; - + if(!is_wire_off(x, y)) - return; - + return; + // go left as far as possible x1 = x2 = x; - while(x1>0) { - if(!is_wire_off(x1-1, y)) - break; - x1--; + while(x1>0) + { + if(!is_wire_off(x1-1, y)) + break; + x1--; } - while(x21 && x1==x2 && - is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && - !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) - set_emap(x1, y-2); + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + set_emap(x1, y-2); else if(y>0) - for(x=x1; x<=x2; x++) - if(is_wire_off(x, y-1)) { - if(x==x1 || x==x2 || y>=YRES/CELL-1 || - is_wire(x-1, y-1) || is_wire(x+1, y-1) || - is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) - set_emap(x, y-1); - } - + for(x=x1; x<=x2; x++) + if(is_wire_off(x, y-1)) + { + if(x==x1 || x==x2 || y>=YRES/CELL-1 || + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + set_emap(x, y-1); + } + if(y>8) < NPART && (pmr>>8) >= 0){ - return parts[pmr>>8].type; - } else { - return PT_NONE; - } +inline int parts_avg(int ci, int ni) +{ + int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; + if((pmr>>8) < NPART && (pmr>>8) >= 0) + { + return parts[pmr>>8].type; + } + else + { + return PT_NONE; + } } -int nearest_part(int ci, int t){ - int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); - int ndistance = 0; - int id = -1; - int i = 0; - int cx = (int)parts[ci].x; - int cy = (int)parts[ci].y; - for(i=0; i=XRES || y>=YRES || - ((bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) { - kill_part(i); - continue; - } - - vx[y/CELL][x/CELL] *= ptypes[t].airloss; - vy[y/CELL][x/CELL] *= ptypes[t].airloss; - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - if(t==PT_GASS||t==PT_NBLE) { - if(pv[y/CELL][x/CELL]<3.5f) - pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); - if(y+CELL2.5f) { - parts[i].life = rand()%80+180; - rt = parts[i].type = PT_FIRE; - parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - pv[y/CELL][x/CELL] += 0.25f * CFDS; - t = PT_FIRE; - } - - parts[i].vx *= ptypes[t].loss; - parts[i].vy *= ptypes[t].loss; - - if(t==PT_DFRM && !parts[i].life) { - if(pv[y/CELL][x/CELL]>1.0f) { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - parts[i].life = rand()%80+300; - } - } else { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - - if(ptypes[t].diffusion) { - parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - } - - // interpolator + float pt = R_TEMP; + float c_heat = 0.0f; + int h_count = 0; + int starti = (start*-1); + for(i=start; i<(NPART-starti); i+=inc) + if(parts[i].type) + { + + lx = parts[i].x; + ly = parts[i].y; + t = parts[i].type; + + if(sys_pause) + goto justdraw; + + if(parts[i].life && t!=PT_ACID && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM) + { + if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) + parts[i].life--; + if(parts[i].life<=0 && t!=PT_WIRE && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_HSCN && t!=PT_CSCN && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY) + { + kill_part(i); + continue; + } + if(parts[i].life<=0 && t==PT_SPRK) + { + t = parts[i].ctype; + if(t!=PT_WIRE&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM&&t!=PT_BTRY&&t!=PT_NBLE) + parts[i].temp = R_TEMP; + if(!t) + t = PT_WIRE; + parts[i].type = t; + parts[i].life = 4; + if(t == PT_WATR) + parts[i].life = 64; + if(t == PT_SLTW) + parts[i].life = 54; + } + } + + if(t==PT_SPRK&&parts[i].ctype==PT_SPRK) + { + kill_part(i); + continue; + } + + x = (int)(parts[i].x+0.5f); + y = (int)(parts[i].y+0.5f); + + + if(x<0 || y<0 || x>=XRES || y>=YRES || + ((bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) + { + kill_part(i); + continue; + } + + vx[y/CELL][x/CELL] *= ptypes[t].airloss; + vy[y/CELL][x/CELL] *= ptypes[t].airloss; + vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + if(t==PT_GASS||t==PT_NBLE) + { + if(pv[y/CELL][x/CELL]<3.5f) + pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); + if(y+CELL2.5f) + { + parts[i].life = rand()%80+180; + rt = parts[i].type = PT_FIRE; + parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + pv[y/CELL][x/CELL] += 0.25f * CFDS; + t = PT_FIRE; + } + + parts[i].vx *= ptypes[t].loss; + parts[i].vy *= ptypes[t].loss; + + if(t==PT_DFRM && !parts[i].life) + { + if(pv[y/CELL][x/CELL]>1.0f) + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].life = rand()%80+300; + } + } + else + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + + if(ptypes[t].diffusion) + { + parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + } + + // interpolator #ifdef WIN32 - mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); + mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); #else - mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); + mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); #endif - if(mv < ISTP) { - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - } else { - dx = parts[i].vx*ISTP/mv; - dy = parts[i].vy*ISTP/mv; - ix = parts[i].x; - iy = parts[i].y; - while(1) { - mv -= ISTP; - if(mv <= 0.0f) { - // nothing found - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - break; - } - ix += dx; - iy += dy; - nx = (int)(ix+0.5f); - ny = (int)(iy+0.5f); - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) { - parts[i].x = ix; - parts[i].y = iy; - break; - } - } - } - - a = nt = 0; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx4.0f) - t = parts[i].type = PT_DSTW; - if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) - t = parts[i].type = PT_OILL; - if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) - t = parts[i].type = PT_GASS; - } - if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) - t = parts[i].type = PT_BRMT; - //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) - // t = parts[i].type = PT_BGLA; - if(t==PT_GLAS){ - parts[i].pavg[0] = parts[i].pavg[1]; - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f){ - parts[i].type = PT_BGLA; - } - } - if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) - t = parts[i].type = PT_SNOW; - if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) { - t = PT_NEUT; - create_part(i, x, y, t); - } - - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1){ - nearp = nearest_part(i, PT_ETRD); - if(nearp!=-1){ - create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[nearp].type = PT_SPRK; - parts[nearp].life = 9; - parts[nearp].ctype = PT_ETRD; - } - } - - if(!legacy_enable){ - int ctemp = pv[y/CELL][x/CELL]*2; - c_heat = 0.0f; - h_count = 0; - if(ptypes[t].hconduct>(rand()%250)){ - for(nx=-1; nx<2; nx++) { - for(ny=-1; ny<2; ny++) { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0){ - h_count++; - c_heat += parts[r>>8].temp; - } - } - } - } - pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); - for(nx=-1; nx<2; nx++) { - for(ny=-1; ny<2; ny++) { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0){ - parts[r>>8].temp = parts[i].temp; - } - } - } - } - if(pt>=pstates[t].btemp&&pstates[t].burn) { - t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE||t==PT_PLSM) - parts[i].life = rand()%50+120; - } - else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid){ - if(t==PT_LAVA&&parts[i].ctype){ - parts[i].life = 0; - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp){ - parts[i].ctype = parts[i].type; - t = parts[i].type = PT_ICEI; - } else { - parts[i].life = 0; - t = parts[i].type = pstates[t].solid; - } - } else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)){ - if(pstates[t].liquid==PT_LAVA){ - parts[i].life = rand()%120+240; - parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; - parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; - t = parts[i].type = pstates[t].liquid; - } else if(t==PT_ICEI&&parts[i].ctype){ - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } else { - t = parts[i].type = pstates[t].liquid; - } - }else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS){ - t = parts[i].type = pstates[t].liquid; - }else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)){ - if(t==PT_SLTW&&1>rand()%6){ - t = parts[i].type = PT_SALT; - } else { - t = parts[i].type = pstates[t].gas; - pv[y/CELL][x/CELL] += 0.50f; - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - } - } - if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f){ - float atemp = parts[i].temp + (-MIN_TEMP); - pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; - } - if(t==PT_LAVA){ - parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - } - pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - } - } - if(t==PT_CSCN&&parts[i].temp>24.0f){ - pt = parts[i].temp -= 2.5f; - } - if(t==PT_HSCN&&parts[i].temp>24.0f){ - pt = parts[i].temp -= 2.5f; - } - - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) { - nx = x % CELL; - if(nx == 0) - nx = x/CELL - 1; - else if(nx == CELL-1) - nx = x/CELL + 1; - else - nx = x/CELL; - ny = y % CELL; - if(ny == 0) - ny = y/CELL - 1; - else if(ny == CELL-1) - ny = y/CELL + 1; - else - ny = y/CELL; - if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ){ - t = parts[i].type = PT_NONE; - parts[r>>8].ctype = parts[r>>8].type; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - } else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) { - pv[y/CELL][x/CELL] += 100.0f; - if(legacy_enable&&1>(rand()%200)){ - parts[i].life = rand()%50+120; - t = parts[i].type = PT_FIRE; - } else { - t = parts[i].type = PT_NONE; - } - } - } - } else if(t==PT_ICEI || t==PT_SNOW) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if(legacy_enable){ - if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) { - t = parts[i].type = PT_ICEI; - parts[r>>8].type = PT_ICEI; - } - if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) - t = parts[i].type = PT_WATR; - } - } - } - else if(t==PT_HSCN||t==PT_CSCN) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) { - parts[i].temp = 200.0f; - } - } - } - //PLANT - else if(t==PT_PLNT) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR && 1>(rand()%250)) { - t = parts[i].type = PT_PLNT; - parts[r>>8].type = PT_PLNT; - } else if((r&0xFF)==PT_LAVA && 1>(rand()%250)){ - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_WATR||t==PT_DSTW) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) { - t = parts[i].type = PT_WTRV; - } else if((r&0xFF)==PT_SALT && 1>(rand()%250)) { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)){ - t = parts[i].type = PT_WATR; - } - if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)){ - t = parts[i].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)){ - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_SLTW) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) { - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; - } else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) { - parts[r>>8].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)){ - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } else if(t==PT_WTRV) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) { - t = parts[i].type = PT_WATR; - parts[r>>8].type = PT_WATR; - } - - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)){ - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) { - t = parts[i].type = PT_WATR; - if(1>(rand()%1000)) - parts[r>>8].type = PT_WATR; - } - } - } else if(t==PT_ACID) { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)!=PT_ACID){ - if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD){ - t = parts[i].type = PT_FIRE; - parts[i].life = 4; - parts[r>>8].type = PT_FIRE; - parts[r>>8].life = 4; - } else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) { - parts[i].life--; - parts[r>>8].type = PT_NONE; - } else if (parts[i].life==50){ - parts[i].life = 0; - t = parts[i].type = PT_NONE; - } - } - } - } else if(t==PT_NEUT) { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) { - if(33>rand()%100) { - create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); - } else { - create_part(r>>8, x+nx, y+ny, PT_NEUT); - parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; - parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; - } - pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough - fe ++; - } - if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) - parts[r>>8].type = PT_DUST; - if((r&0xFF)==PT_WATR && 15>(rand()%100)) - parts[r>>8].type = PT_DSTW; - if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) - parts[r>>8].type = PT_DFRM; - if((r&0xFF)==PT_NITR && 15>(rand()%1000)) - parts[r>>8].type = PT_OILL; - if((r&0xFF)==PT_OILL && 5>(rand()%1000)) - parts[r>>8].type = PT_GASS; - if((r&0xFF)==PT_PLNT && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - } - } else if(t==PT_PHOT){ - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=0; nx<1; nx++) - for(ny=0; ny<1; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - } - } else if(t==PT_LCRY){ - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK){ - if(parts[r>>8].ctype==PT_PSCN) { - parts[i].life = 10; - } else if(parts[r>>8].ctype==PT_NSCN) { - parts[i].life = 9; - } - } - if(rt==PT_LCRY){ - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0){ - parts[i].life = 9; - } else if(parts[i].life==0&&parts[r>>8].life==10){ - parts[i].life = 10; - } - } - } - } else if(t==PT_BTRY){ - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(parts_avg(i,r>>8) != PT_INSL){ - if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) { - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - parts[r>>8].type = PT_SPRK; - } - } - } - } - if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)) || t ==PT_SWCH) { - if(t==PT_SWCH) - if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) - { - parts[i].life--; - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) - continue; - rt = parts[r>>8].type; - if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && - ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { - parts[r>>8].type = PT_FIRE; - parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - parts[r>>8].life = rand()%80+180; - if(ptypes[rt].explosive) - pv[y/CELL][x/CELL] += 0.25f * CFDS; - continue; - } - lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; - if(lpv < 1) lpv = 1; - if(legacy_enable){ - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && - ptypes[rt].meltable*lpv>(rand()%1000)) { - if(t!=PT_LAVA || parts[i].life>0) { - parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; - parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; - parts[r>>8].type = PT_LAVA; - parts[r>>8].life = rand()%120+240; - } else { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) { - parts[r>>8].type = PT_WATR; - if(t==PT_FIRE) { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) { - parts[i].life = 0; - t = parts[i].type = PT_METL; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) { - kill_part(r>>8); - if(t==PT_FIRE) { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE; - goto killed; - } - } - } - pavg = parts_avg(i, r>>8); - if(t==PT_SWCH&&pavg!= PT_INSL){ - if(parts[r>>8].type == PT_SWCH){ - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0){ - parts[i].life = 9; - } else if(parts[i].life==0&&parts[r>>8].life==10){ - parts[i].life = 10; - } - } - } - if(rt==PT_SWCH && t==PT_SPRK){ - pavg = parts_avg(r>>8, i); - if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) - parts[r>>8].life = 10; - if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) - parts[r>>8].life = 9; - if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL){ - parts[r>>8].type = PT_SPRK; - parts[r>>8].ctype = PT_SWCH; - parts[r>>8].life = 4; - } - } - pavg = parts_avg(i, r>>8); - if(pavg != PT_INSL){ - if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ){ - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) - parts[r>>8].temp = parts[r>>8].temp+10.0f; - } - } - if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL){ - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL){ - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 6; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 5; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5){ - if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN){ - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - - if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) - { - parts[i].life = rand()%150+50; - parts[i].type = PT_PLSM; - parts[i].ctype = PT_NBLE; - parts[i].temp = 3500; - pv[y/CELL][x/CELL] += 1; - } - if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) - { - parts[i].type = PT_SWCH; - parts[i].life = 11; - } - } - } - killed: - if(parts[i].type == PT_NONE) - continue; - } - - if(t==PT_STKM) - { - //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) - parts[i].temp += 1; - - //Death - if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... - { - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - //Verlet integration - pp = 2*player[3]-player[5]; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+1; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+1; - player[18] = player[16]; - player[16] = pp; - - //Go left - if (((int)(player[0])&0x01) == 0x01) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] += 3; player[10] += 2; player[5] += 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 3; player[18] += 2; player[13] +=2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[9] += 1; player[10] += 1; player[5] += 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 1; player[18] += 1; player[13] +=1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 3; player[10] += 2; player[5] -= 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 3; player[18] += 2; player[13] -= 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 1; player[10] += 1; player[5] -= 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 1; player[18] += 1; player[13] -= 1; - } - - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)){ - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - create_part(-1, nx, ny, player[2]); - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 ) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - } - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; player[10] += 1; player[18] += 1; - } - - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) - player[15] -= nx; - - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= 10+ny; - parts[i].vy = -10; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[7] += 0.2; - player[15] -= 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[3] += 0.2; - player[11] -= 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[16] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[8] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } - - if(t==PT_CLNE) { - if(!parts[i].ctype) { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx=XRES-CELL || - ny=YRES-CELL) { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - continue; - } - - rt = parts[i].flags & FLAG_STAGNANT; - parts[i].flags &= ~FLAG_STAGNANT; - if(!try_move(i, x, y, nx, ny)) { - parts[i].x = lx; - parts[i].y = ly; - if(ptypes[t].falldown) { - if(nx!=x && try_move(i, x, y, nx, y)) { - parts[i].x = ix; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else if(ny!=y && try_move(i, x, y, x, ny)) { - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else { - r = (rand()%2)*2-1; - if(ny!=y && try_move(i, x, y, x+r, ny)) { - parts[i].x += r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else if(ny!=y && try_move(i, x, y, x-r, ny)) { - parts[i].x -= r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else if(nx!=x && try_move(i, x, y, nx, y+r)) { - parts[i].x = ix; - parts[i].y += r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else if(nx!=x && try_move(i, x, y, nx, y-r)) { - parts[i].x = ix; - parts[i].y -= r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) { - s = 0; - if(!rt || nt) - rt = 50; - else - rt = 10; - for(j=x+r; j>=0 && j>=x-rt && j0) - r = 1; - else - r = -1; - if(s) - for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; - if(nxy+ISTP) ny=y+ISTP; - if(ny(rand()%1000)) { - kill_part(i); - continue; - } else if(try_move(i, x, y, 2*x-nx, ny)) { - parts[i].x = (float)(2*x-nx); - parts[i].y = (float)iy; - parts[i].vx *= ptypes[t].collision; - } else if(try_move(i, x, y, nx, 2*y-ny)) { - parts[i].x = (float)ix; - parts[i].y = (float)(2*y-ny); - parts[i].vy *= ptypes[t].collision; - } else { - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - } - } - - justdraw: - - nx = (int)(parts[i].x+0.5f); - ny = (int)(parts[i].y+0.5f); - - if(nx=XRES-CELL || - ny=YRES-CELL) { - kill_part(i); - continue; - } - if(cmode!=CM_HEAT){ - if(t==PT_STKM) //Just draw head here - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; - vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; - vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; - vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; - } - draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); - draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); - draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); - draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); - - isplayer = 1; //It's a secret. Tssss... - } - - if(t==PT_ACID) { - if(parts[i].life>255) parts[i].life = 255; - if(parts[i].life<47) parts[i].life = 48; - s = (255/((parts[i].life-46)*28)); - if(s==0) s = 1; - cr = PIXR(ptypes[t].pcolors)/s; - cg = PIXG(ptypes[t].pcolors)/s; - cb = PIXB(ptypes[t].pcolors)/s; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - if(cmode==4){ - blendpixel(vid, nx+1, ny, cr, cg, cb, 223); - blendpixel(vid, nx-1, ny, cr, cg, cb, 223); - blendpixel(vid, nx, ny+1, cr, cg, cb, 223); - blendpixel(vid, nx, ny-1, cr, cg, cb, 223); - - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); - } - }else if(t==PT_NEUT) { - if(cmode == 3||cmode==4) { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 8; - cb = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } else { - cr = 0x20; - cg = 0xE0; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - }else if(t==PT_PHOT) { - if(cmode == 3||cmode==4) { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 12; - cb = 12; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } else { - cr = 0xFF; - cg = 0xFF; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_SWCH && parts[i].life == 10) { - x = nx; - y = ny; - blendpixel(vid,x,y,17,217,24,255); - } else if(t==PT_SMKE) { - if(cmode == 3||cmode==4) { - x = nx/CELL; - y = ny/CELL; - cg = 10; - cb = 10; - cr = 10; - cg += fire_g[y][x]; if(cg > 50) cg = 50; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 50) cb = 50; fire_b[y][x] = cb; - cr += fire_r[y][x]; if(cr > 50) cr = 50; fire_r[y][x] = cr; - } else { - for(x=-3;x<4;x++){ - for(y=-3;y<4;y++){ - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny,100,100,100,30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,100,100,100,10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,100,100,100,20); - } - } - } - } else if(t==PT_WTRV) { - if(cmode == 3||cmode==4) { - x = nx/CELL; - y = ny/CELL; - cg = PIXG(ptypes[t].pcolors)/3; - cb = PIXB(ptypes[t].pcolors)/3; - cr = PIXR(ptypes[t].pcolors)/3; - cg += fire_g[y][x]; if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; fire_b[y][x] = cb; - cr += fire_r[y][x]; if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; fire_r[y][x] = cr; - } else { - for(x=-3;x<4;x++){ - for(y=-3;y<4;y++){ - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); - } - } - } - } else if(t==PT_THDR) { - if(cmode == 3||cmode==4) { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 16; - cb = 20; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } else { - cr = 0xFF; - cg = 0xFF; - cb = 0xA0; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_LCRY) { - if(cmode == 3||cmode==4) { - //cr = R/8; - //cg = G/8; - //cb = B/8; - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); - //x = nx/CELL; - //y = ny/CELL; - //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } else { - cr = 0x50+(parts[i].life*10); - cg = 0x50+(parts[i].life*10); - cb = 0x50+(parts[i].life*10); - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - }else if(t==PT_PLSM) { - float ttemp = parts[i].life; - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = plasma_data[caddress]; - uint8 G = plasma_data[caddress+1]; - uint8 B = plasma_data[caddress+2]; - if(cmode == 3||cmode==4) { - cr = R/8; - cg = G/8; - cb = B/8; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } else { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_FIRE && parts[i].life) { - if(cmode == 3||cmode==4) { - cr = parts[i].life / 4; - cg = parts[i].life / 16; - cb = parts[i].life / 32; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } else { - cr = parts[i].life * 8; - cg = parts[i].life * 2; - cb = parts[i].life; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_LAVA && parts[i].life) { - cr = parts[i].life * 2 + 0xE0; - cg = parts[i].life * 1 + 0x50; - cb = parts[i].life/2 + 0x10; - if(cr>255) cr = 255; - if(cg>192) cg = 192; - if(cb>128) cb = 128; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 64); - blendpixel(vid, nx-1, ny, cr, cg, cb, 64); - blendpixel(vid, nx, ny+1, cr, cg, cb, 64); - blendpixel(vid, nx, ny-1, cr, cg, cb, 64); - if(cmode == 3||cmode==4) { - cr /= 32; - cg /= 32; - cb /= 32; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } else if(t==PT_LAVA || t==PT_SPRK) { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - if(cmode == 3 || cmode==4) { - if(t == PT_LAVA) { - cr = 3; - cg = i%2; - cb = 0; - } else { - cr = 8; - cg = 12; - cb = 16; - } - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } else - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - } else { - float ttemp = parts[i].temp+(-MIN_TEMP); - int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); - uint8 R = color_data[caddress]; - uint8 G = color_data[caddress+1]; - uint8 B = color_data[caddress+2]; - - if(t==PT_STKM) //Stick man should be visible in heat mode - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); - vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); - vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); - vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); - } - draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); - draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); - draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); - draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); - } - else - { - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); - //blendpixel(vid, nx+1, ny, R, G, B, 255); - } - } - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID){ - uint8 R = PIXR(ptypes[t].pcolors); - uint8 G = PIXG(ptypes[t].pcolors); - uint8 B = PIXB(ptypes[t].pcolors); - - //if(vid[(ny-1)*YRES+(nx-1)]!=0){ - // blendpixel(vid, nx, ny-1, R, G, B, 46); - //} - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); - } - - } - + if(mv < ISTP) + { + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + } + else + { + dx = parts[i].vx*ISTP/mv; + dy = parts[i].vy*ISTP/mv; + ix = parts[i].x; + iy = parts[i].y; + while(1) + { + mv -= ISTP; + if(mv <= 0.0f) + { + // nothing found + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + break; + } + ix += dx; + iy += dy; + nx = (int)(ix+0.5f); + ny = (int)(iy+0.5f); + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) + { + parts[i].x = ix; + parts[i].y = iy; + break; + } + } + } + + a = nt = 0; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx4.0f) + t = parts[i].type = PT_DSTW; + if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) + t = parts[i].type = PT_OILL; + if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) + t = parts[i].type = PT_GASS; + } + if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) + t = parts[i].type = PT_BRMT; + //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) + // t = parts[i].type = PT_BGLA; + if(t==PT_GLAS) + { + parts[i].pavg[0] = parts[i].pavg[1]; + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) + { + parts[i].type = PT_BGLA; + } + } + if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) + t = parts[i].type = PT_SNOW; + if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) + { + t = PT_NEUT; + create_part(i, x, y, t); + } + + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) + { + nearp = nearest_part(i, PT_ETRD); + if(nearp!=-1) + { + create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[nearp].type = PT_SPRK; + parts[nearp].life = 9; + parts[nearp].ctype = PT_ETRD; + } + } + + if(!legacy_enable) + { + int ctemp = pv[y/CELL][x/CELL]*2; + c_heat = 0.0f; + h_count = 0; + if(ptypes[t].hconduct>(rand()%250)) + { + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + h_count++; + c_heat += parts[r>>8].temp; + } + } + } + } + pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + parts[r>>8].temp = parts[i].temp; + } + } + } + } + if(pt>=pstates[t].btemp&&pstates[t].burn) + { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE||t==PT_PLSM) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) + { + if(t==PT_LAVA&&parts[i].ctype) + { + parts[i].life = 0; + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) + { + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } + else + { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } + else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) + { + if(pstates[t].liquid==PT_LAVA) + { + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } + else if(t==PT_ICEI&&parts[i].ctype) + { + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else + { + t = parts[i].type = pstates[t].liquid; + } + } + else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) + { + t = parts[i].type = pstates[t].liquid; + } + else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) + { + if(t==PT_SLTW&&1>rand()%6) + { + t = parts[i].type = PT_SALT; + } + else + { + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) + { + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA) + { + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } + } + if(t==PT_CSCN&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + if(t==PT_HSCN&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) + { + nx = x % CELL; + if(nx == 0) + nx = x/CELL - 1; + else if(nx == CELL-1) + nx = x/CELL + 1; + else + nx = x/CELL; + ny = y % CELL; + if(ny == 0) + ny = y/CELL - 1; + else if(ny == CELL-1) + ny = y/CELL + 1; + else + ny = y/CELL; + if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ) + { + t = parts[i].type = PT_NONE; + parts[r>>8].ctype = parts[r>>8].type; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + } + else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) + { + pv[y/CELL][x/CELL] += 100.0f; + if(legacy_enable&&1>(rand()%200)) + { + parts[i].life = rand()%50+120; + t = parts[i].type = PT_FIRE; + } + else + { + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_ICEI || t==PT_SNOW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if(legacy_enable) + { + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; + } + } + } + else if(t==PT_HSCN||t==PT_CSCN) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) + { + parts[i].temp = 200.0f; + } + } + } + //PLANT + else if(t==PT_PLNT) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR && 1>(rand()%250)) + { + t = parts[i].type = PT_PLNT; + parts[r>>8].type = PT_PLNT; + } + else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WATR||t==PT_DSTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%250)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_WATR; + } + if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_SLTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) + { + parts[r>>8].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_WTRV) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + parts[r>>8].type = PT_WATR; + } + + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; + } + } + } + else if(t==PT_ACID) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)!=PT_ACID) + { + if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) + { + t = parts[i].type = PT_FIRE; + parts[i].life = 4; + parts[r>>8].type = PT_FIRE; + parts[r>>8].life = 4; + } + else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) + { + parts[i].life--; + parts[r>>8].type = PT_NONE; + } + else if (parts[i].life==50) + { + parts[i].life = 0; + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_NEUT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) + { + if(33>rand()%100) + { + create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); + } + else + { + create_part(r>>8, x+nx, y+ny, PT_NEUT); + parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; + parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; + } + pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + fe ++; + } + if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + parts[r>>8].type = PT_DUST; + if((r&0xFF)==PT_WATR && 15>(rand()%100)) + parts[r>>8].type = PT_DSTW; + if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) + parts[r>>8].type = PT_DFRM; + if((r&0xFF)==PT_NITR && 15>(rand()%1000)) + parts[r>>8].type = PT_OILL; + if((r&0xFF)==PT_OILL && 5>(rand()%1000)) + parts[r>>8].type = PT_GASS; + if((r&0xFF)==PT_PLNT && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + } + } + else if(t==PT_PHOT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=0; nx<1; nx++) + for(ny=0; ny<1; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + } + } + else if(t==PT_LCRY) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_LCRY) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_BTRY) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts_avg(i,r>>8) != PT_INSL) + { + if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) + { + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + parts[r>>8].type = PT_SPRK; + } + } + } + } + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)) || t ==PT_SWCH) + { + if(t==PT_SWCH) + if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) + { + parts[i].life--; + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) + continue; + rt = parts[r>>8].type; + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL) || t!=PT_SPRK) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) + { + parts[r>>8].type = PT_FIRE; + parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + parts[r>>8].life = rand()%80+180; + if(ptypes[rt].explosive) + pv[y/CELL][x/CELL] += 0.25f * CFDS; + continue; + } + lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; + if(lpv < 1) lpv = 1; + if(legacy_enable) + { + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && + ptypes[rt].meltable*lpv>(rand()%1000)) + { + if(t!=PT_LAVA || parts[i].life>0) + { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } + else + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) + { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = PT_METL; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) + { + kill_part(r>>8); + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE; + goto killed; + } + } + } + pavg = parts_avg(i, r>>8); + if(t==PT_SWCH&&pavg!= PT_INSL) + { + if(parts[r>>8].type == PT_SWCH) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + if(rt==PT_SWCH && t==PT_SPRK) + { + pavg = parts_avg(r>>8, i); + if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) + parts[r>>8].life = 10; + if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) + parts[r>>8].life = 9; + if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].ctype = PT_SWCH; + parts[r>>8].life = 4; + } + } + pavg = parts_avg(i, r>>8); + if(pavg != PT_INSL) + { + if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) + parts[r>>8].temp = parts[r>>8].temp+10.0f; + } + } + if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 6; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 5; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) + { + if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) + { + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) + { + parts[i].life = rand()%150+50; + parts[i].type = PT_PLSM; + parts[i].ctype = PT_NBLE; + parts[i].temp = 3500; + pv[y/CELL][x/CELL] += 1; + } + if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) + { + parts[i].type = PT_SWCH; + parts[i].life = 11; + } + } + } +killed: + if(parts[i].type == PT_NONE) + continue; + } + + if(t==PT_STKM) + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; + player[10] += 2; + player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; + player[18] += 2; + player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; + player[10] += 1; + player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; + player[18] += 1; + player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; + player[10] += 2; + player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; + player[18] += 2; + player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; + player[10] += 1; + player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; + player[18] += 1; + player[13] -= 1; + } + + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) + || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 ) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + } + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[10] += 1; + player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } + + if(t==PT_CLNE) + { + if(!parts[i].ctype) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx=XRES-CELL || + ny=YRES-CELL) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + continue; + } + + rt = parts[i].flags & FLAG_STAGNANT; + parts[i].flags &= ~FLAG_STAGNANT; + if(!try_move(i, x, y, nx, ny)) + { + parts[i].x = lx; + parts[i].y = ly; + if(ptypes[t].falldown) + { + if(nx!=x && try_move(i, x, y, nx, y)) + { + parts[i].x = ix; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x, ny)) + { + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else + { + r = (rand()%2)*2-1; + if(ny!=y && try_move(i, x, y, x+r, ny)) + { + parts[i].x += r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x-r, ny)) + { + parts[i].x -= r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y+r)) + { + parts[i].x = ix; + parts[i].y += r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y-r)) + { + parts[i].x = ix; + parts[i].y -= r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) + { + s = 0; + if(!rt || nt) + rt = 50; + else + rt = 10; + for(j=x+r; j>=0 && j>=x-rt && j0) + r = 1; + else + r = -1; + if(s) + for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny(rand()%1000)) + { + kill_part(i); + continue; + } + else if(try_move(i, x, y, 2*x-nx, ny)) + { + parts[i].x = (float)(2*x-nx); + parts[i].y = (float)iy; + parts[i].vx *= ptypes[t].collision; + } + else if(try_move(i, x, y, nx, 2*y-ny)) + { + parts[i].x = (float)ix; + parts[i].y = (float)(2*y-ny); + parts[i].vy *= ptypes[t].collision; + } + else + { + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + } + } + +justdraw: + + nx = (int)(parts[i].x+0.5f); + ny = (int)(parts[i].y+0.5f); + + if(nx=XRES-CELL || + ny=YRES-CELL) + { + kill_part(i); + continue; + } + if(cmode!=CM_HEAT) + { + if(t==PT_STKM) //Just draw head here + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; + vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; + vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; + vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; + } + draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); + draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); + draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); + draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); + + isplayer = 1; //It's a secret. Tssss... + } + + if(t==PT_ACID) + { + if(parts[i].life>255) parts[i].life = 255; + if(parts[i].life<47) parts[i].life = 48; + s = (255/((parts[i].life-46)*28)); + if(s==0) s = 1; + cr = PIXR(ptypes[t].pcolors)/s; + cg = PIXG(ptypes[t].pcolors)/s; + cb = PIXB(ptypes[t].pcolors)/s; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + if(cmode==4) + { + blendpixel(vid, nx+1, ny, cr, cg, cb, 223); + blendpixel(vid, nx-1, ny, cr, cg, cb, 223); + blendpixel(vid, nx, ny+1, cr, cg, cb, 223); + blendpixel(vid, nx, ny-1, cr, cg, cb, 223); + + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); + } + } + else if(t==PT_NEUT) + { + if(cmode == 3||cmode==4) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 8; + cb = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = 0x20; + cg = 0xE0; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_PHOT) + { + if(cmode == 3||cmode==4) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 12; + cb = 12; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_SWCH && parts[i].life == 10) + { + x = nx; + y = ny; + blendpixel(vid,x,y,17,217,24,255); + } + else if(t==PT_SMKE) + { + if(cmode == 3||cmode==4) + { + x = nx/CELL; + y = ny/CELL; + cg = 10; + cb = 10; + cr = 10; + cg += fire_g[y][x]; + if(cg > 50) cg = 50; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 50) cb = 50; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 50) cr = 50; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,100,100,100,30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,100,100,100,10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,100,100,100,20); + } + } + } + } + else if(t==PT_WTRV) + { + if(cmode == 3||cmode==4) + { + x = nx/CELL; + y = ny/CELL; + cg = PIXG(ptypes[t].pcolors)/3; + cb = PIXB(ptypes[t].pcolors)/3; + cr = PIXR(ptypes[t].pcolors)/3; + cg += fire_g[y][x]; + if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); + } + } + } + } + else if(t==PT_THDR) + { + if(cmode == 3||cmode==4) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 16; + cb = 20; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xA0; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LCRY) + { + if(cmode == 3||cmode==4) + { + //cr = R/8; + //cg = G/8; + //cb = B/8; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); + //x = nx/CELL; + //y = ny/CELL; + //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } + else + { + cr = 0x50+(parts[i].life*10); + cg = 0x50+(parts[i].life*10); + cb = 0x50+(parts[i].life*10); + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_PLSM) + { + float ttemp = parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = plasma_data[caddress]; + uint8 G = plasma_data[caddress+1]; + uint8 B = plasma_data[caddress+2]; + if(cmode == 3||cmode==4) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_FIRE && parts[i].life) + { + if(cmode == 3||cmode==4) + { + cr = parts[i].life / 4; + cg = parts[i].life / 16; + cb = parts[i].life / 32; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = parts[i].life * 8; + cg = parts[i].life * 2; + cb = parts[i].life; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LAVA && parts[i].life) + { + cr = parts[i].life * 2 + 0xE0; + cg = parts[i].life * 1 + 0x50; + cb = parts[i].life/2 + 0x10; + if(cr>255) cr = 255; + if(cg>192) cg = 192; + if(cb>128) cb = 128; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 64); + blendpixel(vid, nx-1, ny, cr, cg, cb, 64); + blendpixel(vid, nx, ny+1, cr, cg, cb, 64); + blendpixel(vid, nx, ny-1, cr, cg, cb, 64); + if(cmode == 3||cmode==4) + { + cr /= 32; + cg /= 32; + cb /= 32; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else if(t==PT_LAVA || t==PT_SPRK) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + if(cmode == 3 || cmode==4) + { + if(t == PT_LAVA) + { + cr = 3; + cg = i%2; + cb = 0; + } + else + { + cr = 8; + cg = 12; + cb = 16; + } + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + } + else + { + float ttemp = parts[i].temp+(-MIN_TEMP); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); + uint8 R = color_data[caddress]; + uint8 G = color_data[caddress+1]; + uint8 B = color_data[caddress+2]; + + if(t==PT_STKM) //Stick man should be visible in heat mode + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); + vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); + vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); + vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); + } + draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); + draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); + draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); + draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); + } + else + { + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); + //blendpixel(vid, nx+1, ny, R, G, B, 255); + } + } + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) + { + uint8 R = PIXR(ptypes[t].pcolors); + uint8 G = PIXG(ptypes[t].pcolors); + uint8 B = PIXB(ptypes[t].pcolors); + + //if(vid[(ny-1)*YRES+(nx-1)]!=0){ + // blendpixel(vid, nx, ny-1, R, G, B, 46); + //} + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + + } + } -void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb){ - blendpixel(vid, x+1, y, cr, cg, cb, 112); - blendpixel(vid, x-1, y, cr, cg, cb, 112); - blendpixel(vid, x, y+1, cr, cg, cb, 112); - blendpixel(vid, x, y-1, cr, cg, cb, 112); - - blendpixel(vid, x+1, y-1, cr, cg, cb, 64); - blendpixel(vid, x-1, y-1, cr, cg, cb, 64); - blendpixel(vid, x+1, y+1, cr, cg, cb, 64); - blendpixel(vid, x-1, y+1, cr, cg, cb, 64); +void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) +{ + blendpixel(vid, x+1, y, cr, cg, cb, 112); + blendpixel(vid, x-1, y, cr, cg, cb, 112); + blendpixel(vid, x, y+1, cr, cg, cb, 112); + blendpixel(vid, x, y-1, cr, cg, cb, 112); + + blendpixel(vid, x+1, y-1, cr, cg, cb, 64); + blendpixel(vid, x-1, y-1, cr, cg, cb, 64); + blendpixel(vid, x+1, y+1, cr, cg, cb, 64); + blendpixel(vid, x-1, y+1, cr, cg, cb, 64); } -void update_particles_i_th(void *arg){ - upstruc *newup = (upstruc*)arg; - update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); - return; +void update_particles_i_th(void *arg) +{ + upstruc *newup = (upstruc*)arg; + update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); + return; } void update_particles(pixel *vid) @@ -2847,390 +3280,560 @@ void update_particles(pixel *vid) int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; float lx, ly; #ifdef MT - int pt = 0, pc = 0; - pthread_t *InterThreads; + int pt = 0, pc = 0; + pthread_t *InterThreads; #endif - + isplayer = 0; //Needed for player spawning memset(pmap, 0, sizeof(pmap)); r = rand()%2; - for(j=0; j=0 && y>=0 && x=0 && y>=0 && x>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) { - if(emap[y][x]) { - cr = cg = cb = 128; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) { - for(j=0; j 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==13) { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(emap[y][x] && !sys_pause) - emap[y][x] --; - } - } - } else { - for(y=0; y>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) { - if(emap[y][x]) { - cr = cg = cb = 128; - cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) { - for(j=0; j 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(bmap[y][x]==9){ - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; fire_r[y][x] = cr; - cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - } - } - if(emap[y][x] && !sys_pause) - emap[y][x] --; - } - } - } - + if(cmode==4) + { + for(y=0; y>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==13) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } + else + { + for(y=0; y>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==9) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } + #ifdef MT - if(numCores > 1) { - InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); - for(pc = 0; pc 1) + { + InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); + for(pc = 0; pc=XRES || ny<0 || ny>=YRES) - break; - addpixel(vid, nx, ny, 255, 255, 255, 64); - i = nx/CELL; - j = ny/CELL; - lx += vx[j][i]*0.125f; - ly += vy[j][i]*0.125f; - if(bmap[j][i]==5 && i!=x && j!=y) - break; - } - drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); - } - + for(x=0; x=XRES || ny<0 || ny>=YRES) + break; + addpixel(vid, nx, ny, 255, 255, 255, 64); + i = nx/CELL; + j = ny/CELL; + lx += vx[j][i]*0.125f; + ly += vy[j][i]*0.125f; + if(bmap[j][i]==5 && i!=x && j!=y) + break; + } + drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); + } + } void update_particles_th(void *arg) { - update_particles((pixel*)arg); - return; + update_particles((pixel*)arg); + return; } /*********************************************************** @@ -3246,11 +3849,11 @@ int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; void sdl_seticon(void) { #ifdef WIN32 - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else +#else #ifdef MACOSX - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); #else SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); @@ -3261,7 +3864,8 @@ void sdl_seticon(void) void sdl_open(void) { - if(SDL_Init(SDL_INIT_VIDEO)<0) { + if(SDL_Init(SDL_INIT_VIDEO)<0) + { fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); exit(1); } @@ -3271,14 +3875,15 @@ void sdl_open(void) #else sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); #endif - if(!sdl_scrn) { + if(!sdl_scrn) + { fprintf(stderr, "Creating window: %s\n", SDL_GetError()); exit(1); } SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); sdl_seticon(); SDL_EnableUNICODE(1); - //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); + //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); } void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) @@ -3289,10 +3894,11 @@ void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) if(SDL_LockSurface(sdl_scrn)<0) return; dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0;jpitch/PIXELSIZE; - src+=pitch; + for(j=0; jpitch/PIXELSIZE; + src+=pitch; } if(SDL_MUSTLOCK(sdl_scrn)) SDL_UnlockSurface(sdl_scrn); @@ -3308,15 +3914,18 @@ void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) if(SDL_LockSurface(sdl_scrn)<0) return; dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0;jpitch/PIXELSIZE; - } - src+=pitch; + for(j=0; jpitch/PIXELSIZE; + } + src+=pitch; } if(SDL_MUSTLOCK(sdl_scrn)) SDL_UnlockSurface(sdl_scrn); @@ -3325,9 +3934,9 @@ void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) { if(sdl_scale == 2) - sdl_blit_2(x, y, w, h, src, pitch); + sdl_blit_2(x, y, w, h, src, pitch); else - sdl_blit_1(x, y, w, h, src, pitch); + sdl_blit_1(x, y, w, h, src, pitch); } int frame_idx=0; @@ -3340,14 +3949,16 @@ void dump_frame(pixel *src, int w, int h, int pitch) sprintf(frame_name,"frame%04d.ppm",frame_idx); f=fopen(frame_name,"wb"); fprintf(f,"P6\n%d %d\n255\n",w,h); - for(j=0;j=0 && x=0 && y=0 && x=0 && yPT_NUM) - return 2; - if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) - return 3; - i = XRES*YRES; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) - return 1; - size = i; - } else - d = c; - - if(size < XRES*YRES) { - if(bzip2) - free(d); - return 1; - } - + + if(bzip2) + { + if(size<16) + return 1; + if(c[3]!=0x74 || c[2]!=0x49 || c[1]!=0x68 || c[0]!=0x53) + return 1; + if(c[4]>PT_NUM) + return 2; + if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) + return 3; + i = XRES*YRES; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) + return 1; + size = i; + } + else + d = c; + + if(size < XRES*YRES) + { + if(bzip2) + free(d); + return 1; + } + sy = 0; - for(y=0;y+scl<=YRES;y+=scl) { - sx = 0; - for(x=0;x+scl<=XRES;x+=scl) { - a = 0; - r = g = b = 0; - for(j=0;j=PT_NUM) - goto corrupt; - r += PIXR(ptypes[t].pcolors); - g += PIXG(ptypes[t].pcolors); - b += PIXB(ptypes[t].pcolors); - a ++; - } - } - if(a) { - a = 256/a; - r = (r*a)>>8; - g = (g*a)>>8; - b = (b*a)>>8; - } - - drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); - sx++; - } - sy++; - } - + for(y=0; y+scl<=YRES; y+=scl) + { + sx = 0; + for(x=0; x+scl<=XRES; x+=scl) + { + a = 0; + r = g = b = 0; + for(j=0; j=PT_NUM) + goto corrupt; + r += PIXR(ptypes[t].pcolors); + g += PIXG(ptypes[t].pcolors); + b += PIXB(ptypes[t].pcolors); + a ++; + } + } + if(a) + { + a = 256/a; + r = (r*a)>>8; + g = (g*a)>>8; + b = (b*a)>>8; + } + + drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); + sx++; + } + sy++; + } + if(bzip2) - free(d); + free(d); return 0; - + corrupt: if(bzip2) - free(d); + free(d); return 1; } static char *mystrdup(char *s) { char *x; - if(s) { - x = malloc(strlen(s)+1); - strcpy(x, s); - return x; + if(s) + { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; } return s; } void *build_save(int *size, int x0, int y0, int w, int h) { - unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; - + // normalize coordinates x0 = bx0*CELL; y0 = by0*CELL; w = bw *CELL; h = bh *CELL; - + // save the required air state for(y=by0; y255) i=255; - d[p++] = i; - } + for(x=bx0; x255) i=255; + d[p++] = i; + } for(y=by0; y255) i=255; - d[p++] = i; - } - + for(x=bx0; x255) i=255; + d[p++] = i; + } + // save the particle map for(i=0; i=x0 && x=y0 && y=x0 && x=y0 && y255) x=255; - if(y<0) y=0; - if(y>255) y=255; - d[p++] = x; - d[p++] = y; - } - } - for(j=0; j255) tttemp=255; - d[p++] = tttemp; - } - } - for(j=0; j255) x=255; + if(y<0) y=0; + if(y>255) y=255; + d[p++] = x; + d[p++] = y; + } + } + for(j=0; j255) tttemp=255; + d[p++] = tttemp; + } + } + for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; - d[p++] = (signs[i].y-y0); - d[p++] = (signs[i].y-y0)>>8; - d[p++] = signs[i].ju; - x = strlen(signs[i].text); - d[p++] = x; - memcpy(d+p, signs[i].text, x); - p+=x; - } - + if(signs[i].text[0] && + signs[i].x>=x0 && signs[i].x=y0 && signs[i].y>8; + d[p++] = (signs[i].y-y0); + d[p++] = (signs[i].y-y0)>>8; + d[p++] = signs[i].ju; + x = strlen(signs[i].text); + d[p++] = x; + memcpy(d+p, signs[i].text, x); + p+=x; + } + i = (p*101+99)/100 + 612; c = malloc(i); c[0] = 0x66; @@ -3706,16 +4347,17 @@ void *build_save(int *size, int x0, int y0, int w, int h) c[9] = p >> 8; c[10] = p >> 16; c[11] = p >> 24; - + i -= 12; - - if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) { - free(d); - free(c); - return NULL; + + if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) + { + free(d); + free(c); + return NULL; } free(d); - + *size = i+12; return c; } @@ -3726,251 +4368,286 @@ int parse_save(void *save, int size, int replace, int x0, int y0) int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; int fp[NPART], nf=0; - + if(size<16) - return 1; + return 1; if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) - return 1; + return 1; if(c[4]>SAVE_VERSION) - return 2; + return 2; ver = c[4]; - - if(ver<34){ - legacy_enable = 1; - } else { - if(c[3]==1||c[3]==0) - legacy_enable = c[3]; - else - legacy_beta = 1; - } - + + if(ver<34) + { + legacy_enable = 1; + } + else + { + if(c[3]==1||c[3]==0) + legacy_enable = c[3]; + else + legacy_beta = 1; + } + bw = c[6]; bh = c[7]; if(bx0+bw > XRES/CELL) - bx0 = XRES/CELL - bw; + bx0 = XRES/CELL - bw; if(by0+bh > YRES/CELL) - by0 = YRES/CELL - bh; + by0 = YRES/CELL - bh; if(bx0 < 0) - bx0 = 0; + bx0 = 0; if(by0 < 0) - by0 = 0; - + by0 = 0; + if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) - return 3; + return 3; i = (unsigned)c[8]; i |= ((unsigned)c[9])<<8; i |= ((unsigned)c[10])<<16; i |= ((unsigned)c[11])<<24; d = malloc(i); if(!d) - return 1; - + return 1; + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - return 1; + return 1; size = i; - + if(size < bw*bh) - return 1; - + return 1; + // normalize coordinates x0 = bx0*CELL; y0 = by0*CELL; w = bw *CELL; h = bh *CELL; - - if(replace) { - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(signs, 0, sizeof(signs)); - memset(parts, 0, sizeof(particle)*NPART); - memset(pmap, 0, sizeof(pmap)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(pv, 0, sizeof(pv)); - } - + + if(replace) + { + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(signs, 0, sizeof(signs)); + memset(parts, 0, sizeof(particle)*NPART); + memset(pmap, 0, sizeof(pmap)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(pv, 0, sizeof(pv)); + } + // make a catalog of free parts memset(pmap, 0, sizeof(pmap)); for(i=0; i= size) - goto corrupt; - fvx[y][x] = (d[p++]-127.0f)/64.0f; - } + for(x=bx0; x= size) + goto corrupt; + fvx[y][x] = (d[p++]-127.0f)/64.0f; + } for(y=by0; y= size) - goto corrupt; - fvy[y][x] = (d[p++]-127.0f)/64.0f; - } - + for(x=bx0; x= size) + goto corrupt; + fvy[y][x] = (d[p++]-127.0f)/64.0f; + } + // load the particle map i = 0; pty = p; - for(y=y0;y= size) - goto corrupt; - j=d[p++]; - if(j >= PT_NUM) - goto corrupt; - if(j && !(isplayer == 1 && j==PT_STKM)) { - if(pmap[y][x]) { - k = pmap[y][x]>>8; - parts[k].type = j; - parts[k].x = (float)x; - parts[k].y = (float)y; - m[(x-x0)+(y-y0)*w] = k+1; - } else if(i < nf) { - parts[fp[i]].type = j; - parts[fp[i]].x = (float)x; - parts[fp[i]].y = (float)y; - m[(x-x0)+(y-y0)*w] = fp[i]+1; - i++; - } else - m[(x-x0)+(y-y0)*w] = NPART+1; - } - } - + for(y=y0; y= size) + goto corrupt; + j=d[p++]; + if(j >= PT_NUM) + goto corrupt; + if(j && !(isplayer == 1 && j==PT_STKM)) + { + if(pmap[y][x]) + { + k = pmap[y][x]>>8; + parts[k].type = j; + parts[k].x = (float)x; + parts[k].y = (float)y; + m[(x-x0)+(y-y0)*w] = k+1; + } + else if(i < nf) + { + parts[fp[i]].type = j; + parts[fp[i]].x = (float)x; + parts[fp[i]].y = (float)y; + m[(x-x0)+(y-y0)*w] = fp[i]+1; + i++; + } + else + m[(x-x0)+(y-y0)*w] = NPART+1; + } + } + // load particle properties - for(j=0; j= size) - goto corrupt; - if(i < NPART) { - parts[i].vx = (d[p++]-127.0f)/16.0f; - parts[i].vy = (d[p++]-127.0f)/16.0f; - if(parts[i].type == PT_STKM) - { - player[2] = PT_DUST; - - player[3] = parts[i].x-1; //Setting legs positions - player[4] = parts[i].y+6; - player[5] = parts[i].x-1; - player[6] = parts[i].y+6; - - player[7] = parts[i].x-3; - player[8] = parts[i].y+12; - player[9] = parts[i].x-3; - player[10] = parts[i].y+12; - - player[11] = parts[i].x+1; - player[12] = parts[i].y+6; - player[13] = parts[i].x+1; - player[14] = parts[i].y+6; - - player[15] = parts[i].x+3; - player[16] = parts[i].y+12; - player[17] = parts[i].x+3; - player[18] = parts[i].y+12; - - } - } else - p += 2; - } - } - for(j=0; j= size) - goto corrupt; - if(i <= NPART) - parts[i-1].life = d[p++]*4; - else - p++; - } - } - for(j=0; j=34&&legacy_beta==0){ - if(p >= size){ - goto corrupt; - } - if(i <= NPART) { - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; - } else { - p++; - } - } else { - parts[i-1].temp = ptypes[parts[i-1].type].heat; - } - } - } - for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) { - if(p >= size) - goto corrupt; - if(i <= NPART) - parts[i-1].ctype = d[p++]; - else - p++; - } - } - + for(j=0; j= size) + goto corrupt; + if(i < NPART) + { + parts[i].vx = (d[p++]-127.0f)/16.0f; + parts[i].vy = (d[p++]-127.0f)/16.0f; + if(parts[i].type == PT_STKM) + { + player[2] = PT_DUST; + + player[3] = parts[i].x-1; //Setting legs positions + player[4] = parts[i].y+6; + player[5] = parts[i].x-1; + player[6] = parts[i].y+6; + + player[7] = parts[i].x-3; + player[8] = parts[i].y+12; + player[9] = parts[i].x-3; + player[10] = parts[i].y+12; + + player[11] = parts[i].x+1; + player[12] = parts[i].y+6; + player[13] = parts[i].x+1; + player[14] = parts[i].y+6; + + player[15] = parts[i].x+3; + player[16] = parts[i].y+12; + player[17] = parts[i].x+3; + player[18] = parts[i].y+12; + + } + } + else + p += 2; + } + } + for(j=0; j= size) + goto corrupt; + if(i <= NPART) + parts[i-1].life = d[p++]*4; + else + p++; + } + } + for(j=0; j=34&&legacy_beta==0) + { + if(p >= size) + { + goto corrupt; + } + if(i <= NPART) + { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } + else + { + p++; + } + } + else + { + parts[i-1].temp = ptypes[parts[i-1].type].heat; + } + } + } + for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) + { + if(p >= size) + goto corrupt; + if(i <= NPART) + parts[i-1].ctype = d[p++]; + else + p++; + } + } + if(p >= size) - goto version1; + goto version1; j = d[p++]; - for(i=0; i size) - goto corrupt; - for(k=0; k size) - goto corrupt; - if(k size) + goto corrupt; + for(k=0; k size) + goto corrupt; + if(kSAVE_VERSION) - return NULL; - + return NULL; + bw = c[6]; bh = c[7]; w = bw*CELL; h = bh*CELL; - + if(c[5]!=CELL) - return NULL; - + return NULL; + i = (unsigned)c[8]; i |= ((unsigned)c[9])<<8; i |= ((unsigned)c[10])<<16; i |= ((unsigned)c[11])<<24; d = malloc(i); if(!d) - return NULL; + return NULL; fb = calloc(w*h, PIXELSIZE); - if(!fb) { - free(d); - return NULL; + if(!fb) + { + free(d); + return NULL; } - + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - goto corrupt; + goto corrupt; size = i; - + if(size < bw*bh) - goto corrupt; - + goto corrupt; + k = 0; for(y=0; y>1)&1; i>1)&1; i>1)&1; i>1)&1; i>1)&1; i>1)&1; i=size) - goto corrupt; - - for(y=0;y= size) - goto corrupt; - j=d[p++]; - if(j0) - { - if(j==PT_STKM) //Stickman should be drawed another way - { - //Stickman drawing - for(k=-2; k<=1; k++) - { - fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); - fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); - fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); - fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); - } - draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); - draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); - draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); - draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); - } - else - fb[y*w+x] = ptypes[j].pcolors; - } - } - + goto corrupt; + + for(y=0; y= size) + goto corrupt; + j=d[p++]; + if(j0) + { + if(j==PT_STKM) //Stickman should be drawed another way + { + //Stickman drawing + for(k=-2; k<=1; k++) + { + fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); + fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); + fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); + fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); + } + draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); + draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); + draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); + draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); + } + else + fb[y*w+x] = ptypes[j].pcolors; + } + } + free(d); *width = w; *height = h; return fb; - + corrupt: free(d); free(fb); @@ -4111,13 +4792,13 @@ corrupt: /* NO, I DON'T THINK SO #include "fbi.h" - + pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) { unsigned char *tmp; pixel *res; int i; - + tmp = malloc(width*height*3); if(!tmp) return NULL; @@ -4126,17 +4807,17 @@ corrupt: free(tmp); return NULL; } - + i = width*height*3; if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { free(res); free(tmp); return NULL; } - + for(i=0; i1) { - r = (r+c/2)/c; - g = (g+c/2)/c; - b = (b+c/2)/c; - } - q[y*w+x] = PIXRGB(r, g, b); - } + for(x=0; x1) + { + r = (r+c/2)/c; + g = (g+c/2)/c; + b = (b+c/2)/c; + } + q[y*w+x] = PIXRGB(r, g, b); + } *qw = w; *qh = h; return q; @@ -4256,28 +4947,31 @@ void stamp_gen_thumb(int i) void *data; int size, factor_x, factor_y; pixel *tmp; - - if(stamps[i].thumb) { - free(stamps[i].thumb); - stamps[i].thumb = NULL; + + if(stamps[i].thumb) + { + free(stamps[i].thumb); + stamps[i].thumb = NULL; } - + sprintf(fn, "stamps" PATH_SEP "%s.stm", stamps[i].name); data = file_load(fn, &size); - - if(data) { - stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); - if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) { - factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); - factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); - if(factor_y > factor_x) - factor_x = factor_y; - tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); - free(stamps[i].thumb); - stamps[i].thumb = tmp; - } - } - + + if(data) + { + stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); + if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) + { + factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); + factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); + if(factor_y > factor_x) + factor_x = factor_y; + tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); + free(stamps[i].thumb); + stamps[i].thumb = tmp; + } + } + free(data); } @@ -4291,34 +4985,34 @@ void stamp_save(int x, int y, int w, int h) int n; char fn[64], sn[16]; void *s=build_save(&n, x, y, w, h); - + #ifdef WIN32 _mkdir("stamps"); #else mkdir("stamps", 0755); #endif - + stamp_gen_name(sn); sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); - + f = fopen(fn, "wb"); if(!f) - return; + return; fwrite(s, n, 1, f); fclose(f); - + free(s); - + if(stamps[STAMP_MAX-1].thumb) - free(stamps[STAMP_MAX-1].thumb); + free(stamps[STAMP_MAX-1].thumb); memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); memset(stamps, 0, sizeof(struct stamp_info)); - if(stamp_count0) { - memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); - memcpy(stamps, &tmp, sizeof(struct stamp_info)); - - stamp_update(); - } - + return NULL; + + if(i>0) + { + memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); + memcpy(stamps, &tmp, sizeof(struct stamp_info)); + + stamp_update(); + } + return data; } @@ -4351,28 +5046,29 @@ void stamp_init(void) { int i; FILE *f; - + memset(stamps, 0, sizeof(stamps)); - + f=fopen("stamps" PATH_SEP "stamps.def", "rb"); if(!f) - return; - for(i=0; i=XRES+BARSIZE || y>=YRES+MENUSIZE) - return; - if(a!=255) { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; } vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } @@ -4400,50 +5097,58 @@ inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) char *rp = font_data + font_ptrs[c]; w = *(rp++); for(j=0; j>= 2; - bn -= 2; - } + for(i=0; i>= 2; + bn -= 2; + } return x + w; } int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) { int sx = x; - for(;*s;s++) { - if(*s == '\n') { - x = sx; - y += FONT_H+2; - } else if(*s == '\b') { - switch(s[1]) { - case 'w': - r = g = b = 255; - break; - case 'g': - r = g = b = 192; - break; - case 'o': - r = 255; - g = 216; - b = 32; - break; - case 'r': - r = 255; - g = b = 0; - break; - case 'b': - r = g = 0; - b = 255; - break; - } - s++; - } else - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + for(; *s; s++) + { + if(*s == '\n') + { + x = sx; + y += FONT_H+2; + } + else if(*s == '\b') + { + switch(s[1]) + { + case 'w': + r = g = b = 255; + break; + case 'g': + r = g = b = 192; + break; + case 'o': + r = 255; + g = 216; + b = 32; + break; + case 'r': + r = 255; + g = b = 0; + break; + case 'b': + r = g = 0; + b = 255; + break; + } + s++; + } + else + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); } return x; } @@ -4451,13 +5156,15 @@ int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) { int i; - for(i=0; i<=w; i++) { - drawpixel(vid, x+i, y, r, g, b, a); - drawpixel(vid, x+i, y+h, r, g, b, a); + for(i=0; i<=w; i++) + { + drawpixel(vid, x+i, y, r, g, b, a); + drawpixel(vid, x+i, y+h, r, g, b, a); } - for(i=1; i=w && x+textwidth(s)>=w+5) - break; - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + for(; *s; s++) + { + if(x+font_data[font_ptrs[(int)(*(unsigned char *)s)]]>=w && x+textwidth(s)>=w+5) + break; + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); } if(*s) - for(i=0; i<3; i++) - x = drawchar(vid, x, y, '.', r, g, b, a); + for(i=0; i<3; i++) + x = drawchar(vid, x, y, '.', r, g, b, a); return x; } int textnwidth(char *s, int n) { int x = 0; - for(;*s;s++) { - if(!n) - break; - x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - n--; + for(; *s; s++) + { + if(!n) + break; + x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + n--; } return x-1; } int textwidthx(char *s, int w) { int x=0,n=0,cw; - for(;*s;s++) { - cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - if(x+(cw/2) >= w) - break; - x += cw; - n++; + for(; *s; s++) + { + cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + if(x+(cw/2) >= w) + break; + x += cw; + n++; } return n; } @@ -4536,842 +5246,1107 @@ int textwidthx(char *s, int w) void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) { int x, y, i, j, c; - int bo = b; - if(iswall==1){ - b = b-100; - x = (2+32*((b-22)/1)); - y = YRES+2+40; - switch(b){ - case WL_WALLELEC: - for(j=1; j<15; j++){ - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } else { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) { - for(i=1; i<6+j; i++) { - if(!(i&j&1)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) { - if(i&j&1) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<13; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) { - for(i=14; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - default: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) { - for(j=4; j<12; j++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } else { - x = 2+32*(b/2); - y = YRES+2+20*(b%2); - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) { - for(j=4; j<12; j++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - if(bo==sl || bo==sr) { - c = 0; - if(bo==sl) - c |= PIXPACK(0xFF0000); - if(bo==sr) - c |= PIXPACK(0x0000FF); - for(i=0; i<30; i++) { - vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; - } - for(j=0; j<18; j++) { - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; - } - } + int bo = b; + if(iswall==1) + { + b = b-100; + x = (2+32*((b-22)/1)); + y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + x = 2+32*(b/2); + y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + if(bo==sl || bo==sr) + { + c = 0; + if(bo==sl) + c |= PIXPACK(0xFF0000); + if(bo==sr) + c |= PIXPACK(0x0000FF); + for(i=0; i<30; i++) + { + vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; + } + for(j=0; j<18; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; + } + } } int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) { int i, j, c; - if(b>=121){ - b = b-100; - //x = (2+32*((b-22)/1)); - //y = YRES+2+40; - switch(b){ - case WL_WALLELEC: - for(j=1; j<15; j++){ - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } else { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) { - for(i=1; i<6+j; i++) { - if(!(i&j&1)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) { - if(i&j&1) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<13; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) { - for(i=14; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - if(!(i%2) && !(j%2)) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - case 40: - for(j=1; j<15; j+=2) { - for(i=1+(1&(j>>1)); i<27; i+=2) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - default: - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) { - for(j=4; j<12; j++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } else { - //x = 2+32*(b/2); - //y = YRES+2+20*(b%2); - for(j=1; j<15; j++) { - for(i=1; i<27; i++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) { - for(j=4; j<12; j++) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) { - c = 255; - } else { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - return 26; + if(b>=121) + { + b = b-100; + //x = (2+32*((b-22)/1)); + //y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + case 40: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + //x = 2+32*(b/2); + //y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + return 26; } -void draw_menu(pixel *vid_buf, int i, int hover){ - - //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); +void draw_menu(pixel *vid_buf, int i, int hover) +{ + + //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); #ifdef MENUV3 - drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - if(hover==i){ - fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); - } else { - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); - } + drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + if(hover==i) + { + fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + } #else - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); #endif } -void menu_ui(pixel *vid_buf, int i, int *sl, int *sr){ - int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; - pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); - fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); - memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - rows = ceil((float)msections[i].itemcount/16.0f); - height = (ceil((float)msections[i].itemcount/16.0f)*18); - width = restrict_flt(msections[i].itemcount*31, 0, 16*31); - //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); - h = -1; - x = XRES-BARSIZE-26; - y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; - sy = y; - //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); - fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); - fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); - drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); - if(i==SC_WALL){ - for(n = 122; n<122+UI_WALLCOUNT; n++){ - if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM){ - if(x-26<=60){ - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } else if(i==SC_SPECIAL){ - for(n = 122; n<122+UI_WALLCOUNT; n++){ - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM){ - if(x-26<=60){ - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } else { - for(n = 0; n=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1){ - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); - } else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } else { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=60) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=20) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(!bq && mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + if(b==1&&h!=-1) + { + *sl = h; + } + if(b==4&&h!=-1) + { + *sr = h; + } } - void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my){ - int h,x,y,n=0,height,width,sy,rows=0; - //bq = b; - //b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - rows = ceil((float)msections[i].itemcount/16.0f); - height = (ceil((float)msections[i].itemcount/16.0f)*18); - width = restrict_flt(msections[i].itemcount*31, 0, 16*31); - //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); - h = -1; - x = XRES-BARSIZE-26; - y = YRES+1;//(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; - sy = y; - //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); - //fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); - //drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); - //fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); - //drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); - //drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); - if(i==SC_WALL){ - for(n = 122; n<122+UI_WALLCOUNT; n++){ - if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM){ - if(x-26<=20){ - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } else if(i==SC_SPECIAL){ - for(n = 122; n<122+UI_WALLCOUNT; n++){ - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM){ - if(x-26<=20){ - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } else { - for(n = 0; n=x+32 && mx=y && my< y+15){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } else if(n==*sl){ - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } else if(n==*sr){ - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1){ - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); - } else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } else { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - if(b==1&&h!=-1){ - *sl = h; - } - if(b==4&&h!=-1){ - *sr = h; - } - } - int create_parts(int x, int y, int r, int c) { int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; - - if(c == 125) { - i = x / CELL; - j = y / CELL; - for(v=-1;v<2;v++) - for(u=-1;u<2;u++) - if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oy=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; float e, de; - if(cp) { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; } dx = x2 - x1; dy = abs(y2 - y1); e = 0.0f; if(dx) - de = dy/(float)dx; + de = dy/(float)dx; else - de = 0.0f; + de = 0.0f; y = y1; sy = (y1= 0.5f) { - y += sy; - if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) { - if(cp) - create_parts(y, x, r, c); - else - create_parts(x, y, r, c); - } - e -= 1.0f; - } + for(x=x1; x<=x2; x++) + { + if(cp) + create_parts(y, x, r, c); + else + create_parts(x, y, r, c); + e += de; + if(e >= 0.5f) + { + y += sy; + if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) + { + if(cp) + create_parts(y, x, r, c); + else + create_parts(x, y, r, c); + } + e -= 1.0f; + } } } void create_box(int x1, int y1, int x2, int y2, int c) { int i, j; - if(x1>x2) { - i = x2; - x2 = x1; - x1 = i; + if(x1>x2) + { + i = x2; + x2 = x1; + x1 = i; } - if(y1>y2) { - j = y2; - y2 = y1; - y1 = j; + if(y1>y2) + { + j = y2; + y2 = y1; + y1 = j; } for(j=y1; j<=y2; j++) - for(i=x1; i<=x2; i++) - create_parts(i, j, 1, c); + for(i=x1; i<=x2; i++) + create_parts(i, j, 1, c); } int flood_parts(int x, int y, int c, int cm, int bm) { int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT){ - c = c-100; - } - if(cm==-1) { - if(c==0) { - cm = pmap[y][x]&0xFF; - if(!cm) - return 0; - } else - cm = 0; - } - if(bm==-1) { - if(c==30) { - bm = bmap[y/CELL][x/CELL]; - if(!bm) - return 0; - if(bm==1) - cm = 0xFF; - } else - bm = 0; - } - + int co = c; + if(c>=122&&c<=122+UI_WALLCOUNT) + { + c = c-100; + } + if(cm==-1) + { + if(c==0) + { + cm = pmap[y][x]&0xFF; + if(!cm) + return 0; + } + else + cm = 0; + } + if(bm==-1) + { + if(c==30) + { + bm = bmap[y/CELL][x/CELL]; + if(!bm) + return 0; + if(bm==1) + cm = 0xFF; + } + else + bm = 0; + } + if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) - return 1; - + return 1; + // go left as far as possible x1 = x2 = x; - while(x1>=CELL) { - if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) - break; - x1--; + while(x1>=CELL) + { + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + break; + x1--; } - while(x2=CELL+dy) - for(x=x1; x<=x2; x++) - if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) - if(!flood_parts(x, y-dy, co, cm, bm)) - return 0; + for(x=x1; x<=x2; x++) + if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) + if(!flood_parts(x, y-dy, co, cm, bm)) + return 0; if(y=XRES || y>=YRES) - return; + return; c = vid[y*(XRES+BARSIZE)+x]; c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); if(c<512) - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); else - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); } void xor_line(int x1, int y1, int x2, int y2, pixel *vid) { int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; float e, de; - if(cp) { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; } dx = x2 - x1; dy = abs(y2 - y1); e = 0.0f; if(dx) - de = dy/(float)dx; + de = dy/(float)dx; else - de = 0.0f; + de = 0.0f; y = y1; sy = (y1= 0.5f) { - y += sy; - e -= 1.0f; - } + for(x=x1; x<=x2; x++) + { + if(cp) + xor_pixel(y, x, vid); + else + xor_pixel(x, y, vid); + e += de; + if(e >= 0.5f) + { + y += sy; + e -= 1.0f; + } } } void draw_svf_ui(pixel *vid_buf) { int c; - + drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - + c = svf_open ? 255 : 128; drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); - + c = svf_login ? 255 : 128; drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); if(svf_open) - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); else - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); if(svf_open && svf_own) - drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); - - c = (svf_login && svf_open) ? 255 : 128; - - drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - - if(svf_myvote==1 && (svf_login && svf_open)){ - fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); - } else if(svf_myvote==-1 && (svf_login && svf_open)){ - fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); - } - - drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); - drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); - + drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); + + c = (svf_login && svf_open) ? 255 : 128; + + drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + + if(svf_myvote==1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); + } + else if(svf_myvote==-1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); + } + + drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); + drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); + drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); if(svf_tags[0]) - drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); + drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); else - drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); + drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); - + drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - + drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); if(svf_login) - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); else - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); - - if(sys_pause) { - fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); - } else { - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); - drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - if(!legacy_enable) { - fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); - } else { - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - switch(cmode) { - case 0: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); - break; - case 1: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); - break; - case 2: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); - break; - case 3: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); - break; - case 4: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); - break; - case 5: - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - break; + + if(sys_pause) + { + fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); + drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); } - drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - - if(svf_admin) { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); - } else if(svf_mod) { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - }//else if(amd) - // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? -} -typedef struct ui_edit { - int x, y, w, nx; - char str[256],*def; - int focus, cursor, hide; -} ui_edit; -void ui_edit_draw(pixel *vid_buf, ui_edit *ed) -{ - int cx, i; - char echo[256], *str; - - if(ed->hide) { - for(i=0;ed->str[i];i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } else - str = ed->str; - - if(ed->str[0]) { - drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); - drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); - } else if(!ed->focus) - drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); - if(ed->focus) { - cx = textnwidth(str, ed->cursor); - for(i=-3; i<9; i++) - drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); + if(!legacy_enable) + { + fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + switch(cmode) + { + case 0: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); + break; + case 1: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); + break; + case 2: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); + break; + case 3: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); + break; + case 4: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); + break; + case 5: + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + break; + } + drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + + if(svf_admin) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); + } + else if(svf_mod) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + }//else if(amd) + // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? +} + +typedef struct ui_edit +{ + int x, y, w, nx; + char str[256],*def; + int focus, cursor, hide; +} ui_edit; +void ui_edit_draw(pixel *vid_buf, ui_edit *ed) +{ + int cx, i; + char echo[256], *str; + + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(ed->str[0]) + { + drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } + else if(!ed->focus) + drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); + if(ed->focus) + { + cx = textnwidth(str, ed->cursor); + for(i=-3; i<9; i++) + drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); } } char *shift_0="`1234567890-=[]\\;',./"; @@ -5700,224 +6714,259 @@ void ui_edit_process(int mx, int my, int mb, ui_edit *ed) #ifdef RAWINPUT char *p; #endif - - if(mb) { - if(ed->hide) { - for(i=0;ed->str[i];i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } else - str = ed->str; - - if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) { - ed->focus = 1; - ed->cursor = 0; - ed->str[0] = 0; - } else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) { - ed->focus = 1; - ed->cursor = textwidthx(str, mx-ed->x); - } else - ed->focus = 0; - } - if(ed->focus && sdl_key) { - if(ed->hide) { - for(i=0;ed->str[i];i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } else - str = ed->str; - - l = strlen(ed->str); - switch(sdl_key) { - case SDLK_HOME: - ed->cursor = 0; - break; - case SDLK_END: - ed->cursor = l; - break; - case SDLK_LEFT: - if(ed->cursor > 0) - ed->cursor --; - break; - case SDLK_RIGHT: - if(ed->cursor < l) - ed->cursor ++; - break; - case SDLK_DELETE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - ed->str[ed->cursor] = 0; - else if(ed->cursor < l) - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - break; - case SDLK_BACKSPACE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) { - if(ed->cursor > 0) - memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); - ed->cursor = 0; - } else if(ed->cursor > 0) { - ed->cursor--; - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - } - break; - default: + + if(mb) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } + else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } + else + ed->focus = 0; + } + if(ed->focus && sdl_key) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + l = strlen(ed->str); + switch(sdl_key) + { + case SDLK_HOME: + ed->cursor = 0; + break; + case SDLK_END: + ed->cursor = l; + break; + case SDLK_LEFT: + if(ed->cursor > 0) + ed->cursor --; + break; + case SDLK_RIGHT: + if(ed->cursor < l) + ed->cursor ++; + break; + case SDLK_DELETE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + ed->str[ed->cursor] = 0; + else if(ed->cursor < l) + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + break; + case SDLK_BACKSPACE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + { + if(ed->cursor > 0) + memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); + ed->cursor = 0; + } + else if(ed->cursor > 0) + { + ed->cursor--; + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + } + break; + default: #ifdef RAWINPUT - if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) { - ch = sdl_key; - if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) { - if(ch>='a' && ch<='z') - ch &= ~0x20; - p = strchr(shift_0, ch); - if(p) - ch = shift_1[p-shift_0]; - } - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } + if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) + { + ch = sdl_key; + if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) + { + if(ch>='a' && ch<='z') + ch &= ~0x20; + p = strchr(shift_0, ch); + if(p) + ch = shift_1[p-shift_0]; + } + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } #else - if(sdl_ascii>=' ' && sdl_ascii<127) { - ch = sdl_ascii; - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } + if(sdl_ascii>=' ' && sdl_ascii<127) + { + ch = sdl_ascii; + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } #endif - break; - } + break; + } + } +} +typedef struct ui_checkbox +{ + int x, y; + int focus, checked; +} ui_checkbox; +void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) +{ + int w = 12; + if(ed->checked) + { + drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); + } + if(ed->focus) + { + drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); + } + else + { + drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); + } +} +void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) +{ + int w = 12; + + if(mb && !mbq) + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->checked = (ed->checked)?0:1; + } + } + else + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->focus = 1; + } + else + { + ed->focus = 0; + } } } - typedef struct ui_checkbox { - int x, y; - int focus, checked; - } ui_checkbox; - void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) - { - int w = 12; - if(ed->checked) { - drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); - } - if(ed->focus){ - drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); - } else { - drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); - } - } - void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) - { - int w = 12; - - if(mb && !mbq) { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w){ - ed->checked = (ed->checked)?0:1; - } - } else { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w){ - ed->focus = 1; - } else { - ed->focus = 0; - } - } - } void error_ui(pixel *vid_buf, int err, char *txt) { int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; char *msg; - + msg = malloc(strlen(txt)+16); if(err) - sprintf(msg, "%03d %s", err, txt); + sprintf(msg, "%03d %s", err, txt); else - sprintf(msg, "%s", txt); - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - if(err) - drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); - else - drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - + sprintf(msg, "%s", txt); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + if(err) + drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); + else + drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + free(msg); - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; } } void info_ui(pixel *vid_buf, char *top, char *txt) { int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); - drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); + drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; } } @@ -5925,7 +6974,7 @@ void info_box(pixel *vid_buf, char *msg) { int w = textwidth(msg)+16; int x0=(XRES-w)/2,y0=(YRES-24)/2; - + clearrect(vid_buf, x0-2, y0-2, w+4, 28); drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); @@ -5936,50 +6985,55 @@ int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) { int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; int ret = 0; - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); - drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); - drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); - drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) { - ret = 1; - break; - } - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) { - ret = 1; - break; - } - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); + drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); + drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); + drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) + { + ret = 1; + break; + } + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + { + ret = 1; + break; + } + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + return ret; } @@ -5987,48 +7041,52 @@ int execute_tagop(pixel *vid_buf, char *op, char *tag) { int status; char *result; - + char *names[] = {"ID", "Tag", NULL}; char *parts[2]; - + char *uri = malloc(strlen(SERVER)+strlen(op)+36); sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); - + parts[0] = svf_id; parts[1] = tag; - + result = http_multipart_post( - uri, - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - + uri, + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + free(uri); - - if(status!=200) { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 1; - } - if(result && strncmp(result, "OK", 2)) { - error_ui(vid_buf, 0, result); - free(result); - return 1; - } - - if(result[2]) { - strncpy(svf_tags, result+3, 255); - svf_id[15] = 0; - } - + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 1; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 1; + } + + if(result[2]) + { + strncpy(svf_tags, result+3, 255); + svf_id[15] = 0; + } + if(result) - free(result); - + free(result); + return 0; } -struct strlist { +struct strlist +{ char *str; struct strlist *next; }; @@ -6042,18 +7100,19 @@ void strlist_add(struct strlist **list, char *str) int strlist_find(struct strlist **list, char *str) { struct strlist *item; - for(item=*list;item;item=item->next) - if(!strcmp(item->str, str)) - return 1; + for(item=*list; item; item=item->next) + if(!strcmp(item->str, str)) + return 1; return 0; } void strlist_free(struct strlist **list) { struct strlist *item; - while(*list) { - item = *list; - *list = (*list)->next; - free(item); + while(*list) + { + item = *list; + *list = (*list)->next; + free(item); } } @@ -6064,7 +7123,7 @@ void tag_list_ui(pixel *vid_buf) char *tag=NULL, *op=NULL; ui_edit ed; struct strlist *vote=NULL,*down=NULL; - + ed.x = x0+25; ed.y = y0+221; ed.w = 158; @@ -6074,118 +7133,131 @@ void tag_list_ui(pixel *vid_buf) ed.hide = 0; ed.cursor = 0; strcpy(ed.str, ""); - + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - op = tag = NULL; - - drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 256); - drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); - p = svf_tags; - s = svf_tags[0] ? ' ' : 0; - y = 36 + y0; - while(s) { - q = strchr(p, ' '); - if(!q) - q = p+strlen(p); - s = *q; - *q = 0; - if(svf_own || svf_admin || svf_mod) { - drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); - d = 14; - if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) { - if(!ed1.focus) - break; - ed1.focus = 0; - ed2.focus = 1; - } - if(sdl_key==SDLK_ESCAPE) { - if(!ed1.focus && !ed2.focus) - return; - ed1.focus = 0; - ed2.focus = 0; - } - } - + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, "Server login:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\x8B", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\x8A", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + drawtext(vid_buf, x0+11, y0+44, "\x8C", 160, 144, 32, 255); + drawtext(vid_buf, x0+11, y0+44, "\x84", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+40, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed1); + ui_edit_draw(vid_buf, &ed2); + drawtext(vid_buf, x0+5, y0+69, "Sign in", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed1); + ui_edit_process(mx, my, b, &ed2); + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) + { + if(!ed1.focus) + break; + ed1.focus = 0; + ed2.focus = 1; + } + if(sdl_key==SDLK_ESCAPE) + { + if(!ed1.focus && !ed2.focus) + return; + ed1.focus = 0; + ed2.focus = 0; + } + } + strcpy(svf_user, ed1.str); md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); - + res = http_multipart_post( - "http://" SERVER "/Login.api", - NULL, NULL, NULL, - svf_user, svf_pass, - &err, NULL); - if(err != 200) { - error_ui(vid_buf, err, http_ret_text(err)); - if(res) - free(res); - goto fail; - } - if(res && !strncmp(res, "OK", 2)) { - if(!strcmp(res, "OK ADMIN")){ - svf_admin = 1; - svf_mod = 0; - } else if(!strcmp(res, "OK MOD")){ - svf_admin = 0; - svf_mod = 1; - } else { - svf_admin = 0; - svf_mod = 0; - } - free(res); - svf_login = 1; - return; + "http://" SERVER "/Login.api", + NULL, NULL, NULL, + svf_user, svf_pass, + &err, NULL); + if(err != 200) + { + error_ui(vid_buf, err, http_ret_text(err)); + if(res) + free(res); + goto fail; + } + if(res && !strncmp(res, "OK", 2)) + { + if(!strcmp(res, "OK ADMIN")) + { + svf_admin = 1; + svf_mod = 0; + } + else if(!strcmp(res, "OK MOD")) + { + svf_admin = 0; + svf_mod = 1; + } + else + { + svf_admin = 0; + svf_mod = 0; + } + free(res); + svf_login = 1; + return; } if(!res) - res = mystrdup("Unspecified Error"); + res = mystrdup("Unspecified Error"); error_ui(vid_buf, 0, res); free(res); - + fail: strcpy(svf_user, ""); strcpy(svf_pass, ""); svf_login = 0; svf_own = 0; svf_admin = 0; - svf_mod = 0; + svf_mod = 0; } void execute_delete(pixel *vid_buf, char *id) { int status; char *result; - + char *names[] = {"ID", NULL}; char *parts[1]; - + parts[0] = id; - + result = http_multipart_post( - "http://" SERVER "/Delete.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return; - } - if(result && strncmp(result, "OK", 2)) { - error_ui(vid_buf, 0, result); - free(result); - return; - } - + "http://" SERVER "/Delete.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + if(result) - free(result); + free(result); } - + int execute_vote(pixel *vid_buf, char *id, char *action) { - int status; - char *result; - - char *names[] = {"ID", "Action", NULL}; - char *parts[2]; - - parts[0] = id; - parts[1] = action; - - result = http_multipart_post( - "http://" SERVER "/Vote.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 0; - } - if(result && strncmp(result, "OK", 2)) { - error_ui(vid_buf, 0, result); - free(result); - return 0; - } - - if(result) - free(result); - return 1; + int status; + char *result; + + char *names[] = {"ID", "Action", NULL}; + char *parts[2]; + + parts[0] = id; + parts[1] = action; + + result = http_multipart_post( + "http://" SERVER "/Vote.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 0; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 0; + } + + if(result) + free(result); + return 1; } static char hex[] = "0123456789ABCDEF"; @@ -6550,19 +7650,21 @@ void strcaturl(char *dst, char *src) { char *d; unsigned char *s; - + for(d=dst; *d; d++) ; - - for(s=(unsigned char *)src; *s; s++) { - if((*s>='0' && *s<='9') || - (*s>='a' && *s<='z') || - (*s>='A' && *s<='Z')) - *(d++) = *s; - else { - *(d++) = '%'; - *(d++) = hex[*s>>4]; - *(d++) = hex[*s&15]; - } + + for(s=(unsigned char *)src; *s; s++) + { + if((*s>='0' && *s<='9') || + (*s>='a' && *s<='z') || + (*s>='A' && *s<='Z')) + *(d++) = *s; + else + { + *(d++) = '%'; + *(d++) = hex[*s>>4]; + *(d++) = hex[*s&15]; + } } *d = 0; } @@ -6577,36 +7679,39 @@ int thumb_cache_lru[THUMB_CACHE_SIZE]; void thumb_cache_inval(char *id) { int i,j; - for(i=0;i= THUMB_CACHE_SIZE) - return; + return; free(thumb_cache_id[i]); free(thumb_cache_data[i]); thumb_cache_id[i] = NULL; - for(j=0;j thumb_cache_lru[i]) - thumb_cache_lru[j]--; + for(j=0; j thumb_cache_lru[i]) + thumb_cache_lru[j]--; } void thumb_cache_add(char *id, void *thumb, int size) { int i,m=-1,j=-1; thumb_cache_inval(id); - for(i=0;i m) { - m = thumb_cache_lru[i]; - j = i; - } - } - if(i >= THUMB_CACHE_SIZE) { - thumb_cache_inval(thumb_cache_id[j]); - i = j; - } - for(j=0;j m) + { + m = thumb_cache_lru[i]; + j = i; + } + } + if(i >= THUMB_CACHE_SIZE) + { + thumb_cache_inval(thumb_cache_id[j]); + i = j; + } + for(j=0; j= THUMB_CACHE_SIZE) - return 0; - for(j=0;j=GRID_X*GRID_Y) - break; - if(votes) { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } else { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str+5); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } else if(!strncmp(str, "TAG ", 4)) { - if(j >= TAG_MAX) { - str = p; - continue; - } - q = strchr(str+4, ' '); - if(!q) { - str = p; - continue; - } - *(q++) = 0; - tag_names[j] = mystrdup(str+4); - tag_votes[j] = atoi(q); - j++; - } else { - if(i>=GRID_X*GRID_Y) - break; - if(votes) { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } else { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - str = p; + do_open = 0; + while(1) + { + if(!*str) + break; + p = strchr(str, '\n'); + if(!p) + p = str + strlen(str); + else + *(p++) = 0; + if(!strncmp(str, "OPEN ", 5)) + { + do_open = 1; + if(i>=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+5); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + else if(!strncmp(str, "TAG ", 4)) + { + if(j >= TAG_MAX) + { + str = p; + continue; + } + q = strchr(str+4, ' '); + if(!q) + { + str = p; + continue; + } + *(q++) = 0; + tag_names[j] = mystrdup(str+4); + tag_votes[j] = atoi(q); + j++; + } + else + { + if(i>=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + str = p; } if(*str) - i++; + i++; return i; } @@ -6838,13 +7963,13 @@ int search_ui(pixel *vid_buf) { int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; - int thumb_drawn[GRID_X*GRID_Y]; - pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - float ry; + int thumb_drawn[GRID_X*GRID_Y]; + pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + float ry; time_t http_last_use=HTTP_TIMEOUT; ui_edit ed; - + void *http = NULL; int active = 0; char *last = NULL; @@ -6854,36 +7979,37 @@ int search_ui(pixel *vid_buf) int status; char *results; char *tmp, ts[64]; - + void *img_http[IMGCONNS]; char *img_id[IMGCONNS]; void *thumb, *data; int thlen, dlen; - - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); memset(img_http, 0, sizeof(img_http)); memset(img_id, 0, sizeof(img_id)); - + memset(search_ids, 0, sizeof(search_ids)); memset(search_names, 0, sizeof(search_names)); - memset(search_scoreup, 0, sizeof(search_scoreup)); - memset(search_scoredown, 0, sizeof(search_scoredown)); - memset(search_publish, 0, sizeof(search_publish)); + memset(search_scoreup, 0, sizeof(search_scoreup)); + memset(search_scoredown, 0, sizeof(search_scoredown)); + memset(search_publish, 0, sizeof(search_publish)); memset(search_owners, 0, sizeof(search_owners)); memset(search_thumbs, 0, sizeof(search_thumbs)); memset(search_thsizes, 0, sizeof(search_thsizes)); - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - - do_open = 0; - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + + do_open = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; } - + ed.x = 65; ed.y = 13; ed.w = XRES-200; @@ -6893,522 +8019,619 @@ int search_ui(pixel *vid_buf) ed.hide = 0; ed.cursor = strlen(search_expr); strcpy(ed.str, search_expr); - + sdl_wheel = 0; - - while(!sdl_poll()) { - uih = 0; - bq = b; - mxq = mx; - myq = my; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - if(mx!=mxq || my!=myq || sdl_wheel || b) - mmt = 0; - else if(mmt 9) { - drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); - drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); - } - - ui_edit_draw(vid_buf, &ed); - - if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) { - if(search_page) { - search_page --; - lasttime = TIMEOUT; - } - sdl_wheel = 0; - uih = 1; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) { - lasttime = TIMEOUT; - search_page ++; - page_count = exp_res; - } - sdl_wheel = 0; - uih = 1; - } - - tp = -1; - if(is_p1) { - drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); - for(gj=0;gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14);gj++) - for(gi=0;giTAG_MAX || !tag_names[pos]) - break; - if(tag_votes[0]) - i = 127+(128*tag_votes[pos])/tag_votes[0]; - else - i = 192; - w = textwidth(tag_names[pos]); - if(w>XRES/GRID_X-5) - w = XRES/GRID_X-5; - gx = (XRES/GRID_X)*gi; - gy = gj*14 + 46; - if(mx>=gx && mx=gy && my XRES/GRID_X-10) { - tmp = malloc(strlen(search_names[pos])+4); - strcpy(tmp, search_names[pos]); - j = textwidthx(tmp, XRES/GRID_X-15); - strcpy(tmp+j, "..."); - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); - free(tmp); - } else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); - j = textwidth(search_owners[pos]); - if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && - my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) { - st = 1; - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); - } else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); - if(search_thumbs[pos]&&thumb_drawn[pos]==0){ - render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); - thumb_drawn[pos] = 1; - } - own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); - if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) - mp = pos; - if(own) { - if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) { - mp = -1; - dp = pos; - } - } - if(mp==pos && !st) - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); - else - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); - if(own) { - if(dp == pos) - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); - else - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); - } - if(!search_publish[pos]){ - drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); - drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); - } - if(view_own || svf_admin || svf_mod) { - sprintf(ts+1, "%d", search_votes[pos]); - ts[0] = 0xBB; - for(j=1; ts[j]; j++) - ts[j] = 0xBC; - ts[j-1] = 0xB9; - ts[j] = 0xBA; - ts[j+1] = 0; - w = gx+XRES/GRID_S-2-textwidth(ts); - h = gy+YRES/GRID_S-11; - drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); - for(j=0; ts[j]; j++) - ts[j] -= 14; - drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); - sprintf(ts, "%d", search_votes[pos]); - for(j=0; ts[j]; j++) - ts[j] += 127; - drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); - } - if(search_scoreup[pos]>0||search_scoredown[pos]>0){ - lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); - - if(((YRES/GRID_S+3)/2)>lv){ - ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); - if(lv<8){ - ry = ry/(8-lv); - } - nyu = search_scoreup[pos]*ry; - nyd = search_scoredown[pos]*ry; - } else { - ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); - nyu = search_scoreup[pos]/ry; - nyd = search_scoredown[pos]/ry; - } - - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); - - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); - } - } - - if(mp!=-1 && mmt>=TIMEOUT/5 && !st) { - gi = mp % GRID_X; - gj = mp / GRID_X; - if(is_p1) - gj += GRID_Y-GRID_P; - gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; - gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; - i = w = textwidth(search_names[mp]); - h = YRES/GRID_Z+30; - if(w=XRES-2) gx=XRES-3-w; - if(gy<32) gy=32; - if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; - clearrect(vid_buf, gx-2, gy-3, w+4, h); - drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); - if(search_thumbs[mp]) - render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); - drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); - drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); - } - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(sdl_key==SDLK_RETURN) { - if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) - lasttime = TIMEOUT; - else if(search_ids[0] && !search_ids[1]) { - bq = 0; - b = 1; - mp = 0; - } - } - if(sdl_key==SDLK_ESCAPE) - goto finish; - - if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) { - search_own = !search_own; - lasttime = TIMEOUT; - } - if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) { - search_date = !search_date; - lasttime = TIMEOUT; - } - - if(b && !bq && dp!=-1) - if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) { - execute_delete(vid_buf, search_ids[dp]); - lasttime = TIMEOUT; - if(last) { - free(last); - last = NULL; - } - } - - if(b && !bq && tp!=-1) { - strncpy(ed.str, tag_names[tp], 255); - lasttime = TIMEOUT; - } - - if(b && !bq && mp!=-1 && st) { - sprintf(ed.str, "user:%s", search_owners[mp]); - lasttime = TIMEOUT; - } - - if(do_open==1){ - mp = 0; - } - - if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) { - fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); - info_box(vid_buf, "Loading..."); - - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - data = http_simple_get(uri, &status, &dlen); - free(uri); - - if(status == 200) { - status = parse_save(data, dlen, 1, 0, 0); - switch(status) { - case 1: - error_ui(vid_buf, 0, "Simulation corrupted"); - break; - case 2: - error_ui(vid_buf, 0, "Simulation from a newer version"); - break; - case 3: - error_ui(vid_buf, 0, "Simulation on a too large grid"); - break; - } - if(!status) { - char *tnames[] = {"ID", NULL}; - char *tparts[1]; - int tplens[1]; - if(svf_last) - free(svf_last); - svf_last = data; - svf_lsize = dlen; - - tparts[0] = search_ids[mp]; - tplens[0] = strlen(search_ids[mp]); - data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); - - svf_open = 1; - svf_own = svf_login && !strcmp(search_owners[mp], svf_user); - svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); - - strcpy(svf_id, search_ids[mp]); - strcpy(svf_name, search_names[mp]); - if(status == 200) { - if(data) { - strncpy(svf_tags, data, 255); - svf_tags[255] = 0; - } else - svf_tags[0] = 0; - } else { - svf_tags[0] = 0; - } - - if(svf_login){ - char *names[] = {"ID", NULL}; - char *parts[1]; - parts[0] = search_ids[mp]; - data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); - if(status == 200){ - if(data){ - if(!strcmp(data, "Up")){ - svf_myvote = 1; - } else if(!strcmp(data, "Down")){ - svf_myvote = -1; - } else { - svf_myvote = 0; - } - } else { - svf_myvote = 0; - } - } else { - svf_myvote = 0; - } - } - } else { - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - } - } else - error_ui(vid_buf, status, http_ret_text(status)); - - if(data) - free(data); - goto finish; - } - - if(!last){ - search = 1; - } else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) { - search = 1; - if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) { - search_page = 0; - page_count = 0; - } - free(last); - last = NULL; - } else - search = 0; - - if(search && lasttime>=TIMEOUT) { - lasttime = 0; - last = mystrdup(ed.str); - last_own = search_own; - last_date = search_date; - last_page = search_page; - active = 1; - uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); - if(search_own || svf_admin || svf_mod) - tmp = "&ShowVotes=true"; - else - tmp = ""; - if(!search_own && !search_date && !*last) { - if(search_page) { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); - } else { - exp_res = GRID_X*GRID_P; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); - } - } else { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); - } - strcaturl(uri, last); - if(search_own) { - strcaturl(uri, " user:"); - strcaturl(uri, svf_user); - } - if(search_date) - strcaturl(uri, " sort:date"); - - http = http_async_req_start(http, uri, NULL, 0, 1); - if(svf_login){ - http_auth_headers(http, svf_user, svf_pass); - } - http_last_use = time(NULL); - free(uri); - } - - if(active && http_async_req_status(http)) { - http_last_use = time(NULL); - results = http_async_req_stop(http, &status, NULL); - view_own = last_own; - if(status == 200){ - page_count = search_results(results, last_own||svf_admin||svf_mod); - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - } - is_p1 = (exp_res < GRID_X*GRID_Y); - free(results); - active = 0; - } - - if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) { - http_async_req_close(http); - http = NULL; - } - - for(i=0;i 9) + { + drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); + drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); + } + + ui_edit_draw(vid_buf, &ed); + + if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) + { + if(search_page) + { + search_page --; + lasttime = TIMEOUT; + } + sdl_wheel = 0; + uih = 1; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) + { + lasttime = TIMEOUT; + search_page ++; + page_count = exp_res; + } + sdl_wheel = 0; + uih = 1; + } + + tp = -1; + if(is_p1) + { + drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); + for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) + for(gi=0; giTAG_MAX || !tag_names[pos]) + break; + if(tag_votes[0]) + i = 127+(128*tag_votes[pos])/tag_votes[0]; + else + i = 192; + w = textwidth(tag_names[pos]); + if(w>XRES/GRID_X-5) + w = XRES/GRID_X-5; + gx = (XRES/GRID_X)*gi; + gy = gj*14 + 46; + if(mx>=gx && mx=gy && my XRES/GRID_X-10) + { + tmp = malloc(strlen(search_names[pos])+4); + strcpy(tmp, search_names[pos]); + j = textwidthx(tmp, XRES/GRID_X-15); + strcpy(tmp+j, "..."); + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); + free(tmp); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); + j = textwidth(search_owners[pos]); + if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && + my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) + { + st = 1; + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); + if(search_thumbs[pos]&&thumb_drawn[pos]==0) + { + render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); + thumb_drawn[pos] = 1; + } + own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); + if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) + mp = pos; + if(own) + { + if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) + { + mp = -1; + dp = pos; + } + } + if(mp==pos && !st) + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); + else + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); + if(own) + { + if(dp == pos) + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); + else + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); + } + if(!search_publish[pos]) + { + drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); + drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } + if(view_own || svf_admin || svf_mod) + { + sprintf(ts+1, "%d", search_votes[pos]); + ts[0] = 0xBB; + for(j=1; ts[j]; j++) + ts[j] = 0xBC; + ts[j-1] = 0xB9; + ts[j] = 0xBA; + ts[j+1] = 0; + w = gx+XRES/GRID_S-2-textwidth(ts); + h = gy+YRES/GRID_S-11; + drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); + for(j=0; ts[j]; j++) + ts[j] -= 14; + drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); + sprintf(ts, "%d", search_votes[pos]); + for(j=0; ts[j]; j++) + ts[j] += 127; + drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); + } + if(search_scoreup[pos]>0||search_scoredown[pos]>0) + { + lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); + + if(((YRES/GRID_S+3)/2)>lv) + { + ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); + if(lv<8) + { + ry = ry/(8-lv); + } + nyu = search_scoreup[pos]*ry; + nyd = search_scoredown[pos]*ry; + } + else + { + ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); + nyu = search_scoreup[pos]/ry; + nyd = search_scoredown[pos]/ry; + } + + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); + + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); + } + } + + if(mp!=-1 && mmt>=TIMEOUT/5 && !st) + { + gi = mp % GRID_X; + gj = mp / GRID_X; + if(is_p1) + gj += GRID_Y-GRID_P; + gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; + gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; + i = w = textwidth(search_names[mp]); + h = YRES/GRID_Z+30; + if(w=XRES-2) gx=XRES-3-w; + if(gy<32) gy=32; + if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; + clearrect(vid_buf, gx-2, gy-3, w+4, h); + drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); + if(search_thumbs[mp]) + render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); + drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); + drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); + } + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(sdl_key==SDLK_RETURN) + { + if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) + lasttime = TIMEOUT; + else if(search_ids[0] && !search_ids[1]) + { + bq = 0; + b = 1; + mp = 0; + } + } + if(sdl_key==SDLK_ESCAPE) + goto finish; + + if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) + { + search_own = !search_own; + lasttime = TIMEOUT; + } + if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) + { + search_date = !search_date; + lasttime = TIMEOUT; + } + + if(b && !bq && dp!=-1) + if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) + { + execute_delete(vid_buf, search_ids[dp]); + lasttime = TIMEOUT; + if(last) + { + free(last); + last = NULL; + } + } + + if(b && !bq && tp!=-1) + { + strncpy(ed.str, tag_names[tp], 255); + lasttime = TIMEOUT; + } + + if(b && !bq && mp!=-1 && st) + { + sprintf(ed.str, "user:%s", search_owners[mp]); + lasttime = TIMEOUT; + } + + if(do_open==1) + { + mp = 0; + } + + if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) + { + fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); + info_box(vid_buf, "Loading..."); + + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + data = http_simple_get(uri, &status, &dlen); + free(uri); + + if(status == 200) + { + status = parse_save(data, dlen, 1, 0, 0); + switch(status) + { + case 1: + error_ui(vid_buf, 0, "Simulation corrupted"); + break; + case 2: + error_ui(vid_buf, 0, "Simulation from a newer version"); + break; + case 3: + error_ui(vid_buf, 0, "Simulation on a too large grid"); + break; + } + if(!status) + { + char *tnames[] = {"ID", NULL}; + char *tparts[1]; + int tplens[1]; + if(svf_last) + free(svf_last); + svf_last = data; + svf_lsize = dlen; + + tparts[0] = search_ids[mp]; + tplens[0] = strlen(search_ids[mp]); + data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); + + svf_open = 1; + svf_own = svf_login && !strcmp(search_owners[mp], svf_user); + svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); + + strcpy(svf_id, search_ids[mp]); + strcpy(svf_name, search_names[mp]); + if(status == 200) + { + if(data) + { + strncpy(svf_tags, data, 255); + svf_tags[255] = 0; + } + else + svf_tags[0] = 0; + } + else + { + svf_tags[0] = 0; + } + + if(svf_login) + { + char *names[] = {"ID", NULL}; + char *parts[1]; + parts[0] = search_ids[mp]; + data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); + if(status == 200) + { + if(data) + { + if(!strcmp(data, "Up")) + { + svf_myvote = 1; + } + else if(!strcmp(data, "Down")) + { + svf_myvote = -1; + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + } + else + { + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + } + } + else + error_ui(vid_buf, status, http_ret_text(status)); + + if(data) + free(data); + goto finish; + } + + if(!last) + { + search = 1; + } + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) + { + search = 1; + if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) + { + search_page = 0; + page_count = 0; + } + free(last); + last = NULL; + } + else + search = 0; + + if(search && lasttime>=TIMEOUT) + { + lasttime = 0; + last = mystrdup(ed.str); + last_own = search_own; + last_date = search_date; + last_page = search_page; + active = 1; + uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); + if(search_own || svf_admin || svf_mod) + tmp = "&ShowVotes=true"; + else + tmp = ""; + if(!search_own && !search_date && !*last) + { + if(search_page) + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); + } + else + { + exp_res = GRID_X*GRID_P; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); + } + } + else + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); + } + strcaturl(uri, last); + if(search_own) + { + strcaturl(uri, " user:"); + strcaturl(uri, svf_user); + } + if(search_date) + strcaturl(uri, " sort:date"); + + http = http_async_req_start(http, uri, NULL, 0, 1); + if(svf_login) + { + http_auth_headers(http, svf_user, svf_pass); + } + http_last_use = time(NULL); + free(uri); + } + + if(active && http_async_req_status(http)) + { + http_last_use = time(NULL); + results = http_async_req_stop(http, &status, NULL); + view_own = last_own; + if(status == 200) + { + page_count = search_results(results, last_own||svf_admin||svf_mod); + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + } + is_p1 = (exp_res < GRID_X*GRID_Y); + free(results); + active = 0; + } + + if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) + { + http_async_req_close(http); + http = NULL; + } + + for(i=0; i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) { - if(stamp_page) { - stamp_page --; - } - sdl_wheel = 0; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) + { + if(stamp_page) + { + stamp_page --; + } + sdl_wheel = 0; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; + //Changing width if sign have special content + if(strcmp(signs[i].text, "{p}")==0) + *w = textwidth("Pressure: -000.00"); + + if(strcmp(signs[i].text, "{t}")==0) + *w = textwidth("Temp: 0000.00"); + + //Ususal width + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + *w = textwidth(signs[i].text) + 5; + *h = 14; + *x0 = (signs[i].ju == 2) ? signs[i].x - *w : + (signs[i].ju == 1) ? signs[i].x - *w/2 : signs[i].x; + *y0 = (signs[i].y > 18) ? signs[i].y - 18 : signs[i].y + 4; } void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) @@ -7578,12 +8825,15 @@ void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) char t[2]; t[0] = ch; t[1] = 0; - if(flag) { - fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); - } else { - drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); + if(flag) + { + fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); + } + else + { + drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); } } @@ -7592,40 +8842,42 @@ void render_signs(pixel *vid_buf) int i, j, x, y, w, h, dx, dy; char buff[30]; //Buffer for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature - else - sprintf(buff, "Temp: 0.00"); //...tempirature - drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); - } - - //Usual text - if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) - drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); - x = signs[i].x; - y = signs[i].y; - dx = 1 - signs[i].ju; - dy = (signs[i].y > 18) ? -1 : 1; - for(j=0; j<4; j++) { - drawpixel(vid_buf, x, y, 192, 192, 192, 255); - x+=dx; - y+=dy; - } - } + if(signs[i].text[0]) + { + get_sign_pos(i, &x, &y, &w, &h); + clearrect(vid_buf, x, y, w, h); + drawrect(vid_buf, x, y, w, h, 192, 192, 192, 255); + + //Displaying special information + if(strcmp(signs[i].text, "{p}")==0) + { + sprintf(buff, "Pressure: %3.2f", pv[signs[i].y/CELL][signs[i].x/CELL]); //...pressure + drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); + } + + if(strcmp(signs[i].text, "{t}")==0) + { + if((pmap[signs[i].y][signs[i].x]>>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature + else + sprintf(buff, "Temp: 0.00"); //...tempirature + drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); + } + + //Usual text + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); + x = signs[i].x; + y = signs[i].y; + dx = 1 - signs[i].ju; + dy = (signs[i].y > 18) ? -1 : 1; + for(j=0; j<4; j++) + { + drawpixel(vid_buf, x, y, 192, 192, 192, 255); + x+=dx; + y+=dy; + } + } } void add_sign_ui(pixel *vid_buf, int mx, int my) @@ -7633,36 +8885,40 @@ void add_sign_ui(pixel *vid_buf, int mx, int my) int i, w, h, x, y, nm=0, ju; int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; ui_edit ed; - + // check if it is an existing sign for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) - break; - } + if(signs[i].text[0]) + { + get_sign_pos(i, &x, &y, &w, &h); + if(mx>=x && mx<=x+w && my>=y && my<=y+h) + break; + } // else look for empty spot - if(i >= MAXSIGNS) { - nm = 1; - for(i=0; i= MAXSIGNS) + { + nm = 1; + for(i=0; i= MAXSIGNS) - return; - - if(nm) { - signs[i].x = mx; - signs[i].y = my; - signs[i].ju = 1; - } - - while(!sdl_poll()) { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - + return; + + if(nm) + { + signs[i].x = mx; + signs[i].y = my; + signs[i].ju = 1; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + ed.x = x0+25; ed.y = y0+25; ed.w = 158; @@ -7673,66 +8929,70 @@ void add_sign_ui(pixel *vid_buf, int mx, int my) ed.cursor = strlen(signs[i].text); strcpy(ed.str, signs[i].text); ju = signs[i].ju; - + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 80); - drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); - ui_edit_draw(vid_buf, &ed); - drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); - draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); - draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); - draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); - - if(!nm) { - drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); - drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); - drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); - } - - drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) - ju = 0; - if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) - ju = 1; - if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) - ju = 2; - - if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) { - signs[i].text[0] = 0; - return; - } - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) { - if(!ed.focus) - return; - ed.focus = 0; - } - } - + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed); + drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); + draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); + draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); + draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); + + if(!nm) + { + drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); + drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); + drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); + } + + drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) + ju = 0; + if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) + ju = 1; + if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) + ju = 2; + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) + { + signs[i].text[0] = 0; + return; + } + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + { + if(!ed.focus) + return; + ed.focus = 0; + } + } + strcpy(signs[i].text, ed.str); signs[i].ju = ju; } @@ -7759,9 +9019,10 @@ int load_string(FILE *f, char *str, int max) unsigned char lb[2]; fread(lb, 2, 1, f); li = lb[0] | (lb[1] << 8); - if(li > max) { - str[0] = 0; - return 1; + if(li > max) + { + str[0] = 0; + return 1; } fread(str, li, 1, f); str[li] = 0; @@ -7776,7 +9037,7 @@ void save_presets(int do_update) unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; unsigned char tmp = sdl_scale; if(!f) - return; + return; fwrite(sig, 1, 4, f); save_string(f, svf_user); save_string(f, svf_pass); @@ -7785,8 +9046,8 @@ void save_presets(int do_update) fwrite(&tmp, 1, 1, f); tmp = svf_admin; fwrite(&tmp, 1, 1, f); - tmp = svf_mod; - fwrite(&tmp, 1, 1, f); + tmp = svf_mod; + fwrite(&tmp, 1, 1, f); save_string(f, http_proxy); tmp = SAVE_VERSION; fwrite(&tmp, 1, 1, f); @@ -7802,47 +9063,51 @@ void load_presets(void) FILE *f=fopen("powder.def", "rb"); unsigned char sig[4], tmp; if(!f) - return; + return; fread(sig, 1, 4, f); - if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66){ - if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F){ - if(fseek(f, -3, SEEK_END)){ - remove("powder.def"); - return; - } - if(fread(sig, 1, 3, f) != 3){ - remove("powder.def"); - goto fail; - } - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; - } - fclose(f); - remove("powder.def"); - return; - } + if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) + { + if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) + { + if(fseek(f, -3, SEEK_END)) + { + remove("powder.def"); + return; + } + if(fread(sig, 1, 3, f) != 3) + { + remove("powder.def"); + goto fail; + } + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; + } + fclose(f); + remove("powder.def"); + return; + } if(load_string(f, svf_user, 63)) - goto fail; + goto fail; if(load_string(f, svf_pass, 63)) - goto fail; + goto fail; svf_login = !!svf_user[0]; if(fread(&tmp, 1, 1, f) != 1) - goto fail; + goto fail; sdl_scale = (tmp == 2) ? 2 : 1; if(fread(&tmp, 1, 1, f) != 1) - goto fail; - cmode = tmp%6; + goto fail; + cmode = tmp%6; if(fread(&tmp, 1, 1, f) != 1) - goto fail; + goto fail; svf_admin = tmp; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_mod = tmp; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_mod = tmp; if(load_string(f, http_proxy, 255)) - goto fail; + goto fail; if(fread(sig, 1, 3, f) != 3) - goto fail; + goto fail; last_major = sig[0]; last_minor = sig[1]; update_flag = sig[2]; @@ -7853,17 +9118,18 @@ fail: void dim_copy(pixel *dst, pixel *src) { int i,r,g,b; - for(i=0;i0) - r--; - if(g>0) - g--; - if(b>0) - b--; - dst[i] = PIXRGB(r,g,b); + for(i=0; i0) + r--; + if(g>0) + g--; + if(b>0) + b--; + dst[i] = PIXRGB(r,g,b); } } @@ -7874,41 +9140,43 @@ void prepare_alpha(void) float temp[CELL*3][CELL*3]; memset(temp, 0, sizeof(temp)); for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; - fire_g[j][i] = g>4 ? g-4 : 0; - fire_b[j][i] = b>4 ? b-4 : 0; - } + for(j=0; j=0 && j+y>=0 && i+x4 ? r-4 : 0; + fire_g[j][i] = g>4 ? g-4 : 0; + fire_b[j][i] = b>4 ? b-4 : 0; + } } int zoom_en = 0; @@ -7922,61 +9190,71 @@ void render_zoom(pixel *img) drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) { - xor_pixel(x+i, y+j, vid); - if(j) xor_pixel(x+i, y-j, vid); - if(i) xor_pixel(x-i, y+j, vid); - if(i&&j) xor_pixel(x-i, y-j, vid); - } - } else { - int tc; - c = (r/CELL) * CELL; - x = (x/CELL) * CELL; - y = (y/CELL) * CELL; - - tc = !((c%(CELL*2))==0); - - x -= c/2; - y -= c/2; - - x += tc*(CELL/2); - y += tc*(CELL/2); - - for(i=0; ir*r || i*i+(j+1)*(j+1)>r*r)) + { + xor_pixel(x+i, y+j, vid); + if(j) xor_pixel(x+i, y-j, vid); + if(i) xor_pixel(x-i, y+j, vid); + if(i&&j) xor_pixel(x-i, y-j, vid); + } + } + else + { + int tc; + c = (r/CELL) * CELL; + x = (x/CELL) * CELL; + y = (y/CELL) * CELL; + + tc = !((c%(CELL*2))==0); + + x -= c/2; + y -= c/2; + + x += tc*(CELL/2); + y += tc*(CELL/2); + + for(i=0; i2){ - pthread_t pth; - pthread_create(&pth,NULL,update_air_th,""); - } else { - update_air(); - } + if(numCores>2) + { + pthread_t pth; + pthread_create(&pth,NULL,update_air_th,""); + } + else + { + update_air(); + } #else - update_air(); + update_air(); #endif - } - if(cmode==0 || cmode==1) { - draw_air(vid_buf); - } else if(cmode==2) { - memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); - memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); - } else { - memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); - } - update_particles(vid_buf); - - if(cmode==2) { - if(!fire_fc) { - dim_copy(fire_bg, vid_buf); - } else { - memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); - } - fire_fc = (fire_fc+1) % 3; - } - if(cmode==3||cmode==4) - render_fire(vid_buf); - - render_signs(vid_buf); - - memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); - clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); - - draw_svf_ui(vid_buf); - - if(http_ver_check) { - if(!do_check && http_async_req_status(http_ver_check)) { - ver_data = http_async_req_stop(http_ver_check, &http_ret, NULL); - if(http_ret==200 && ver_data) { + } + if(cmode==0 || cmode==1) + { + draw_air(vid_buf); + } + else if(cmode==2) + { + memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); + memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); + } + else + { + memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + } + update_particles(vid_buf); + + if(cmode==2) + { + if(!fire_fc) + { + dim_copy(fire_bg, vid_buf); + } + else + { + memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); + } + fire_fc = (fire_fc+1) % 3; + } + if(cmode==3||cmode==4) + render_fire(vid_buf); + + render_signs(vid_buf); + + memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); + clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); + + draw_svf_ui(vid_buf); + + if(http_ver_check) + { + if(!do_check && http_async_req_status(http_ver_check)) + { + ver_data = http_async_req_stop(http_ver_check, &http_ret, NULL); + if(http_ret==200 && ver_data) + { #ifdef BETA - if(sscanf(ver_data, "%d.%d.%d", &major, &minor, &is_beta)==3) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) - old_version = 1; + if(sscanf(ver_data, "%d.%d.%d", &major, &minor, &is_beta)==3) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) + old_version = 1; #else - if(sscanf(ver_data, "%d.%d", &major, &minor)==2) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) - old_version = 1; + if(sscanf(ver_data, "%d.%d", &major, &minor)==2) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) + old_version = 1; #endif - free(ver_data); - } - http_ver_check = NULL; - } - do_check = (do_check+1) & 15; - } - - if(sdl_key=='q' || sdl_key==SDLK_ESCAPE){ - if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")){ - break; - } - } - if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) { - if(load_mode) { - free(load_img); - free(load_data); - load_mode = 0; - load_data = NULL; - load_img = NULL; - } - if(it > 50) - it = 50; - if(sdl_key=='k' && stamps[1].name[0]) { - j = stamp_ui(vid_buf); - if(j>=0) - load_data = stamp_load(j, &load_size); - else - load_data = NULL; - } else - load_data = stamp_load(0, &load_size); - if(load_data) { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - if(sdl_key=='s') { - if(it > 50) - it = 50; - save_mode = 1; - } - if(sdl_key=='1'){ - set_cmode(0); - } - if(sdl_key=='2'){ - set_cmode(1); - } - if(sdl_key=='3'){ - set_cmode(2); - } - if(sdl_key=='4'){ - set_cmode(3); - } - if(sdl_key=='5'){ - set_cmode(4); - } - if(sdl_key=='6'){ - set_cmode(5); - } - if(sdl_key==SDLK_SPACE) - sys_pause = !sys_pause; - if(sdl_key=='h') - hud_enable = !hud_enable; - if(sdl_key=='p') - dump_frame(vid_buf, XRES, YRES, XRES); - if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))){ - if(clipboard_ready==1){ - load_data = malloc(clipboard_length); - memcpy(load_data, clipboard_data, clipboard_length); - load_size = clipboard_length; - if(load_data) { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - } - if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))){ - save_mode = 1; - copy_mode = 2; - } - if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))){ - save_mode = 1; - copy_mode = 1; - } else if(sdl_key=='c') { - set_cmode((cmode+1) % 6); - if(it > 50) - it = 50; - } + free(ver_data); + } + http_ver_check = NULL; + } + do_check = (do_check+1) & 15; + } + + if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) + { + if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) + { + break; + } + } + if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) + { + if(load_mode) + { + free(load_img); + free(load_data); + load_mode = 0; + load_data = NULL; + load_img = NULL; + } + if(it > 50) + it = 50; + if(sdl_key=='k' && stamps[1].name[0]) + { + j = stamp_ui(vid_buf); + if(j>=0) + load_data = stamp_load(j, &load_size); + else + load_data = NULL; + } + else + load_data = stamp_load(0, &load_size); + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + if(sdl_key=='s') + { + if(it > 50) + it = 50; + save_mode = 1; + } + if(sdl_key=='1') + { + set_cmode(0); + } + if(sdl_key=='2') + { + set_cmode(1); + } + if(sdl_key=='3') + { + set_cmode(2); + } + if(sdl_key=='4') + { + set_cmode(3); + } + if(sdl_key=='5') + { + set_cmode(4); + } + if(sdl_key=='6') + { + set_cmode(5); + } + if(sdl_key==SDLK_SPACE) + sys_pause = !sys_pause; + if(sdl_key=='h') + hud_enable = !hud_enable; + if(sdl_key=='p') + dump_frame(vid_buf, XRES, YRES, XRES); + if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + if(clipboard_ready==1) + { + load_data = malloc(clipboard_length); + memcpy(load_data, clipboard_data, clipboard_length); + load_size = clipboard_length; + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + } + if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 2; + } + if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 1; + } + else if(sdl_key=='c') + { + set_cmode((cmode+1) % 6); + if(it > 50) + it = 50; + } #ifdef INTERNAL - if(sdl_key=='v') - vs = !vs; - if(vs) - dump_frame(vid_buf, XRES, YRES, XRES); + if(sdl_key=='v') + vs = !vs; + if(vs) + dump_frame(vid_buf, XRES, YRES, XRES); #endif - - if(sdl_wheel) { - if(sdl_zoom_trig==1){ - ZSIZE += sdl_wheel; - if(ZSIZE>32) - ZSIZE = 32; - if(ZSIZE<2) - ZSIZE = 2; - ZFACTOR = 256/ZSIZE; - sdl_wheel = 0; - } else { - bs += sdl_wheel; - if(bs>16) - bs = 16; - if(bs<0) - bs = 0; - sdl_wheel = 0; - /*if(su >= PT_NUM) { - if(sl < PT_NUM) - su = sl; - if(sr < PT_NUM) - su = sr; - }*/ - } - } - - bq = b; - b = SDL_GetMouseState(&x, &y); - - for(i=0; i32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + sdl_wheel = 0; + } + else + { + bs += sdl_wheel; + if(bs>16) + bs = 16; + if(bs<0) + bs = 0; + sdl_wheel = 0; + /*if(su >= PT_NUM) { + if(sl < PT_NUM) + su = sl; + if(sr < PT_NUM) + su = sr; + }*/ + } + } + + bq = b; + b = SDL_GetMouseState(&x, &y); + + for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy - && x0 && y0 && x>8)>=NPART || !cr)){ + if(zoom_en && x>=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy + && x0 && y0 && x>8)>=NPART || !cr)) + { #ifdef BETA - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); #else - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); #endif - } else { - sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); - } - } - mx = x; - my = y; - if(update_flag) { - info_box(vid_buf, "Finalizing update..."); - if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) { - update_cleanup(); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } else { - if(update_finish()) - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - else - info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); - } - update_flag = 0; - } - - if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && - x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) { - tmp = malloc(64); + } + else + { + sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + } + } + mx = x; + my = y; + if(update_flag) + { + info_box(vid_buf, "Finalizing update..."); + if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) + { + update_cleanup(); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + { + if(update_finish()) + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + else + info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); + } + update_flag = 0; + } + + if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && + x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) + { + tmp = malloc(64); #ifdef BETA - if(is_beta){ - sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); - } else { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); - } + if(is_beta) + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); + } + else + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); + } #else - sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); + sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); #endif - if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) { - free(tmp); - tmp = download_ui(vid_buf, my_uri, &i); - if(tmp) { - save_presets(1); - if(update_start(tmp, i)) { - update_cleanup(); - save_presets(0); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } else - return 0; - } - } else - free(tmp); - } - if(y>=sdl_scale*(YRES+(MENUSIZE-20))) { - if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0){ - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0){ - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0){ - db = (svf_myvote==1) ? 273 : 274; - if(da < 51) - da ++; - } - else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) { - db = svf_own ? 257 : 256; - if(da < 51) - da ++; - } else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) { - db = 270; - if(da < 51) - da ++; - } else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) { - db = 266; - if(da < 51) - da ++; - } else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) { - db = 259; - if(svf_open && svf_own && x<=55*sdl_scale) - db = 258; - if(da < 51) - da ++; - } else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) { - db = svf_login ? 261 : 260; - if(svf_admin) { - db = 268; - } else if(svf_mod) { - db = 271; - } - if(da < 51) - da ++; - } else if(x>=sdl_scale && x<=17*sdl_scale) { - db = 262; - if(da < 51) - da ++; - } else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) { - db = sys_pause ? 264 : 263; - if(da < 51) - da ++; - } else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) { - db = 267; - if(da < 51) - da ++; - } else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) { - db = 265; - if(da < 51) - da ++; - } else if(da > 0) - da --; - } else - if(da > 0) - da --; - - if(!sdl_zoom_trig && zoom_en==1) - zoom_en = 0; - - if(sdl_key==Z_keysym && zoom_en==2) - zoom_en = 1; - - if(load_mode) { - load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); - load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); - if(load_x+load_w>XRES) load_x=XRES-load_w; - if(load_y+load_h>YRES) load_y=YRES-load_h; - if(load_x<0) load_x=0; - if(load_y<0) load_y=0; - if(bq==1 && !b) { - parse_save(load_data, load_size, 0, load_x, load_y); - free(load_data); - free(load_img); - load_mode = 0; - } else if(bq==4 && !b) { - free(load_data); - free(load_img); - load_mode = 0; - } - } else if(save_mode==1) { - save_x = (mx/sdl_scale)/CELL; - save_y = (my/sdl_scale)/CELL; - if(save_x >= XRES/CELL) save_x = XRES/CELL-1; - if(save_y >= YRES/CELL) save_y = YRES/CELL-1; - save_w = 1; - save_h = 1; - if(b==1){ - save_mode = 2; - } else if(b==4){ - save_mode = 0; - copy_mode = 0; - } - } else if(save_mode==2) { - save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; - save_h = (my/sdl_scale+CELL/2)/CELL - save_y; - if(save_w>XRES/CELL) save_w = XRES/CELL; - if(save_h>YRES/CELL) save_h = YRES/CELL; - if(save_w<1) save_w = 1; - if(save_h<1) save_h = 1; - if(!b) { - if(copy_mode==1){ - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - } else if(copy_mode==2){ - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - } else { - stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - save_mode = 0; - } - } - } else if(sdl_zoom_trig && zoom_en<2) { - x /= sdl_scale; - y /= sdl_scale; - x -= ZSIZE/2; - y -= ZSIZE/2; - if(x<0) x=0; - if(y<0) y=0; - if(x>XRES-ZSIZE) x=XRES-ZSIZE; - if(y>YRES-ZSIZE) y=YRES-ZSIZE; - zoom_x = x; - zoom_y = y; - zoom_wx = (x 50) - it = 50; - x /= sdl_scale; - y /= sdl_scale; - if(y>=YRES+(MENUSIZE-20)) { - if(!lb) { - if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0){ - if(execute_vote(vid_buf, svf_id, "Up")){ - svf_myvote = 1; - } - } - if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0){ - if(execute_vote(vid_buf, svf_id, "Down")){ - svf_myvote = -1; - } - } - if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) - tag_list_ui(vid_buf); - if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) { - legacy_enable = !legacy_enable; - } - if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) { - memset(signs, 0, sizeof(signs)); - memset(pv, 0, sizeof(pv)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(fvx, 0, sizeof(fvx)); - memset(fvy, 0, sizeof(fvy)); - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(parts, 0, sizeof(particle)*NPART); - for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) { - login_ui(vid_buf); - if(svf_login) - save_presets(0); - } - if(x>=37 && x<=187 && svf_login) { - if(!svf_open || !svf_own || x>51) { - if(save_name_ui(vid_buf)) - execute_save(vid_buf); - } else - execute_save(vid_buf); - while(!sdl_poll()) - if(!SDL_GetMouseState(&x, &y)) - break; - b = bq = 0; - } - if(x>=1 && x<=17) { - search_ui(vid_buf); - memset(fire_bg, 0, XRES*YRES*PIXELSIZE); - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - } - if(x>=19 && x<=35 && svf_last && svf_open) - parse_save(svf_last, svf_lsize, 1, 0, 0); - if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { - if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 6); - if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+5) % 6); - save_presets(0); - } - if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) - sys_pause = !sys_pause; - lb = 0; - } - } else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)){ - c = sl = cr&0xFF; - } else { - //Something - } - } - //create_parts(x, y, bs, SPC_AIR); - lx = x; - ly = y; - lb = 0; - lm = 0; - } else { - create_parts(x, y, bs, c); - lx = x; - ly = y; - lb = b; - lm = 0; - } - } - } - } else { - if(lb && lm) { - x /= sdl_scale; - y /= sdl_scale; - c = (lb&1) ? sl : sr; - su = c; - if(lm == 1) { - if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) - create_line(lx, ly, x, y, bs, c); - } else - create_box(lx, ly, x, y, c); - lm = 0; - } - lb = 0; - } - - if(load_mode) { - draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); - xor_rect(vid_buf, load_x, load_y, load_w, load_h); - } - - if(save_mode) { - xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - da = 51; - db = 269; - } - - if(zoom_en!=1 && !load_mode && !save_mode) - { - render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); - mousex = mx/sdl_scale; mousey = my/sdl_scale; - } - - if(zoom_en) - render_zoom(vid_buf); - - if(da) - switch(db) { - case 256: - drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); - break; - case 257: - drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); - break; - case 258: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); - break; - case 259: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); - break; - case 260: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); - break; - case 261: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); - break; - case 262: - drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); - break; - case 263: - drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); - break; - case 264: - drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); - break; - case 265: - drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); - break; - case 266: - drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); - break; - case 267: - drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); - break; - case 268: - drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); - break; - case 269: - drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); - break; - case 270: - drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); - break; - case 271: - drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); - break; - case 272: - drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); - break; - case 273: - drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); - break; - case 274: - drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); - break; - case 275: - drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); - break; - default: - drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); - } - if(itc) { - itc--; - drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); - } - if(it) { - it--; - //if(fbi_img) - //draw_image(vid_buf, fbi_img, (XRES-FBI_W)/2, (YRES-FBI_H)/2+25, FBI_W, FBI_H, it>12?64:it*5); - drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); - } - - if(old_version) { - clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); + if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) + { + free(tmp); + tmp = download_ui(vid_buf, my_uri, &i); + if(tmp) + { + save_presets(1); + if(update_start(tmp, i)) + { + update_cleanup(); + save_presets(0); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + return 0; + } + } + else + free(tmp); + } + if(y>=sdl_scale*(YRES+(MENUSIZE-20))) + { + if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) + { + db = (svf_myvote==1) ? 273 : 274; + if(da < 51) + da ++; + } + else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) + { + db = svf_own ? 257 : 256; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) + { + db = 270; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) + { + db = 266; + if(da < 51) + da ++; + } + else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) + { + db = 259; + if(svf_open && svf_own && x<=55*sdl_scale) + db = 258; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) + { + db = svf_login ? 261 : 260; + if(svf_admin) + { + db = 268; + } + else if(svf_mod) + { + db = 271; + } + if(da < 51) + da ++; + } + else if(x>=sdl_scale && x<=17*sdl_scale) + { + db = 262; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) + { + db = sys_pause ? 264 : 263; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) + { + db = 267; + if(da < 51) + da ++; + } + else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) + { + db = 265; + if(da < 51) + da ++; + } + else if(da > 0) + da --; + } + else if(da > 0) + da --; + + if(!sdl_zoom_trig && zoom_en==1) + zoom_en = 0; + + if(sdl_key==Z_keysym && zoom_en==2) + zoom_en = 1; + + if(load_mode) + { + load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); + load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); + if(load_x+load_w>XRES) load_x=XRES-load_w; + if(load_y+load_h>YRES) load_y=YRES-load_h; + if(load_x<0) load_x=0; + if(load_y<0) load_y=0; + if(bq==1 && !b) + { + parse_save(load_data, load_size, 0, load_x, load_y); + free(load_data); + free(load_img); + load_mode = 0; + } + else if(bq==4 && !b) + { + free(load_data); + free(load_img); + load_mode = 0; + } + } + else if(save_mode==1) + { + save_x = (mx/sdl_scale)/CELL; + save_y = (my/sdl_scale)/CELL; + if(save_x >= XRES/CELL) save_x = XRES/CELL-1; + if(save_y >= YRES/CELL) save_y = YRES/CELL-1; + save_w = 1; + save_h = 1; + if(b==1) + { + save_mode = 2; + } + else if(b==4) + { + save_mode = 0; + copy_mode = 0; + } + } + else if(save_mode==2) + { + save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; + save_h = (my/sdl_scale+CELL/2)/CELL - save_y; + if(save_w>XRES/CELL) save_w = XRES/CELL; + if(save_h>YRES/CELL) save_h = YRES/CELL; + if(save_w<1) save_w = 1; + if(save_h<1) save_h = 1; + if(!b) + { + if(copy_mode==1) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + } + else if(copy_mode==2) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + } + else + { + stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + save_mode = 0; + } + } + } + else if(sdl_zoom_trig && zoom_en<2) + { + x /= sdl_scale; + y /= sdl_scale; + x -= ZSIZE/2; + y -= ZSIZE/2; + if(x<0) x=0; + if(y<0) y=0; + if(x>XRES-ZSIZE) x=XRES-ZSIZE; + if(y>YRES-ZSIZE) y=YRES-ZSIZE; + zoom_x = x; + zoom_y = y; + zoom_wx = (x 50) + it = 50; + x /= sdl_scale; + y /= sdl_scale; + if(y>=YRES+(MENUSIZE-20)) + { + if(!lb) + { + if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Up")) + { + svf_myvote = 1; + } + } + if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Down")) + { + svf_myvote = -1; + } + } + if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) + tag_list_ui(vid_buf); + if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) + { + legacy_enable = !legacy_enable; + } + if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) + { + memset(signs, 0, sizeof(signs)); + memset(pv, 0, sizeof(pv)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(fvx, 0, sizeof(fvx)); + memset(fvy, 0, sizeof(fvy)); + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(parts, 0, sizeof(particle)*NPART); + for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) + { + login_ui(vid_buf); + if(svf_login) + save_presets(0); + } + if(x>=37 && x<=187 && svf_login) + { + if(!svf_open || !svf_own || x>51) + { + if(save_name_ui(vid_buf)) + execute_save(vid_buf); + } + else + execute_save(vid_buf); + while(!sdl_poll()) + if(!SDL_GetMouseState(&x, &y)) + break; + b = bq = 0; + } + if(x>=1 && x<=17) + { + search_ui(vid_buf); + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + } + if(x>=19 && x<=35 && svf_last && svf_open) + parse_save(svf_last, svf_lsize, 1, 0, 0); + if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) + { + if(b & SDL_BUTTON_LMASK) + set_cmode((cmode+1) % 6); + if(b & SDL_BUTTON_RMASK) + set_cmode((cmode+5) % 6); + save_presets(0); + } + if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) + sys_pause = !sys_pause; + lb = 0; + } + } + else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) + { + c = sl = cr&0xFF; + } + else + { + //Something + } + } + //create_parts(x, y, bs, SPC_AIR); + lx = x; + ly = y; + lb = 0; + lm = 0; + } + else + { + create_parts(x, y, bs, c); + lx = x; + ly = y; + lb = b; + lm = 0; + } + } + } + } + else + { + if(lb && lm) + { + x /= sdl_scale; + y /= sdl_scale; + c = (lb&1) ? sl : sr; + su = c; + if(lm == 1) + { + if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) + create_line(lx, ly, x, y, bs, c); + } + else + create_box(lx, ly, x, y, c); + lm = 0; + } + lb = 0; + } + + if(load_mode) + { + draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); + xor_rect(vid_buf, load_x, load_y, load_w, load_h); + } + + if(save_mode) + { + xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + da = 51; + db = 269; + } + + if(zoom_en!=1 && !load_mode && !save_mode) + { + render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); + mousex = mx/sdl_scale; + mousey = my/sdl_scale; + } + + if(zoom_en) + render_zoom(vid_buf); + + if(da) + switch(db) + { + case 256: + drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); + break; + case 257: + drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); + break; + case 258: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); + break; + case 259: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); + break; + case 260: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); + break; + case 261: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); + break; + case 262: + drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); + break; + case 263: + drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); + break; + case 264: + drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); + break; + case 265: + drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); + break; + case 266: + drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); + break; + case 267: + drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); + break; + case 268: + drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); + break; + case 269: + drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); + break; + case 270: + drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); + break; + case 271: + drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); + break; + case 272: + drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); + break; + case 273: + drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); + break; + case 274: + drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); + break; + case 275: + drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); + break; + default: + drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); + } + if(itc) + { + itc--; + drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); + } + if(it) + { + it--; + //if(fbi_img) + //draw_image(vid_buf, fbi_img, (XRES-FBI_W)/2, (YRES-FBI_H)/2+25, FBI_W, FBI_H, it>12?64:it*5); + drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); + } + + if(old_version) + { + clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); #ifdef BETA - if(is_beta){ - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); - } else { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); - } + if(is_beta) + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); + } + else + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); + } #else - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); #endif - drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); - } - /*#ifdef MT - pthread_join(pth2,NULL); - #endif*/ - - if(hud_enable){ - currentTime = SDL_GetTicks(); - if(currentTime-past>=16) { - past = SDL_GetTicks(); - FPS++; - } - if(currentTime-pastFPS>=1000) { + drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); + } + /*#ifdef MT + pthread_join(pth2,NULL); + #endif*/ + + if(hud_enable) + { + currentTime = SDL_GetTicks(); + if(currentTime-past>=16) + { + past = SDL_GetTicks(); + FPS++; + } + if(currentTime-pastFPS>=1000) + { #ifdef BETA - sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); + sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); #else - sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); + sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); #endif - FPSB = FPS; - FPS = 0; - pastFPS = currentTime; - } - if(sdl_zoom_trig||zoom_en){ - if(zoom_x= max) { + while((res = (char)GetModuleFileName(NULL, name, max)) >= max) + { #elif defined MACOSX char *fn=malloc(64),*name=malloc(PATH_MAX), max=64, res; - if(_NSGetExecutablePath(fn, &max) != 0) { - fn = realloc(fn, max); - _NSGetExecutablePath(fn, &max); + if(_NSGetExecutablePath(fn, &max) != 0) + { + fn = realloc(fn, max); + _NSGetExecutablePath(fn, &max); } - if(realpath(fn, name) == NULL) { - free(fn); - free(name); - return NULL; + if(realpath(fn, name) == NULL) + { + free(fn); + free(name); + return NULL; } res = 1; #else char fn[64], *name=malloc(64), max=64, res; sprintf(fn, "/proc/self/exe"); memset(name, 0, max); - while((res = readlink(fn, name, max)) >= max-1) { + while((res = readlink(fn, name, max)) >= max-1) + { #endif #ifndef MACOSX - max *= 2; - name = realloc(name, max); - memset(name, 0, max); + max *= 2; + name = realloc(name, max); + memset(name, 0, max); } #endif - if(res <= 0) { - free(name); - return NULL; + if(res <= 0) + { + free(name); + return NULL; } return name; } @@ -85,34 +90,36 @@ int update_start(char *data, int len) int res = 1; if(!self) - return 1; + return 1; #ifdef WIN32 temp = malloc(strlen(self)+12); strcpy(temp, self); p = temp + strlen(temp) - 4; if(_stricmp(p, ".exe")) - p += 4; + p += 4; strcpy(p, "_update.exe"); if(!MoveFile(self, temp)) - goto fail; + goto fail; f = fopen(self, "wb"); if(!f) - goto fail; - if(fwrite(data, 1, len, f) != len) { - fclose(f); - DeleteFile(self); - goto fail; + goto fail; + if(fwrite(data, 1, len, f) != len) + { + fclose(f); + DeleteFile(self); + goto fail; } fclose(f); - if((int)ShellExecute(NULL, "open", self, NULL, NULL, SW_SHOWNORMAL) <= 32) { - DeleteFile(self); - goto fail; + if((int)ShellExecute(NULL, "open", self, NULL, NULL, SW_SHOWNORMAL) <= 32) + { + DeleteFile(self); + goto fail; } - + return 0; #else temp = malloc(strlen(self)+8); @@ -121,22 +128,25 @@ int update_start(char *data, int len) f = fopen(temp, "w"); if(!f) - goto fail; - if(fwrite(data, 1, len, f) != len) { - fclose(f); - unlink(temp); - goto fail; + goto fail; + if(fwrite(data, 1, len, f) != len) + { + fclose(f); + unlink(temp); + goto fail; } fclose(f); - if(chmod(temp, 0755)) { - unlink(temp); - goto fail; + if(chmod(temp, 0755)) + { + unlink(temp); + goto fail; } - if(rename(temp, self)) { - unlink(temp); - goto fail; + if(rename(temp, self)) + { + unlink(temp); + goto fail; } execl(self, "powder-update", NULL); @@ -158,22 +168,25 @@ int update_finish(void) strcpy(temp, self); p = temp + strlen(temp) - 4; if(_stricmp(p, ".exe")) - p += 4; + p += 4; strcpy(p, "_update.exe"); - while(!DeleteFile(temp)) { - err = GetLastError(); - if(err == ERROR_FILE_NOT_FOUND) { - // just as well, then - free(temp); - return 0; - } - Sleep(500); - timeout--; - if(timeout <= 0) { - free(temp); - return 1; - } + while(!DeleteFile(temp)) + { + err = GetLastError(); + if(err == ERROR_FILE_NOT_FOUND) + { + // just as well, then + free(temp); + return 0; + } + Sleep(500); + timeout--; + if(timeout <= 0) + { + free(temp); + return 1; + } } free(temp); #endif -- cgit v0.9.2-21-gd62e From 81063864a46ef5407ed10aec66c8c9d5791078e9 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 20:30:04 +0800 Subject: WATAAH diff --git a/powder.c b/powder.c index ffc6568..99a3dd1 100644 --- a/powder.c +++ b/powder.c @@ -2947,6 +2947,21 @@ justdraw: } } } + else if(t==PT_WATR) + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,32,48,208,70); + } + } + } else if(t==PT_WTRV) { if(cmode == 3||cmode==4) @@ -10518,4 +10533,4 @@ int main(int argc, char *argv[]) http_done(); return 0; -} \ No newline at end of file +} -- cgit v0.9.2-21-gd62e From abc9efe10f90775ba47a64640d838a823504092c Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 20:34:37 +0800 Subject: now for destilled water too. diff --git a/powder.c b/powder.c index 99a3dd1..c23fea3 100644 --- a/powder.c +++ b/powder.c @@ -2961,7 +2961,21 @@ justdraw: blendpixel(vid,x+nx,y+ny,32,48,208,70); } } - } + } + else if(t==PT_DSTW) + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,32,48,208,70); + } + } + else if(t==PT_WTRV) { if(cmode == 3||cmode==4) -- cgit v0.9.2-21-gd62e From f78eef8903f0327ed83b593d56753d52b2d02e00 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 20:35:06 +0800 Subject: fixed curly brackets diff --git a/powder.c b/powder.c index c23fea3..90c81fe 100644 --- a/powder.c +++ b/powder.c @@ -2963,6 +2963,7 @@ justdraw: } } else if(t==PT_DSTW) + { for(x=-3; x<4; x++) { for(y=-3; y<4; y++) @@ -2975,7 +2976,7 @@ justdraw: blendpixel(vid,x+nx,y+ny,32,48,208,70); } } - + } else if(t==PT_WTRV) { if(cmode == 3||cmode==4) -- cgit v0.9.2-21-gd62e From 5ef2b6069b5455bb34a0af44db5e5c6f4ce59818 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 16 Aug 2010 13:54:36 +0100 Subject: Remove binary notation for other compilers diff --git a/powder.c b/powder.c old mode 100644 new mode 100755 index 90c81fe..836de9f --- a/powder.c +++ b/powder.c @@ -582,11 +582,11 @@ struct menu_section msections[] = #define MAX_TEMP 3500 #define MIN_TEMP -273 -static unsigned char TYPE_PART = 0b0001 << 4; -static unsigned char TYPE_LIQUID = 0b0010 << 4; -static unsigned char TYPE_SOLID = 0b0100 << 4; -static unsigned char TYPE_GAS = 0b1000 << 4; -static unsigned char PROP_CONDUCTS = 0b0001 >> 4; +static unsigned char TYPE_PART = 0x01; //1 +static unsigned char TYPE_LIQUID = 0x02; //2 +static unsigned char TYPE_SOLID = 0x04; //4 +static unsigned char TYPE_GAS = 0x08; //8 +static unsigned char PROP_CONDUCTS = 0x10; //16 const struct part_type ptypes[] = { -- cgit v0.9.2-21-gd62e From 9fcb23954db99934f3ea38f5ef403cfea0832345 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 16:57:20 +0200 Subject: Changed rendering of most liquids diff --git a/powder.c b/powder.c index 836de9f..50b5599 100755 --- a/powder.c +++ b/powder.c @@ -2824,7 +2824,19 @@ justdraw: cr = PIXR(ptypes[t].pcolors)/s; cg = PIXG(ptypes[t].pcolors)/s; cb = PIXB(ptypes[t].pcolors)/s; - blendpixel(vid, nx, ny, cr, cg, cb, 255); + for(x=-2; x<2; x++) + { + for(y=-2; y<2; y++) + { + if (abs(x)+abs(y) <=0 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + if(abs(x)+abs(y) <1 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,95); + if (abs(x)+abs(y) <= 2) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,90); + } + } + if(cmode==4) { blendpixel(vid, nx+1, ny, cr, cg, cb, 223); @@ -2870,6 +2882,22 @@ justdraw: blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } } + else if(t==PT_SLTW) + { + for(x=-3; x<3; x++) + { + for(y=-3; y<3; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,64,80,240,100); + else if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,64,80,240,70); + else if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,64,80,240,90); + } + } + + } else if(t==PT_PHOT) { if(cmode == 3||cmode==4) @@ -2956,9 +2984,9 @@ justdraw: if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) blendpixel(vid,x+nx,y+ny,32,48,208,100); if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - if (abs(x)+abs(y) == 2) blendpixel(vid,x+nx,y+ny,32,48,208,70); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,32,48,208,90); } } } -- cgit v0.9.2-21-gd62e From d501059c1b9439a11220163cd3e9333981bf15ff Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 17:05:39 +0200 Subject: Added ln2 diffusing diff --git a/powder.c b/powder.c index 50b5599..dcca104 100755 --- a/powder.c +++ b/powder.c @@ -2940,6 +2940,22 @@ justdraw: y = ny; blendpixel(vid,x,y,17,217,24,255); } + else if(t==PT_LNTG) + { + for(x=-3; x<3; x++) + { + for(y=-3; y<3; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,128,160,223,100); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,128,160,223,70); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,128,160,223,90); + } + } + + } else if(t==PT_SMKE) { if(cmode == 3||cmode==4) -- cgit v0.9.2-21-gd62e From 9bd08247336a9be4c5ab71b98ffa40aaaab2c079 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 17:22:25 +0200 Subject: changed looks. still needs to be modified diff --git a/powder.c b/powder.c index dcca104..8090ee3 100755 --- a/powder.c +++ b/powder.c @@ -2884,14 +2884,14 @@ justdraw: } else if(t==PT_SLTW) { - for(x=-3; x<3; x++) + for(x=-2; x<2; x++) { - for(y=-3; y<3; y++) + for(y=-2; y<2; y++) { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + if (abs(x)+abs(y) <0 && !(abs(x)==2||abs(y)==2)) blendpixel(vid,x+nx,y+ny,64,80,240,100); - else if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,64,80,240,70); + else if(abs(x)+abs(y) == 1 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,64,80,240,95); else if (abs(x)+abs(y) == 2) blendpixel(vid,x+nx,y+ny,64,80,240,90); } @@ -2942,15 +2942,15 @@ justdraw: } else if(t==PT_LNTG) { - for(x=-3; x<3; x++) + for(x=-2; x<2; x++) { - for(y=-3; y<3; y++) + for(y=-2; y<2; y++) { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + if(abs(x)+abs(y) <0 && !(abs(x)==2||abs(y)==2)) blendpixel(vid,x+nx,y+ny,128,160,223,100); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,128,160,223,70); - if (abs(x)+abs(y) == 2) + else if(abs(x)+abs(y) == 1 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,128,160,223,95); + else if (abs(x)+abs(y) == 2) blendpixel(vid,x+nx,y+ny,128,160,223,90); } } @@ -2993,14 +2993,14 @@ justdraw: } else if(t==PT_WATR) { - for(x=-3; x<4; x++) + for(x=-2; x<2; x++) { - for(y=-3; y<4; y++) + for(y=-2; y<2; y++) { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + if (abs(x)+abs(y) <0 && !(abs(x)==2||abs(y)==2)) blendpixel(vid,x+nx,y+ny,32,48,208,100); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,32,48,208,70); + if(abs(x)+abs(y) == 1 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,32,48,208,95); if (abs(x)+abs(y) == 2) blendpixel(vid,x+nx,y+ny,32,48,208,90); } @@ -3008,16 +3008,16 @@ justdraw: } else if(t==PT_DSTW) { - for(x=-3; x<4; x++) + for(x=-2; x<2; x++) { - for(y=-3; y<4; y++) + for(y=-2; y<2; y++) { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + if (abs(x)+abs(y) <0 && !(abs(x)==2||abs(y)==2)) blendpixel(vid,x+nx,y+ny,32,48,208,100); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,32,48,208,50); + if(abs(x)+abs(y) == 1 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,32,48,208,95); if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,32,48,208,70); + blendpixel(vid,x+nx,y+ny,32,48,208,90); } } } -- cgit v0.9.2-21-gd62e From 242c7097387d013758db0d5b01094225e9a15600 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 17:39:41 +0200 Subject: more changes with diffusion of liquids diff --git a/powder.c b/powder.c index 8090ee3..a932696 100755 --- a/powder.c +++ b/powder.c @@ -2850,6 +2850,22 @@ justdraw: blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); } } + else if(t==PT_OILL) + { + for(x=-2; x<2; x++) + { + for(y=-2; y<2; y++) + { + if (abs(x)+abs(y) <=0 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,64,64,16,100); + if(abs(x)+abs(y) <1 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,64,64,16,95); + if (abs(x)+abs(y) <= 2) + blendpixel(vid,x+nx,y+ny,64,64,16,90); + } + } + + } else if(t==PT_NEUT) { if(cmode == 3||cmode==4) -- cgit v0.9.2-21-gd62e From 9baf8ad869ae2e5977627210fa9be0f921a0947b Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 18:36:35 +0200 Subject: now it looks good and less blobby. diff --git a/powder.c b/powder.c index a932696..f019485 100755 --- a/powder.c +++ b/powder.c @@ -2824,16 +2824,14 @@ justdraw: cr = PIXR(ptypes[t].pcolors)/s; cg = PIXG(ptypes[t].pcolors)/s; cb = PIXB(ptypes[t].pcolors)/s; - for(x=-2; x<2; x++) + for(x=-1; x<=1; x++) { - for(y=-2; y<2; y++) + for(y=-1; y<=1; y++) { - if (abs(x)+abs(y) <=0 && !(abs(x)==2||abs(y)==2)) + if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); - if(abs(x)+abs(y) <1 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,95); - if (abs(x)+abs(y) <= 2) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,90); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,50); } } @@ -2851,20 +2849,17 @@ justdraw: } } else if(t==PT_OILL) - { - for(x=-2; x<2; x++) + { + for(x=-1; x<=1; x++) { - for(y=-2; y<2; y++) + for(y=-1; y<=1; y++) { - if (abs(x)+abs(y) <=0 && !(abs(x)==2||abs(y)==2)) + if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,64,64,16,100); - if(abs(x)+abs(y) <1 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,64,64,16,95); - if (abs(x)+abs(y) <= 2) - blendpixel(vid,x+nx,y+ny,64,64,16,90); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,64,16,50); } } - } else if(t==PT_NEUT) { @@ -2900,19 +2895,16 @@ justdraw: } else if(t==PT_SLTW) { - for(x=-2; x<2; x++) + for(x=-1; x<=1; x++) { - for(y=-2; y<2; y++) + for(y=-1; y<=1; y++) { - if (abs(x)+abs(y) <0 && !(abs(x)==2||abs(y)==2)) + if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,64,80,240,100); - else if(abs(x)+abs(y) == 1 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,64,80,240,95); - else if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,64,80,240,90); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,80,240,50); } } - } else if(t==PT_PHOT) { @@ -2958,19 +2950,16 @@ justdraw: } else if(t==PT_LNTG) { - for(x=-2; x<2; x++) + for(x=-1; x<=1; x++) { - for(y=-2; y<2; y++) + for(y=-1; y<=1; y++) { - if(abs(x)+abs(y) <0 && !(abs(x)==2||abs(y)==2)) + if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,128,160,223,100); - else if(abs(x)+abs(y) == 1 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,128,160,223,95); - else if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,128,160,223,90); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,128,160,223,50); } } - } else if(t==PT_SMKE) { @@ -3009,31 +2998,28 @@ justdraw: } else if(t==PT_WATR) { - for(x=-2; x<2; x++) + for(x=-1; x<=1; x++) { - for(y=-2; y<2; y++) + for(y=-1; y<=1; y++) { - if (abs(x)+abs(y) <0 && !(abs(x)==2||abs(y)==2)) + if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,32,48,208,100); - if(abs(x)+abs(y) == 1 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,32,48,208,95); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,32,48,208,90); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); } } + } else if(t==PT_DSTW) - { - for(x=-2; x<2; x++) - { - for(y=-2; y<2; y++) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) { - if (abs(x)+abs(y) <0 && !(abs(x)==2||abs(y)==2)) + if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,32,48,208,100); - if(abs(x)+abs(y) == 1 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,32,48,208,95); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,32,48,208,90); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); } } } -- cgit v0.9.2-21-gd62e From ed38916423873ff870f402b341ebbbc6f4d8559e Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 19:43:03 +0200 Subject: added test for gas diff --git a/powder.c b/powder.c index f019485..74b23fc 100755 --- a/powder.c +++ b/powder.c @@ -2831,7 +2831,7 @@ justdraw: if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,50); + blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); } } @@ -2857,7 +2857,7 @@ justdraw: if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,64,64,16,100); else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,64,16,50); + blendpixel(vid,x+nx,y+ny,64,64,16,40); } } } @@ -3023,6 +3023,20 @@ justdraw: } } } + else if(t==PT_GASS) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,224,255,32,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,224,255,32,20); + } + } + + } else if(t==PT_WTRV) { if(cmode == 3||cmode==4) -- cgit v0.9.2-21-gd62e From 9f6a5b7e3b0034dd1be94dd157ce61daf02e8e07 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 19:46:47 +0200 Subject: Added for noble too diff --git a/powder.c b/powder.c index 74b23fc..9132dd6 100755 --- a/powder.c +++ b/powder.c @@ -3023,6 +3023,20 @@ justdraw: } } } + else if(t==PT_NBLE) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,235,73,23,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,235,73,23,20); + } + } + + } else if(t==PT_GASS) { for(x=-1; x<=1; x++) -- cgit v0.9.2-21-gd62e From 76a2dfac7e64c9638c83f75c8dbab62a7b1f3ebc Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 20:16:35 +0200 Subject: various other things diff --git a/powder.c b/powder.c index 9132dd6..59c1e3e 100755 --- a/powder.c +++ b/powder.c @@ -3023,6 +3023,35 @@ justdraw: } } } + else if(t==PT_NITR) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,224,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,224,16,50); + } + } + + } + else if(t==PT_LRBD) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,170,170,170,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,170,170,170,50); + } + } + + } + else if(t==PT_NBLE) { for(x=-1; x<=1; x++) -- cgit v0.9.2-21-gd62e From 40f6e4583f05d1cdd17021fc2095bd7fe8a91871 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 20:39:41 +0200 Subject: test diff --git a/powder.c b/powder.c index 59c1e3e..2acd1d6 100755 --- a/powder.c +++ b/powder.c @@ -3073,7 +3073,7 @@ justdraw: for(y=-1; y<=1; y++) { if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,255,32,100); + blendpixel(vid,x+nx,y+ny,224,255,32,200); else if (abs(y) != 0 || abs(x) != 0) blendpixel(vid,x+nx,y+ny,224,255,32,20); } -- cgit v0.9.2-21-gd62e From 9c0a95c34bf782329e01a5f582acee19058da314 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 20:42:05 +0200 Subject: test diff --git a/powder.c b/powder.c index 2acd1d6..54f0f96 100755 --- a/powder.c +++ b/powder.c @@ -3073,7 +3073,7 @@ justdraw: for(y=-1; y<=1; y++) { if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,255,32,200); + blendpixel(vid,x+nx,y+ny,224,255,32,255); else if (abs(y) != 0 || abs(x) != 0) blendpixel(vid,x+nx,y+ny,224,255,32,20); } -- cgit v0.9.2-21-gd62e From b27e61e64a94eb084cc4e1e6e0c9d2f2dab7a4a9 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 16 Aug 2010 15:09:45 -0400 Subject: sorta glow-ish diff --git a/powder.c b/powder.c index 54f0f96..03c7a7f 100755 --- a/powder.c +++ b/powder.c @@ -3180,8 +3180,20 @@ justdraw: blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } - else if(t==PT_PLSM) + } else if(t==PT_URAN) { + cr=0x70; + cg=0x70; + cb=0x20; + blendpixel(vid, nx, ny, 255, 255, 255, 255); + blendpixel(vid, nx+1, ny, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx-1, ny, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx, ny+1, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx, ny-1, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 255); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 255); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 255); + } else if(t==PT_PLSM) { float ttemp = parts[i].life; int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); -- cgit v0.9.2-21-gd62e From 335bd5ecf88737b1055aaf71f1ab91f4882051e1 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 16 Aug 2010 15:31:10 -0400 Subject: added glow-ish uran and plut diff --git a/powder.c b/powder.c index 03c7a7f..b3ab34d 100755 --- a/powder.c +++ b/powder.c @@ -3181,18 +3181,63 @@ justdraw: blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } } else if(t==PT_URAN) { - cr=0x70; - cg=0x70; - cb=0x20; - blendpixel(vid, nx, ny, 255, 255, 255, 255); - blendpixel(vid, nx+1, ny, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx-1, ny, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx, ny+1, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx, ny-1, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 255); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 255); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 255); + cr=0x70; + cg=0x70; + cb=0x20; + blendpixel(vid, nx, ny, cr, cr, cr, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny, cr, cg, cb, 32); + blendpixel(vid, nx, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); + } else if(t==PT_PLUT) { + cr=0x40; + cg=0x70; + cb=0x20; + blendpixel(vid, nx, ny, cr, cr, cr, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny, cr, cg, cb, 32); + blendpixel(vid, nx, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); } else if(t==PT_PLSM) { float ttemp = parts[i].life; -- cgit v0.9.2-21-gd62e From 77646c71040182fd7871407c3fd1f404e2e4f4b0 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 17 Aug 2010 03:09:45 +0800 Subject: sorta glow-ish diff --git a/powder.c b/powder.c index 54f0f96..03c7a7f 100755 --- a/powder.c +++ b/powder.c @@ -3180,8 +3180,20 @@ justdraw: blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } - else if(t==PT_PLSM) + } else if(t==PT_URAN) { + cr=0x70; + cg=0x70; + cb=0x20; + blendpixel(vid, nx, ny, 255, 255, 255, 255); + blendpixel(vid, nx+1, ny, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx-1, ny, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx, ny+1, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx, ny-1, cr+100, cg+100, cb+100, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 255); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 255); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 255); + } else if(t==PT_PLSM) { float ttemp = parts[i].life; int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); -- cgit v0.9.2-21-gd62e From 9249455ba7d1987f8b730ea585ac86b15374b4c3 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 17 Aug 2010 03:31:10 +0800 Subject: added glow-ish uran and plut diff --git a/powder.c b/powder.c index 03c7a7f..b3ab34d 100755 --- a/powder.c +++ b/powder.c @@ -3181,18 +3181,63 @@ justdraw: blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } } else if(t==PT_URAN) { - cr=0x70; - cg=0x70; - cb=0x20; - blendpixel(vid, nx, ny, 255, 255, 255, 255); - blendpixel(vid, nx+1, ny, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx-1, ny, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx, ny+1, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx, ny-1, cr+100, cg+100, cb+100, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 255); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 255); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 255); + cr=0x70; + cg=0x70; + cb=0x20; + blendpixel(vid, nx, ny, cr, cr, cr, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny, cr, cg, cb, 32); + blendpixel(vid, nx, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); + } else if(t==PT_PLUT) { + cr=0x40; + cg=0x70; + cb=0x20; + blendpixel(vid, nx, ny, cr, cr, cr, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny, cr, cg, cb, 32); + blendpixel(vid, nx, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); } else if(t==PT_PLSM) { float ttemp = parts[i].life; -- cgit v0.9.2-21-gd62e From f6170777a158cd900832493502f9715c8393eacf Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 16 Aug 2010 15:45:41 -0400 Subject: added glow-ish uran and plut diff --git a/powder.c b/powder.c index b3ab34d..456f1c3 100755 --- a/powder.c +++ b/powder.c @@ -3209,6 +3209,90 @@ justdraw: blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+3, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+3, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+3, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+3, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+3, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); } else if(t==PT_PLUT) { cr=0x40; cg=0x70; @@ -3238,6 +3322,90 @@ justdraw: blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+3, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+3, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+3, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+3, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+3, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny+1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+1, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny-1, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-1, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny+3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-4, ny-3, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny+4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx-3, ny-4, cr+10, cg+10, cb+10, 32); + blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); + blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); } else if(t==PT_PLSM) { float ttemp = parts[i].life; -- cgit v0.9.2-21-gd62e From 1682788324048e4d8fc6a6fcbb7cb044cd2b6441 Mon Sep 17 00:00:00 2001 From: ief015 Date: Mon, 16 Aug 2010 16:09:22 -0400 Subject: > ief015 -Ctrl+Z Undo (ctrl+z will only to revert to the undo state, there is no redo, though I can change this if it becomes necessary) -I don't know what those inline keywords were for, but they were causing errors. diff --git a/powder.c b/powder.c index 9c7d2d9..eb5b6d6 100644 --- a/powder.c +++ b/powder.c @@ -5,6 +5,7 @@ * Copyright (c) 2010 Simon Robertshaw * Copyright (c) 2010 Skresanov Savely * Copyright (c) 2010 Bryan Hoyle + * Copyright (c) 2010 Nathan Cousins * * 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 @@ -113,6 +114,7 @@ char *it_msg = "Shift+drag will create straight lines of particles.\n" "Ctrl+drag will result in filled rectangles.\n" "Ctrl+Shift+click will flood-fill a closed area.\n" + "Ctrl+Z will act as Undo.\n" "Middle click or Alt+Click to \"sample\" the particles.\n" "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" "Use 'S' to save parts of the window as 'stamps'.\n" @@ -128,6 +130,7 @@ char *it_msg = "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" + "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" "\n" "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" @@ -169,11 +172,20 @@ struct sign unsigned char bmap[YRES/CELL][XRES/CELL]; unsigned char emap[YRES/CELL][XRES/CELL]; + +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; + unsigned cmode = 3; float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float cb_vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float cb_vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float cb_pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; #define TSTEPP 0.3f #define TSTEPV 0.4f @@ -340,7 +352,7 @@ void *update_air_th(void *arg) return NULL; } -inline unsigned clamp_flt(float f, float min, float max) +unsigned clamp_flt(float f, float min, float max) { if(f=XRES || y>=YRES) @@ -1272,7 +1288,7 @@ void set_emap(int x, int y) set_emap(x, y+1); } } -inline int parts_avg(int ci, int ni) + int parts_avg(int ci, int ni) { int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; if((pmr>>8) < NPART && (pmr>>8) >= 0) @@ -4474,7 +4490,7 @@ void *build_thumb(int *size, int bzip2) return d; } -inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl) { unsigned char *d,*c=thumb; @@ -5434,7 +5450,7 @@ void del_stamp(int d) #include "font.h" -inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) { pixel t; if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) @@ -5449,7 +5465,7 @@ inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } -inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) { int i, j, w, bn = 0, ba = 0; char *rp = font_data + font_ptrs[c]; @@ -9875,6 +9891,7 @@ int main(int argc, char *argv[]) #endif menu_count(); parts = calloc(sizeof(particle), NPART); + cb_parts = calloc(sizeof(particle), NPART); for(i=0; i 50) it = 50; } + if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo + { + int cbx, cby, cbi; + + for(cbi=0; cbi Date: Mon, 16 Aug 2010 16:23:46 -0400 Subject: readded inlines, my bad diff --git a/powder.c b/powder.c index eb5b6d6..d403ff8 100644 --- a/powder.c +++ b/powder.c @@ -352,7 +352,7 @@ void *update_air_th(void *arg) return NULL; } -unsigned clamp_flt(float f, float min, float max) +inline unsigned clamp_flt(float f, float min, float max) { if(f=XRES || y>=YRES) @@ -1288,7 +1288,7 @@ void set_emap(int x, int y) set_emap(x, y+1); } } - int parts_avg(int ci, int ni) + inline int parts_avg(int ci, int ni) { int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; if((pmr>>8) < NPART && (pmr>>8) >= 0) @@ -5450,7 +5450,7 @@ void del_stamp(int d) #include "font.h" -void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) { pixel t; if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) @@ -5465,7 +5465,7 @@ void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } -int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) { int i, j, w, bn = 0, ba = 0; char *rp = font_data + font_ptrs[c]; -- cgit v0.9.2-21-gd62e From b56d7a4e1ea168cb648ebf670a30b7b0891fee35 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 16 Aug 2010 16:32:15 -0400 Subject: pretty glow :) diff --git a/powder.c b/powder.c index 456f1c3..e57bff5 100755 --- a/powder.c +++ b/powder.c @@ -2892,8 +2892,43 @@ justdraw: blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } - else if(t==PT_SLTW) + } else if(t==PT_PLUT) + { + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_URAN) + { + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_SLTW) { for(x=-1; x<=1; x++) { @@ -3180,233 +3215,7 @@ justdraw: blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } else if(t==PT_URAN) { - cr=0x70; - cg=0x70; - cb=0x20; - blendpixel(vid, nx, ny, cr, cr, cr, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny, cr, cg, cb, 32); - blendpixel(vid, nx, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - } else if(t==PT_PLUT) { - cr=0x40; - cg=0x70; - cb=0x20; - blendpixel(vid, nx, ny, cr, cr, cr, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny, cr, cg, cb, 32); - blendpixel(vid, nx, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - } else if(t==PT_PLSM) + } else if(t==PT_PLSM) { float ttemp = parts[i].life; int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); -- cgit v0.9.2-21-gd62e From 9866b8d24bb11e5fe209a779cf5cb1ae8de53560 Mon Sep 17 00:00:00 2001 From: FacialTurd Date: Mon, 16 Aug 2010 13:47:18 -0700 Subject: LOOPS diff --git a/powder.c b/powder.c index d403ff8..e9adc98 100644 --- a/powder.c +++ b/powder.c @@ -3196,232 +3196,41 @@ justdraw: blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } else if(t==PT_URAN) { - cr=0x70; - cg=0x70; - cb=0x20; - blendpixel(vid, nx, ny, cr, cr, cr, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny, cr, cg, cb, 32); - blendpixel(vid, nx, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); } else if(t==PT_PLUT) { - cr=0x40; - cg=0x70; - cb=0x20; - blendpixel(vid, nx, ny, cr, cr, cr, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny, cr, cg, cb, 32); - blendpixel(vid, nx, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_URAN) + { + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } } else if(t==PT_PLSM) { float ttemp = parts[i].life; -- cgit v0.9.2-21-gd62e From 5826279c6d0bd1bf60ae106112fd00ab823adee2 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 22:52:22 +0200 Subject: backup files. diff --git a/.gitignore b/.gitignore index c66d7cb..ccc72b8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ powder-64-sse3 powder.def powder-debug gmon.out +*.*.orig -- cgit v0.9.2-21-gd62e From 55e731c7561f3ebfc2d4286b7993c9b13851856a Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 16 Aug 2010 21:54:12 +0100 Subject: .orig? NOT IT MY GIT diff --git a/powder.c.orig b/powder.c.orig deleted file mode 100755 index 456f1c3..0000000 --- a/powder.c.orig +++ /dev/null @@ -1,10879 +0,0 @@ -/** - * Powder Toy - Main source - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * Copyright (c) 2010 Simon Robertshaw - * Copyright (c) 2010 Skresanov Savely - * Copyright (c) 2010 Bryan Hoyle - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#else -#include -#include -#endif - - -#include "version.h" -#include "http.h" -#include "md5.h" -#include "update.h" -#include "hmap.h" - -#define SERVER "powdertoy.co.uk" - -#undef PLOSS - -#ifdef MENUV3 -#define MENUSIZE 40 -#else -#define MENUSIZE 20 -#endif -#define BARSIZE 14 -#define XRES 612 -#define YRES 384 -#define NPART XRES*YRES - -#define ZSIZE_D 16 -#define ZFACTOR_D 8 -unsigned char ZFACTOR = 256/ZSIZE_D; -unsigned char ZSIZE = ZSIZE_D; - -#define CELL 4 -#define ISTP (CELL/2) -#define CFDS (4.0f/CELL) - -typedef unsigned char uint8; - -#ifdef PIX16 -#define PIXELSIZE 2 -typedef unsigned short pixel; -#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) -#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) -#define PIXR(x) (((x)>>8)&0xF8) -#define PIXG(x) (((x)>>3)&0xFC) -#define PIXB(x) (((x)<<3)&0xF8) -#else -#define PIXELSIZE 4 -typedef unsigned int pixel; -#ifdef PIX32BGR -#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) -#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) -#define PIXR(x) ((x)&0xFF) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)>>16) -#else -#ifdef PIX32BGRA -#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) -#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) -#define PIXR(x) (((x)>>8)&0xFF) -#define PIXG(x) (((x)>>16)&0xFF) -#define PIXB(x) (((x)>>24)) -#else -#define PIXPACK(x) (x) -#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) -#define PIXR(x) ((x)>>16) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)&0xFF) -#endif -#endif -#endif - -char *it_msg = - "\brThe Powder Toy\n" - "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" - "\n" - "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" - "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" - "\bgPick your material from the menu using mouse left/right buttons.\n" - "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" - "Shift+drag will create straight lines of particles.\n" - "Ctrl+drag will result in filled rectangles.\n" - "Ctrl+Shift+click will flood-fill a closed area.\n" - "Middle click or Alt+Click to \"sample\" the particles.\n" - "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" - "Use 'S' to save parts of the window as 'stamps'.\n" - "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" - "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" - "Use the mouse scroll wheel to change the tool size for particles.\n" - "'Q' will quit the application.\n" - "The spacebar can be used to pause physics.\n" - "'P' will take a screenshot and save it into the current directory.\n" - "\n" - "\brhttp://powdertoy.co.uk/\n" - "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" - "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" - "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" - "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" - "\n" - "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" - "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" - ; - -typedef struct -{ - int start, inc; - pixel *vid; -} upstruc; - -#ifdef BETA -char *old_ver_msg_beta = "A new beta is available - click here!"; -#endif -char *old_ver_msg = "A new version is available - click here!"; -float mheat = 0.0f; - -int do_open = 0; -int sys_pause = 0; -int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. - -int amd = 0; - -unsigned char fire_r[YRES/CELL][XRES/CELL]; -unsigned char fire_g[YRES/CELL][XRES/CELL]; -unsigned char fire_b[YRES/CELL][XRES/CELL]; - -#define MAXSIGNS 16 - -struct sign -{ - int x,y,ju; - char text[256]; -} signs[MAXSIGNS]; - -/*********************************************************** - * AIR FLOW SIMULATOR * - ***********************************************************/ - -unsigned char bmap[YRES/CELL][XRES/CELL]; -unsigned char emap[YRES/CELL][XRES/CELL]; -unsigned cmode = 3; - -float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; -float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; -#define TSTEPP 0.3f -#define TSTEPV 0.4f -#define VADV 0.3f -#define VLOSS 0.999f -#define PLOSS 0.9999f -int numCores = 1; -float kernel[9]; -void make_kernel(void) -{ - int i, j; - float s = 0.0f; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - { - kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); - s += kernel[(i+1)+3*(j+1)]; - } - s = 1.0f / s; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - kernel[(i+1)+3*(j+1)] *= s; -} - -int core_count() -{ - int numCPU = 1; -#ifdef MT -#ifdef WIN32 - SYSTEM_INFO sysinfo; - GetSystemInfo( &sysinfo ); - numCPU = sysinfo.dwNumberOfProcessors; -#else -#ifdef MACOSX - numCPU = 4; -#else - numCPU = sysconf( _SC_NPROCESSORS_ONLN ); -#endif -#endif - - printf("Cpus: %d\n", numCPU); - if(numCPU>1) - printf("Multithreading enabled\n"); - else - printf("Multithreading disabled\n"); -#endif - return numCPU; -} - -void update_air(void) -{ - int x, y, i, j; - float dp, dx, dy, f, tx, ty; - - for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; - if(dp < -256.0f) dp = -256.0f; - if(dx > 256.0f) dx = 256.0f; - if(dx < -256.0f) dx = -256.0f; - if(dy > 256.0f) dy = 256.0f; - if(dy < -256.0f) dy = -256.0f; - - ovx[y][x] = dx; - ovy[y][x] = dy; - opv[y][x] = dp; - } - memcpy(vx, ovx, sizeof(vx)); - memcpy(vy, ovy, sizeof(vy)); - memcpy(pv, opv, sizeof(pv)); -} - -void *update_air_th(void *arg) -{ - update_air(); - return NULL; -} - -inline unsigned clamp_flt(float f, float min, float max) -{ - if(fmax) - return 255; - return (int)(255.0f*(f-min)/(max-min)); -} - -inline float restrict_flt(float f, float min, float max) -{ - if(fmax) - return max; - return f; -} - -void draw_air(pixel *vid) -{ - int x, y, i, j; - pixel c; - - if(cmode == 2) - return; - - for(y=0; y 0.0f) - c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); - else - c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); - } - else - c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), - clamp_flt(pv[y][x], 0.0f, 8.0f), - clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); - for(j=0; j=XRES || ny>=YRES) - return 0; - if(x==nx && y==ny) - return 1; - r = pmap[ny][nx]; - if(r && (r>>8)>8].type; - - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) - { - return 1; - } - - if((r&0xFF)==PT_VOID) - { - parts[i].type=PT_NONE; - return 0; - } - if((r&0xFF)==PT_BHOL) - { - parts[i].type=PT_NONE; - if(!legacy_enable) - { - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; - } - return 0; - } - - if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide - { - return 1; - } - - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) - { - return 1; - } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) - { - return 0; - } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) - { - return 0; - } - - if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; - if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) - return 0; - if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) - return 0; - - if(parts[i].type==PT_CNCT && y>8)>= 8; - parts[r].x += x-nx; - parts[r].y += y-ny; - } - - return 1; -} - -void kill_part(int i) -{ - int x, y; - parts[i].type = PT_NONE; - - x = (int)(parts[i].x+0.5f); - y = (int)(parts[i].y+0.5f); - - if(x>=0 && y>=0 && x=XRES || y>=YRES) - return -1; - - if(t==SPC_HEAT||t==SPC_COOL) - { - if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); - } - if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) - { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); - } - return pmap[y][x]>>8; - } - else - { - return -1; - } - } - if(t==SPC_AIR) - { - pv[y/CELL][x/CELL] += 0.03f; - if(y+CELL>8].type = PT_SPRK; - parts[pmap[y][x]>>8].life = 4; - parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; - pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; - return pmap[y][x]>>8; - } - - if(p==-1) - { - if(pmap[y][x]) - return -1; - if(pfree == -1) - return -1; - i = pfree; - pfree = parts[i].life; - } - else - i = p; - - if(t==PT_GLAS) - { - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - } - if(t!=PT_STKM) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = t; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 0; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - } - if(t==PT_ACID) - { - parts[i].life = 75; - } - //Testing - /*if(t==PT_WOOD){ - parts[i].life = 150; - }*/ - //End Testing - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_PLSM) - parts[i].life = rand()%150+50; - if(t==PT_LAVA) - parts[i].life = rand()%120+240; - if(t==PT_NBLE) - parts[i].life = 0; - if(t==PT_NEUT) - { - float r = (rand()%128+128)/127.0f; - float a = (rand()%360)*3.14159f/180.0f; - parts[i].life = rand()%480+480; - parts[i].vx = r*cosf(a); - parts[i].vy = r*sinf(a); - } - if(t==PT_PHOT) - { - float r = (rand()%3-1)*3; - float a = (rand()%3-1)*3; - parts[i].life = 680; - if(a==0.0f&&r==0.0f) - { - parts[i].life = 0; - parts[i].type = PT_NONE; - return -1; - } - else - { - parts[i].vx = a; - parts[i].vy = r; - } - //} else { - // parts[i].life = 0; - // parts[i].type = PT_NONE; - //} - } - - if(t!=PT_STKM) - pmap[y][x] = t|(i<<8); - else - { - if(isplayer==0) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - player[2] = PT_DUST; - player[3] = x-1; //Setting legs positions - player[4] = y+6; - player[5] = x-1; - player[6] = y+6; - - player[7] = x-3; - player[8] = y+12; - player[9] = x-3; - player[10] = y+12; - - player[11] = x+1; - player[12] = y+6; - player[13] = x+1; - player[14] = y+6; - - player[15] = x+3; - player[16] = y+12; - player[17] = x+3; - player[18] = y+12; - - isplayer = 1; - } - } - - return i; -} - -void delete_part(int x, int y) -{ - unsigned i; - - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - i = pmap[y][x]; - if(!i || (i>>8)>=NPART) - return; - - kill_part(i>>8); - pmap[y][x] = 0; // just in case -} - -inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -{ - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - if(a!=255) - { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -int sign(float i) //Signum function -{ - if (i<0) - return -1; - if (i>0) - return 1; - return 0; -} - -void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a) //Draws a line -{ - int dx, dy, i, sx, sy, check, e, x, y; - - dx = abs(x1-x2); - dy = abs(y1-y2); - sx = sign(x2-x1); - sy = sign(y2-y1); - x = x1; - y = y1; - check = 0; - - if (dy>dx) - { - dx = dx+dy; - dy = dx-dy; - dx = dx-dy; - check = 1; - } - - e = (dy<<2)-dx; - for (i=0; i<=dx; i++) - { - vid[x+y*a] =PIXRGB(r, g, b); - if (e>=0) - { - if (check==1) - x = x+sx; - else - y = y+sy; - e = e-(dx<<2); - } - if (check==1) - y = y+sy; - else - x = x+sx; - e = e+(dy<<2); - } -} - -void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -{ - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + 255*PIXR(t)) >> 8; - g = (a*g + 255*PIXG(t)) >> 8; - b = (a*b + 255*PIXB(t)) >> 8; - if(r>255) - r = 255; - if(g>255) - g = 255; - if(b>255) - b = 255; - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); - -int is_wire(int x, int y) -{ - return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; -} -int is_wire_off(int x, int y) -{ - return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; -} - -void set_emap(int x, int y) -{ - int x1, x2; - - if(!is_wire_off(x, y)) - return; - - // go left as far as possible - x1 = x2 = x; - while(x1>0) - { - if(!is_wire_off(x1-1, y)) - break; - x1--; - } - while(x21 && x1==x2 && - is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && - !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) - set_emap(x1, y-2); - else if(y>0) - for(x=x1; x<=x2; x++) - if(is_wire_off(x, y-1)) - { - if(x==x1 || x==x2 || y>=YRES/CELL-1 || - is_wire(x-1, y-1) || is_wire(x+1, y-1) || - is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) - set_emap(x, y-1); - } - - if(y>8) < NPART && (pmr>>8) >= 0) - { - return parts[pmr>>8].type; - } - else - { - return PT_NONE; - } -} -int nearest_part(int ci, int t) -{ - int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); - int ndistance = 0; - int id = -1; - int i = 0; - int cx = (int)parts[ci].x; - int cy = (int)parts[ci].y; - for(i=0; i=XRES || y>=YRES || - ((bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) - { - kill_part(i); - continue; - } - - vx[y/CELL][x/CELL] *= ptypes[t].airloss; - vy[y/CELL][x/CELL] *= ptypes[t].airloss; - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - if(t==PT_GASS||t==PT_NBLE) - { - if(pv[y/CELL][x/CELL]<3.5f) - pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); - if(y+CELL2.5f) - { - parts[i].life = rand()%80+180; - rt = parts[i].type = PT_FIRE; - parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - pv[y/CELL][x/CELL] += 0.25f * CFDS; - t = PT_FIRE; - } - - parts[i].vx *= ptypes[t].loss; - parts[i].vy *= ptypes[t].loss; - - if(t==PT_DFRM && !parts[i].life) - { - if(pv[y/CELL][x/CELL]>1.0f) - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - parts[i].life = rand()%80+300; - } - } - else - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - - if(ptypes[t].diffusion) - { - parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - } - - // interpolator -#ifdef WIN32 - mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#else - mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#endif - if(mv < ISTP) - { - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - } - else - { - dx = parts[i].vx*ISTP/mv; - dy = parts[i].vy*ISTP/mv; - ix = parts[i].x; - iy = parts[i].y; - while(1) - { - mv -= ISTP; - if(mv <= 0.0f) - { - // nothing found - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - break; - } - ix += dx; - iy += dy; - nx = (int)(ix+0.5f); - ny = (int)(iy+0.5f); - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) - { - parts[i].x = ix; - parts[i].y = iy; - break; - } - } - } - - a = nt = 0; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx4.0f) - t = parts[i].type = PT_DSTW; - if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) - t = parts[i].type = PT_OILL; - if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) - t = parts[i].type = PT_GASS; - } - if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) - t = parts[i].type = PT_BRMT; - //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) - // t = parts[i].type = PT_BGLA; - if(t==PT_GLAS) - { - parts[i].pavg[0] = parts[i].pavg[1]; - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) - { - parts[i].type = PT_BGLA; - } - } - if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) - t = parts[i].type = PT_SNOW; - if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) - { - t = PT_NEUT; - create_part(i, x, y, t); - } - - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) - { - nearp = nearest_part(i, PT_ETRD); - if(nearp!=-1) - { - create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[nearp].type = PT_SPRK; - parts[nearp].life = 9; - parts[nearp].ctype = PT_ETRD; - } - } - - if(!legacy_enable) - { - int ctemp = pv[y/CELL][x/CELL]*2; - c_heat = 0.0f; - h_count = 0; - if(ptypes[t].hconduct>(rand()%250)) - { - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) - { - h_count++; - c_heat += parts[r>>8].temp; - } - } - } - } - pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) - { - parts[r>>8].temp = parts[i].temp; - } - } - } - } - if(pt>=pstates[t].btemp&&pstates[t].burn) - { - t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE||t==PT_PLSM) - parts[i].life = rand()%50+120; - } - else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) - { - if(t==PT_LAVA&&parts[i].ctype) - { - parts[i].life = 0; - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) - { - parts[i].ctype = parts[i].type; - t = parts[i].type = PT_ICEI; - } - else - { - parts[i].life = 0; - t = parts[i].type = pstates[t].solid; - } - } - else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) - { - if(pstates[t].liquid==PT_LAVA) - { - parts[i].life = rand()%120+240; - parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; - parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; - t = parts[i].type = pstates[t].liquid; - } - else if(t==PT_ICEI&&parts[i].ctype) - { - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else - { - t = parts[i].type = pstates[t].liquid; - } - } - else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) - { - t = parts[i].type = pstates[t].liquid; - } - else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) - { - if(t==PT_SLTW&&1>rand()%6) - { - t = parts[i].type = PT_SALT; - } - else - { - t = parts[i].type = pstates[t].gas; - pv[y/CELL][x/CELL] += 0.50f; - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - } - } - if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) - { - float atemp = parts[i].temp + (-MIN_TEMP); - pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; - } - if(t==PT_LAVA) - { - parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - } - pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - } - } - if(t==PT_CSCN&&parts[i].temp>24.0f) - { - pt = parts[i].temp -= 2.5f; - } - if(t==PT_HSCN&&parts[i].temp>24.0f) - { - pt = parts[i].temp -= 2.5f; - } - - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) - { - nx = x % CELL; - if(nx == 0) - nx = x/CELL - 1; - else if(nx == CELL-1) - nx = x/CELL + 1; - else - nx = x/CELL; - ny = y % CELL; - if(ny == 0) - ny = y/CELL - 1; - else if(ny == CELL-1) - ny = y/CELL + 1; - else - ny = y/CELL; - if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ) - { - t = parts[i].type = PT_NONE; - parts[r>>8].ctype = parts[r>>8].type; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - } - else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) - { - pv[y/CELL][x/CELL] += 100.0f; - if(legacy_enable&&1>(rand()%200)) - { - parts[i].life = rand()%50+120; - t = parts[i].type = PT_FIRE; - } - else - { - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_ICEI || t==PT_SNOW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if(legacy_enable) - { - if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_ICEI; - parts[r>>8].type = PT_ICEI; - } - if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) - t = parts[i].type = PT_WATR; - } - } - } - else if(t==PT_HSCN||t==PT_CSCN) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) - { - parts[i].temp = 200.0f; - } - } - } - //PLANT - else if(t==PT_PLNT) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR && 1>(rand()%250)) - { - t = parts[i].type = PT_PLNT; - parts[r>>8].type = PT_PLNT; - } - else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_WATR||t==PT_DSTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%250)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_WATR; - } - if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_SLTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) - { - parts[r>>8].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_WTRV) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - parts[r>>8].type = PT_WATR; - } - - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - if(1>(rand()%1000)) - parts[r>>8].type = PT_WATR; - } - } - } - else if(t==PT_ACID) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)!=PT_ACID) - { - if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) - { - t = parts[i].type = PT_FIRE; - parts[i].life = 4; - parts[r>>8].type = PT_FIRE; - parts[r>>8].life = 4; - } - else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) - { - parts[i].life--; - parts[r>>8].type = PT_NONE; - } - else if (parts[i].life==50) - { - parts[i].life = 0; - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_NEUT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) - { - if(33>rand()%100) - { - create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); - } - else - { - create_part(r>>8, x+nx, y+ny, PT_NEUT); - parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; - parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; - } - pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough - fe ++; - } - if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) - parts[r>>8].type = PT_DUST; - if((r&0xFF)==PT_WATR && 15>(rand()%100)) - parts[r>>8].type = PT_DSTW; - if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) - parts[r>>8].type = PT_DFRM; - if((r&0xFF)==PT_NITR && 15>(rand()%1000)) - parts[r>>8].type = PT_OILL; - if((r&0xFF)==PT_OILL && 5>(rand()%1000)) - parts[r>>8].type = PT_GASS; - if((r&0xFF)==PT_PLNT && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - } - } - else if(t==PT_PHOT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=0; nx<1; nx++) - for(ny=0; ny<1; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - } - } - else if(t==PT_LCRY) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK) - { - if(parts[r>>8].ctype==PT_PSCN) - { - parts[i].life = 10; - } - else if(parts[r>>8].ctype==PT_NSCN) - { - parts[i].life = 9; - } - } - if(rt==PT_LCRY) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - else if(t==PT_BTRY) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(parts_avg(i,r>>8) != PT_INSL) - { - if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) - { - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - parts[r>>8].type = PT_SPRK; - } - } - } - } - if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)) || t ==PT_SWCH) - { - if(t==PT_SWCH) - if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) - { - parts[i].life--; - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) - continue; - rt = parts[r>>8].type; - if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && - ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) - { - parts[r>>8].type = PT_FIRE; - parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - parts[r>>8].life = rand()%80+180; - if(ptypes[rt].explosive) - pv[y/CELL][x/CELL] += 0.25f * CFDS; - continue; - } - lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; - if(lpv < 1) lpv = 1; - if(legacy_enable) - { - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && - ptypes[rt].meltable*lpv>(rand()%1000)) - { - if(t!=PT_LAVA || parts[i].life>0) - { - parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; - parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; - parts[r>>8].type = PT_LAVA; - parts[r>>8].life = rand()%120+240; - } - else - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) - { - parts[r>>8].type = PT_WATR; - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = PT_METL; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) - { - kill_part(r>>8); - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE; - goto killed; - } - } - } - pavg = parts_avg(i, r>>8); - if(t==PT_SWCH&&pavg!= PT_INSL) - { - if(parts[r>>8].type == PT_SWCH) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - if(rt==PT_SWCH && t==PT_SPRK) - { - pavg = parts_avg(r>>8, i); - if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) - parts[r>>8].life = 10; - if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) - parts[r>>8].life = 9; - if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].ctype = PT_SWCH; - parts[r>>8].life = 4; - } - } - pavg = parts_avg(i, r>>8); - if(pavg != PT_INSL) - { - if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) - parts[r>>8].temp = parts[r>>8].temp+10.0f; - } - } - if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 6; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 5; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) - { - if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) - { - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - - if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) - { - parts[i].life = rand()%150+50; - parts[i].type = PT_PLSM; - parts[i].ctype = PT_NBLE; - parts[i].temp = 3500; - pv[y/CELL][x/CELL] += 1; - } - if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) - { - parts[i].type = PT_SWCH; - parts[i].life = 11; - } - } - } -killed: - if(parts[i].type == PT_NONE) - continue; - } - - if(t==PT_STKM) - { - //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) - parts[i].temp += 1; - - //Death - if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... - { - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - //Verlet integration - pp = 2*player[3]-player[5]; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+1; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+1; - player[18] = player[16]; - player[16] = pp; - - //Go left - if (((int)(player[0])&0x01) == 0x01) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] += 3; - player[10] += 2; - player[5] += 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 3; - player[18] += 2; - player[13] +=2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[9] += 1; - player[10] += 1; - player[5] += 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 1; - player[18] += 1; - player[13] +=1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 3; - player[10] += 2; - player[5] -= 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 3; - player[18] += 2; - player[13] -= 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 1; - player[10] += 1; - player[5] -= 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 1; - player[18] += 1; - player[13] -= 1; - } - - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)) - { - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - create_part(-1, nx, ny, player[2]); - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 ) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - } - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[10] += 1; - player[18] += 1; - } - - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; - player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; - player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; - player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; - player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; - parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; - player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; - parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; - player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) - player[15] -= nx; - - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= 10+ny; - parts[i].vy = -10; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[7] += 0.2; - player[15] -= 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[3] += 0.2; - player[11] -= 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[16] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[8] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } - - if(t==PT_CLNE) - { - if(!parts[i].ctype) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx=XRES-CELL || - ny=YRES-CELL) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - continue; - } - - rt = parts[i].flags & FLAG_STAGNANT; - parts[i].flags &= ~FLAG_STAGNANT; - if(!try_move(i, x, y, nx, ny)) - { - parts[i].x = lx; - parts[i].y = ly; - if(ptypes[t].falldown) - { - if(nx!=x && try_move(i, x, y, nx, y)) - { - parts[i].x = ix; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x, ny)) - { - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else - { - r = (rand()%2)*2-1; - if(ny!=y && try_move(i, x, y, x+r, ny)) - { - parts[i].x += r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x-r, ny)) - { - parts[i].x -= r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y+r)) - { - parts[i].x = ix; - parts[i].y += r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y-r)) - { - parts[i].x = ix; - parts[i].y -= r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) - { - s = 0; - if(!rt || nt) - rt = 50; - else - rt = 10; - for(j=x+r; j>=0 && j>=x-rt && j0) - r = 1; - else - r = -1; - if(s) - for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; - if(nxy+ISTP) ny=y+ISTP; - if(ny(rand()%1000)) - { - kill_part(i); - continue; - } - else if(try_move(i, x, y, 2*x-nx, ny)) - { - parts[i].x = (float)(2*x-nx); - parts[i].y = (float)iy; - parts[i].vx *= ptypes[t].collision; - } - else if(try_move(i, x, y, nx, 2*y-ny)) - { - parts[i].x = (float)ix; - parts[i].y = (float)(2*y-ny); - parts[i].vy *= ptypes[t].collision; - } - else - { - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - } - } - -justdraw: - - nx = (int)(parts[i].x+0.5f); - ny = (int)(parts[i].y+0.5f); - - if(nx=XRES-CELL || - ny=YRES-CELL) - { - kill_part(i); - continue; - } - if(cmode!=CM_HEAT) - { - if(t==PT_STKM) //Just draw head here - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; - vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; - vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; - vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; - } - draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); - draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); - draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); - draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); - - isplayer = 1; //It's a secret. Tssss... - } - - if(t==PT_ACID) - { - if(parts[i].life>255) parts[i].life = 255; - if(parts[i].life<47) parts[i].life = 48; - s = (255/((parts[i].life-46)*28)); - if(s==0) s = 1; - cr = PIXR(ptypes[t].pcolors)/s; - cg = PIXG(ptypes[t].pcolors)/s; - cb = PIXB(ptypes[t].pcolors)/s; - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); - } - } - - if(cmode==4) - { - blendpixel(vid, nx+1, ny, cr, cg, cb, 223); - blendpixel(vid, nx-1, ny, cr, cg, cb, 223); - blendpixel(vid, nx, ny+1, cr, cg, cb, 223); - blendpixel(vid, nx, ny-1, cr, cg, cb, 223); - - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); - } - } - else if(t==PT_OILL) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,64,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,64,16,40); - } - } - } - else if(t==PT_NEUT) - { - if(cmode == 3||cmode==4) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 8; - cb = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = 0x20; - cg = 0xE0; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_SLTW) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,80,240,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,80,240,50); - } - } - } - else if(t==PT_PHOT) - { - if(cmode == 3||cmode==4) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 12; - cb = 12; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_SWCH && parts[i].life == 10) - { - x = nx; - y = ny; - blendpixel(vid,x,y,17,217,24,255); - } - else if(t==PT_LNTG) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,128,160,223,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,128,160,223,50); - } - } - } - else if(t==PT_SMKE) - { - if(cmode == 3||cmode==4) - { - x = nx/CELL; - y = ny/CELL; - cg = 10; - cb = 10; - cr = 10; - cg += fire_g[y][x]; - if(cg > 50) cg = 50; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 50) cb = 50; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 50) cr = 50; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny,100,100,100,30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,100,100,100,10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,100,100,100,20); - } - } - } - } - else if(t==PT_WATR) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - - } - else if(t==PT_DSTW) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - } - else if(t==PT_NITR) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,224,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,224,16,50); - } - } - - } - else if(t==PT_LRBD) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,170,170,170,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,170,170,170,50); - } - } - - } - - else if(t==PT_NBLE) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,235,73,23,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,235,73,23,20); - } - } - - } - else if(t==PT_GASS) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,255,32,255); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,224,255,32,20); - } - } - - } - else if(t==PT_WTRV) - { - if(cmode == 3||cmode==4) - { - x = nx/CELL; - y = ny/CELL; - cg = PIXG(ptypes[t].pcolors)/3; - cb = PIXB(ptypes[t].pcolors)/3; - cr = PIXR(ptypes[t].pcolors)/3; - cg += fire_g[y][x]; - if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); - } - } - } - } - else if(t==PT_THDR) - { - if(cmode == 3||cmode==4) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 16; - cb = 20; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xA0; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LCRY) - { - if(cmode == 3||cmode==4) - { - //cr = R/8; - //cg = G/8; - //cb = B/8; - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); - //x = nx/CELL; - //y = ny/CELL; - //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } - else - { - cr = 0x50+(parts[i].life*10); - cg = 0x50+(parts[i].life*10); - cb = 0x50+(parts[i].life*10); - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_URAN) { - cr=0x70; - cg=0x70; - cb=0x20; - blendpixel(vid, nx, ny, cr, cr, cr, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny, cr, cg, cb, 32); - blendpixel(vid, nx, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - } else if(t==PT_PLUT) { - cr=0x40; - cg=0x70; - cb=0x20; - blendpixel(vid, nx, ny, cr, cr, cr, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny, cr, cg, cb, 32); - blendpixel(vid, nx, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+1, ny+1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-1, ny-1, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+2, ny+2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-2, ny-2, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+3, ny+3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-3, ny-3, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-1, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-1, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-2, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny+3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+2, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-4, ny-3, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny+4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx-3, ny-4, cr+10, cg+10, cb+10, 32); - blendpixel(vid, nx+4, ny-4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx+4, ny+4, cr+100, cg+100, cb+100, 32); - blendpixel(vid, nx-4, ny-4, cr+100, cg+100, cb+100, 32); - } else if(t==PT_PLSM) - { - float ttemp = parts[i].life; - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = plasma_data[caddress]; - uint8 G = plasma_data[caddress+1]; - uint8 B = plasma_data[caddress+2]; - if(cmode == 3||cmode==4) - { - cr = R/8; - cg = G/8; - cb = B/8; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_FIRE && parts[i].life) - { - if(cmode == 3||cmode==4) - { - cr = parts[i].life / 4; - cg = parts[i].life / 16; - cb = parts[i].life / 32; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = parts[i].life * 8; - cg = parts[i].life * 2; - cb = parts[i].life; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LAVA && parts[i].life) - { - cr = parts[i].life * 2 + 0xE0; - cg = parts[i].life * 1 + 0x50; - cb = parts[i].life/2 + 0x10; - if(cr>255) cr = 255; - if(cg>192) cg = 192; - if(cb>128) cb = 128; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 64); - blendpixel(vid, nx-1, ny, cr, cg, cb, 64); - blendpixel(vid, nx, ny+1, cr, cg, cb, 64); - blendpixel(vid, nx, ny-1, cr, cg, cb, 64); - if(cmode == 3||cmode==4) - { - cr /= 32; - cg /= 32; - cb /= 32; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else if(t==PT_LAVA || t==PT_SPRK) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - if(cmode == 3 || cmode==4) - { - if(t == PT_LAVA) - { - cr = 3; - cg = i%2; - cb = 0; - } - else - { - cr = 8; - cg = 12; - cb = 16; - } - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - } - else - { - float ttemp = parts[i].temp+(-MIN_TEMP); - int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); - uint8 R = color_data[caddress]; - uint8 G = color_data[caddress+1]; - uint8 B = color_data[caddress+2]; - - if(t==PT_STKM) //Stick man should be visible in heat mode - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); - vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); - vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); - vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); - } - draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); - draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); - draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); - draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); - } - else - { - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); - //blendpixel(vid, nx+1, ny, R, G, B, 255); - } - } - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) - { - uint8 R = PIXR(ptypes[t].pcolors); - uint8 G = PIXG(ptypes[t].pcolors); - uint8 B = PIXB(ptypes[t].pcolors); - - //if(vid[(ny-1)*YRES+(nx-1)]!=0){ - // blendpixel(vid, nx, ny-1, R, G, B, 46); - //} - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); - } - - } - -} - -void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) -{ - blendpixel(vid, x+1, y, cr, cg, cb, 112); - blendpixel(vid, x-1, y, cr, cg, cb, 112); - blendpixel(vid, x, y+1, cr, cg, cb, 112); - blendpixel(vid, x, y-1, cr, cg, cb, 112); - - blendpixel(vid, x+1, y-1, cr, cg, cb, 64); - blendpixel(vid, x-1, y-1, cr, cg, cb, 64); - blendpixel(vid, x+1, y+1, cr, cg, cb, 64); - blendpixel(vid, x-1, y+1, cr, cg, cb, 64); -} - -void update_particles_i_th(void *arg) -{ - upstruc *newup = (upstruc*)arg; - update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); - return; -} - -void update_particles(pixel *vid) -{ - int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; - float lx, ly; -#ifdef MT - int pt = 0, pc = 0; - pthread_t *InterThreads; -#endif - - isplayer = 0; //Needed for player spawning - memset(pmap, 0, sizeof(pmap)); - r = rand()%2; - for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==13) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && !sys_pause) - emap[y][x] --; - } - } - } - else - { - for(y=0; y>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==9) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && !sys_pause) - emap[y][x] --; - } - } - } - -#ifdef MT - if(numCores > 1) - { - InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); - for(pc = 0; pc=XRES || ny<0 || ny>=YRES) - break; - addpixel(vid, nx, ny, 255, 255, 255, 64); - i = nx/CELL; - j = ny/CELL; - lx += vx[j][i]*0.125f; - ly += vy[j][i]*0.125f; - if(bmap[j][i]==5 && i!=x && j!=y) - break; - } - drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); - } - -} - -void update_particles_th(void *arg) -{ - update_particles((pixel*)arg); - return; -} - -/*********************************************************** - * SDL OUTPUT * - ***********************************************************/ - -int sdl_scale = 1; -SDL_Surface *sdl_scrn; -SDLMod sdl_mod; -int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; - -#include "icon.h" -void sdl_seticon(void) -{ -#ifdef WIN32 - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else -#ifdef MACOSX - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else - SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#endif -#endif -} - -void sdl_open(void) -{ - if(SDL_Init(SDL_INIT_VIDEO)<0) - { - fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); - exit(1); - } - atexit(SDL_Quit); -#ifdef PIX16 - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); -#else - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); -#endif - if(!sdl_scrn) - { - fprintf(stderr, "Creating window: %s\n", SDL_GetError()); - exit(1); - } - SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); - sdl_seticon(); - SDL_EnableUNICODE(1); - //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); -} - -void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0; jpitch/PIXELSIZE; - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} - -void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - int i,k; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0; jpitch/PIXELSIZE; - } - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} -void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) -{ - if(sdl_scale == 2) - sdl_blit_2(x, y, w, h, src, pitch); - else - sdl_blit_1(x, y, w, h, src, pitch); -} - -int frame_idx=0; -void dump_frame(pixel *src, int w, int h, int pitch) -{ - char frame_name[32]; - int j,i; - unsigned char c[3]; - FILE *f; - sprintf(frame_name,"frame%04d.ppm",frame_idx); - f=fopen(frame_name,"wb"); - fprintf(f,"P6\n%d %d\n255\n",w,h); - for(j=0; j=0 && x=0 && yPT_NUM) - return 2; - if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) - return 3; - i = XRES*YRES; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) - return 1; - size = i; - } - else - d = c; - - if(size < XRES*YRES) - { - if(bzip2) - free(d); - return 1; - } - - sy = 0; - for(y=0; y+scl<=YRES; y+=scl) - { - sx = 0; - for(x=0; x+scl<=XRES; x+=scl) - { - a = 0; - r = g = b = 0; - for(j=0; j=PT_NUM) - goto corrupt; - r += PIXR(ptypes[t].pcolors); - g += PIXG(ptypes[t].pcolors); - b += PIXB(ptypes[t].pcolors); - a ++; - } - } - if(a) - { - a = 256/a; - r = (r*a)>>8; - g = (g*a)>>8; - b = (b*a)>>8; - } - - drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); - sx++; - } - sy++; - } - - if(bzip2) - free(d); - return 0; - -corrupt: - if(bzip2) - free(d); - return 1; -} - -static char *mystrdup(char *s) -{ - char *x; - if(s) - { - x = malloc(strlen(s)+1); - strcpy(x, s); - return x; - } - return s; -} - -void *build_save(int *size, int x0, int y0, int w, int h) -{ - unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; - int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); - int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - // save the required air state - for(y=by0; y255) i=255; - d[p++] = i; - } - for(y=by0; y255) i=255; - d[p++] = i; - } - - // save the particle map - for(i=0; i=x0 && x=y0 && y255) x=255; - if(y<0) y=0; - if(y>255) y=255; - d[p++] = x; - d[p++] = y; - } - } - for(j=0; j255) tttemp=255; - d[p++] = tttemp; - } - } - for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; - d[p++] = (signs[i].y-y0); - d[p++] = (signs[i].y-y0)>>8; - d[p++] = signs[i].ju; - x = strlen(signs[i].text); - d[p++] = x; - memcpy(d+p, signs[i].text, x); - p+=x; - } - - i = (p*101+99)/100 + 612; - c = malloc(i); - c[0] = 0x66; - c[1] = 0x75; - c[2] = 0x43; - c[3] = legacy_enable; - c[4] = SAVE_VERSION; - c[5] = CELL; - c[6] = bw; - c[7] = bh; - c[8] = p; - c[9] = p >> 8; - c[10] = p >> 16; - c[11] = p >> 24; - - i -= 12; - - if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) - { - free(d); - free(c); - return NULL; - } - free(d); - - *size = i+12; - return c; -} - -int parse_save(void *save, int size, int replace, int x0, int y0) -{ - unsigned char *d,*c=save; - int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; - int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; - int fp[NPART], nf=0; - - if(size<16) - return 1; - if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) - return 1; - if(c[4]>SAVE_VERSION) - return 2; - ver = c[4]; - - if(ver<34) - { - legacy_enable = 1; - } - else - { - if(c[3]==1||c[3]==0) - legacy_enable = c[3]; - else - legacy_beta = 1; - } - - bw = c[6]; - bh = c[7]; - if(bx0+bw > XRES/CELL) - bx0 = XRES/CELL - bw; - if(by0+bh > YRES/CELL) - by0 = YRES/CELL - bh; - if(bx0 < 0) - bx0 = 0; - if(by0 < 0) - by0 = 0; - - if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) - return 3; - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - return 1; - size = i; - - if(size < bw*bh) - return 1; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - if(replace) - { - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(signs, 0, sizeof(signs)); - memset(parts, 0, sizeof(particle)*NPART); - memset(pmap, 0, sizeof(pmap)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(pv, 0, sizeof(pv)); - } - - // make a catalog of free parts - memset(pmap, 0, sizeof(pmap)); - for(i=0; i= size) - goto corrupt; - fvx[y][x] = (d[p++]-127.0f)/64.0f; - } - for(y=by0; y= size) - goto corrupt; - fvy[y][x] = (d[p++]-127.0f)/64.0f; - } - - // load the particle map - i = 0; - pty = p; - for(y=y0; y= size) - goto corrupt; - j=d[p++]; - if(j >= PT_NUM) - goto corrupt; - if(j && !(isplayer == 1 && j==PT_STKM)) - { - if(pmap[y][x]) - { - k = pmap[y][x]>>8; - parts[k].type = j; - parts[k].x = (float)x; - parts[k].y = (float)y; - m[(x-x0)+(y-y0)*w] = k+1; - } - else if(i < nf) - { - parts[fp[i]].type = j; - parts[fp[i]].x = (float)x; - parts[fp[i]].y = (float)y; - m[(x-x0)+(y-y0)*w] = fp[i]+1; - i++; - } - else - m[(x-x0)+(y-y0)*w] = NPART+1; - } - } - - // load particle properties - for(j=0; j= size) - goto corrupt; - if(i < NPART) - { - parts[i].vx = (d[p++]-127.0f)/16.0f; - parts[i].vy = (d[p++]-127.0f)/16.0f; - if(parts[i].type == PT_STKM) - { - player[2] = PT_DUST; - - player[3] = parts[i].x-1; //Setting legs positions - player[4] = parts[i].y+6; - player[5] = parts[i].x-1; - player[6] = parts[i].y+6; - - player[7] = parts[i].x-3; - player[8] = parts[i].y+12; - player[9] = parts[i].x-3; - player[10] = parts[i].y+12; - - player[11] = parts[i].x+1; - player[12] = parts[i].y+6; - player[13] = parts[i].x+1; - player[14] = parts[i].y+6; - - player[15] = parts[i].x+3; - player[16] = parts[i].y+12; - player[17] = parts[i].x+3; - player[18] = parts[i].y+12; - - } - } - else - p += 2; - } - } - for(j=0; j= size) - goto corrupt; - if(i <= NPART) - parts[i-1].life = d[p++]*4; - else - p++; - } - } - for(j=0; j=34&&legacy_beta==0) - { - if(p >= size) - { - goto corrupt; - } - if(i <= NPART) - { - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; - } - else - { - p++; - } - } - else - { - parts[i-1].temp = ptypes[parts[i-1].type].heat; - } - } - } - for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) - { - if(p >= size) - goto corrupt; - if(i <= NPART) - parts[i-1].ctype = d[p++]; - else - p++; - } - } - - if(p >= size) - goto version1; - j = d[p++]; - for(i=0; i size) - goto corrupt; - for(k=0; k size) - goto corrupt; - if(kSAVE_VERSION) - return NULL; - - bw = c[6]; - bh = c[7]; - w = bw*CELL; - h = bh*CELL; - - if(c[5]!=CELL) - return NULL; - - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return NULL; - fb = calloc(w*h, PIXELSIZE); - if(!fb) - { - free(d); - return NULL; - } - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - goto corrupt; - size = i; - - if(size < bw*bh) - goto corrupt; - - k = 0; - for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) - goto corrupt; - - for(y=0; y= size) - goto corrupt; - j=d[p++]; - if(j0) - { - if(j==PT_STKM) //Stickman should be drawed another way - { - //Stickman drawing - for(k=-2; k<=1; k++) - { - fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); - fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); - fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); - fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); - } - draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); - draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); - draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); - draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); - } - else - fb[y*w+x] = ptypes[j].pcolors; - } - } - - free(d); - *width = w; - *height = h; - return fb; - -corrupt: - free(d); - free(fb); - return NULL; -} - -/* NO, I DON'T THINK SO - #include "fbi.h" - - pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) - { - unsigned char *tmp; - pixel *res; - int i; - - tmp = malloc(width*height*3); - if(!tmp) - return NULL; - res = malloc(width*height*PIXELSIZE); - if(!res) { - free(tmp); - return NULL; - } - - i = width*height*3; - if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { - free(res); - free(tmp); - return NULL; - } - - for(i=0; i1) - { - r = (r+c/2)/c; - g = (g+c/2)/c; - b = (b+c/2)/c; - } - q[y*w+x] = PIXRGB(r, g, b); - } - *qw = w; - *qh = h; - return q; -} - -#define GRID_X 5 -#define GRID_Y 4 -#define GRID_P 3 -#define GRID_S 6 -#define GRID_Z 3 - -void stamp_gen_thumb(int i) -{ - char fn[64]; - void *data; - int size, factor_x, factor_y; - pixel *tmp; - - if(stamps[i].thumb) - { - free(stamps[i].thumb); - stamps[i].thumb = NULL; - } - - sprintf(fn, "stamps" PATH_SEP "%s.stm", stamps[i].name); - data = file_load(fn, &size); - - if(data) - { - stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); - if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) - { - factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); - factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); - if(factor_y > factor_x) - factor_x = factor_y; - tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); - free(stamps[i].thumb); - stamps[i].thumb = tmp; - } - } - - free(data); -} - -int clipboard_ready = 0; -void *clipboard_data = 0; -int clipboard_length = 0; - -void stamp_save(int x, int y, int w, int h) -{ - FILE *f; - int n; - char fn[64], sn[16]; - void *s=build_save(&n, x, y, w, h); - -#ifdef WIN32 - _mkdir("stamps"); -#else - mkdir("stamps", 0755); -#endif - - stamp_gen_name(sn); - sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); - - f = fopen(fn, "wb"); - if(!f) - return; - fwrite(s, n, 1, f); - fclose(f); - - free(s); - - if(stamps[STAMP_MAX-1].thumb) - free(stamps[STAMP_MAX-1].thumb); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); - memset(stamps, 0, sizeof(struct stamp_info)); - if(stamp_count0) - { - memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); - memcpy(stamps, &tmp, sizeof(struct stamp_info)); - - stamp_update(); - } - - return data; -} - -void stamp_init(void) -{ - int i; - FILE *f; - - memset(stamps, 0, sizeof(stamps)); - - f=fopen("stamps" PATH_SEP "stamps.def", "rb"); - if(!f) - return; - for(i=0; i=XRES+BARSIZE || y>=YRES+MENUSIZE) - return; - if(a!=255) - { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) -{ - int i, j, w, bn = 0, ba = 0; - char *rp = font_data + font_ptrs[c]; - w = *(rp++); - for(j=0; j>= 2; - bn -= 2; - } - return x + w; -} - -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) -{ - int sx = x; - for(; *s; s++) - { - if(*s == '\n') - { - x = sx; - y += FONT_H+2; - } - else if(*s == '\b') - { - switch(s[1]) - { - case 'w': - r = g = b = 255; - break; - case 'g': - r = g = b = 192; - break; - case 'o': - r = 255; - g = 216; - b = 32; - break; - case 'r': - r = 255; - g = b = 0; - break; - case 'b': - r = g = 0; - b = 255; - break; - } - s++; - } - else - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - return x; -} - -void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) -{ - int i; - for(i=0; i<=w; i++) - { - drawpixel(vid, x+i, y, r, g, b, a); - drawpixel(vid, x+i, y+h, r, g, b, a); - } - for(i=1; i=w && x+textwidth(s)>=w+5) - break; - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - if(*s) - for(i=0; i<3; i++) - x = drawchar(vid, x, y, '.', r, g, b, a); - return x; -} - -int textnwidth(char *s, int n) -{ - int x = 0; - for(; *s; s++) - { - if(!n) - break; - x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - n--; - } - return x-1; -} -int textwidthx(char *s, int w) -{ - int x=0,n=0,cw; - for(; *s; s++) - { - cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - if(x+(cw/2) >= w) - break; - x += cw; - n++; - } - return n; -} - -/*********************************************************** - * MAIN PROGRAM * - ***********************************************************/ - -void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) -{ - int x, y, i, j, c; - int bo = b; - if(iswall==1) - { - b = b-100; - x = (2+32*((b-22)/1)); - y = YRES+2+40; - switch(b) - { - case WL_WALLELEC: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - else - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) - { - for(i=1; i<6+j; i++) - { - if(!(i&j&1)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) - { - if(i&j&1) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) - { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<13; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) - { - for(i=14; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - default: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } - else - { - x = 2+32*(b/2); - y = YRES+2+20*(b%2); - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - if(bo==sl || bo==sr) - { - c = 0; - if(bo==sl) - c |= PIXPACK(0xFF0000); - if(bo==sr) - c |= PIXPACK(0x0000FF); - for(i=0; i<30; i++) - { - vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; - } - for(j=0; j<18; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; - } - } -} - -int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) -{ - int i, j, c; - if(b>=121) - { - b = b-100; - //x = (2+32*((b-22)/1)); - //y = YRES+2+40; - switch(b) - { - case WL_WALLELEC: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - else - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) - { - for(i=1; i<6+j; i++) - { - if(!(i&j&1)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) - { - if(i&j&1) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) - { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<13; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) - { - for(i=14; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - case 40: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - default: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } - else - { - //x = 2+32*(b/2); - //y = YRES+2+20*(b%2); - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - return 26; -} - -void draw_menu(pixel *vid_buf, int i, int hover) -{ - - //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); -#ifdef MENUV3 - drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - if(hover==i) - { - fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); - } -#else - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); -#endif -} - -void menu_ui(pixel *vid_buf, int i, int *sl, int *sr) -{ - int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; - pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); - fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); - memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - rows = ceil((float)msections[i].itemcount/16.0f); - height = (ceil((float)msections[i].itemcount/16.0f)*18); - width = restrict_flt(msections[i].itemcount*31, 0, 16*31); - //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); - h = -1; - x = XRES-BARSIZE-26; - y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; - sy = y; - //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); - fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); - fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); - drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); - if(i==SC_WALL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM) - { - if(x-26<=60) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=60) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=20) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - if(b==1&&h!=-1) - { - *sl = h; - } - if(b==4&&h!=-1) - { - *sr = h; - } -} - -int create_parts(int x, int y, int r, int c) -{ - int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; - - if(c == 125) - { - i = x / CELL; - j = y / CELL; - for(v=-1; v<2; v++) - for(u=-1; u<2; u++) - if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) - { - if(cp) - create_parts(y, x, r, c); - else - create_parts(x, y, r, c); - } - e -= 1.0f; - } - } -} - -void create_box(int x1, int y1, int x2, int y2, int c) -{ - int i, j; - if(x1>x2) - { - i = x2; - x2 = x1; - x1 = i; - } - if(y1>y2) - { - j = y2; - y2 = y1; - y1 = j; - } - for(j=y1; j<=y2; j++) - for(i=x1; i<=x2; i++) - create_parts(i, j, 1, c); -} - -int flood_parts(int x, int y, int c, int cm, int bm) -{ - int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) - { - c = c-100; - } - if(cm==-1) - { - if(c==0) - { - cm = pmap[y][x]&0xFF; - if(!cm) - return 0; - } - else - cm = 0; - } - if(bm==-1) - { - if(c==30) - { - bm = bmap[y/CELL][x/CELL]; - if(!bm) - return 0; - if(bm==1) - cm = 0xFF; - } - else - bm = 0; - } - - if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) - return 1; - - // go left as far as possible - x1 = x2 = x; - while(x1>=CELL) - { - if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) - break; - x1--; - } - while(x2=CELL+dy) - for(x=x1; x<=x2; x++) - if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) - if(!flood_parts(x, y-dy, co, cm, bm)) - return 0; - if(y=XRES || y>=YRES) - return; - c = vid[y*(XRES+BARSIZE)+x]; - c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); - if(c<512) - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); - else - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); -} - -void xor_line(int x1, int y1, int x2, int y2, pixel *vid) -{ - int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - e -= 1.0f; - } - } -} - -void draw_svf_ui(pixel *vid_buf) -{ - int c; - - drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); - drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - c = svf_open ? 255 : 128; - drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); - drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); - - c = svf_login ? 255 : 128; - drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); - if(svf_open) - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); - else - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); - drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); - if(svf_open && svf_own) - drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); - - c = (svf_login && svf_open) ? 255 : 128; - - drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - - if(svf_myvote==1 && (svf_login && svf_open)) - { - fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); - } - else if(svf_myvote==-1 && (svf_login && svf_open)) - { - fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); - } - - drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); - drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); - - drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); - if(svf_tags[0]) - drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); - else - drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); - - drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); - - drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); - drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); - if(svf_login) - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); - else - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); - drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); - - if(sys_pause) - { - fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); - drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - if(!legacy_enable) - { - fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - switch(cmode) - { - case 0: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); - break; - case 1: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); - break; - case 2: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); - break; - case 3: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); - break; - case 4: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); - break; - case 5: - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - break; - } - drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - - if(svf_admin) - { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); - } - else if(svf_mod) - { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - }//else if(amd) - // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? -} - -typedef struct ui_edit -{ - int x, y, w, nx; - char str[256],*def; - int focus, cursor, hide; -} ui_edit; -void ui_edit_draw(pixel *vid_buf, ui_edit *ed) -{ - int cx, i; - char echo[256], *str; - - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(ed->str[0]) - { - drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); - drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); - } - else if(!ed->focus) - drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); - if(ed->focus) - { - cx = textnwidth(str, ed->cursor); - for(i=-3; i<9; i++) - drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); - } -} -char *shift_0="`1234567890-=[]\\;',./"; -char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; -void ui_edit_process(int mx, int my, int mb, ui_edit *ed) -{ - char ch, ts[2], echo[256], *str; - int l, i; -#ifdef RAWINPUT - char *p; -#endif - - if(mb) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = 0; - ed->str[0] = 0; - } - else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = textwidthx(str, mx-ed->x); - } - else - ed->focus = 0; - } - if(ed->focus && sdl_key) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - l = strlen(ed->str); - switch(sdl_key) - { - case SDLK_HOME: - ed->cursor = 0; - break; - case SDLK_END: - ed->cursor = l; - break; - case SDLK_LEFT: - if(ed->cursor > 0) - ed->cursor --; - break; - case SDLK_RIGHT: - if(ed->cursor < l) - ed->cursor ++; - break; - case SDLK_DELETE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - ed->str[ed->cursor] = 0; - else if(ed->cursor < l) - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - break; - case SDLK_BACKSPACE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - { - if(ed->cursor > 0) - memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); - ed->cursor = 0; - } - else if(ed->cursor > 0) - { - ed->cursor--; - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - } - break; - default: -#ifdef RAWINPUT - if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) - { - ch = sdl_key; - if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) - { - if(ch>='a' && ch<='z') - ch &= ~0x20; - p = strchr(shift_0, ch); - if(p) - ch = shift_1[p-shift_0]; - } - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#else - if(sdl_ascii>=' ' && sdl_ascii<127) - { - ch = sdl_ascii; - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#endif - break; - } - } -} -typedef struct ui_checkbox -{ - int x, y; - int focus, checked; -} ui_checkbox; -void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) -{ - int w = 12; - if(ed->checked) - { - drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); - } - if(ed->focus) - { - drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); - } - else - { - drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); - } -} -void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) -{ - int w = 12; - - if(mb && !mbq) - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->checked = (ed->checked)?0:1; - } - } - else - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->focus = 1; - } - else - { - ed->focus = 0; - } - } -} - -void error_ui(pixel *vid_buf, int err, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - char *msg; - - msg = malloc(strlen(txt)+16); - if(err) - sprintf(msg, "%03d %s", err, txt); - else - sprintf(msg, "%s", txt); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - if(err) - drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); - else - drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - free(msg); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_ui(pixel *vid_buf, char *top, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); - drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_box(pixel *vid_buf, char *msg) -{ - int w = textwidth(msg)+16; - int x0=(XRES-w)/2,y0=(YRES-24)/2; - - clearrect(vid_buf, x0-2, y0-2, w+4, 28); - drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); -} - -int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - int ret = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); - drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); - drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); - drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) - { - ret = 1; - break; - } - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - { - ret = 1; - break; - } - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - return ret; -} - -int execute_tagop(pixel *vid_buf, char *op, char *tag) -{ - int status; - char *result; - - char *names[] = {"ID", "Tag", NULL}; - char *parts[2]; - - char *uri = malloc(strlen(SERVER)+strlen(op)+36); - sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); - - parts[0] = svf_id; - parts[1] = tag; - - result = http_multipart_post( - uri, - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - free(uri); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 1; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 1; - } - - if(result[2]) - { - strncpy(svf_tags, result+3, 255); - svf_id[15] = 0; - } - - if(result) - free(result); - - return 0; -} - -struct strlist -{ - char *str; - struct strlist *next; -}; -void strlist_add(struct strlist **list, char *str) -{ - struct strlist *item = malloc(sizeof(struct strlist)); - item->str = mystrdup(str); - item->next = *list; - *list = item; -} -int strlist_find(struct strlist **list, char *str) -{ - struct strlist *item; - for(item=*list; item; item=item->next) - if(!strcmp(item->str, str)) - return 1; - return 0; -} -void strlist_free(struct strlist **list) -{ - struct strlist *item; - while(*list) - { - item = *list; - *list = (*list)->next; - free(item); - } -} - -void tag_list_ui(pixel *vid_buf) -{ - int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; - char *p,*q,s; - char *tag=NULL, *op=NULL; - ui_edit ed; - struct strlist *vote=NULL,*down=NULL; - - ed.x = x0+25; - ed.y = y0+221; - ed.w = 158; - ed.nx = 1; - ed.def = "[new tag]"; - ed.focus = 0; - ed.hide = 0; - ed.cursor = 0; - strcpy(ed.str, ""); - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - op = tag = NULL; - - drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 256); - drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); - p = svf_tags; - s = svf_tags[0] ? ' ' : 0; - y = 36 + y0; - while(s) - { - q = strchr(p, ' '); - if(!q) - q = p+strlen(p); - s = *q; - *q = 0; - if(svf_own || svf_admin || svf_mod) - { - drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); - d = 14; - if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) - { - if(!ed1.focus) - break; - ed1.focus = 0; - ed2.focus = 1; - } - if(sdl_key==SDLK_ESCAPE) - { - if(!ed1.focus && !ed2.focus) - return; - ed1.focus = 0; - ed2.focus = 0; - } - } - - strcpy(svf_user, ed1.str); - md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); - - res = http_multipart_post( - "http://" SERVER "/Login.api", - NULL, NULL, NULL, - svf_user, svf_pass, - &err, NULL); - if(err != 200) - { - error_ui(vid_buf, err, http_ret_text(err)); - if(res) - free(res); - goto fail; - } - if(res && !strncmp(res, "OK", 2)) - { - if(!strcmp(res, "OK ADMIN")) - { - svf_admin = 1; - svf_mod = 0; - } - else if(!strcmp(res, "OK MOD")) - { - svf_admin = 0; - svf_mod = 1; - } - else - { - svf_admin = 0; - svf_mod = 0; - } - free(res); - svf_login = 1; - return; - } - if(!res) - res = mystrdup("Unspecified Error"); - error_ui(vid_buf, 0, res); - free(res); - -fail: - strcpy(svf_user, ""); - strcpy(svf_pass, ""); - svf_login = 0; - svf_own = 0; - svf_admin = 0; - svf_mod = 0; -} - -void execute_delete(pixel *vid_buf, char *id) -{ - int status; - char *result; - - char *names[] = {"ID", NULL}; - char *parts[1]; - - parts[0] = id; - - result = http_multipart_post( - "http://" SERVER "/Delete.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return; - } - - if(result) - free(result); -} - -int execute_vote(pixel *vid_buf, char *id, char *action) -{ - int status; - char *result; - - char *names[] = {"ID", "Action", NULL}; - char *parts[2]; - - parts[0] = id; - parts[1] = action; - - result = http_multipart_post( - "http://" SERVER "/Vote.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 0; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 0; - } - - if(result) - free(result); - return 1; -} - -static char hex[] = "0123456789ABCDEF"; -void strcaturl(char *dst, char *src) -{ - char *d; - unsigned char *s; - - for(d=dst; *d; d++) ; - - for(s=(unsigned char *)src; *s; s++) - { - if((*s>='0' && *s<='9') || - (*s>='a' && *s<='z') || - (*s>='A' && *s<='Z')) - *(d++) = *s; - else - { - *(d++) = '%'; - *(d++) = hex[*s>>4]; - *(d++) = hex[*s&15]; - } - } - *d = 0; -} - -#define THUMB_CACHE_SIZE 256 - -char *thumb_cache_id[THUMB_CACHE_SIZE]; -void *thumb_cache_data[THUMB_CACHE_SIZE]; -int thumb_cache_size[THUMB_CACHE_SIZE]; -int thumb_cache_lru[THUMB_CACHE_SIZE]; - -void thumb_cache_inval(char *id) -{ - int i,j; - for(i=0; i= THUMB_CACHE_SIZE) - return; - free(thumb_cache_id[i]); - free(thumb_cache_data[i]); - thumb_cache_id[i] = NULL; - for(j=0; j thumb_cache_lru[i]) - thumb_cache_lru[j]--; -} -void thumb_cache_add(char *id, void *thumb, int size) -{ - int i,m=-1,j=-1; - thumb_cache_inval(id); - for(i=0; i m) - { - m = thumb_cache_lru[i]; - j = i; - } - } - if(i >= THUMB_CACHE_SIZE) - { - thumb_cache_inval(thumb_cache_id[j]); - i = j; - } - for(j=0; j= THUMB_CACHE_SIZE) - return 0; - for(j=0; j=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str+5); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - else if(!strncmp(str, "TAG ", 4)) - { - if(j >= TAG_MAX) - { - str = p; - continue; - } - q = strchr(str+4, ' '); - if(!q) - { - str = p; - continue; - } - *(q++) = 0; - tag_names[j] = mystrdup(str+4); - tag_votes[j] = atoi(q); - j++; - } - else - { - if(i>=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - str = p; - } - if(*str) - i++; - return i; -} - -#define IMGCONNS 3 -#define TIMEOUT 100 -#define HTTP_TIMEOUT 10 - -int search_own = 0; -int search_date = 0; -int search_page = 0; -char search_expr[256] = ""; - -int search_ui(pixel *vid_buf) -{ - int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; - int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; - int thumb_drawn[GRID_X*GRID_Y]; - pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - float ry; - time_t http_last_use=HTTP_TIMEOUT; - ui_edit ed; - - - void *http = NULL; - int active = 0; - char *last = NULL; - int search = 0; - int lasttime = TIMEOUT; - char *uri; - int status; - char *results; - char *tmp, ts[64]; - - void *img_http[IMGCONNS]; - char *img_id[IMGCONNS]; - void *thumb, *data; - int thlen, dlen; - - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - - memset(img_http, 0, sizeof(img_http)); - memset(img_id, 0, sizeof(img_id)); - - memset(search_ids, 0, sizeof(search_ids)); - memset(search_names, 0, sizeof(search_names)); - memset(search_scoreup, 0, sizeof(search_scoreup)); - memset(search_scoredown, 0, sizeof(search_scoredown)); - memset(search_publish, 0, sizeof(search_publish)); - memset(search_owners, 0, sizeof(search_owners)); - memset(search_thumbs, 0, sizeof(search_thumbs)); - memset(search_thsizes, 0, sizeof(search_thsizes)); - - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - - do_open = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = 65; - ed.y = 13; - ed.w = XRES-200; - ed.nx = 1; - ed.def = "[search terms]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(search_expr); - strcpy(ed.str, search_expr); - - sdl_wheel = 0; - - while(!sdl_poll()) - { - uih = 0; - bq = b; - mxq = mx; - myq = my; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - if(mx!=mxq || my!=myq || sdl_wheel || b) - mmt = 0; - else if(mmt 9) - { - drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); - drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); - } - - ui_edit_draw(vid_buf, &ed); - - if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) - { - if(search_page) - { - search_page --; - lasttime = TIMEOUT; - } - sdl_wheel = 0; - uih = 1; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) - { - lasttime = TIMEOUT; - search_page ++; - page_count = exp_res; - } - sdl_wheel = 0; - uih = 1; - } - - tp = -1; - if(is_p1) - { - drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); - for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) - for(gi=0; giTAG_MAX || !tag_names[pos]) - break; - if(tag_votes[0]) - i = 127+(128*tag_votes[pos])/tag_votes[0]; - else - i = 192; - w = textwidth(tag_names[pos]); - if(w>XRES/GRID_X-5) - w = XRES/GRID_X-5; - gx = (XRES/GRID_X)*gi; - gy = gj*14 + 46; - if(mx>=gx && mx=gy && my XRES/GRID_X-10) - { - tmp = malloc(strlen(search_names[pos])+4); - strcpy(tmp, search_names[pos]); - j = textwidthx(tmp, XRES/GRID_X-15); - strcpy(tmp+j, "..."); - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); - free(tmp); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); - j = textwidth(search_owners[pos]); - if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && - my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) - { - st = 1; - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); - if(search_thumbs[pos]&&thumb_drawn[pos]==0) - { - render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); - thumb_drawn[pos] = 1; - } - own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); - if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) - mp = pos; - if(own) - { - if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) - { - mp = -1; - dp = pos; - } - } - if(mp==pos && !st) - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); - else - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); - if(own) - { - if(dp == pos) - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); - else - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); - } - if(!search_publish[pos]) - { - drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); - drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); - } - if(view_own || svf_admin || svf_mod) - { - sprintf(ts+1, "%d", search_votes[pos]); - ts[0] = 0xBB; - for(j=1; ts[j]; j++) - ts[j] = 0xBC; - ts[j-1] = 0xB9; - ts[j] = 0xBA; - ts[j+1] = 0; - w = gx+XRES/GRID_S-2-textwidth(ts); - h = gy+YRES/GRID_S-11; - drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); - for(j=0; ts[j]; j++) - ts[j] -= 14; - drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); - sprintf(ts, "%d", search_votes[pos]); - for(j=0; ts[j]; j++) - ts[j] += 127; - drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); - } - if(search_scoreup[pos]>0||search_scoredown[pos]>0) - { - lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); - - if(((YRES/GRID_S+3)/2)>lv) - { - ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); - if(lv<8) - { - ry = ry/(8-lv); - } - nyu = search_scoreup[pos]*ry; - nyd = search_scoredown[pos]*ry; - } - else - { - ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); - nyu = search_scoreup[pos]/ry; - nyd = search_scoredown[pos]/ry; - } - - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); - - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); - } - } - - if(mp!=-1 && mmt>=TIMEOUT/5 && !st) - { - gi = mp % GRID_X; - gj = mp / GRID_X; - if(is_p1) - gj += GRID_Y-GRID_P; - gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; - gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; - i = w = textwidth(search_names[mp]); - h = YRES/GRID_Z+30; - if(w=XRES-2) gx=XRES-3-w; - if(gy<32) gy=32; - if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; - clearrect(vid_buf, gx-2, gy-3, w+4, h); - drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); - if(search_thumbs[mp]) - render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); - drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); - drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); - } - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(sdl_key==SDLK_RETURN) - { - if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) - lasttime = TIMEOUT; - else if(search_ids[0] && !search_ids[1]) - { - bq = 0; - b = 1; - mp = 0; - } - } - if(sdl_key==SDLK_ESCAPE) - goto finish; - - if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) - { - search_own = !search_own; - lasttime = TIMEOUT; - } - if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) - { - search_date = !search_date; - lasttime = TIMEOUT; - } - - if(b && !bq && dp!=-1) - if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) - { - execute_delete(vid_buf, search_ids[dp]); - lasttime = TIMEOUT; - if(last) - { - free(last); - last = NULL; - } - } - - if(b && !bq && tp!=-1) - { - strncpy(ed.str, tag_names[tp], 255); - lasttime = TIMEOUT; - } - - if(b && !bq && mp!=-1 && st) - { - sprintf(ed.str, "user:%s", search_owners[mp]); - lasttime = TIMEOUT; - } - - if(do_open==1) - { - mp = 0; - } - - if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) - { - fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); - info_box(vid_buf, "Loading..."); - - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - data = http_simple_get(uri, &status, &dlen); - free(uri); - - if(status == 200) - { - status = parse_save(data, dlen, 1, 0, 0); - switch(status) - { - case 1: - error_ui(vid_buf, 0, "Simulation corrupted"); - break; - case 2: - error_ui(vid_buf, 0, "Simulation from a newer version"); - break; - case 3: - error_ui(vid_buf, 0, "Simulation on a too large grid"); - break; - } - if(!status) - { - char *tnames[] = {"ID", NULL}; - char *tparts[1]; - int tplens[1]; - if(svf_last) - free(svf_last); - svf_last = data; - svf_lsize = dlen; - - tparts[0] = search_ids[mp]; - tplens[0] = strlen(search_ids[mp]); - data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); - - svf_open = 1; - svf_own = svf_login && !strcmp(search_owners[mp], svf_user); - svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); - - strcpy(svf_id, search_ids[mp]); - strcpy(svf_name, search_names[mp]); - if(status == 200) - { - if(data) - { - strncpy(svf_tags, data, 255); - svf_tags[255] = 0; - } - else - svf_tags[0] = 0; - } - else - { - svf_tags[0] = 0; - } - - if(svf_login) - { - char *names[] = {"ID", NULL}; - char *parts[1]; - parts[0] = search_ids[mp]; - data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); - if(status == 200) - { - if(data) - { - if(!strcmp(data, "Up")) - { - svf_myvote = 1; - } - else if(!strcmp(data, "Down")) - { - svf_myvote = -1; - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - } - else - { - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - } - } - else - error_ui(vid_buf, status, http_ret_text(status)); - - if(data) - free(data); - goto finish; - } - - if(!last) - { - search = 1; - } - else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) - { - search = 1; - if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) - { - search_page = 0; - page_count = 0; - } - free(last); - last = NULL; - } - else - search = 0; - - if(search && lasttime>=TIMEOUT) - { - lasttime = 0; - last = mystrdup(ed.str); - last_own = search_own; - last_date = search_date; - last_page = search_page; - active = 1; - uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); - if(search_own || svf_admin || svf_mod) - tmp = "&ShowVotes=true"; - else - tmp = ""; - if(!search_own && !search_date && !*last) - { - if(search_page) - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); - } - else - { - exp_res = GRID_X*GRID_P; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); - } - } - else - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); - } - strcaturl(uri, last); - if(search_own) - { - strcaturl(uri, " user:"); - strcaturl(uri, svf_user); - } - if(search_date) - strcaturl(uri, " sort:date"); - - http = http_async_req_start(http, uri, NULL, 0, 1); - if(svf_login) - { - http_auth_headers(http, svf_user, svf_pass); - } - http_last_use = time(NULL); - free(uri); - } - - if(active && http_async_req_status(http)) - { - http_last_use = time(NULL); - results = http_async_req_stop(http, &status, NULL); - view_own = last_own; - if(status == 200) - { - page_count = search_results(results, last_own||svf_admin||svf_mod); - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - } - is_p1 = (exp_res < GRID_X*GRID_Y); - free(results); - active = 0; - } - - if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) - { - http_async_req_close(http); - http = NULL; - } - - for(i=0; i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) - { - if(stamp_page) - { - stamp_page --; - } - sdl_wheel = 0; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; -} - -void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) -{ - char t[2]; - t[0] = ch; - t[1] = 0; - if(flag) - { - fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); - } - else - { - drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); - } -} - -void render_signs(pixel *vid_buf) -{ - int i, j, x, y, w, h, dx, dy; - char buff[30]; //Buffer - for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature - else - sprintf(buff, "Temp: 0.00"); //...tempirature - drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); - } - - //Usual text - if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) - drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); - x = signs[i].x; - y = signs[i].y; - dx = 1 - signs[i].ju; - dy = (signs[i].y > 18) ? -1 : 1; - for(j=0; j<4; j++) - { - drawpixel(vid_buf, x, y, 192, 192, 192, 255); - x+=dx; - y+=dy; - } - } -} - -void add_sign_ui(pixel *vid_buf, int mx, int my) -{ - int i, w, h, x, y, nm=0, ju; - int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; - ui_edit ed; - - // check if it is an existing sign - for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) - break; - } - // else look for empty spot - if(i >= MAXSIGNS) - { - nm = 1; - for(i=0; i= MAXSIGNS) - return; - - if(nm) - { - signs[i].x = mx; - signs[i].y = my; - signs[i].ju = 1; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = x0+25; - ed.y = y0+25; - ed.w = 158; - ed.nx = 1; - ed.def = "[message]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(signs[i].text); - strcpy(ed.str, signs[i].text); - ju = signs[i].ju; - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 80); - drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); - ui_edit_draw(vid_buf, &ed); - drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); - draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); - draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); - draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); - - if(!nm) - { - drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); - drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); - drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); - } - - drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) - ju = 0; - if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) - ju = 1; - if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) - ju = 2; - - if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) - { - signs[i].text[0] = 0; - return; - } - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - { - if(!ed.focus) - return; - ed.focus = 0; - } - } - - strcpy(signs[i].text, ed.str); - signs[i].ju = ju; -} - -/*********************************************************** - * CONFIG FILE * - ***********************************************************/ - -char http_proxy[256] = ""; - -void save_string(FILE *f, char *str) -{ - int li = strlen(str); - unsigned char lb[2]; - lb[0] = li; - lb[1] = li >> 8; - fwrite(lb, 2, 1, f); - fwrite(str, li, 1, f); -} - -int load_string(FILE *f, char *str, int max) -{ - int li; - unsigned char lb[2]; - fread(lb, 2, 1, f); - li = lb[0] | (lb[1] << 8); - if(li > max) - { - str[0] = 0; - return 1; - } - fread(str, li, 1, f); - str[li] = 0; - return 0; -} - -unsigned char last_major=0, last_minor=0, update_flag=0; - -void save_presets(int do_update) -{ - FILE *f=fopen("powder.def", "wb"); - unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; - unsigned char tmp = sdl_scale; - if(!f) - return; - fwrite(sig, 1, 4, f); - save_string(f, svf_user); - save_string(f, svf_pass); - fwrite(&tmp, 1, 1, f); - tmp = cmode; - fwrite(&tmp, 1, 1, f); - tmp = svf_admin; - fwrite(&tmp, 1, 1, f); - tmp = svf_mod; - fwrite(&tmp, 1, 1, f); - save_string(f, http_proxy); - tmp = SAVE_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = MINOR_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = do_update; - fwrite(&tmp, 1, 1, f); - fclose(f); -} - -void load_presets(void) -{ - FILE *f=fopen("powder.def", "rb"); - unsigned char sig[4], tmp; - if(!f) - return; - fread(sig, 1, 4, f); - if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) - { - if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) - { - if(fseek(f, -3, SEEK_END)) - { - remove("powder.def"); - return; - } - if(fread(sig, 1, 3, f) != 3) - { - remove("powder.def"); - goto fail; - } - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; - } - fclose(f); - remove("powder.def"); - return; - } - if(load_string(f, svf_user, 63)) - goto fail; - if(load_string(f, svf_pass, 63)) - goto fail; - svf_login = !!svf_user[0]; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - sdl_scale = (tmp == 2) ? 2 : 1; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - cmode = tmp%6; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_admin = tmp; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_mod = tmp; - if(load_string(f, http_proxy, 255)) - goto fail; - if(fread(sig, 1, 3, f) != 3) - goto fail; - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; -fail: - fclose(f); -} - -void dim_copy(pixel *dst, pixel *src) -{ - int i,r,g,b; - for(i=0; i0) - r--; - if(g>0) - g--; - if(b>0) - b--; - dst[i] = PIXRGB(r,g,b); - } -} - -unsigned int fire_alpha[CELL*3][CELL*3]; -void prepare_alpha(void) -{ - int x,y,i,j; - float temp[CELL*3][CELL*3]; - memset(temp, 0, sizeof(temp)); - for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; - fire_g[j][i] = g>4 ? g-4 : 0; - fire_b[j][i] = b>4 ? b-4 : 0; - } -} - -int zoom_en = 0; -int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; -int zoom_wx=0, zoom_wy=0; -void render_zoom(pixel *img) -{ - int x, y, i, j; - pixel pix; - drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); - drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); - clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); - for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) - { - xor_pixel(x+i, y+j, vid); - if(j) xor_pixel(x+i, y-j, vid); - if(i) xor_pixel(x-i, y+j, vid); - if(i&&j) xor_pixel(x-i, y-j, vid); - } - } - else - { - int tc; - c = (r/CELL) * CELL; - x = (x/CELL) * CELL; - y = (y/CELL) * CELL; - - tc = !((c%(CELL*2))==0); - - x -= c/2; - y -= c/2; - - x += tc*(CELL/2); - y += tc*(CELL/2); - - for(i=0; i2) - { - pthread_t pth; - pthread_create(&pth,NULL,update_air_th,""); - } - else - { - update_air(); - } -#else - update_air(); -#endif - } - if(cmode==0 || cmode==1) - { - draw_air(vid_buf); - } - else if(cmode==2) - { - memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); - memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); - } - else - { - memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); - } - update_particles(vid_buf); - - if(cmode==2) - { - if(!fire_fc) - { - dim_copy(fire_bg, vid_buf); - } - else - { - memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); - } - fire_fc = (fire_fc+1) % 3; - } - if(cmode==3||cmode==4) - render_fire(vid_buf); - - render_signs(vid_buf); - - memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); - clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); - - draw_svf_ui(vid_buf); - - if(http_ver_check) - { - if(!do_check && http_async_req_status(http_ver_check)) - { - ver_data = http_async_req_stop(http_ver_check, &http_ret, NULL); - if(http_ret==200 && ver_data) - { -#ifdef BETA - if(sscanf(ver_data, "%d.%d.%d", &major, &minor, &is_beta)==3) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) - old_version = 1; -#else - if(sscanf(ver_data, "%d.%d", &major, &minor)==2) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) - old_version = 1; -#endif - free(ver_data); - } - http_ver_check = NULL; - } - do_check = (do_check+1) & 15; - } - - if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) - { - if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) - { - break; - } - } - if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) - { - if(load_mode) - { - free(load_img); - free(load_data); - load_mode = 0; - load_data = NULL; - load_img = NULL; - } - if(it > 50) - it = 50; - if(sdl_key=='k' && stamps[1].name[0]) - { - j = stamp_ui(vid_buf); - if(j>=0) - load_data = stamp_load(j, &load_size); - else - load_data = NULL; - } - else - load_data = stamp_load(0, &load_size); - if(load_data) - { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - if(sdl_key=='s') - { - if(it > 50) - it = 50; - save_mode = 1; - } - if(sdl_key=='1') - { - set_cmode(0); - } - if(sdl_key=='2') - { - set_cmode(1); - } - if(sdl_key=='3') - { - set_cmode(2); - } - if(sdl_key=='4') - { - set_cmode(3); - } - if(sdl_key=='5') - { - set_cmode(4); - } - if(sdl_key=='6') - { - set_cmode(5); - } - if(sdl_key==SDLK_SPACE) - sys_pause = !sys_pause; - if(sdl_key=='h') - hud_enable = !hud_enable; - if(sdl_key=='p') - dump_frame(vid_buf, XRES, YRES, XRES); - if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - if(clipboard_ready==1) - { - load_data = malloc(clipboard_length); - memcpy(load_data, clipboard_data, clipboard_length); - load_size = clipboard_length; - if(load_data) - { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - } - if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 2; - } - if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 1; - } - else if(sdl_key=='c') - { - set_cmode((cmode+1) % 6); - if(it > 50) - it = 50; - } -#ifdef INTERNAL - if(sdl_key=='v') - vs = !vs; - if(vs) - dump_frame(vid_buf, XRES, YRES, XRES); -#endif - - if(sdl_wheel) - { - if(sdl_zoom_trig==1) - { - ZSIZE += sdl_wheel; - if(ZSIZE>32) - ZSIZE = 32; - if(ZSIZE<2) - ZSIZE = 2; - ZFACTOR = 256/ZSIZE; - sdl_wheel = 0; - } - else - { - bs += sdl_wheel; - if(bs>16) - bs = 16; - if(bs<0) - bs = 0; - sdl_wheel = 0; - /*if(su >= PT_NUM) { - if(sl < PT_NUM) - su = sl; - if(sr < PT_NUM) - su = sr; - }*/ - } - } - - bq = b; - b = SDL_GetMouseState(&x, &y); - - for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy - && x0 && y0 && x>8)>=NPART || !cr)) - { -#ifdef BETA - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); -#else - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); -#endif - } - else - { - sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); - } - } - mx = x; - my = y; - if(update_flag) - { - info_box(vid_buf, "Finalizing update..."); - if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) - { - update_cleanup(); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } - else - { - if(update_finish()) - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - else - info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); - } - update_flag = 0; - } - - if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && - x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) - { - tmp = malloc(64); -#ifdef BETA - if(is_beta) - { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); - } - else - { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); - } -#else - sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); -#endif - if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) - { - free(tmp); - tmp = download_ui(vid_buf, my_uri, &i); - if(tmp) - { - save_presets(1); - if(update_start(tmp, i)) - { - update_cleanup(); - save_presets(0); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } - else - return 0; - } - } - else - free(tmp); - } - if(y>=sdl_scale*(YRES+(MENUSIZE-20))) - { - if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) - { - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } - else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) - { - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } - else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) - { - db = (svf_myvote==1) ? 273 : 274; - if(da < 51) - da ++; - } - else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) - { - db = svf_own ? 257 : 256; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) - { - db = 270; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) - { - db = 266; - if(da < 51) - da ++; - } - else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) - { - db = 259; - if(svf_open && svf_own && x<=55*sdl_scale) - db = 258; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) - { - db = svf_login ? 261 : 260; - if(svf_admin) - { - db = 268; - } - else if(svf_mod) - { - db = 271; - } - if(da < 51) - da ++; - } - else if(x>=sdl_scale && x<=17*sdl_scale) - { - db = 262; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) - { - db = sys_pause ? 264 : 263; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) - { - db = 267; - if(da < 51) - da ++; - } - else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) - { - db = 265; - if(da < 51) - da ++; - } - else if(da > 0) - da --; - } - else if(da > 0) - da --; - - if(!sdl_zoom_trig && zoom_en==1) - zoom_en = 0; - - if(sdl_key==Z_keysym && zoom_en==2) - zoom_en = 1; - - if(load_mode) - { - load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); - load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); - if(load_x+load_w>XRES) load_x=XRES-load_w; - if(load_y+load_h>YRES) load_y=YRES-load_h; - if(load_x<0) load_x=0; - if(load_y<0) load_y=0; - if(bq==1 && !b) - { - parse_save(load_data, load_size, 0, load_x, load_y); - free(load_data); - free(load_img); - load_mode = 0; - } - else if(bq==4 && !b) - { - free(load_data); - free(load_img); - load_mode = 0; - } - } - else if(save_mode==1) - { - save_x = (mx/sdl_scale)/CELL; - save_y = (my/sdl_scale)/CELL; - if(save_x >= XRES/CELL) save_x = XRES/CELL-1; - if(save_y >= YRES/CELL) save_y = YRES/CELL-1; - save_w = 1; - save_h = 1; - if(b==1) - { - save_mode = 2; - } - else if(b==4) - { - save_mode = 0; - copy_mode = 0; - } - } - else if(save_mode==2) - { - save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; - save_h = (my/sdl_scale+CELL/2)/CELL - save_y; - if(save_w>XRES/CELL) save_w = XRES/CELL; - if(save_h>YRES/CELL) save_h = YRES/CELL; - if(save_w<1) save_w = 1; - if(save_h<1) save_h = 1; - if(!b) - { - if(copy_mode==1) - { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - } - else if(copy_mode==2) - { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - } - else - { - stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - save_mode = 0; - } - } - } - else if(sdl_zoom_trig && zoom_en<2) - { - x /= sdl_scale; - y /= sdl_scale; - x -= ZSIZE/2; - y -= ZSIZE/2; - if(x<0) x=0; - if(y<0) y=0; - if(x>XRES-ZSIZE) x=XRES-ZSIZE; - if(y>YRES-ZSIZE) y=YRES-ZSIZE; - zoom_x = x; - zoom_y = y; - zoom_wx = (x 50) - it = 50; - x /= sdl_scale; - y /= sdl_scale; - if(y>=YRES+(MENUSIZE-20)) - { - if(!lb) - { - if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) - { - if(execute_vote(vid_buf, svf_id, "Up")) - { - svf_myvote = 1; - } - } - if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) - { - if(execute_vote(vid_buf, svf_id, "Down")) - { - svf_myvote = -1; - } - } - if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) - tag_list_ui(vid_buf); - if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) - { - legacy_enable = !legacy_enable; - } - if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) - { - memset(signs, 0, sizeof(signs)); - memset(pv, 0, sizeof(pv)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(fvx, 0, sizeof(fvx)); - memset(fvy, 0, sizeof(fvy)); - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(parts, 0, sizeof(particle)*NPART); - for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) - { - login_ui(vid_buf); - if(svf_login) - save_presets(0); - } - if(x>=37 && x<=187 && svf_login) - { - if(!svf_open || !svf_own || x>51) - { - if(save_name_ui(vid_buf)) - execute_save(vid_buf); - } - else - execute_save(vid_buf); - while(!sdl_poll()) - if(!SDL_GetMouseState(&x, &y)) - break; - b = bq = 0; - } - if(x>=1 && x<=17) - { - search_ui(vid_buf); - memset(fire_bg, 0, XRES*YRES*PIXELSIZE); - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - } - if(x>=19 && x<=35 && svf_last && svf_open) - parse_save(svf_last, svf_lsize, 1, 0, 0); - if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) - { - if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 6); - if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+5) % 6); - save_presets(0); - } - if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) - sys_pause = !sys_pause; - lb = 0; - } - } - else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) - { - c = sl = cr&0xFF; - } - else - { - //Something - } - } - //create_parts(x, y, bs, SPC_AIR); - lx = x; - ly = y; - lb = 0; - lm = 0; - } - else - { - create_parts(x, y, bs, c); - lx = x; - ly = y; - lb = b; - lm = 0; - } - } - } - } - else - { - if(lb && lm) - { - x /= sdl_scale; - y /= sdl_scale; - c = (lb&1) ? sl : sr; - su = c; - if(lm == 1) - { - if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) - create_line(lx, ly, x, y, bs, c); - } - else - create_box(lx, ly, x, y, c); - lm = 0; - } - lb = 0; - } - - if(load_mode) - { - draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); - xor_rect(vid_buf, load_x, load_y, load_w, load_h); - } - - if(save_mode) - { - xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - da = 51; - db = 269; - } - - if(zoom_en!=1 && !load_mode && !save_mode) - { - render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); - mousex = mx/sdl_scale; - mousey = my/sdl_scale; - } - - if(zoom_en) - render_zoom(vid_buf); - - if(da) - switch(db) - { - case 256: - drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); - break; - case 257: - drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); - break; - case 258: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); - break; - case 259: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); - break; - case 260: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); - break; - case 261: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); - break; - case 262: - drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); - break; - case 263: - drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); - break; - case 264: - drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); - break; - case 265: - drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); - break; - case 266: - drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); - break; - case 267: - drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); - break; - case 268: - drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); - break; - case 269: - drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); - break; - case 270: - drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); - break; - case 271: - drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); - break; - case 272: - drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); - break; - case 273: - drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); - break; - case 274: - drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); - break; - case 275: - drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); - break; - default: - drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); - } - if(itc) - { - itc--; - drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); - } - if(it) - { - it--; - //if(fbi_img) - //draw_image(vid_buf, fbi_img, (XRES-FBI_W)/2, (YRES-FBI_H)/2+25, FBI_W, FBI_H, it>12?64:it*5); - drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); - } - - if(old_version) - { - clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); -#ifdef BETA - if(is_beta) - { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); - } - else - { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); - } -#else - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); -#endif - drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); - } - /*#ifdef MT - pthread_join(pth2,NULL); - #endif*/ - - if(hud_enable) - { - currentTime = SDL_GetTicks(); - if(currentTime-past>=16) - { - past = SDL_GetTicks(); - FPS++; - } - if(currentTime-pastFPS>=1000) - { -#ifdef BETA - sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#else - sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#endif - FPSB = FPS; - FPS = 0; - pastFPS = currentTime; - } - if(sdl_zoom_trig||zoom_en) - { - if(zoom_x Date: Mon, 16 Aug 2010 17:11:50 -0400 Subject: wee diff --git a/powder.c b/powder.c index 2f8642b..750beaa 100644 --- a/powder.c +++ b/powder.c @@ -3266,7 +3266,6 @@ justdraw: blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); } } ->>>>>>> simon/master } else if(t==PT_PLSM) { float ttemp = parts[i].life; -- cgit v0.9.2-21-gd62e From 664e15215dd8345b6ca54fc885492fe3fb103488 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 16 Aug 2010 17:13:46 -0400 Subject: change a tad bit diff --git a/powder.c b/powder.c index 750beaa..334884a 100644 --- a/powder.c +++ b/powder.c @@ -3236,10 +3236,10 @@ justdraw: cg = 0x70; cb = 0x20; blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny, cr, cg, cb, 5); + blendpixel(vid, nx-1, ny, cr, cg, cb, 5); + blendpixel(vid, nx, ny+1, cr, cg, cb, 5); + blendpixel(vid, nx, ny-1, cr, cg, cb, 5); for(int tempx = 2; tempx < 10; tempx++) { for(int tempy = 2; tempy < 10; tempy++) { blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); @@ -3254,10 +3254,10 @@ justdraw: cg = 0x70; cb = 0x20; blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny, cr, cg, cb, 5); + blendpixel(vid, nx-1, ny, cr, cg, cb, 5); + blendpixel(vid, nx, ny+1, cr, cg, cb, 5); + blendpixel(vid, nx, ny-1, cr, cg, cb, 5); for(int tempx = 2; tempx < 10; tempx++) { for(int tempy = 2; tempy < 10; tempy++) { blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); -- cgit v0.9.2-21-gd62e From 802e7705a2e6673e9ffd95974e88066825810bc7 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 23:18:29 +0200 Subject: astyle formatted diff --git a/powder.c b/powder.c index 334884a..78e481b 100644 --- a/powder.c +++ b/powder.c @@ -114,7 +114,7 @@ char *it_msg = "Shift+drag will create straight lines of particles.\n" "Ctrl+drag will result in filled rectangles.\n" "Ctrl+Shift+click will flood-fill a closed area.\n" - "Ctrl+Z will act as Undo.\n" + "Ctrl+Z will act as Undo.\n" "Middle click or Alt+Click to \"sample\" the particles.\n" "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" "Use 'S' to save parts of the window as 'stamps'.\n" @@ -130,7 +130,7 @@ char *it_msg = "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" - "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" + "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" "\n" "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" @@ -1288,7 +1288,7 @@ void set_emap(int x, int y) set_emap(x, y+1); } } - inline int parts_avg(int ci, int ni) +inline int parts_avg(int ci, int ni) { int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; if((pmr>>8) < NPART && (pmr>>8) >= 0) @@ -2910,40 +2910,40 @@ justdraw: } } else if(t==PT_PLUT) { - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } } else if(t==PT_URAN) { - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } } else if(t==PT_SLTW) { for(x=-1; x<=1; x++) @@ -3232,40 +3232,40 @@ justdraw: blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } } else if(t==PT_PLUT) { - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 5); - blendpixel(vid, nx-1, ny, cr, cg, cb, 5); - blendpixel(vid, nx, ny+1, cr, cg, cb, 5); - blendpixel(vid, nx, ny-1, cr, cg, cb, 5); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 5); + blendpixel(vid, nx-1, ny, cr, cg, cb, 5); + blendpixel(vid, nx, ny+1, cr, cg, cb, 5); + blendpixel(vid, nx, ny-1, cr, cg, cb, 5); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } } else if(t==PT_URAN) { - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 5); - blendpixel(vid, nx-1, ny, cr, cg, cb, 5); - blendpixel(vid, nx, ny+1, cr, cg, cb, 5); - blendpixel(vid, nx, ny-1, cr, cg, cb, 5); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 5); + blendpixel(vid, nx-1, ny, cr, cg, cb, 5); + blendpixel(vid, nx, ny+1, cr, cg, cb, 5); + blendpixel(vid, nx, ny-1, cr, cg, cb, 5); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } } else if(t==PT_PLSM) { float ttemp = parts[i].life; @@ -9735,7 +9735,7 @@ int main(int argc, char *argv[]) #endif menu_count(); parts = calloc(sizeof(particle), NPART); - cb_parts = calloc(sizeof(particle), NPART); + cb_parts = calloc(sizeof(particle), NPART); for(i=0; i 50) it = 50; } - if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo + if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo { - int cbx, cby, cbi; + int cbx, cby, cbi; - for(cbi=0; cbi Date: Mon, 16 Aug 2010 23:22:38 +0200 Subject: git fails diff --git a/powder.c b/powder.c index 78e481b..f173f5a 100644 --- a/powder.c +++ b/powder.c @@ -3222,10 +3222,10 @@ justdraw: cg = 0x50+(parts[i].life*10); cb = 0x50+(parts[i].life*10); blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny, cr, cg, cb, 5); + blendpixel(vid, nx-1, ny, cr, cg, cb, 5); + blendpixel(vid, nx, ny+1, cr, cg, cb, 5); + blendpixel(vid, nx, ny-1, cr, cg, cb, 5); blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); -- cgit v0.9.2-21-gd62e From 60e58a7e6bf171d3969d8b840fe4e7dbf4b8d74a Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 23:26:08 +0200 Subject: what about now diff --git a/powder.c b/powder.c index f173f5a..78e481b 100644 --- a/powder.c +++ b/powder.c @@ -3222,10 +3222,10 @@ justdraw: cg = 0x50+(parts[i].life*10); cb = 0x50+(parts[i].life*10); blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 5); - blendpixel(vid, nx-1, ny, cr, cg, cb, 5); - blendpixel(vid, nx, ny+1, cr, cg, cb, 5); - blendpixel(vid, nx, ny-1, cr, cg, cb, 5); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); -- cgit v0.9.2-21-gd62e From 435e36538f8f81267439c9db2b21ac43a5e81bb5 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 16 Aug 2010 23:30:48 +0200 Subject: test diff --git a/powder.c b/powder.c deleted file mode 100644 index 78e481b..0000000 --- a/powder.c +++ /dev/null @@ -1,10781 +0,0 @@ -/** - * Powder Toy - Main source - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * Copyright (c) 2010 Simon Robertshaw - * Copyright (c) 2010 Skresanov Savely - * Copyright (c) 2010 Bryan Hoyle - * Copyright (c) 2010 Nathan Cousins - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#else -#include -#include -#endif - - -#include "version.h" -#include "http.h" -#include "md5.h" -#include "update.h" -#include "hmap.h" - -#define SERVER "powdertoy.co.uk" - -#undef PLOSS - -#ifdef MENUV3 -#define MENUSIZE 40 -#else -#define MENUSIZE 20 -#endif -#define BARSIZE 14 -#define XRES 612 -#define YRES 384 -#define NPART XRES*YRES - -#define ZSIZE_D 16 -#define ZFACTOR_D 8 -unsigned char ZFACTOR = 256/ZSIZE_D; -unsigned char ZSIZE = ZSIZE_D; - -#define CELL 4 -#define ISTP (CELL/2) -#define CFDS (4.0f/CELL) - -typedef unsigned char uint8; - -#ifdef PIX16 -#define PIXELSIZE 2 -typedef unsigned short pixel; -#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) -#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) -#define PIXR(x) (((x)>>8)&0xF8) -#define PIXG(x) (((x)>>3)&0xFC) -#define PIXB(x) (((x)<<3)&0xF8) -#else -#define PIXELSIZE 4 -typedef unsigned int pixel; -#ifdef PIX32BGR -#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) -#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) -#define PIXR(x) ((x)&0xFF) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)>>16) -#else -#ifdef PIX32BGRA -#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) -#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) -#define PIXR(x) (((x)>>8)&0xFF) -#define PIXG(x) (((x)>>16)&0xFF) -#define PIXB(x) (((x)>>24)) -#else -#define PIXPACK(x) (x) -#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) -#define PIXR(x) ((x)>>16) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)&0xFF) -#endif -#endif -#endif - -char *it_msg = - "\brThe Powder Toy\n" - "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" - "\n" - "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" - "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" - "\bgPick your material from the menu using mouse left/right buttons.\n" - "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" - "Shift+drag will create straight lines of particles.\n" - "Ctrl+drag will result in filled rectangles.\n" - "Ctrl+Shift+click will flood-fill a closed area.\n" - "Ctrl+Z will act as Undo.\n" - "Middle click or Alt+Click to \"sample\" the particles.\n" - "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" - "Use 'S' to save parts of the window as 'stamps'.\n" - "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" - "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" - "Use the mouse scroll wheel to change the tool size for particles.\n" - "'Q' will quit the application.\n" - "The spacebar can be used to pause physics.\n" - "'P' will take a screenshot and save it into the current directory.\n" - "\n" - "\brhttp://powdertoy.co.uk/\n" - "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" - "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" - "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" - "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" - "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" - "\n" - "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" - "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" - ; - -typedef struct -{ - int start, inc; - pixel *vid; -} upstruc; - -#ifdef BETA -char *old_ver_msg_beta = "A new beta is available - click here!"; -#endif -char *old_ver_msg = "A new version is available - click here!"; -float mheat = 0.0f; - -int do_open = 0; -int sys_pause = 0; -int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. - -int amd = 0; - -unsigned char fire_r[YRES/CELL][XRES/CELL]; -unsigned char fire_g[YRES/CELL][XRES/CELL]; -unsigned char fire_b[YRES/CELL][XRES/CELL]; - -#define MAXSIGNS 16 - -struct sign -{ - int x,y,ju; - char text[256]; -} signs[MAXSIGNS]; - -/*********************************************************** - * AIR FLOW SIMULATOR * - ***********************************************************/ - -unsigned char bmap[YRES/CELL][XRES/CELL]; -unsigned char emap[YRES/CELL][XRES/CELL]; - -unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -unsigned char cb_emap[YRES/CELL][XRES/CELL]; - -unsigned cmode = 3; - -float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; - -float cb_vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float cb_vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float cb_pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; - -float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; -#define TSTEPP 0.3f -#define TSTEPV 0.4f -#define VADV 0.3f -#define VLOSS 0.999f -#define PLOSS 0.9999f -int numCores = 1; -float kernel[9]; -void make_kernel(void) -{ - int i, j; - float s = 0.0f; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - { - kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); - s += kernel[(i+1)+3*(j+1)]; - } - s = 1.0f / s; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - kernel[(i+1)+3*(j+1)] *= s; -} - -int core_count() -{ - int numCPU = 1; -#ifdef MT -#ifdef WIN32 - SYSTEM_INFO sysinfo; - GetSystemInfo( &sysinfo ); - numCPU = sysinfo.dwNumberOfProcessors; -#else -#ifdef MACOSX - numCPU = 4; -#else - numCPU = sysconf( _SC_NPROCESSORS_ONLN ); -#endif -#endif - - printf("Cpus: %d\n", numCPU); - if(numCPU>1) - printf("Multithreading enabled\n"); - else - printf("Multithreading disabled\n"); -#endif - return numCPU; -} - -void update_air(void) -{ - int x, y, i, j; - float dp, dx, dy, f, tx, ty; - - for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; - if(dp < -256.0f) dp = -256.0f; - if(dx > 256.0f) dx = 256.0f; - if(dx < -256.0f) dx = -256.0f; - if(dy > 256.0f) dy = 256.0f; - if(dy < -256.0f) dy = -256.0f; - - ovx[y][x] = dx; - ovy[y][x] = dy; - opv[y][x] = dp; - } - memcpy(vx, ovx, sizeof(vx)); - memcpy(vy, ovy, sizeof(vy)); - memcpy(pv, opv, sizeof(pv)); -} - -void *update_air_th(void *arg) -{ - update_air(); - return NULL; -} - -inline unsigned clamp_flt(float f, float min, float max) -{ - if(fmax) - return 255; - return (int)(255.0f*(f-min)/(max-min)); -} - -inline float restrict_flt(float f, float min, float max) -{ - if(fmax) - return max; - return f; -} - -void draw_air(pixel *vid) -{ - int x, y, i, j; - pixel c; - - if(cmode == 2) - return; - - for(y=0; y 0.0f) - c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); - else - c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); - } - else - c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), - clamp_flt(pv[y][x], 0.0f, 8.0f), - clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); - for(j=0; j=XRES || ny>=YRES) - return 0; - if(x==nx && y==ny) - return 1; - r = pmap[ny][nx]; - if(r && (r>>8)>8].type; - - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) - { - return 1; - } - - if((r&0xFF)==PT_VOID) - { - parts[i].type=PT_NONE; - return 0; - } - if((r&0xFF)==PT_BHOL) - { - parts[i].type=PT_NONE; - if(!legacy_enable) - { - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; - } - return 0; - } - - if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide - { - return 1; - } - - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) - { - return 1; - } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) - { - return 0; - } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) - { - return 0; - } - - if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; - if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) - return 0; - if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) - return 0; - - if(parts[i].type==PT_CNCT && y>8)>= 8; - parts[r].x += x-nx; - parts[r].y += y-ny; - } - - return 1; -} - -void kill_part(int i) -{ - int x, y; - parts[i].type = PT_NONE; - - x = (int)(parts[i].x+0.5f); - y = (int)(parts[i].y+0.5f); - - if(x>=0 && y>=0 && x=XRES || y>=YRES) - return -1; - - if(t==SPC_HEAT||t==SPC_COOL) - { - if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); - } - if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) - { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); - } - return pmap[y][x]>>8; - } - else - { - return -1; - } - } - if(t==SPC_AIR) - { - pv[y/CELL][x/CELL] += 0.03f; - if(y+CELL>8].type = PT_SPRK; - parts[pmap[y][x]>>8].life = 4; - parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; - pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; - return pmap[y][x]>>8; - } - - if(p==-1) - { - if(pmap[y][x]) - return -1; - if(pfree == -1) - return -1; - i = pfree; - pfree = parts[i].life; - } - else - i = p; - - if(t==PT_GLAS) - { - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - } - if(t!=PT_STKM) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = t; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 0; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - } - if(t==PT_ACID) - { - parts[i].life = 75; - } - //Testing - /*if(t==PT_WOOD){ - parts[i].life = 150; - }*/ - //End Testing - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_PLSM) - parts[i].life = rand()%150+50; - if(t==PT_LAVA) - parts[i].life = rand()%120+240; - if(t==PT_NBLE) - parts[i].life = 0; - if(t==PT_NEUT) - { - float r = (rand()%128+128)/127.0f; - float a = (rand()%360)*3.14159f/180.0f; - parts[i].life = rand()%480+480; - parts[i].vx = r*cosf(a); - parts[i].vy = r*sinf(a); - } - if(t==PT_PHOT) - { - float r = (rand()%3-1)*3; - float a = (rand()%3-1)*3; - parts[i].life = 680; - if(a==0.0f&&r==0.0f) - { - parts[i].life = 0; - parts[i].type = PT_NONE; - return -1; - } - else - { - parts[i].vx = a; - parts[i].vy = r; - } - //} else { - // parts[i].life = 0; - // parts[i].type = PT_NONE; - //} - } - - if(t!=PT_STKM) - pmap[y][x] = t|(i<<8); - else - { - if(isplayer==0) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - player[2] = PT_DUST; - player[3] = x-1; //Setting legs positions - player[4] = y+6; - player[5] = x-1; - player[6] = y+6; - - player[7] = x-3; - player[8] = y+12; - player[9] = x-3; - player[10] = y+12; - - player[11] = x+1; - player[12] = y+6; - player[13] = x+1; - player[14] = y+6; - - player[15] = x+3; - player[16] = y+12; - player[17] = x+3; - player[18] = y+12; - - isplayer = 1; - } - } - - return i; -} - -void delete_part(int x, int y) -{ - unsigned i; - - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - i = pmap[y][x]; - if(!i || (i>>8)>=NPART) - return; - - kill_part(i>>8); - pmap[y][x] = 0; // just in case -} - -inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -{ - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - if(a!=255) - { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -int sign(float i) //Signum function -{ - if (i<0) - return -1; - if (i>0) - return 1; - return 0; -} - -void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a) //Draws a line -{ - int dx, dy, i, sx, sy, check, e, x, y; - - dx = abs(x1-x2); - dy = abs(y1-y2); - sx = sign(x2-x1); - sy = sign(y2-y1); - x = x1; - y = y1; - check = 0; - - if (dy>dx) - { - dx = dx+dy; - dy = dx-dy; - dx = dx-dy; - check = 1; - } - - e = (dy<<2)-dx; - for (i=0; i<=dx; i++) - { - vid[x+y*a] =PIXRGB(r, g, b); - if (e>=0) - { - if (check==1) - x = x+sx; - else - y = y+sy; - e = e-(dx<<2); - } - if (check==1) - y = y+sy; - else - x = x+sx; - e = e+(dy<<2); - } -} - -void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -{ - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + 255*PIXR(t)) >> 8; - g = (a*g + 255*PIXG(t)) >> 8; - b = (a*b + 255*PIXB(t)) >> 8; - if(r>255) - r = 255; - if(g>255) - g = 255; - if(b>255) - b = 255; - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); - -int is_wire(int x, int y) -{ - return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; -} -int is_wire_off(int x, int y) -{ - return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; -} - -void set_emap(int x, int y) -{ - int x1, x2; - - if(!is_wire_off(x, y)) - return; - - // go left as far as possible - x1 = x2 = x; - while(x1>0) - { - if(!is_wire_off(x1-1, y)) - break; - x1--; - } - while(x21 && x1==x2 && - is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && - !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) - set_emap(x1, y-2); - else if(y>0) - for(x=x1; x<=x2; x++) - if(is_wire_off(x, y-1)) - { - if(x==x1 || x==x2 || y>=YRES/CELL-1 || - is_wire(x-1, y-1) || is_wire(x+1, y-1) || - is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) - set_emap(x, y-1); - } - - if(y>8) < NPART && (pmr>>8) >= 0) - { - return parts[pmr>>8].type; - } - else - { - return PT_NONE; - } -} -int nearest_part(int ci, int t) -{ - int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); - int ndistance = 0; - int id = -1; - int i = 0; - int cx = (int)parts[ci].x; - int cy = (int)parts[ci].y; - for(i=0; i=XRES || y>=YRES || - ((bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) - { - kill_part(i); - continue; - } - - vx[y/CELL][x/CELL] *= ptypes[t].airloss; - vy[y/CELL][x/CELL] *= ptypes[t].airloss; - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - if(t==PT_GASS||t==PT_NBLE) - { - if(pv[y/CELL][x/CELL]<3.5f) - pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); - if(y+CELL2.5f) - { - parts[i].life = rand()%80+180; - rt = parts[i].type = PT_FIRE; - parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - pv[y/CELL][x/CELL] += 0.25f * CFDS; - t = PT_FIRE; - } - - parts[i].vx *= ptypes[t].loss; - parts[i].vy *= ptypes[t].loss; - - if(t==PT_DFRM && !parts[i].life) - { - if(pv[y/CELL][x/CELL]>1.0f) - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - parts[i].life = rand()%80+300; - } - } - else - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - - if(ptypes[t].diffusion) - { - parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - } - - // interpolator -#ifdef WIN32 - mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#else - mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#endif - if(mv < ISTP) - { - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - } - else - { - dx = parts[i].vx*ISTP/mv; - dy = parts[i].vy*ISTP/mv; - ix = parts[i].x; - iy = parts[i].y; - while(1) - { - mv -= ISTP; - if(mv <= 0.0f) - { - // nothing found - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - break; - } - ix += dx; - iy += dy; - nx = (int)(ix+0.5f); - ny = (int)(iy+0.5f); - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) - { - parts[i].x = ix; - parts[i].y = iy; - break; - } - } - } - - a = nt = 0; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx4.0f) - t = parts[i].type = PT_DSTW; - if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) - t = parts[i].type = PT_OILL; - if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) - t = parts[i].type = PT_GASS; - } - if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) - t = parts[i].type = PT_BRMT; - //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) - // t = parts[i].type = PT_BGLA; - if(t==PT_GLAS) - { - parts[i].pavg[0] = parts[i].pavg[1]; - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) - { - parts[i].type = PT_BGLA; - } - } - if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) - t = parts[i].type = PT_SNOW; - if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) - { - t = PT_NEUT; - create_part(i, x, y, t); - } - - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) - { - nearp = nearest_part(i, PT_ETRD); - if(nearp!=-1) - { - create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[nearp].type = PT_SPRK; - parts[nearp].life = 9; - parts[nearp].ctype = PT_ETRD; - } - } - - if(!legacy_enable) - { - int ctemp = pv[y/CELL][x/CELL]*2; - c_heat = 0.0f; - h_count = 0; - if(ptypes[t].hconduct>(rand()%250)) - { - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) - { - h_count++; - c_heat += parts[r>>8].temp; - } - } - } - } - pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) - { - parts[r>>8].temp = parts[i].temp; - } - } - } - } - if(pt>=pstates[t].btemp&&pstates[t].burn) - { - t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE||t==PT_PLSM) - parts[i].life = rand()%50+120; - } - else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) - { - if(t==PT_LAVA&&parts[i].ctype) - { - parts[i].life = 0; - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) - { - parts[i].ctype = parts[i].type; - t = parts[i].type = PT_ICEI; - } - else - { - parts[i].life = 0; - t = parts[i].type = pstates[t].solid; - } - } - else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) - { - if(pstates[t].liquid==PT_LAVA) - { - parts[i].life = rand()%120+240; - parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; - parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; - t = parts[i].type = pstates[t].liquid; - } - else if(t==PT_ICEI&&parts[i].ctype) - { - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else - { - t = parts[i].type = pstates[t].liquid; - } - } - else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) - { - t = parts[i].type = pstates[t].liquid; - } - else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) - { - if(t==PT_SLTW&&1>rand()%6) - { - t = parts[i].type = PT_SALT; - } - else - { - t = parts[i].type = pstates[t].gas; - pv[y/CELL][x/CELL] += 0.50f; - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - } - } - if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) - { - float atemp = parts[i].temp + (-MIN_TEMP); - pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; - } - if(t==PT_LAVA) - { - parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - } - pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - } - } - if(t==PT_CSCN&&parts[i].temp>24.0f) - { - pt = parts[i].temp -= 2.5f; - } - if(t==PT_HSCN&&parts[i].temp>24.0f) - { - pt = parts[i].temp -= 2.5f; - } - - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) - { - nx = x % CELL; - if(nx == 0) - nx = x/CELL - 1; - else if(nx == CELL-1) - nx = x/CELL + 1; - else - nx = x/CELL; - ny = y % CELL; - if(ny == 0) - ny = y/CELL - 1; - else if(ny == CELL-1) - ny = y/CELL + 1; - else - ny = y/CELL; - if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ) - { - t = parts[i].type = PT_NONE; - parts[r>>8].ctype = parts[r>>8].type; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - } - else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) - { - pv[y/CELL][x/CELL] += 100.0f; - if(legacy_enable&&1>(rand()%200)) - { - parts[i].life = rand()%50+120; - t = parts[i].type = PT_FIRE; - } - else - { - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_ICEI || t==PT_SNOW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if(legacy_enable) - { - if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_ICEI; - parts[r>>8].type = PT_ICEI; - } - if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) - t = parts[i].type = PT_WATR; - } - } - } - else if(t==PT_HSCN||t==PT_CSCN) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) - { - parts[i].temp = 200.0f; - } - } - } - //PLANT - else if(t==PT_PLNT) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR && 1>(rand()%250)) - { - t = parts[i].type = PT_PLNT; - parts[r>>8].type = PT_PLNT; - } - else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_WATR||t==PT_DSTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%250)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_WATR; - } - if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_SLTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) - { - parts[r>>8].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_WTRV) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - parts[r>>8].type = PT_WATR; - } - - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - if(1>(rand()%1000)) - parts[r>>8].type = PT_WATR; - } - } - } - else if(t==PT_ACID) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)!=PT_ACID) - { - if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) - { - t = parts[i].type = PT_FIRE; - parts[i].life = 4; - parts[r>>8].type = PT_FIRE; - parts[r>>8].life = 4; - } - else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) - { - parts[i].life--; - parts[r>>8].type = PT_NONE; - } - else if (parts[i].life==50) - { - parts[i].life = 0; - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_NEUT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) - { - if(33>rand()%100) - { - create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); - } - else - { - create_part(r>>8, x+nx, y+ny, PT_NEUT); - parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; - parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; - } - pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough - fe ++; - } - if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) - parts[r>>8].type = PT_DUST; - if((r&0xFF)==PT_WATR && 15>(rand()%100)) - parts[r>>8].type = PT_DSTW; - if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) - parts[r>>8].type = PT_DFRM; - if((r&0xFF)==PT_NITR && 15>(rand()%1000)) - parts[r>>8].type = PT_OILL; - if((r&0xFF)==PT_OILL && 5>(rand()%1000)) - parts[r>>8].type = PT_GASS; - if((r&0xFF)==PT_PLNT && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - } - } - else if(t==PT_PHOT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=0; nx<1; nx++) - for(ny=0; ny<1; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - } - } - else if(t==PT_LCRY) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK) - { - if(parts[r>>8].ctype==PT_PSCN) - { - parts[i].life = 10; - } - else if(parts[r>>8].ctype==PT_NSCN) - { - parts[i].life = 9; - } - } - if(rt==PT_LCRY) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - else if(t==PT_BTRY) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(parts_avg(i,r>>8) != PT_INSL) - { - if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) - { - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - parts[r>>8].type = PT_SPRK; - } - } - } - } - if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)) || t ==PT_SWCH) - { - if(t==PT_SWCH) - if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) - { - parts[i].life--; - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) - continue; - rt = parts[r>>8].type; - if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && - ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) - { - parts[r>>8].type = PT_FIRE; - parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - parts[r>>8].life = rand()%80+180; - if(ptypes[rt].explosive) - pv[y/CELL][x/CELL] += 0.25f * CFDS; - continue; - } - lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; - if(lpv < 1) lpv = 1; - if(legacy_enable) - { - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && - ptypes[rt].meltable*lpv>(rand()%1000)) - { - if(t!=PT_LAVA || parts[i].life>0) - { - parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; - parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; - parts[r>>8].type = PT_LAVA; - parts[r>>8].life = rand()%120+240; - } - else - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) - { - parts[r>>8].type = PT_WATR; - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = PT_METL; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) - { - kill_part(r>>8); - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE; - goto killed; - } - } - } - pavg = parts_avg(i, r>>8); - if(t==PT_SWCH&&pavg!= PT_INSL) - { - if(parts[r>>8].type == PT_SWCH) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - if(rt==PT_SWCH && t==PT_SPRK) - { - pavg = parts_avg(r>>8, i); - if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) - parts[r>>8].life = 10; - if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) - parts[r>>8].life = 9; - if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].ctype = PT_SWCH; - parts[r>>8].life = 4; - } - } - pavg = parts_avg(i, r>>8); - if(pavg != PT_INSL) - { - if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) - parts[r>>8].temp = parts[r>>8].temp+10.0f; - } - } - if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 6; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 5; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) - { - if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) - { - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - - if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) - { - parts[i].life = rand()%150+50; - parts[i].type = PT_PLSM; - parts[i].ctype = PT_NBLE; - parts[i].temp = 3500; - pv[y/CELL][x/CELL] += 1; - } - if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) - { - parts[i].type = PT_SWCH; - parts[i].life = 11; - } - } - } -killed: - if(parts[i].type == PT_NONE) - continue; - } - - if(t==PT_STKM) - { - //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) - parts[i].temp += 1; - - //Death - if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... - { - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - //Verlet integration - pp = 2*player[3]-player[5]; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+1; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+1; - player[18] = player[16]; - player[16] = pp; - - //Go left - if (((int)(player[0])&0x01) == 0x01) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] += 3; - player[10] += 2; - player[5] += 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 3; - player[18] += 2; - player[13] +=2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[9] += 1; - player[10] += 1; - player[5] += 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 1; - player[18] += 1; - player[13] +=1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 3; - player[10] += 2; - player[5] -= 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 3; - player[18] += 2; - player[13] -= 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 1; - player[10] += 1; - player[5] -= 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 1; - player[18] += 1; - player[13] -= 1; - } - - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)) - { - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - create_part(-1, nx, ny, player[2]); - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 ) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - } - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[10] += 1; - player[18] += 1; - } - - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; - player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; - player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; - player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; - player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; - parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; - player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; - parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; - player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) - player[15] -= nx; - - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= 10+ny; - parts[i].vy = -10; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[7] += 0.2; - player[15] -= 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[3] += 0.2; - player[11] -= 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[16] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[8] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } - - if(t==PT_CLNE) - { - if(!parts[i].ctype) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx=XRES-CELL || - ny=YRES-CELL) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - continue; - } - - rt = parts[i].flags & FLAG_STAGNANT; - parts[i].flags &= ~FLAG_STAGNANT; - if(!try_move(i, x, y, nx, ny)) - { - parts[i].x = lx; - parts[i].y = ly; - if(ptypes[t].falldown) - { - if(nx!=x && try_move(i, x, y, nx, y)) - { - parts[i].x = ix; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x, ny)) - { - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else - { - r = (rand()%2)*2-1; - if(ny!=y && try_move(i, x, y, x+r, ny)) - { - parts[i].x += r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x-r, ny)) - { - parts[i].x -= r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y+r)) - { - parts[i].x = ix; - parts[i].y += r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y-r)) - { - parts[i].x = ix; - parts[i].y -= r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) - { - s = 0; - if(!rt || nt) - rt = 50; - else - rt = 10; - for(j=x+r; j>=0 && j>=x-rt && j0) - r = 1; - else - r = -1; - if(s) - for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; - if(nxy+ISTP) ny=y+ISTP; - if(ny(rand()%1000)) - { - kill_part(i); - continue; - } - else if(try_move(i, x, y, 2*x-nx, ny)) - { - parts[i].x = (float)(2*x-nx); - parts[i].y = (float)iy; - parts[i].vx *= ptypes[t].collision; - } - else if(try_move(i, x, y, nx, 2*y-ny)) - { - parts[i].x = (float)ix; - parts[i].y = (float)(2*y-ny); - parts[i].vy *= ptypes[t].collision; - } - else - { - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - } - } - -justdraw: - - nx = (int)(parts[i].x+0.5f); - ny = (int)(parts[i].y+0.5f); - - if(nx=XRES-CELL || - ny=YRES-CELL) - { - kill_part(i); - continue; - } - if(cmode!=CM_HEAT) - { - if(t==PT_STKM) //Just draw head here - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; - vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; - vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; - vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; - } - draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); - draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); - draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); - draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); - - isplayer = 1; //It's a secret. Tssss... - } - - if(t==PT_ACID) - { - if(parts[i].life>255) parts[i].life = 255; - if(parts[i].life<47) parts[i].life = 48; - s = (255/((parts[i].life-46)*28)); - if(s==0) s = 1; - cr = PIXR(ptypes[t].pcolors)/s; - cg = PIXG(ptypes[t].pcolors)/s; - cb = PIXB(ptypes[t].pcolors)/s; - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); - } - } - - if(cmode==4) - { - blendpixel(vid, nx+1, ny, cr, cg, cb, 223); - blendpixel(vid, nx-1, ny, cr, cg, cb, 223); - blendpixel(vid, nx, ny+1, cr, cg, cb, 223); - blendpixel(vid, nx, ny-1, cr, cg, cb, 223); - - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); - } - } - else if(t==PT_OILL) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,64,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,64,16,40); - } - } - } - else if(t==PT_NEUT) - { - if(cmode == 3||cmode==4) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 8; - cb = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = 0x20; - cg = 0xE0; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_PLUT) - { - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_URAN) - { - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_SLTW) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,80,240,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,80,240,50); - } - } - } - else if(t==PT_PHOT) - { - if(cmode == 3||cmode==4) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 12; - cb = 12; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_SWCH && parts[i].life == 10) - { - x = nx; - y = ny; - blendpixel(vid,x,y,17,217,24,255); - } - else if(t==PT_LNTG) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,128,160,223,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,128,160,223,50); - } - } - } - else if(t==PT_SMKE) - { - if(cmode == 3||cmode==4) - { - x = nx/CELL; - y = ny/CELL; - cg = 10; - cb = 10; - cr = 10; - cg += fire_g[y][x]; - if(cg > 50) cg = 50; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 50) cb = 50; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 50) cr = 50; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny,100,100,100,30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,100,100,100,10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,100,100,100,20); - } - } - } - } - else if(t==PT_WATR) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - - } - else if(t==PT_DSTW) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - } - else if(t==PT_NITR) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,224,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,224,16,50); - } - } - - } - else if(t==PT_LRBD) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,170,170,170,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,170,170,170,50); - } - } - - } - - else if(t==PT_NBLE) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,235,73,23,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,235,73,23,20); - } - } - - } - else if(t==PT_GASS) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,255,32,255); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,224,255,32,20); - } - } - - } - else if(t==PT_WTRV) - { - if(cmode == 3||cmode==4) - { - x = nx/CELL; - y = ny/CELL; - cg = PIXG(ptypes[t].pcolors)/3; - cb = PIXB(ptypes[t].pcolors)/3; - cr = PIXR(ptypes[t].pcolors)/3; - cg += fire_g[y][x]; - if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); - } - } - } - } - else if(t==PT_THDR) - { - if(cmode == 3||cmode==4) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 16; - cb = 20; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xA0; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LCRY) - { - if(cmode == 3||cmode==4) - { - //cr = R/8; - //cg = G/8; - //cb = B/8; - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); - //x = nx/CELL; - //y = ny/CELL; - //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } - else - { - cr = 0x50+(parts[i].life*10); - cg = 0x50+(parts[i].life*10); - cb = 0x50+(parts[i].life*10); - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_PLUT) { - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 5); - blendpixel(vid, nx-1, ny, cr, cg, cb, 5); - blendpixel(vid, nx, ny+1, cr, cg, cb, 5); - blendpixel(vid, nx, ny-1, cr, cg, cb, 5); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_URAN) - { - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 5); - blendpixel(vid, nx-1, ny, cr, cg, cb, 5); - blendpixel(vid, nx, ny+1, cr, cg, cb, 5); - blendpixel(vid, nx, ny-1, cr, cg, cb, 5); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_PLSM) - { - float ttemp = parts[i].life; - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = plasma_data[caddress]; - uint8 G = plasma_data[caddress+1]; - uint8 B = plasma_data[caddress+2]; - if(cmode == 3||cmode==4) - { - cr = R/8; - cg = G/8; - cb = B/8; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_FIRE && parts[i].life) - { - if(cmode == 3||cmode==4) - { - cr = parts[i].life / 4; - cg = parts[i].life / 16; - cb = parts[i].life / 32; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = parts[i].life * 8; - cg = parts[i].life * 2; - cb = parts[i].life; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LAVA && parts[i].life) - { - cr = parts[i].life * 2 + 0xE0; - cg = parts[i].life * 1 + 0x50; - cb = parts[i].life/2 + 0x10; - if(cr>255) cr = 255; - if(cg>192) cg = 192; - if(cb>128) cb = 128; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 64); - blendpixel(vid, nx-1, ny, cr, cg, cb, 64); - blendpixel(vid, nx, ny+1, cr, cg, cb, 64); - blendpixel(vid, nx, ny-1, cr, cg, cb, 64); - if(cmode == 3||cmode==4) - { - cr /= 32; - cg /= 32; - cb /= 32; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else if(t==PT_LAVA || t==PT_SPRK) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - if(cmode == 3 || cmode==4) - { - if(t == PT_LAVA) - { - cr = 3; - cg = i%2; - cb = 0; - } - else - { - cr = 8; - cg = 12; - cb = 16; - } - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - } - else - { - float ttemp = parts[i].temp+(-MIN_TEMP); - int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); - uint8 R = color_data[caddress]; - uint8 G = color_data[caddress+1]; - uint8 B = color_data[caddress+2]; - - if(t==PT_STKM) //Stick man should be visible in heat mode - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); - vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); - vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); - vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); - } - draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); - draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); - draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); - draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); - } - else - { - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); - //blendpixel(vid, nx+1, ny, R, G, B, 255); - } - } - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) - { - uint8 R = PIXR(ptypes[t].pcolors); - uint8 G = PIXG(ptypes[t].pcolors); - uint8 B = PIXB(ptypes[t].pcolors); - - //if(vid[(ny-1)*YRES+(nx-1)]!=0){ - // blendpixel(vid, nx, ny-1, R, G, B, 46); - //} - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); - } - - } - -} - -void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) -{ - blendpixel(vid, x+1, y, cr, cg, cb, 112); - blendpixel(vid, x-1, y, cr, cg, cb, 112); - blendpixel(vid, x, y+1, cr, cg, cb, 112); - blendpixel(vid, x, y-1, cr, cg, cb, 112); - - blendpixel(vid, x+1, y-1, cr, cg, cb, 64); - blendpixel(vid, x-1, y-1, cr, cg, cb, 64); - blendpixel(vid, x+1, y+1, cr, cg, cb, 64); - blendpixel(vid, x-1, y+1, cr, cg, cb, 64); -} - -void update_particles_i_th(void *arg) -{ - upstruc *newup = (upstruc*)arg; - update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); - return; -} - -void update_particles(pixel *vid) -{ - int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; - float lx, ly; -#ifdef MT - int pt = 0, pc = 0; - pthread_t *InterThreads; -#endif - - isplayer = 0; //Needed for player spawning - memset(pmap, 0, sizeof(pmap)); - r = rand()%2; - for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==13) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && !sys_pause) - emap[y][x] --; - } - } - } - else - { - for(y=0; y>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==9) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && !sys_pause) - emap[y][x] --; - } - } - } - -#ifdef MT - if(numCores > 1) - { - InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); - for(pc = 0; pc=XRES || ny<0 || ny>=YRES) - break; - addpixel(vid, nx, ny, 255, 255, 255, 64); - i = nx/CELL; - j = ny/CELL; - lx += vx[j][i]*0.125f; - ly += vy[j][i]*0.125f; - if(bmap[j][i]==5 && i!=x && j!=y) - break; - } - drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); - } - -} - -void update_particles_th(void *arg) -{ - update_particles((pixel*)arg); - return; -} - -/*********************************************************** - * SDL OUTPUT * - ***********************************************************/ - -int sdl_scale = 1; -SDL_Surface *sdl_scrn; -SDLMod sdl_mod; -int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; - -#include "icon.h" -void sdl_seticon(void) -{ -#ifdef WIN32 - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else -#ifdef MACOSX - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else - SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#endif -#endif -} - -void sdl_open(void) -{ - if(SDL_Init(SDL_INIT_VIDEO)<0) - { - fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); - exit(1); - } - atexit(SDL_Quit); -#ifdef PIX16 - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); -#else - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); -#endif - if(!sdl_scrn) - { - fprintf(stderr, "Creating window: %s\n", SDL_GetError()); - exit(1); - } - SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); - sdl_seticon(); - SDL_EnableUNICODE(1); - //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); -} - -void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0; jpitch/PIXELSIZE; - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} - -void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - int i,k; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0; jpitch/PIXELSIZE; - } - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} -void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) -{ - if(sdl_scale == 2) - sdl_blit_2(x, y, w, h, src, pitch); - else - sdl_blit_1(x, y, w, h, src, pitch); -} - -int frame_idx=0; -void dump_frame(pixel *src, int w, int h, int pitch) -{ - char frame_name[32]; - int j,i; - unsigned char c[3]; - FILE *f; - sprintf(frame_name,"frame%04d.ppm",frame_idx); - f=fopen(frame_name,"wb"); - fprintf(f,"P6\n%d %d\n255\n",w,h); - for(j=0; j=0 && x=0 && yPT_NUM) - return 2; - if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) - return 3; - i = XRES*YRES; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) - return 1; - size = i; - } - else - d = c; - - if(size < XRES*YRES) - { - if(bzip2) - free(d); - return 1; - } - - sy = 0; - for(y=0; y+scl<=YRES; y+=scl) - { - sx = 0; - for(x=0; x+scl<=XRES; x+=scl) - { - a = 0; - r = g = b = 0; - for(j=0; j=PT_NUM) - goto corrupt; - r += PIXR(ptypes[t].pcolors); - g += PIXG(ptypes[t].pcolors); - b += PIXB(ptypes[t].pcolors); - a ++; - } - } - if(a) - { - a = 256/a; - r = (r*a)>>8; - g = (g*a)>>8; - b = (b*a)>>8; - } - - drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); - sx++; - } - sy++; - } - - if(bzip2) - free(d); - return 0; - -corrupt: - if(bzip2) - free(d); - return 1; -} - -static char *mystrdup(char *s) -{ - char *x; - if(s) - { - x = malloc(strlen(s)+1); - strcpy(x, s); - return x; - } - return s; -} - -void *build_save(int *size, int x0, int y0, int w, int h) -{ - unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; - int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); - int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - // save the required air state - for(y=by0; y255) i=255; - d[p++] = i; - } - for(y=by0; y255) i=255; - d[p++] = i; - } - - // save the particle map - for(i=0; i=x0 && x=y0 && y255) x=255; - if(y<0) y=0; - if(y>255) y=255; - d[p++] = x; - d[p++] = y; - } - } - for(j=0; j255) tttemp=255; - d[p++] = tttemp; - } - } - for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; - d[p++] = (signs[i].y-y0); - d[p++] = (signs[i].y-y0)>>8; - d[p++] = signs[i].ju; - x = strlen(signs[i].text); - d[p++] = x; - memcpy(d+p, signs[i].text, x); - p+=x; - } - - i = (p*101+99)/100 + 612; - c = malloc(i); - c[0] = 0x66; - c[1] = 0x75; - c[2] = 0x43; - c[3] = legacy_enable; - c[4] = SAVE_VERSION; - c[5] = CELL; - c[6] = bw; - c[7] = bh; - c[8] = p; - c[9] = p >> 8; - c[10] = p >> 16; - c[11] = p >> 24; - - i -= 12; - - if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) - { - free(d); - free(c); - return NULL; - } - free(d); - - *size = i+12; - return c; -} - -int parse_save(void *save, int size, int replace, int x0, int y0) -{ - unsigned char *d,*c=save; - int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; - int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; - int fp[NPART], nf=0; - - if(size<16) - return 1; - if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) - return 1; - if(c[4]>SAVE_VERSION) - return 2; - ver = c[4]; - - if(ver<34) - { - legacy_enable = 1; - } - else - { - if(c[3]==1||c[3]==0) - legacy_enable = c[3]; - else - legacy_beta = 1; - } - - bw = c[6]; - bh = c[7]; - if(bx0+bw > XRES/CELL) - bx0 = XRES/CELL - bw; - if(by0+bh > YRES/CELL) - by0 = YRES/CELL - bh; - if(bx0 < 0) - bx0 = 0; - if(by0 < 0) - by0 = 0; - - if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) - return 3; - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - return 1; - size = i; - - if(size < bw*bh) - return 1; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - if(replace) - { - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(signs, 0, sizeof(signs)); - memset(parts, 0, sizeof(particle)*NPART); - memset(pmap, 0, sizeof(pmap)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(pv, 0, sizeof(pv)); - } - - // make a catalog of free parts - memset(pmap, 0, sizeof(pmap)); - for(i=0; i= size) - goto corrupt; - fvx[y][x] = (d[p++]-127.0f)/64.0f; - } - for(y=by0; y= size) - goto corrupt; - fvy[y][x] = (d[p++]-127.0f)/64.0f; - } - - // load the particle map - i = 0; - pty = p; - for(y=y0; y= size) - goto corrupt; - j=d[p++]; - if(j >= PT_NUM) - goto corrupt; - if(j && !(isplayer == 1 && j==PT_STKM)) - { - if(pmap[y][x]) - { - k = pmap[y][x]>>8; - parts[k].type = j; - parts[k].x = (float)x; - parts[k].y = (float)y; - m[(x-x0)+(y-y0)*w] = k+1; - } - else if(i < nf) - { - parts[fp[i]].type = j; - parts[fp[i]].x = (float)x; - parts[fp[i]].y = (float)y; - m[(x-x0)+(y-y0)*w] = fp[i]+1; - i++; - } - else - m[(x-x0)+(y-y0)*w] = NPART+1; - } - } - - // load particle properties - for(j=0; j= size) - goto corrupt; - if(i < NPART) - { - parts[i].vx = (d[p++]-127.0f)/16.0f; - parts[i].vy = (d[p++]-127.0f)/16.0f; - if(parts[i].type == PT_STKM) - { - player[2] = PT_DUST; - - player[3] = parts[i].x-1; //Setting legs positions - player[4] = parts[i].y+6; - player[5] = parts[i].x-1; - player[6] = parts[i].y+6; - - player[7] = parts[i].x-3; - player[8] = parts[i].y+12; - player[9] = parts[i].x-3; - player[10] = parts[i].y+12; - - player[11] = parts[i].x+1; - player[12] = parts[i].y+6; - player[13] = parts[i].x+1; - player[14] = parts[i].y+6; - - player[15] = parts[i].x+3; - player[16] = parts[i].y+12; - player[17] = parts[i].x+3; - player[18] = parts[i].y+12; - - } - } - else - p += 2; - } - } - for(j=0; j= size) - goto corrupt; - if(i <= NPART) - parts[i-1].life = d[p++]*4; - else - p++; - } - } - for(j=0; j=34&&legacy_beta==0) - { - if(p >= size) - { - goto corrupt; - } - if(i <= NPART) - { - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; - } - else - { - p++; - } - } - else - { - parts[i-1].temp = ptypes[parts[i-1].type].heat; - } - } - } - for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) - { - if(p >= size) - goto corrupt; - if(i <= NPART) - parts[i-1].ctype = d[p++]; - else - p++; - } - } - - if(p >= size) - goto version1; - j = d[p++]; - for(i=0; i size) - goto corrupt; - for(k=0; k size) - goto corrupt; - if(kSAVE_VERSION) - return NULL; - - bw = c[6]; - bh = c[7]; - w = bw*CELL; - h = bh*CELL; - - if(c[5]!=CELL) - return NULL; - - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return NULL; - fb = calloc(w*h, PIXELSIZE); - if(!fb) - { - free(d); - return NULL; - } - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - goto corrupt; - size = i; - - if(size < bw*bh) - goto corrupt; - - k = 0; - for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) - goto corrupt; - - for(y=0; y= size) - goto corrupt; - j=d[p++]; - if(j0) - { - if(j==PT_STKM) //Stickman should be drawed another way - { - //Stickman drawing - for(k=-2; k<=1; k++) - { - fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); - fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); - fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); - fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); - } - draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); - draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); - draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); - draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); - } - else - fb[y*w+x] = ptypes[j].pcolors; - } - } - - free(d); - *width = w; - *height = h; - return fb; - -corrupt: - free(d); - free(fb); - return NULL; -} - -/* NO, I DON'T THINK SO - #include "fbi.h" - - pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) - { - unsigned char *tmp; - pixel *res; - int i; - - tmp = malloc(width*height*3); - if(!tmp) - return NULL; - res = malloc(width*height*PIXELSIZE); - if(!res) { - free(tmp); - return NULL; - } - - i = width*height*3; - if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { - free(res); - free(tmp); - return NULL; - } - - for(i=0; i1) - { - r = (r+c/2)/c; - g = (g+c/2)/c; - b = (b+c/2)/c; - } - q[y*w+x] = PIXRGB(r, g, b); - } - *qw = w; - *qh = h; - return q; -} - -#define GRID_X 5 -#define GRID_Y 4 -#define GRID_P 3 -#define GRID_S 6 -#define GRID_Z 3 - -void stamp_gen_thumb(int i) -{ - char fn[64]; - void *data; - int size, factor_x, factor_y; - pixel *tmp; - - if(stamps[i].thumb) - { - free(stamps[i].thumb); - stamps[i].thumb = NULL; - } - - sprintf(fn, "stamps" PATH_SEP "%s.stm", stamps[i].name); - data = file_load(fn, &size); - - if(data) - { - stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); - if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) - { - factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); - factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); - if(factor_y > factor_x) - factor_x = factor_y; - tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); - free(stamps[i].thumb); - stamps[i].thumb = tmp; - } - } - - free(data); -} - -int clipboard_ready = 0; -void *clipboard_data = 0; -int clipboard_length = 0; - -void stamp_save(int x, int y, int w, int h) -{ - FILE *f; - int n; - char fn[64], sn[16]; - void *s=build_save(&n, x, y, w, h); - -#ifdef WIN32 - _mkdir("stamps"); -#else - mkdir("stamps", 0755); -#endif - - stamp_gen_name(sn); - sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); - - f = fopen(fn, "wb"); - if(!f) - return; - fwrite(s, n, 1, f); - fclose(f); - - free(s); - - if(stamps[STAMP_MAX-1].thumb) - free(stamps[STAMP_MAX-1].thumb); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); - memset(stamps, 0, sizeof(struct stamp_info)); - if(stamp_count0) - { - memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); - memcpy(stamps, &tmp, sizeof(struct stamp_info)); - - stamp_update(); - } - - return data; -} - -void stamp_init(void) -{ - int i; - FILE *f; - - memset(stamps, 0, sizeof(stamps)); - - f=fopen("stamps" PATH_SEP "stamps.def", "rb"); - if(!f) - return; - for(i=0; i=XRES+BARSIZE || y>=YRES+MENUSIZE) - return; - if(a!=255) - { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) -{ - int i, j, w, bn = 0, ba = 0; - char *rp = font_data + font_ptrs[c]; - w = *(rp++); - for(j=0; j>= 2; - bn -= 2; - } - return x + w; -} - -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) -{ - int sx = x; - for(; *s; s++) - { - if(*s == '\n') - { - x = sx; - y += FONT_H+2; - } - else if(*s == '\b') - { - switch(s[1]) - { - case 'w': - r = g = b = 255; - break; - case 'g': - r = g = b = 192; - break; - case 'o': - r = 255; - g = 216; - b = 32; - break; - case 'r': - r = 255; - g = b = 0; - break; - case 'b': - r = g = 0; - b = 255; - break; - } - s++; - } - else - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - return x; -} - -void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) -{ - int i; - for(i=0; i<=w; i++) - { - drawpixel(vid, x+i, y, r, g, b, a); - drawpixel(vid, x+i, y+h, r, g, b, a); - } - for(i=1; i=w && x+textwidth(s)>=w+5) - break; - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - if(*s) - for(i=0; i<3; i++) - x = drawchar(vid, x, y, '.', r, g, b, a); - return x; -} - -int textnwidth(char *s, int n) -{ - int x = 0; - for(; *s; s++) - { - if(!n) - break; - x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - n--; - } - return x-1; -} -int textwidthx(char *s, int w) -{ - int x=0,n=0,cw; - for(; *s; s++) - { - cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - if(x+(cw/2) >= w) - break; - x += cw; - n++; - } - return n; -} - -/*********************************************************** - * MAIN PROGRAM * - ***********************************************************/ - -void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) -{ - int x, y, i, j, c; - int bo = b; - if(iswall==1) - { - b = b-100; - x = (2+32*((b-22)/1)); - y = YRES+2+40; - switch(b) - { - case WL_WALLELEC: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - else - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) - { - for(i=1; i<6+j; i++) - { - if(!(i&j&1)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) - { - if(i&j&1) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) - { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<13; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) - { - for(i=14; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - default: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } - else - { - x = 2+32*(b/2); - y = YRES+2+20*(b%2); - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - if(bo==sl || bo==sr) - { - c = 0; - if(bo==sl) - c |= PIXPACK(0xFF0000); - if(bo==sr) - c |= PIXPACK(0x0000FF); - for(i=0; i<30; i++) - { - vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; - } - for(j=0; j<18; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; - } - } -} - -int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) -{ - int i, j, c; - if(b>=121) - { - b = b-100; - //x = (2+32*((b-22)/1)); - //y = YRES+2+40; - switch(b) - { - case WL_WALLELEC: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - else - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) - { - for(i=1; i<6+j; i++) - { - if(!(i&j&1)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) - { - if(i&j&1) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) - { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<13; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) - { - for(i=14; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - case 40: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - default: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } - else - { - //x = 2+32*(b/2); - //y = YRES+2+20*(b%2); - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - return 26; -} - -void draw_menu(pixel *vid_buf, int i, int hover) -{ - - //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); -#ifdef MENUV3 - drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - if(hover==i) - { - fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); - } -#else - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); -#endif -} - -void menu_ui(pixel *vid_buf, int i, int *sl, int *sr) -{ - int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; - pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); - fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); - memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - rows = ceil((float)msections[i].itemcount/16.0f); - height = (ceil((float)msections[i].itemcount/16.0f)*18); - width = restrict_flt(msections[i].itemcount*31, 0, 16*31); - //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); - h = -1; - x = XRES-BARSIZE-26; - y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; - sy = y; - //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); - fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); - fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); - drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); - if(i==SC_WALL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM) - { - if(x-26<=60) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=60) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=20) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - if(b==1&&h!=-1) - { - *sl = h; - } - if(b==4&&h!=-1) - { - *sr = h; - } -} - -int create_parts(int x, int y, int r, int c) -{ - int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; - - if(c == 125) - { - i = x / CELL; - j = y / CELL; - for(v=-1; v<2; v++) - for(u=-1; u<2; u++) - if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) - { - if(cp) - create_parts(y, x, r, c); - else - create_parts(x, y, r, c); - } - e -= 1.0f; - } - } -} - -void create_box(int x1, int y1, int x2, int y2, int c) -{ - int i, j; - if(x1>x2) - { - i = x2; - x2 = x1; - x1 = i; - } - if(y1>y2) - { - j = y2; - y2 = y1; - y1 = j; - } - for(j=y1; j<=y2; j++) - for(i=x1; i<=x2; i++) - create_parts(i, j, 1, c); -} - -int flood_parts(int x, int y, int c, int cm, int bm) -{ - int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) - { - c = c-100; - } - if(cm==-1) - { - if(c==0) - { - cm = pmap[y][x]&0xFF; - if(!cm) - return 0; - } - else - cm = 0; - } - if(bm==-1) - { - if(c==30) - { - bm = bmap[y/CELL][x/CELL]; - if(!bm) - return 0; - if(bm==1) - cm = 0xFF; - } - else - bm = 0; - } - - if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) - return 1; - - // go left as far as possible - x1 = x2 = x; - while(x1>=CELL) - { - if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) - break; - x1--; - } - while(x2=CELL+dy) - for(x=x1; x<=x2; x++) - if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) - if(!flood_parts(x, y-dy, co, cm, bm)) - return 0; - if(y=XRES || y>=YRES) - return; - c = vid[y*(XRES+BARSIZE)+x]; - c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); - if(c<512) - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); - else - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); -} - -void xor_line(int x1, int y1, int x2, int y2, pixel *vid) -{ - int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - e -= 1.0f; - } - } -} - -void draw_svf_ui(pixel *vid_buf) -{ - int c; - - drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); - drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - c = svf_open ? 255 : 128; - drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); - drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); - - c = svf_login ? 255 : 128; - drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); - if(svf_open) - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); - else - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); - drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); - if(svf_open && svf_own) - drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); - - c = (svf_login && svf_open) ? 255 : 128; - - drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - - if(svf_myvote==1 && (svf_login && svf_open)) - { - fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); - } - else if(svf_myvote==-1 && (svf_login && svf_open)) - { - fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); - } - - drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); - drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); - - drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); - if(svf_tags[0]) - drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); - else - drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); - - drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); - - drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); - drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); - if(svf_login) - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); - else - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); - drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); - - if(sys_pause) - { - fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); - drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - if(!legacy_enable) - { - fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - switch(cmode) - { - case 0: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); - break; - case 1: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); - break; - case 2: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); - break; - case 3: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); - break; - case 4: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); - break; - case 5: - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - break; - } - drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - - if(svf_admin) - { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); - } - else if(svf_mod) - { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - }//else if(amd) - // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? -} - -typedef struct ui_edit -{ - int x, y, w, nx; - char str[256],*def; - int focus, cursor, hide; -} ui_edit; -void ui_edit_draw(pixel *vid_buf, ui_edit *ed) -{ - int cx, i; - char echo[256], *str; - - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(ed->str[0]) - { - drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); - drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); - } - else if(!ed->focus) - drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); - if(ed->focus) - { - cx = textnwidth(str, ed->cursor); - for(i=-3; i<9; i++) - drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); - } -} -char *shift_0="`1234567890-=[]\\;',./"; -char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; -void ui_edit_process(int mx, int my, int mb, ui_edit *ed) -{ - char ch, ts[2], echo[256], *str; - int l, i; -#ifdef RAWINPUT - char *p; -#endif - - if(mb) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = 0; - ed->str[0] = 0; - } - else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = textwidthx(str, mx-ed->x); - } - else - ed->focus = 0; - } - if(ed->focus && sdl_key) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - l = strlen(ed->str); - switch(sdl_key) - { - case SDLK_HOME: - ed->cursor = 0; - break; - case SDLK_END: - ed->cursor = l; - break; - case SDLK_LEFT: - if(ed->cursor > 0) - ed->cursor --; - break; - case SDLK_RIGHT: - if(ed->cursor < l) - ed->cursor ++; - break; - case SDLK_DELETE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - ed->str[ed->cursor] = 0; - else if(ed->cursor < l) - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - break; - case SDLK_BACKSPACE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - { - if(ed->cursor > 0) - memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); - ed->cursor = 0; - } - else if(ed->cursor > 0) - { - ed->cursor--; - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - } - break; - default: -#ifdef RAWINPUT - if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) - { - ch = sdl_key; - if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) - { - if(ch>='a' && ch<='z') - ch &= ~0x20; - p = strchr(shift_0, ch); - if(p) - ch = shift_1[p-shift_0]; - } - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#else - if(sdl_ascii>=' ' && sdl_ascii<127) - { - ch = sdl_ascii; - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#endif - break; - } - } -} -typedef struct ui_checkbox -{ - int x, y; - int focus, checked; -} ui_checkbox; -void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) -{ - int w = 12; - if(ed->checked) - { - drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); - } - if(ed->focus) - { - drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); - } - else - { - drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); - } -} -void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) -{ - int w = 12; - - if(mb && !mbq) - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->checked = (ed->checked)?0:1; - } - } - else - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->focus = 1; - } - else - { - ed->focus = 0; - } - } -} - -void error_ui(pixel *vid_buf, int err, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - char *msg; - - msg = malloc(strlen(txt)+16); - if(err) - sprintf(msg, "%03d %s", err, txt); - else - sprintf(msg, "%s", txt); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - if(err) - drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); - else - drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - free(msg); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_ui(pixel *vid_buf, char *top, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); - drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_box(pixel *vid_buf, char *msg) -{ - int w = textwidth(msg)+16; - int x0=(XRES-w)/2,y0=(YRES-24)/2; - - clearrect(vid_buf, x0-2, y0-2, w+4, 28); - drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); -} - -int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - int ret = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); - drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); - drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); - drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) - { - ret = 1; - break; - } - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - { - ret = 1; - break; - } - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - return ret; -} - -int execute_tagop(pixel *vid_buf, char *op, char *tag) -{ - int status; - char *result; - - char *names[] = {"ID", "Tag", NULL}; - char *parts[2]; - - char *uri = malloc(strlen(SERVER)+strlen(op)+36); - sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); - - parts[0] = svf_id; - parts[1] = tag; - - result = http_multipart_post( - uri, - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - free(uri); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 1; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 1; - } - - if(result[2]) - { - strncpy(svf_tags, result+3, 255); - svf_id[15] = 0; - } - - if(result) - free(result); - - return 0; -} - -struct strlist -{ - char *str; - struct strlist *next; -}; -void strlist_add(struct strlist **list, char *str) -{ - struct strlist *item = malloc(sizeof(struct strlist)); - item->str = mystrdup(str); - item->next = *list; - *list = item; -} -int strlist_find(struct strlist **list, char *str) -{ - struct strlist *item; - for(item=*list; item; item=item->next) - if(!strcmp(item->str, str)) - return 1; - return 0; -} -void strlist_free(struct strlist **list) -{ - struct strlist *item; - while(*list) - { - item = *list; - *list = (*list)->next; - free(item); - } -} - -void tag_list_ui(pixel *vid_buf) -{ - int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; - char *p,*q,s; - char *tag=NULL, *op=NULL; - ui_edit ed; - struct strlist *vote=NULL,*down=NULL; - - ed.x = x0+25; - ed.y = y0+221; - ed.w = 158; - ed.nx = 1; - ed.def = "[new tag]"; - ed.focus = 0; - ed.hide = 0; - ed.cursor = 0; - strcpy(ed.str, ""); - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - op = tag = NULL; - - drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 256); - drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); - p = svf_tags; - s = svf_tags[0] ? ' ' : 0; - y = 36 + y0; - while(s) - { - q = strchr(p, ' '); - if(!q) - q = p+strlen(p); - s = *q; - *q = 0; - if(svf_own || svf_admin || svf_mod) - { - drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); - d = 14; - if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) - { - if(!ed1.focus) - break; - ed1.focus = 0; - ed2.focus = 1; - } - if(sdl_key==SDLK_ESCAPE) - { - if(!ed1.focus && !ed2.focus) - return; - ed1.focus = 0; - ed2.focus = 0; - } - } - - strcpy(svf_user, ed1.str); - md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); - - res = http_multipart_post( - "http://" SERVER "/Login.api", - NULL, NULL, NULL, - svf_user, svf_pass, - &err, NULL); - if(err != 200) - { - error_ui(vid_buf, err, http_ret_text(err)); - if(res) - free(res); - goto fail; - } - if(res && !strncmp(res, "OK", 2)) - { - if(!strcmp(res, "OK ADMIN")) - { - svf_admin = 1; - svf_mod = 0; - } - else if(!strcmp(res, "OK MOD")) - { - svf_admin = 0; - svf_mod = 1; - } - else - { - svf_admin = 0; - svf_mod = 0; - } - free(res); - svf_login = 1; - return; - } - if(!res) - res = mystrdup("Unspecified Error"); - error_ui(vid_buf, 0, res); - free(res); - -fail: - strcpy(svf_user, ""); - strcpy(svf_pass, ""); - svf_login = 0; - svf_own = 0; - svf_admin = 0; - svf_mod = 0; -} - -void execute_delete(pixel *vid_buf, char *id) -{ - int status; - char *result; - - char *names[] = {"ID", NULL}; - char *parts[1]; - - parts[0] = id; - - result = http_multipart_post( - "http://" SERVER "/Delete.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return; - } - - if(result) - free(result); -} - -int execute_vote(pixel *vid_buf, char *id, char *action) -{ - int status; - char *result; - - char *names[] = {"ID", "Action", NULL}; - char *parts[2]; - - parts[0] = id; - parts[1] = action; - - result = http_multipart_post( - "http://" SERVER "/Vote.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 0; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 0; - } - - if(result) - free(result); - return 1; -} - -static char hex[] = "0123456789ABCDEF"; -void strcaturl(char *dst, char *src) -{ - char *d; - unsigned char *s; - - for(d=dst; *d; d++) ; - - for(s=(unsigned char *)src; *s; s++) - { - if((*s>='0' && *s<='9') || - (*s>='a' && *s<='z') || - (*s>='A' && *s<='Z')) - *(d++) = *s; - else - { - *(d++) = '%'; - *(d++) = hex[*s>>4]; - *(d++) = hex[*s&15]; - } - } - *d = 0; -} - -#define THUMB_CACHE_SIZE 256 - -char *thumb_cache_id[THUMB_CACHE_SIZE]; -void *thumb_cache_data[THUMB_CACHE_SIZE]; -int thumb_cache_size[THUMB_CACHE_SIZE]; -int thumb_cache_lru[THUMB_CACHE_SIZE]; - -void thumb_cache_inval(char *id) -{ - int i,j; - for(i=0; i= THUMB_CACHE_SIZE) - return; - free(thumb_cache_id[i]); - free(thumb_cache_data[i]); - thumb_cache_id[i] = NULL; - for(j=0; j thumb_cache_lru[i]) - thumb_cache_lru[j]--; -} -void thumb_cache_add(char *id, void *thumb, int size) -{ - int i,m=-1,j=-1; - thumb_cache_inval(id); - for(i=0; i m) - { - m = thumb_cache_lru[i]; - j = i; - } - } - if(i >= THUMB_CACHE_SIZE) - { - thumb_cache_inval(thumb_cache_id[j]); - i = j; - } - for(j=0; j= THUMB_CACHE_SIZE) - return 0; - for(j=0; j=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str+5); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - else if(!strncmp(str, "TAG ", 4)) - { - if(j >= TAG_MAX) - { - str = p; - continue; - } - q = strchr(str+4, ' '); - if(!q) - { - str = p; - continue; - } - *(q++) = 0; - tag_names[j] = mystrdup(str+4); - tag_votes[j] = atoi(q); - j++; - } - else - { - if(i>=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - str = p; - } - if(*str) - i++; - return i; -} - -#define IMGCONNS 3 -#define TIMEOUT 100 -#define HTTP_TIMEOUT 10 - -int search_own = 0; -int search_date = 0; -int search_page = 0; -char search_expr[256] = ""; - -int search_ui(pixel *vid_buf) -{ - int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; - int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; - int thumb_drawn[GRID_X*GRID_Y]; - pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - float ry; - time_t http_last_use=HTTP_TIMEOUT; - ui_edit ed; - - - void *http = NULL; - int active = 0; - char *last = NULL; - int search = 0; - int lasttime = TIMEOUT; - char *uri; - int status; - char *results; - char *tmp, ts[64]; - - void *img_http[IMGCONNS]; - char *img_id[IMGCONNS]; - void *thumb, *data; - int thlen, dlen; - - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - - memset(img_http, 0, sizeof(img_http)); - memset(img_id, 0, sizeof(img_id)); - - memset(search_ids, 0, sizeof(search_ids)); - memset(search_names, 0, sizeof(search_names)); - memset(search_scoreup, 0, sizeof(search_scoreup)); - memset(search_scoredown, 0, sizeof(search_scoredown)); - memset(search_publish, 0, sizeof(search_publish)); - memset(search_owners, 0, sizeof(search_owners)); - memset(search_thumbs, 0, sizeof(search_thumbs)); - memset(search_thsizes, 0, sizeof(search_thsizes)); - - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - - do_open = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = 65; - ed.y = 13; - ed.w = XRES-200; - ed.nx = 1; - ed.def = "[search terms]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(search_expr); - strcpy(ed.str, search_expr); - - sdl_wheel = 0; - - while(!sdl_poll()) - { - uih = 0; - bq = b; - mxq = mx; - myq = my; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - if(mx!=mxq || my!=myq || sdl_wheel || b) - mmt = 0; - else if(mmt 9) - { - drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); - drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); - } - - ui_edit_draw(vid_buf, &ed); - - if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) - { - if(search_page) - { - search_page --; - lasttime = TIMEOUT; - } - sdl_wheel = 0; - uih = 1; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) - { - lasttime = TIMEOUT; - search_page ++; - page_count = exp_res; - } - sdl_wheel = 0; - uih = 1; - } - - tp = -1; - if(is_p1) - { - drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); - for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) - for(gi=0; giTAG_MAX || !tag_names[pos]) - break; - if(tag_votes[0]) - i = 127+(128*tag_votes[pos])/tag_votes[0]; - else - i = 192; - w = textwidth(tag_names[pos]); - if(w>XRES/GRID_X-5) - w = XRES/GRID_X-5; - gx = (XRES/GRID_X)*gi; - gy = gj*14 + 46; - if(mx>=gx && mx=gy && my XRES/GRID_X-10) - { - tmp = malloc(strlen(search_names[pos])+4); - strcpy(tmp, search_names[pos]); - j = textwidthx(tmp, XRES/GRID_X-15); - strcpy(tmp+j, "..."); - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); - free(tmp); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); - j = textwidth(search_owners[pos]); - if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && - my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) - { - st = 1; - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); - if(search_thumbs[pos]&&thumb_drawn[pos]==0) - { - render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); - thumb_drawn[pos] = 1; - } - own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); - if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) - mp = pos; - if(own) - { - if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) - { - mp = -1; - dp = pos; - } - } - if(mp==pos && !st) - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); - else - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); - if(own) - { - if(dp == pos) - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); - else - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); - } - if(!search_publish[pos]) - { - drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); - drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); - } - if(view_own || svf_admin || svf_mod) - { - sprintf(ts+1, "%d", search_votes[pos]); - ts[0] = 0xBB; - for(j=1; ts[j]; j++) - ts[j] = 0xBC; - ts[j-1] = 0xB9; - ts[j] = 0xBA; - ts[j+1] = 0; - w = gx+XRES/GRID_S-2-textwidth(ts); - h = gy+YRES/GRID_S-11; - drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); - for(j=0; ts[j]; j++) - ts[j] -= 14; - drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); - sprintf(ts, "%d", search_votes[pos]); - for(j=0; ts[j]; j++) - ts[j] += 127; - drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); - } - if(search_scoreup[pos]>0||search_scoredown[pos]>0) - { - lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); - - if(((YRES/GRID_S+3)/2)>lv) - { - ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); - if(lv<8) - { - ry = ry/(8-lv); - } - nyu = search_scoreup[pos]*ry; - nyd = search_scoredown[pos]*ry; - } - else - { - ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); - nyu = search_scoreup[pos]/ry; - nyd = search_scoredown[pos]/ry; - } - - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); - - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); - } - } - - if(mp!=-1 && mmt>=TIMEOUT/5 && !st) - { - gi = mp % GRID_X; - gj = mp / GRID_X; - if(is_p1) - gj += GRID_Y-GRID_P; - gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; - gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; - i = w = textwidth(search_names[mp]); - h = YRES/GRID_Z+30; - if(w=XRES-2) gx=XRES-3-w; - if(gy<32) gy=32; - if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; - clearrect(vid_buf, gx-2, gy-3, w+4, h); - drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); - if(search_thumbs[mp]) - render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); - drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); - drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); - } - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(sdl_key==SDLK_RETURN) - { - if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) - lasttime = TIMEOUT; - else if(search_ids[0] && !search_ids[1]) - { - bq = 0; - b = 1; - mp = 0; - } - } - if(sdl_key==SDLK_ESCAPE) - goto finish; - - if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) - { - search_own = !search_own; - lasttime = TIMEOUT; - } - if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) - { - search_date = !search_date; - lasttime = TIMEOUT; - } - - if(b && !bq && dp!=-1) - if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) - { - execute_delete(vid_buf, search_ids[dp]); - lasttime = TIMEOUT; - if(last) - { - free(last); - last = NULL; - } - } - - if(b && !bq && tp!=-1) - { - strncpy(ed.str, tag_names[tp], 255); - lasttime = TIMEOUT; - } - - if(b && !bq && mp!=-1 && st) - { - sprintf(ed.str, "user:%s", search_owners[mp]); - lasttime = TIMEOUT; - } - - if(do_open==1) - { - mp = 0; - } - - if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) - { - fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); - info_box(vid_buf, "Loading..."); - - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - data = http_simple_get(uri, &status, &dlen); - free(uri); - - if(status == 200) - { - status = parse_save(data, dlen, 1, 0, 0); - switch(status) - { - case 1: - error_ui(vid_buf, 0, "Simulation corrupted"); - break; - case 2: - error_ui(vid_buf, 0, "Simulation from a newer version"); - break; - case 3: - error_ui(vid_buf, 0, "Simulation on a too large grid"); - break; - } - if(!status) - { - char *tnames[] = {"ID", NULL}; - char *tparts[1]; - int tplens[1]; - if(svf_last) - free(svf_last); - svf_last = data; - svf_lsize = dlen; - - tparts[0] = search_ids[mp]; - tplens[0] = strlen(search_ids[mp]); - data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); - - svf_open = 1; - svf_own = svf_login && !strcmp(search_owners[mp], svf_user); - svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); - - strcpy(svf_id, search_ids[mp]); - strcpy(svf_name, search_names[mp]); - if(status == 200) - { - if(data) - { - strncpy(svf_tags, data, 255); - svf_tags[255] = 0; - } - else - svf_tags[0] = 0; - } - else - { - svf_tags[0] = 0; - } - - if(svf_login) - { - char *names[] = {"ID", NULL}; - char *parts[1]; - parts[0] = search_ids[mp]; - data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); - if(status == 200) - { - if(data) - { - if(!strcmp(data, "Up")) - { - svf_myvote = 1; - } - else if(!strcmp(data, "Down")) - { - svf_myvote = -1; - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - } - else - { - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - } - } - else - error_ui(vid_buf, status, http_ret_text(status)); - - if(data) - free(data); - goto finish; - } - - if(!last) - { - search = 1; - } - else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) - { - search = 1; - if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) - { - search_page = 0; - page_count = 0; - } - free(last); - last = NULL; - } - else - search = 0; - - if(search && lasttime>=TIMEOUT) - { - lasttime = 0; - last = mystrdup(ed.str); - last_own = search_own; - last_date = search_date; - last_page = search_page; - active = 1; - uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); - if(search_own || svf_admin || svf_mod) - tmp = "&ShowVotes=true"; - else - tmp = ""; - if(!search_own && !search_date && !*last) - { - if(search_page) - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); - } - else - { - exp_res = GRID_X*GRID_P; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); - } - } - else - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); - } - strcaturl(uri, last); - if(search_own) - { - strcaturl(uri, " user:"); - strcaturl(uri, svf_user); - } - if(search_date) - strcaturl(uri, " sort:date"); - - http = http_async_req_start(http, uri, NULL, 0, 1); - if(svf_login) - { - http_auth_headers(http, svf_user, svf_pass); - } - http_last_use = time(NULL); - free(uri); - } - - if(active && http_async_req_status(http)) - { - http_last_use = time(NULL); - results = http_async_req_stop(http, &status, NULL); - view_own = last_own; - if(status == 200) - { - page_count = search_results(results, last_own||svf_admin||svf_mod); - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - } - is_p1 = (exp_res < GRID_X*GRID_Y); - free(results); - active = 0; - } - - if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) - { - http_async_req_close(http); - http = NULL; - } - - for(i=0; i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) - { - if(stamp_page) - { - stamp_page --; - } - sdl_wheel = 0; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; -} - -void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) -{ - char t[2]; - t[0] = ch; - t[1] = 0; - if(flag) - { - fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); - } - else - { - drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); - } -} - -void render_signs(pixel *vid_buf) -{ - int i, j, x, y, w, h, dx, dy; - char buff[30]; //Buffer - for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature - else - sprintf(buff, "Temp: 0.00"); //...tempirature - drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); - } - - //Usual text - if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) - drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); - x = signs[i].x; - y = signs[i].y; - dx = 1 - signs[i].ju; - dy = (signs[i].y > 18) ? -1 : 1; - for(j=0; j<4; j++) - { - drawpixel(vid_buf, x, y, 192, 192, 192, 255); - x+=dx; - y+=dy; - } - } -} - -void add_sign_ui(pixel *vid_buf, int mx, int my) -{ - int i, w, h, x, y, nm=0, ju; - int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; - ui_edit ed; - - // check if it is an existing sign - for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) - break; - } - // else look for empty spot - if(i >= MAXSIGNS) - { - nm = 1; - for(i=0; i= MAXSIGNS) - return; - - if(nm) - { - signs[i].x = mx; - signs[i].y = my; - signs[i].ju = 1; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = x0+25; - ed.y = y0+25; - ed.w = 158; - ed.nx = 1; - ed.def = "[message]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(signs[i].text); - strcpy(ed.str, signs[i].text); - ju = signs[i].ju; - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 80); - drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); - ui_edit_draw(vid_buf, &ed); - drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); - draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); - draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); - draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); - - if(!nm) - { - drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); - drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); - drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); - } - - drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) - ju = 0; - if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) - ju = 1; - if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) - ju = 2; - - if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) - { - signs[i].text[0] = 0; - return; - } - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - { - if(!ed.focus) - return; - ed.focus = 0; - } - } - - strcpy(signs[i].text, ed.str); - signs[i].ju = ju; -} - -/*********************************************************** - * CONFIG FILE * - ***********************************************************/ - -char http_proxy[256] = ""; - -void save_string(FILE *f, char *str) -{ - int li = strlen(str); - unsigned char lb[2]; - lb[0] = li; - lb[1] = li >> 8; - fwrite(lb, 2, 1, f); - fwrite(str, li, 1, f); -} - -int load_string(FILE *f, char *str, int max) -{ - int li; - unsigned char lb[2]; - fread(lb, 2, 1, f); - li = lb[0] | (lb[1] << 8); - if(li > max) - { - str[0] = 0; - return 1; - } - fread(str, li, 1, f); - str[li] = 0; - return 0; -} - -unsigned char last_major=0, last_minor=0, update_flag=0; - -void save_presets(int do_update) -{ - FILE *f=fopen("powder.def", "wb"); - unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; - unsigned char tmp = sdl_scale; - if(!f) - return; - fwrite(sig, 1, 4, f); - save_string(f, svf_user); - save_string(f, svf_pass); - fwrite(&tmp, 1, 1, f); - tmp = cmode; - fwrite(&tmp, 1, 1, f); - tmp = svf_admin; - fwrite(&tmp, 1, 1, f); - tmp = svf_mod; - fwrite(&tmp, 1, 1, f); - save_string(f, http_proxy); - tmp = SAVE_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = MINOR_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = do_update; - fwrite(&tmp, 1, 1, f); - fclose(f); -} - -void load_presets(void) -{ - FILE *f=fopen("powder.def", "rb"); - unsigned char sig[4], tmp; - if(!f) - return; - fread(sig, 1, 4, f); - if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) - { - if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) - { - if(fseek(f, -3, SEEK_END)) - { - remove("powder.def"); - return; - } - if(fread(sig, 1, 3, f) != 3) - { - remove("powder.def"); - goto fail; - } - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; - } - fclose(f); - remove("powder.def"); - return; - } - if(load_string(f, svf_user, 63)) - goto fail; - if(load_string(f, svf_pass, 63)) - goto fail; - svf_login = !!svf_user[0]; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - sdl_scale = (tmp == 2) ? 2 : 1; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - cmode = tmp%6; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_admin = tmp; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_mod = tmp; - if(load_string(f, http_proxy, 255)) - goto fail; - if(fread(sig, 1, 3, f) != 3) - goto fail; - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; -fail: - fclose(f); -} - -void dim_copy(pixel *dst, pixel *src) -{ - int i,r,g,b; - for(i=0; i0) - r--; - if(g>0) - g--; - if(b>0) - b--; - dst[i] = PIXRGB(r,g,b); - } -} - -unsigned int fire_alpha[CELL*3][CELL*3]; -void prepare_alpha(void) -{ - int x,y,i,j; - float temp[CELL*3][CELL*3]; - memset(temp, 0, sizeof(temp)); - for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; - fire_g[j][i] = g>4 ? g-4 : 0; - fire_b[j][i] = b>4 ? b-4 : 0; - } -} - -int zoom_en = 0; -int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; -int zoom_wx=0, zoom_wy=0; -void render_zoom(pixel *img) -{ - int x, y, i, j; - pixel pix; - drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); - drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); - clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); - for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) - { - xor_pixel(x+i, y+j, vid); - if(j) xor_pixel(x+i, y-j, vid); - if(i) xor_pixel(x-i, y+j, vid); - if(i&&j) xor_pixel(x-i, y-j, vid); - } - } - else - { - int tc; - c = (r/CELL) * CELL; - x = (x/CELL) * CELL; - y = (y/CELL) * CELL; - - tc = !((c%(CELL*2))==0); - - x -= c/2; - y -= c/2; - - x += tc*(CELL/2); - y += tc*(CELL/2); - - for(i=0; i2) - { - pthread_t pth; - pthread_create(&pth,NULL,update_air_th,""); - } - else - { - update_air(); - } -#else - update_air(); -#endif - } - if(cmode==0 || cmode==1) - { - draw_air(vid_buf); - } - else if(cmode==2) - { - memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); - memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); - } - else - { - memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); - } - update_particles(vid_buf); - - if(cmode==2) - { - if(!fire_fc) - { - dim_copy(fire_bg, vid_buf); - } - else - { - memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); - } - fire_fc = (fire_fc+1) % 3; - } - if(cmode==3||cmode==4) - render_fire(vid_buf); - - render_signs(vid_buf); - - memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); - clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); - - draw_svf_ui(vid_buf); - - if(http_ver_check) - { - if(!do_check && http_async_req_status(http_ver_check)) - { - ver_data = http_async_req_stop(http_ver_check, &http_ret, NULL); - if(http_ret==200 && ver_data) - { -#ifdef BETA - if(sscanf(ver_data, "%d.%d.%d", &major, &minor, &is_beta)==3) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) - old_version = 1; -#else - if(sscanf(ver_data, "%d.%d", &major, &minor)==2) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) - old_version = 1; -#endif - free(ver_data); - } - http_ver_check = NULL; - } - do_check = (do_check+1) & 15; - } - - if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) - { - if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) - { - break; - } - } - if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) - { - if(load_mode) - { - free(load_img); - free(load_data); - load_mode = 0; - load_data = NULL; - load_img = NULL; - } - if(it > 50) - it = 50; - if(sdl_key=='k' && stamps[1].name[0]) - { - j = stamp_ui(vid_buf); - if(j>=0) - load_data = stamp_load(j, &load_size); - else - load_data = NULL; - } - else - load_data = stamp_load(0, &load_size); - if(load_data) - { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - if(sdl_key=='s') - { - if(it > 50) - it = 50; - save_mode = 1; - } - if(sdl_key=='1') - { - set_cmode(0); - } - if(sdl_key=='2') - { - set_cmode(1); - } - if(sdl_key=='3') - { - set_cmode(2); - } - if(sdl_key=='4') - { - set_cmode(3); - } - if(sdl_key=='5') - { - set_cmode(4); - } - if(sdl_key=='6') - { - set_cmode(5); - } - if(sdl_key==SDLK_SPACE) - sys_pause = !sys_pause; - if(sdl_key=='h') - hud_enable = !hud_enable; - if(sdl_key=='p') - dump_frame(vid_buf, XRES, YRES, XRES); - if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - if(clipboard_ready==1) - { - load_data = malloc(clipboard_length); - memcpy(load_data, clipboard_data, clipboard_length); - load_size = clipboard_length; - if(load_data) - { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - } - if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 2; - } - if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 1; - } - else if(sdl_key=='c') - { - set_cmode((cmode+1) % 6); - if(it > 50) - it = 50; - } - if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo - { - int cbx, cby, cbi; - - for(cbi=0; cbi32) - ZSIZE = 32; - if(ZSIZE<2) - ZSIZE = 2; - ZFACTOR = 256/ZSIZE; - sdl_wheel = 0; - } - else - { - bs += sdl_wheel; - if(bs>16) - bs = 16; - if(bs<0) - bs = 0; - sdl_wheel = 0; - /*if(su >= PT_NUM) { - if(sl < PT_NUM) - su = sl; - if(sr < PT_NUM) - su = sr; - }*/ - } - } - - bq = b; - b = SDL_GetMouseState(&x, &y); - - for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy - && x0 && y0 && x>8)>=NPART || !cr)) - { -#ifdef BETA - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); -#else - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); -#endif - } - else - { - sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); - } - } - mx = x; - my = y; - if(update_flag) - { - info_box(vid_buf, "Finalizing update..."); - if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) - { - update_cleanup(); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } - else - { - if(update_finish()) - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - else - info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); - } - update_flag = 0; - } - - if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && - x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) - { - tmp = malloc(64); -#ifdef BETA - if(is_beta) - { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); - } - else - { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); - } -#else - sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); -#endif - if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) - { - free(tmp); - tmp = download_ui(vid_buf, my_uri, &i); - if(tmp) - { - save_presets(1); - if(update_start(tmp, i)) - { - update_cleanup(); - save_presets(0); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } - else - return 0; - } - } - else - free(tmp); - } - if(y>=sdl_scale*(YRES+(MENUSIZE-20))) - { - if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) - { - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } - else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) - { - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } - else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) - { - db = (svf_myvote==1) ? 273 : 274; - if(da < 51) - da ++; - } - else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) - { - db = svf_own ? 257 : 256; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) - { - db = 270; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) - { - db = 266; - if(da < 51) - da ++; - } - else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) - { - db = 259; - if(svf_open && svf_own && x<=55*sdl_scale) - db = 258; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) - { - db = svf_login ? 261 : 260; - if(svf_admin) - { - db = 268; - } - else if(svf_mod) - { - db = 271; - } - if(da < 51) - da ++; - } - else if(x>=sdl_scale && x<=17*sdl_scale) - { - db = 262; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) - { - db = sys_pause ? 264 : 263; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) - { - db = 267; - if(da < 51) - da ++; - } - else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) - { - db = 265; - if(da < 51) - da ++; - } - else if(da > 0) - da --; - } - else if(da > 0) - da --; - - if(!sdl_zoom_trig && zoom_en==1) - zoom_en = 0; - - if(sdl_key==Z_keysym && zoom_en==2) - zoom_en = 1; - - if(load_mode) - { - load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); - load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); - if(load_x+load_w>XRES) load_x=XRES-load_w; - if(load_y+load_h>YRES) load_y=YRES-load_h; - if(load_x<0) load_x=0; - if(load_y<0) load_y=0; - if(bq==1 && !b) - { - parse_save(load_data, load_size, 0, load_x, load_y); - free(load_data); - free(load_img); - load_mode = 0; - } - else if(bq==4 && !b) - { - free(load_data); - free(load_img); - load_mode = 0; - } - } - else if(save_mode==1) - { - save_x = (mx/sdl_scale)/CELL; - save_y = (my/sdl_scale)/CELL; - if(save_x >= XRES/CELL) save_x = XRES/CELL-1; - if(save_y >= YRES/CELL) save_y = YRES/CELL-1; - save_w = 1; - save_h = 1; - if(b==1) - { - save_mode = 2; - } - else if(b==4) - { - save_mode = 0; - copy_mode = 0; - } - } - else if(save_mode==2) - { - save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; - save_h = (my/sdl_scale+CELL/2)/CELL - save_y; - if(save_w>XRES/CELL) save_w = XRES/CELL; - if(save_h>YRES/CELL) save_h = YRES/CELL; - if(save_w<1) save_w = 1; - if(save_h<1) save_h = 1; - if(!b) - { - if(copy_mode==1) - { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - } - else if(copy_mode==2) - { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - } - else - { - stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - save_mode = 0; - } - } - } - else if(sdl_zoom_trig && zoom_en<2) - { - x /= sdl_scale; - y /= sdl_scale; - x -= ZSIZE/2; - y -= ZSIZE/2; - if(x<0) x=0; - if(y<0) y=0; - if(x>XRES-ZSIZE) x=XRES-ZSIZE; - if(y>YRES-ZSIZE) y=YRES-ZSIZE; - zoom_x = x; - zoom_y = y; - zoom_wx = (x 50) - it = 50; - x /= sdl_scale; - y /= sdl_scale; - if(y>=YRES+(MENUSIZE-20)) - { - if(!lb) - { - if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) - { - if(execute_vote(vid_buf, svf_id, "Up")) - { - svf_myvote = 1; - } - } - if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) - { - if(execute_vote(vid_buf, svf_id, "Down")) - { - svf_myvote = -1; - } - } - if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) - tag_list_ui(vid_buf); - if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) - { - legacy_enable = !legacy_enable; - } - if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) - { - memset(signs, 0, sizeof(signs)); - memset(pv, 0, sizeof(pv)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(fvx, 0, sizeof(fvx)); - memset(fvy, 0, sizeof(fvy)); - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(parts, 0, sizeof(particle)*NPART); - for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) - { - login_ui(vid_buf); - if(svf_login) - save_presets(0); - } - if(x>=37 && x<=187 && svf_login) - { - if(!svf_open || !svf_own || x>51) - { - if(save_name_ui(vid_buf)) - execute_save(vid_buf); - } - else - execute_save(vid_buf); - while(!sdl_poll()) - if(!SDL_GetMouseState(&x, &y)) - break; - b = bq = 0; - } - if(x>=1 && x<=17) - { - search_ui(vid_buf); - memset(fire_bg, 0, XRES*YRES*PIXELSIZE); - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - } - if(x>=19 && x<=35 && svf_last && svf_open) - parse_save(svf_last, svf_lsize, 1, 0, 0); - if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) - { - if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 6); - if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+5) % 6); - save_presets(0); - } - if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) - sys_pause = !sys_pause; - lb = 0; - } - } - else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) - { - c = sl = cr&0xFF; - } - else - { - //Something - } - } - //create_parts(x, y, bs, SPC_AIR); - lx = x; - ly = y; - lb = 0; - lm = 0; - } - else - { - //Copy state before drawing any particles (for undo) - int cbx, cby, cbi; - - for(cbi=0; cbi=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) - create_line(lx, ly, x, y, bs, c); - } - else - create_box(lx, ly, x, y, c); - lm = 0; - } - lb = 0; - } - - if(load_mode) - { - draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); - xor_rect(vid_buf, load_x, load_y, load_w, load_h); - } - - if(save_mode) - { - xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - da = 51; - db = 269; - } - - if(zoom_en!=1 && !load_mode && !save_mode) - { - render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); - mousex = mx/sdl_scale; - mousey = my/sdl_scale; - } - - if(zoom_en) - render_zoom(vid_buf); - - if(da) - switch(db) - { - case 256: - drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); - break; - case 257: - drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); - break; - case 258: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); - break; - case 259: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); - break; - case 260: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); - break; - case 261: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); - break; - case 262: - drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); - break; - case 263: - drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); - break; - case 264: - drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); - break; - case 265: - drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); - break; - case 266: - drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); - break; - case 267: - drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); - break; - case 268: - drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); - break; - case 269: - drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); - break; - case 270: - drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); - break; - case 271: - drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); - break; - case 272: - drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); - break; - case 273: - drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); - break; - case 274: - drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); - break; - case 275: - drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); - break; - default: - drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); - } - if(itc) - { - itc--; - drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); - } - if(it) - { - it--; - //if(fbi_img) - //draw_image(vid_buf, fbi_img, (XRES-FBI_W)/2, (YRES-FBI_H)/2+25, FBI_W, FBI_H, it>12?64:it*5); - drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); - } - - if(old_version) - { - clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); -#ifdef BETA - if(is_beta) - { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); - } - else - { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); - } -#else - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); -#endif - drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); - } - /*#ifdef MT - pthread_join(pth2,NULL); - #endif*/ - - if(hud_enable) - { - currentTime = SDL_GetTicks(); - if(currentTime-past>=16) - { - past = SDL_GetTicks(); - FPS++; - } - if(currentTime-pastFPS>=1000) - { -#ifdef BETA - sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#else - sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#endif - FPSB = FPS; - FPS = 0; - pastFPS = currentTime; - } - if(sdl_zoom_trig||zoom_en) - { - if(zoom_x +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#else +#include +#include +#endif + + +#include "version.h" +#include "http.h" +#include "md5.h" +#include "update.h" +#include "hmap.h" + +#define SERVER "powdertoy.co.uk" + +#undef PLOSS + +#ifdef MENUV3 +#define MENUSIZE 40 +#else +#define MENUSIZE 20 +#endif +#define BARSIZE 14 +#define XRES 612 +#define YRES 384 +#define NPART XRES*YRES + +#define ZSIZE_D 16 +#define ZFACTOR_D 8 +unsigned char ZFACTOR = 256/ZSIZE_D; +unsigned char ZSIZE = ZSIZE_D; + +#define CELL 4 +#define ISTP (CELL/2) +#define CFDS (4.0f/CELL) + +typedef unsigned char uint8; + +#ifdef PIX16 +#define PIXELSIZE 2 +typedef unsigned short pixel; +#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) +#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) +#define PIXR(x) (((x)>>8)&0xF8) +#define PIXG(x) (((x)>>3)&0xFC) +#define PIXB(x) (((x)<<3)&0xF8) +#else +#define PIXELSIZE 4 +typedef unsigned int pixel; +#ifdef PIX32BGR +#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) +#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) +#define PIXR(x) ((x)&0xFF) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)>>16) +#else +#ifdef PIX32BGRA +#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) +#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) +#define PIXR(x) (((x)>>8)&0xFF) +#define PIXG(x) (((x)>>16)&0xFF) +#define PIXB(x) (((x)>>24)) +#else +#define PIXPACK(x) (x) +#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) +#define PIXR(x) ((x)>>16) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)&0xFF) +#endif +#endif +#endif + +char *it_msg = + "\brThe Powder Toy\n" + "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" + "\n" + "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" + "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" + "\bgPick your material from the menu using mouse left/right buttons.\n" + "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" + "Shift+drag will create straight lines of particles.\n" + "Ctrl+drag will result in filled rectangles.\n" + "Ctrl+Shift+click will flood-fill a closed area.\n" + "Ctrl+Z will act as Undo.\n" + "Middle click or Alt+Click to \"sample\" the particles.\n" + "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" + "Use 'S' to save parts of the window as 'stamps'.\n" + "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" + "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" + "Use the mouse scroll wheel to change the tool size for particles.\n" + "'Q' will quit the application.\n" + "The spacebar can be used to pause physics.\n" + "'P' will take a screenshot and save it into the current directory.\n" + "\n" + "\brhttp://powdertoy.co.uk/\n" + "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" + "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" + "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" + "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" + "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" + "\n" + "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" + "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" + ; + +typedef struct +{ + int start, inc; + pixel *vid; +} upstruc; + +#ifdef BETA +char *old_ver_msg_beta = "A new beta is available - click here!"; +#endif +char *old_ver_msg = "A new version is available - click here!"; +float mheat = 0.0f; + +int do_open = 0; +int sys_pause = 0; +int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. + +int amd = 0; + +unsigned char fire_r[YRES/CELL][XRES/CELL]; +unsigned char fire_g[YRES/CELL][XRES/CELL]; +unsigned char fire_b[YRES/CELL][XRES/CELL]; + +#define MAXSIGNS 16 + +struct sign +{ + int x,y,ju; + char text[256]; +} signs[MAXSIGNS]; + +/*********************************************************** + * AIR FLOW SIMULATOR * + ***********************************************************/ + +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; + +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; + +unsigned cmode = 3; + +float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float cb_vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float cb_vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float cb_pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; +#define TSTEPP 0.3f +#define TSTEPV 0.4f +#define VADV 0.3f +#define VLOSS 0.999f +#define PLOSS 0.9999f +int numCores = 1; +float kernel[9]; +void make_kernel(void) +{ + int i, j; + float s = 0.0f; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + { + kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); + s += kernel[(i+1)+3*(j+1)]; + } + s = 1.0f / s; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + kernel[(i+1)+3*(j+1)] *= s; +} + +int core_count() +{ + int numCPU = 1; +#ifdef MT +#ifdef WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + numCPU = sysinfo.dwNumberOfProcessors; +#else +#ifdef MACOSX + numCPU = 4; +#else + numCPU = sysconf( _SC_NPROCESSORS_ONLN ); +#endif +#endif + + printf("Cpus: %d\n", numCPU); + if(numCPU>1) + printf("Multithreading enabled\n"); + else + printf("Multithreading disabled\n"); +#endif + return numCPU; +} + +void update_air(void) +{ + int x, y, i, j; + float dp, dx, dy, f, tx, ty; + + for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; + if(dp < -256.0f) dp = -256.0f; + if(dx > 256.0f) dx = 256.0f; + if(dx < -256.0f) dx = -256.0f; + if(dy > 256.0f) dy = 256.0f; + if(dy < -256.0f) dy = -256.0f; + + ovx[y][x] = dx; + ovy[y][x] = dy; + opv[y][x] = dp; + } + memcpy(vx, ovx, sizeof(vx)); + memcpy(vy, ovy, sizeof(vy)); + memcpy(pv, opv, sizeof(pv)); +} + +void *update_air_th(void *arg) +{ + update_air(); + return NULL; +} + +inline unsigned clamp_flt(float f, float min, float max) +{ + if(fmax) + return 255; + return (int)(255.0f*(f-min)/(max-min)); +} + +inline float restrict_flt(float f, float min, float max) +{ + if(fmax) + return max; + return f; +} + +void draw_air(pixel *vid) +{ + int x, y, i, j; + pixel c; + + if(cmode == 2) + return; + + for(y=0; y 0.0f) + c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); + else + c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); + } + else + c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), + clamp_flt(pv[y][x], 0.0f, 8.0f), + clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); + for(j=0; j=XRES || ny>=YRES) + return 0; + if(x==nx && y==ny) + return 1; + r = pmap[ny][nx]; + if(r && (r>>8)>8].type; + + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) + { + return 1; + } + + if((r&0xFF)==PT_VOID) + { + parts[i].type=PT_NONE; + return 0; + } + if((r&0xFF)==PT_BHOL) + { + parts[i].type=PT_NONE; + if(!legacy_enable) + { + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; + } + return 0; + } + + if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide + { + return 1; + } + + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) + { + return 1; + } + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) + { + return 0; + } + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) + { + return 0; + } + + if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; + if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + return 0; + if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) + return 0; + + if(parts[i].type==PT_CNCT && y>8)>= 8; + parts[r].x += x-nx; + parts[r].y += y-ny; + } + + return 1; +} + +void kill_part(int i) +{ + int x, y; + parts[i].type = PT_NONE; + + x = (int)(parts[i].x+0.5f); + y = (int)(parts[i].y+0.5f); + + if(x>=0 && y>=0 && x=XRES || y>=YRES) + return -1; + + if(t==SPC_HEAT||t==SPC_COOL) + { + if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + } + if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) + { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + } + return pmap[y][x]>>8; + } + else + { + return -1; + } + } + if(t==SPC_AIR) + { + pv[y/CELL][x/CELL] += 0.03f; + if(y+CELL>8].type = PT_SPRK; + parts[pmap[y][x]>>8].life = 4; + parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; + pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; + return pmap[y][x]>>8; + } + + if(p==-1) + { + if(pmap[y][x]) + return -1; + if(pfree == -1) + return -1; + i = pfree; + pfree = parts[i].life; + } + else + i = p; + + if(t==PT_GLAS) + { + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + } + if(t!=PT_STKM) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + } + if(t==PT_ACID) + { + parts[i].life = 75; + } + //Testing + /*if(t==PT_WOOD){ + parts[i].life = 150; + }*/ + //End Testing + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_PLSM) + parts[i].life = rand()%150+50; + if(t==PT_LAVA) + parts[i].life = rand()%120+240; + if(t==PT_NBLE) + parts[i].life = 0; + if(t==PT_NEUT) + { + float r = (rand()%128+128)/127.0f; + float a = (rand()%360)*3.14159f/180.0f; + parts[i].life = rand()%480+480; + parts[i].vx = r*cosf(a); + parts[i].vy = r*sinf(a); + } + if(t==PT_PHOT) + { + float r = (rand()%3-1)*3; + float a = (rand()%3-1)*3; + parts[i].life = 680; + if(a==0.0f&&r==0.0f) + { + parts[i].life = 0; + parts[i].type = PT_NONE; + return -1; + } + else + { + parts[i].vx = a; + parts[i].vy = r; + } + //} else { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + //} + } + + if(t!=PT_STKM) + pmap[y][x] = t|(i<<8); + else + { + if(isplayer==0) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + player[2] = PT_DUST; + player[3] = x-1; //Setting legs positions + player[4] = y+6; + player[5] = x-1; + player[6] = y+6; + + player[7] = x-3; + player[8] = y+12; + player[9] = x-3; + player[10] = y+12; + + player[11] = x+1; + player[12] = y+6; + player[13] = x+1; + player[14] = y+6; + + player[15] = x+3; + player[16] = y+12; + player[17] = x+3; + player[18] = y+12; + + isplayer = 1; + } + } + + return i; +} + +void delete_part(int x, int y) +{ + unsigned i; + + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + i = pmap[y][x]; + if(!i || (i>>8)>=NPART) + return; + + kill_part(i>>8); + pmap[y][x] = 0; // just in case +} + +inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +int sign(float i) //Signum function +{ + if (i<0) + return -1; + if (i>0) + return 1; + return 0; +} + +void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a) //Draws a line +{ + int dx, dy, i, sx, sy, check, e, x, y; + + dx = abs(x1-x2); + dy = abs(y1-y2); + sx = sign(x2-x1); + sy = sign(y2-y1); + x = x1; + y = y1; + check = 0; + + if (dy>dx) + { + dx = dx+dy; + dy = dx-dy; + dx = dx-dy; + check = 1; + } + + e = (dy<<2)-dx; + for (i=0; i<=dx; i++) + { + vid[x+y*a] =PIXRGB(r, g, b); + if (e>=0) + { + if (check==1) + x = x+sx; + else + y = y+sy; + e = e-(dx<<2); + } + if (check==1) + y = y+sy; + else + x = x+sx; + e = e+(dy<<2); + } +} + +void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + 255*PIXR(t)) >> 8; + g = (a*g + 255*PIXG(t)) >> 8; + b = (a*b + 255*PIXB(t)) >> 8; + if(r>255) + r = 255; + if(g>255) + g = 255; + if(b>255) + b = 255; + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); + +int is_wire(int x, int y) +{ + return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; +} +int is_wire_off(int x, int y) +{ + return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; +} + +void set_emap(int x, int y) +{ + int x1, x2; + + if(!is_wire_off(x, y)) + return; + + // go left as far as possible + x1 = x2 = x; + while(x1>0) + { + if(!is_wire_off(x1-1, y)) + break; + x1--; + } + while(x21 && x1==x2 && + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + set_emap(x1, y-2); + else if(y>0) + for(x=x1; x<=x2; x++) + if(is_wire_off(x, y-1)) + { + if(x==x1 || x==x2 || y>=YRES/CELL-1 || + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + set_emap(x, y-1); + } + + if(y>8) < NPART && (pmr>>8) >= 0) + { + return parts[pmr>>8].type; + } + else + { + return PT_NONE; + } +} +int nearest_part(int ci, int t) +{ + int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); + int ndistance = 0; + int id = -1; + int i = 0; + int cx = (int)parts[ci].x; + int cy = (int)parts[ci].y; + for(i=0; i=XRES || y>=YRES || + ((bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) + { + kill_part(i); + continue; + } + + vx[y/CELL][x/CELL] *= ptypes[t].airloss; + vy[y/CELL][x/CELL] *= ptypes[t].airloss; + vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + if(t==PT_GASS||t==PT_NBLE) + { + if(pv[y/CELL][x/CELL]<3.5f) + pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); + if(y+CELL2.5f) + { + parts[i].life = rand()%80+180; + rt = parts[i].type = PT_FIRE; + parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + pv[y/CELL][x/CELL] += 0.25f * CFDS; + t = PT_FIRE; + } + + parts[i].vx *= ptypes[t].loss; + parts[i].vy *= ptypes[t].loss; + + if(t==PT_DFRM && !parts[i].life) + { + if(pv[y/CELL][x/CELL]>1.0f) + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].life = rand()%80+300; + } + } + else + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + + if(ptypes[t].diffusion) + { + parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + } + + // interpolator +#ifdef WIN32 + mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#else + mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#endif + if(mv < ISTP) + { + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + } + else + { + dx = parts[i].vx*ISTP/mv; + dy = parts[i].vy*ISTP/mv; + ix = parts[i].x; + iy = parts[i].y; + while(1) + { + mv -= ISTP; + if(mv <= 0.0f) + { + // nothing found + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + break; + } + ix += dx; + iy += dy; + nx = (int)(ix+0.5f); + ny = (int)(iy+0.5f); + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) + { + parts[i].x = ix; + parts[i].y = iy; + break; + } + } + } + + a = nt = 0; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx4.0f) + t = parts[i].type = PT_DSTW; + if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) + t = parts[i].type = PT_OILL; + if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) + t = parts[i].type = PT_GASS; + } + if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) + t = parts[i].type = PT_BRMT; + //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) + // t = parts[i].type = PT_BGLA; + if(t==PT_GLAS) + { + parts[i].pavg[0] = parts[i].pavg[1]; + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) + { + parts[i].type = PT_BGLA; + } + } + if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) + t = parts[i].type = PT_SNOW; + if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) + { + t = PT_NEUT; + create_part(i, x, y, t); + } + + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) + { + nearp = nearest_part(i, PT_ETRD); + if(nearp!=-1) + { + create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[nearp].type = PT_SPRK; + parts[nearp].life = 9; + parts[nearp].ctype = PT_ETRD; + } + } + + if(!legacy_enable) + { + int ctemp = pv[y/CELL][x/CELL]*2; + c_heat = 0.0f; + h_count = 0; + if(ptypes[t].hconduct>(rand()%250)) + { + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + h_count++; + c_heat += parts[r>>8].temp; + } + } + } + } + pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + parts[r>>8].temp = parts[i].temp; + } + } + } + } + if(pt>=pstates[t].btemp&&pstates[t].burn) + { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE||t==PT_PLSM) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) + { + if(t==PT_LAVA&&parts[i].ctype) + { + parts[i].life = 0; + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) + { + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } + else + { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } + else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) + { + if(pstates[t].liquid==PT_LAVA) + { + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } + else if(t==PT_ICEI&&parts[i].ctype) + { + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else + { + t = parts[i].type = pstates[t].liquid; + } + } + else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) + { + t = parts[i].type = pstates[t].liquid; + } + else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) + { + if(t==PT_SLTW&&1>rand()%6) + { + t = parts[i].type = PT_SALT; + } + else + { + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) + { + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA) + { + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } + } + if(t==PT_CSCN&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + if(t==PT_HSCN&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) + { + nx = x % CELL; + if(nx == 0) + nx = x/CELL - 1; + else if(nx == CELL-1) + nx = x/CELL + 1; + else + nx = x/CELL; + ny = y % CELL; + if(ny == 0) + ny = y/CELL - 1; + else if(ny == CELL-1) + ny = y/CELL + 1; + else + ny = y/CELL; + if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ) + { + t = parts[i].type = PT_NONE; + parts[r>>8].ctype = parts[r>>8].type; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + } + else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) + { + pv[y/CELL][x/CELL] += 100.0f; + if(legacy_enable&&1>(rand()%200)) + { + parts[i].life = rand()%50+120; + t = parts[i].type = PT_FIRE; + } + else + { + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_ICEI || t==PT_SNOW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if(legacy_enable) + { + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; + } + } + } + else if(t==PT_HSCN||t==PT_CSCN) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) + { + parts[i].temp = 200.0f; + } + } + } + //PLANT + else if(t==PT_PLNT) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR && 1>(rand()%250)) + { + t = parts[i].type = PT_PLNT; + parts[r>>8].type = PT_PLNT; + } + else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WATR||t==PT_DSTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%250)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_WATR; + } + if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_SLTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) + { + parts[r>>8].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_WTRV) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + parts[r>>8].type = PT_WATR; + } + + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; + } + } + } + else if(t==PT_ACID) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)!=PT_ACID) + { + if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) + { + t = parts[i].type = PT_FIRE; + parts[i].life = 4; + parts[r>>8].type = PT_FIRE; + parts[r>>8].life = 4; + } + else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) + { + parts[i].life--; + parts[r>>8].type = PT_NONE; + } + else if (parts[i].life==50) + { + parts[i].life = 0; + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_NEUT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) + { + if(33>rand()%100) + { + create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); + } + else + { + create_part(r>>8, x+nx, y+ny, PT_NEUT); + parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; + parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; + } + pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + fe ++; + } + if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + parts[r>>8].type = PT_DUST; + if((r&0xFF)==PT_WATR && 15>(rand()%100)) + parts[r>>8].type = PT_DSTW; + if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) + parts[r>>8].type = PT_DFRM; + if((r&0xFF)==PT_NITR && 15>(rand()%1000)) + parts[r>>8].type = PT_OILL; + if((r&0xFF)==PT_OILL && 5>(rand()%1000)) + parts[r>>8].type = PT_GASS; + if((r&0xFF)==PT_PLNT && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + } + } + else if(t==PT_PHOT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=0; nx<1; nx++) + for(ny=0; ny<1; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + } + } + else if(t==PT_LCRY) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_LCRY) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_BTRY) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts_avg(i,r>>8) != PT_INSL) + { + if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) + { + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + parts[r>>8].type = PT_SPRK; + } + } + } + } + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)) || t ==PT_SWCH) + { + if(t==PT_SWCH) + if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) + { + parts[i].life--; + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) + continue; + rt = parts[r>>8].type; + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL) || t!=PT_SPRK) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) + { + parts[r>>8].type = PT_FIRE; + parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + parts[r>>8].life = rand()%80+180; + if(ptypes[rt].explosive) + pv[y/CELL][x/CELL] += 0.25f * CFDS; + continue; + } + lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; + if(lpv < 1) lpv = 1; + if(legacy_enable) + { + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && + ptypes[rt].meltable*lpv>(rand()%1000)) + { + if(t!=PT_LAVA || parts[i].life>0) + { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } + else + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) + { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = PT_METL; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) + { + kill_part(r>>8); + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE; + goto killed; + } + } + } + pavg = parts_avg(i, r>>8); + if(t==PT_SWCH&&pavg!= PT_INSL) + { + if(parts[r>>8].type == PT_SWCH) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + if(rt==PT_SWCH && t==PT_SPRK) + { + pavg = parts_avg(r>>8, i); + if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) + parts[r>>8].life = 10; + if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) + parts[r>>8].life = 9; + if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].ctype = PT_SWCH; + parts[r>>8].life = 4; + } + } + pavg = parts_avg(i, r>>8); + if(pavg != PT_INSL) + { + if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) + parts[r>>8].temp = parts[r>>8].temp+10.0f; + } + } + if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 6; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 5; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) + { + if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) + { + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) + { + parts[i].life = rand()%150+50; + parts[i].type = PT_PLSM; + parts[i].ctype = PT_NBLE; + parts[i].temp = 3500; + pv[y/CELL][x/CELL] += 1; + } + if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) + { + parts[i].type = PT_SWCH; + parts[i].life = 11; + } + } + } +killed: + if(parts[i].type == PT_NONE) + continue; + } + + if(t==PT_STKM) + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; + player[10] += 2; + player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; + player[18] += 2; + player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; + player[10] += 1; + player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; + player[18] += 1; + player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; + player[10] += 2; + player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; + player[18] += 2; + player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; + player[10] += 1; + player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; + player[18] += 1; + player[13] -= 1; + } + + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) + || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 ) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + } + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[10] += 1; + player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } + + if(t==PT_CLNE) + { + if(!parts[i].ctype) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx=XRES-CELL || + ny=YRES-CELL) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + continue; + } + + rt = parts[i].flags & FLAG_STAGNANT; + parts[i].flags &= ~FLAG_STAGNANT; + if(!try_move(i, x, y, nx, ny)) + { + parts[i].x = lx; + parts[i].y = ly; + if(ptypes[t].falldown) + { + if(nx!=x && try_move(i, x, y, nx, y)) + { + parts[i].x = ix; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x, ny)) + { + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else + { + r = (rand()%2)*2-1; + if(ny!=y && try_move(i, x, y, x+r, ny)) + { + parts[i].x += r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x-r, ny)) + { + parts[i].x -= r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y+r)) + { + parts[i].x = ix; + parts[i].y += r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y-r)) + { + parts[i].x = ix; + parts[i].y -= r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) + { + s = 0; + if(!rt || nt) + rt = 50; + else + rt = 10; + for(j=x+r; j>=0 && j>=x-rt && j0) + r = 1; + else + r = -1; + if(s) + for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny(rand()%1000)) + { + kill_part(i); + continue; + } + else if(try_move(i, x, y, 2*x-nx, ny)) + { + parts[i].x = (float)(2*x-nx); + parts[i].y = (float)iy; + parts[i].vx *= ptypes[t].collision; + } + else if(try_move(i, x, y, nx, 2*y-ny)) + { + parts[i].x = (float)ix; + parts[i].y = (float)(2*y-ny); + parts[i].vy *= ptypes[t].collision; + } + else + { + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + } + } + +justdraw: + + nx = (int)(parts[i].x+0.5f); + ny = (int)(parts[i].y+0.5f); + + if(nx=XRES-CELL || + ny=YRES-CELL) + { + kill_part(i); + continue; + } + if(cmode!=CM_HEAT) + { + if(t==PT_STKM) //Just draw head here + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; + vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; + vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; + vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; + } + draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); + draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); + draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); + draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); + + isplayer = 1; //It's a secret. Tssss... + } + + if(t==PT_ACID) + { + if(parts[i].life>255) parts[i].life = 255; + if(parts[i].life<47) parts[i].life = 48; + s = (255/((parts[i].life-46)*28)); + if(s==0) s = 1; + cr = PIXR(ptypes[t].pcolors)/s; + cg = PIXG(ptypes[t].pcolors)/s; + cb = PIXB(ptypes[t].pcolors)/s; + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); + } + } + + if(cmode==4) + { + blendpixel(vid, nx+1, ny, cr, cg, cb, 223); + blendpixel(vid, nx-1, ny, cr, cg, cb, 223); + blendpixel(vid, nx, ny+1, cr, cg, cb, 223); + blendpixel(vid, nx, ny-1, cr, cg, cb, 223); + + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); + } + } + else if(t==PT_OILL) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,64,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,64,16,40); + } + } + } + else if(t==PT_NEUT) + { + if(cmode == 3||cmode==4) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 8; + cb = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = 0x20; + cg = 0xE0; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLUT) + { + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_URAN) + { + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_SLTW) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,80,240,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,80,240,50); + } + } + } + else if(t==PT_PHOT) + { + if(cmode == 3||cmode==4) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 12; + cb = 12; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_SWCH && parts[i].life == 10) + { + x = nx; + y = ny; + blendpixel(vid,x,y,17,217,24,255); + } + else if(t==PT_LNTG) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,128,160,223,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,128,160,223,50); + } + } + } + else if(t==PT_SMKE) + { + if(cmode == 3||cmode==4) + { + x = nx/CELL; + y = ny/CELL; + cg = 10; + cb = 10; + cr = 10; + cg += fire_g[y][x]; + if(cg > 50) cg = 50; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 50) cb = 50; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 50) cr = 50; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,100,100,100,30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,100,100,100,10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,100,100,100,20); + } + } + } + } + else if(t==PT_WATR) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + + } + else if(t==PT_DSTW) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + } + else if(t==PT_NITR) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,224,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,224,16,50); + } + } + + } + else if(t==PT_LRBD) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,170,170,170,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,170,170,170,50); + } + } + + } + + else if(t==PT_NBLE) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,235,73,23,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,235,73,23,20); + } + } + + } + else if(t==PT_GASS) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,224,255,32,255); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,224,255,32,20); + } + } + + } + else if(t==PT_WTRV) + { + if(cmode == 3||cmode==4) + { + x = nx/CELL; + y = ny/CELL; + cg = PIXG(ptypes[t].pcolors)/3; + cb = PIXB(ptypes[t].pcolors)/3; + cr = PIXR(ptypes[t].pcolors)/3; + cg += fire_g[y][x]; + if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); + } + } + } + } + else if(t==PT_THDR) + { + if(cmode == 3||cmode==4) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 16; + cb = 20; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xA0; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LCRY) + { + if(cmode == 3||cmode==4) + { + //cr = R/8; + //cg = G/8; + //cb = B/8; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); + //x = nx/CELL; + //y = ny/CELL; + //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } + else + { + cr = 0x50+(parts[i].life*10); + cg = 0x50+(parts[i].life*10); + cb = 0x50+(parts[i].life*10); + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLUT) { + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 5); + blendpixel(vid, nx-1, ny, cr, cg, cb, 5); + blendpixel(vid, nx, ny+1, cr, cg, cb, 5); + blendpixel(vid, nx, ny-1, cr, cg, cb, 5); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_URAN) + { + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 5); + blendpixel(vid, nx-1, ny, cr, cg, cb, 5); + blendpixel(vid, nx, ny+1, cr, cg, cb, 5); + blendpixel(vid, nx, ny-1, cr, cg, cb, 5); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_PLSM) + { + float ttemp = parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = plasma_data[caddress]; + uint8 G = plasma_data[caddress+1]; + uint8 B = plasma_data[caddress+2]; + if(cmode == 3||cmode==4) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_FIRE && parts[i].life) + { + if(cmode == 3||cmode==4) + { + cr = parts[i].life / 4; + cg = parts[i].life / 16; + cb = parts[i].life / 32; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = parts[i].life * 8; + cg = parts[i].life * 2; + cb = parts[i].life; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LAVA && parts[i].life) + { + cr = parts[i].life * 2 + 0xE0; + cg = parts[i].life * 1 + 0x50; + cb = parts[i].life/2 + 0x10; + if(cr>255) cr = 255; + if(cg>192) cg = 192; + if(cb>128) cb = 128; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 64); + blendpixel(vid, nx-1, ny, cr, cg, cb, 64); + blendpixel(vid, nx, ny+1, cr, cg, cb, 64); + blendpixel(vid, nx, ny-1, cr, cg, cb, 64); + if(cmode == 3||cmode==4) + { + cr /= 32; + cg /= 32; + cb /= 32; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else if(t==PT_LAVA || t==PT_SPRK) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + if(cmode == 3 || cmode==4) + { + if(t == PT_LAVA) + { + cr = 3; + cg = i%2; + cb = 0; + } + else + { + cr = 8; + cg = 12; + cb = 16; + } + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + } + else + { + float ttemp = parts[i].temp+(-MIN_TEMP); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); + uint8 R = color_data[caddress]; + uint8 G = color_data[caddress+1]; + uint8 B = color_data[caddress+2]; + + if(t==PT_STKM) //Stick man should be visible in heat mode + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); + vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); + vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); + vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); + } + draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); + draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); + draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); + draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); + } + else + { + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); + //blendpixel(vid, nx+1, ny, R, G, B, 255); + } + } + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) + { + uint8 R = PIXR(ptypes[t].pcolors); + uint8 G = PIXG(ptypes[t].pcolors); + uint8 B = PIXB(ptypes[t].pcolors); + + //if(vid[(ny-1)*YRES+(nx-1)]!=0){ + // blendpixel(vid, nx, ny-1, R, G, B, 46); + //} + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + + } + +} + +void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) +{ + blendpixel(vid, x+1, y, cr, cg, cb, 112); + blendpixel(vid, x-1, y, cr, cg, cb, 112); + blendpixel(vid, x, y+1, cr, cg, cb, 112); + blendpixel(vid, x, y-1, cr, cg, cb, 112); + + blendpixel(vid, x+1, y-1, cr, cg, cb, 64); + blendpixel(vid, x-1, y-1, cr, cg, cb, 64); + blendpixel(vid, x+1, y+1, cr, cg, cb, 64); + blendpixel(vid, x-1, y+1, cr, cg, cb, 64); +} + +void update_particles_i_th(void *arg) +{ + upstruc *newup = (upstruc*)arg; + update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); + return; +} + +void update_particles(pixel *vid) +{ + int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; + float lx, ly; +#ifdef MT + int pt = 0, pc = 0; + pthread_t *InterThreads; +#endif + + isplayer = 0; //Needed for player spawning + memset(pmap, 0, sizeof(pmap)); + r = rand()%2; + for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==13) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } + else + { + for(y=0; y>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==9) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } + +#ifdef MT + if(numCores > 1) + { + InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); + for(pc = 0; pc=XRES || ny<0 || ny>=YRES) + break; + addpixel(vid, nx, ny, 255, 255, 255, 64); + i = nx/CELL; + j = ny/CELL; + lx += vx[j][i]*0.125f; + ly += vy[j][i]*0.125f; + if(bmap[j][i]==5 && i!=x && j!=y) + break; + } + drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); + } + +} + +void update_particles_th(void *arg) +{ + update_particles((pixel*)arg); + return; +} + +/*********************************************************** + * SDL OUTPUT * + ***********************************************************/ + +int sdl_scale = 1; +SDL_Surface *sdl_scrn; +SDLMod sdl_mod; +int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; + +#include "icon.h" +void sdl_seticon(void) +{ +#ifdef WIN32 + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else +#ifdef MACOSX + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else + SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#endif +#endif +} + +void sdl_open(void) +{ + if(SDL_Init(SDL_INIT_VIDEO)<0) + { + fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); + exit(1); + } + atexit(SDL_Quit); +#ifdef PIX16 + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); +#else + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); +#endif + if(!sdl_scrn) + { + fprintf(stderr, "Creating window: %s\n", SDL_GetError()); + exit(1); + } + SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); + sdl_seticon(); + SDL_EnableUNICODE(1); + //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); +} + +void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0; jpitch/PIXELSIZE; + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} + +void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + int i,k; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0; jpitch/PIXELSIZE; + } + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} +void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) +{ + if(sdl_scale == 2) + sdl_blit_2(x, y, w, h, src, pitch); + else + sdl_blit_1(x, y, w, h, src, pitch); +} + +int frame_idx=0; +void dump_frame(pixel *src, int w, int h, int pitch) +{ + char frame_name[32]; + int j,i; + unsigned char c[3]; + FILE *f; + sprintf(frame_name,"frame%04d.ppm",frame_idx); + f=fopen(frame_name,"wb"); + fprintf(f,"P6\n%d %d\n255\n",w,h); + for(j=0; j=0 && x=0 && yPT_NUM) + return 2; + if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) + return 3; + i = XRES*YRES; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) + return 1; + size = i; + } + else + d = c; + + if(size < XRES*YRES) + { + if(bzip2) + free(d); + return 1; + } + + sy = 0; + for(y=0; y+scl<=YRES; y+=scl) + { + sx = 0; + for(x=0; x+scl<=XRES; x+=scl) + { + a = 0; + r = g = b = 0; + for(j=0; j=PT_NUM) + goto corrupt; + r += PIXR(ptypes[t].pcolors); + g += PIXG(ptypes[t].pcolors); + b += PIXB(ptypes[t].pcolors); + a ++; + } + } + if(a) + { + a = 256/a; + r = (r*a)>>8; + g = (g*a)>>8; + b = (b*a)>>8; + } + + drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); + sx++; + } + sy++; + } + + if(bzip2) + free(d); + return 0; + +corrupt: + if(bzip2) + free(d); + return 1; +} + +static char *mystrdup(char *s) +{ + char *x; + if(s) + { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; + } + return s; +} + +void *build_save(int *size, int x0, int y0, int w, int h) +{ + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; + int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); + int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + // save the required air state + for(y=by0; y255) i=255; + d[p++] = i; + } + for(y=by0; y255) i=255; + d[p++] = i; + } + + // save the particle map + for(i=0; i=x0 && x=y0 && y255) x=255; + if(y<0) y=0; + if(y>255) y=255; + d[p++] = x; + d[p++] = y; + } + } + for(j=0; j255) tttemp=255; + d[p++] = tttemp; + } + } + for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; + d[p++] = (signs[i].y-y0); + d[p++] = (signs[i].y-y0)>>8; + d[p++] = signs[i].ju; + x = strlen(signs[i].text); + d[p++] = x; + memcpy(d+p, signs[i].text, x); + p+=x; + } + + i = (p*101+99)/100 + 612; + c = malloc(i); + c[0] = 0x66; + c[1] = 0x75; + c[2] = 0x43; + c[3] = legacy_enable; + c[4] = SAVE_VERSION; + c[5] = CELL; + c[6] = bw; + c[7] = bh; + c[8] = p; + c[9] = p >> 8; + c[10] = p >> 16; + c[11] = p >> 24; + + i -= 12; + + if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) + { + free(d); + free(c); + return NULL; + } + free(d); + + *size = i+12; + return c; +} + +int parse_save(void *save, int size, int replace, int x0, int y0) +{ + unsigned char *d,*c=save; + int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; + int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; + int fp[NPART], nf=0; + + if(size<16) + return 1; + if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) + return 1; + if(c[4]>SAVE_VERSION) + return 2; + ver = c[4]; + + if(ver<34) + { + legacy_enable = 1; + } + else + { + if(c[3]==1||c[3]==0) + legacy_enable = c[3]; + else + legacy_beta = 1; + } + + bw = c[6]; + bh = c[7]; + if(bx0+bw > XRES/CELL) + bx0 = XRES/CELL - bw; + if(by0+bh > YRES/CELL) + by0 = YRES/CELL - bh; + if(bx0 < 0) + bx0 = 0; + if(by0 < 0) + by0 = 0; + + if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) + return 3; + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + return 1; + size = i; + + if(size < bw*bh) + return 1; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + if(replace) + { + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(signs, 0, sizeof(signs)); + memset(parts, 0, sizeof(particle)*NPART); + memset(pmap, 0, sizeof(pmap)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(pv, 0, sizeof(pv)); + } + + // make a catalog of free parts + memset(pmap, 0, sizeof(pmap)); + for(i=0; i= size) + goto corrupt; + fvx[y][x] = (d[p++]-127.0f)/64.0f; + } + for(y=by0; y= size) + goto corrupt; + fvy[y][x] = (d[p++]-127.0f)/64.0f; + } + + // load the particle map + i = 0; + pty = p; + for(y=y0; y= size) + goto corrupt; + j=d[p++]; + if(j >= PT_NUM) + goto corrupt; + if(j && !(isplayer == 1 && j==PT_STKM)) + { + if(pmap[y][x]) + { + k = pmap[y][x]>>8; + parts[k].type = j; + parts[k].x = (float)x; + parts[k].y = (float)y; + m[(x-x0)+(y-y0)*w] = k+1; + } + else if(i < nf) + { + parts[fp[i]].type = j; + parts[fp[i]].x = (float)x; + parts[fp[i]].y = (float)y; + m[(x-x0)+(y-y0)*w] = fp[i]+1; + i++; + } + else + m[(x-x0)+(y-y0)*w] = NPART+1; + } + } + + // load particle properties + for(j=0; j= size) + goto corrupt; + if(i < NPART) + { + parts[i].vx = (d[p++]-127.0f)/16.0f; + parts[i].vy = (d[p++]-127.0f)/16.0f; + if(parts[i].type == PT_STKM) + { + player[2] = PT_DUST; + + player[3] = parts[i].x-1; //Setting legs positions + player[4] = parts[i].y+6; + player[5] = parts[i].x-1; + player[6] = parts[i].y+6; + + player[7] = parts[i].x-3; + player[8] = parts[i].y+12; + player[9] = parts[i].x-3; + player[10] = parts[i].y+12; + + player[11] = parts[i].x+1; + player[12] = parts[i].y+6; + player[13] = parts[i].x+1; + player[14] = parts[i].y+6; + + player[15] = parts[i].x+3; + player[16] = parts[i].y+12; + player[17] = parts[i].x+3; + player[18] = parts[i].y+12; + + } + } + else + p += 2; + } + } + for(j=0; j= size) + goto corrupt; + if(i <= NPART) + parts[i-1].life = d[p++]*4; + else + p++; + } + } + for(j=0; j=34&&legacy_beta==0) + { + if(p >= size) + { + goto corrupt; + } + if(i <= NPART) + { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } + else + { + p++; + } + } + else + { + parts[i-1].temp = ptypes[parts[i-1].type].heat; + } + } + } + for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) + { + if(p >= size) + goto corrupt; + if(i <= NPART) + parts[i-1].ctype = d[p++]; + else + p++; + } + } + + if(p >= size) + goto version1; + j = d[p++]; + for(i=0; i size) + goto corrupt; + for(k=0; k size) + goto corrupt; + if(kSAVE_VERSION) + return NULL; + + bw = c[6]; + bh = c[7]; + w = bw*CELL; + h = bh*CELL; + + if(c[5]!=CELL) + return NULL; + + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return NULL; + fb = calloc(w*h, PIXELSIZE); + if(!fb) + { + free(d); + return NULL; + } + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + goto corrupt; + size = i; + + if(size < bw*bh) + goto corrupt; + + k = 0; + for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) + goto corrupt; + + for(y=0; y= size) + goto corrupt; + j=d[p++]; + if(j0) + { + if(j==PT_STKM) //Stickman should be drawed another way + { + //Stickman drawing + for(k=-2; k<=1; k++) + { + fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); + fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); + fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); + fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); + } + draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); + draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); + draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); + draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); + } + else + fb[y*w+x] = ptypes[j].pcolors; + } + } + + free(d); + *width = w; + *height = h; + return fb; + +corrupt: + free(d); + free(fb); + return NULL; +} + +/* NO, I DON'T THINK SO + #include "fbi.h" + + pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) + { + unsigned char *tmp; + pixel *res; + int i; + + tmp = malloc(width*height*3); + if(!tmp) + return NULL; + res = malloc(width*height*PIXELSIZE); + if(!res) { + free(tmp); + return NULL; + } + + i = width*height*3; + if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { + free(res); + free(tmp); + return NULL; + } + + for(i=0; i1) + { + r = (r+c/2)/c; + g = (g+c/2)/c; + b = (b+c/2)/c; + } + q[y*w+x] = PIXRGB(r, g, b); + } + *qw = w; + *qh = h; + return q; +} + +#define GRID_X 5 +#define GRID_Y 4 +#define GRID_P 3 +#define GRID_S 6 +#define GRID_Z 3 + +void stamp_gen_thumb(int i) +{ + char fn[64]; + void *data; + int size, factor_x, factor_y; + pixel *tmp; + + if(stamps[i].thumb) + { + free(stamps[i].thumb); + stamps[i].thumb = NULL; + } + + sprintf(fn, "stamps" PATH_SEP "%s.stm", stamps[i].name); + data = file_load(fn, &size); + + if(data) + { + stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); + if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) + { + factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); + factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); + if(factor_y > factor_x) + factor_x = factor_y; + tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); + free(stamps[i].thumb); + stamps[i].thumb = tmp; + } + } + + free(data); +} + +int clipboard_ready = 0; +void *clipboard_data = 0; +int clipboard_length = 0; + +void stamp_save(int x, int y, int w, int h) +{ + FILE *f; + int n; + char fn[64], sn[16]; + void *s=build_save(&n, x, y, w, h); + +#ifdef WIN32 + _mkdir("stamps"); +#else + mkdir("stamps", 0755); +#endif + + stamp_gen_name(sn); + sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); + + f = fopen(fn, "wb"); + if(!f) + return; + fwrite(s, n, 1, f); + fclose(f); + + free(s); + + if(stamps[STAMP_MAX-1].thumb) + free(stamps[STAMP_MAX-1].thumb); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); + memset(stamps, 0, sizeof(struct stamp_info)); + if(stamp_count0) + { + memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); + memcpy(stamps, &tmp, sizeof(struct stamp_info)); + + stamp_update(); + } + + return data; +} + +void stamp_init(void) +{ + int i; + FILE *f; + + memset(stamps, 0, sizeof(stamps)); + + f=fopen("stamps" PATH_SEP "stamps.def", "rb"); + if(!f) + return; + for(i=0; i=XRES+BARSIZE || y>=YRES+MENUSIZE) + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +{ + int i, j, w, bn = 0, ba = 0; + char *rp = font_data + font_ptrs[c]; + w = *(rp++); + for(j=0; j>= 2; + bn -= 2; + } + return x + w; +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) +{ + int sx = x; + for(; *s; s++) + { + if(*s == '\n') + { + x = sx; + y += FONT_H+2; + } + else if(*s == '\b') + { + switch(s[1]) + { + case 'w': + r = g = b = 255; + break; + case 'g': + r = g = b = 192; + break; + case 'o': + r = 255; + g = 216; + b = 32; + break; + case 'r': + r = 255; + g = b = 0; + break; + case 'b': + r = g = 0; + b = 255; + break; + } + s++; + } + else + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + return x; +} + +void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) +{ + int i; + for(i=0; i<=w; i++) + { + drawpixel(vid, x+i, y, r, g, b, a); + drawpixel(vid, x+i, y+h, r, g, b, a); + } + for(i=1; i=w && x+textwidth(s)>=w+5) + break; + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + if(*s) + for(i=0; i<3; i++) + x = drawchar(vid, x, y, '.', r, g, b, a); + return x; +} + +int textnwidth(char *s, int n) +{ + int x = 0; + for(; *s; s++) + { + if(!n) + break; + x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + n--; + } + return x-1; +} +int textwidthx(char *s, int w) +{ + int x=0,n=0,cw; + for(; *s; s++) + { + cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + if(x+(cw/2) >= w) + break; + x += cw; + n++; + } + return n; +} + +/*********************************************************** + * MAIN PROGRAM * + ***********************************************************/ + +void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) +{ + int x, y, i, j, c; + int bo = b; + if(iswall==1) + { + b = b-100; + x = (2+32*((b-22)/1)); + y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + x = 2+32*(b/2); + y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + if(bo==sl || bo==sr) + { + c = 0; + if(bo==sl) + c |= PIXPACK(0xFF0000); + if(bo==sr) + c |= PIXPACK(0x0000FF); + for(i=0; i<30; i++) + { + vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; + } + for(j=0; j<18; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; + } + } +} + +int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) +{ + int i, j, c; + if(b>=121) + { + b = b-100; + //x = (2+32*((b-22)/1)); + //y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + case 40: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + //x = 2+32*(b/2); + //y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + return 26; +} + +void draw_menu(pixel *vid_buf, int i, int hover) +{ + + //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); +#ifdef MENUV3 + drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + if(hover==i) + { + fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + } +#else + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); +#endif +} + +void menu_ui(pixel *vid_buf, int i, int *sl, int *sr) +{ + int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; + pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); + fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + rows = ceil((float)msections[i].itemcount/16.0f); + height = (ceil((float)msections[i].itemcount/16.0f)*18); + width = restrict_flt(msections[i].itemcount*31, 0, 16*31); + //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); + h = -1; + x = XRES-BARSIZE-26; + y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; + sy = y; + //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); + fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); + fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); + drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); + if(i==SC_WALL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM) + { + if(x-26<=60) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=60) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=20) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(!bq && mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + if(b==1&&h!=-1) + { + *sl = h; + } + if(b==4&&h!=-1) + { + *sr = h; + } +} + +int create_parts(int x, int y, int r, int c) +{ + int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; + + if(c == 125) + { + i = x / CELL; + j = y / CELL; + for(v=-1; v<2; v++) + for(u=-1; u<2; u++) + if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) + { + if(cp) + create_parts(y, x, r, c); + else + create_parts(x, y, r, c); + } + e -= 1.0f; + } + } +} + +void create_box(int x1, int y1, int x2, int y2, int c) +{ + int i, j; + if(x1>x2) + { + i = x2; + x2 = x1; + x1 = i; + } + if(y1>y2) + { + j = y2; + y2 = y1; + y1 = j; + } + for(j=y1; j<=y2; j++) + for(i=x1; i<=x2; i++) + create_parts(i, j, 1, c); +} + +int flood_parts(int x, int y, int c, int cm, int bm) +{ + int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) + { + c = c-100; + } + if(cm==-1) + { + if(c==0) + { + cm = pmap[y][x]&0xFF; + if(!cm) + return 0; + } + else + cm = 0; + } + if(bm==-1) + { + if(c==30) + { + bm = bmap[y/CELL][x/CELL]; + if(!bm) + return 0; + if(bm==1) + cm = 0xFF; + } + else + bm = 0; + } + + if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) + return 1; + + // go left as far as possible + x1 = x2 = x; + while(x1>=CELL) + { + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + break; + x1--; + } + while(x2=CELL+dy) + for(x=x1; x<=x2; x++) + if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) + if(!flood_parts(x, y-dy, co, cm, bm)) + return 0; + if(y=XRES || y>=YRES) + return; + c = vid[y*(XRES+BARSIZE)+x]; + c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); + if(c<512) + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); + else + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); +} + +void xor_line(int x1, int y1, int x2, int y2, pixel *vid) +{ + int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + e -= 1.0f; + } + } +} + +void draw_svf_ui(pixel *vid_buf) +{ + int c; + + drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); + drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + c = svf_open ? 255 : 128; + drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); + drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); + + c = svf_login ? 255 : 128; + drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); + if(svf_open) + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); + else + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); + drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); + if(svf_open && svf_own) + drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); + + c = (svf_login && svf_open) ? 255 : 128; + + drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + + if(svf_myvote==1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); + } + else if(svf_myvote==-1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); + } + + drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); + drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); + + drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); + if(svf_tags[0]) + drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); + else + drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); + + drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); + + drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); + drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); + if(svf_login) + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); + else + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); + drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); + + if(sys_pause) + { + fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); + drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + if(!legacy_enable) + { + fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + switch(cmode) + { + case 0: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); + break; + case 1: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); + break; + case 2: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); + break; + case 3: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); + break; + case 4: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); + break; + case 5: + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + break; + } + drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + + if(svf_admin) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); + } + else if(svf_mod) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + }//else if(amd) + // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? +} + +typedef struct ui_edit +{ + int x, y, w, nx; + char str[256],*def; + int focus, cursor, hide; +} ui_edit; +void ui_edit_draw(pixel *vid_buf, ui_edit *ed) +{ + int cx, i; + char echo[256], *str; + + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(ed->str[0]) + { + drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } + else if(!ed->focus) + drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); + if(ed->focus) + { + cx = textnwidth(str, ed->cursor); + for(i=-3; i<9; i++) + drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); + } +} +char *shift_0="`1234567890-=[]\\;',./"; +char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; +void ui_edit_process(int mx, int my, int mb, ui_edit *ed) +{ + char ch, ts[2], echo[256], *str; + int l, i; +#ifdef RAWINPUT + char *p; +#endif + + if(mb) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } + else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } + else + ed->focus = 0; + } + if(ed->focus && sdl_key) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + l = strlen(ed->str); + switch(sdl_key) + { + case SDLK_HOME: + ed->cursor = 0; + break; + case SDLK_END: + ed->cursor = l; + break; + case SDLK_LEFT: + if(ed->cursor > 0) + ed->cursor --; + break; + case SDLK_RIGHT: + if(ed->cursor < l) + ed->cursor ++; + break; + case SDLK_DELETE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + ed->str[ed->cursor] = 0; + else if(ed->cursor < l) + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + break; + case SDLK_BACKSPACE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + { + if(ed->cursor > 0) + memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); + ed->cursor = 0; + } + else if(ed->cursor > 0) + { + ed->cursor--; + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + } + break; + default: +#ifdef RAWINPUT + if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) + { + ch = sdl_key; + if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) + { + if(ch>='a' && ch<='z') + ch &= ~0x20; + p = strchr(shift_0, ch); + if(p) + ch = shift_1[p-shift_0]; + } + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#else + if(sdl_ascii>=' ' && sdl_ascii<127) + { + ch = sdl_ascii; + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#endif + break; + } + } +} +typedef struct ui_checkbox +{ + int x, y; + int focus, checked; +} ui_checkbox; +void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) +{ + int w = 12; + if(ed->checked) + { + drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); + } + if(ed->focus) + { + drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); + } + else + { + drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); + } +} +void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) +{ + int w = 12; + + if(mb && !mbq) + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->checked = (ed->checked)?0:1; + } + } + else + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->focus = 1; + } + else + { + ed->focus = 0; + } + } +} + +void error_ui(pixel *vid_buf, int err, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + char *msg; + + msg = malloc(strlen(txt)+16); + if(err) + sprintf(msg, "%03d %s", err, txt); + else + sprintf(msg, "%s", txt); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + if(err) + drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); + else + drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + free(msg); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_ui(pixel *vid_buf, char *top, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); + drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_box(pixel *vid_buf, char *msg) +{ + int w = textwidth(msg)+16; + int x0=(XRES-w)/2,y0=(YRES-24)/2; + + clearrect(vid_buf, x0-2, y0-2, w+4, 28); + drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); +} + +int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + int ret = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); + drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); + drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); + drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) + { + ret = 1; + break; + } + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + { + ret = 1; + break; + } + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + return ret; +} + +int execute_tagop(pixel *vid_buf, char *op, char *tag) +{ + int status; + char *result; + + char *names[] = {"ID", "Tag", NULL}; + char *parts[2]; + + char *uri = malloc(strlen(SERVER)+strlen(op)+36); + sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); + + parts[0] = svf_id; + parts[1] = tag; + + result = http_multipart_post( + uri, + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + free(uri); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 1; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 1; + } + + if(result[2]) + { + strncpy(svf_tags, result+3, 255); + svf_id[15] = 0; + } + + if(result) + free(result); + + return 0; +} + +struct strlist +{ + char *str; + struct strlist *next; +}; +void strlist_add(struct strlist **list, char *str) +{ + struct strlist *item = malloc(sizeof(struct strlist)); + item->str = mystrdup(str); + item->next = *list; + *list = item; +} +int strlist_find(struct strlist **list, char *str) +{ + struct strlist *item; + for(item=*list; item; item=item->next) + if(!strcmp(item->str, str)) + return 1; + return 0; +} +void strlist_free(struct strlist **list) +{ + struct strlist *item; + while(*list) + { + item = *list; + *list = (*list)->next; + free(item); + } +} + +void tag_list_ui(pixel *vid_buf) +{ + int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; + char *p,*q,s; + char *tag=NULL, *op=NULL; + ui_edit ed; + struct strlist *vote=NULL,*down=NULL; + + ed.x = x0+25; + ed.y = y0+221; + ed.w = 158; + ed.nx = 1; + ed.def = "[new tag]"; + ed.focus = 0; + ed.hide = 0; + ed.cursor = 0; + strcpy(ed.str, ""); + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + op = tag = NULL; + + drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 256); + drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); + p = svf_tags; + s = svf_tags[0] ? ' ' : 0; + y = 36 + y0; + while(s) + { + q = strchr(p, ' '); + if(!q) + q = p+strlen(p); + s = *q; + *q = 0; + if(svf_own || svf_admin || svf_mod) + { + drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); + d = 14; + if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) + { + if(!ed1.focus) + break; + ed1.focus = 0; + ed2.focus = 1; + } + if(sdl_key==SDLK_ESCAPE) + { + if(!ed1.focus && !ed2.focus) + return; + ed1.focus = 0; + ed2.focus = 0; + } + } + + strcpy(svf_user, ed1.str); + md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); + + res = http_multipart_post( + "http://" SERVER "/Login.api", + NULL, NULL, NULL, + svf_user, svf_pass, + &err, NULL); + if(err != 200) + { + error_ui(vid_buf, err, http_ret_text(err)); + if(res) + free(res); + goto fail; + } + if(res && !strncmp(res, "OK", 2)) + { + if(!strcmp(res, "OK ADMIN")) + { + svf_admin = 1; + svf_mod = 0; + } + else if(!strcmp(res, "OK MOD")) + { + svf_admin = 0; + svf_mod = 1; + } + else + { + svf_admin = 0; + svf_mod = 0; + } + free(res); + svf_login = 1; + return; + } + if(!res) + res = mystrdup("Unspecified Error"); + error_ui(vid_buf, 0, res); + free(res); + +fail: + strcpy(svf_user, ""); + strcpy(svf_pass, ""); + svf_login = 0; + svf_own = 0; + svf_admin = 0; + svf_mod = 0; +} + +void execute_delete(pixel *vid_buf, char *id) +{ + int status; + char *result; + + char *names[] = {"ID", NULL}; + char *parts[1]; + + parts[0] = id; + + result = http_multipart_post( + "http://" SERVER "/Delete.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result) + free(result); +} + +int execute_vote(pixel *vid_buf, char *id, char *action) +{ + int status; + char *result; + + char *names[] = {"ID", "Action", NULL}; + char *parts[2]; + + parts[0] = id; + parts[1] = action; + + result = http_multipart_post( + "http://" SERVER "/Vote.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 0; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 0; + } + + if(result) + free(result); + return 1; +} + +static char hex[] = "0123456789ABCDEF"; +void strcaturl(char *dst, char *src) +{ + char *d; + unsigned char *s; + + for(d=dst; *d; d++) ; + + for(s=(unsigned char *)src; *s; s++) + { + if((*s>='0' && *s<='9') || + (*s>='a' && *s<='z') || + (*s>='A' && *s<='Z')) + *(d++) = *s; + else + { + *(d++) = '%'; + *(d++) = hex[*s>>4]; + *(d++) = hex[*s&15]; + } + } + *d = 0; +} + +#define THUMB_CACHE_SIZE 256 + +char *thumb_cache_id[THUMB_CACHE_SIZE]; +void *thumb_cache_data[THUMB_CACHE_SIZE]; +int thumb_cache_size[THUMB_CACHE_SIZE]; +int thumb_cache_lru[THUMB_CACHE_SIZE]; + +void thumb_cache_inval(char *id) +{ + int i,j; + for(i=0; i= THUMB_CACHE_SIZE) + return; + free(thumb_cache_id[i]); + free(thumb_cache_data[i]); + thumb_cache_id[i] = NULL; + for(j=0; j thumb_cache_lru[i]) + thumb_cache_lru[j]--; +} +void thumb_cache_add(char *id, void *thumb, int size) +{ + int i,m=-1,j=-1; + thumb_cache_inval(id); + for(i=0; i m) + { + m = thumb_cache_lru[i]; + j = i; + } + } + if(i >= THUMB_CACHE_SIZE) + { + thumb_cache_inval(thumb_cache_id[j]); + i = j; + } + for(j=0; j= THUMB_CACHE_SIZE) + return 0; + for(j=0; j=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+5); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + else if(!strncmp(str, "TAG ", 4)) + { + if(j >= TAG_MAX) + { + str = p; + continue; + } + q = strchr(str+4, ' '); + if(!q) + { + str = p; + continue; + } + *(q++) = 0; + tag_names[j] = mystrdup(str+4); + tag_votes[j] = atoi(q); + j++; + } + else + { + if(i>=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + str = p; + } + if(*str) + i++; + return i; +} + +#define IMGCONNS 3 +#define TIMEOUT 100 +#define HTTP_TIMEOUT 10 + +int search_own = 0; +int search_date = 0; +int search_page = 0; +char search_expr[256] = ""; + +int search_ui(pixel *vid_buf) +{ + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; + int thumb_drawn[GRID_X*GRID_Y]; + pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + float ry; + time_t http_last_use=HTTP_TIMEOUT; + ui_edit ed; + + + void *http = NULL; + int active = 0; + char *last = NULL; + int search = 0; + int lasttime = TIMEOUT; + char *uri; + int status; + char *results; + char *tmp, ts[64]; + + void *img_http[IMGCONNS]; + char *img_id[IMGCONNS]; + void *thumb, *data; + int thlen, dlen; + + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + + memset(img_http, 0, sizeof(img_http)); + memset(img_id, 0, sizeof(img_id)); + + memset(search_ids, 0, sizeof(search_ids)); + memset(search_names, 0, sizeof(search_names)); + memset(search_scoreup, 0, sizeof(search_scoreup)); + memset(search_scoredown, 0, sizeof(search_scoredown)); + memset(search_publish, 0, sizeof(search_publish)); + memset(search_owners, 0, sizeof(search_owners)); + memset(search_thumbs, 0, sizeof(search_thumbs)); + memset(search_thsizes, 0, sizeof(search_thsizes)); + + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + + do_open = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = 65; + ed.y = 13; + ed.w = XRES-200; + ed.nx = 1; + ed.def = "[search terms]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(search_expr); + strcpy(ed.str, search_expr); + + sdl_wheel = 0; + + while(!sdl_poll()) + { + uih = 0; + bq = b; + mxq = mx; + myq = my; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + if(mx!=mxq || my!=myq || sdl_wheel || b) + mmt = 0; + else if(mmt 9) + { + drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); + drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); + } + + ui_edit_draw(vid_buf, &ed); + + if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) + { + if(search_page) + { + search_page --; + lasttime = TIMEOUT; + } + sdl_wheel = 0; + uih = 1; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) + { + lasttime = TIMEOUT; + search_page ++; + page_count = exp_res; + } + sdl_wheel = 0; + uih = 1; + } + + tp = -1; + if(is_p1) + { + drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); + for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) + for(gi=0; giTAG_MAX || !tag_names[pos]) + break; + if(tag_votes[0]) + i = 127+(128*tag_votes[pos])/tag_votes[0]; + else + i = 192; + w = textwidth(tag_names[pos]); + if(w>XRES/GRID_X-5) + w = XRES/GRID_X-5; + gx = (XRES/GRID_X)*gi; + gy = gj*14 + 46; + if(mx>=gx && mx=gy && my XRES/GRID_X-10) + { + tmp = malloc(strlen(search_names[pos])+4); + strcpy(tmp, search_names[pos]); + j = textwidthx(tmp, XRES/GRID_X-15); + strcpy(tmp+j, "..."); + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); + free(tmp); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); + j = textwidth(search_owners[pos]); + if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && + my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) + { + st = 1; + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); + if(search_thumbs[pos]&&thumb_drawn[pos]==0) + { + render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); + thumb_drawn[pos] = 1; + } + own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); + if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) + mp = pos; + if(own) + { + if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) + { + mp = -1; + dp = pos; + } + } + if(mp==pos && !st) + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); + else + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); + if(own) + { + if(dp == pos) + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); + else + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); + } + if(!search_publish[pos]) + { + drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); + drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } + if(view_own || svf_admin || svf_mod) + { + sprintf(ts+1, "%d", search_votes[pos]); + ts[0] = 0xBB; + for(j=1; ts[j]; j++) + ts[j] = 0xBC; + ts[j-1] = 0xB9; + ts[j] = 0xBA; + ts[j+1] = 0; + w = gx+XRES/GRID_S-2-textwidth(ts); + h = gy+YRES/GRID_S-11; + drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); + for(j=0; ts[j]; j++) + ts[j] -= 14; + drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); + sprintf(ts, "%d", search_votes[pos]); + for(j=0; ts[j]; j++) + ts[j] += 127; + drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); + } + if(search_scoreup[pos]>0||search_scoredown[pos]>0) + { + lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); + + if(((YRES/GRID_S+3)/2)>lv) + { + ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); + if(lv<8) + { + ry = ry/(8-lv); + } + nyu = search_scoreup[pos]*ry; + nyd = search_scoredown[pos]*ry; + } + else + { + ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); + nyu = search_scoreup[pos]/ry; + nyd = search_scoredown[pos]/ry; + } + + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); + + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); + } + } + + if(mp!=-1 && mmt>=TIMEOUT/5 && !st) + { + gi = mp % GRID_X; + gj = mp / GRID_X; + if(is_p1) + gj += GRID_Y-GRID_P; + gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; + gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; + i = w = textwidth(search_names[mp]); + h = YRES/GRID_Z+30; + if(w=XRES-2) gx=XRES-3-w; + if(gy<32) gy=32; + if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; + clearrect(vid_buf, gx-2, gy-3, w+4, h); + drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); + if(search_thumbs[mp]) + render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); + drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); + drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); + } + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(sdl_key==SDLK_RETURN) + { + if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) + lasttime = TIMEOUT; + else if(search_ids[0] && !search_ids[1]) + { + bq = 0; + b = 1; + mp = 0; + } + } + if(sdl_key==SDLK_ESCAPE) + goto finish; + + if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) + { + search_own = !search_own; + lasttime = TIMEOUT; + } + if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) + { + search_date = !search_date; + lasttime = TIMEOUT; + } + + if(b && !bq && dp!=-1) + if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) + { + execute_delete(vid_buf, search_ids[dp]); + lasttime = TIMEOUT; + if(last) + { + free(last); + last = NULL; + } + } + + if(b && !bq && tp!=-1) + { + strncpy(ed.str, tag_names[tp], 255); + lasttime = TIMEOUT; + } + + if(b && !bq && mp!=-1 && st) + { + sprintf(ed.str, "user:%s", search_owners[mp]); + lasttime = TIMEOUT; + } + + if(do_open==1) + { + mp = 0; + } + + if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) + { + fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); + info_box(vid_buf, "Loading..."); + + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + data = http_simple_get(uri, &status, &dlen); + free(uri); + + if(status == 200) + { + status = parse_save(data, dlen, 1, 0, 0); + switch(status) + { + case 1: + error_ui(vid_buf, 0, "Simulation corrupted"); + break; + case 2: + error_ui(vid_buf, 0, "Simulation from a newer version"); + break; + case 3: + error_ui(vid_buf, 0, "Simulation on a too large grid"); + break; + } + if(!status) + { + char *tnames[] = {"ID", NULL}; + char *tparts[1]; + int tplens[1]; + if(svf_last) + free(svf_last); + svf_last = data; + svf_lsize = dlen; + + tparts[0] = search_ids[mp]; + tplens[0] = strlen(search_ids[mp]); + data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); + + svf_open = 1; + svf_own = svf_login && !strcmp(search_owners[mp], svf_user); + svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); + + strcpy(svf_id, search_ids[mp]); + strcpy(svf_name, search_names[mp]); + if(status == 200) + { + if(data) + { + strncpy(svf_tags, data, 255); + svf_tags[255] = 0; + } + else + svf_tags[0] = 0; + } + else + { + svf_tags[0] = 0; + } + + if(svf_login) + { + char *names[] = {"ID", NULL}; + char *parts[1]; + parts[0] = search_ids[mp]; + data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); + if(status == 200) + { + if(data) + { + if(!strcmp(data, "Up")) + { + svf_myvote = 1; + } + else if(!strcmp(data, "Down")) + { + svf_myvote = -1; + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + } + else + { + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + } + } + else + error_ui(vid_buf, status, http_ret_text(status)); + + if(data) + free(data); + goto finish; + } + + if(!last) + { + search = 1; + } + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) + { + search = 1; + if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) + { + search_page = 0; + page_count = 0; + } + free(last); + last = NULL; + } + else + search = 0; + + if(search && lasttime>=TIMEOUT) + { + lasttime = 0; + last = mystrdup(ed.str); + last_own = search_own; + last_date = search_date; + last_page = search_page; + active = 1; + uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); + if(search_own || svf_admin || svf_mod) + tmp = "&ShowVotes=true"; + else + tmp = ""; + if(!search_own && !search_date && !*last) + { + if(search_page) + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); + } + else + { + exp_res = GRID_X*GRID_P; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); + } + } + else + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); + } + strcaturl(uri, last); + if(search_own) + { + strcaturl(uri, " user:"); + strcaturl(uri, svf_user); + } + if(search_date) + strcaturl(uri, " sort:date"); + + http = http_async_req_start(http, uri, NULL, 0, 1); + if(svf_login) + { + http_auth_headers(http, svf_user, svf_pass); + } + http_last_use = time(NULL); + free(uri); + } + + if(active && http_async_req_status(http)) + { + http_last_use = time(NULL); + results = http_async_req_stop(http, &status, NULL); + view_own = last_own; + if(status == 200) + { + page_count = search_results(results, last_own||svf_admin||svf_mod); + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + } + is_p1 = (exp_res < GRID_X*GRID_Y); + free(results); + active = 0; + } + + if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) + { + http_async_req_close(http); + http = NULL; + } + + for(i=0; i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) + { + if(stamp_page) + { + stamp_page --; + } + sdl_wheel = 0; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; +} + +void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) +{ + char t[2]; + t[0] = ch; + t[1] = 0; + if(flag) + { + fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); + } + else + { + drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); + } +} + +void render_signs(pixel *vid_buf) +{ + int i, j, x, y, w, h, dx, dy; + char buff[30]; //Buffer + for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature + else + sprintf(buff, "Temp: 0.00"); //...tempirature + drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); + } + + //Usual text + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); + x = signs[i].x; + y = signs[i].y; + dx = 1 - signs[i].ju; + dy = (signs[i].y > 18) ? -1 : 1; + for(j=0; j<4; j++) + { + drawpixel(vid_buf, x, y, 192, 192, 192, 255); + x+=dx; + y+=dy; + } + } +} + +void add_sign_ui(pixel *vid_buf, int mx, int my) +{ + int i, w, h, x, y, nm=0, ju; + int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; + ui_edit ed; + + // check if it is an existing sign + for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) + break; + } + // else look for empty spot + if(i >= MAXSIGNS) + { + nm = 1; + for(i=0; i= MAXSIGNS) + return; + + if(nm) + { + signs[i].x = mx; + signs[i].y = my; + signs[i].ju = 1; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = x0+25; + ed.y = y0+25; + ed.w = 158; + ed.nx = 1; + ed.def = "[message]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(signs[i].text); + strcpy(ed.str, signs[i].text); + ju = signs[i].ju; + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed); + drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); + draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); + draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); + draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); + + if(!nm) + { + drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); + drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); + drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); + } + + drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) + ju = 0; + if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) + ju = 1; + if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) + ju = 2; + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) + { + signs[i].text[0] = 0; + return; + } + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + { + if(!ed.focus) + return; + ed.focus = 0; + } + } + + strcpy(signs[i].text, ed.str); + signs[i].ju = ju; +} + +/*********************************************************** + * CONFIG FILE * + ***********************************************************/ + +char http_proxy[256] = ""; + +void save_string(FILE *f, char *str) +{ + int li = strlen(str); + unsigned char lb[2]; + lb[0] = li; + lb[1] = li >> 8; + fwrite(lb, 2, 1, f); + fwrite(str, li, 1, f); +} + +int load_string(FILE *f, char *str, int max) +{ + int li; + unsigned char lb[2]; + fread(lb, 2, 1, f); + li = lb[0] | (lb[1] << 8); + if(li > max) + { + str[0] = 0; + return 1; + } + fread(str, li, 1, f); + str[li] = 0; + return 0; +} + +unsigned char last_major=0, last_minor=0, update_flag=0; + +void save_presets(int do_update) +{ + FILE *f=fopen("powder.def", "wb"); + unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; + unsigned char tmp = sdl_scale; + if(!f) + return; + fwrite(sig, 1, 4, f); + save_string(f, svf_user); + save_string(f, svf_pass); + fwrite(&tmp, 1, 1, f); + tmp = cmode; + fwrite(&tmp, 1, 1, f); + tmp = svf_admin; + fwrite(&tmp, 1, 1, f); + tmp = svf_mod; + fwrite(&tmp, 1, 1, f); + save_string(f, http_proxy); + tmp = SAVE_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = MINOR_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = do_update; + fwrite(&tmp, 1, 1, f); + fclose(f); +} + +void load_presets(void) +{ + FILE *f=fopen("powder.def", "rb"); + unsigned char sig[4], tmp; + if(!f) + return; + fread(sig, 1, 4, f); + if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) + { + if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) + { + if(fseek(f, -3, SEEK_END)) + { + remove("powder.def"); + return; + } + if(fread(sig, 1, 3, f) != 3) + { + remove("powder.def"); + goto fail; + } + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; + } + fclose(f); + remove("powder.def"); + return; + } + if(load_string(f, svf_user, 63)) + goto fail; + if(load_string(f, svf_pass, 63)) + goto fail; + svf_login = !!svf_user[0]; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + sdl_scale = (tmp == 2) ? 2 : 1; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + cmode = tmp%6; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_admin = tmp; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_mod = tmp; + if(load_string(f, http_proxy, 255)) + goto fail; + if(fread(sig, 1, 3, f) != 3) + goto fail; + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; +fail: + fclose(f); +} + +void dim_copy(pixel *dst, pixel *src) +{ + int i,r,g,b; + for(i=0; i0) + r--; + if(g>0) + g--; + if(b>0) + b--; + dst[i] = PIXRGB(r,g,b); + } +} + +unsigned int fire_alpha[CELL*3][CELL*3]; +void prepare_alpha(void) +{ + int x,y,i,j; + float temp[CELL*3][CELL*3]; + memset(temp, 0, sizeof(temp)); + for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; + fire_g[j][i] = g>4 ? g-4 : 0; + fire_b[j][i] = b>4 ? b-4 : 0; + } +} + +int zoom_en = 0; +int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; +int zoom_wx=0, zoom_wy=0; +void render_zoom(pixel *img) +{ + int x, y, i, j; + pixel pix; + drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); + drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); + clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); + for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) + { + xor_pixel(x+i, y+j, vid); + if(j) xor_pixel(x+i, y-j, vid); + if(i) xor_pixel(x-i, y+j, vid); + if(i&&j) xor_pixel(x-i, y-j, vid); + } + } + else + { + int tc; + c = (r/CELL) * CELL; + x = (x/CELL) * CELL; + y = (y/CELL) * CELL; + + tc = !((c%(CELL*2))==0); + + x -= c/2; + y -= c/2; + + x += tc*(CELL/2); + y += tc*(CELL/2); + + for(i=0; i2) + { + pthread_t pth; + pthread_create(&pth,NULL,update_air_th,""); + } + else + { + update_air(); + } +#else + update_air(); +#endif + } + if(cmode==0 || cmode==1) + { + draw_air(vid_buf); + } + else if(cmode==2) + { + memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); + memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); + } + else + { + memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + } + update_particles(vid_buf); + + if(cmode==2) + { + if(!fire_fc) + { + dim_copy(fire_bg, vid_buf); + } + else + { + memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); + } + fire_fc = (fire_fc+1) % 3; + } + if(cmode==3||cmode==4) + render_fire(vid_buf); + + render_signs(vid_buf); + + memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); + clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); + + draw_svf_ui(vid_buf); + + if(http_ver_check) + { + if(!do_check && http_async_req_status(http_ver_check)) + { + ver_data = http_async_req_stop(http_ver_check, &http_ret, NULL); + if(http_ret==200 && ver_data) + { +#ifdef BETA + if(sscanf(ver_data, "%d.%d.%d", &major, &minor, &is_beta)==3) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) + old_version = 1; +#else + if(sscanf(ver_data, "%d.%d", &major, &minor)==2) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) + old_version = 1; +#endif + free(ver_data); + } + http_ver_check = NULL; + } + do_check = (do_check+1) & 15; + } + + if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) + { + if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) + { + break; + } + } + if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) + { + if(load_mode) + { + free(load_img); + free(load_data); + load_mode = 0; + load_data = NULL; + load_img = NULL; + } + if(it > 50) + it = 50; + if(sdl_key=='k' && stamps[1].name[0]) + { + j = stamp_ui(vid_buf); + if(j>=0) + load_data = stamp_load(j, &load_size); + else + load_data = NULL; + } + else + load_data = stamp_load(0, &load_size); + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + if(sdl_key=='s') + { + if(it > 50) + it = 50; + save_mode = 1; + } + if(sdl_key=='1') + { + set_cmode(0); + } + if(sdl_key=='2') + { + set_cmode(1); + } + if(sdl_key=='3') + { + set_cmode(2); + } + if(sdl_key=='4') + { + set_cmode(3); + } + if(sdl_key=='5') + { + set_cmode(4); + } + if(sdl_key=='6') + { + set_cmode(5); + } + if(sdl_key==SDLK_SPACE) + sys_pause = !sys_pause; + if(sdl_key=='h') + hud_enable = !hud_enable; + if(sdl_key=='p') + dump_frame(vid_buf, XRES, YRES, XRES); + if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + if(clipboard_ready==1) + { + load_data = malloc(clipboard_length); + memcpy(load_data, clipboard_data, clipboard_length); + load_size = clipboard_length; + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + } + if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 2; + } + if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 1; + } + else if(sdl_key=='c') + { + set_cmode((cmode+1) % 6); + if(it > 50) + it = 50; + } + if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo + { + int cbx, cby, cbi; + + for(cbi=0; cbi32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + sdl_wheel = 0; + } + else + { + bs += sdl_wheel; + if(bs>16) + bs = 16; + if(bs<0) + bs = 0; + sdl_wheel = 0; + /*if(su >= PT_NUM) { + if(sl < PT_NUM) + su = sl; + if(sr < PT_NUM) + su = sr; + }*/ + } + } + + bq = b; + b = SDL_GetMouseState(&x, &y); + + for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy + && x0 && y0 && x>8)>=NPART || !cr)) + { +#ifdef BETA + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); +#else + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); +#endif + } + else + { + sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + } + } + mx = x; + my = y; + if(update_flag) + { + info_box(vid_buf, "Finalizing update..."); + if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) + { + update_cleanup(); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + { + if(update_finish()) + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + else + info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); + } + update_flag = 0; + } + + if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && + x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) + { + tmp = malloc(64); +#ifdef BETA + if(is_beta) + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); + } + else + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); + } +#else + sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); +#endif + if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) + { + free(tmp); + tmp = download_ui(vid_buf, my_uri, &i); + if(tmp) + { + save_presets(1); + if(update_start(tmp, i)) + { + update_cleanup(); + save_presets(0); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + return 0; + } + } + else + free(tmp); + } + if(y>=sdl_scale*(YRES+(MENUSIZE-20))) + { + if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) + { + db = (svf_myvote==1) ? 273 : 274; + if(da < 51) + da ++; + } + else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) + { + db = svf_own ? 257 : 256; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) + { + db = 270; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) + { + db = 266; + if(da < 51) + da ++; + } + else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) + { + db = 259; + if(svf_open && svf_own && x<=55*sdl_scale) + db = 258; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) + { + db = svf_login ? 261 : 260; + if(svf_admin) + { + db = 268; + } + else if(svf_mod) + { + db = 271; + } + if(da < 51) + da ++; + } + else if(x>=sdl_scale && x<=17*sdl_scale) + { + db = 262; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) + { + db = sys_pause ? 264 : 263; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) + { + db = 267; + if(da < 51) + da ++; + } + else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) + { + db = 265; + if(da < 51) + da ++; + } + else if(da > 0) + da --; + } + else if(da > 0) + da --; + + if(!sdl_zoom_trig && zoom_en==1) + zoom_en = 0; + + if(sdl_key==Z_keysym && zoom_en==2) + zoom_en = 1; + + if(load_mode) + { + load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); + load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); + if(load_x+load_w>XRES) load_x=XRES-load_w; + if(load_y+load_h>YRES) load_y=YRES-load_h; + if(load_x<0) load_x=0; + if(load_y<0) load_y=0; + if(bq==1 && !b) + { + parse_save(load_data, load_size, 0, load_x, load_y); + free(load_data); + free(load_img); + load_mode = 0; + } + else if(bq==4 && !b) + { + free(load_data); + free(load_img); + load_mode = 0; + } + } + else if(save_mode==1) + { + save_x = (mx/sdl_scale)/CELL; + save_y = (my/sdl_scale)/CELL; + if(save_x >= XRES/CELL) save_x = XRES/CELL-1; + if(save_y >= YRES/CELL) save_y = YRES/CELL-1; + save_w = 1; + save_h = 1; + if(b==1) + { + save_mode = 2; + } + else if(b==4) + { + save_mode = 0; + copy_mode = 0; + } + } + else if(save_mode==2) + { + save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; + save_h = (my/sdl_scale+CELL/2)/CELL - save_y; + if(save_w>XRES/CELL) save_w = XRES/CELL; + if(save_h>YRES/CELL) save_h = YRES/CELL; + if(save_w<1) save_w = 1; + if(save_h<1) save_h = 1; + if(!b) + { + if(copy_mode==1) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + } + else if(copy_mode==2) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + } + else + { + stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + save_mode = 0; + } + } + } + else if(sdl_zoom_trig && zoom_en<2) + { + x /= sdl_scale; + y /= sdl_scale; + x -= ZSIZE/2; + y -= ZSIZE/2; + if(x<0) x=0; + if(y<0) y=0; + if(x>XRES-ZSIZE) x=XRES-ZSIZE; + if(y>YRES-ZSIZE) y=YRES-ZSIZE; + zoom_x = x; + zoom_y = y; + zoom_wx = (x 50) + it = 50; + x /= sdl_scale; + y /= sdl_scale; + if(y>=YRES+(MENUSIZE-20)) + { + if(!lb) + { + if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Up")) + { + svf_myvote = 1; + } + } + if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Down")) + { + svf_myvote = -1; + } + } + if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) + tag_list_ui(vid_buf); + if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) + { + legacy_enable = !legacy_enable; + } + if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) + { + memset(signs, 0, sizeof(signs)); + memset(pv, 0, sizeof(pv)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(fvx, 0, sizeof(fvx)); + memset(fvy, 0, sizeof(fvy)); + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(parts, 0, sizeof(particle)*NPART); + for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) + { + login_ui(vid_buf); + if(svf_login) + save_presets(0); + } + if(x>=37 && x<=187 && svf_login) + { + if(!svf_open || !svf_own || x>51) + { + if(save_name_ui(vid_buf)) + execute_save(vid_buf); + } + else + execute_save(vid_buf); + while(!sdl_poll()) + if(!SDL_GetMouseState(&x, &y)) + break; + b = bq = 0; + } + if(x>=1 && x<=17) + { + search_ui(vid_buf); + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + } + if(x>=19 && x<=35 && svf_last && svf_open) + parse_save(svf_last, svf_lsize, 1, 0, 0); + if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) + { + if(b & SDL_BUTTON_LMASK) + set_cmode((cmode+1) % 6); + if(b & SDL_BUTTON_RMASK) + set_cmode((cmode+5) % 6); + save_presets(0); + } + if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) + sys_pause = !sys_pause; + lb = 0; + } + } + else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) + { + c = sl = cr&0xFF; + } + else + { + //Something + } + } + //create_parts(x, y, bs, SPC_AIR); + lx = x; + ly = y; + lb = 0; + lm = 0; + } + else + { + //Copy state before drawing any particles (for undo) + int cbx, cby, cbi; + + for(cbi=0; cbi=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) + create_line(lx, ly, x, y, bs, c); + } + else + create_box(lx, ly, x, y, c); + lm = 0; + } + lb = 0; + } + + if(load_mode) + { + draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); + xor_rect(vid_buf, load_x, load_y, load_w, load_h); + } + + if(save_mode) + { + xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + da = 51; + db = 269; + } + + if(zoom_en!=1 && !load_mode && !save_mode) + { + render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); + mousex = mx/sdl_scale; + mousey = my/sdl_scale; + } + + if(zoom_en) + render_zoom(vid_buf); + + if(da) + switch(db) + { + case 256: + drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); + break; + case 257: + drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); + break; + case 258: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); + break; + case 259: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); + break; + case 260: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); + break; + case 261: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); + break; + case 262: + drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); + break; + case 263: + drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); + break; + case 264: + drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); + break; + case 265: + drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); + break; + case 266: + drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); + break; + case 267: + drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); + break; + case 268: + drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); + break; + case 269: + drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); + break; + case 270: + drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); + break; + case 271: + drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); + break; + case 272: + drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); + break; + case 273: + drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); + break; + case 274: + drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); + break; + case 275: + drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); + break; + default: + drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); + } + if(itc) + { + itc--; + drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); + } + if(it) + { + it--; + //if(fbi_img) + //draw_image(vid_buf, fbi_img, (XRES-FBI_W)/2, (YRES-FBI_H)/2+25, FBI_W, FBI_H, it>12?64:it*5); + drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); + } + + if(old_version) + { + clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); +#ifdef BETA + if(is_beta) + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); + } + else + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); + } +#else + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); +#endif + drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); + } + /*#ifdef MT + pthread_join(pth2,NULL); + #endif*/ + + if(hud_enable) + { + currentTime = SDL_GetTicks(); + if(currentTime-past>=16) + { + past = SDL_GetTicks(); + FPS++; + } + if(currentTime-pastFPS>=1000) + { +#ifdef BETA + sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#else + sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#endif + FPSB = FPS; + FPS = 0; + pastFPS = currentTime; + } + if(sdl_zoom_trig||zoom_en) + { + if(zoom_x Date: Mon, 16 Aug 2010 23:31:11 +0200 Subject: now? diff --git a/powder2.c b/powder2.c deleted file mode 100644 index 78e481b..0000000 --- a/powder2.c +++ /dev/null @@ -1,10781 +0,0 @@ -/** - * Powder Toy - Main source - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * Copyright (c) 2010 Simon Robertshaw - * Copyright (c) 2010 Skresanov Savely - * Copyright (c) 2010 Bryan Hoyle - * Copyright (c) 2010 Nathan Cousins - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#else -#include -#include -#endif - - -#include "version.h" -#include "http.h" -#include "md5.h" -#include "update.h" -#include "hmap.h" - -#define SERVER "powdertoy.co.uk" - -#undef PLOSS - -#ifdef MENUV3 -#define MENUSIZE 40 -#else -#define MENUSIZE 20 -#endif -#define BARSIZE 14 -#define XRES 612 -#define YRES 384 -#define NPART XRES*YRES - -#define ZSIZE_D 16 -#define ZFACTOR_D 8 -unsigned char ZFACTOR = 256/ZSIZE_D; -unsigned char ZSIZE = ZSIZE_D; - -#define CELL 4 -#define ISTP (CELL/2) -#define CFDS (4.0f/CELL) - -typedef unsigned char uint8; - -#ifdef PIX16 -#define PIXELSIZE 2 -typedef unsigned short pixel; -#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) -#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) -#define PIXR(x) (((x)>>8)&0xF8) -#define PIXG(x) (((x)>>3)&0xFC) -#define PIXB(x) (((x)<<3)&0xF8) -#else -#define PIXELSIZE 4 -typedef unsigned int pixel; -#ifdef PIX32BGR -#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) -#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) -#define PIXR(x) ((x)&0xFF) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)>>16) -#else -#ifdef PIX32BGRA -#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) -#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) -#define PIXR(x) (((x)>>8)&0xFF) -#define PIXG(x) (((x)>>16)&0xFF) -#define PIXB(x) (((x)>>24)) -#else -#define PIXPACK(x) (x) -#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) -#define PIXR(x) ((x)>>16) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)&0xFF) -#endif -#endif -#endif - -char *it_msg = - "\brThe Powder Toy\n" - "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" - "\n" - "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" - "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" - "\bgPick your material from the menu using mouse left/right buttons.\n" - "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" - "Shift+drag will create straight lines of particles.\n" - "Ctrl+drag will result in filled rectangles.\n" - "Ctrl+Shift+click will flood-fill a closed area.\n" - "Ctrl+Z will act as Undo.\n" - "Middle click or Alt+Click to \"sample\" the particles.\n" - "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" - "Use 'S' to save parts of the window as 'stamps'.\n" - "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" - "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" - "Use the mouse scroll wheel to change the tool size for particles.\n" - "'Q' will quit the application.\n" - "The spacebar can be used to pause physics.\n" - "'P' will take a screenshot and save it into the current directory.\n" - "\n" - "\brhttp://powdertoy.co.uk/\n" - "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" - "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" - "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" - "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" - "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" - "\n" - "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" - "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" - ; - -typedef struct -{ - int start, inc; - pixel *vid; -} upstruc; - -#ifdef BETA -char *old_ver_msg_beta = "A new beta is available - click here!"; -#endif -char *old_ver_msg = "A new version is available - click here!"; -float mheat = 0.0f; - -int do_open = 0; -int sys_pause = 0; -int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. - -int amd = 0; - -unsigned char fire_r[YRES/CELL][XRES/CELL]; -unsigned char fire_g[YRES/CELL][XRES/CELL]; -unsigned char fire_b[YRES/CELL][XRES/CELL]; - -#define MAXSIGNS 16 - -struct sign -{ - int x,y,ju; - char text[256]; -} signs[MAXSIGNS]; - -/*********************************************************** - * AIR FLOW SIMULATOR * - ***********************************************************/ - -unsigned char bmap[YRES/CELL][XRES/CELL]; -unsigned char emap[YRES/CELL][XRES/CELL]; - -unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -unsigned char cb_emap[YRES/CELL][XRES/CELL]; - -unsigned cmode = 3; - -float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; - -float cb_vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float cb_vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float cb_pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; - -float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; -#define TSTEPP 0.3f -#define TSTEPV 0.4f -#define VADV 0.3f -#define VLOSS 0.999f -#define PLOSS 0.9999f -int numCores = 1; -float kernel[9]; -void make_kernel(void) -{ - int i, j; - float s = 0.0f; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - { - kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); - s += kernel[(i+1)+3*(j+1)]; - } - s = 1.0f / s; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - kernel[(i+1)+3*(j+1)] *= s; -} - -int core_count() -{ - int numCPU = 1; -#ifdef MT -#ifdef WIN32 - SYSTEM_INFO sysinfo; - GetSystemInfo( &sysinfo ); - numCPU = sysinfo.dwNumberOfProcessors; -#else -#ifdef MACOSX - numCPU = 4; -#else - numCPU = sysconf( _SC_NPROCESSORS_ONLN ); -#endif -#endif - - printf("Cpus: %d\n", numCPU); - if(numCPU>1) - printf("Multithreading enabled\n"); - else - printf("Multithreading disabled\n"); -#endif - return numCPU; -} - -void update_air(void) -{ - int x, y, i, j; - float dp, dx, dy, f, tx, ty; - - for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; - if(dp < -256.0f) dp = -256.0f; - if(dx > 256.0f) dx = 256.0f; - if(dx < -256.0f) dx = -256.0f; - if(dy > 256.0f) dy = 256.0f; - if(dy < -256.0f) dy = -256.0f; - - ovx[y][x] = dx; - ovy[y][x] = dy; - opv[y][x] = dp; - } - memcpy(vx, ovx, sizeof(vx)); - memcpy(vy, ovy, sizeof(vy)); - memcpy(pv, opv, sizeof(pv)); -} - -void *update_air_th(void *arg) -{ - update_air(); - return NULL; -} - -inline unsigned clamp_flt(float f, float min, float max) -{ - if(fmax) - return 255; - return (int)(255.0f*(f-min)/(max-min)); -} - -inline float restrict_flt(float f, float min, float max) -{ - if(fmax) - return max; - return f; -} - -void draw_air(pixel *vid) -{ - int x, y, i, j; - pixel c; - - if(cmode == 2) - return; - - for(y=0; y 0.0f) - c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); - else - c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); - } - else - c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), - clamp_flt(pv[y][x], 0.0f, 8.0f), - clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); - for(j=0; j=XRES || ny>=YRES) - return 0; - if(x==nx && y==ny) - return 1; - r = pmap[ny][nx]; - if(r && (r>>8)>8].type; - - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) - { - return 1; - } - - if((r&0xFF)==PT_VOID) - { - parts[i].type=PT_NONE; - return 0; - } - if((r&0xFF)==PT_BHOL) - { - parts[i].type=PT_NONE; - if(!legacy_enable) - { - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; - } - return 0; - } - - if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide - { - return 1; - } - - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) - { - return 1; - } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) - { - return 0; - } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) - { - return 0; - } - - if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; - if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) - return 0; - if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) - return 0; - - if(parts[i].type==PT_CNCT && y>8)>= 8; - parts[r].x += x-nx; - parts[r].y += y-ny; - } - - return 1; -} - -void kill_part(int i) -{ - int x, y; - parts[i].type = PT_NONE; - - x = (int)(parts[i].x+0.5f); - y = (int)(parts[i].y+0.5f); - - if(x>=0 && y>=0 && x=XRES || y>=YRES) - return -1; - - if(t==SPC_HEAT||t==SPC_COOL) - { - if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); - } - if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) - { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); - } - return pmap[y][x]>>8; - } - else - { - return -1; - } - } - if(t==SPC_AIR) - { - pv[y/CELL][x/CELL] += 0.03f; - if(y+CELL>8].type = PT_SPRK; - parts[pmap[y][x]>>8].life = 4; - parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; - pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; - return pmap[y][x]>>8; - } - - if(p==-1) - { - if(pmap[y][x]) - return -1; - if(pfree == -1) - return -1; - i = pfree; - pfree = parts[i].life; - } - else - i = p; - - if(t==PT_GLAS) - { - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - } - if(t!=PT_STKM) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = t; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 0; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - } - if(t==PT_ACID) - { - parts[i].life = 75; - } - //Testing - /*if(t==PT_WOOD){ - parts[i].life = 150; - }*/ - //End Testing - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_PLSM) - parts[i].life = rand()%150+50; - if(t==PT_LAVA) - parts[i].life = rand()%120+240; - if(t==PT_NBLE) - parts[i].life = 0; - if(t==PT_NEUT) - { - float r = (rand()%128+128)/127.0f; - float a = (rand()%360)*3.14159f/180.0f; - parts[i].life = rand()%480+480; - parts[i].vx = r*cosf(a); - parts[i].vy = r*sinf(a); - } - if(t==PT_PHOT) - { - float r = (rand()%3-1)*3; - float a = (rand()%3-1)*3; - parts[i].life = 680; - if(a==0.0f&&r==0.0f) - { - parts[i].life = 0; - parts[i].type = PT_NONE; - return -1; - } - else - { - parts[i].vx = a; - parts[i].vy = r; - } - //} else { - // parts[i].life = 0; - // parts[i].type = PT_NONE; - //} - } - - if(t!=PT_STKM) - pmap[y][x] = t|(i<<8); - else - { - if(isplayer==0) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - player[2] = PT_DUST; - player[3] = x-1; //Setting legs positions - player[4] = y+6; - player[5] = x-1; - player[6] = y+6; - - player[7] = x-3; - player[8] = y+12; - player[9] = x-3; - player[10] = y+12; - - player[11] = x+1; - player[12] = y+6; - player[13] = x+1; - player[14] = y+6; - - player[15] = x+3; - player[16] = y+12; - player[17] = x+3; - player[18] = y+12; - - isplayer = 1; - } - } - - return i; -} - -void delete_part(int x, int y) -{ - unsigned i; - - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - i = pmap[y][x]; - if(!i || (i>>8)>=NPART) - return; - - kill_part(i>>8); - pmap[y][x] = 0; // just in case -} - -inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -{ - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - if(a!=255) - { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -int sign(float i) //Signum function -{ - if (i<0) - return -1; - if (i>0) - return 1; - return 0; -} - -void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a) //Draws a line -{ - int dx, dy, i, sx, sy, check, e, x, y; - - dx = abs(x1-x2); - dy = abs(y1-y2); - sx = sign(x2-x1); - sy = sign(y2-y1); - x = x1; - y = y1; - check = 0; - - if (dy>dx) - { - dx = dx+dy; - dy = dx-dy; - dx = dx-dy; - check = 1; - } - - e = (dy<<2)-dx; - for (i=0; i<=dx; i++) - { - vid[x+y*a] =PIXRGB(r, g, b); - if (e>=0) - { - if (check==1) - x = x+sx; - else - y = y+sy; - e = e-(dx<<2); - } - if (check==1) - y = y+sy; - else - x = x+sx; - e = e+(dy<<2); - } -} - -void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -{ - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + 255*PIXR(t)) >> 8; - g = (a*g + 255*PIXG(t)) >> 8; - b = (a*b + 255*PIXB(t)) >> 8; - if(r>255) - r = 255; - if(g>255) - g = 255; - if(b>255) - b = 255; - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); - -int is_wire(int x, int y) -{ - return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; -} -int is_wire_off(int x, int y) -{ - return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; -} - -void set_emap(int x, int y) -{ - int x1, x2; - - if(!is_wire_off(x, y)) - return; - - // go left as far as possible - x1 = x2 = x; - while(x1>0) - { - if(!is_wire_off(x1-1, y)) - break; - x1--; - } - while(x21 && x1==x2 && - is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && - !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) - set_emap(x1, y-2); - else if(y>0) - for(x=x1; x<=x2; x++) - if(is_wire_off(x, y-1)) - { - if(x==x1 || x==x2 || y>=YRES/CELL-1 || - is_wire(x-1, y-1) || is_wire(x+1, y-1) || - is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) - set_emap(x, y-1); - } - - if(y>8) < NPART && (pmr>>8) >= 0) - { - return parts[pmr>>8].type; - } - else - { - return PT_NONE; - } -} -int nearest_part(int ci, int t) -{ - int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); - int ndistance = 0; - int id = -1; - int i = 0; - int cx = (int)parts[ci].x; - int cy = (int)parts[ci].y; - for(i=0; i=XRES || y>=YRES || - ((bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) - { - kill_part(i); - continue; - } - - vx[y/CELL][x/CELL] *= ptypes[t].airloss; - vy[y/CELL][x/CELL] *= ptypes[t].airloss; - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - if(t==PT_GASS||t==PT_NBLE) - { - if(pv[y/CELL][x/CELL]<3.5f) - pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); - if(y+CELL2.5f) - { - parts[i].life = rand()%80+180; - rt = parts[i].type = PT_FIRE; - parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - pv[y/CELL][x/CELL] += 0.25f * CFDS; - t = PT_FIRE; - } - - parts[i].vx *= ptypes[t].loss; - parts[i].vy *= ptypes[t].loss; - - if(t==PT_DFRM && !parts[i].life) - { - if(pv[y/CELL][x/CELL]>1.0f) - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - parts[i].life = rand()%80+300; - } - } - else - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - - if(ptypes[t].diffusion) - { - parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - } - - // interpolator -#ifdef WIN32 - mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#else - mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#endif - if(mv < ISTP) - { - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - } - else - { - dx = parts[i].vx*ISTP/mv; - dy = parts[i].vy*ISTP/mv; - ix = parts[i].x; - iy = parts[i].y; - while(1) - { - mv -= ISTP; - if(mv <= 0.0f) - { - // nothing found - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - break; - } - ix += dx; - iy += dy; - nx = (int)(ix+0.5f); - ny = (int)(iy+0.5f); - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) - { - parts[i].x = ix; - parts[i].y = iy; - break; - } - } - } - - a = nt = 0; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx4.0f) - t = parts[i].type = PT_DSTW; - if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) - t = parts[i].type = PT_OILL; - if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) - t = parts[i].type = PT_GASS; - } - if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) - t = parts[i].type = PT_BRMT; - //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) - // t = parts[i].type = PT_BGLA; - if(t==PT_GLAS) - { - parts[i].pavg[0] = parts[i].pavg[1]; - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) - { - parts[i].type = PT_BGLA; - } - } - if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) - t = parts[i].type = PT_SNOW; - if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) - { - t = PT_NEUT; - create_part(i, x, y, t); - } - - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) - { - nearp = nearest_part(i, PT_ETRD); - if(nearp!=-1) - { - create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[nearp].type = PT_SPRK; - parts[nearp].life = 9; - parts[nearp].ctype = PT_ETRD; - } - } - - if(!legacy_enable) - { - int ctemp = pv[y/CELL][x/CELL]*2; - c_heat = 0.0f; - h_count = 0; - if(ptypes[t].hconduct>(rand()%250)) - { - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) - { - h_count++; - c_heat += parts[r>>8].temp; - } - } - } - } - pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) - { - parts[r>>8].temp = parts[i].temp; - } - } - } - } - if(pt>=pstates[t].btemp&&pstates[t].burn) - { - t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE||t==PT_PLSM) - parts[i].life = rand()%50+120; - } - else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) - { - if(t==PT_LAVA&&parts[i].ctype) - { - parts[i].life = 0; - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) - { - parts[i].ctype = parts[i].type; - t = parts[i].type = PT_ICEI; - } - else - { - parts[i].life = 0; - t = parts[i].type = pstates[t].solid; - } - } - else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) - { - if(pstates[t].liquid==PT_LAVA) - { - parts[i].life = rand()%120+240; - parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; - parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; - t = parts[i].type = pstates[t].liquid; - } - else if(t==PT_ICEI&&parts[i].ctype) - { - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else - { - t = parts[i].type = pstates[t].liquid; - } - } - else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) - { - t = parts[i].type = pstates[t].liquid; - } - else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) - { - if(t==PT_SLTW&&1>rand()%6) - { - t = parts[i].type = PT_SALT; - } - else - { - t = parts[i].type = pstates[t].gas; - pv[y/CELL][x/CELL] += 0.50f; - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - } - } - if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) - { - float atemp = parts[i].temp + (-MIN_TEMP); - pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; - } - if(t==PT_LAVA) - { - parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - } - pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - } - } - if(t==PT_CSCN&&parts[i].temp>24.0f) - { - pt = parts[i].temp -= 2.5f; - } - if(t==PT_HSCN&&parts[i].temp>24.0f) - { - pt = parts[i].temp -= 2.5f; - } - - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) - { - nx = x % CELL; - if(nx == 0) - nx = x/CELL - 1; - else if(nx == CELL-1) - nx = x/CELL + 1; - else - nx = x/CELL; - ny = y % CELL; - if(ny == 0) - ny = y/CELL - 1; - else if(ny == CELL-1) - ny = y/CELL + 1; - else - ny = y/CELL; - if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ) - { - t = parts[i].type = PT_NONE; - parts[r>>8].ctype = parts[r>>8].type; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - } - else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) - { - pv[y/CELL][x/CELL] += 100.0f; - if(legacy_enable&&1>(rand()%200)) - { - parts[i].life = rand()%50+120; - t = parts[i].type = PT_FIRE; - } - else - { - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_ICEI || t==PT_SNOW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if(legacy_enable) - { - if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_ICEI; - parts[r>>8].type = PT_ICEI; - } - if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) - t = parts[i].type = PT_WATR; - } - } - } - else if(t==PT_HSCN||t==PT_CSCN) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) - { - parts[i].temp = 200.0f; - } - } - } - //PLANT - else if(t==PT_PLNT) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR && 1>(rand()%250)) - { - t = parts[i].type = PT_PLNT; - parts[r>>8].type = PT_PLNT; - } - else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_WATR||t==PT_DSTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%250)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_WATR; - } - if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_SLTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) - { - parts[r>>8].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_WTRV) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - parts[r>>8].type = PT_WATR; - } - - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - if(1>(rand()%1000)) - parts[r>>8].type = PT_WATR; - } - } - } - else if(t==PT_ACID) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)!=PT_ACID) - { - if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) - { - t = parts[i].type = PT_FIRE; - parts[i].life = 4; - parts[r>>8].type = PT_FIRE; - parts[r>>8].life = 4; - } - else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) - { - parts[i].life--; - parts[r>>8].type = PT_NONE; - } - else if (parts[i].life==50) - { - parts[i].life = 0; - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_NEUT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) - { - if(33>rand()%100) - { - create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); - } - else - { - create_part(r>>8, x+nx, y+ny, PT_NEUT); - parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; - parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; - } - pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough - fe ++; - } - if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) - parts[r>>8].type = PT_DUST; - if((r&0xFF)==PT_WATR && 15>(rand()%100)) - parts[r>>8].type = PT_DSTW; - if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) - parts[r>>8].type = PT_DFRM; - if((r&0xFF)==PT_NITR && 15>(rand()%1000)) - parts[r>>8].type = PT_OILL; - if((r&0xFF)==PT_OILL && 5>(rand()%1000)) - parts[r>>8].type = PT_GASS; - if((r&0xFF)==PT_PLNT && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - } - } - else if(t==PT_PHOT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=0; nx<1; nx++) - for(ny=0; ny<1; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - } - } - else if(t==PT_LCRY) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK) - { - if(parts[r>>8].ctype==PT_PSCN) - { - parts[i].life = 10; - } - else if(parts[r>>8].ctype==PT_NSCN) - { - parts[i].life = 9; - } - } - if(rt==PT_LCRY) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - else if(t==PT_BTRY) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(parts_avg(i,r>>8) != PT_INSL) - { - if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) - { - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - parts[r>>8].type = PT_SPRK; - } - } - } - } - if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)) || t ==PT_SWCH) - { - if(t==PT_SWCH) - if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) - { - parts[i].life--; - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) - continue; - rt = parts[r>>8].type; - if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && - ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) - { - parts[r>>8].type = PT_FIRE; - parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - parts[r>>8].life = rand()%80+180; - if(ptypes[rt].explosive) - pv[y/CELL][x/CELL] += 0.25f * CFDS; - continue; - } - lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; - if(lpv < 1) lpv = 1; - if(legacy_enable) - { - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && - ptypes[rt].meltable*lpv>(rand()%1000)) - { - if(t!=PT_LAVA || parts[i].life>0) - { - parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; - parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; - parts[r>>8].type = PT_LAVA; - parts[r>>8].life = rand()%120+240; - } - else - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE;//rt; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) - { - parts[r>>8].type = PT_WATR; - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = PT_METL; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) - { - kill_part(r>>8); - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; - parts[i].ctype = PT_NONE; - goto killed; - } - } - } - pavg = parts_avg(i, r>>8); - if(t==PT_SWCH&&pavg!= PT_INSL) - { - if(parts[r>>8].type == PT_SWCH) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - if(rt==PT_SWCH && t==PT_SPRK) - { - pavg = parts_avg(r>>8, i); - if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) - parts[r>>8].life = 10; - if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) - parts[r>>8].life = 9; - if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].ctype = PT_SWCH; - parts[r>>8].life = 4; - } - } - pavg = parts_avg(i, r>>8); - if(pavg != PT_INSL) - { - if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) - parts[r>>8].temp = parts[r>>8].temp+10.0f; - } - } - if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 6; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 5; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) - { - if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) - { - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - - if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) - { - parts[i].life = rand()%150+50; - parts[i].type = PT_PLSM; - parts[i].ctype = PT_NBLE; - parts[i].temp = 3500; - pv[y/CELL][x/CELL] += 1; - } - if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) - { - parts[i].type = PT_SWCH; - parts[i].life = 11; - } - } - } -killed: - if(parts[i].type == PT_NONE) - continue; - } - - if(t==PT_STKM) - { - //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) - parts[i].temp += 1; - - //Death - if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... - { - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - //Verlet integration - pp = 2*player[3]-player[5]; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+1; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+1; - player[18] = player[16]; - player[16] = pp; - - //Go left - if (((int)(player[0])&0x01) == 0x01) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] += 3; - player[10] += 2; - player[5] += 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 3; - player[18] += 2; - player[13] +=2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[9] += 1; - player[10] += 1; - player[5] += 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 1; - player[18] += 1; - player[13] +=1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 3; - player[10] += 2; - player[5] -= 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 3; - player[18] += 2; - player[13] -= 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 1; - player[10] += 1; - player[5] -= 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 1; - player[18] += 1; - player[13] -= 1; - } - - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)) - { - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - create_part(-1, nx, ny, player[2]); - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 ) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - } - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[10] += 1; - player[18] += 1; - } - - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; - player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; - player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; - player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; - player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; - parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; - player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; - parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; - player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) - player[15] -= nx; - - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= 10+ny; - parts[i].vy = -10; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[7] += 0.2; - player[15] -= 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[3] += 0.2; - player[11] -= 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[16] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[8] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } - - if(t==PT_CLNE) - { - if(!parts[i].ctype) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx=XRES-CELL || - ny=YRES-CELL) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - continue; - } - - rt = parts[i].flags & FLAG_STAGNANT; - parts[i].flags &= ~FLAG_STAGNANT; - if(!try_move(i, x, y, nx, ny)) - { - parts[i].x = lx; - parts[i].y = ly; - if(ptypes[t].falldown) - { - if(nx!=x && try_move(i, x, y, nx, y)) - { - parts[i].x = ix; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x, ny)) - { - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else - { - r = (rand()%2)*2-1; - if(ny!=y && try_move(i, x, y, x+r, ny)) - { - parts[i].x += r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x-r, ny)) - { - parts[i].x -= r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y+r)) - { - parts[i].x = ix; - parts[i].y += r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y-r)) - { - parts[i].x = ix; - parts[i].y -= r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) - { - s = 0; - if(!rt || nt) - rt = 50; - else - rt = 10; - for(j=x+r; j>=0 && j>=x-rt && j0) - r = 1; - else - r = -1; - if(s) - for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; - if(nxy+ISTP) ny=y+ISTP; - if(ny(rand()%1000)) - { - kill_part(i); - continue; - } - else if(try_move(i, x, y, 2*x-nx, ny)) - { - parts[i].x = (float)(2*x-nx); - parts[i].y = (float)iy; - parts[i].vx *= ptypes[t].collision; - } - else if(try_move(i, x, y, nx, 2*y-ny)) - { - parts[i].x = (float)ix; - parts[i].y = (float)(2*y-ny); - parts[i].vy *= ptypes[t].collision; - } - else - { - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - } - } - -justdraw: - - nx = (int)(parts[i].x+0.5f); - ny = (int)(parts[i].y+0.5f); - - if(nx=XRES-CELL || - ny=YRES-CELL) - { - kill_part(i); - continue; - } - if(cmode!=CM_HEAT) - { - if(t==PT_STKM) //Just draw head here - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; - vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; - vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; - vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; - } - draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); - draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); - draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); - draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); - - isplayer = 1; //It's a secret. Tssss... - } - - if(t==PT_ACID) - { - if(parts[i].life>255) parts[i].life = 255; - if(parts[i].life<47) parts[i].life = 48; - s = (255/((parts[i].life-46)*28)); - if(s==0) s = 1; - cr = PIXR(ptypes[t].pcolors)/s; - cg = PIXG(ptypes[t].pcolors)/s; - cb = PIXB(ptypes[t].pcolors)/s; - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); - } - } - - if(cmode==4) - { - blendpixel(vid, nx+1, ny, cr, cg, cb, 223); - blendpixel(vid, nx-1, ny, cr, cg, cb, 223); - blendpixel(vid, nx, ny+1, cr, cg, cb, 223); - blendpixel(vid, nx, ny-1, cr, cg, cb, 223); - - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); - } - } - else if(t==PT_OILL) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,64,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,64,16,40); - } - } - } - else if(t==PT_NEUT) - { - if(cmode == 3||cmode==4) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 8; - cb = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = 0x20; - cg = 0xE0; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_PLUT) - { - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_URAN) - { - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_SLTW) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,80,240,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,80,240,50); - } - } - } - else if(t==PT_PHOT) - { - if(cmode == 3||cmode==4) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 12; - cb = 12; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_SWCH && parts[i].life == 10) - { - x = nx; - y = ny; - blendpixel(vid,x,y,17,217,24,255); - } - else if(t==PT_LNTG) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,128,160,223,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,128,160,223,50); - } - } - } - else if(t==PT_SMKE) - { - if(cmode == 3||cmode==4) - { - x = nx/CELL; - y = ny/CELL; - cg = 10; - cb = 10; - cr = 10; - cg += fire_g[y][x]; - if(cg > 50) cg = 50; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 50) cb = 50; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 50) cr = 50; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny,100,100,100,30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,100,100,100,10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,100,100,100,20); - } - } - } - } - else if(t==PT_WATR) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - - } - else if(t==PT_DSTW) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - } - else if(t==PT_NITR) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,224,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,224,16,50); - } - } - - } - else if(t==PT_LRBD) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,170,170,170,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,170,170,170,50); - } - } - - } - - else if(t==PT_NBLE) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,235,73,23,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,235,73,23,20); - } - } - - } - else if(t==PT_GASS) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,255,32,255); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,224,255,32,20); - } - } - - } - else if(t==PT_WTRV) - { - if(cmode == 3||cmode==4) - { - x = nx/CELL; - y = ny/CELL; - cg = PIXG(ptypes[t].pcolors)/3; - cb = PIXB(ptypes[t].pcolors)/3; - cr = PIXR(ptypes[t].pcolors)/3; - cg += fire_g[y][x]; - if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); - } - } - } - } - else if(t==PT_THDR) - { - if(cmode == 3||cmode==4) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 16; - cb = 20; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xA0; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LCRY) - { - if(cmode == 3||cmode==4) - { - //cr = R/8; - //cg = G/8; - //cb = B/8; - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); - //x = nx/CELL; - //y = ny/CELL; - //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } - else - { - cr = 0x50+(parts[i].life*10); - cg = 0x50+(parts[i].life*10); - cb = 0x50+(parts[i].life*10); - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_PLUT) { - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 5); - blendpixel(vid, nx-1, ny, cr, cg, cb, 5); - blendpixel(vid, nx, ny+1, cr, cg, cb, 5); - blendpixel(vid, nx, ny-1, cr, cg, cb, 5); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_URAN) - { - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 5); - blendpixel(vid, nx-1, ny, cr, cg, cb, 5); - blendpixel(vid, nx, ny+1, cr, cg, cb, 5); - blendpixel(vid, nx, ny-1, cr, cg, cb, 5); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_PLSM) - { - float ttemp = parts[i].life; - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = plasma_data[caddress]; - uint8 G = plasma_data[caddress+1]; - uint8 B = plasma_data[caddress+2]; - if(cmode == 3||cmode==4) - { - cr = R/8; - cg = G/8; - cb = B/8; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_FIRE && parts[i].life) - { - if(cmode == 3||cmode==4) - { - cr = parts[i].life / 4; - cg = parts[i].life / 16; - cb = parts[i].life / 32; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = parts[i].life * 8; - cg = parts[i].life * 2; - cb = parts[i].life; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LAVA && parts[i].life) - { - cr = parts[i].life * 2 + 0xE0; - cg = parts[i].life * 1 + 0x50; - cb = parts[i].life/2 + 0x10; - if(cr>255) cr = 255; - if(cg>192) cg = 192; - if(cb>128) cb = 128; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 64); - blendpixel(vid, nx-1, ny, cr, cg, cb, 64); - blendpixel(vid, nx, ny+1, cr, cg, cb, 64); - blendpixel(vid, nx, ny-1, cr, cg, cb, 64); - if(cmode == 3||cmode==4) - { - cr /= 32; - cg /= 32; - cb /= 32; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else if(t==PT_LAVA || t==PT_SPRK) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - if(cmode == 3 || cmode==4) - { - if(t == PT_LAVA) - { - cr = 3; - cg = i%2; - cb = 0; - } - else - { - cr = 8; - cg = 12; - cb = 16; - } - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - } - else - { - float ttemp = parts[i].temp+(-MIN_TEMP); - int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); - uint8 R = color_data[caddress]; - uint8 G = color_data[caddress+1]; - uint8 B = color_data[caddress+2]; - - if(t==PT_STKM) //Stick man should be visible in heat mode - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); - vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); - vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); - vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); - } - draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); - draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); - draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); - draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); - } - else - { - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); - //blendpixel(vid, nx+1, ny, R, G, B, 255); - } - } - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) - { - uint8 R = PIXR(ptypes[t].pcolors); - uint8 G = PIXG(ptypes[t].pcolors); - uint8 B = PIXB(ptypes[t].pcolors); - - //if(vid[(ny-1)*YRES+(nx-1)]!=0){ - // blendpixel(vid, nx, ny-1, R, G, B, 46); - //} - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); - } - - } - -} - -void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) -{ - blendpixel(vid, x+1, y, cr, cg, cb, 112); - blendpixel(vid, x-1, y, cr, cg, cb, 112); - blendpixel(vid, x, y+1, cr, cg, cb, 112); - blendpixel(vid, x, y-1, cr, cg, cb, 112); - - blendpixel(vid, x+1, y-1, cr, cg, cb, 64); - blendpixel(vid, x-1, y-1, cr, cg, cb, 64); - blendpixel(vid, x+1, y+1, cr, cg, cb, 64); - blendpixel(vid, x-1, y+1, cr, cg, cb, 64); -} - -void update_particles_i_th(void *arg) -{ - upstruc *newup = (upstruc*)arg; - update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); - return; -} - -void update_particles(pixel *vid) -{ - int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; - float lx, ly; -#ifdef MT - int pt = 0, pc = 0; - pthread_t *InterThreads; -#endif - - isplayer = 0; //Needed for player spawning - memset(pmap, 0, sizeof(pmap)); - r = rand()%2; - for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==13) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && !sys_pause) - emap[y][x] --; - } - } - } - else - { - for(y=0; y>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==9) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && !sys_pause) - emap[y][x] --; - } - } - } - -#ifdef MT - if(numCores > 1) - { - InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); - for(pc = 0; pc=XRES || ny<0 || ny>=YRES) - break; - addpixel(vid, nx, ny, 255, 255, 255, 64); - i = nx/CELL; - j = ny/CELL; - lx += vx[j][i]*0.125f; - ly += vy[j][i]*0.125f; - if(bmap[j][i]==5 && i!=x && j!=y) - break; - } - drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); - } - -} - -void update_particles_th(void *arg) -{ - update_particles((pixel*)arg); - return; -} - -/*********************************************************** - * SDL OUTPUT * - ***********************************************************/ - -int sdl_scale = 1; -SDL_Surface *sdl_scrn; -SDLMod sdl_mod; -int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; - -#include "icon.h" -void sdl_seticon(void) -{ -#ifdef WIN32 - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else -#ifdef MACOSX - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else - SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#endif -#endif -} - -void sdl_open(void) -{ - if(SDL_Init(SDL_INIT_VIDEO)<0) - { - fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); - exit(1); - } - atexit(SDL_Quit); -#ifdef PIX16 - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); -#else - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); -#endif - if(!sdl_scrn) - { - fprintf(stderr, "Creating window: %s\n", SDL_GetError()); - exit(1); - } - SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); - sdl_seticon(); - SDL_EnableUNICODE(1); - //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); -} - -void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0; jpitch/PIXELSIZE; - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} - -void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - int i,k; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0; jpitch/PIXELSIZE; - } - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} -void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) -{ - if(sdl_scale == 2) - sdl_blit_2(x, y, w, h, src, pitch); - else - sdl_blit_1(x, y, w, h, src, pitch); -} - -int frame_idx=0; -void dump_frame(pixel *src, int w, int h, int pitch) -{ - char frame_name[32]; - int j,i; - unsigned char c[3]; - FILE *f; - sprintf(frame_name,"frame%04d.ppm",frame_idx); - f=fopen(frame_name,"wb"); - fprintf(f,"P6\n%d %d\n255\n",w,h); - for(j=0; j=0 && x=0 && yPT_NUM) - return 2; - if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) - return 3; - i = XRES*YRES; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) - return 1; - size = i; - } - else - d = c; - - if(size < XRES*YRES) - { - if(bzip2) - free(d); - return 1; - } - - sy = 0; - for(y=0; y+scl<=YRES; y+=scl) - { - sx = 0; - for(x=0; x+scl<=XRES; x+=scl) - { - a = 0; - r = g = b = 0; - for(j=0; j=PT_NUM) - goto corrupt; - r += PIXR(ptypes[t].pcolors); - g += PIXG(ptypes[t].pcolors); - b += PIXB(ptypes[t].pcolors); - a ++; - } - } - if(a) - { - a = 256/a; - r = (r*a)>>8; - g = (g*a)>>8; - b = (b*a)>>8; - } - - drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); - sx++; - } - sy++; - } - - if(bzip2) - free(d); - return 0; - -corrupt: - if(bzip2) - free(d); - return 1; -} - -static char *mystrdup(char *s) -{ - char *x; - if(s) - { - x = malloc(strlen(s)+1); - strcpy(x, s); - return x; - } - return s; -} - -void *build_save(int *size, int x0, int y0, int w, int h) -{ - unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; - int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); - int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - // save the required air state - for(y=by0; y255) i=255; - d[p++] = i; - } - for(y=by0; y255) i=255; - d[p++] = i; - } - - // save the particle map - for(i=0; i=x0 && x=y0 && y255) x=255; - if(y<0) y=0; - if(y>255) y=255; - d[p++] = x; - d[p++] = y; - } - } - for(j=0; j255) tttemp=255; - d[p++] = tttemp; - } - } - for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; - d[p++] = (signs[i].y-y0); - d[p++] = (signs[i].y-y0)>>8; - d[p++] = signs[i].ju; - x = strlen(signs[i].text); - d[p++] = x; - memcpy(d+p, signs[i].text, x); - p+=x; - } - - i = (p*101+99)/100 + 612; - c = malloc(i); - c[0] = 0x66; - c[1] = 0x75; - c[2] = 0x43; - c[3] = legacy_enable; - c[4] = SAVE_VERSION; - c[5] = CELL; - c[6] = bw; - c[7] = bh; - c[8] = p; - c[9] = p >> 8; - c[10] = p >> 16; - c[11] = p >> 24; - - i -= 12; - - if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) - { - free(d); - free(c); - return NULL; - } - free(d); - - *size = i+12; - return c; -} - -int parse_save(void *save, int size, int replace, int x0, int y0) -{ - unsigned char *d,*c=save; - int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; - int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; - int fp[NPART], nf=0; - - if(size<16) - return 1; - if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) - return 1; - if(c[4]>SAVE_VERSION) - return 2; - ver = c[4]; - - if(ver<34) - { - legacy_enable = 1; - } - else - { - if(c[3]==1||c[3]==0) - legacy_enable = c[3]; - else - legacy_beta = 1; - } - - bw = c[6]; - bh = c[7]; - if(bx0+bw > XRES/CELL) - bx0 = XRES/CELL - bw; - if(by0+bh > YRES/CELL) - by0 = YRES/CELL - bh; - if(bx0 < 0) - bx0 = 0; - if(by0 < 0) - by0 = 0; - - if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) - return 3; - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - return 1; - size = i; - - if(size < bw*bh) - return 1; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - if(replace) - { - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(signs, 0, sizeof(signs)); - memset(parts, 0, sizeof(particle)*NPART); - memset(pmap, 0, sizeof(pmap)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(pv, 0, sizeof(pv)); - } - - // make a catalog of free parts - memset(pmap, 0, sizeof(pmap)); - for(i=0; i= size) - goto corrupt; - fvx[y][x] = (d[p++]-127.0f)/64.0f; - } - for(y=by0; y= size) - goto corrupt; - fvy[y][x] = (d[p++]-127.0f)/64.0f; - } - - // load the particle map - i = 0; - pty = p; - for(y=y0; y= size) - goto corrupt; - j=d[p++]; - if(j >= PT_NUM) - goto corrupt; - if(j && !(isplayer == 1 && j==PT_STKM)) - { - if(pmap[y][x]) - { - k = pmap[y][x]>>8; - parts[k].type = j; - parts[k].x = (float)x; - parts[k].y = (float)y; - m[(x-x0)+(y-y0)*w] = k+1; - } - else if(i < nf) - { - parts[fp[i]].type = j; - parts[fp[i]].x = (float)x; - parts[fp[i]].y = (float)y; - m[(x-x0)+(y-y0)*w] = fp[i]+1; - i++; - } - else - m[(x-x0)+(y-y0)*w] = NPART+1; - } - } - - // load particle properties - for(j=0; j= size) - goto corrupt; - if(i < NPART) - { - parts[i].vx = (d[p++]-127.0f)/16.0f; - parts[i].vy = (d[p++]-127.0f)/16.0f; - if(parts[i].type == PT_STKM) - { - player[2] = PT_DUST; - - player[3] = parts[i].x-1; //Setting legs positions - player[4] = parts[i].y+6; - player[5] = parts[i].x-1; - player[6] = parts[i].y+6; - - player[7] = parts[i].x-3; - player[8] = parts[i].y+12; - player[9] = parts[i].x-3; - player[10] = parts[i].y+12; - - player[11] = parts[i].x+1; - player[12] = parts[i].y+6; - player[13] = parts[i].x+1; - player[14] = parts[i].y+6; - - player[15] = parts[i].x+3; - player[16] = parts[i].y+12; - player[17] = parts[i].x+3; - player[18] = parts[i].y+12; - - } - } - else - p += 2; - } - } - for(j=0; j= size) - goto corrupt; - if(i <= NPART) - parts[i-1].life = d[p++]*4; - else - p++; - } - } - for(j=0; j=34&&legacy_beta==0) - { - if(p >= size) - { - goto corrupt; - } - if(i <= NPART) - { - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; - } - else - { - p++; - } - } - else - { - parts[i-1].temp = ptypes[parts[i-1].type].heat; - } - } - } - for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) - { - if(p >= size) - goto corrupt; - if(i <= NPART) - parts[i-1].ctype = d[p++]; - else - p++; - } - } - - if(p >= size) - goto version1; - j = d[p++]; - for(i=0; i size) - goto corrupt; - for(k=0; k size) - goto corrupt; - if(kSAVE_VERSION) - return NULL; - - bw = c[6]; - bh = c[7]; - w = bw*CELL; - h = bh*CELL; - - if(c[5]!=CELL) - return NULL; - - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return NULL; - fb = calloc(w*h, PIXELSIZE); - if(!fb) - { - free(d); - return NULL; - } - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - goto corrupt; - size = i; - - if(size < bw*bh) - goto corrupt; - - k = 0; - for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) - goto corrupt; - - for(y=0; y= size) - goto corrupt; - j=d[p++]; - if(j0) - { - if(j==PT_STKM) //Stickman should be drawed another way - { - //Stickman drawing - for(k=-2; k<=1; k++) - { - fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); - fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); - fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); - fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); - } - draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); - draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); - draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); - draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); - } - else - fb[y*w+x] = ptypes[j].pcolors; - } - } - - free(d); - *width = w; - *height = h; - return fb; - -corrupt: - free(d); - free(fb); - return NULL; -} - -/* NO, I DON'T THINK SO - #include "fbi.h" - - pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) - { - unsigned char *tmp; - pixel *res; - int i; - - tmp = malloc(width*height*3); - if(!tmp) - return NULL; - res = malloc(width*height*PIXELSIZE); - if(!res) { - free(tmp); - return NULL; - } - - i = width*height*3; - if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { - free(res); - free(tmp); - return NULL; - } - - for(i=0; i1) - { - r = (r+c/2)/c; - g = (g+c/2)/c; - b = (b+c/2)/c; - } - q[y*w+x] = PIXRGB(r, g, b); - } - *qw = w; - *qh = h; - return q; -} - -#define GRID_X 5 -#define GRID_Y 4 -#define GRID_P 3 -#define GRID_S 6 -#define GRID_Z 3 - -void stamp_gen_thumb(int i) -{ - char fn[64]; - void *data; - int size, factor_x, factor_y; - pixel *tmp; - - if(stamps[i].thumb) - { - free(stamps[i].thumb); - stamps[i].thumb = NULL; - } - - sprintf(fn, "stamps" PATH_SEP "%s.stm", stamps[i].name); - data = file_load(fn, &size); - - if(data) - { - stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); - if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) - { - factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); - factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); - if(factor_y > factor_x) - factor_x = factor_y; - tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); - free(stamps[i].thumb); - stamps[i].thumb = tmp; - } - } - - free(data); -} - -int clipboard_ready = 0; -void *clipboard_data = 0; -int clipboard_length = 0; - -void stamp_save(int x, int y, int w, int h) -{ - FILE *f; - int n; - char fn[64], sn[16]; - void *s=build_save(&n, x, y, w, h); - -#ifdef WIN32 - _mkdir("stamps"); -#else - mkdir("stamps", 0755); -#endif - - stamp_gen_name(sn); - sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); - - f = fopen(fn, "wb"); - if(!f) - return; - fwrite(s, n, 1, f); - fclose(f); - - free(s); - - if(stamps[STAMP_MAX-1].thumb) - free(stamps[STAMP_MAX-1].thumb); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); - memset(stamps, 0, sizeof(struct stamp_info)); - if(stamp_count0) - { - memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); - memcpy(stamps, &tmp, sizeof(struct stamp_info)); - - stamp_update(); - } - - return data; -} - -void stamp_init(void) -{ - int i; - FILE *f; - - memset(stamps, 0, sizeof(stamps)); - - f=fopen("stamps" PATH_SEP "stamps.def", "rb"); - if(!f) - return; - for(i=0; i=XRES+BARSIZE || y>=YRES+MENUSIZE) - return; - if(a!=255) - { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) -{ - int i, j, w, bn = 0, ba = 0; - char *rp = font_data + font_ptrs[c]; - w = *(rp++); - for(j=0; j>= 2; - bn -= 2; - } - return x + w; -} - -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) -{ - int sx = x; - for(; *s; s++) - { - if(*s == '\n') - { - x = sx; - y += FONT_H+2; - } - else if(*s == '\b') - { - switch(s[1]) - { - case 'w': - r = g = b = 255; - break; - case 'g': - r = g = b = 192; - break; - case 'o': - r = 255; - g = 216; - b = 32; - break; - case 'r': - r = 255; - g = b = 0; - break; - case 'b': - r = g = 0; - b = 255; - break; - } - s++; - } - else - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - return x; -} - -void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) -{ - int i; - for(i=0; i<=w; i++) - { - drawpixel(vid, x+i, y, r, g, b, a); - drawpixel(vid, x+i, y+h, r, g, b, a); - } - for(i=1; i=w && x+textwidth(s)>=w+5) - break; - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - if(*s) - for(i=0; i<3; i++) - x = drawchar(vid, x, y, '.', r, g, b, a); - return x; -} - -int textnwidth(char *s, int n) -{ - int x = 0; - for(; *s; s++) - { - if(!n) - break; - x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - n--; - } - return x-1; -} -int textwidthx(char *s, int w) -{ - int x=0,n=0,cw; - for(; *s; s++) - { - cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - if(x+(cw/2) >= w) - break; - x += cw; - n++; - } - return n; -} - -/*********************************************************** - * MAIN PROGRAM * - ***********************************************************/ - -void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) -{ - int x, y, i, j, c; - int bo = b; - if(iswall==1) - { - b = b-100; - x = (2+32*((b-22)/1)); - y = YRES+2+40; - switch(b) - { - case WL_WALLELEC: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - else - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) - { - for(i=1; i<6+j; i++) - { - if(!(i&j&1)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) - { - if(i&j&1) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) - { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<13; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) - { - for(i=14; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - default: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } - else - { - x = 2+32*(b/2); - y = YRES+2+20*(b%2); - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - if(bo==sl || bo==sr) - { - c = 0; - if(bo==sl) - c |= PIXPACK(0xFF0000); - if(bo==sr) - c |= PIXPACK(0x0000FF); - for(i=0; i<30; i++) - { - vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; - } - for(j=0; j<18; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; - } - } -} - -int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) -{ - int i, j, c; - if(b>=121) - { - b = b-100; - //x = (2+32*((b-22)/1)); - //y = YRES+2+40; - switch(b) - { - case WL_WALLELEC: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - else - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) - { - for(i=1; i<6+j; i++) - { - if(!(i&j&1)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) - { - if(i&j&1) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) - { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<13; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) - { - for(i=14; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - case 40: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - default: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } - else - { - //x = 2+32*(b/2); - //y = YRES+2+20*(b%2); - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - return 26; -} - -void draw_menu(pixel *vid_buf, int i, int hover) -{ - - //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); -#ifdef MENUV3 - drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - if(hover==i) - { - fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); - } -#else - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); -#endif -} - -void menu_ui(pixel *vid_buf, int i, int *sl, int *sr) -{ - int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; - pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); - fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); - memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - rows = ceil((float)msections[i].itemcount/16.0f); - height = (ceil((float)msections[i].itemcount/16.0f)*18); - width = restrict_flt(msections[i].itemcount*31, 0, 16*31); - //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); - h = -1; - x = XRES-BARSIZE-26; - y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; - sy = y; - //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); - fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); - fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); - drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); - if(i==SC_WALL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM) - { - if(x-26<=60) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=60) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=20) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - if(b==1&&h!=-1) - { - *sl = h; - } - if(b==4&&h!=-1) - { - *sr = h; - } -} - -int create_parts(int x, int y, int r, int c) -{ - int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; - - if(c == 125) - { - i = x / CELL; - j = y / CELL; - for(v=-1; v<2; v++) - for(u=-1; u<2; u++) - if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) - { - if(cp) - create_parts(y, x, r, c); - else - create_parts(x, y, r, c); - } - e -= 1.0f; - } - } -} - -void create_box(int x1, int y1, int x2, int y2, int c) -{ - int i, j; - if(x1>x2) - { - i = x2; - x2 = x1; - x1 = i; - } - if(y1>y2) - { - j = y2; - y2 = y1; - y1 = j; - } - for(j=y1; j<=y2; j++) - for(i=x1; i<=x2; i++) - create_parts(i, j, 1, c); -} - -int flood_parts(int x, int y, int c, int cm, int bm) -{ - int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) - { - c = c-100; - } - if(cm==-1) - { - if(c==0) - { - cm = pmap[y][x]&0xFF; - if(!cm) - return 0; - } - else - cm = 0; - } - if(bm==-1) - { - if(c==30) - { - bm = bmap[y/CELL][x/CELL]; - if(!bm) - return 0; - if(bm==1) - cm = 0xFF; - } - else - bm = 0; - } - - if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) - return 1; - - // go left as far as possible - x1 = x2 = x; - while(x1>=CELL) - { - if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) - break; - x1--; - } - while(x2=CELL+dy) - for(x=x1; x<=x2; x++) - if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) - if(!flood_parts(x, y-dy, co, cm, bm)) - return 0; - if(y=XRES || y>=YRES) - return; - c = vid[y*(XRES+BARSIZE)+x]; - c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); - if(c<512) - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); - else - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); -} - -void xor_line(int x1, int y1, int x2, int y2, pixel *vid) -{ - int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - e -= 1.0f; - } - } -} - -void draw_svf_ui(pixel *vid_buf) -{ - int c; - - drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); - drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - c = svf_open ? 255 : 128; - drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); - drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); - - c = svf_login ? 255 : 128; - drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); - if(svf_open) - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); - else - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); - drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); - if(svf_open && svf_own) - drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); - - c = (svf_login && svf_open) ? 255 : 128; - - drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - - if(svf_myvote==1 && (svf_login && svf_open)) - { - fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); - } - else if(svf_myvote==-1 && (svf_login && svf_open)) - { - fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); - } - - drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); - drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); - - drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); - if(svf_tags[0]) - drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); - else - drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); - - drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); - - drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); - drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); - if(svf_login) - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); - else - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); - drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); - - if(sys_pause) - { - fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); - drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - if(!legacy_enable) - { - fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - switch(cmode) - { - case 0: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); - break; - case 1: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); - break; - case 2: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); - break; - case 3: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); - break; - case 4: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); - break; - case 5: - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - break; - } - drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - - if(svf_admin) - { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); - } - else if(svf_mod) - { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - }//else if(amd) - // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? -} - -typedef struct ui_edit -{ - int x, y, w, nx; - char str[256],*def; - int focus, cursor, hide; -} ui_edit; -void ui_edit_draw(pixel *vid_buf, ui_edit *ed) -{ - int cx, i; - char echo[256], *str; - - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(ed->str[0]) - { - drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); - drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); - } - else if(!ed->focus) - drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); - if(ed->focus) - { - cx = textnwidth(str, ed->cursor); - for(i=-3; i<9; i++) - drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); - } -} -char *shift_0="`1234567890-=[]\\;',./"; -char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; -void ui_edit_process(int mx, int my, int mb, ui_edit *ed) -{ - char ch, ts[2], echo[256], *str; - int l, i; -#ifdef RAWINPUT - char *p; -#endif - - if(mb) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = 0; - ed->str[0] = 0; - } - else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = textwidthx(str, mx-ed->x); - } - else - ed->focus = 0; - } - if(ed->focus && sdl_key) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - l = strlen(ed->str); - switch(sdl_key) - { - case SDLK_HOME: - ed->cursor = 0; - break; - case SDLK_END: - ed->cursor = l; - break; - case SDLK_LEFT: - if(ed->cursor > 0) - ed->cursor --; - break; - case SDLK_RIGHT: - if(ed->cursor < l) - ed->cursor ++; - break; - case SDLK_DELETE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - ed->str[ed->cursor] = 0; - else if(ed->cursor < l) - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - break; - case SDLK_BACKSPACE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - { - if(ed->cursor > 0) - memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); - ed->cursor = 0; - } - else if(ed->cursor > 0) - { - ed->cursor--; - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - } - break; - default: -#ifdef RAWINPUT - if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) - { - ch = sdl_key; - if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) - { - if(ch>='a' && ch<='z') - ch &= ~0x20; - p = strchr(shift_0, ch); - if(p) - ch = shift_1[p-shift_0]; - } - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#else - if(sdl_ascii>=' ' && sdl_ascii<127) - { - ch = sdl_ascii; - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#endif - break; - } - } -} -typedef struct ui_checkbox -{ - int x, y; - int focus, checked; -} ui_checkbox; -void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) -{ - int w = 12; - if(ed->checked) - { - drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); - } - if(ed->focus) - { - drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); - } - else - { - drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); - } -} -void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) -{ - int w = 12; - - if(mb && !mbq) - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->checked = (ed->checked)?0:1; - } - } - else - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->focus = 1; - } - else - { - ed->focus = 0; - } - } -} - -void error_ui(pixel *vid_buf, int err, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - char *msg; - - msg = malloc(strlen(txt)+16); - if(err) - sprintf(msg, "%03d %s", err, txt); - else - sprintf(msg, "%s", txt); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - if(err) - drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); - else - drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - free(msg); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_ui(pixel *vid_buf, char *top, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); - drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_box(pixel *vid_buf, char *msg) -{ - int w = textwidth(msg)+16; - int x0=(XRES-w)/2,y0=(YRES-24)/2; - - clearrect(vid_buf, x0-2, y0-2, w+4, 28); - drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); -} - -int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - int ret = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); - drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); - drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); - drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) - { - ret = 1; - break; - } - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - { - ret = 1; - break; - } - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - return ret; -} - -int execute_tagop(pixel *vid_buf, char *op, char *tag) -{ - int status; - char *result; - - char *names[] = {"ID", "Tag", NULL}; - char *parts[2]; - - char *uri = malloc(strlen(SERVER)+strlen(op)+36); - sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); - - parts[0] = svf_id; - parts[1] = tag; - - result = http_multipart_post( - uri, - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - free(uri); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 1; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 1; - } - - if(result[2]) - { - strncpy(svf_tags, result+3, 255); - svf_id[15] = 0; - } - - if(result) - free(result); - - return 0; -} - -struct strlist -{ - char *str; - struct strlist *next; -}; -void strlist_add(struct strlist **list, char *str) -{ - struct strlist *item = malloc(sizeof(struct strlist)); - item->str = mystrdup(str); - item->next = *list; - *list = item; -} -int strlist_find(struct strlist **list, char *str) -{ - struct strlist *item; - for(item=*list; item; item=item->next) - if(!strcmp(item->str, str)) - return 1; - return 0; -} -void strlist_free(struct strlist **list) -{ - struct strlist *item; - while(*list) - { - item = *list; - *list = (*list)->next; - free(item); - } -} - -void tag_list_ui(pixel *vid_buf) -{ - int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; - char *p,*q,s; - char *tag=NULL, *op=NULL; - ui_edit ed; - struct strlist *vote=NULL,*down=NULL; - - ed.x = x0+25; - ed.y = y0+221; - ed.w = 158; - ed.nx = 1; - ed.def = "[new tag]"; - ed.focus = 0; - ed.hide = 0; - ed.cursor = 0; - strcpy(ed.str, ""); - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - op = tag = NULL; - - drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 256); - drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); - p = svf_tags; - s = svf_tags[0] ? ' ' : 0; - y = 36 + y0; - while(s) - { - q = strchr(p, ' '); - if(!q) - q = p+strlen(p); - s = *q; - *q = 0; - if(svf_own || svf_admin || svf_mod) - { - drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); - d = 14; - if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) - { - if(!ed1.focus) - break; - ed1.focus = 0; - ed2.focus = 1; - } - if(sdl_key==SDLK_ESCAPE) - { - if(!ed1.focus && !ed2.focus) - return; - ed1.focus = 0; - ed2.focus = 0; - } - } - - strcpy(svf_user, ed1.str); - md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); - - res = http_multipart_post( - "http://" SERVER "/Login.api", - NULL, NULL, NULL, - svf_user, svf_pass, - &err, NULL); - if(err != 200) - { - error_ui(vid_buf, err, http_ret_text(err)); - if(res) - free(res); - goto fail; - } - if(res && !strncmp(res, "OK", 2)) - { - if(!strcmp(res, "OK ADMIN")) - { - svf_admin = 1; - svf_mod = 0; - } - else if(!strcmp(res, "OK MOD")) - { - svf_admin = 0; - svf_mod = 1; - } - else - { - svf_admin = 0; - svf_mod = 0; - } - free(res); - svf_login = 1; - return; - } - if(!res) - res = mystrdup("Unspecified Error"); - error_ui(vid_buf, 0, res); - free(res); - -fail: - strcpy(svf_user, ""); - strcpy(svf_pass, ""); - svf_login = 0; - svf_own = 0; - svf_admin = 0; - svf_mod = 0; -} - -void execute_delete(pixel *vid_buf, char *id) -{ - int status; - char *result; - - char *names[] = {"ID", NULL}; - char *parts[1]; - - parts[0] = id; - - result = http_multipart_post( - "http://" SERVER "/Delete.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return; - } - - if(result) - free(result); -} - -int execute_vote(pixel *vid_buf, char *id, char *action) -{ - int status; - char *result; - - char *names[] = {"ID", "Action", NULL}; - char *parts[2]; - - parts[0] = id; - parts[1] = action; - - result = http_multipart_post( - "http://" SERVER "/Vote.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 0; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 0; - } - - if(result) - free(result); - return 1; -} - -static char hex[] = "0123456789ABCDEF"; -void strcaturl(char *dst, char *src) -{ - char *d; - unsigned char *s; - - for(d=dst; *d; d++) ; - - for(s=(unsigned char *)src; *s; s++) - { - if((*s>='0' && *s<='9') || - (*s>='a' && *s<='z') || - (*s>='A' && *s<='Z')) - *(d++) = *s; - else - { - *(d++) = '%'; - *(d++) = hex[*s>>4]; - *(d++) = hex[*s&15]; - } - } - *d = 0; -} - -#define THUMB_CACHE_SIZE 256 - -char *thumb_cache_id[THUMB_CACHE_SIZE]; -void *thumb_cache_data[THUMB_CACHE_SIZE]; -int thumb_cache_size[THUMB_CACHE_SIZE]; -int thumb_cache_lru[THUMB_CACHE_SIZE]; - -void thumb_cache_inval(char *id) -{ - int i,j; - for(i=0; i= THUMB_CACHE_SIZE) - return; - free(thumb_cache_id[i]); - free(thumb_cache_data[i]); - thumb_cache_id[i] = NULL; - for(j=0; j thumb_cache_lru[i]) - thumb_cache_lru[j]--; -} -void thumb_cache_add(char *id, void *thumb, int size) -{ - int i,m=-1,j=-1; - thumb_cache_inval(id); - for(i=0; i m) - { - m = thumb_cache_lru[i]; - j = i; - } - } - if(i >= THUMB_CACHE_SIZE) - { - thumb_cache_inval(thumb_cache_id[j]); - i = j; - } - for(j=0; j= THUMB_CACHE_SIZE) - return 0; - for(j=0; j=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str+5); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - else if(!strncmp(str, "TAG ", 4)) - { - if(j >= TAG_MAX) - { - str = p; - continue; - } - q = strchr(str+4, ' '); - if(!q) - { - str = p; - continue; - } - *(q++) = 0; - tag_names[j] = mystrdup(str+4); - tag_votes[j] = atoi(q); - j++; - } - else - { - if(i>=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - str = p; - } - if(*str) - i++; - return i; -} - -#define IMGCONNS 3 -#define TIMEOUT 100 -#define HTTP_TIMEOUT 10 - -int search_own = 0; -int search_date = 0; -int search_page = 0; -char search_expr[256] = ""; - -int search_ui(pixel *vid_buf) -{ - int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; - int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; - int thumb_drawn[GRID_X*GRID_Y]; - pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - float ry; - time_t http_last_use=HTTP_TIMEOUT; - ui_edit ed; - - - void *http = NULL; - int active = 0; - char *last = NULL; - int search = 0; - int lasttime = TIMEOUT; - char *uri; - int status; - char *results; - char *tmp, ts[64]; - - void *img_http[IMGCONNS]; - char *img_id[IMGCONNS]; - void *thumb, *data; - int thlen, dlen; - - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - - memset(img_http, 0, sizeof(img_http)); - memset(img_id, 0, sizeof(img_id)); - - memset(search_ids, 0, sizeof(search_ids)); - memset(search_names, 0, sizeof(search_names)); - memset(search_scoreup, 0, sizeof(search_scoreup)); - memset(search_scoredown, 0, sizeof(search_scoredown)); - memset(search_publish, 0, sizeof(search_publish)); - memset(search_owners, 0, sizeof(search_owners)); - memset(search_thumbs, 0, sizeof(search_thumbs)); - memset(search_thsizes, 0, sizeof(search_thsizes)); - - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - - do_open = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = 65; - ed.y = 13; - ed.w = XRES-200; - ed.nx = 1; - ed.def = "[search terms]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(search_expr); - strcpy(ed.str, search_expr); - - sdl_wheel = 0; - - while(!sdl_poll()) - { - uih = 0; - bq = b; - mxq = mx; - myq = my; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - if(mx!=mxq || my!=myq || sdl_wheel || b) - mmt = 0; - else if(mmt 9) - { - drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); - drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); - } - - ui_edit_draw(vid_buf, &ed); - - if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) - { - if(search_page) - { - search_page --; - lasttime = TIMEOUT; - } - sdl_wheel = 0; - uih = 1; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) - { - lasttime = TIMEOUT; - search_page ++; - page_count = exp_res; - } - sdl_wheel = 0; - uih = 1; - } - - tp = -1; - if(is_p1) - { - drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); - for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) - for(gi=0; giTAG_MAX || !tag_names[pos]) - break; - if(tag_votes[0]) - i = 127+(128*tag_votes[pos])/tag_votes[0]; - else - i = 192; - w = textwidth(tag_names[pos]); - if(w>XRES/GRID_X-5) - w = XRES/GRID_X-5; - gx = (XRES/GRID_X)*gi; - gy = gj*14 + 46; - if(mx>=gx && mx=gy && my XRES/GRID_X-10) - { - tmp = malloc(strlen(search_names[pos])+4); - strcpy(tmp, search_names[pos]); - j = textwidthx(tmp, XRES/GRID_X-15); - strcpy(tmp+j, "..."); - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); - free(tmp); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); - j = textwidth(search_owners[pos]); - if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && - my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) - { - st = 1; - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); - if(search_thumbs[pos]&&thumb_drawn[pos]==0) - { - render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); - thumb_drawn[pos] = 1; - } - own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); - if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) - mp = pos; - if(own) - { - if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) - { - mp = -1; - dp = pos; - } - } - if(mp==pos && !st) - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); - else - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); - if(own) - { - if(dp == pos) - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); - else - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); - } - if(!search_publish[pos]) - { - drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); - drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); - } - if(view_own || svf_admin || svf_mod) - { - sprintf(ts+1, "%d", search_votes[pos]); - ts[0] = 0xBB; - for(j=1; ts[j]; j++) - ts[j] = 0xBC; - ts[j-1] = 0xB9; - ts[j] = 0xBA; - ts[j+1] = 0; - w = gx+XRES/GRID_S-2-textwidth(ts); - h = gy+YRES/GRID_S-11; - drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); - for(j=0; ts[j]; j++) - ts[j] -= 14; - drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); - sprintf(ts, "%d", search_votes[pos]); - for(j=0; ts[j]; j++) - ts[j] += 127; - drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); - } - if(search_scoreup[pos]>0||search_scoredown[pos]>0) - { - lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); - - if(((YRES/GRID_S+3)/2)>lv) - { - ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); - if(lv<8) - { - ry = ry/(8-lv); - } - nyu = search_scoreup[pos]*ry; - nyd = search_scoredown[pos]*ry; - } - else - { - ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); - nyu = search_scoreup[pos]/ry; - nyd = search_scoredown[pos]/ry; - } - - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); - - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); - } - } - - if(mp!=-1 && mmt>=TIMEOUT/5 && !st) - { - gi = mp % GRID_X; - gj = mp / GRID_X; - if(is_p1) - gj += GRID_Y-GRID_P; - gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; - gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; - i = w = textwidth(search_names[mp]); - h = YRES/GRID_Z+30; - if(w=XRES-2) gx=XRES-3-w; - if(gy<32) gy=32; - if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; - clearrect(vid_buf, gx-2, gy-3, w+4, h); - drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); - if(search_thumbs[mp]) - render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); - drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); - drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); - } - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(sdl_key==SDLK_RETURN) - { - if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) - lasttime = TIMEOUT; - else if(search_ids[0] && !search_ids[1]) - { - bq = 0; - b = 1; - mp = 0; - } - } - if(sdl_key==SDLK_ESCAPE) - goto finish; - - if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) - { - search_own = !search_own; - lasttime = TIMEOUT; - } - if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) - { - search_date = !search_date; - lasttime = TIMEOUT; - } - - if(b && !bq && dp!=-1) - if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) - { - execute_delete(vid_buf, search_ids[dp]); - lasttime = TIMEOUT; - if(last) - { - free(last); - last = NULL; - } - } - - if(b && !bq && tp!=-1) - { - strncpy(ed.str, tag_names[tp], 255); - lasttime = TIMEOUT; - } - - if(b && !bq && mp!=-1 && st) - { - sprintf(ed.str, "user:%s", search_owners[mp]); - lasttime = TIMEOUT; - } - - if(do_open==1) - { - mp = 0; - } - - if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) - { - fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); - info_box(vid_buf, "Loading..."); - - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - data = http_simple_get(uri, &status, &dlen); - free(uri); - - if(status == 200) - { - status = parse_save(data, dlen, 1, 0, 0); - switch(status) - { - case 1: - error_ui(vid_buf, 0, "Simulation corrupted"); - break; - case 2: - error_ui(vid_buf, 0, "Simulation from a newer version"); - break; - case 3: - error_ui(vid_buf, 0, "Simulation on a too large grid"); - break; - } - if(!status) - { - char *tnames[] = {"ID", NULL}; - char *tparts[1]; - int tplens[1]; - if(svf_last) - free(svf_last); - svf_last = data; - svf_lsize = dlen; - - tparts[0] = search_ids[mp]; - tplens[0] = strlen(search_ids[mp]); - data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); - - svf_open = 1; - svf_own = svf_login && !strcmp(search_owners[mp], svf_user); - svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); - - strcpy(svf_id, search_ids[mp]); - strcpy(svf_name, search_names[mp]); - if(status == 200) - { - if(data) - { - strncpy(svf_tags, data, 255); - svf_tags[255] = 0; - } - else - svf_tags[0] = 0; - } - else - { - svf_tags[0] = 0; - } - - if(svf_login) - { - char *names[] = {"ID", NULL}; - char *parts[1]; - parts[0] = search_ids[mp]; - data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); - if(status == 200) - { - if(data) - { - if(!strcmp(data, "Up")) - { - svf_myvote = 1; - } - else if(!strcmp(data, "Down")) - { - svf_myvote = -1; - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - } - else - { - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - } - } - else - error_ui(vid_buf, status, http_ret_text(status)); - - if(data) - free(data); - goto finish; - } - - if(!last) - { - search = 1; - } - else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) - { - search = 1; - if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) - { - search_page = 0; - page_count = 0; - } - free(last); - last = NULL; - } - else - search = 0; - - if(search && lasttime>=TIMEOUT) - { - lasttime = 0; - last = mystrdup(ed.str); - last_own = search_own; - last_date = search_date; - last_page = search_page; - active = 1; - uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); - if(search_own || svf_admin || svf_mod) - tmp = "&ShowVotes=true"; - else - tmp = ""; - if(!search_own && !search_date && !*last) - { - if(search_page) - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); - } - else - { - exp_res = GRID_X*GRID_P; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); - } - } - else - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); - } - strcaturl(uri, last); - if(search_own) - { - strcaturl(uri, " user:"); - strcaturl(uri, svf_user); - } - if(search_date) - strcaturl(uri, " sort:date"); - - http = http_async_req_start(http, uri, NULL, 0, 1); - if(svf_login) - { - http_auth_headers(http, svf_user, svf_pass); - } - http_last_use = time(NULL); - free(uri); - } - - if(active && http_async_req_status(http)) - { - http_last_use = time(NULL); - results = http_async_req_stop(http, &status, NULL); - view_own = last_own; - if(status == 200) - { - page_count = search_results(results, last_own||svf_admin||svf_mod); - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - } - is_p1 = (exp_res < GRID_X*GRID_Y); - free(results); - active = 0; - } - - if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) - { - http_async_req_close(http); - http = NULL; - } - - for(i=0; i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) - { - if(stamp_page) - { - stamp_page --; - } - sdl_wheel = 0; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; -} - -void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) -{ - char t[2]; - t[0] = ch; - t[1] = 0; - if(flag) - { - fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); - } - else - { - drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); - } -} - -void render_signs(pixel *vid_buf) -{ - int i, j, x, y, w, h, dx, dy; - char buff[30]; //Buffer - for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature - else - sprintf(buff, "Temp: 0.00"); //...tempirature - drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); - } - - //Usual text - if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) - drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); - x = signs[i].x; - y = signs[i].y; - dx = 1 - signs[i].ju; - dy = (signs[i].y > 18) ? -1 : 1; - for(j=0; j<4; j++) - { - drawpixel(vid_buf, x, y, 192, 192, 192, 255); - x+=dx; - y+=dy; - } - } -} - -void add_sign_ui(pixel *vid_buf, int mx, int my) -{ - int i, w, h, x, y, nm=0, ju; - int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; - ui_edit ed; - - // check if it is an existing sign - for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) - break; - } - // else look for empty spot - if(i >= MAXSIGNS) - { - nm = 1; - for(i=0; i= MAXSIGNS) - return; - - if(nm) - { - signs[i].x = mx; - signs[i].y = my; - signs[i].ju = 1; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = x0+25; - ed.y = y0+25; - ed.w = 158; - ed.nx = 1; - ed.def = "[message]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(signs[i].text); - strcpy(ed.str, signs[i].text); - ju = signs[i].ju; - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 80); - drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); - ui_edit_draw(vid_buf, &ed); - drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); - draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); - draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); - draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); - - if(!nm) - { - drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); - drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); - drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); - } - - drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) - ju = 0; - if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) - ju = 1; - if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) - ju = 2; - - if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) - { - signs[i].text[0] = 0; - return; - } - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - { - if(!ed.focus) - return; - ed.focus = 0; - } - } - - strcpy(signs[i].text, ed.str); - signs[i].ju = ju; -} - -/*********************************************************** - * CONFIG FILE * - ***********************************************************/ - -char http_proxy[256] = ""; - -void save_string(FILE *f, char *str) -{ - int li = strlen(str); - unsigned char lb[2]; - lb[0] = li; - lb[1] = li >> 8; - fwrite(lb, 2, 1, f); - fwrite(str, li, 1, f); -} - -int load_string(FILE *f, char *str, int max) -{ - int li; - unsigned char lb[2]; - fread(lb, 2, 1, f); - li = lb[0] | (lb[1] << 8); - if(li > max) - { - str[0] = 0; - return 1; - } - fread(str, li, 1, f); - str[li] = 0; - return 0; -} - -unsigned char last_major=0, last_minor=0, update_flag=0; - -void save_presets(int do_update) -{ - FILE *f=fopen("powder.def", "wb"); - unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; - unsigned char tmp = sdl_scale; - if(!f) - return; - fwrite(sig, 1, 4, f); - save_string(f, svf_user); - save_string(f, svf_pass); - fwrite(&tmp, 1, 1, f); - tmp = cmode; - fwrite(&tmp, 1, 1, f); - tmp = svf_admin; - fwrite(&tmp, 1, 1, f); - tmp = svf_mod; - fwrite(&tmp, 1, 1, f); - save_string(f, http_proxy); - tmp = SAVE_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = MINOR_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = do_update; - fwrite(&tmp, 1, 1, f); - fclose(f); -} - -void load_presets(void) -{ - FILE *f=fopen("powder.def", "rb"); - unsigned char sig[4], tmp; - if(!f) - return; - fread(sig, 1, 4, f); - if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) - { - if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) - { - if(fseek(f, -3, SEEK_END)) - { - remove("powder.def"); - return; - } - if(fread(sig, 1, 3, f) != 3) - { - remove("powder.def"); - goto fail; - } - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; - } - fclose(f); - remove("powder.def"); - return; - } - if(load_string(f, svf_user, 63)) - goto fail; - if(load_string(f, svf_pass, 63)) - goto fail; - svf_login = !!svf_user[0]; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - sdl_scale = (tmp == 2) ? 2 : 1; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - cmode = tmp%6; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_admin = tmp; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_mod = tmp; - if(load_string(f, http_proxy, 255)) - goto fail; - if(fread(sig, 1, 3, f) != 3) - goto fail; - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; -fail: - fclose(f); -} - -void dim_copy(pixel *dst, pixel *src) -{ - int i,r,g,b; - for(i=0; i0) - r--; - if(g>0) - g--; - if(b>0) - b--; - dst[i] = PIXRGB(r,g,b); - } -} - -unsigned int fire_alpha[CELL*3][CELL*3]; -void prepare_alpha(void) -{ - int x,y,i,j; - float temp[CELL*3][CELL*3]; - memset(temp, 0, sizeof(temp)); - for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; - fire_g[j][i] = g>4 ? g-4 : 0; - fire_b[j][i] = b>4 ? b-4 : 0; - } -} - -int zoom_en = 0; -int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; -int zoom_wx=0, zoom_wy=0; -void render_zoom(pixel *img) -{ - int x, y, i, j; - pixel pix; - drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); - drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); - clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); - for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) - { - xor_pixel(x+i, y+j, vid); - if(j) xor_pixel(x+i, y-j, vid); - if(i) xor_pixel(x-i, y+j, vid); - if(i&&j) xor_pixel(x-i, y-j, vid); - } - } - else - { - int tc; - c = (r/CELL) * CELL; - x = (x/CELL) * CELL; - y = (y/CELL) * CELL; - - tc = !((c%(CELL*2))==0); - - x -= c/2; - y -= c/2; - - x += tc*(CELL/2); - y += tc*(CELL/2); - - for(i=0; i2) - { - pthread_t pth; - pthread_create(&pth,NULL,update_air_th,""); - } - else - { - update_air(); - } -#else - update_air(); -#endif - } - if(cmode==0 || cmode==1) - { - draw_air(vid_buf); - } - else if(cmode==2) - { - memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); - memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); - } - else - { - memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); - } - update_particles(vid_buf); - - if(cmode==2) - { - if(!fire_fc) - { - dim_copy(fire_bg, vid_buf); - } - else - { - memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); - } - fire_fc = (fire_fc+1) % 3; - } - if(cmode==3||cmode==4) - render_fire(vid_buf); - - render_signs(vid_buf); - - memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); - clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); - - draw_svf_ui(vid_buf); - - if(http_ver_check) - { - if(!do_check && http_async_req_status(http_ver_check)) - { - ver_data = http_async_req_stop(http_ver_check, &http_ret, NULL); - if(http_ret==200 && ver_data) - { -#ifdef BETA - if(sscanf(ver_data, "%d.%d.%d", &major, &minor, &is_beta)==3) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) - old_version = 1; -#else - if(sscanf(ver_data, "%d.%d", &major, &minor)==2) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) - old_version = 1; -#endif - free(ver_data); - } - http_ver_check = NULL; - } - do_check = (do_check+1) & 15; - } - - if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) - { - if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) - { - break; - } - } - if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) - { - if(load_mode) - { - free(load_img); - free(load_data); - load_mode = 0; - load_data = NULL; - load_img = NULL; - } - if(it > 50) - it = 50; - if(sdl_key=='k' && stamps[1].name[0]) - { - j = stamp_ui(vid_buf); - if(j>=0) - load_data = stamp_load(j, &load_size); - else - load_data = NULL; - } - else - load_data = stamp_load(0, &load_size); - if(load_data) - { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - if(sdl_key=='s') - { - if(it > 50) - it = 50; - save_mode = 1; - } - if(sdl_key=='1') - { - set_cmode(0); - } - if(sdl_key=='2') - { - set_cmode(1); - } - if(sdl_key=='3') - { - set_cmode(2); - } - if(sdl_key=='4') - { - set_cmode(3); - } - if(sdl_key=='5') - { - set_cmode(4); - } - if(sdl_key=='6') - { - set_cmode(5); - } - if(sdl_key==SDLK_SPACE) - sys_pause = !sys_pause; - if(sdl_key=='h') - hud_enable = !hud_enable; - if(sdl_key=='p') - dump_frame(vid_buf, XRES, YRES, XRES); - if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - if(clipboard_ready==1) - { - load_data = malloc(clipboard_length); - memcpy(load_data, clipboard_data, clipboard_length); - load_size = clipboard_length; - if(load_data) - { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - } - if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 2; - } - if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 1; - } - else if(sdl_key=='c') - { - set_cmode((cmode+1) % 6); - if(it > 50) - it = 50; - } - if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo - { - int cbx, cby, cbi; - - for(cbi=0; cbi32) - ZSIZE = 32; - if(ZSIZE<2) - ZSIZE = 2; - ZFACTOR = 256/ZSIZE; - sdl_wheel = 0; - } - else - { - bs += sdl_wheel; - if(bs>16) - bs = 16; - if(bs<0) - bs = 0; - sdl_wheel = 0; - /*if(su >= PT_NUM) { - if(sl < PT_NUM) - su = sl; - if(sr < PT_NUM) - su = sr; - }*/ - } - } - - bq = b; - b = SDL_GetMouseState(&x, &y); - - for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy - && x0 && y0 && x>8)>=NPART || !cr)) - { -#ifdef BETA - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); -#else - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); -#endif - } - else - { - sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); - } - } - mx = x; - my = y; - if(update_flag) - { - info_box(vid_buf, "Finalizing update..."); - if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) - { - update_cleanup(); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } - else - { - if(update_finish()) - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - else - info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); - } - update_flag = 0; - } - - if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && - x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) - { - tmp = malloc(64); -#ifdef BETA - if(is_beta) - { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); - } - else - { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); - } -#else - sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); -#endif - if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) - { - free(tmp); - tmp = download_ui(vid_buf, my_uri, &i); - if(tmp) - { - save_presets(1); - if(update_start(tmp, i)) - { - update_cleanup(); - save_presets(0); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } - else - return 0; - } - } - else - free(tmp); - } - if(y>=sdl_scale*(YRES+(MENUSIZE-20))) - { - if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) - { - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } - else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) - { - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } - else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) - { - db = (svf_myvote==1) ? 273 : 274; - if(da < 51) - da ++; - } - else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) - { - db = svf_own ? 257 : 256; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) - { - db = 270; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) - { - db = 266; - if(da < 51) - da ++; - } - else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) - { - db = 259; - if(svf_open && svf_own && x<=55*sdl_scale) - db = 258; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) - { - db = svf_login ? 261 : 260; - if(svf_admin) - { - db = 268; - } - else if(svf_mod) - { - db = 271; - } - if(da < 51) - da ++; - } - else if(x>=sdl_scale && x<=17*sdl_scale) - { - db = 262; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) - { - db = sys_pause ? 264 : 263; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) - { - db = 267; - if(da < 51) - da ++; - } - else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) - { - db = 265; - if(da < 51) - da ++; - } - else if(da > 0) - da --; - } - else if(da > 0) - da --; - - if(!sdl_zoom_trig && zoom_en==1) - zoom_en = 0; - - if(sdl_key==Z_keysym && zoom_en==2) - zoom_en = 1; - - if(load_mode) - { - load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); - load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); - if(load_x+load_w>XRES) load_x=XRES-load_w; - if(load_y+load_h>YRES) load_y=YRES-load_h; - if(load_x<0) load_x=0; - if(load_y<0) load_y=0; - if(bq==1 && !b) - { - parse_save(load_data, load_size, 0, load_x, load_y); - free(load_data); - free(load_img); - load_mode = 0; - } - else if(bq==4 && !b) - { - free(load_data); - free(load_img); - load_mode = 0; - } - } - else if(save_mode==1) - { - save_x = (mx/sdl_scale)/CELL; - save_y = (my/sdl_scale)/CELL; - if(save_x >= XRES/CELL) save_x = XRES/CELL-1; - if(save_y >= YRES/CELL) save_y = YRES/CELL-1; - save_w = 1; - save_h = 1; - if(b==1) - { - save_mode = 2; - } - else if(b==4) - { - save_mode = 0; - copy_mode = 0; - } - } - else if(save_mode==2) - { - save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; - save_h = (my/sdl_scale+CELL/2)/CELL - save_y; - if(save_w>XRES/CELL) save_w = XRES/CELL; - if(save_h>YRES/CELL) save_h = YRES/CELL; - if(save_w<1) save_w = 1; - if(save_h<1) save_h = 1; - if(!b) - { - if(copy_mode==1) - { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - } - else if(copy_mode==2) - { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - } - else - { - stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - save_mode = 0; - } - } - } - else if(sdl_zoom_trig && zoom_en<2) - { - x /= sdl_scale; - y /= sdl_scale; - x -= ZSIZE/2; - y -= ZSIZE/2; - if(x<0) x=0; - if(y<0) y=0; - if(x>XRES-ZSIZE) x=XRES-ZSIZE; - if(y>YRES-ZSIZE) y=YRES-ZSIZE; - zoom_x = x; - zoom_y = y; - zoom_wx = (x 50) - it = 50; - x /= sdl_scale; - y /= sdl_scale; - if(y>=YRES+(MENUSIZE-20)) - { - if(!lb) - { - if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) - { - if(execute_vote(vid_buf, svf_id, "Up")) - { - svf_myvote = 1; - } - } - if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) - { - if(execute_vote(vid_buf, svf_id, "Down")) - { - svf_myvote = -1; - } - } - if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) - tag_list_ui(vid_buf); - if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) - { - legacy_enable = !legacy_enable; - } - if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) - { - memset(signs, 0, sizeof(signs)); - memset(pv, 0, sizeof(pv)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(fvx, 0, sizeof(fvx)); - memset(fvy, 0, sizeof(fvy)); - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(parts, 0, sizeof(particle)*NPART); - for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) - { - login_ui(vid_buf); - if(svf_login) - save_presets(0); - } - if(x>=37 && x<=187 && svf_login) - { - if(!svf_open || !svf_own || x>51) - { - if(save_name_ui(vid_buf)) - execute_save(vid_buf); - } - else - execute_save(vid_buf); - while(!sdl_poll()) - if(!SDL_GetMouseState(&x, &y)) - break; - b = bq = 0; - } - if(x>=1 && x<=17) - { - search_ui(vid_buf); - memset(fire_bg, 0, XRES*YRES*PIXELSIZE); - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - } - if(x>=19 && x<=35 && svf_last && svf_open) - parse_save(svf_last, svf_lsize, 1, 0, 0); - if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) - { - if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 6); - if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+5) % 6); - save_presets(0); - } - if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) - sys_pause = !sys_pause; - lb = 0; - } - } - else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) - { - c = sl = cr&0xFF; - } - else - { - //Something - } - } - //create_parts(x, y, bs, SPC_AIR); - lx = x; - ly = y; - lb = 0; - lm = 0; - } - else - { - //Copy state before drawing any particles (for undo) - int cbx, cby, cbi; - - for(cbi=0; cbi=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) - create_line(lx, ly, x, y, bs, c); - } - else - create_box(lx, ly, x, y, c); - lm = 0; - } - lb = 0; - } - - if(load_mode) - { - draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); - xor_rect(vid_buf, load_x, load_y, load_w, load_h); - } - - if(save_mode) - { - xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - da = 51; - db = 269; - } - - if(zoom_en!=1 && !load_mode && !save_mode) - { - render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); - mousex = mx/sdl_scale; - mousey = my/sdl_scale; - } - - if(zoom_en) - render_zoom(vid_buf); - - if(da) - switch(db) - { - case 256: - drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); - break; - case 257: - drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); - break; - case 258: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); - break; - case 259: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); - break; - case 260: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); - break; - case 261: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); - break; - case 262: - drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); - break; - case 263: - drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); - break; - case 264: - drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); - break; - case 265: - drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); - break; - case 266: - drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); - break; - case 267: - drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); - break; - case 268: - drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); - break; - case 269: - drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); - break; - case 270: - drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); - break; - case 271: - drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); - break; - case 272: - drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); - break; - case 273: - drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); - break; - case 274: - drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); - break; - case 275: - drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); - break; - default: - drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); - } - if(itc) - { - itc--; - drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); - } - if(it) - { - it--; - //if(fbi_img) - //draw_image(vid_buf, fbi_img, (XRES-FBI_W)/2, (YRES-FBI_H)/2+25, FBI_W, FBI_H, it>12?64:it*5); - drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); - } - - if(old_version) - { - clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); -#ifdef BETA - if(is_beta) - { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); - } - else - { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); - } -#else - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); -#endif - drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); - } - /*#ifdef MT - pthread_join(pth2,NULL); - #endif*/ - - if(hud_enable) - { - currentTime = SDL_GetTicks(); - if(currentTime-past>=16) - { - past = SDL_GetTicks(); - FPS++; - } - if(currentTime-pastFPS>=1000) - { -#ifdef BETA - sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#else - sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#endif - FPSB = FPS; - FPS = 0; - pastFPS = currentTime; - } - if(sdl_zoom_trig||zoom_en) - { - if(zoom_x Date: Mon, 16 Aug 2010 23:34:27 +0200 Subject: wwops diff --git a/powder.c b/powder.c new file mode 100644 index 0000000..78e481b --- /dev/null +++ b/powder.c @@ -0,0 +1,10781 @@ +/** + * Powder Toy - Main source + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw + * Copyright (c) 2010 Skresanov Savely + * Copyright (c) 2010 Bryan Hoyle + * Copyright (c) 2010 Nathan Cousins + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#else +#include +#include +#endif + + +#include "version.h" +#include "http.h" +#include "md5.h" +#include "update.h" +#include "hmap.h" + +#define SERVER "powdertoy.co.uk" + +#undef PLOSS + +#ifdef MENUV3 +#define MENUSIZE 40 +#else +#define MENUSIZE 20 +#endif +#define BARSIZE 14 +#define XRES 612 +#define YRES 384 +#define NPART XRES*YRES + +#define ZSIZE_D 16 +#define ZFACTOR_D 8 +unsigned char ZFACTOR = 256/ZSIZE_D; +unsigned char ZSIZE = ZSIZE_D; + +#define CELL 4 +#define ISTP (CELL/2) +#define CFDS (4.0f/CELL) + +typedef unsigned char uint8; + +#ifdef PIX16 +#define PIXELSIZE 2 +typedef unsigned short pixel; +#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) +#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) +#define PIXR(x) (((x)>>8)&0xF8) +#define PIXG(x) (((x)>>3)&0xFC) +#define PIXB(x) (((x)<<3)&0xF8) +#else +#define PIXELSIZE 4 +typedef unsigned int pixel; +#ifdef PIX32BGR +#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) +#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) +#define PIXR(x) ((x)&0xFF) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)>>16) +#else +#ifdef PIX32BGRA +#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) +#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) +#define PIXR(x) (((x)>>8)&0xFF) +#define PIXG(x) (((x)>>16)&0xFF) +#define PIXB(x) (((x)>>24)) +#else +#define PIXPACK(x) (x) +#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) +#define PIXR(x) ((x)>>16) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)&0xFF) +#endif +#endif +#endif + +char *it_msg = + "\brThe Powder Toy\n" + "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" + "\n" + "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" + "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" + "\bgPick your material from the menu using mouse left/right buttons.\n" + "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" + "Shift+drag will create straight lines of particles.\n" + "Ctrl+drag will result in filled rectangles.\n" + "Ctrl+Shift+click will flood-fill a closed area.\n" + "Ctrl+Z will act as Undo.\n" + "Middle click or Alt+Click to \"sample\" the particles.\n" + "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" + "Use 'S' to save parts of the window as 'stamps'.\n" + "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" + "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" + "Use the mouse scroll wheel to change the tool size for particles.\n" + "'Q' will quit the application.\n" + "The spacebar can be used to pause physics.\n" + "'P' will take a screenshot and save it into the current directory.\n" + "\n" + "\brhttp://powdertoy.co.uk/\n" + "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" + "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" + "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" + "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" + "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" + "\n" + "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" + "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" + ; + +typedef struct +{ + int start, inc; + pixel *vid; +} upstruc; + +#ifdef BETA +char *old_ver_msg_beta = "A new beta is available - click here!"; +#endif +char *old_ver_msg = "A new version is available - click here!"; +float mheat = 0.0f; + +int do_open = 0; +int sys_pause = 0; +int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. + +int amd = 0; + +unsigned char fire_r[YRES/CELL][XRES/CELL]; +unsigned char fire_g[YRES/CELL][XRES/CELL]; +unsigned char fire_b[YRES/CELL][XRES/CELL]; + +#define MAXSIGNS 16 + +struct sign +{ + int x,y,ju; + char text[256]; +} signs[MAXSIGNS]; + +/*********************************************************** + * AIR FLOW SIMULATOR * + ***********************************************************/ + +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; + +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; + +unsigned cmode = 3; + +float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float cb_vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float cb_vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float cb_pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; +#define TSTEPP 0.3f +#define TSTEPV 0.4f +#define VADV 0.3f +#define VLOSS 0.999f +#define PLOSS 0.9999f +int numCores = 1; +float kernel[9]; +void make_kernel(void) +{ + int i, j; + float s = 0.0f; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + { + kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); + s += kernel[(i+1)+3*(j+1)]; + } + s = 1.0f / s; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + kernel[(i+1)+3*(j+1)] *= s; +} + +int core_count() +{ + int numCPU = 1; +#ifdef MT +#ifdef WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + numCPU = sysinfo.dwNumberOfProcessors; +#else +#ifdef MACOSX + numCPU = 4; +#else + numCPU = sysconf( _SC_NPROCESSORS_ONLN ); +#endif +#endif + + printf("Cpus: %d\n", numCPU); + if(numCPU>1) + printf("Multithreading enabled\n"); + else + printf("Multithreading disabled\n"); +#endif + return numCPU; +} + +void update_air(void) +{ + int x, y, i, j; + float dp, dx, dy, f, tx, ty; + + for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; + if(dp < -256.0f) dp = -256.0f; + if(dx > 256.0f) dx = 256.0f; + if(dx < -256.0f) dx = -256.0f; + if(dy > 256.0f) dy = 256.0f; + if(dy < -256.0f) dy = -256.0f; + + ovx[y][x] = dx; + ovy[y][x] = dy; + opv[y][x] = dp; + } + memcpy(vx, ovx, sizeof(vx)); + memcpy(vy, ovy, sizeof(vy)); + memcpy(pv, opv, sizeof(pv)); +} + +void *update_air_th(void *arg) +{ + update_air(); + return NULL; +} + +inline unsigned clamp_flt(float f, float min, float max) +{ + if(fmax) + return 255; + return (int)(255.0f*(f-min)/(max-min)); +} + +inline float restrict_flt(float f, float min, float max) +{ + if(fmax) + return max; + return f; +} + +void draw_air(pixel *vid) +{ + int x, y, i, j; + pixel c; + + if(cmode == 2) + return; + + for(y=0; y 0.0f) + c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); + else + c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); + } + else + c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), + clamp_flt(pv[y][x], 0.0f, 8.0f), + clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); + for(j=0; j=XRES || ny>=YRES) + return 0; + if(x==nx && y==ny) + return 1; + r = pmap[ny][nx]; + if(r && (r>>8)>8].type; + + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) + { + return 1; + } + + if((r&0xFF)==PT_VOID) + { + parts[i].type=PT_NONE; + return 0; + } + if((r&0xFF)==PT_BHOL) + { + parts[i].type=PT_NONE; + if(!legacy_enable) + { + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; + } + return 0; + } + + if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide + { + return 1; + } + + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) + { + return 1; + } + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) + { + return 0; + } + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) + { + return 0; + } + + if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; + if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + return 0; + if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) + return 0; + + if(parts[i].type==PT_CNCT && y>8)>= 8; + parts[r].x += x-nx; + parts[r].y += y-ny; + } + + return 1; +} + +void kill_part(int i) +{ + int x, y; + parts[i].type = PT_NONE; + + x = (int)(parts[i].x+0.5f); + y = (int)(parts[i].y+0.5f); + + if(x>=0 && y>=0 && x=XRES || y>=YRES) + return -1; + + if(t==SPC_HEAT||t==SPC_COOL) + { + if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + } + if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) + { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + } + return pmap[y][x]>>8; + } + else + { + return -1; + } + } + if(t==SPC_AIR) + { + pv[y/CELL][x/CELL] += 0.03f; + if(y+CELL>8].type = PT_SPRK; + parts[pmap[y][x]>>8].life = 4; + parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; + pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; + return pmap[y][x]>>8; + } + + if(p==-1) + { + if(pmap[y][x]) + return -1; + if(pfree == -1) + return -1; + i = pfree; + pfree = parts[i].life; + } + else + i = p; + + if(t==PT_GLAS) + { + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + } + if(t!=PT_STKM) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + } + if(t==PT_ACID) + { + parts[i].life = 75; + } + //Testing + /*if(t==PT_WOOD){ + parts[i].life = 150; + }*/ + //End Testing + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_PLSM) + parts[i].life = rand()%150+50; + if(t==PT_LAVA) + parts[i].life = rand()%120+240; + if(t==PT_NBLE) + parts[i].life = 0; + if(t==PT_NEUT) + { + float r = (rand()%128+128)/127.0f; + float a = (rand()%360)*3.14159f/180.0f; + parts[i].life = rand()%480+480; + parts[i].vx = r*cosf(a); + parts[i].vy = r*sinf(a); + } + if(t==PT_PHOT) + { + float r = (rand()%3-1)*3; + float a = (rand()%3-1)*3; + parts[i].life = 680; + if(a==0.0f&&r==0.0f) + { + parts[i].life = 0; + parts[i].type = PT_NONE; + return -1; + } + else + { + parts[i].vx = a; + parts[i].vy = r; + } + //} else { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + //} + } + + if(t!=PT_STKM) + pmap[y][x] = t|(i<<8); + else + { + if(isplayer==0) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + player[2] = PT_DUST; + player[3] = x-1; //Setting legs positions + player[4] = y+6; + player[5] = x-1; + player[6] = y+6; + + player[7] = x-3; + player[8] = y+12; + player[9] = x-3; + player[10] = y+12; + + player[11] = x+1; + player[12] = y+6; + player[13] = x+1; + player[14] = y+6; + + player[15] = x+3; + player[16] = y+12; + player[17] = x+3; + player[18] = y+12; + + isplayer = 1; + } + } + + return i; +} + +void delete_part(int x, int y) +{ + unsigned i; + + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + i = pmap[y][x]; + if(!i || (i>>8)>=NPART) + return; + + kill_part(i>>8); + pmap[y][x] = 0; // just in case +} + +inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +int sign(float i) //Signum function +{ + if (i<0) + return -1; + if (i>0) + return 1; + return 0; +} + +void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a) //Draws a line +{ + int dx, dy, i, sx, sy, check, e, x, y; + + dx = abs(x1-x2); + dy = abs(y1-y2); + sx = sign(x2-x1); + sy = sign(y2-y1); + x = x1; + y = y1; + check = 0; + + if (dy>dx) + { + dx = dx+dy; + dy = dx-dy; + dx = dx-dy; + check = 1; + } + + e = (dy<<2)-dx; + for (i=0; i<=dx; i++) + { + vid[x+y*a] =PIXRGB(r, g, b); + if (e>=0) + { + if (check==1) + x = x+sx; + else + y = y+sy; + e = e-(dx<<2); + } + if (check==1) + y = y+sy; + else + x = x+sx; + e = e+(dy<<2); + } +} + +void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + 255*PIXR(t)) >> 8; + g = (a*g + 255*PIXG(t)) >> 8; + b = (a*b + 255*PIXB(t)) >> 8; + if(r>255) + r = 255; + if(g>255) + g = 255; + if(b>255) + b = 255; + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); + +int is_wire(int x, int y) +{ + return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; +} +int is_wire_off(int x, int y) +{ + return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; +} + +void set_emap(int x, int y) +{ + int x1, x2; + + if(!is_wire_off(x, y)) + return; + + // go left as far as possible + x1 = x2 = x; + while(x1>0) + { + if(!is_wire_off(x1-1, y)) + break; + x1--; + } + while(x21 && x1==x2 && + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + set_emap(x1, y-2); + else if(y>0) + for(x=x1; x<=x2; x++) + if(is_wire_off(x, y-1)) + { + if(x==x1 || x==x2 || y>=YRES/CELL-1 || + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + set_emap(x, y-1); + } + + if(y>8) < NPART && (pmr>>8) >= 0) + { + return parts[pmr>>8].type; + } + else + { + return PT_NONE; + } +} +int nearest_part(int ci, int t) +{ + int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); + int ndistance = 0; + int id = -1; + int i = 0; + int cx = (int)parts[ci].x; + int cy = (int)parts[ci].y; + for(i=0; i=XRES || y>=YRES || + ((bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) + { + kill_part(i); + continue; + } + + vx[y/CELL][x/CELL] *= ptypes[t].airloss; + vy[y/CELL][x/CELL] *= ptypes[t].airloss; + vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + if(t==PT_GASS||t==PT_NBLE) + { + if(pv[y/CELL][x/CELL]<3.5f) + pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); + if(y+CELL2.5f) + { + parts[i].life = rand()%80+180; + rt = parts[i].type = PT_FIRE; + parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + pv[y/CELL][x/CELL] += 0.25f * CFDS; + t = PT_FIRE; + } + + parts[i].vx *= ptypes[t].loss; + parts[i].vy *= ptypes[t].loss; + + if(t==PT_DFRM && !parts[i].life) + { + if(pv[y/CELL][x/CELL]>1.0f) + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].life = rand()%80+300; + } + } + else + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + + if(ptypes[t].diffusion) + { + parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + } + + // interpolator +#ifdef WIN32 + mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#else + mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#endif + if(mv < ISTP) + { + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + } + else + { + dx = parts[i].vx*ISTP/mv; + dy = parts[i].vy*ISTP/mv; + ix = parts[i].x; + iy = parts[i].y; + while(1) + { + mv -= ISTP; + if(mv <= 0.0f) + { + // nothing found + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + break; + } + ix += dx; + iy += dy; + nx = (int)(ix+0.5f); + ny = (int)(iy+0.5f); + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) + { + parts[i].x = ix; + parts[i].y = iy; + break; + } + } + } + + a = nt = 0; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx4.0f) + t = parts[i].type = PT_DSTW; + if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) + t = parts[i].type = PT_OILL; + if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) + t = parts[i].type = PT_GASS; + } + if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) + t = parts[i].type = PT_BRMT; + //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) + // t = parts[i].type = PT_BGLA; + if(t==PT_GLAS) + { + parts[i].pavg[0] = parts[i].pavg[1]; + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) + { + parts[i].type = PT_BGLA; + } + } + if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) + t = parts[i].type = PT_SNOW; + if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) + { + t = PT_NEUT; + create_part(i, x, y, t); + } + + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) + { + nearp = nearest_part(i, PT_ETRD); + if(nearp!=-1) + { + create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[nearp].type = PT_SPRK; + parts[nearp].life = 9; + parts[nearp].ctype = PT_ETRD; + } + } + + if(!legacy_enable) + { + int ctemp = pv[y/CELL][x/CELL]*2; + c_heat = 0.0f; + h_count = 0; + if(ptypes[t].hconduct>(rand()%250)) + { + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + h_count++; + c_heat += parts[r>>8].temp; + } + } + } + } + pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + parts[r>>8].temp = parts[i].temp; + } + } + } + } + if(pt>=pstates[t].btemp&&pstates[t].burn) + { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE||t==PT_PLSM) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) + { + if(t==PT_LAVA&&parts[i].ctype) + { + parts[i].life = 0; + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) + { + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } + else + { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } + else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) + { + if(pstates[t].liquid==PT_LAVA) + { + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } + else if(t==PT_ICEI&&parts[i].ctype) + { + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else + { + t = parts[i].type = pstates[t].liquid; + } + } + else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) + { + t = parts[i].type = pstates[t].liquid; + } + else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) + { + if(t==PT_SLTW&&1>rand()%6) + { + t = parts[i].type = PT_SALT; + } + else + { + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) + { + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA) + { + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } + } + if(t==PT_CSCN&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + if(t==PT_HSCN&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) + { + nx = x % CELL; + if(nx == 0) + nx = x/CELL - 1; + else if(nx == CELL-1) + nx = x/CELL + 1; + else + nx = x/CELL; + ny = y % CELL; + if(ny == 0) + ny = y/CELL - 1; + else if(ny == CELL-1) + ny = y/CELL + 1; + else + ny = y/CELL; + if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ) + { + t = parts[i].type = PT_NONE; + parts[r>>8].ctype = parts[r>>8].type; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + } + else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) + { + pv[y/CELL][x/CELL] += 100.0f; + if(legacy_enable&&1>(rand()%200)) + { + parts[i].life = rand()%50+120; + t = parts[i].type = PT_FIRE; + } + else + { + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_ICEI || t==PT_SNOW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if(legacy_enable) + { + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; + } + } + } + else if(t==PT_HSCN||t==PT_CSCN) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) + { + parts[i].temp = 200.0f; + } + } + } + //PLANT + else if(t==PT_PLNT) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR && 1>(rand()%250)) + { + t = parts[i].type = PT_PLNT; + parts[r>>8].type = PT_PLNT; + } + else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WATR||t==PT_DSTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%250)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_WATR; + } + if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_SLTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) + { + parts[r>>8].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_WTRV) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + parts[r>>8].type = PT_WATR; + } + + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; + } + } + } + else if(t==PT_ACID) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)!=PT_ACID) + { + if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) + { + t = parts[i].type = PT_FIRE; + parts[i].life = 4; + parts[r>>8].type = PT_FIRE; + parts[r>>8].life = 4; + } + else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) + { + parts[i].life--; + parts[r>>8].type = PT_NONE; + } + else if (parts[i].life==50) + { + parts[i].life = 0; + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_NEUT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) + { + if(33>rand()%100) + { + create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); + } + else + { + create_part(r>>8, x+nx, y+ny, PT_NEUT); + parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; + parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; + } + pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + fe ++; + } + if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + parts[r>>8].type = PT_DUST; + if((r&0xFF)==PT_WATR && 15>(rand()%100)) + parts[r>>8].type = PT_DSTW; + if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) + parts[r>>8].type = PT_DFRM; + if((r&0xFF)==PT_NITR && 15>(rand()%1000)) + parts[r>>8].type = PT_OILL; + if((r&0xFF)==PT_OILL && 5>(rand()%1000)) + parts[r>>8].type = PT_GASS; + if((r&0xFF)==PT_PLNT && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + } + } + else if(t==PT_PHOT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=0; nx<1; nx++) + for(ny=0; ny<1; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + } + } + else if(t==PT_LCRY) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_LCRY) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_BTRY) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts_avg(i,r>>8) != PT_INSL) + { + if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) + { + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + parts[r>>8].type = PT_SPRK; + } + } + } + } + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)) || t ==PT_SWCH) + { + if(t==PT_SWCH) + if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) + { + parts[i].life--; + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) + continue; + rt = parts[r>>8].type; + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL) || t!=PT_SPRK) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) + { + parts[r>>8].type = PT_FIRE; + parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + parts[r>>8].life = rand()%80+180; + if(ptypes[rt].explosive) + pv[y/CELL][x/CELL] += 0.25f * CFDS; + continue; + } + lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; + if(lpv < 1) lpv = 1; + if(legacy_enable) + { + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && + ptypes[rt].meltable*lpv>(rand()%1000)) + { + if(t!=PT_LAVA || parts[i].life>0) + { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } + else + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) + { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = PT_METL; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) + { + kill_part(r>>8); + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE; + goto killed; + } + } + } + pavg = parts_avg(i, r>>8); + if(t==PT_SWCH&&pavg!= PT_INSL) + { + if(parts[r>>8].type == PT_SWCH) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + if(rt==PT_SWCH && t==PT_SPRK) + { + pavg = parts_avg(r>>8, i); + if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) + parts[r>>8].life = 10; + if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) + parts[r>>8].life = 9; + if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].ctype = PT_SWCH; + parts[r>>8].life = 4; + } + } + pavg = parts_avg(i, r>>8); + if(pavg != PT_INSL) + { + if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) + parts[r>>8].temp = parts[r>>8].temp+10.0f; + } + } + if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 6; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 5; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) + { + if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) + { + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) + { + parts[i].life = rand()%150+50; + parts[i].type = PT_PLSM; + parts[i].ctype = PT_NBLE; + parts[i].temp = 3500; + pv[y/CELL][x/CELL] += 1; + } + if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) + { + parts[i].type = PT_SWCH; + parts[i].life = 11; + } + } + } +killed: + if(parts[i].type == PT_NONE) + continue; + } + + if(t==PT_STKM) + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; + player[10] += 2; + player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; + player[18] += 2; + player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; + player[10] += 1; + player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; + player[18] += 1; + player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; + player[10] += 2; + player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; + player[18] += 2; + player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; + player[10] += 1; + player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; + player[18] += 1; + player[13] -= 1; + } + + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) + || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 ) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + } + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[10] += 1; + player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } + + if(t==PT_CLNE) + { + if(!parts[i].ctype) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx=XRES-CELL || + ny=YRES-CELL) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + continue; + } + + rt = parts[i].flags & FLAG_STAGNANT; + parts[i].flags &= ~FLAG_STAGNANT; + if(!try_move(i, x, y, nx, ny)) + { + parts[i].x = lx; + parts[i].y = ly; + if(ptypes[t].falldown) + { + if(nx!=x && try_move(i, x, y, nx, y)) + { + parts[i].x = ix; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x, ny)) + { + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else + { + r = (rand()%2)*2-1; + if(ny!=y && try_move(i, x, y, x+r, ny)) + { + parts[i].x += r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x-r, ny)) + { + parts[i].x -= r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y+r)) + { + parts[i].x = ix; + parts[i].y += r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y-r)) + { + parts[i].x = ix; + parts[i].y -= r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) + { + s = 0; + if(!rt || nt) + rt = 50; + else + rt = 10; + for(j=x+r; j>=0 && j>=x-rt && j0) + r = 1; + else + r = -1; + if(s) + for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny(rand()%1000)) + { + kill_part(i); + continue; + } + else if(try_move(i, x, y, 2*x-nx, ny)) + { + parts[i].x = (float)(2*x-nx); + parts[i].y = (float)iy; + parts[i].vx *= ptypes[t].collision; + } + else if(try_move(i, x, y, nx, 2*y-ny)) + { + parts[i].x = (float)ix; + parts[i].y = (float)(2*y-ny); + parts[i].vy *= ptypes[t].collision; + } + else + { + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + } + } + +justdraw: + + nx = (int)(parts[i].x+0.5f); + ny = (int)(parts[i].y+0.5f); + + if(nx=XRES-CELL || + ny=YRES-CELL) + { + kill_part(i); + continue; + } + if(cmode!=CM_HEAT) + { + if(t==PT_STKM) //Just draw head here + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; + vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; + vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; + vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; + } + draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); + draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); + draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); + draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); + + isplayer = 1; //It's a secret. Tssss... + } + + if(t==PT_ACID) + { + if(parts[i].life>255) parts[i].life = 255; + if(parts[i].life<47) parts[i].life = 48; + s = (255/((parts[i].life-46)*28)); + if(s==0) s = 1; + cr = PIXR(ptypes[t].pcolors)/s; + cg = PIXG(ptypes[t].pcolors)/s; + cb = PIXB(ptypes[t].pcolors)/s; + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); + } + } + + if(cmode==4) + { + blendpixel(vid, nx+1, ny, cr, cg, cb, 223); + blendpixel(vid, nx-1, ny, cr, cg, cb, 223); + blendpixel(vid, nx, ny+1, cr, cg, cb, 223); + blendpixel(vid, nx, ny-1, cr, cg, cb, 223); + + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); + } + } + else if(t==PT_OILL) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,64,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,64,16,40); + } + } + } + else if(t==PT_NEUT) + { + if(cmode == 3||cmode==4) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 8; + cb = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = 0x20; + cg = 0xE0; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLUT) + { + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_URAN) + { + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_SLTW) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,80,240,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,80,240,50); + } + } + } + else if(t==PT_PHOT) + { + if(cmode == 3||cmode==4) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 12; + cb = 12; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_SWCH && parts[i].life == 10) + { + x = nx; + y = ny; + blendpixel(vid,x,y,17,217,24,255); + } + else if(t==PT_LNTG) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,128,160,223,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,128,160,223,50); + } + } + } + else if(t==PT_SMKE) + { + if(cmode == 3||cmode==4) + { + x = nx/CELL; + y = ny/CELL; + cg = 10; + cb = 10; + cr = 10; + cg += fire_g[y][x]; + if(cg > 50) cg = 50; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 50) cb = 50; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 50) cr = 50; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,100,100,100,30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,100,100,100,10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,100,100,100,20); + } + } + } + } + else if(t==PT_WATR) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + + } + else if(t==PT_DSTW) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + } + else if(t==PT_NITR) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,224,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,224,16,50); + } + } + + } + else if(t==PT_LRBD) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,170,170,170,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,170,170,170,50); + } + } + + } + + else if(t==PT_NBLE) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,235,73,23,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,235,73,23,20); + } + } + + } + else if(t==PT_GASS) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,224,255,32,255); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,224,255,32,20); + } + } + + } + else if(t==PT_WTRV) + { + if(cmode == 3||cmode==4) + { + x = nx/CELL; + y = ny/CELL; + cg = PIXG(ptypes[t].pcolors)/3; + cb = PIXB(ptypes[t].pcolors)/3; + cr = PIXR(ptypes[t].pcolors)/3; + cg += fire_g[y][x]; + if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); + } + } + } + } + else if(t==PT_THDR) + { + if(cmode == 3||cmode==4) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 16; + cb = 20; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xA0; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LCRY) + { + if(cmode == 3||cmode==4) + { + //cr = R/8; + //cg = G/8; + //cb = B/8; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); + //x = nx/CELL; + //y = ny/CELL; + //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } + else + { + cr = 0x50+(parts[i].life*10); + cg = 0x50+(parts[i].life*10); + cb = 0x50+(parts[i].life*10); + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLUT) { + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 5); + blendpixel(vid, nx-1, ny, cr, cg, cb, 5); + blendpixel(vid, nx, ny+1, cr, cg, cb, 5); + blendpixel(vid, nx, ny-1, cr, cg, cb, 5); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_URAN) + { + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 5); + blendpixel(vid, nx-1, ny, cr, cg, cb, 5); + blendpixel(vid, nx, ny+1, cr, cg, cb, 5); + blendpixel(vid, nx, ny-1, cr, cg, cb, 5); + for(int tempx = 2; tempx < 10; tempx++) { + for(int tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_PLSM) + { + float ttemp = parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = plasma_data[caddress]; + uint8 G = plasma_data[caddress+1]; + uint8 B = plasma_data[caddress+2]; + if(cmode == 3||cmode==4) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_FIRE && parts[i].life) + { + if(cmode == 3||cmode==4) + { + cr = parts[i].life / 4; + cg = parts[i].life / 16; + cb = parts[i].life / 32; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = parts[i].life * 8; + cg = parts[i].life * 2; + cb = parts[i].life; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LAVA && parts[i].life) + { + cr = parts[i].life * 2 + 0xE0; + cg = parts[i].life * 1 + 0x50; + cb = parts[i].life/2 + 0x10; + if(cr>255) cr = 255; + if(cg>192) cg = 192; + if(cb>128) cb = 128; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 64); + blendpixel(vid, nx-1, ny, cr, cg, cb, 64); + blendpixel(vid, nx, ny+1, cr, cg, cb, 64); + blendpixel(vid, nx, ny-1, cr, cg, cb, 64); + if(cmode == 3||cmode==4) + { + cr /= 32; + cg /= 32; + cb /= 32; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else if(t==PT_LAVA || t==PT_SPRK) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + if(cmode == 3 || cmode==4) + { + if(t == PT_LAVA) + { + cr = 3; + cg = i%2; + cb = 0; + } + else + { + cr = 8; + cg = 12; + cb = 16; + } + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + } + else + { + float ttemp = parts[i].temp+(-MIN_TEMP); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); + uint8 R = color_data[caddress]; + uint8 G = color_data[caddress+1]; + uint8 B = color_data[caddress+2]; + + if(t==PT_STKM) //Stick man should be visible in heat mode + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); + vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); + vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); + vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); + } + draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); + draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); + draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); + draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); + } + else + { + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); + //blendpixel(vid, nx+1, ny, R, G, B, 255); + } + } + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) + { + uint8 R = PIXR(ptypes[t].pcolors); + uint8 G = PIXG(ptypes[t].pcolors); + uint8 B = PIXB(ptypes[t].pcolors); + + //if(vid[(ny-1)*YRES+(nx-1)]!=0){ + // blendpixel(vid, nx, ny-1, R, G, B, 46); + //} + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + + } + +} + +void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) +{ + blendpixel(vid, x+1, y, cr, cg, cb, 112); + blendpixel(vid, x-1, y, cr, cg, cb, 112); + blendpixel(vid, x, y+1, cr, cg, cb, 112); + blendpixel(vid, x, y-1, cr, cg, cb, 112); + + blendpixel(vid, x+1, y-1, cr, cg, cb, 64); + blendpixel(vid, x-1, y-1, cr, cg, cb, 64); + blendpixel(vid, x+1, y+1, cr, cg, cb, 64); + blendpixel(vid, x-1, y+1, cr, cg, cb, 64); +} + +void update_particles_i_th(void *arg) +{ + upstruc *newup = (upstruc*)arg; + update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); + return; +} + +void update_particles(pixel *vid) +{ + int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; + float lx, ly; +#ifdef MT + int pt = 0, pc = 0; + pthread_t *InterThreads; +#endif + + isplayer = 0; //Needed for player spawning + memset(pmap, 0, sizeof(pmap)); + r = rand()%2; + for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==13) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } + else + { + for(y=0; y>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==9) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } + +#ifdef MT + if(numCores > 1) + { + InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); + for(pc = 0; pc=XRES || ny<0 || ny>=YRES) + break; + addpixel(vid, nx, ny, 255, 255, 255, 64); + i = nx/CELL; + j = ny/CELL; + lx += vx[j][i]*0.125f; + ly += vy[j][i]*0.125f; + if(bmap[j][i]==5 && i!=x && j!=y) + break; + } + drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); + } + +} + +void update_particles_th(void *arg) +{ + update_particles((pixel*)arg); + return; +} + +/*********************************************************** + * SDL OUTPUT * + ***********************************************************/ + +int sdl_scale = 1; +SDL_Surface *sdl_scrn; +SDLMod sdl_mod; +int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; + +#include "icon.h" +void sdl_seticon(void) +{ +#ifdef WIN32 + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else +#ifdef MACOSX + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else + SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#endif +#endif +} + +void sdl_open(void) +{ + if(SDL_Init(SDL_INIT_VIDEO)<0) + { + fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); + exit(1); + } + atexit(SDL_Quit); +#ifdef PIX16 + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); +#else + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); +#endif + if(!sdl_scrn) + { + fprintf(stderr, "Creating window: %s\n", SDL_GetError()); + exit(1); + } + SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); + sdl_seticon(); + SDL_EnableUNICODE(1); + //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); +} + +void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0; jpitch/PIXELSIZE; + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} + +void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + int i,k; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0; jpitch/PIXELSIZE; + } + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} +void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) +{ + if(sdl_scale == 2) + sdl_blit_2(x, y, w, h, src, pitch); + else + sdl_blit_1(x, y, w, h, src, pitch); +} + +int frame_idx=0; +void dump_frame(pixel *src, int w, int h, int pitch) +{ + char frame_name[32]; + int j,i; + unsigned char c[3]; + FILE *f; + sprintf(frame_name,"frame%04d.ppm",frame_idx); + f=fopen(frame_name,"wb"); + fprintf(f,"P6\n%d %d\n255\n",w,h); + for(j=0; j=0 && x=0 && yPT_NUM) + return 2; + if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) + return 3; + i = XRES*YRES; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) + return 1; + size = i; + } + else + d = c; + + if(size < XRES*YRES) + { + if(bzip2) + free(d); + return 1; + } + + sy = 0; + for(y=0; y+scl<=YRES; y+=scl) + { + sx = 0; + for(x=0; x+scl<=XRES; x+=scl) + { + a = 0; + r = g = b = 0; + for(j=0; j=PT_NUM) + goto corrupt; + r += PIXR(ptypes[t].pcolors); + g += PIXG(ptypes[t].pcolors); + b += PIXB(ptypes[t].pcolors); + a ++; + } + } + if(a) + { + a = 256/a; + r = (r*a)>>8; + g = (g*a)>>8; + b = (b*a)>>8; + } + + drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); + sx++; + } + sy++; + } + + if(bzip2) + free(d); + return 0; + +corrupt: + if(bzip2) + free(d); + return 1; +} + +static char *mystrdup(char *s) +{ + char *x; + if(s) + { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; + } + return s; +} + +void *build_save(int *size, int x0, int y0, int w, int h) +{ + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; + int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); + int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + // save the required air state + for(y=by0; y255) i=255; + d[p++] = i; + } + for(y=by0; y255) i=255; + d[p++] = i; + } + + // save the particle map + for(i=0; i=x0 && x=y0 && y255) x=255; + if(y<0) y=0; + if(y>255) y=255; + d[p++] = x; + d[p++] = y; + } + } + for(j=0; j255) tttemp=255; + d[p++] = tttemp; + } + } + for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; + d[p++] = (signs[i].y-y0); + d[p++] = (signs[i].y-y0)>>8; + d[p++] = signs[i].ju; + x = strlen(signs[i].text); + d[p++] = x; + memcpy(d+p, signs[i].text, x); + p+=x; + } + + i = (p*101+99)/100 + 612; + c = malloc(i); + c[0] = 0x66; + c[1] = 0x75; + c[2] = 0x43; + c[3] = legacy_enable; + c[4] = SAVE_VERSION; + c[5] = CELL; + c[6] = bw; + c[7] = bh; + c[8] = p; + c[9] = p >> 8; + c[10] = p >> 16; + c[11] = p >> 24; + + i -= 12; + + if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) + { + free(d); + free(c); + return NULL; + } + free(d); + + *size = i+12; + return c; +} + +int parse_save(void *save, int size, int replace, int x0, int y0) +{ + unsigned char *d,*c=save; + int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; + int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; + int fp[NPART], nf=0; + + if(size<16) + return 1; + if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) + return 1; + if(c[4]>SAVE_VERSION) + return 2; + ver = c[4]; + + if(ver<34) + { + legacy_enable = 1; + } + else + { + if(c[3]==1||c[3]==0) + legacy_enable = c[3]; + else + legacy_beta = 1; + } + + bw = c[6]; + bh = c[7]; + if(bx0+bw > XRES/CELL) + bx0 = XRES/CELL - bw; + if(by0+bh > YRES/CELL) + by0 = YRES/CELL - bh; + if(bx0 < 0) + bx0 = 0; + if(by0 < 0) + by0 = 0; + + if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) + return 3; + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + return 1; + size = i; + + if(size < bw*bh) + return 1; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + if(replace) + { + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(signs, 0, sizeof(signs)); + memset(parts, 0, sizeof(particle)*NPART); + memset(pmap, 0, sizeof(pmap)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(pv, 0, sizeof(pv)); + } + + // make a catalog of free parts + memset(pmap, 0, sizeof(pmap)); + for(i=0; i= size) + goto corrupt; + fvx[y][x] = (d[p++]-127.0f)/64.0f; + } + for(y=by0; y= size) + goto corrupt; + fvy[y][x] = (d[p++]-127.0f)/64.0f; + } + + // load the particle map + i = 0; + pty = p; + for(y=y0; y= size) + goto corrupt; + j=d[p++]; + if(j >= PT_NUM) + goto corrupt; + if(j && !(isplayer == 1 && j==PT_STKM)) + { + if(pmap[y][x]) + { + k = pmap[y][x]>>8; + parts[k].type = j; + parts[k].x = (float)x; + parts[k].y = (float)y; + m[(x-x0)+(y-y0)*w] = k+1; + } + else if(i < nf) + { + parts[fp[i]].type = j; + parts[fp[i]].x = (float)x; + parts[fp[i]].y = (float)y; + m[(x-x0)+(y-y0)*w] = fp[i]+1; + i++; + } + else + m[(x-x0)+(y-y0)*w] = NPART+1; + } + } + + // load particle properties + for(j=0; j= size) + goto corrupt; + if(i < NPART) + { + parts[i].vx = (d[p++]-127.0f)/16.0f; + parts[i].vy = (d[p++]-127.0f)/16.0f; + if(parts[i].type == PT_STKM) + { + player[2] = PT_DUST; + + player[3] = parts[i].x-1; //Setting legs positions + player[4] = parts[i].y+6; + player[5] = parts[i].x-1; + player[6] = parts[i].y+6; + + player[7] = parts[i].x-3; + player[8] = parts[i].y+12; + player[9] = parts[i].x-3; + player[10] = parts[i].y+12; + + player[11] = parts[i].x+1; + player[12] = parts[i].y+6; + player[13] = parts[i].x+1; + player[14] = parts[i].y+6; + + player[15] = parts[i].x+3; + player[16] = parts[i].y+12; + player[17] = parts[i].x+3; + player[18] = parts[i].y+12; + + } + } + else + p += 2; + } + } + for(j=0; j= size) + goto corrupt; + if(i <= NPART) + parts[i-1].life = d[p++]*4; + else + p++; + } + } + for(j=0; j=34&&legacy_beta==0) + { + if(p >= size) + { + goto corrupt; + } + if(i <= NPART) + { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } + else + { + p++; + } + } + else + { + parts[i-1].temp = ptypes[parts[i-1].type].heat; + } + } + } + for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) + { + if(p >= size) + goto corrupt; + if(i <= NPART) + parts[i-1].ctype = d[p++]; + else + p++; + } + } + + if(p >= size) + goto version1; + j = d[p++]; + for(i=0; i size) + goto corrupt; + for(k=0; k size) + goto corrupt; + if(kSAVE_VERSION) + return NULL; + + bw = c[6]; + bh = c[7]; + w = bw*CELL; + h = bh*CELL; + + if(c[5]!=CELL) + return NULL; + + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return NULL; + fb = calloc(w*h, PIXELSIZE); + if(!fb) + { + free(d); + return NULL; + } + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + goto corrupt; + size = i; + + if(size < bw*bh) + goto corrupt; + + k = 0; + for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) + goto corrupt; + + for(y=0; y= size) + goto corrupt; + j=d[p++]; + if(j0) + { + if(j==PT_STKM) //Stickman should be drawed another way + { + //Stickman drawing + for(k=-2; k<=1; k++) + { + fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); + fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); + fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); + fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); + } + draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); + draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); + draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); + draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); + } + else + fb[y*w+x] = ptypes[j].pcolors; + } + } + + free(d); + *width = w; + *height = h; + return fb; + +corrupt: + free(d); + free(fb); + return NULL; +} + +/* NO, I DON'T THINK SO + #include "fbi.h" + + pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) + { + unsigned char *tmp; + pixel *res; + int i; + + tmp = malloc(width*height*3); + if(!tmp) + return NULL; + res = malloc(width*height*PIXELSIZE); + if(!res) { + free(tmp); + return NULL; + } + + i = width*height*3; + if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { + free(res); + free(tmp); + return NULL; + } + + for(i=0; i1) + { + r = (r+c/2)/c; + g = (g+c/2)/c; + b = (b+c/2)/c; + } + q[y*w+x] = PIXRGB(r, g, b); + } + *qw = w; + *qh = h; + return q; +} + +#define GRID_X 5 +#define GRID_Y 4 +#define GRID_P 3 +#define GRID_S 6 +#define GRID_Z 3 + +void stamp_gen_thumb(int i) +{ + char fn[64]; + void *data; + int size, factor_x, factor_y; + pixel *tmp; + + if(stamps[i].thumb) + { + free(stamps[i].thumb); + stamps[i].thumb = NULL; + } + + sprintf(fn, "stamps" PATH_SEP "%s.stm", stamps[i].name); + data = file_load(fn, &size); + + if(data) + { + stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); + if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) + { + factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); + factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); + if(factor_y > factor_x) + factor_x = factor_y; + tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); + free(stamps[i].thumb); + stamps[i].thumb = tmp; + } + } + + free(data); +} + +int clipboard_ready = 0; +void *clipboard_data = 0; +int clipboard_length = 0; + +void stamp_save(int x, int y, int w, int h) +{ + FILE *f; + int n; + char fn[64], sn[16]; + void *s=build_save(&n, x, y, w, h); + +#ifdef WIN32 + _mkdir("stamps"); +#else + mkdir("stamps", 0755); +#endif + + stamp_gen_name(sn); + sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); + + f = fopen(fn, "wb"); + if(!f) + return; + fwrite(s, n, 1, f); + fclose(f); + + free(s); + + if(stamps[STAMP_MAX-1].thumb) + free(stamps[STAMP_MAX-1].thumb); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); + memset(stamps, 0, sizeof(struct stamp_info)); + if(stamp_count0) + { + memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); + memcpy(stamps, &tmp, sizeof(struct stamp_info)); + + stamp_update(); + } + + return data; +} + +void stamp_init(void) +{ + int i; + FILE *f; + + memset(stamps, 0, sizeof(stamps)); + + f=fopen("stamps" PATH_SEP "stamps.def", "rb"); + if(!f) + return; + for(i=0; i=XRES+BARSIZE || y>=YRES+MENUSIZE) + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +{ + int i, j, w, bn = 0, ba = 0; + char *rp = font_data + font_ptrs[c]; + w = *(rp++); + for(j=0; j>= 2; + bn -= 2; + } + return x + w; +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) +{ + int sx = x; + for(; *s; s++) + { + if(*s == '\n') + { + x = sx; + y += FONT_H+2; + } + else if(*s == '\b') + { + switch(s[1]) + { + case 'w': + r = g = b = 255; + break; + case 'g': + r = g = b = 192; + break; + case 'o': + r = 255; + g = 216; + b = 32; + break; + case 'r': + r = 255; + g = b = 0; + break; + case 'b': + r = g = 0; + b = 255; + break; + } + s++; + } + else + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + return x; +} + +void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) +{ + int i; + for(i=0; i<=w; i++) + { + drawpixel(vid, x+i, y, r, g, b, a); + drawpixel(vid, x+i, y+h, r, g, b, a); + } + for(i=1; i=w && x+textwidth(s)>=w+5) + break; + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + if(*s) + for(i=0; i<3; i++) + x = drawchar(vid, x, y, '.', r, g, b, a); + return x; +} + +int textnwidth(char *s, int n) +{ + int x = 0; + for(; *s; s++) + { + if(!n) + break; + x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + n--; + } + return x-1; +} +int textwidthx(char *s, int w) +{ + int x=0,n=0,cw; + for(; *s; s++) + { + cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + if(x+(cw/2) >= w) + break; + x += cw; + n++; + } + return n; +} + +/*********************************************************** + * MAIN PROGRAM * + ***********************************************************/ + +void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) +{ + int x, y, i, j, c; + int bo = b; + if(iswall==1) + { + b = b-100; + x = (2+32*((b-22)/1)); + y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + x = 2+32*(b/2); + y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + if(bo==sl || bo==sr) + { + c = 0; + if(bo==sl) + c |= PIXPACK(0xFF0000); + if(bo==sr) + c |= PIXPACK(0x0000FF); + for(i=0; i<30; i++) + { + vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; + } + for(j=0; j<18; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; + } + } +} + +int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) +{ + int i, j, c; + if(b>=121) + { + b = b-100; + //x = (2+32*((b-22)/1)); + //y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + case 40: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + //x = 2+32*(b/2); + //y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + return 26; +} + +void draw_menu(pixel *vid_buf, int i, int hover) +{ + + //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); +#ifdef MENUV3 + drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + if(hover==i) + { + fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + } +#else + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); +#endif +} + +void menu_ui(pixel *vid_buf, int i, int *sl, int *sr) +{ + int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; + pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); + fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + rows = ceil((float)msections[i].itemcount/16.0f); + height = (ceil((float)msections[i].itemcount/16.0f)*18); + width = restrict_flt(msections[i].itemcount*31, 0, 16*31); + //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); + h = -1; + x = XRES-BARSIZE-26; + y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; + sy = y; + //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); + fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); + fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); + drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); + if(i==SC_WALL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM) + { + if(x-26<=60) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=60) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=20) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(!bq && mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + if(b==1&&h!=-1) + { + *sl = h; + } + if(b==4&&h!=-1) + { + *sr = h; + } +} + +int create_parts(int x, int y, int r, int c) +{ + int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; + + if(c == 125) + { + i = x / CELL; + j = y / CELL; + for(v=-1; v<2; v++) + for(u=-1; u<2; u++) + if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) + { + if(cp) + create_parts(y, x, r, c); + else + create_parts(x, y, r, c); + } + e -= 1.0f; + } + } +} + +void create_box(int x1, int y1, int x2, int y2, int c) +{ + int i, j; + if(x1>x2) + { + i = x2; + x2 = x1; + x1 = i; + } + if(y1>y2) + { + j = y2; + y2 = y1; + y1 = j; + } + for(j=y1; j<=y2; j++) + for(i=x1; i<=x2; i++) + create_parts(i, j, 1, c); +} + +int flood_parts(int x, int y, int c, int cm, int bm) +{ + int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) + { + c = c-100; + } + if(cm==-1) + { + if(c==0) + { + cm = pmap[y][x]&0xFF; + if(!cm) + return 0; + } + else + cm = 0; + } + if(bm==-1) + { + if(c==30) + { + bm = bmap[y/CELL][x/CELL]; + if(!bm) + return 0; + if(bm==1) + cm = 0xFF; + } + else + bm = 0; + } + + if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) + return 1; + + // go left as far as possible + x1 = x2 = x; + while(x1>=CELL) + { + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + break; + x1--; + } + while(x2=CELL+dy) + for(x=x1; x<=x2; x++) + if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) + if(!flood_parts(x, y-dy, co, cm, bm)) + return 0; + if(y=XRES || y>=YRES) + return; + c = vid[y*(XRES+BARSIZE)+x]; + c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); + if(c<512) + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); + else + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); +} + +void xor_line(int x1, int y1, int x2, int y2, pixel *vid) +{ + int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + e -= 1.0f; + } + } +} + +void draw_svf_ui(pixel *vid_buf) +{ + int c; + + drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); + drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + c = svf_open ? 255 : 128; + drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); + drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); + + c = svf_login ? 255 : 128; + drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); + if(svf_open) + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); + else + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); + drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); + if(svf_open && svf_own) + drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); + + c = (svf_login && svf_open) ? 255 : 128; + + drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + + if(svf_myvote==1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); + } + else if(svf_myvote==-1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); + } + + drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); + drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); + + drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); + if(svf_tags[0]) + drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); + else + drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); + + drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); + + drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); + drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); + if(svf_login) + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); + else + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); + drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); + + if(sys_pause) + { + fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); + drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + if(!legacy_enable) + { + fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + switch(cmode) + { + case 0: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); + break; + case 1: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); + break; + case 2: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); + break; + case 3: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); + break; + case 4: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); + break; + case 5: + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + break; + } + drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + + if(svf_admin) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); + } + else if(svf_mod) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + }//else if(amd) + // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? +} + +typedef struct ui_edit +{ + int x, y, w, nx; + char str[256],*def; + int focus, cursor, hide; +} ui_edit; +void ui_edit_draw(pixel *vid_buf, ui_edit *ed) +{ + int cx, i; + char echo[256], *str; + + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(ed->str[0]) + { + drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } + else if(!ed->focus) + drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); + if(ed->focus) + { + cx = textnwidth(str, ed->cursor); + for(i=-3; i<9; i++) + drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); + } +} +char *shift_0="`1234567890-=[]\\;',./"; +char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; +void ui_edit_process(int mx, int my, int mb, ui_edit *ed) +{ + char ch, ts[2], echo[256], *str; + int l, i; +#ifdef RAWINPUT + char *p; +#endif + + if(mb) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } + else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } + else + ed->focus = 0; + } + if(ed->focus && sdl_key) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + l = strlen(ed->str); + switch(sdl_key) + { + case SDLK_HOME: + ed->cursor = 0; + break; + case SDLK_END: + ed->cursor = l; + break; + case SDLK_LEFT: + if(ed->cursor > 0) + ed->cursor --; + break; + case SDLK_RIGHT: + if(ed->cursor < l) + ed->cursor ++; + break; + case SDLK_DELETE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + ed->str[ed->cursor] = 0; + else if(ed->cursor < l) + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + break; + case SDLK_BACKSPACE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + { + if(ed->cursor > 0) + memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); + ed->cursor = 0; + } + else if(ed->cursor > 0) + { + ed->cursor--; + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + } + break; + default: +#ifdef RAWINPUT + if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) + { + ch = sdl_key; + if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) + { + if(ch>='a' && ch<='z') + ch &= ~0x20; + p = strchr(shift_0, ch); + if(p) + ch = shift_1[p-shift_0]; + } + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#else + if(sdl_ascii>=' ' && sdl_ascii<127) + { + ch = sdl_ascii; + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#endif + break; + } + } +} +typedef struct ui_checkbox +{ + int x, y; + int focus, checked; +} ui_checkbox; +void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) +{ + int w = 12; + if(ed->checked) + { + drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); + } + if(ed->focus) + { + drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); + } + else + { + drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); + } +} +void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) +{ + int w = 12; + + if(mb && !mbq) + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->checked = (ed->checked)?0:1; + } + } + else + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->focus = 1; + } + else + { + ed->focus = 0; + } + } +} + +void error_ui(pixel *vid_buf, int err, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + char *msg; + + msg = malloc(strlen(txt)+16); + if(err) + sprintf(msg, "%03d %s", err, txt); + else + sprintf(msg, "%s", txt); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + if(err) + drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); + else + drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + free(msg); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_ui(pixel *vid_buf, char *top, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); + drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_box(pixel *vid_buf, char *msg) +{ + int w = textwidth(msg)+16; + int x0=(XRES-w)/2,y0=(YRES-24)/2; + + clearrect(vid_buf, x0-2, y0-2, w+4, 28); + drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); +} + +int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + int ret = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); + drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); + drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); + drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) + { + ret = 1; + break; + } + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + { + ret = 1; + break; + } + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + return ret; +} + +int execute_tagop(pixel *vid_buf, char *op, char *tag) +{ + int status; + char *result; + + char *names[] = {"ID", "Tag", NULL}; + char *parts[2]; + + char *uri = malloc(strlen(SERVER)+strlen(op)+36); + sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); + + parts[0] = svf_id; + parts[1] = tag; + + result = http_multipart_post( + uri, + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + free(uri); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 1; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 1; + } + + if(result[2]) + { + strncpy(svf_tags, result+3, 255); + svf_id[15] = 0; + } + + if(result) + free(result); + + return 0; +} + +struct strlist +{ + char *str; + struct strlist *next; +}; +void strlist_add(struct strlist **list, char *str) +{ + struct strlist *item = malloc(sizeof(struct strlist)); + item->str = mystrdup(str); + item->next = *list; + *list = item; +} +int strlist_find(struct strlist **list, char *str) +{ + struct strlist *item; + for(item=*list; item; item=item->next) + if(!strcmp(item->str, str)) + return 1; + return 0; +} +void strlist_free(struct strlist **list) +{ + struct strlist *item; + while(*list) + { + item = *list; + *list = (*list)->next; + free(item); + } +} + +void tag_list_ui(pixel *vid_buf) +{ + int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; + char *p,*q,s; + char *tag=NULL, *op=NULL; + ui_edit ed; + struct strlist *vote=NULL,*down=NULL; + + ed.x = x0+25; + ed.y = y0+221; + ed.w = 158; + ed.nx = 1; + ed.def = "[new tag]"; + ed.focus = 0; + ed.hide = 0; + ed.cursor = 0; + strcpy(ed.str, ""); + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + op = tag = NULL; + + drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 256); + drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); + p = svf_tags; + s = svf_tags[0] ? ' ' : 0; + y = 36 + y0; + while(s) + { + q = strchr(p, ' '); + if(!q) + q = p+strlen(p); + s = *q; + *q = 0; + if(svf_own || svf_admin || svf_mod) + { + drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); + d = 14; + if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) + { + if(!ed1.focus) + break; + ed1.focus = 0; + ed2.focus = 1; + } + if(sdl_key==SDLK_ESCAPE) + { + if(!ed1.focus && !ed2.focus) + return; + ed1.focus = 0; + ed2.focus = 0; + } + } + + strcpy(svf_user, ed1.str); + md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); + + res = http_multipart_post( + "http://" SERVER "/Login.api", + NULL, NULL, NULL, + svf_user, svf_pass, + &err, NULL); + if(err != 200) + { + error_ui(vid_buf, err, http_ret_text(err)); + if(res) + free(res); + goto fail; + } + if(res && !strncmp(res, "OK", 2)) + { + if(!strcmp(res, "OK ADMIN")) + { + svf_admin = 1; + svf_mod = 0; + } + else if(!strcmp(res, "OK MOD")) + { + svf_admin = 0; + svf_mod = 1; + } + else + { + svf_admin = 0; + svf_mod = 0; + } + free(res); + svf_login = 1; + return; + } + if(!res) + res = mystrdup("Unspecified Error"); + error_ui(vid_buf, 0, res); + free(res); + +fail: + strcpy(svf_user, ""); + strcpy(svf_pass, ""); + svf_login = 0; + svf_own = 0; + svf_admin = 0; + svf_mod = 0; +} + +void execute_delete(pixel *vid_buf, char *id) +{ + int status; + char *result; + + char *names[] = {"ID", NULL}; + char *parts[1]; + + parts[0] = id; + + result = http_multipart_post( + "http://" SERVER "/Delete.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result) + free(result); +} + +int execute_vote(pixel *vid_buf, char *id, char *action) +{ + int status; + char *result; + + char *names[] = {"ID", "Action", NULL}; + char *parts[2]; + + parts[0] = id; + parts[1] = action; + + result = http_multipart_post( + "http://" SERVER "/Vote.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 0; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 0; + } + + if(result) + free(result); + return 1; +} + +static char hex[] = "0123456789ABCDEF"; +void strcaturl(char *dst, char *src) +{ + char *d; + unsigned char *s; + + for(d=dst; *d; d++) ; + + for(s=(unsigned char *)src; *s; s++) + { + if((*s>='0' && *s<='9') || + (*s>='a' && *s<='z') || + (*s>='A' && *s<='Z')) + *(d++) = *s; + else + { + *(d++) = '%'; + *(d++) = hex[*s>>4]; + *(d++) = hex[*s&15]; + } + } + *d = 0; +} + +#define THUMB_CACHE_SIZE 256 + +char *thumb_cache_id[THUMB_CACHE_SIZE]; +void *thumb_cache_data[THUMB_CACHE_SIZE]; +int thumb_cache_size[THUMB_CACHE_SIZE]; +int thumb_cache_lru[THUMB_CACHE_SIZE]; + +void thumb_cache_inval(char *id) +{ + int i,j; + for(i=0; i= THUMB_CACHE_SIZE) + return; + free(thumb_cache_id[i]); + free(thumb_cache_data[i]); + thumb_cache_id[i] = NULL; + for(j=0; j thumb_cache_lru[i]) + thumb_cache_lru[j]--; +} +void thumb_cache_add(char *id, void *thumb, int size) +{ + int i,m=-1,j=-1; + thumb_cache_inval(id); + for(i=0; i m) + { + m = thumb_cache_lru[i]; + j = i; + } + } + if(i >= THUMB_CACHE_SIZE) + { + thumb_cache_inval(thumb_cache_id[j]); + i = j; + } + for(j=0; j= THUMB_CACHE_SIZE) + return 0; + for(j=0; j=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+5); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + else if(!strncmp(str, "TAG ", 4)) + { + if(j >= TAG_MAX) + { + str = p; + continue; + } + q = strchr(str+4, ' '); + if(!q) + { + str = p; + continue; + } + *(q++) = 0; + tag_names[j] = mystrdup(str+4); + tag_votes[j] = atoi(q); + j++; + } + else + { + if(i>=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + str = p; + } + if(*str) + i++; + return i; +} + +#define IMGCONNS 3 +#define TIMEOUT 100 +#define HTTP_TIMEOUT 10 + +int search_own = 0; +int search_date = 0; +int search_page = 0; +char search_expr[256] = ""; + +int search_ui(pixel *vid_buf) +{ + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; + int thumb_drawn[GRID_X*GRID_Y]; + pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + float ry; + time_t http_last_use=HTTP_TIMEOUT; + ui_edit ed; + + + void *http = NULL; + int active = 0; + char *last = NULL; + int search = 0; + int lasttime = TIMEOUT; + char *uri; + int status; + char *results; + char *tmp, ts[64]; + + void *img_http[IMGCONNS]; + char *img_id[IMGCONNS]; + void *thumb, *data; + int thlen, dlen; + + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + + memset(img_http, 0, sizeof(img_http)); + memset(img_id, 0, sizeof(img_id)); + + memset(search_ids, 0, sizeof(search_ids)); + memset(search_names, 0, sizeof(search_names)); + memset(search_scoreup, 0, sizeof(search_scoreup)); + memset(search_scoredown, 0, sizeof(search_scoredown)); + memset(search_publish, 0, sizeof(search_publish)); + memset(search_owners, 0, sizeof(search_owners)); + memset(search_thumbs, 0, sizeof(search_thumbs)); + memset(search_thsizes, 0, sizeof(search_thsizes)); + + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + + do_open = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = 65; + ed.y = 13; + ed.w = XRES-200; + ed.nx = 1; + ed.def = "[search terms]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(search_expr); + strcpy(ed.str, search_expr); + + sdl_wheel = 0; + + while(!sdl_poll()) + { + uih = 0; + bq = b; + mxq = mx; + myq = my; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + if(mx!=mxq || my!=myq || sdl_wheel || b) + mmt = 0; + else if(mmt 9) + { + drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); + drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); + } + + ui_edit_draw(vid_buf, &ed); + + if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) + { + if(search_page) + { + search_page --; + lasttime = TIMEOUT; + } + sdl_wheel = 0; + uih = 1; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) + { + lasttime = TIMEOUT; + search_page ++; + page_count = exp_res; + } + sdl_wheel = 0; + uih = 1; + } + + tp = -1; + if(is_p1) + { + drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); + for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) + for(gi=0; giTAG_MAX || !tag_names[pos]) + break; + if(tag_votes[0]) + i = 127+(128*tag_votes[pos])/tag_votes[0]; + else + i = 192; + w = textwidth(tag_names[pos]); + if(w>XRES/GRID_X-5) + w = XRES/GRID_X-5; + gx = (XRES/GRID_X)*gi; + gy = gj*14 + 46; + if(mx>=gx && mx=gy && my XRES/GRID_X-10) + { + tmp = malloc(strlen(search_names[pos])+4); + strcpy(tmp, search_names[pos]); + j = textwidthx(tmp, XRES/GRID_X-15); + strcpy(tmp+j, "..."); + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); + free(tmp); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); + j = textwidth(search_owners[pos]); + if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && + my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) + { + st = 1; + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); + if(search_thumbs[pos]&&thumb_drawn[pos]==0) + { + render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); + thumb_drawn[pos] = 1; + } + own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); + if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) + mp = pos; + if(own) + { + if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) + { + mp = -1; + dp = pos; + } + } + if(mp==pos && !st) + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); + else + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); + if(own) + { + if(dp == pos) + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); + else + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); + } + if(!search_publish[pos]) + { + drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); + drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } + if(view_own || svf_admin || svf_mod) + { + sprintf(ts+1, "%d", search_votes[pos]); + ts[0] = 0xBB; + for(j=1; ts[j]; j++) + ts[j] = 0xBC; + ts[j-1] = 0xB9; + ts[j] = 0xBA; + ts[j+1] = 0; + w = gx+XRES/GRID_S-2-textwidth(ts); + h = gy+YRES/GRID_S-11; + drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); + for(j=0; ts[j]; j++) + ts[j] -= 14; + drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); + sprintf(ts, "%d", search_votes[pos]); + for(j=0; ts[j]; j++) + ts[j] += 127; + drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); + } + if(search_scoreup[pos]>0||search_scoredown[pos]>0) + { + lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); + + if(((YRES/GRID_S+3)/2)>lv) + { + ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); + if(lv<8) + { + ry = ry/(8-lv); + } + nyu = search_scoreup[pos]*ry; + nyd = search_scoredown[pos]*ry; + } + else + { + ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); + nyu = search_scoreup[pos]/ry; + nyd = search_scoredown[pos]/ry; + } + + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); + + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); + } + } + + if(mp!=-1 && mmt>=TIMEOUT/5 && !st) + { + gi = mp % GRID_X; + gj = mp / GRID_X; + if(is_p1) + gj += GRID_Y-GRID_P; + gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; + gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; + i = w = textwidth(search_names[mp]); + h = YRES/GRID_Z+30; + if(w=XRES-2) gx=XRES-3-w; + if(gy<32) gy=32; + if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; + clearrect(vid_buf, gx-2, gy-3, w+4, h); + drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); + if(search_thumbs[mp]) + render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); + drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); + drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); + } + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(sdl_key==SDLK_RETURN) + { + if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) + lasttime = TIMEOUT; + else if(search_ids[0] && !search_ids[1]) + { + bq = 0; + b = 1; + mp = 0; + } + } + if(sdl_key==SDLK_ESCAPE) + goto finish; + + if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) + { + search_own = !search_own; + lasttime = TIMEOUT; + } + if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) + { + search_date = !search_date; + lasttime = TIMEOUT; + } + + if(b && !bq && dp!=-1) + if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) + { + execute_delete(vid_buf, search_ids[dp]); + lasttime = TIMEOUT; + if(last) + { + free(last); + last = NULL; + } + } + + if(b && !bq && tp!=-1) + { + strncpy(ed.str, tag_names[tp], 255); + lasttime = TIMEOUT; + } + + if(b && !bq && mp!=-1 && st) + { + sprintf(ed.str, "user:%s", search_owners[mp]); + lasttime = TIMEOUT; + } + + if(do_open==1) + { + mp = 0; + } + + if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) + { + fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); + info_box(vid_buf, "Loading..."); + + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + data = http_simple_get(uri, &status, &dlen); + free(uri); + + if(status == 200) + { + status = parse_save(data, dlen, 1, 0, 0); + switch(status) + { + case 1: + error_ui(vid_buf, 0, "Simulation corrupted"); + break; + case 2: + error_ui(vid_buf, 0, "Simulation from a newer version"); + break; + case 3: + error_ui(vid_buf, 0, "Simulation on a too large grid"); + break; + } + if(!status) + { + char *tnames[] = {"ID", NULL}; + char *tparts[1]; + int tplens[1]; + if(svf_last) + free(svf_last); + svf_last = data; + svf_lsize = dlen; + + tparts[0] = search_ids[mp]; + tplens[0] = strlen(search_ids[mp]); + data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); + + svf_open = 1; + svf_own = svf_login && !strcmp(search_owners[mp], svf_user); + svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); + + strcpy(svf_id, search_ids[mp]); + strcpy(svf_name, search_names[mp]); + if(status == 200) + { + if(data) + { + strncpy(svf_tags, data, 255); + svf_tags[255] = 0; + } + else + svf_tags[0] = 0; + } + else + { + svf_tags[0] = 0; + } + + if(svf_login) + { + char *names[] = {"ID", NULL}; + char *parts[1]; + parts[0] = search_ids[mp]; + data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); + if(status == 200) + { + if(data) + { + if(!strcmp(data, "Up")) + { + svf_myvote = 1; + } + else if(!strcmp(data, "Down")) + { + svf_myvote = -1; + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + } + else + { + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + } + } + else + error_ui(vid_buf, status, http_ret_text(status)); + + if(data) + free(data); + goto finish; + } + + if(!last) + { + search = 1; + } + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) + { + search = 1; + if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) + { + search_page = 0; + page_count = 0; + } + free(last); + last = NULL; + } + else + search = 0; + + if(search && lasttime>=TIMEOUT) + { + lasttime = 0; + last = mystrdup(ed.str); + last_own = search_own; + last_date = search_date; + last_page = search_page; + active = 1; + uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); + if(search_own || svf_admin || svf_mod) + tmp = "&ShowVotes=true"; + else + tmp = ""; + if(!search_own && !search_date && !*last) + { + if(search_page) + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); + } + else + { + exp_res = GRID_X*GRID_P; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); + } + } + else + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); + } + strcaturl(uri, last); + if(search_own) + { + strcaturl(uri, " user:"); + strcaturl(uri, svf_user); + } + if(search_date) + strcaturl(uri, " sort:date"); + + http = http_async_req_start(http, uri, NULL, 0, 1); + if(svf_login) + { + http_auth_headers(http, svf_user, svf_pass); + } + http_last_use = time(NULL); + free(uri); + } + + if(active && http_async_req_status(http)) + { + http_last_use = time(NULL); + results = http_async_req_stop(http, &status, NULL); + view_own = last_own; + if(status == 200) + { + page_count = search_results(results, last_own||svf_admin||svf_mod); + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + } + is_p1 = (exp_res < GRID_X*GRID_Y); + free(results); + active = 0; + } + + if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) + { + http_async_req_close(http); + http = NULL; + } + + for(i=0; i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) + { + if(stamp_page) + { + stamp_page --; + } + sdl_wheel = 0; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; +} + +void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) +{ + char t[2]; + t[0] = ch; + t[1] = 0; + if(flag) + { + fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); + } + else + { + drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); + } +} + +void render_signs(pixel *vid_buf) +{ + int i, j, x, y, w, h, dx, dy; + char buff[30]; //Buffer + for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature + else + sprintf(buff, "Temp: 0.00"); //...tempirature + drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); + } + + //Usual text + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); + x = signs[i].x; + y = signs[i].y; + dx = 1 - signs[i].ju; + dy = (signs[i].y > 18) ? -1 : 1; + for(j=0; j<4; j++) + { + drawpixel(vid_buf, x, y, 192, 192, 192, 255); + x+=dx; + y+=dy; + } + } +} + +void add_sign_ui(pixel *vid_buf, int mx, int my) +{ + int i, w, h, x, y, nm=0, ju; + int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; + ui_edit ed; + + // check if it is an existing sign + for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) + break; + } + // else look for empty spot + if(i >= MAXSIGNS) + { + nm = 1; + for(i=0; i= MAXSIGNS) + return; + + if(nm) + { + signs[i].x = mx; + signs[i].y = my; + signs[i].ju = 1; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = x0+25; + ed.y = y0+25; + ed.w = 158; + ed.nx = 1; + ed.def = "[message]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(signs[i].text); + strcpy(ed.str, signs[i].text); + ju = signs[i].ju; + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed); + drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); + draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); + draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); + draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); + + if(!nm) + { + drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); + drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); + drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); + } + + drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) + ju = 0; + if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) + ju = 1; + if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) + ju = 2; + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) + { + signs[i].text[0] = 0; + return; + } + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + { + if(!ed.focus) + return; + ed.focus = 0; + } + } + + strcpy(signs[i].text, ed.str); + signs[i].ju = ju; +} + +/*********************************************************** + * CONFIG FILE * + ***********************************************************/ + +char http_proxy[256] = ""; + +void save_string(FILE *f, char *str) +{ + int li = strlen(str); + unsigned char lb[2]; + lb[0] = li; + lb[1] = li >> 8; + fwrite(lb, 2, 1, f); + fwrite(str, li, 1, f); +} + +int load_string(FILE *f, char *str, int max) +{ + int li; + unsigned char lb[2]; + fread(lb, 2, 1, f); + li = lb[0] | (lb[1] << 8); + if(li > max) + { + str[0] = 0; + return 1; + } + fread(str, li, 1, f); + str[li] = 0; + return 0; +} + +unsigned char last_major=0, last_minor=0, update_flag=0; + +void save_presets(int do_update) +{ + FILE *f=fopen("powder.def", "wb"); + unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; + unsigned char tmp = sdl_scale; + if(!f) + return; + fwrite(sig, 1, 4, f); + save_string(f, svf_user); + save_string(f, svf_pass); + fwrite(&tmp, 1, 1, f); + tmp = cmode; + fwrite(&tmp, 1, 1, f); + tmp = svf_admin; + fwrite(&tmp, 1, 1, f); + tmp = svf_mod; + fwrite(&tmp, 1, 1, f); + save_string(f, http_proxy); + tmp = SAVE_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = MINOR_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = do_update; + fwrite(&tmp, 1, 1, f); + fclose(f); +} + +void load_presets(void) +{ + FILE *f=fopen("powder.def", "rb"); + unsigned char sig[4], tmp; + if(!f) + return; + fread(sig, 1, 4, f); + if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) + { + if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) + { + if(fseek(f, -3, SEEK_END)) + { + remove("powder.def"); + return; + } + if(fread(sig, 1, 3, f) != 3) + { + remove("powder.def"); + goto fail; + } + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; + } + fclose(f); + remove("powder.def"); + return; + } + if(load_string(f, svf_user, 63)) + goto fail; + if(load_string(f, svf_pass, 63)) + goto fail; + svf_login = !!svf_user[0]; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + sdl_scale = (tmp == 2) ? 2 : 1; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + cmode = tmp%6; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_admin = tmp; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_mod = tmp; + if(load_string(f, http_proxy, 255)) + goto fail; + if(fread(sig, 1, 3, f) != 3) + goto fail; + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; +fail: + fclose(f); +} + +void dim_copy(pixel *dst, pixel *src) +{ + int i,r,g,b; + for(i=0; i0) + r--; + if(g>0) + g--; + if(b>0) + b--; + dst[i] = PIXRGB(r,g,b); + } +} + +unsigned int fire_alpha[CELL*3][CELL*3]; +void prepare_alpha(void) +{ + int x,y,i,j; + float temp[CELL*3][CELL*3]; + memset(temp, 0, sizeof(temp)); + for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; + fire_g[j][i] = g>4 ? g-4 : 0; + fire_b[j][i] = b>4 ? b-4 : 0; + } +} + +int zoom_en = 0; +int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; +int zoom_wx=0, zoom_wy=0; +void render_zoom(pixel *img) +{ + int x, y, i, j; + pixel pix; + drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); + drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); + clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); + for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) + { + xor_pixel(x+i, y+j, vid); + if(j) xor_pixel(x+i, y-j, vid); + if(i) xor_pixel(x-i, y+j, vid); + if(i&&j) xor_pixel(x-i, y-j, vid); + } + } + else + { + int tc; + c = (r/CELL) * CELL; + x = (x/CELL) * CELL; + y = (y/CELL) * CELL; + + tc = !((c%(CELL*2))==0); + + x -= c/2; + y -= c/2; + + x += tc*(CELL/2); + y += tc*(CELL/2); + + for(i=0; i2) + { + pthread_t pth; + pthread_create(&pth,NULL,update_air_th,""); + } + else + { + update_air(); + } +#else + update_air(); +#endif + } + if(cmode==0 || cmode==1) + { + draw_air(vid_buf); + } + else if(cmode==2) + { + memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); + memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); + } + else + { + memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + } + update_particles(vid_buf); + + if(cmode==2) + { + if(!fire_fc) + { + dim_copy(fire_bg, vid_buf); + } + else + { + memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); + } + fire_fc = (fire_fc+1) % 3; + } + if(cmode==3||cmode==4) + render_fire(vid_buf); + + render_signs(vid_buf); + + memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); + clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); + + draw_svf_ui(vid_buf); + + if(http_ver_check) + { + if(!do_check && http_async_req_status(http_ver_check)) + { + ver_data = http_async_req_stop(http_ver_check, &http_ret, NULL); + if(http_ret==200 && ver_data) + { +#ifdef BETA + if(sscanf(ver_data, "%d.%d.%d", &major, &minor, &is_beta)==3) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) + old_version = 1; +#else + if(sscanf(ver_data, "%d.%d", &major, &minor)==2) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) + old_version = 1; +#endif + free(ver_data); + } + http_ver_check = NULL; + } + do_check = (do_check+1) & 15; + } + + if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) + { + if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) + { + break; + } + } + if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) + { + if(load_mode) + { + free(load_img); + free(load_data); + load_mode = 0; + load_data = NULL; + load_img = NULL; + } + if(it > 50) + it = 50; + if(sdl_key=='k' && stamps[1].name[0]) + { + j = stamp_ui(vid_buf); + if(j>=0) + load_data = stamp_load(j, &load_size); + else + load_data = NULL; + } + else + load_data = stamp_load(0, &load_size); + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + if(sdl_key=='s') + { + if(it > 50) + it = 50; + save_mode = 1; + } + if(sdl_key=='1') + { + set_cmode(0); + } + if(sdl_key=='2') + { + set_cmode(1); + } + if(sdl_key=='3') + { + set_cmode(2); + } + if(sdl_key=='4') + { + set_cmode(3); + } + if(sdl_key=='5') + { + set_cmode(4); + } + if(sdl_key=='6') + { + set_cmode(5); + } + if(sdl_key==SDLK_SPACE) + sys_pause = !sys_pause; + if(sdl_key=='h') + hud_enable = !hud_enable; + if(sdl_key=='p') + dump_frame(vid_buf, XRES, YRES, XRES); + if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + if(clipboard_ready==1) + { + load_data = malloc(clipboard_length); + memcpy(load_data, clipboard_data, clipboard_length); + load_size = clipboard_length; + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + } + if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 2; + } + if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 1; + } + else if(sdl_key=='c') + { + set_cmode((cmode+1) % 6); + if(it > 50) + it = 50; + } + if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo + { + int cbx, cby, cbi; + + for(cbi=0; cbi32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + sdl_wheel = 0; + } + else + { + bs += sdl_wheel; + if(bs>16) + bs = 16; + if(bs<0) + bs = 0; + sdl_wheel = 0; + /*if(su >= PT_NUM) { + if(sl < PT_NUM) + su = sl; + if(sr < PT_NUM) + su = sr; + }*/ + } + } + + bq = b; + b = SDL_GetMouseState(&x, &y); + + for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy + && x0 && y0 && x>8)>=NPART || !cr)) + { +#ifdef BETA + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); +#else + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); +#endif + } + else + { + sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + } + } + mx = x; + my = y; + if(update_flag) + { + info_box(vid_buf, "Finalizing update..."); + if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) + { + update_cleanup(); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + { + if(update_finish()) + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + else + info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); + } + update_flag = 0; + } + + if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && + x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) + { + tmp = malloc(64); +#ifdef BETA + if(is_beta) + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); + } + else + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); + } +#else + sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); +#endif + if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) + { + free(tmp); + tmp = download_ui(vid_buf, my_uri, &i); + if(tmp) + { + save_presets(1); + if(update_start(tmp, i)) + { + update_cleanup(); + save_presets(0); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + return 0; + } + } + else + free(tmp); + } + if(y>=sdl_scale*(YRES+(MENUSIZE-20))) + { + if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) + { + db = (svf_myvote==1) ? 273 : 274; + if(da < 51) + da ++; + } + else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) + { + db = svf_own ? 257 : 256; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) + { + db = 270; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) + { + db = 266; + if(da < 51) + da ++; + } + else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) + { + db = 259; + if(svf_open && svf_own && x<=55*sdl_scale) + db = 258; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) + { + db = svf_login ? 261 : 260; + if(svf_admin) + { + db = 268; + } + else if(svf_mod) + { + db = 271; + } + if(da < 51) + da ++; + } + else if(x>=sdl_scale && x<=17*sdl_scale) + { + db = 262; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) + { + db = sys_pause ? 264 : 263; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) + { + db = 267; + if(da < 51) + da ++; + } + else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) + { + db = 265; + if(da < 51) + da ++; + } + else if(da > 0) + da --; + } + else if(da > 0) + da --; + + if(!sdl_zoom_trig && zoom_en==1) + zoom_en = 0; + + if(sdl_key==Z_keysym && zoom_en==2) + zoom_en = 1; + + if(load_mode) + { + load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); + load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); + if(load_x+load_w>XRES) load_x=XRES-load_w; + if(load_y+load_h>YRES) load_y=YRES-load_h; + if(load_x<0) load_x=0; + if(load_y<0) load_y=0; + if(bq==1 && !b) + { + parse_save(load_data, load_size, 0, load_x, load_y); + free(load_data); + free(load_img); + load_mode = 0; + } + else if(bq==4 && !b) + { + free(load_data); + free(load_img); + load_mode = 0; + } + } + else if(save_mode==1) + { + save_x = (mx/sdl_scale)/CELL; + save_y = (my/sdl_scale)/CELL; + if(save_x >= XRES/CELL) save_x = XRES/CELL-1; + if(save_y >= YRES/CELL) save_y = YRES/CELL-1; + save_w = 1; + save_h = 1; + if(b==1) + { + save_mode = 2; + } + else if(b==4) + { + save_mode = 0; + copy_mode = 0; + } + } + else if(save_mode==2) + { + save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; + save_h = (my/sdl_scale+CELL/2)/CELL - save_y; + if(save_w>XRES/CELL) save_w = XRES/CELL; + if(save_h>YRES/CELL) save_h = YRES/CELL; + if(save_w<1) save_w = 1; + if(save_h<1) save_h = 1; + if(!b) + { + if(copy_mode==1) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + } + else if(copy_mode==2) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + } + else + { + stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + save_mode = 0; + } + } + } + else if(sdl_zoom_trig && zoom_en<2) + { + x /= sdl_scale; + y /= sdl_scale; + x -= ZSIZE/2; + y -= ZSIZE/2; + if(x<0) x=0; + if(y<0) y=0; + if(x>XRES-ZSIZE) x=XRES-ZSIZE; + if(y>YRES-ZSIZE) y=YRES-ZSIZE; + zoom_x = x; + zoom_y = y; + zoom_wx = (x 50) + it = 50; + x /= sdl_scale; + y /= sdl_scale; + if(y>=YRES+(MENUSIZE-20)) + { + if(!lb) + { + if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Up")) + { + svf_myvote = 1; + } + } + if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Down")) + { + svf_myvote = -1; + } + } + if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) + tag_list_ui(vid_buf); + if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) + { + legacy_enable = !legacy_enable; + } + if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) + { + memset(signs, 0, sizeof(signs)); + memset(pv, 0, sizeof(pv)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(fvx, 0, sizeof(fvx)); + memset(fvy, 0, sizeof(fvy)); + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(parts, 0, sizeof(particle)*NPART); + for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) + { + login_ui(vid_buf); + if(svf_login) + save_presets(0); + } + if(x>=37 && x<=187 && svf_login) + { + if(!svf_open || !svf_own || x>51) + { + if(save_name_ui(vid_buf)) + execute_save(vid_buf); + } + else + execute_save(vid_buf); + while(!sdl_poll()) + if(!SDL_GetMouseState(&x, &y)) + break; + b = bq = 0; + } + if(x>=1 && x<=17) + { + search_ui(vid_buf); + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + } + if(x>=19 && x<=35 && svf_last && svf_open) + parse_save(svf_last, svf_lsize, 1, 0, 0); + if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) + { + if(b & SDL_BUTTON_LMASK) + set_cmode((cmode+1) % 6); + if(b & SDL_BUTTON_RMASK) + set_cmode((cmode+5) % 6); + save_presets(0); + } + if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) + sys_pause = !sys_pause; + lb = 0; + } + } + else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) + { + c = sl = cr&0xFF; + } + else + { + //Something + } + } + //create_parts(x, y, bs, SPC_AIR); + lx = x; + ly = y; + lb = 0; + lm = 0; + } + else + { + //Copy state before drawing any particles (for undo) + int cbx, cby, cbi; + + for(cbi=0; cbi=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) + create_line(lx, ly, x, y, bs, c); + } + else + create_box(lx, ly, x, y, c); + lm = 0; + } + lb = 0; + } + + if(load_mode) + { + draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); + xor_rect(vid_buf, load_x, load_y, load_w, load_h); + } + + if(save_mode) + { + xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + da = 51; + db = 269; + } + + if(zoom_en!=1 && !load_mode && !save_mode) + { + render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); + mousex = mx/sdl_scale; + mousey = my/sdl_scale; + } + + if(zoom_en) + render_zoom(vid_buf); + + if(da) + switch(db) + { + case 256: + drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); + break; + case 257: + drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); + break; + case 258: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); + break; + case 259: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); + break; + case 260: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); + break; + case 261: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); + break; + case 262: + drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); + break; + case 263: + drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); + break; + case 264: + drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); + break; + case 265: + drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); + break; + case 266: + drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); + break; + case 267: + drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); + break; + case 268: + drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); + break; + case 269: + drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); + break; + case 270: + drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); + break; + case 271: + drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); + break; + case 272: + drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); + break; + case 273: + drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); + break; + case 274: + drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); + break; + case 275: + drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); + break; + default: + drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); + } + if(itc) + { + itc--; + drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); + } + if(it) + { + it--; + //if(fbi_img) + //draw_image(vid_buf, fbi_img, (XRES-FBI_W)/2, (YRES-FBI_H)/2+25, FBI_W, FBI_H, it>12?64:it*5); + drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); + } + + if(old_version) + { + clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); +#ifdef BETA + if(is_beta) + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); + } + else + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); + } +#else + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); +#endif + drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); + } + /*#ifdef MT + pthread_join(pth2,NULL); + #endif*/ + + if(hud_enable) + { + currentTime = SDL_GetTicks(); + if(currentTime-past>=16) + { + past = SDL_GetTicks(); + FPS++; + } + if(currentTime-pastFPS>=1000) + { +#ifdef BETA + sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#else + sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#endif + FPSB = FPS; + FPS = 0; + pastFPS = currentTime; + } + if(sdl_zoom_trig||zoom_en) + { + if(zoom_x Date: Mon, 16 Aug 2010 23:49:32 +0200 Subject: added roadmap, feel free to change diff --git a/roadmap b/roadmap new file mode 100644 index 0000000..2ac0edd --- /dev/null +++ b/roadmap @@ -0,0 +1,7 @@ +Next two releases: +use bitmasks where possible, add these to init list for part_types +splitting of powder.c +feature freeze +Focus on scalability +stability, possibly not use -O3 on linux, inlines where possible. +performance. -- cgit v0.9.2-21-gd62e From d430a352a1395e7a69e12ff79092c19de4d3657f Mon Sep 17 00:00:00 2001 From: FacialTurd Date: Mon, 16 Aug 2010 15:35:50 -0700 Subject: diff --git a/roadmap b/roadmap index 2ac0edd..98dbd43 100644 --- a/roadmap +++ b/roadmap @@ -5,3 +5,4 @@ feature freeze Focus on scalability stability, possibly not use -O3 on linux, inlines where possible. performance. +Multithreading? \ No newline at end of file -- cgit v0.9.2-21-gd62e From 887895624c0b8920a377230acc0dd5ecd58ebaea Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Tue, 17 Aug 2010 10:23:01 +0200 Subject: now weak diffusion for molten wax. diff --git a/.powder.c.swo b/.powder.c.swo new file mode 100644 index 0000000..79cdebe Binary files /dev/null and b/.powder.c.swo differ diff --git a/powder.c b/powder.c index 78e481b..9371e37 100644 --- a/powder.c +++ b/powder.c @@ -1025,7 +1025,7 @@ inline int create_part(int p, int x, int y, int t) { parts[i].pavg[1] = pv[y/CELL][x/CELL]; } - if(t!=PT_STKM) + else if(t!=PT_STKM) { parts[i].x = (float)x; parts[i].y = (float)y; @@ -1036,7 +1036,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].ctype = 0; parts[i].temp = ptypes[t].heat; } - if(t==PT_ACID) + else if(t==PT_ACID) { parts[i].life = 75; } @@ -1125,7 +1125,7 @@ inline int create_part(int p, int x, int y, int t) return i; } -void delete_part(int x, int y) +inline void delete_part(int x, int y) { unsigned i; @@ -1154,7 +1154,7 @@ inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } -int sign(float i) //Signum function +inline int sign(float i) //Signum function { if (i<0) return -1; @@ -1223,11 +1223,11 @@ void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); -int is_wire(int x, int y) +inline int is_wire(int x, int y) { return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; } -int is_wire_off(int x, int y) +inline int is_wire_off(int x, int y) { return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; } @@ -2830,8 +2830,21 @@ justdraw: isplayer = 1; //It's a secret. Tssss... } + if(t==PT_MWAX) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,224,224,170,255); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,224,224,170,5); + } + } - if(t==PT_ACID) + } + else if(t==PT_ACID) { if(parts[i].life>255) parts[i].life = 255; if(parts[i].life<47) parts[i].life = 48; -- cgit v0.9.2-21-gd62e From ec1ab3fbcfcf9de58c3f14ff393dbcceffe47d05 Mon Sep 17 00:00:00 2001 From: savask Date: Tue, 17 Aug 2010 16:38:08 +0800 Subject: Fixed photons spawning, but it's still have some bugs. diff --git a/powder.c b/powder.c index 9371e37..1e27abd 100644 --- a/powder.c +++ b/powder.c @@ -2262,353 +2262,368 @@ killed: } if(t==PT_STKM) - { - //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) - parts[i].temp += 1; - - //Death - if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... - { - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - //Verlet integration - pp = 2*player[3]-player[5]; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+1; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+1; - player[18] = player[16]; - player[16] = pp; - - //Go left - if (((int)(player[0])&0x01) == 0x01) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] += 3; - player[10] += 2; - player[5] += 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 3; - player[18] += 2; - player[13] +=2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[9] += 1; - player[10] += 1; - player[5] += 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 1; - player[18] += 1; - player[13] +=1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 3; - player[10] += 2; - player[5] -= 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 3; - player[18] += 2; - player[13] -= 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 1; - player[10] += 1; - player[5] -= 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 1; - player[18] += 1; - player[13] -= 1; - } - - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)) - { - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - create_part(-1, nx, ny, player[2]); - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 ) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - } - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[10] += 1; - player[18] += 1; - } - - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; - player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; - player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; - player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; - player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; - parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; - player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; - parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; - player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) - player[15] -= nx; - - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= 10+ny; - parts[i].vy = -10; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[7] += 0.2; - player[15] -= 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[3] += 0.2; - player[11] -= 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[16] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[8] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; + player[10] += 2; + player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; + player[18] += 2; + player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; + player[10] += 1; + player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; + player[18] += 1; + player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; + player[10] += 2; + player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; + player[18] += 2; + player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; + player[10] += 1; + player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; + player[18] += 1; + player[13] -= 1; + } + + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) + || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) + { + int random = abs(rand()%3-1)*3; + if (random==0) + { + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + } + else + { + parts[r>>8].vy = 0; + parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; + } + } + + } + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[10] += 1; + player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } if(t==PT_CLNE) { -- cgit v0.9.2-21-gd62e From d6c0211c54a004fe6e61810a799562f15efc84c8 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 17 Aug 2010 06:12:42 +0800 Subject: fix gas diff --git a/powder.c b/powder.c index 1e27abd..a46bb59 100644 --- a/powder.c +++ b/powder.c @@ -3152,7 +3152,7 @@ justdraw: for(y=-1; y<=1; y++) { if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,255,32,255); + blendpixel(vid,x+nx,y+ny,224,255,32,100); else if (abs(y) != 0 || abs(x) != 0) blendpixel(vid,x+nx,y+ny,224,255,32,20); } -- cgit v0.9.2-21-gd62e From 59fccc35fd3b6bd607db676d5f1e3855b220c292 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 17 Aug 2010 06:39:35 +0800 Subject: fix mwax bug diff --git a/powder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0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, @@ -3088,8 +3088,20 @@ justdraw: } } - } - else if(t==PT_DSTW) + } else if(t==PT_MWAX) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,0xE0,0xE0,0xAA,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,0xE0,0xE0,0xAA,50); + } + } + + } else if(t==PT_DSTW) { for(x=-1; x<=1; x++) { -- cgit v0.9.2-21-gd62e From 97fc7ce3307a478abe63499987b53bc2a19a7414 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 17 Aug 2010 12:51:55 +0100 Subject: Changes to particle drawing (zc00gii) diff --git a/powder.c b/powder.c index c9360e4..1df08e3 100644 --- a/powder.c +++ b/powder.c @@ -2853,8 +2853,10 @@ justdraw: { if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,224,224,170,255); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,224,224,170,5); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,224,224,170,20); + else + blendpixel(vid,x+nx,y+ny,224,224,170,40); } } @@ -3151,8 +3153,10 @@ justdraw: { if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,235,73,23,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,235,73,23,20); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,235,73,23,30); + else + blendpixel(vid,x+nx,y+ny,235,73,23,50); } } @@ -3164,9 +3168,11 @@ justdraw: for(y=-1; y<=1; y++) { if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,255,32,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,224,255,32,20); + blendpixel(vid,x+nx,y+ny,255,255,0,180); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,255,255,0,50); + else + blendpixel(vid,x+nx,y+ny,255,255,0,80); } } @@ -3275,7 +3281,7 @@ justdraw: cr = 0x40; cg = 0x70; cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx+1, ny, cr, cg, cb, 5); blendpixel(vid, nx-1, ny, cr, cg, cb, 5); blendpixel(vid, nx, ny+1, cr, cg, cb, 5); @@ -3293,7 +3299,7 @@ justdraw: cr = 0x70; cg = 0x70; cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx+1, ny, cr, cg, cb, 5); blendpixel(vid, nx-1, ny, cr, cg, cb, 5); blendpixel(vid, nx, ny+1, cr, cg, cb, 5); -- cgit v0.9.2-21-gd62e From 7076587196cdcb16a34f022bc0af6a34dbb77afc Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 17 Aug 2010 13:10:17 +0100 Subject: Removed superfluous particle drawings and made blurry stuff Firemode only diff --git a/powder.c b/powder.c old mode 100644 new mode 100755 index 1df08e3..113e303 --- a/powder.c +++ b/powder.c @@ -2845,7 +2845,7 @@ justdraw: isplayer = 1; //It's a secret. Tssss... } - if(t==PT_MWAX) + if(t==PT_MWAX&&cmode == 3) { for(x=-1; x<=1; x++) { @@ -2894,7 +2894,7 @@ justdraw: blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); } } - else if(t==PT_OILL) + else if(t==PT_OILL&&cmode == 3) { for(x=-1; x<=1; x++) { @@ -2938,7 +2938,7 @@ justdraw: blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } else if(t==PT_PLUT) + } else if(t==PT_PLUT&&cmode == 3) { cr = 0x40; cg = 0x70; @@ -2956,7 +2956,7 @@ justdraw: blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); } } - } else if(t==PT_URAN) + } else if(t==PT_URAN&&cmode == 3) { cr = 0x70; cg = 0x70; @@ -2974,7 +2974,7 @@ justdraw: blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); } } - } else if(t==PT_SLTW) + } else if(t==PT_SLTW&&cmode == 3) { for(x=-1; x<=1; x++) { @@ -3029,7 +3029,7 @@ justdraw: y = ny; blendpixel(vid,x,y,17,217,24,255); } - else if(t==PT_LNTG) + else if(t==PT_LNTG&&cmode == 3) { for(x=-1; x<=1; x++) { @@ -3077,7 +3077,7 @@ justdraw: } } } - else if(t==PT_WATR) + else if(t==PT_WATR&&cmode == 3) { for(x=-1; x<=1; x++) { @@ -3090,20 +3090,7 @@ justdraw: } } - } else if(t==PT_MWAX) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,0xE0,0xE0,0xAA,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,0xE0,0xE0,0xAA,50); - } - } - - } else if(t==PT_DSTW) + } else if(t==PT_DSTW&&cmode == 3) { for(x=-1; x<=1; x++) { @@ -3116,7 +3103,7 @@ justdraw: } } } - else if(t==PT_NITR) + else if(t==PT_NITR&&cmode == 3) { for(x=-1; x<=1; x++) { @@ -3130,7 +3117,7 @@ justdraw: } } - else if(t==PT_LRBD) + else if(t==PT_LRBD&&cmode == 3) { for(x=-1; x<=1; x++) { @@ -3145,7 +3132,7 @@ justdraw: } - else if(t==PT_NBLE) + else if(t==PT_NBLE&&cmode == 3) { for(x=-1; x<=1; x++) { @@ -3161,7 +3148,7 @@ justdraw: } } - else if(t==PT_GASS) + else if(t==PT_GASS&&cmode == 3) { for(x=-1; x<=1; x++) { @@ -3277,41 +3264,6 @@ justdraw: blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } else if(t==PT_PLUT) { - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 5); - blendpixel(vid, nx-1, ny, cr, cg, cb, 5); - blendpixel(vid, nx, ny+1, cr, cg, cb, 5); - blendpixel(vid, nx, ny-1, cr, cg, cb, 5); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_URAN) - { - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 5); - blendpixel(vid, nx-1, ny, cr, cg, cb, 5); - blendpixel(vid, nx, ny+1, cr, cg, cb, 5); - blendpixel(vid, nx, ny-1, cr, cg, cb, 5); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } } else if(t==PT_PLSM) { float ttemp = parts[i].life; -- cgit v0.9.2-21-gd62e From 5a41f64a08162ade16d148285e469bc06529de59 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 17 Aug 2010 13:38:43 +0100 Subject: Changes for Windows Compilation diff --git a/powder.c b/powder.c index 113e303..1913596 100755 --- a/powder.c +++ b/powder.c @@ -352,7 +352,11 @@ void *update_air_th(void *arg) return NULL; } +#ifdef WIN32 +_inline unsigned clamp_flt(float f, float min, float max) +#else inline unsigned clamp_flt(float f, float min, float max) +#endif { if(f=XRES || y>=YRES) @@ -1154,7 +1174,12 @@ inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } -inline int sign(float i) //Signum function +//Signum function +#ifdef WIN32 +_inline int sign(float i) +#else +inline int sign(float i) +#endif { if (i<0) return -1; @@ -1223,11 +1248,20 @@ void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); +#ifdef WIN32 +_inline int is_wire(int x, int y) +#else inline int is_wire(int x, int y) +#endif { return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; } + +#ifdef WIN32 +_inline int is_wire_off(int x, int y) +#else inline int is_wire_off(int x, int y) +#endif { return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; } @@ -1288,7 +1322,11 @@ void set_emap(int x, int y) set_emap(x, y+1); } } +#ifdef WIN32 +_inline int parts_avg(int ci, int ni) +#else inline int parts_avg(int ci, int ni) +#endif { int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; if((pmr>>8) < NPART && (pmr>>8) >= 0) @@ -2940,6 +2978,8 @@ justdraw: } } else if(t==PT_PLUT&&cmode == 3) { + int tempx; + int tempy; cr = 0x40; cg = 0x70; cb = 0x20; @@ -2948,8 +2988,8 @@ justdraw: blendpixel(vid, nx-1, ny, cr, cg, cb, 96); blendpixel(vid, nx, ny+1, cr, cg, cb, 96); blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { + for(tempx = 2; tempx < 10; tempx++) { + for(tempy = 2; tempy < 10; tempy++) { blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); @@ -2958,6 +2998,8 @@ justdraw: } } else if(t==PT_URAN&&cmode == 3) { + int tempx; + int tempy; cr = 0x70; cg = 0x70; cb = 0x20; @@ -2966,8 +3008,8 @@ justdraw: blendpixel(vid, nx-1, ny, cr, cg, cb, 96); blendpixel(vid, nx, ny+1, cr, cg, cb, 96); blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(int tempx = 2; tempx < 10; tempx++) { - for(int tempy = 2; tempy < 10; tempy++) { + for(tempx = 2; tempx < 10; tempx++) { + for(tempy = 2; tempy < 10; tempy++) { blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); @@ -5292,7 +5334,11 @@ void del_stamp(int d) #include "font.h" +#ifdef WIN32 +_inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#else inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#endif { pixel t; if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) @@ -5307,7 +5353,11 @@ inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); } +#ifdef WIN32 +_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +#else inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +#endif { int i, j, w, bn = 0, ba = 0; char *rp = font_data + font_ptrs[c]; diff --git a/version.h b/version.h index 4bb0d65..c306999 100755 --- a/version.h +++ b/version.h @@ -20,8 +20,8 @@ #ifndef VERSION_H #define VERSION_H -#define SAVE_VERSION 40 -#define MINOR_VERSION 3 +#define SAVE_VERSION 41 +#define MINOR_VERSION 0 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. #define MENUV3 -- cgit v0.9.2-21-gd62e From 5f46d7e63ec9d2a70f8b493a967ce4dbb01ab071 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Tue, 17 Aug 2010 14:55:38 +0200 Subject: fixed acid diff --git a/powder.c b/powder.c index 113e303..8d63375 100755 --- a/powder.c +++ b/powder.c @@ -1025,7 +1025,7 @@ inline int create_part(int p, int x, int y, int t) { parts[i].pavg[1] = pv[y/CELL][x/CELL]; } - else if(t!=PT_STKM) + if(t!=PT_STKM) { parts[i].x = (float)x; parts[i].y = (float)y; @@ -1036,7 +1036,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].ctype = 0; parts[i].temp = ptypes[t].heat; } - else if(t==PT_ACID) + if(t==PT_ACID) { parts[i].life = 75; } -- cgit v0.9.2-21-gd62e From 8b9ab03c142372ab1d8204389ee7210bc8600faf Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Tue, 17 Aug 2010 14:59:03 +0200 Subject: glass now works diff --git a/powder.c b/powder.c index 3193368..af0007a 100755 --- a/powder.c +++ b/powder.c @@ -1052,11 +1052,11 @@ inline int create_part(int p, int x, int y, int t) { parts[i].life = 75; } - //Testing - /*if(t==PT_WOOD){ + /*Testing + if(t==PT_WOOD){ parts[i].life = 150; - }*/ - //End Testing + } + End Testing*/ if(t==PT_FIRE) parts[i].life = rand()%50+120; if(t==PT_PLSM) -- cgit v0.9.2-21-gd62e From 52d64e6132d8bb44a03c43977f111111123c8ba4 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Tue, 17 Aug 2010 15:03:29 +0200 Subject: astyle diff --git a/powder.c b/powder.c old mode 100755 new mode 100644 index af0007a..340cf17 --- a/powder.c +++ b/powder.c @@ -1176,7 +1176,7 @@ inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) //Signum function #ifdef WIN32 -_inline int sign(float i) +_inline int sign(float i) #else inline int sign(float i) #endif @@ -2300,368 +2300,368 @@ killed: } if(t==PT_STKM) - { - //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) - parts[i].temp += 1; - - //Death - if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... - { - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - //Verlet integration - pp = 2*player[3]-player[5]; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+1; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+1; - player[18] = player[16]; - player[16] = pp; - - //Go left - if (((int)(player[0])&0x01) == 0x01) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] += 3; - player[10] += 2; - player[5] += 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 3; - player[18] += 2; - player[13] +=2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[9] += 1; - player[10] += 1; - player[5] += 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 1; - player[18] += 1; - player[13] +=1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 3; - player[10] += 2; - player[5] -= 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 3; - player[18] += 2; - player[13] -= 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 1; - player[10] += 1; - player[5] -= 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 1; - player[18] += 1; - player[13] -= 1; - } - - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)) - { - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - create_part(-1, nx, ny, player[2]); - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) - { - int random = abs(rand()%3-1)*3; - if (random==0) - { - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; - } - else - { - parts[r>>8].vy = 0; - parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; - } - } - - } - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[10] += 1; - player[18] += 1; - } - - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; - player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; - player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; - player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; - player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; - parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; - player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; - parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; - player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) - player[15] -= nx; - - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= 10+ny; - parts[i].vy = -10; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[7] += 0.2; - player[15] -= 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[3] += 0.2; - player[11] -= 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[16] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[8] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; + player[10] += 2; + player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; + player[18] += 2; + player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; + player[10] += 1; + player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; + player[18] += 1; + player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; + player[10] += 2; + player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; + player[18] += 2; + player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; + player[10] += 1; + player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; + player[18] += 1; + player[13] -= 1; + } + + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) + || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) + { + int random = abs(rand()%3-1)*3; + if (random==0) + { + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + } + else + { + parts[r>>8].vy = 0; + parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; + } + } + + } + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[10] += 1; + player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } if(t==PT_CLNE) { @@ -2892,9 +2892,9 @@ justdraw: if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,224,224,170,255); else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,224,224,170,20); - else - blendpixel(vid,x+nx,y+ny,224,224,170,40); + blendpixel(vid,x+nx,y+ny,224,224,170,20); + else + blendpixel(vid,x+nx,y+ny,224,224,170,40); } } @@ -2978,8 +2978,8 @@ justdraw: } } else if(t==PT_PLUT&&cmode == 3) { - int tempx; - int tempy; + int tempx; + int tempy; cr = 0x40; cg = 0x70; cb = 0x20; @@ -2998,8 +2998,8 @@ justdraw: } } else if(t==PT_URAN&&cmode == 3) { - int tempx; - int tempy; + int tempx; + int tempy; cr = 0x70; cg = 0x70; cb = 0x20; @@ -3183,9 +3183,9 @@ justdraw: if ((abs(x) == 0) && (abs(y) == 0)) blendpixel(vid,x+nx,y+ny,235,73,23,100); else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,235,73,23,30); - else - blendpixel(vid,x+nx,y+ny,235,73,23,50); + blendpixel(vid,x+nx,y+ny,235,73,23,30); + else + blendpixel(vid,x+nx,y+ny,235,73,23,50); } } @@ -3197,11 +3197,11 @@ justdraw: for(y=-1; y<=1; y++) { if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,255,255,0,180); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,255,255,0,50); - else - blendpixel(vid,x+nx,y+ny,255,255,0,80); + blendpixel(vid,x+nx,y+ny,255,255,0,180); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,255,255,0,50); + else + blendpixel(vid,x+nx,y+ny,255,255,0,80); } } -- cgit v0.9.2-21-gd62e From 04d6a8051bd2daf6b3dff370d0802b6118ab3979 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 15 Aug 2010 08:43:31 +0100 Subject: Move fancy effects to a new colour mode diff --git a/.powder.c.swo b/.powder.c.swo deleted file mode 100644 index 79cdebe..0000000 Binary files a/.powder.c.swo and /dev/null differ diff --git a/powder.c b/powder.c index 340cf17..7fe78be 100644 --- a/powder.c +++ b/powder.c @@ -507,6 +507,8 @@ struct menu_section msections[] = {"\xCC", "Special", 0}, }; +#define CM_COUNT 7 +#define CM_FANCY 6 #define CM_HEAT 5 #define CM_BLOB 4 #define CM_FIRE 3 @@ -2883,7 +2885,7 @@ justdraw: isplayer = 1; //It's a secret. Tssss... } - if(t==PT_MWAX&&cmode == 3) + if(t==PT_MWAX&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -2908,16 +2910,20 @@ justdraw: cr = PIXR(ptypes[t].pcolors)/s; cg = PIXG(ptypes[t].pcolors)/s; cb = PIXB(ptypes[t].pcolors)/s; - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); - } - } + if(cmode==6){ + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); + } + } + } else { + blendpixel(vid, x, y, cr, cg, cb, 255); + } if(cmode==4) { @@ -2932,7 +2938,7 @@ justdraw: blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); } } - else if(t==PT_OILL&&cmode == 3) + else if(t==PT_OILL&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -2947,7 +2953,7 @@ justdraw: } else if(t==PT_NEUT) { - if(cmode == 3||cmode==4) + if(cmode == 3||cmode==4 || cmode==6) { vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; cg = 8; @@ -2976,7 +2982,7 @@ justdraw: blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } else if(t==PT_PLUT&&cmode == 3) + } else if(t==PT_PLUT&&cmode == 6) { int tempx; int tempy; @@ -2996,7 +3002,7 @@ justdraw: blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); } } - } else if(t==PT_URAN&&cmode == 3) + } else if(t==PT_URAN&&cmode == 6) { int tempx; int tempy; @@ -3016,7 +3022,7 @@ justdraw: blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); } } - } else if(t==PT_SLTW&&cmode == 3) + } else if(t==PT_SLTW&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -3031,7 +3037,7 @@ justdraw: } else if(t==PT_PHOT) { - if(cmode == 3||cmode==4) + if(cmode == 3||cmode==4 || cmode==6) { vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; cg = 12; @@ -3071,7 +3077,7 @@ justdraw: y = ny; blendpixel(vid,x,y,17,217,24,255); } - else if(t==PT_LNTG&&cmode == 3) + else if(t==PT_LNTG&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -3086,7 +3092,7 @@ justdraw: } else if(t==PT_SMKE) { - if(cmode == 3||cmode==4) + if(cmode == 3||cmode==4 || cmode==6) { x = nx/CELL; y = ny/CELL; @@ -3119,7 +3125,7 @@ justdraw: } } } - else if(t==PT_WATR&&cmode == 3) + else if(t==PT_WATR&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -3132,7 +3138,7 @@ justdraw: } } - } else if(t==PT_DSTW&&cmode == 3) + } else if(t==PT_DSTW&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -3145,7 +3151,7 @@ justdraw: } } } - else if(t==PT_NITR&&cmode == 3) + else if(t==PT_NITR&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -3159,7 +3165,7 @@ justdraw: } } - else if(t==PT_LRBD&&cmode == 3) + else if(t==PT_LRBD&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -3174,7 +3180,7 @@ justdraw: } - else if(t==PT_NBLE&&cmode == 3) + else if(t==PT_NBLE&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -3190,7 +3196,7 @@ justdraw: } } - else if(t==PT_GASS&&cmode == 3) + else if(t==PT_GASS&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -3208,7 +3214,7 @@ justdraw: } else if(t==PT_WTRV) { - if(cmode == 3||cmode==4) + if(cmode == 3||cmode==4 || cmode==6) { x = nx/CELL; y = ny/CELL; @@ -3243,7 +3249,7 @@ justdraw: } else if(t==PT_THDR) { - if(cmode == 3||cmode==4) + if(cmode == 3||cmode==4 || cmode==6) { vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; cg = 16; @@ -3279,7 +3285,7 @@ justdraw: } else if(t==PT_LCRY) { - if(cmode == 3||cmode==4) + if(cmode == 3||cmode==4 || cmode==6) { //cr = R/8; //cg = G/8; @@ -3313,7 +3319,7 @@ justdraw: uint8 R = plasma_data[caddress]; uint8 G = plasma_data[caddress+1]; uint8 B = plasma_data[caddress+2]; - if(cmode == 3||cmode==4) + if(cmode == 3||cmode==4 || cmode==6) { cr = R/8; cg = G/8; @@ -3348,7 +3354,7 @@ justdraw: } else if(t==PT_FIRE && parts[i].life) { - if(cmode == 3||cmode==4) + if(cmode == 3||cmode==4 || cmode==6) { cr = parts[i].life / 4; cg = parts[i].life / 16; @@ -3400,7 +3406,7 @@ justdraw: blendpixel(vid, nx-1, ny, cr, cg, cb, 64); blendpixel(vid, nx, ny+1, cr, cg, cb, 64); blendpixel(vid, nx, ny-1, cr, cg, cb, 64); - if(cmode == 3||cmode==4) + if(cmode == 3||cmode==4 || cmode==6) { cr /= 32; cg /= 32; @@ -3421,7 +3427,7 @@ justdraw: else if(t==PT_LAVA || t==PT_SPRK) { vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - if(cmode == 3 || cmode==4) + if(cmode == 3 || cmode==4 || cmode==6) { if(t == PT_LAVA) { @@ -5089,7 +5095,7 @@ struct stamp_info { char name[11]; pixel *thumb; - int thumb_w, thumb_h, delete; + int thumb_w, thumb_h, dodelete; } stamps[STAMP_MAX];//[STAMP_X*STAMP_Y]; int stamp_count = 0; @@ -5148,7 +5154,7 @@ void stamp_update(void) { if(!stamps[i].name[0]) break; - if(stamps[i].delete!=1) + if(stamps[i].dodelete!=1) { fwrite(stamps[i].name, 1, 10, f); } @@ -5323,7 +5329,7 @@ void stamp_init(void) void del_stamp(int d) { - stamps[d].delete = 1; + stamps[d].dodelete = 1; stamp_update(); stamp_count = 0; stamp_init(); @@ -6919,6 +6925,9 @@ void draw_svf_ui(pixel *vid_buf) drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); break; + case 6: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255); + break; } drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); @@ -9363,7 +9372,7 @@ void load_presets(void) sdl_scale = (tmp == 2) ? 2 : 1; if(fread(&tmp, 1, 1, f) != 1) goto fail; - cmode = tmp%6; + cmode = tmp%7; if(fread(&tmp, 1, 1, f) != 1) goto fail; svf_admin = tmp; @@ -9589,6 +9598,13 @@ void set_cmode(int cm) { strcpy(itc_msg, "Heat Display"); } + else if(cmode==6) + { + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + strcpy(itc_msg, "Fancy Display"); + } else if(cmode==3) { memset(fire_r, 0, sizeof(fire_r)); @@ -9926,7 +9942,7 @@ int main(int argc, char *argv[]) } fire_fc = (fire_fc+1) % 3; } - if(cmode==3||cmode==4) + if(cmode==3||cmode==4||cmode==6) render_fire(vid_buf); render_signs(vid_buf); @@ -10027,6 +10043,10 @@ int main(int argc, char *argv[]) { set_cmode(5); } + if(sdl_key=='7') + { + set_cmode(6); + } if(sdl_key==SDLK_SPACE) sys_pause = !sys_pause; if(sdl_key=='h') @@ -10062,7 +10082,7 @@ int main(int argc, char *argv[]) } else if(sdl_key=='c') { - set_cmode((cmode+1) % 6); + set_cmode((cmode+1) % 7); if(it > 50) it = 50; } @@ -10508,9 +10528,9 @@ int main(int argc, char *argv[]) if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 6); + set_cmode((cmode+1) % 7); if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+5) % 6); + set_cmode((cmode+6) % 7); save_presets(0); } if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) @@ -10601,7 +10621,6 @@ int main(int argc, char *argv[]) //Something } } - //create_parts(x, y, bs, SPC_AIR); lx = x; ly = y; lb = 0; @@ -10609,7 +10628,7 @@ int main(int argc, char *argv[]) } else { - //Copy state before drawing any particles (for undo) + //Copy state before drawing any particles (for undo)7 int cbx, cby, cbi; for(cbi=0; cbi12?64:it*5); drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); } @@ -10777,9 +10794,6 @@ int main(int argc, char *argv[]) #endif drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); } - /*#ifdef MT - pthread_join(pth2,NULL); - #endif*/ if(hud_enable) { -- cgit v0.9.2-21-gd62e From 08f98b5f6ace23e8ab2110b04fa4297806c15d76 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 18 Aug 2010 18:55:50 +0100 Subject: Version 41.3, bug fixes for Insl and Swch diff --git a/powder.c b/powder.c old mode 100644 new mode 100755 index 7fe78be..e78b7e1 --- a/powder.c +++ b/powder.c @@ -2086,7 +2086,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -2102,14 +2102,38 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + }else if(t==PT_SWCH) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8)!=PT_INSL) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } } - if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)) || t ==PT_SWCH) + if(t==PT_SWCH) + if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) + { + parts[i].life--; + } + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) { - if(t==PT_SWCH) - if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) - { - parts[i].life--; - } for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && @@ -2121,8 +2145,8 @@ void update_particles_i(pixel *vid, int start, int inc) if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) continue; rt = parts[r>>8].type; - if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT)) && + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH)) && ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { parts[r>>8].type = PT_FIRE; @@ -2191,20 +2215,6 @@ void update_particles_i(pixel *vid, int start, int inc) } } pavg = parts_avg(i, r>>8); - if(t==PT_SWCH&&pavg!= PT_INSL) - { - if(parts[r>>8].type == PT_SWCH) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } if(rt==PT_SWCH && t==PT_SPRK) { pavg = parts_avg(r>>8, i); diff --git a/version.h b/version.h index c306999..83066d0 100755 --- a/version.h +++ b/version.h @@ -21,7 +21,7 @@ #define VERSION_H #define SAVE_VERSION 41 -#define MINOR_VERSION 0 +#define MINOR_VERSION 3 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. #define MENUV3 -- cgit v0.9.2-21-gd62e From 580a76a79f55876961b2bc12908288c915580963 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 19 Aug 2010 10:50:05 +0100 Subject: Fix typing error that broke autoupdate diff --git a/powder.c b/powder.c index e78b7e1..8e73c0f 100755 --- a/powder.c +++ b/powder.c @@ -9645,7 +9645,7 @@ char my_uri[] = "http://" SERVER "/Update.api?Action=Download&Architecture=" #else "Unknown" #endif - "&InstrctionSet=" + "&InstructionSet=" #if defined X86_SSE3 "SSE3" #elif defined X86_SSE2 -- cgit v0.9.2-21-gd62e From 392bf0c8947a583ed2e7c57528652985bc70a5dc Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 19 Aug 2010 12:28:26 -0400 Subject: changed PT_METL to PT_STNE and PT_WIRE to PT_METL so it makes sense diff --git a/powder.c b/powder.c index 8e73c0f..acbef39 100755 --- a/powder.c +++ b/powder.c @@ -545,7 +545,7 @@ struct menu_section msections[] = #define PT_WATR 2 #define PT_OILL 3 #define PT_FIRE 4 -#define PT_METL 5 +#define PT_STNE 5 #define PT_LAVA 6 #define PT_GUNP 7 #define PT_NITR 8 @@ -554,7 +554,7 @@ struct menu_section msections[] = #define PT_PLEX 11 #define PT_DFRM 12 #define PT_ICEI 13 -#define PT_WIRE 14 +#define PT_METL 14 #define PT_SPRK 15 #define PT_SNOW 16 #define PT_WOOD 17 @@ -686,7 +686,7 @@ const struct part_state pstates[] = /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GASS, 50.0f, PT_NONE, 0.0f}, /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2500.0f}, /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 710.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LAVA */ {ST_LIQUID, PT_METL, 700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LAVA */ {ST_LIQUID, PT_STNE, 700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -1002,7 +1002,7 @@ inline int create_part(int p, int x, int y, int t) if(t==PT_SPRK) { - if((pmap[y][x]&0xFF)!=PT_WIRE && + if((pmap[y][x]&0xFF)!=PT_METL && (pmap[y][x]&0xFF)!=PT_PSCN && (pmap[y][x]&0xFF)!=PT_NSCN && (pmap[y][x]&0xFF)!=PT_HSCN && @@ -1386,7 +1386,7 @@ void update_particles_i(pixel *vid, int start, int inc) { if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) parts[i].life--; - if(parts[i].life<=0 && t!=PT_WIRE && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_HSCN && t!=PT_CSCN && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY) + if(parts[i].life<=0 && t!=PT_METL && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_HSCN && t!=PT_CSCN && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY) { kill_part(i); continue; @@ -1394,10 +1394,10 @@ void update_particles_i(pixel *vid, int start, int inc) if(parts[i].life<=0 && t==PT_SPRK) { t = parts[i].ctype; - if(t!=PT_WIRE&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM&&t!=PT_BTRY&&t!=PT_NBLE) + if(t!=PT_METL&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM&&t!=PT_BTRY&&t!=PT_NBLE) parts[i].temp = R_TEMP; if(!t) - t = PT_WIRE; + t = PT_METL; parts[i].type = t; parts[i].life = 4; if(t == PT_WATR) @@ -1424,7 +1424,7 @@ void update_particles_i(pixel *vid, int start, int inc) (bmap[y/CELL][x/CELL]==2) || (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) { kill_part(i); @@ -1720,7 +1720,7 @@ void update_particles_i(pixel *vid, int start, int inc) pt = parts[i].temp -= 2.5f; } - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) { nx = x % CELL; if(nx == 0) @@ -1738,7 +1738,7 @@ void update_particles_i(pixel *vid, int start, int inc) ny = y/CELL; if(nx>=0 && ny>=0 && nx>8)>=NPART || !r) continue; - if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ) + if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ) { t = parts[i].type = PT_NONE; parts[r>>8].ctype = parts[r>>8].type; @@ -1828,7 +1828,7 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL) { parts[i].temp = 200.0f; } @@ -2094,7 +2094,7 @@ void update_particles_i(pixel *vid, int start, int inc) rt = parts[r>>8].type; if(parts_avg(i,r>>8) != PT_INSL) { - if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) + if((rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) { parts[r>>8].life = 4; parts[r>>8].ctype = rt; @@ -2146,7 +2146,7 @@ void update_particles_i(pixel *vid, int start, int inc) continue; rt = parts[r>>8].type; if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH)) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH)) && ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { parts[r>>8].type = PT_FIRE; @@ -2160,7 +2160,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(lpv < 1) lpv = 1; if(legacy_enable) { - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && ptypes[rt].meltable*lpv>(rand()%1000)) { if(t!=PT_LAVA || parts[i].life>0) @@ -2173,7 +2173,7 @@ void update_particles_i(pixel *vid, int start, int inc) else { parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; parts[i].ctype = PT_NONE;//rt; goto killed; } @@ -2191,7 +2191,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_LAVA) { parts[i].life = 0; - t = parts[i].type = PT_METL; + t = parts[i].type = PT_STNE; goto killed; } } @@ -2208,7 +2208,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_LAVA) { parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; parts[i].ctype = PT_NONE; goto killed; } @@ -2232,7 +2232,7 @@ void update_particles_i(pixel *vid, int start, int inc) pavg = parts_avg(i, r>>8); if(pavg != PT_INSL) { - if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) @@ -2280,7 +2280,7 @@ void update_particles_i(pixel *vid, int start, int inc) } if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) { - if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) + if(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) { t = parts[i].type = PT_ETRD; parts[i].ctype = PT_NONE; -- cgit v0.9.2-21-gd62e From e2744b1d4d091618abffbc393f88634b31a1234e Mon Sep 17 00:00:00 2001 From: Ant Date: Fri, 20 Aug 2010 02:04:07 +0100 Subject: Added PLAStic, removed the relationship between OIL and GAS, Plastic is created from pressurised OIL and melts back into OIL. May need values tweeking on lines 1493, 1576 and 1579 diff --git a/powder.c b/powder.c index acbef39..d5dc2c1 100755 --- a/powder.c +++ b/powder.c @@ -598,7 +598,8 @@ struct menu_section msections[] = #define PT_STKM 55 #define PT_SWCH 56 #define PT_SMKE 57 -#define PT_NUM 58 +#define PT_PLAS 58 +#define PT_NUM 59 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -616,7 +617,7 @@ const struct part_type ptypes[] = {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Very light dust. Flammable."}, {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Flammable."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Flammable. Solidifies under pressure"}, {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f, 88, "Ignites flammable materials. Heats air."}, {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Heavy particles. Meltable."}, {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, @@ -671,6 +672,7 @@ const struct part_type ptypes[] = {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, + {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, }; #define ST_NONE 0 @@ -683,14 +685,14 @@ const struct part_state pstates[] = /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WATR */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, - /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GASS, 50.0f, PT_NONE, 0.0f}, + /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2500.0f}, /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 710.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* LAVA */ {ST_LIQUID, PT_STNE, 700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_OILL, -40.0f, PT_NONE, 50.0f, PT_FIRE, 300.0f}, + /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 300.0f}, /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -738,6 +740,7 @@ const struct part_state pstates[] = /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OILL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static const unsigned char can_move[PT_NUM][PT_NUM] = { @@ -745,68 +748,69 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ - /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S*/ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M*/ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K*/ - /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y M H E*/ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1}, - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1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0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - /* NBLE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* BTRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* LCRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* STKM */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0}, + /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S P*/ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M l*/ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K a*/ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y M H E s*/ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0}, + /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, + /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0}, + /* METL */ {0,1,1,1,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, + /* LAVA */ {0,1,1,1,1,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0}, + /* GUNP */ {0,0,1,1,0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,0,0,0,0,0,0,0,0}, + /* STKM */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0}, + /* PLAS */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} }; #define FLAG_STAGNANT 1 @@ -943,7 +947,7 @@ void kill_part(int i) pfree = i; } -#ifdef WIN32 +#ifdef WIN32/ _inline int create_part(int p, int x, int y, int t) #else inline int create_part(int p, int x, int y, int t) @@ -1094,7 +1098,7 @@ inline int create_part(int p, int x, int y, int t) //} else { // parts[i].life = 0; // parts[i].type = PT_NONE; - //} + //}/ } if(t!=PT_STKM) @@ -1484,8 +1488,19 @@ void update_particles_i(pixel *vid, int start, int inc) } else { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + if(t==PT_PLAS && !parts[i].life) + { + if(pv[y/CELL][x/CELL]>75.0f) + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + } + } + else + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } } if(ptypes[t].diffusion) @@ -1558,7 +1573,11 @@ void update_particles_i(pixel *vid, int start, int inc) t = parts[i].type = PT_OILL; if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) t = parts[i].type = PT_GASS; + if(t==PT_OILL && pv[y/CELL][x/CELL]>15.0f) + t = parts[i].type = PT_PLAS; } + if(t==PT_OILL && pv[y/CELL][x/CELL]>40.0f) + t = parts[i].type = PT_PLAS; if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) @@ -2025,6 +2044,8 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_GASS; if((r&0xFF)==PT_PLNT && 5>(rand()%100)) parts[r>>8].type = PT_WOOD; + if((r&0xFF)==PT_PLAS && 5>(rand()%1000)) + parts[r>>8].type = PT_OILL; } } else if(t==PT_PHOT) -- cgit v0.9.2-21-gd62e From 68e09b72bb9cacf4ec12ee38c660314659a5dadd Mon Sep 17 00:00:00 2001 From: FacialTurd Date: Fri, 20 Aug 2010 05:25:27 -0700 Subject: Stickman bottom edge fix (savask) diff --git a/powder.c b/powder.c old mode 100755 new mode 100644 index acbef39..0191eab --- a/powder.c +++ b/powder.c @@ -1111,8 +1111,10 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 100; parts[i].ctype = 0; parts[i].temp = ptypes[t].heat; - player[2] = PT_DUST; - player[3] = x-1; //Setting legs positions + + + + player[3] = x-1; //Setting legs positions player[4] = y+6; player[5] = x-1; player[6] = y+6; @@ -2311,369 +2313,376 @@ killed: continue; } - if(t==PT_STKM) - { - //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) - parts[i].temp += 1; - - //Death - if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... - { - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - //Verlet integration - pp = 2*player[3]-player[5]; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+1; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+1; - player[18] = player[16]; - player[16] = pp; - - //Go left - if (((int)(player[0])&0x01) == 0x01) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] += 3; - player[10] += 2; - player[5] += 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 3; - player[18] += 2; - player[13] +=2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[9] += 1; - player[10] += 1; - player[5] += 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 1; - player[18] += 1; - player[13] +=1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 3; - player[10] += 2; - player[5] -= 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 3; - player[18] += 2; - player[13] -= 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 1; - player[10] += 1; - player[5] -= 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 1; - player[18] += 1; - player[13] -= 1; - } - - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)) - { - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - create_part(-1, nx, ny, player[2]); - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) - { - int random = abs(rand()%3-1)*3; - if (random==0) - { - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; - } - else - { - parts[r>>8].vy = 0; - parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; - } - } - - } - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[10] += 1; - player[18] += 1; - } - - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; - player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; - player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; - player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; - player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; - parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; - player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; - parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; - player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) - player[15] -= nx; - - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= 10+ny; - parts[i].vy = -10; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[7] += 0.2; - player[15] -= 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[3] += 0.2; - player[11] -= 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[16] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[8] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } + if(t==PT_STKM) + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; + player[10] += 2; + player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; + player[18] += 2; + player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; + player[10] += 1; + player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; + player[18] += 1; + player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; + player[10] += 2; + player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; + player[18] += 2; + player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; + player[10] += 1; + player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; + player[18] += 1; + player[13] -= 1; + } + + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if(((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID || ptypes[pmap[ny+y][nx+x]&0xFF].falldown > 0) && + (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) + || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) + { + int random = abs(rand()%3-1)*3; + if (random==0) + { + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + } + else + { + parts[r>>8].vy = -(player[1] == 0)*random; + parts[r>>8].vx = (player[1]!=0)*(((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; + } + } + + } + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[10] += 1; + player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + if ((int)(ny+player[8])>=YRES) + continue; + + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + if ((int)(ny+player[16])>=YRES) + continue; + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } if(t==PT_CLNE) { @@ -10845,7 +10854,13 @@ int main(int argc, char *argv[]) fillrect(vid_buf, 12, 12, textwidth(uitext)+8, 15, 0, 0, 0, 140); drawtext(vid_buf, 16, 16, uitext, 32, 216, 255, 200); } - sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE); + sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE); + + //Setting an element for the stick man + if(ptypes[sr].falldown>0) + player[2] = sr; + else + player[2] = PT_DUST; } http_done(); -- cgit v0.9.2-21-gd62e From dbba90eb018286e1edc870b67437d4973b680a96 Mon Sep 17 00:00:00 2001 From: Ant Date: Fri, 20 Aug 2010 16:56:52 +0100 Subject: Tweaked values of plasic and removed GAS-> OIL assosiations I missed, Reason for removeal is PLAS melts at 250, OIL vaporised at a much lower temp meaning PLAS would "melt" into GAS. diff --git a/powder.c b/powder.c index d5dc2c1..ab30878 100755 --- a/powder.c +++ b/powder.c @@ -672,7 +672,7 @@ const struct part_type ptypes[] = {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, - {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, + {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, }; #define ST_NONE 0 @@ -740,7 +740,7 @@ const struct part_state pstates[] = /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OILL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OILL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static const unsigned char can_move[PT_NUM][PT_NUM] = { @@ -1488,13 +1488,10 @@ void update_particles_i(pixel *vid, int start, int inc) } else { - if(t==PT_PLAS && !parts[i].life) + if(t==PT_PLAS && pv[y/CELL][x/CELL]>25.0f) { - if(pv[y/CELL][x/CELL]>75.0f) - { parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - } } else { @@ -1569,14 +1566,10 @@ void update_particles_i(pixel *vid, int start, int inc) { if(t==PT_WTRV && pv[y/CELL][x/CELL]>4.0f) t = parts[i].type = PT_DSTW; - if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) - t = parts[i].type = PT_OILL; - if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) - t = parts[i].type = PT_GASS; - if(t==PT_OILL && pv[y/CELL][x/CELL]>15.0f) + if(t==PT_OILL && pv[y/CELL][x/CELL]>8.0f) t = parts[i].type = PT_PLAS; } - if(t==PT_OILL && pv[y/CELL][x/CELL]>40.0f) + if(t==PT_OILL && pv[y/CELL][x/CELL]>20.0f) t = parts[i].type = PT_PLAS; if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; -- cgit v0.9.2-21-gd62e From 873dfea74daed5ab3ae8dd0ee99aa1c770a885ab Mon Sep 17 00:00:00 2001 From: Ant Date: Fri, 20 Aug 2010 20:33:41 +0100 Subject: Added Diesel [DESL] to replace OILs relationship with GAS. diff --git a/powder.c b/powder.c index ab30878..cf93345 100755 --- a/powder.c +++ b/powder.c @@ -599,7 +599,8 @@ struct menu_section msections[] = #define PT_SWCH 56 #define PT_SMKE 57 #define PT_PLAS 58 -#define PT_NUM 59 +#define PT_DESL 59 +#define PT_NUM 60 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -672,7 +673,8 @@ const struct part_type ptypes[] = {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, - {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, + {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, + {"DESL", PIXPACK(0x440000), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, }; #define ST_NONE 0 @@ -741,6 +743,7 @@ const struct part_state pstates[] = /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OILL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 62.0f}, }; static const unsigned char can_move[PT_NUM][PT_NUM] = { @@ -748,69 +751,75 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ - /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S P*/ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M l*/ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K a*/ - /* e t r l e l a p r e s x m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0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0}, - /* PLAS */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} + /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S P D*/ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M l e*/ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K a s*/ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y M H E s l*/ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0}, + /* WATR */ {0,0,0,1,1,0,0,0,1,0,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 {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}, + /* PLAS */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* DESL */ {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S P D*/ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M l e*/ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K a s*/ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y M H E s l*/ + }; #define FLAG_STAGNANT 1 @@ -1568,9 +1577,21 @@ void update_particles_i(pixel *vid, int start, int inc) t = parts[i].type = PT_DSTW; if(t==PT_OILL && pv[y/CELL][x/CELL]>8.0f) t = parts[i].type = PT_PLAS; + if(t==PT_DESL && pv[y/CELL][x/CELL]<-6.0f) + t = parts[i].type = PT_GASS; + if(t==PT_GASS && pv[y/CELL][x/CELL]>6.0f) + t = parts[i].type = PT_DESL; + if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) + t = parts[i].type = PT_FIRE; } if(t==PT_OILL && pv[y/CELL][x/CELL]>20.0f) t = parts[i].type = PT_PLAS; + if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f) + t = parts[i].type = PT_GASS; + if(t==PT_DESL && pv[y/CELL][x/CELL]>60.0f) // Only way I know to make it + t = parts[i].type = PT_FIRE; // combust under pressure. + if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f) + t = parts[i].type = PT_DESL; if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) @@ -2032,13 +2053,15 @@ void update_particles_i(pixel *vid, int start, int inc) if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) parts[r>>8].type = PT_DFRM; if((r&0xFF)==PT_NITR && 15>(rand()%1000)) - parts[r>>8].type = PT_OILL; + parts[r>>8].type = PT_DESL; if((r&0xFF)==PT_OILL && 5>(rand()%1000)) - parts[r>>8].type = PT_GASS; + parts[r>>8].type = PT_PLAS; if((r&0xFF)==PT_PLNT && 5>(rand()%100)) parts[r>>8].type = PT_WOOD; if((r&0xFF)==PT_PLAS && 5>(rand()%1000)) parts[r>>8].type = PT_OILL; + if((r&0xFF)==PT_DESL && 15>(rand()%1000)) + parts[r>>8].type = PT_GASS; } } else if(t==PT_PHOT) diff --git a/version.h b/version.h index 83066d0..6e08742 100755 --- a/version.h +++ b/version.h @@ -22,7 +22,7 @@ #define SAVE_VERSION 41 #define MINOR_VERSION 3 -#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. +#define IDENT_VERSION "A" //Change this if you're not Simon! It should be a single letter. #define MENUV3 #define BETA -- cgit v0.9.2-21-gd62e From ce36e304bbc87daaeddac0c2157e5234f392e6b8 Mon Sep 17 00:00:00 2001 From: Ant Date: Fri, 20 Aug 2010 20:50:53 +0100 Subject: Added Diesel [DESL] to replace OILs relationship with GAS. Recommit to undo merge with FacialTurd's diff --git a/powder.c b/powder.c index cf93345..4890613 100755 --- a/powder.c +++ b/powder.c @@ -1588,7 +1588,7 @@ void update_particles_i(pixel *vid, int start, int inc) t = parts[i].type = PT_PLAS; if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f) t = parts[i].type = PT_GASS; - if(t==PT_DESL && pv[y/CELL][x/CELL]>60.0f) // Only way I know to make it + if(t==PT_DESL && pv[y/CELL][x/CELL]>50.0f) // Only way I know to make it t = parts[i].type = PT_FIRE; // combust under pressure. if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f) t = parts[i].type = PT_DESL; -- cgit v0.9.2-21-gd62e From 8768223f4681f0450701df3792a0a3e98b16e1a9 Mon Sep 17 00:00:00 2001 From: FacialTurd Date: Fri, 20 Aug 2010 20:25:27 +0800 Subject: Stickman bottom edge fix (savask) diff --git a/powder.c b/powder.c old mode 100755 new mode 100644 index ab30878..570f68e --- a/powder.c +++ b/powder.c @@ -1115,8 +1115,10 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 100; parts[i].ctype = 0; parts[i].temp = ptypes[t].heat; - player[2] = PT_DUST; - player[3] = x-1; //Setting legs positions + + + + player[3] = x-1; //Setting legs positions player[4] = y+6; player[5] = x-1; player[6] = y+6; @@ -2325,369 +2327,376 @@ killed: continue; } - if(t==PT_STKM) - { - //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) - parts[i].temp += 1; - - //Death - if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... - { - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - //Verlet integration - pp = 2*player[3]-player[5]; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+1; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+1; - player[18] = player[16]; - player[16] = pp; - - //Go left - if (((int)(player[0])&0x01) == 0x01) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] += 3; - player[10] += 2; - player[5] += 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 3; - player[18] += 2; - player[13] +=2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[9] += 1; - player[10] += 1; - player[5] += 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 1; - player[18] += 1; - player[13] +=1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 3; - player[10] += 2; - player[5] -= 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 3; - player[18] += 2; - player[13] -= 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 1; - player[10] += 1; - player[5] -= 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 1; - player[18] += 1; - player[13] -= 1; - } - - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)) - { - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - create_part(-1, nx, ny, player[2]); - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) - { - int random = abs(rand()%3-1)*3; - if (random==0) - { - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; - } - else - { - parts[r>>8].vy = 0; - parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; - } - } - - } - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[10] += 1; - player[18] += 1; - } - - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; - player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; - player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; - player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; - player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; - parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; - player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; - parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; - player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) - player[15] -= nx; - - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= 10+ny; - parts[i].vy = -10; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[7] += 0.2; - player[15] -= 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[3] += 0.2; - player[11] -= 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[16] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[8] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } + if(t==PT_STKM) + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; + player[10] += 2; + player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; + player[18] += 2; + player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; + player[10] += 1; + player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; + player[18] += 1; + player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; + player[10] += 2; + player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; + player[18] += 2; + player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; + player[10] += 1; + player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; + player[18] += 1; + player[13] -= 1; + } + + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if(((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID || ptypes[pmap[ny+y][nx+x]&0xFF].falldown > 0) && + (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) + || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) + { + int random = abs(rand()%3-1)*3; + if (random==0) + { + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + } + else + { + parts[r>>8].vy = -(player[1] == 0)*random; + parts[r>>8].vx = (player[1]!=0)*(((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; + } + } + + } + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[10] += 1; + player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + if ((int)(ny+player[8])>=YRES) + continue; + + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + if ((int)(ny+player[16])>=YRES) + continue; + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } if(t==PT_CLNE) { @@ -10859,7 +10868,13 @@ int main(int argc, char *argv[]) fillrect(vid_buf, 12, 12, textwidth(uitext)+8, 15, 0, 0, 0, 140); drawtext(vid_buf, 16, 16, uitext, 32, 216, 255, 200); } - sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE); + sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE); + + //Setting an element for the stick man + if(ptypes[sr].falldown>0) + player[2] = sr; + else + player[2] = PT_DUST; } http_done(); -- cgit v0.9.2-21-gd62e From 22c6a67595f9914e7411882f25dcb6e21b80e17a Mon Sep 17 00:00:00 2001 From: Ant Date: Sat, 21 Aug 2010 06:57:49 +0100 Subject: Think I fixed DESL/STNE bug, Changed some FOAM leftovers to INSU, Added Coal (Slow burning solid fuel), Made DESL burn a bit slower too. TODO: Tweak Values a bit more for pressurising WOOD to COAL. diff --git a/powder.c b/powder.c index 994f473..16c3c4f 100644 --- a/powder.c +++ b/powder.c @@ -600,7 +600,8 @@ struct menu_section msections[] = #define PT_SMKE 57 #define PT_PLAS 58 #define PT_DESL 59 -#define PT_NUM 60 +#define PT_COAL 60 +#define PT_NUM 61 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -632,7 +633,7 @@ const struct part_type ptypes[] = {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Conducts electricity. Meltable."}, {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electricity. Conducted by metal and water."}, {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP+-30.0f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f, 164, "Solid. Flammable."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f, 164, "Solid. Flammable. Can be pressurised into COAL"}, {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 60, "Neutrons. Interact with matter in odd ways."}, {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 65, "Plant, drinks water and grows."}, @@ -673,8 +674,10 @@ const struct part_type ptypes[] = {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, - {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, - {"DESL", PIXPACK(0x440000), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, + {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.0f * CFDS, 0, 0, 0, 1, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, + {"DESL", PIXPACK(0x440000), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f, 200, "Solid. Burns slowly."}, + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; #define ST_NONE 0 @@ -744,6 +747,7 @@ const struct part_state pstates[] = /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OILL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 62.0f}, + /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 250.0f}, }; static const unsigned char can_move[PT_NUM][PT_NUM] = { @@ -751,74 +755,75 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ - /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S P D*/ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M l e*/ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K a s*/ - /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y M H E s l*/ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0}, - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1}, - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}, - /* METL */ {0,1,1,1,0,0,1,1,1,0,1,0,0,0,0,0,1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S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S P D*/ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M l e*/ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K a s*/ - /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y M H E s l*/ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C*/ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o*/ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a*/ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l*/ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0}, /* Dust */ + /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0}, /* Watr */ + /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0}, /* LCry */ + /* STKM */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* StkM */ + /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Swch */ + /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Smke */ + /* PLAS */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Plas */ + /* DESL */ {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Desl */ + /* COAL */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Coal */ + /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C*/ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o*/ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a*/ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l*/ }; @@ -1585,6 +1590,8 @@ void update_particles_i(pixel *vid, int start, int inc) t = parts[i].type = PT_DESL; if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) t = parts[i].type = PT_FIRE; + if(t==PT_WOOD && pv[y/CELL][x/CELL]>6.0f) + t = parts[i].type = PT_COAL; } if(t==PT_OILL && pv[y/CELL][x/CELL]>20.0f) t = parts[i].type = PT_PLAS; @@ -1594,6 +1601,8 @@ void update_particles_i(pixel *vid, int start, int inc) t = parts[i].type = PT_FIRE; // combust under pressure. if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f) t = parts[i].type = PT_DESL; + if(t==PT_WOOD && pv[y/CELL][x/CELL]>30.0f) + t = parts[i].type = PT_COAL; if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) @@ -2064,6 +2073,8 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_OILL; if((r&0xFF)==PT_DESL && 15>(rand()%1000)) parts[r>>8].type = PT_GASS; + if((r&0xFF)==PT_COAL && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; } } else if(t==PT_PHOT) @@ -2206,6 +2217,7 @@ void update_particles_i(pixel *vid, int start, int inc) { parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; + parts[r>>8].ctype = (parts[r>>8].type==PT_DESL)?PT_SMKE:parts[r>>8].ctype; //Stop DESL making STNE when burnt? parts[r>>8].type = PT_LAVA; parts[r>>8].life = rand()%120+240; } -- cgit v0.9.2-21-gd62e From 858918b201d8dc21d50e61a65e03a07da18137b5 Mon Sep 17 00:00:00 2001 From: Ant Date: Sat, 21 Aug 2010 16:29:16 +0100 Subject: Added Liquid Oxygen, Oxygen, Tweaked some more values. diff --git a/Makefile b/Makefile index e5b5f9e..c02fb2e 100755 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ LFLAGS_MTW32 := -lpthreadGC2 LFLAGS_MT := $(LFLAGS) -lpthread MFLAGS_MT := -march=k8 -DX86 -DX86_SSE3 -DMT -msse3 MFLAGS_SSE3 := -march=k8 -DX86 -DX86_SSE3 -msse3 -MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2 +MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2 -msse2 MFLAGS_SSE := -march=pentium3 -DX86 -DX86_SSE FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -O2 -march=k8 -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lpthread -lbz2 COMPILER := gcc @@ -88,4 +88,4 @@ release: $(LINUX_TARG) $(WIN32_TARG) powder-src.tar.bz2 cp powder-sse release/powder gzip release/powder cd release; tar czf powder-bin.tar.gz powder.gz powder64.gz powder-linux.tar.gz powder-win32.zip powder.zip; cd .. - rm -f $(LINUX_TARG) $(WIN32_TARG) SDL.dll powder.exe \ No newline at end of file + rm -f $(LINUX_TARG) $(WIN32_TARG) SDL.dll powder.exe diff --git a/powder.c b/powder.c index 16c3c4f..b28ffa6 100644 --- a/powder.c +++ b/powder.c @@ -601,7 +601,9 @@ struct menu_section msections[] = #define PT_PLAS 58 #define PT_DESL 59 #define PT_COAL 60 -#define PT_NUM 61 +#define PT_LOX 61 +#define PT_O2 62 +#define PT_NUM 63 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -675,8 +677,10 @@ const struct part_type ptypes[] = {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.0f * CFDS, 0, 0, 0, 1, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, - {"DESL", PIXPACK(0x440000), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0.01f, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f, 200, "Solid. Burns slowly."}, + {"LOX", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 5.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Oxygen helps make things burn."}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; @@ -704,7 +708,7 @@ const struct part_state pstates[] = /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 500.0f}, + /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_COAL, 300.0f, PT_FIRE, 600.0f}, /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 300.0f}, @@ -747,7 +751,9 @@ const struct part_state pstates[] = /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OILL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 62.0f}, - /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 250.0f}, + /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, + /* LOX */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, -180.0f, PT_NONE, 0.0f}, + /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LOX, -190.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static const unsigned char can_move[PT_NUM][PT_NUM] = { @@ -755,75 +761,78 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C*/ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o*/ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a*/ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l*/ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0}, /* Dust */ - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0}, /* Watr */ - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* LCry */ - /* STKM */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* StkM */ - /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Swch */ - /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Smke */ - /* PLAS */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Plas */ - /* DESL */ {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Desl */ - /* COAL */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Coal */ - /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C*/ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o*/ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a*/ - /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l*/ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O*/ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2*/ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l */ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0}, /* Dust */ + /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0}, /* Watr */ + /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Oill */ + /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1}, /* LOX */ + /* O2 */ {0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0}, /* O2 */ + + /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O*/ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2*/ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X */ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l */ }; @@ -2217,7 +2226,6 @@ void update_particles_i(pixel *vid, int start, int inc) { parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; - parts[r>>8].ctype = (parts[r>>8].type==PT_DESL)?PT_SMKE:parts[r>>8].ctype; //Stop DESL making STNE when burnt? parts[r>>8].type = PT_LAVA; parts[r>>8].life = rand()%120+240; } -- cgit v0.9.2-21-gd62e From c1045170272538a862f2bc0cc0220221799f1104 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 22 Aug 2010 11:53:43 -0400 Subject: work please diff --git a/powder.c b/powder.c new file mode 100644 index 0000000..b5e85d2 --- /dev/null +++ b/powder.c @@ -0,0 +1,10949 @@ +/** + * Powder Toy - Main source + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw + * Copyright (c) 2010 Skresanov Savely + * Copyright (c) 2010 Bryan Hoyle + * Copyright (c) 2010 Nathan Cousins + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#else +#include +#include +#endif + + +#include "version.h" +#include "http.h" +#include "md5.h" +#include "update.h" +#include "hmap.h" + +#define SERVER "powdertoy.co.uk" + +#undef PLOSS + +#ifdef MENUV3 +#define MENUSIZE 40 +#else +#define MENUSIZE 20 +#endif +#define BARSIZE 14 +#define XRES 612 +#define YRES 384 +#define NPART XRES*YRES + +#define ZSIZE_D 16 +#define ZFACTOR_D 8 +unsigned char ZFACTOR = 256/ZSIZE_D; +unsigned char ZSIZE = ZSIZE_D; + +#define CELL 4 +#define ISTP (CELL/2) +#define CFDS (4.0f/CELL) + +typedef unsigned char uint8; + +#ifdef PIX16 +#define PIXELSIZE 2 +typedef unsigned short pixel; +#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) +#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) +#define PIXR(x) (((x)>>8)&0xF8) +#define PIXG(x) (((x)>>3)&0xFC) +#define PIXB(x) (((x)<<3)&0xF8) +#else +#define PIXELSIZE 4 +typedef unsigned int pixel; +#ifdef PIX32BGR +#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) +#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) +#define PIXR(x) ((x)&0xFF) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)>>16) +#else +#ifdef PIX32BGRA +#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) +#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) +#define PIXR(x) (((x)>>8)&0xFF) +#define PIXG(x) (((x)>>16)&0xFF) +#define PIXB(x) (((x)>>24)) +#else +#define PIXPACK(x) (x) +#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) +#define PIXR(x) ((x)>>16) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)&0xFF) +#endif +#endif +#endif + +char *it_msg = + "\brThe Powder Toy\n" + "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" + "\n" + "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" + "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" + "\bgPick your material from the menu using mouse left/right buttons.\n" + "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" + "Shift+drag will create straight lines of particles.\n" + "Ctrl+drag will result in filled rectangles.\n" + "Ctrl+Shift+click will flood-fill a closed area.\n" + "Ctrl+Z will act as Undo.\n" + "Middle click or Alt+Click to \"sample\" the particles.\n" + "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" + "Use 'S' to save parts of the window as 'stamps'.\n" + "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" + "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" + "Use the mouse scroll wheel to change the tool size for particles.\n" + "'Q' will quit the application.\n" + "The spacebar can be used to pause physics.\n" + "'P' will take a screenshot and save it into the current directory.\n" + "\n" + "\brhttp://powdertoy.co.uk/\n" + "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" + "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" + "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" + "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" + "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" + "\n" + "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" + "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" + ; + +typedef struct +{ + int start, inc; + pixel *vid; +} upstruc; + +#ifdef BETA +char *old_ver_msg_beta = "A new beta is available - click here!"; +#endif +char *old_ver_msg = "A new version is available - click here!"; +float mheat = 0.0f; + +int do_open = 0; +int sys_pause = 0; +int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. +int death = 1, gravityd = 2, framerender = 0; +int amd = 1; + +unsigned char fire_r[YRES/CELL][XRES/CELL]; +unsigned char fire_g[YRES/CELL][XRES/CELL]; +unsigned char fire_b[YRES/CELL][XRES/CELL]; + +#define MAXSIGNS 16 + +struct sign +{ + int x,y,ju; + char text[256]; +} signs[MAXSIGNS]; + +/*********************************************************** + * AIR FLOW SIMULATOR * + ***********************************************************/ + +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; + +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; + +unsigned cmode = 3; + +float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float cb_vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float cb_vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float cb_pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; +#define TSTEPP 0.3f +#define TSTEPV 0.4f +#define VADV 0.3f +#define VLOSS 0.999f +#define PLOSS 0.9999f +int numCores = 4; +float kernel[9]; +void make_kernel(void) +{ + int i, j; + float s = 0.0f; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + { + kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); + s += kernel[(i+1)+3*(j+1)]; + } + s = 1.0f / s; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + kernel[(i+1)+3*(j+1)] *= s; +} + +int core_count() +{ + int numCPU = 1; +#ifdef MT +#ifdef WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + numCPU = sysinfo.dwNumberOfProcessors; +#else +#ifdef MACOSX + numCPU = 4; +#else + numCPU = sysconf( _SC_NPROCESSORS_ONLN ); +#endif +#endif + + printf("Cpus: %d\n", numCPU); + if(numCPU>1) + printf("Multithreading enabled\n"); + else + printf("Multithreading disabled\n"); +#endif + return numCPU; +} + +void update_air(void) +{ + int x, y, i, j; + float dp, dx, dy, f, tx, ty; + + for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; + if(dp < -256.0f) dp = -256.0f; + if(dx > 256.0f) dx = 256.0f; + if(dx < -256.0f) dx = -256.0f; + if(dy > 256.0f) dy = 256.0f; + if(dy < -256.0f) dy = -256.0f; + + ovx[y][x] = dx; + ovy[y][x] = dy; + opv[y][x] = dp; + } + memcpy(vx, ovx, sizeof(vx)); + memcpy(vy, ovy, sizeof(vy)); + memcpy(pv, opv, sizeof(pv)); +} + +void *update_air_th(void *arg) +{ + update_air(); + return NULL; +} + +#ifdef WIN32 +_inline unsigned clamp_flt(float f, float min, float max) +#else +inline unsigned clamp_flt(float f, float min, float max) +#endif +{ + if(fmax) + return 255; + return (int)(255.0f*(f-min)/(max-min)); +} + +#ifdef WIN32 +_inline float restrict_flt(float f, float min, float max) +#else +inline float restrict_flt(float f, float min, float max) +#endif +{ + if(fmax) + return max; + return f; +} + +void draw_air(pixel *vid) +{ + int x, y, i, j; + pixel c; + + if(cmode == 2) + return; + + for(y=0; y 0.0f) + c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); + else + c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); + } + else + c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), + clamp_flt(pv[y][x], 0.0f, 8.0f), + clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); + for(j=0; j=XRES || ny>=YRES) + return 0; + if(x==nx && y==ny) + return 1; + r = pmap[ny][nx]; + if(r && (r>>8)>8].type; + + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) + { + return 1; + } + + if((r&0xFF)==PT_VOID) + { + parts[i].type=PT_NONE; + return 0; + } + if((r&0xFF)==PT_BHOL) + { + parts[i].type=PT_NONE; + if(!legacy_enable) + { + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; + } + return 0; + } + + if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide + { + return 1; + } + + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) + { + return 1; + } + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) + { + return 0; + } + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) + { + return 0; + } + + if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; + if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + return 0; + if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) + return 0; + + if(parts[i].type==PT_CNCT && y>8)>= 8; + parts[r].x += x-nx; + parts[r].y += y-ny; + } + + return 1; +} + +void kill_part(int i) +{ + int x, y; + parts[i].type = PT_NONE; + + x = (int)(parts[i].x+0.5f); + y = (int)(parts[i].y+0.5f); + + if(x>=0 && y>=0 && x=XRES || y>=YRES) + return -1; + + if(t==SPC_HEAT||t==SPC_COOL) + { + if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + } + if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) + { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + } + return pmap[y][x]>>8; + } + else + { + return -1; + } + } + if(t==SPC_AIR) + { + pv[y/CELL][x/CELL] += 0.03f; + if(y+CELL>8].type = PT_SPRK; + parts[pmap[y][x]>>8].life = 4; + parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; + pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; + return pmap[y][x]>>8; + } + + if(p==-1) + { + if(pmap[y][x]) + return -1; + if(pfree == -1) + return -1; + i = pfree; + pfree = parts[i].life; + } + else + i = p; + + if(t==PT_GLAS) + { + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + } + if(t!=PT_STKM) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + } + if(t==PT_ACID) + { + parts[i].life = 75; + } + /*Testing + if(t==PT_WOOD){ + parts[i].life = 150; + } + End Testing*/ + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_PLSM) + parts[i].life = rand()%150+50; + if(t==PT_LAVA) + parts[i].life = rand()%120+240; + if(t==PT_NBLE) + parts[i].life = 0; + if(t==PT_NEUT) + { + float r = (rand()%128+128)/127.0f; + float a = (rand()%360)*3.14159f/180.0f; + parts[i].life = rand()%480+480; + parts[i].vx = r*cosf(a); + parts[i].vy = r*sinf(a); + } + if(t==PT_PHOT) + { + float r = (rand()%3-1)*3; + float a = (rand()%3-1)*3; + parts[i].life = 680; + if(a==0.0f&&r==0.0f) + { + parts[i].life = 0; + parts[i].type = PT_NONE; + return -1; + } + else + { + parts[i].vx = a; + parts[i].vy = r; + } + //} else { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + //} + } + + if(t!=PT_STKM) + pmap[y][x] = t|(i<<8); + else + { + if(isplayer==0) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + player[2] = PT_DUST; + player[3] = x-1; //Setting legs positions + player[4] = y+6; + player[5] = x-1; + player[6] = y+6; + + player[7] = x-3; + player[8] = y+12; + player[9] = x-3; + player[10] = y+12; + + player[11] = x+1; + player[12] = y+6; + player[13] = x+1; + player[14] = y+6; + + player[15] = x+3; + player[16] = y+12; + player[17] = x+3; + player[18] = y+12; + + isplayer = 1; + } + } + + return i; +} + +#ifdef WIN32 +_inline void delete_part(int x, int y) +#else +inline void delete_part(int x, int y) +#endif +{ + unsigned i; + + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + i = pmap[y][x]; + if(!i || (i>>8)>=NPART) + return; + + kill_part(i>>8); + pmap[y][x] = 0; // just in case +} + +#ifdef WIN32 +_inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#else +inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#endif +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +//Signum function +#ifdef WIN32 +_inline int sign(float i) +#else +inline int sign(float i) +#endif +{ + if (i<0) + return -1; + if (i>0) + return 1; + return 0; +} + +void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a) //Draws a line +{ + int dx, dy, i, sx, sy, check, e, x, y; + + dx = abs(x1-x2); + dy = abs(y1-y2); + sx = sign(x2-x1); + sy = sign(y2-y1); + x = x1; + y = y1; + check = 0; + + if (dy>dx) + { + dx = dx+dy; + dy = dx-dy; + dx = dx-dy; + check = 1; + } + + e = (dy<<2)-dx; + for (i=0; i<=dx; i++) + { + vid[x+y*a] =PIXRGB(r, g, b); + if (e>=0) + { + if (check==1) + x = x+sx; + else + y = y+sy; + e = e-(dx<<2); + } + if (check==1) + y = y+sy; + else + x = x+sx; + e = e+(dy<<2); + } +} + +void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + 255*PIXR(t)) >> 8; + g = (a*g + 255*PIXG(t)) >> 8; + b = (a*b + 255*PIXB(t)) >> 8; + if(r>255) + r = 255; + if(g>255) + g = 255; + if(b>255) + b = 255; + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); + +#ifdef WIN32 +_inline int is_wire(int x, int y) +#else +inline int is_wire(int x, int y) +#endif +{ + return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; +} + +#ifdef WIN32 +_inline int is_wire_off(int x, int y) +#else +inline int is_wire_off(int x, int y) +#endif +{ + return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; +} + +void set_emap(int x, int y) +{ + int x1, x2; + + if(!is_wire_off(x, y)) + return; + + // go left as far as possible + x1 = x2 = x; + while(x1>0) + { + if(!is_wire_off(x1-1, y)) + break; + x1--; + } + while(x21 && x1==x2 && + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + set_emap(x1, y-2); + else if(y>0) + for(x=x1; x<=x2; x++) + if(is_wire_off(x, y-1)) + { + if(x==x1 || x==x2 || y>=YRES/CELL-1 || + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + set_emap(x, y-1); + } + + if(y>8) < NPART && (pmr>>8) >= 0) + { + return parts[pmr>>8].type; + } + else + { + return PT_NONE; + } +} +int nearest_part(int ci, int t) +{ + int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); + int ndistance = 0; + int id = -1; + int i = 0; + int cx = (int)parts[ci].x; + int cy = (int)parts[ci].y; + for(i=0; i=XRES || y>=YRES || + ((bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_WIRE || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) + { + kill_part(i); + continue; + } + + vx[y/CELL][x/CELL] *= ptypes[t].airloss; + vy[y/CELL][x/CELL] *= ptypes[t].airloss; + vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + if(t==PT_GASS||t==PT_NBLE) + { + if(pv[y/CELL][x/CELL]<3.5f) + pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); + if(y+CELL2.5f) + { + parts[i].life = rand()%80+180; + rt = parts[i].type = PT_FIRE; + parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + pv[y/CELL][x/CELL] += 0.25f * CFDS; + t = PT_FIRE; + } + + parts[i].vx *= ptypes[t].loss; + parts[i].vy *= ptypes[t].loss; + + if(t==PT_DFRM && !parts[i].life) + { + if(pv[y/CELL][x/CELL]>1.0f) + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].life = rand()%80+300; + } + } + else + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + if(gravityd == 1) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] - ptypes[t].gravity; + } + if(gravityd == 2) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + if(gravityd == 3) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + ptypes[t].gravity; + } + if(gravityd == 4) + { + parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; + } + if(gravityd == 5) + { + parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL]; + } + if(gravityd == 6) + { + parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + if(gravityd == 7) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] - ptypes[t].gravity; + } + if(gravityd == 8) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; + } + if(gravityd == 9) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + ptypes[t].gravity; + } + } + + if(ptypes[t].diffusion) + { + parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + } + + // interpolator +#ifdef WIN32 + mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#else + mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#endif + if(mv < ISTP) + { + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + } + else + { + dx = parts[i].vx*ISTP/mv; + dy = parts[i].vy*ISTP/mv; + ix = parts[i].x; + iy = parts[i].y; + while(1) + { + mv -= ISTP; + if(mv <= 0.0f) + { + // nothing found + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + break; + } + ix += dx; + iy += dy; + nx = (int)(ix+0.5f); + ny = (int)(iy+0.5f); + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) + { + parts[i].x = ix; + parts[i].y = iy; + break; + } + } + } + + a = nt = 0; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx4.0f) + t = parts[i].type = PT_DSTW; + if(t==PT_GASS && pv[y/CELL][x/CELL]>4.0f) + t = parts[i].type = PT_OILL; + if(t==PT_OILL && pv[y/CELL][x/CELL]<-4.0f) + t = parts[i].type = PT_GASS; + } + if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) + t = parts[i].type = PT_BRMT; + //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) + // t = parts[i].type = PT_BGLA; + if(t==PT_GLAS) + { + parts[i].pavg[0] = parts[i].pavg[1]; + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) + { + parts[i].type = PT_BGLA; + } + } + if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) + t = parts[i].type = PT_SNOW; + if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) + { + t = PT_NEUT; + create_part(i, x, y, t); + } + + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) + { + nearp = nearest_part(i, PT_ETRD); + if(nearp!=-1) + { + create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[nearp].type = PT_SPRK; + parts[nearp].life = 9; + parts[nearp].ctype = PT_ETRD; + } + } + + if(!legacy_enable) + { + int ctemp = pv[y/CELL][x/CELL]*2; + c_heat = 0.0f; + h_count = 0; + if(ptypes[t].hconduct>(rand()%250)) + { + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + h_count++; + c_heat += parts[r>>8].temp; + } + } + } + } + pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + parts[r>>8].temp = parts[i].temp; + } + } + } + } + if(pt>=pstates[t].btemp&&pstates[t].burn) + { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE||t==PT_PLSM) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) + { + if(t==PT_LAVA&&parts[i].ctype) + { + parts[i].life = 0; + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) + { + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } + else + { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } + else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) + { + if(pstates[t].liquid==PT_LAVA) + { + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } + else if(t==PT_ICEI&&parts[i].ctype) + { + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else + { + t = parts[i].type = pstates[t].liquid; + } + } + else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) + { + t = parts[i].type = pstates[t].liquid; + } + else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) + { + if(t==PT_SLTW&&1>rand()%6) + { + t = parts[i].type = PT_SALT; + } + else + { + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) + { + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA) + { + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } + } + if(t==PT_CSCN&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + if(t==PT_HSCN&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_WIRE || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) + { + nx = x % CELL; + if(nx == 0) + nx = x/CELL - 1; + else if(nx == CELL-1) + nx = x/CELL + 1; + else + nx = x/CELL; + ny = y % CELL; + if(ny == 0) + ny = y/CELL - 1; + else if(ny == CELL-1) + ny = y/CELL + 1; + else + ny = y/CELL; + if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WIRE || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ) + { + t = parts[i].type = PT_NONE; + parts[r>>8].ctype = parts[r>>8].type; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + } + else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) + { + pv[y/CELL][x/CELL] += 100.0f; + if(legacy_enable&&1>(rand()%200)) + { + parts[i].life = rand()%50+120; + t = parts[i].type = PT_FIRE; + } + else + { + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_ICEI || t==PT_SNOW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if(legacy_enable) + { + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; + } + } + } + else if(t==PT_HSCN||t==PT_CSCN) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_WIRE) + { + parts[i].temp = 200.0f; + } + } + } + //PLANT + else if(t==PT_PLNT) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR && 1>(rand()%250)) + { + t = parts[i].type = PT_PLNT; + parts[r>>8].type = PT_PLNT; + } + else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WATR||t==PT_DSTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%250)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_WATR; + } + if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_SLTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) + { + parts[r>>8].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_WTRV) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + parts[r>>8].type = PT_WATR; + } + + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; + } + } + } + else if(t==PT_ACID) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)!=PT_ACID) + { + if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) + { + t = parts[i].type = PT_FIRE; + parts[i].life = 4; + parts[r>>8].type = PT_FIRE; + parts[r>>8].life = 4; + } + else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) + { + parts[i].life--; + parts[r>>8].type = PT_NONE; + } + else if (parts[i].life==50) + { + parts[i].life = 0; + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_NEUT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) + { + if(33>rand()%100) + { + create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); + } + else + { + create_part(r>>8, x+nx, y+ny, PT_NEUT); + parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; + parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; + } + pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + fe ++; + } + if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + parts[r>>8].type = PT_DUST; + if((r&0xFF)==PT_WATR && 15>(rand()%100)) + parts[r>>8].type = PT_DSTW; + if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) + parts[r>>8].type = PT_DFRM; + if((r&0xFF)==PT_NITR && 15>(rand()%1000)) + parts[r>>8].type = PT_OILL; + if((r&0xFF)==PT_OILL && 5>(rand()%1000)) + parts[r>>8].type = PT_GASS; + if((r&0xFF)==PT_PLNT && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + } + } + else if(t==PT_PHOT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=0; nx<1; nx++) + for(ny=0; ny<1; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + } + } + else if(t==PT_LCRY) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_LCRY) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_BTRY) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts_avg(i,r>>8) != PT_INSL) + { + if((rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) + { + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + parts[r>>8].type = PT_SPRK; + } + } + } + }else if(t==PT_SWCH) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8)!=PT_INSL) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + if(t==PT_SWCH) + if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) + { + parts[i].life--; + } + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) + continue; + rt = parts[r>>8].type; + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_METL && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) + { + parts[r>>8].type = PT_FIRE; + parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + parts[r>>8].life = rand()%80+180; + if(ptypes[rt].explosive) + pv[y/CELL][x/CELL] += 0.25f * CFDS; + continue; + } + lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; + if(lpv < 1) lpv = 1; + if(legacy_enable) + { + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_WIRE && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && + ptypes[rt].meltable*lpv>(rand()%1000)) + { + if(t!=PT_LAVA || parts[i].life>0) + { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } + else + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) + { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = PT_METL; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) + { + kill_part(r>>8); + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_METL; + parts[i].ctype = PT_NONE; + goto killed; + } + } + } + pavg = parts_avg(i, r>>8); + if(rt==PT_SWCH && t==PT_SPRK) + { + pavg = parts_avg(r>>8, i); + if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) + parts[r>>8].life = 10; + if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) + parts[r>>8].life = 9; + if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].ctype = PT_SWCH; + parts[r>>8].life = 4; + } + } + pavg = parts_avg(i, r>>8); + if(pavg != PT_INSL) + { + if(t==PT_SPRK && (rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) + parts[r>>8].temp = parts[r>>8].temp+10.0f; + } + } + if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 6; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 5; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) + { + if(rt==PT_WIRE||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) + { + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) + { + parts[i].life = rand()%150+50; + parts[i].type = PT_PLSM; + parts[i].ctype = PT_NBLE; + parts[i].temp = 3500; + pv[y/CELL][x/CELL] += 1; + } + if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) + { + parts[i].type = PT_SWCH; + parts[i].life = 11; + } + } + } +killed: + if(parts[i].type == PT_NONE) + continue; + } + + if(t==PT_STKM) + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<0 && (death == 1)) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; + player[10] += 2; + player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; + player[18] += 2; + player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; + player[10] += 1; + player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; + player[18] += 1; + player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; + player[10] += 2; + player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; + player[18] += 2; + player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; + player[10] += 1; + player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; + player[18] += 1; + player[13] -= 1; + } + + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) + || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) + { + int random = abs(rand()%3-1)*3; + if (random==0) + { + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + } + else + { + parts[r>>8].vy = 0; + parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; + } + } + + } + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[10] += 1; + player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } + + if(t==PT_CLNE) + { + if(!parts[i].ctype) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx=XRES-CELL || + ny=YRES-CELL) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + continue; + } + + rt = parts[i].flags & FLAG_STAGNANT; + parts[i].flags &= ~FLAG_STAGNANT; + if(!try_move(i, x, y, nx, ny)) + { + parts[i].x = lx; + parts[i].y = ly; + if(ptypes[t].falldown) + { + if(nx!=x && try_move(i, x, y, nx, y)) + { + parts[i].x = ix; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x, ny)) + { + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else + { + r = (rand()%2)*2-1; + if(ny!=y && try_move(i, x, y, x+r, ny)) + { + parts[i].x += r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x-r, ny)) + { + parts[i].x -= r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y+r)) + { + parts[i].x = ix; + parts[i].y += r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y-r)) + { + parts[i].x = ix; + parts[i].y -= r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) + { + s = 0; + if(!rt || nt) + rt = 50; + else + rt = 10; + for(j=x+r; j>=0 && j>=x-rt && j0) + r = 1; + else + r = -1; + if(s) + for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny(rand()%1000)) + { + kill_part(i); + continue; + } + else if(try_move(i, x, y, 2*x-nx, ny)) + { + parts[i].x = (float)(2*x-nx); + parts[i].y = (float)iy; + parts[i].vx *= ptypes[t].collision; + } + else if(try_move(i, x, y, nx, 2*y-ny)) + { + parts[i].x = (float)ix; + parts[i].y = (float)(2*y-ny); + parts[i].vy *= ptypes[t].collision; + } + else + { + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + } + } + +justdraw: + + nx = (int)(parts[i].x+0.5f); + ny = (int)(parts[i].y+0.5f); + + if(nx=XRES-CELL || + ny=YRES-CELL) + { + kill_part(i); + continue; + } + if(cmode!=CM_HEAT) + { + if(t==PT_STKM) //Just draw head here + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; + vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; + vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; + vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; + } + draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); + draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); + draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); + draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); + + isplayer = 1; //It's a secret. Tssss... + } + if(t==PT_MWAX&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,224,224,170,255); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,224,224,170,20); + else + blendpixel(vid,x+nx,y+ny,224,224,170,40); + } + } + + } + else if(t==PT_ACID) + { + if(parts[i].life>255) parts[i].life = 255; + if(parts[i].life<47) parts[i].life = 48; + s = (255/((parts[i].life-46)*28)); + if(s==0) s = 1; + cr = PIXR(ptypes[t].pcolors)/s; + cg = PIXG(ptypes[t].pcolors)/s; + cb = PIXB(ptypes[t].pcolors)/s; + if(cmode==6){ + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); + } + } + } else { + blendpixel(vid, x, y, cr, cg, cb, 255); + } + + if(cmode==4) + { + blendpixel(vid, nx+1, ny, cr, cg, cb, 223); + blendpixel(vid, nx-1, ny, cr, cg, cb, 223); + blendpixel(vid, nx, ny+1, cr, cg, cb, 223); + blendpixel(vid, nx, ny-1, cr, cg, cb, 223); + + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); + } + } + else if(t==PT_OILL&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,64,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,64,16,40); + } + } + } + else if(t==PT_NEUT) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 8; + cb = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = 0x20; + cg = 0xE0; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLUT&&cmode == 6) + { + int tempx; + int tempy; + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(tempx = 2; tempx < 10; tempx++) { + for(tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_URAN&&cmode == 6) + { + int tempx; + int tempy; + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(tempx = 2; tempx < 10; tempx++) { + for(tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_SLTW&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,80,240,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,80,240,50); + } + } + } + else if(t==PT_PHOT) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 12; + cb = 12; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_SWCH && parts[i].life == 10) + { + x = nx; + y = ny; + blendpixel(vid,x,y,17,217,24,255); + } + else if(t==PT_LNTG&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,128,160,223,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,128,160,223,50); + } + } + } + else if(t==PT_SMKE) + { + if(cmode == 3||cmode==4 || cmode==6) + { + x = nx/CELL; + y = ny/CELL; + cg = 10; + cb = 10; + cr = 10; + cg += fire_g[y][x]; + if(cg > 50) cg = 50; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 50) cb = 50; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 50) cr = 50; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,100,100,100,30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,100,100,100,10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,100,100,100,20); + } + } + } + } + else if(t==PT_WATR&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + + } else if(t==PT_DSTW&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + } + else if(t==PT_NITR&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,224,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,224,16,50); + } + } + + } + else if(t==PT_LRBD&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,170,170,170,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,170,170,170,50); + } + } + + } + + else if(t==PT_NBLE&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,235,73,23,100); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,235,73,23,30); + else + blendpixel(vid,x+nx,y+ny,235,73,23,50); + } + } + + } + else if(t==PT_GASS&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,255,255,0,180); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,255,255,0,50); + else + blendpixel(vid,x+nx,y+ny,255,255,0,80); + } + } + + } + else if(t==PT_WTRV) + { + if(cmode == 3||cmode==4 || cmode==6) + { + x = nx/CELL; + y = ny/CELL; + cg = PIXG(ptypes[t].pcolors)/3; + cb = PIXB(ptypes[t].pcolors)/3; + cr = PIXR(ptypes[t].pcolors)/3; + cg += fire_g[y][x]; + if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); + } + } + } + } + else if(t==PT_THDR) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 16; + cb = 20; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xA0; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LCRY) + { + if(cmode == 3||cmode==4 || cmode==6) + { + //cr = R/8; + //cg = G/8; + //cb = B/8; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); + //x = nx/CELL; + //y = ny/CELL; + //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } + else + { + cr = 0x50+(parts[i].life*10); + cg = 0x50+(parts[i].life*10); + cb = 0x50+(parts[i].life*10); + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLSM) + { + float ttemp = parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = plasma_data[caddress]; + uint8 G = plasma_data[caddress+1]; + uint8 B = plasma_data[caddress+2]; + if(cmode == 3||cmode==4 || cmode==6) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_FIRE && parts[i].life) + { + if(cmode == 3||cmode==4 || cmode==6) + { + cr = parts[i].life / 4; + cg = parts[i].life / 16; + cb = parts[i].life / 32; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = parts[i].life * 8; + cg = parts[i].life * 2; + cb = parts[i].life; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LAVA && parts[i].life) + { + cr = parts[i].life * 2 + 0xE0; + cg = parts[i].life * 1 + 0x50; + cb = parts[i].life/2 + 0x10; + if(cr>255) cr = 255; + if(cg>192) cg = 192; + if(cb>128) cb = 128; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 64); + blendpixel(vid, nx-1, ny, cr, cg, cb, 64); + blendpixel(vid, nx, ny+1, cr, cg, cb, 64); + blendpixel(vid, nx, ny-1, cr, cg, cb, 64); + if(cmode == 3||cmode==4 || cmode==6) + { + cr /= 32; + cg /= 32; + cb /= 32; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else if(t==PT_LAVA || t==PT_SPRK) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + if(cmode == 3 || cmode==4 || cmode==6) + { + if(t == PT_LAVA) + { + cr = 3; + cg = i%2; + cb = 0; + } + else + { + cr = 8; + cg = 12; + cb = 16; + } + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + } + else + { + float ttemp = parts[i].temp+(-MIN_TEMP); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); + uint8 R = color_data[caddress]; + uint8 G = color_data[caddress+1]; + uint8 B = color_data[caddress+2]; + + if(t==PT_STKM) //Stick man should be visible in heat mode + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); + vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); + vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); + vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); + } + draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); + draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); + draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); + draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); + } + else + { + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); + //blendpixel(vid, nx+1, ny, R, G, B, 255); + } + } + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) + { + uint8 R = PIXR(ptypes[t].pcolors); + uint8 G = PIXG(ptypes[t].pcolors); + uint8 B = PIXB(ptypes[t].pcolors); + + //if(vid[(ny-1)*YRES+(nx-1)]!=0){ + // blendpixel(vid, nx, ny-1, R, G, B, 46); + //} + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + + } + if(framerender == 1) + { + sys_pause = 1; + framerender= 0; + } + +} + +void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) +{ + blendpixel(vid, x+1, y, cr, cg, cb, 112); + blendpixel(vid, x-1, y, cr, cg, cb, 112); + blendpixel(vid, x, y+1, cr, cg, cb, 112); + blendpixel(vid, x, y-1, cr, cg, cb, 112); + + blendpixel(vid, x+1, y-1, cr, cg, cb, 64); + blendpixel(vid, x-1, y-1, cr, cg, cb, 64); + blendpixel(vid, x+1, y+1, cr, cg, cb, 64); + blendpixel(vid, x-1, y+1, cr, cg, cb, 64); +} + +void update_particles_i_th(void *arg) +{ + upstruc *newup = (upstruc*)arg; + update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); + return; +} + +void update_particles(pixel *vid) +{ + int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; + float lx, ly; +#ifdef MT + int pt = 0, pc = 0; + pthread_t *InterThreads; +#endif + + isplayer = 0; //Needed for player spawning + memset(pmap, 0, sizeof(pmap)); + r = rand()%2; + for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==13) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } + else + { + for(y=0; y>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==9) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && !sys_pause) + emap[y][x] --; + } + } + } + +#ifdef MT + if(numCores > 1) + { + InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); + for(pc = 0; pc=XRES || ny<0 || ny>=YRES) + break; + addpixel(vid, nx, ny, 255, 255, 255, 64); + i = nx/CELL; + j = ny/CELL; + lx += vx[j][i]*0.125f; + ly += vy[j][i]*0.125f; + if(bmap[j][i]==5 && i!=x && j!=y) + break; + } + drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); + } + +} + +void update_particles_th(void *arg) +{ + update_particles((pixel*)arg); + return; +} + +/*********************************************************** + * SDL OUTPUT * + ***********************************************************/ + +int sdl_scale = 1; +SDL_Surface *sdl_scrn; +SDLMod sdl_mod; +int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; + +#include "icon.h" +void sdl_seticon(void) +{ +#ifdef WIN32 + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else +#ifdef MACOSX + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else + SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#endif +#endif +} + +void sdl_open(void) +{ + if(SDL_Init(SDL_INIT_VIDEO)<0) + { + fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); + exit(1); + } + atexit(SDL_Quit); +#ifdef PIX16 + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); +#else + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); +#endif + if(!sdl_scrn) + { + fprintf(stderr, "Creating window: %s\n", SDL_GetError()); + exit(1); + } + SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); + sdl_seticon(); + SDL_EnableUNICODE(1); + //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); +} + +void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0; jpitch/PIXELSIZE; + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} + +void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + int i,k; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0; jpitch/PIXELSIZE; + } + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} +void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) +{ + if(sdl_scale == 2) + sdl_blit_2(x, y, w, h, src, pitch); + else + sdl_blit_1(x, y, w, h, src, pitch); +} + +int frame_idx=0; +void dump_frame(pixel *src, int w, int h, int pitch) +{ + char frame_name[32]; + int j,i; + unsigned char c[3]; + FILE *f; + sprintf(frame_name,"frame%04d.ppm",frame_idx); + f=fopen(frame_name,"wb"); + fprintf(f,"P6\n%d %d\n255\n",w,h); + for(j=0; j=0 && x=0 && yPT_NUM) + return 2; + if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) + return 3; + i = XRES*YRES; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) + return 1; + size = i; + } + else + d = c; + + if(size < XRES*YRES) + { + if(bzip2) + free(d); + return 1; + } + + sy = 0; + for(y=0; y+scl<=YRES; y+=scl) + { + sx = 0; + for(x=0; x+scl<=XRES; x+=scl) + { + a = 0; + r = g = b = 0; + for(j=0; j=PT_NUM) + goto corrupt; + r += PIXR(ptypes[t].pcolors); + g += PIXG(ptypes[t].pcolors); + b += PIXB(ptypes[t].pcolors); + a ++; + } + } + if(a) + { + a = 256/a; + r = (r*a)>>8; + g = (g*a)>>8; + b = (b*a)>>8; + } + + drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); + sx++; + } + sy++; + } + + if(bzip2) + free(d); + return 0; + +corrupt: + if(bzip2) + free(d); + return 1; +} + +static char *mystrdup(char *s) +{ + char *x; + if(s) + { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; + } + return s; +} + +void *build_save(int *size, int x0, int y0, int w, int h) +{ + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; + int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); + int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + // save the required air state + for(y=by0; y255) i=255; + d[p++] = i; + } + for(y=by0; y255) i=255; + d[p++] = i; + } + + // save the particle map + for(i=0; i=x0 && x=y0 && y255) x=255; + if(y<0) y=0; + if(y>255) y=255; + d[p++] = x; + d[p++] = y; + } + } + for(j=0; j255) tttemp=255; + d[p++] = tttemp; + } + } + for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; + d[p++] = (signs[i].y-y0); + d[p++] = (signs[i].y-y0)>>8; + d[p++] = signs[i].ju; + x = strlen(signs[i].text); + d[p++] = x; + memcpy(d+p, signs[i].text, x); + p+=x; + } + + i = (p*101+99)/100 + 612; + c = malloc(i); + c[0] = 0x66; + c[1] = 0x75; + c[2] = 0x43; + c[3] = legacy_enable; + c[4] = SAVE_VERSION; + c[5] = CELL; + c[6] = bw; + c[7] = bh; + c[8] = p; + c[9] = p >> 8; + c[10] = p >> 16; + c[11] = p >> 24; + + i -= 12; + + if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) + { + free(d); + free(c); + return NULL; + } + free(d); + + *size = i+12; + return c; +} + +int parse_save(void *save, int size, int replace, int x0, int y0) +{ + unsigned char *d,*c=save; + int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; + int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; + int fp[NPART], nf=0; + + if(size<16) + return 1; + if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) + return 1; + if(c[4]>SAVE_VERSION) + return 2; + ver = c[4]; + + if(ver<34) + { + legacy_enable = 1; + } + else + { + if(c[3]==1||c[3]==0) + legacy_enable = c[3]; + else + legacy_beta = 1; + } + + bw = c[6]; + bh = c[7]; + if(bx0+bw > XRES/CELL) + bx0 = XRES/CELL - bw; + if(by0+bh > YRES/CELL) + by0 = YRES/CELL - bh; + if(bx0 < 0) + bx0 = 0; + if(by0 < 0) + by0 = 0; + + if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) + return 3; + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + return 1; + size = i; + + if(size < bw*bh) + return 1; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + if(replace) + { + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(signs, 0, sizeof(signs)); + memset(parts, 0, sizeof(particle)*NPART); + memset(pmap, 0, sizeof(pmap)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(pv, 0, sizeof(pv)); + } + + // make a catalog of free parts + memset(pmap, 0, sizeof(pmap)); + for(i=0; i= size) + goto corrupt; + fvx[y][x] = (d[p++]-127.0f)/64.0f; + } + for(y=by0; y= size) + goto corrupt; + fvy[y][x] = (d[p++]-127.0f)/64.0f; + } + + // load the particle map + i = 0; + pty = p; + for(y=y0; y= size) + goto corrupt; + j=d[p++]; + if(j >= PT_NUM) + goto corrupt; + if(j && !(isplayer == 1 && j==PT_STKM)) + { + if(pmap[y][x]) + { + k = pmap[y][x]>>8; + parts[k].type = j; + parts[k].x = (float)x; + parts[k].y = (float)y; + m[(x-x0)+(y-y0)*w] = k+1; + } + else if(i < nf) + { + parts[fp[i]].type = j; + parts[fp[i]].x = (float)x; + parts[fp[i]].y = (float)y; + m[(x-x0)+(y-y0)*w] = fp[i]+1; + i++; + } + else + m[(x-x0)+(y-y0)*w] = NPART+1; + } + } + + // load particle properties + for(j=0; j= size) + goto corrupt; + if(i < NPART) + { + parts[i].vx = (d[p++]-127.0f)/16.0f; + parts[i].vy = (d[p++]-127.0f)/16.0f; + if(parts[i].type == PT_STKM) + { + player[2] = PT_DUST; + + player[3] = parts[i].x-1; //Setting legs positions + player[4] = parts[i].y+6; + player[5] = parts[i].x-1; + player[6] = parts[i].y+6; + + player[7] = parts[i].x-3; + player[8] = parts[i].y+12; + player[9] = parts[i].x-3; + player[10] = parts[i].y+12; + + player[11] = parts[i].x+1; + player[12] = parts[i].y+6; + player[13] = parts[i].x+1; + player[14] = parts[i].y+6; + + player[15] = parts[i].x+3; + player[16] = parts[i].y+12; + player[17] = parts[i].x+3; + player[18] = parts[i].y+12; + + } + } + else + p += 2; + } + } + for(j=0; j= size) + goto corrupt; + if(i <= NPART) + parts[i-1].life = d[p++]*4; + else + p++; + } + } + for(j=0; j=34&&legacy_beta==0) + { + if(p >= size) + { + goto corrupt; + } + if(i <= NPART) + { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } + else + { + p++; + } + } + else + { + parts[i-1].temp = ptypes[parts[i-1].type].heat; + } + } + } + for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) + { + if(p >= size) + goto corrupt; + if(i <= NPART) + parts[i-1].ctype = d[p++]; + else + p++; + } + } + + if(p >= size) + goto version1; + j = d[p++]; + for(i=0; i size) + goto corrupt; + for(k=0; k size) + goto corrupt; + if(kSAVE_VERSION) + return NULL; + + bw = c[6]; + bh = c[7]; + w = bw*CELL; + h = bh*CELL; + + if(c[5]!=CELL) + return NULL; + + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return NULL; + fb = calloc(w*h, PIXELSIZE); + if(!fb) + { + free(d); + return NULL; + } + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + goto corrupt; + size = i; + + if(size < bw*bh) + goto corrupt; + + k = 0; + for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) + goto corrupt; + + for(y=0; y= size) + goto corrupt; + j=d[p++]; + if(j0) + { + if(j==PT_STKM) //Stickman should be drawed another way + { + //Stickman drawing + for(k=-2; k<=1; k++) + { + fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); + fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); + fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); + fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); + } + draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); + draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); + draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); + draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); + } + else + fb[y*w+x] = ptypes[j].pcolors; + } + } + + free(d); + *width = w; + *height = h; + return fb; + +corrupt: + free(d); + free(fb); + return NULL; +} + +/* NO, I DON'T THINK SO + #include "fbi.h" + + pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) + { + unsigned char *tmp; + pixel *res; + int i; + + tmp = malloc(width*height*3); + if(!tmp) + return NULL; + res = malloc(width*height*PIXELSIZE); + if(!res) { + free(tmp); + return NULL; + } + + i = width*height*3; + if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { + free(res); + free(tmp); + return NULL; + } + + for(i=0; i1) + { + r = (r+c/2)/c; + g = (g+c/2)/c; + b = (b+c/2)/c; + } + q[y*w+x] = PIXRGB(r, g, b); + } + *qw = w; + *qh = h; + return q; +} + +#define GRID_X 5 +#define GRID_Y 4 +#define GRID_P 3 +#define GRID_S 6 +#define GRID_Z 3 + +void stamp_gen_thumb(int i) +{ + char fn[64]; + void *data; + int size, factor_x, factor_y; + pixel *tmp; + + if(stamps[i].thumb) + { + free(stamps[i].thumb); + stamps[i].thumb = NULL; + } + + sprintf(fn, "stamps" PATH_SEP "%s.stm", stamps[i].name); + data = file_load(fn, &size); + + if(data) + { + stamps[i].thumb = prerender_save(data, size, &(stamps[i].thumb_w), &(stamps[i].thumb_h)); + if(stamps[i].thumb && (stamps[i].thumb_w>XRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) + { + factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); + factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); + if(factor_y > factor_x) + factor_x = factor_y; + tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); + free(stamps[i].thumb); + stamps[i].thumb = tmp; + } + } + + free(data); +} + +int clipboard_ready = 0; +void *clipboard_data = 0; +int clipboard_length = 0; + +void stamp_save(int x, int y, int w, int h) +{ + FILE *f; + int n; + char fn[64], sn[16]; + void *s=build_save(&n, x, y, w, h); + +#ifdef WIN32 + _mkdir("stamps"); +#else + mkdir("stamps", 0755); +#endif + + stamp_gen_name(sn); + sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); + + f = fopen(fn, "wb"); + if(!f) + return; + fwrite(s, n, 1, f); + fclose(f); + + free(s); + + if(stamps[STAMP_MAX-1].thumb) + free(stamps[STAMP_MAX-1].thumb); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); + memset(stamps, 0, sizeof(struct stamp_info)); + if(stamp_count0) + { + memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); + memcpy(stamps, &tmp, sizeof(struct stamp_info)); + + stamp_update(); + } + + return data; +} + +void stamp_init(void) +{ + int i; + FILE *f; + + memset(stamps, 0, sizeof(stamps)); + + f=fopen("stamps" PATH_SEP "stamps.def", "rb"); + if(!f) + return; + for(i=0; i=XRES+BARSIZE || y>=YRES+MENUSIZE) + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +#ifdef WIN32 +_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +#else +inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +#endif +{ + int i, j, w, bn = 0, ba = 0; + char *rp = font_data + font_ptrs[c]; + w = *(rp++); + for(j=0; j>= 2; + bn -= 2; + } + return x + w; +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) +{ + int sx = x; + for(; *s; s++) + { + if(*s == '\n') + { + x = sx; + y += FONT_H+2; + } + else if(*s == '\b') + { + switch(s[1]) + { + case 'w': + r = g = b = 255; + break; + case 'g': + r = g = b = 192; + break; + case 'o': + r = 255; + g = 216; + b = 32; + break; + case 'r': + r = 255; + g = b = 0; + break; + case 'b': + r = g = 0; + b = 255; + break; + } + s++; + } + else + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + return x; +} + +void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) +{ + int i; + for(i=0; i<=w; i++) + { + drawpixel(vid, x+i, y, r, g, b, a); + drawpixel(vid, x+i, y+h, r, g, b, a); + } + for(i=1; i=w && x+textwidth(s)>=w+5) + break; + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + if(*s) + for(i=0; i<3; i++) + x = drawchar(vid, x, y, '.', r, g, b, a); + return x; +} + +int textnwidth(char *s, int n) +{ + int x = 0; + for(; *s; s++) + { + if(!n) + break; + x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + n--; + } + return x-1; +} +int textwidthx(char *s, int w) +{ + int x=0,n=0,cw; + for(; *s; s++) + { + cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + if(x+(cw/2) >= w) + break; + x += cw; + n++; + } + return n; +} + +/*********************************************************** + * MAIN PROGRAM * + ***********************************************************/ + +void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) +{ + int x, y, i, j, c; + int bo = b; + if(iswall==1) + { + b = b-100; + x = (2+32*((b-22)/1)); + y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + x = 2+32*(b/2); + y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + if(bo==sl || bo==sr) + { + c = 0; + if(bo==sl) + c |= PIXPACK(0xFF0000); + if(bo==sr) + c |= PIXPACK(0x0000FF); + for(i=0; i<30; i++) + { + vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; + } + for(j=0; j<18; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; + } + } +} + +int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) +{ + int i, j, c; + if(b>=121) + { + b = b-100; + //x = (2+32*((b-22)/1)); + //y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + case 40: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + //x = 2+32*(b/2); + //y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + return 26; +} + +void draw_menu(pixel *vid_buf, int i, int hover) +{ + + //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); +#ifdef MENUV3 + drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + if(hover==i) + { + fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + } +#else + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); +#endif +} + +void menu_ui(pixel *vid_buf, int i, int *sl, int *sr) +{ + int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; + pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); + fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + rows = ceil((float)msections[i].itemcount/16.0f); + height = (ceil((float)msections[i].itemcount/16.0f)*18); + width = restrict_flt(msections[i].itemcount*31, 0, 16*31); + //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); + h = -1; + x = XRES-BARSIZE-26; + y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; + sy = y; + //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); + fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); + fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); + drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); + if(i==SC_WALL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM) + { + if(x-26<=60) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=60) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=20) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(!bq && mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + if(b==1&&h!=-1) + { + *sl = h; + } + if(b==4&&h!=-1) + { + *sr = h; + } +} + +int create_parts(int x, int y, int r, int c) +{ + int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; + + if(c == 125) + { + i = x / CELL; + j = y / CELL; + for(v=-1; v<2; v++) + for(u=-1; u<2; u++) + if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) + { + if(cp) + create_parts(y, x, r, c); + else + create_parts(x, y, r, c); + } + e -= 1.0f; + } + } +} + +void create_box(int x1, int y1, int x2, int y2, int c) +{ + int i, j; + if(x1>x2) + { + i = x2; + x2 = x1; + x1 = i; + } + if(y1>y2) + { + j = y2; + y2 = y1; + y1 = j; + } + for(j=y1; j<=y2; j++) + for(i=x1; i<=x2; i++) + create_parts(i, j, 1, c); +} + +int flood_parts(int x, int y, int c, int cm, int bm) +{ + int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) + { + c = c-100; + } + if(cm==-1) + { + if(c==0) + { + cm = pmap[y][x]&0xFF; + if(!cm) + return 0; + } + else + cm = 0; + } + if(bm==-1) + { + if(c==30) + { + bm = bmap[y/CELL][x/CELL]; + if(!bm) + return 0; + if(bm==1) + cm = 0xFF; + } + else + bm = 0; + } + + if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) + return 1; + + // go left as far as possible + x1 = x2 = x; + while(x1>=CELL) + { + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + break; + x1--; + } + while(x2=CELL+dy) + for(x=x1; x<=x2; x++) + if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) + if(!flood_parts(x, y-dy, co, cm, bm)) + return 0; + if(y=XRES || y>=YRES) + return; + c = vid[y*(XRES+BARSIZE)+x]; + c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); + if(c<512) + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); + else + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); +} + +void xor_line(int x1, int y1, int x2, int y2, pixel *vid) +{ + int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + e -= 1.0f; + } + } +} + +void draw_svf_ui(pixel *vid_buf) +{ + int c; + + drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); + drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + c = svf_open ? 255 : 128; + drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); + drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); + + c = svf_login ? 255 : 128; + drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); + if(svf_open) + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); + else + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); + drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); + if(svf_open && svf_own) + drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); + + c = (svf_login && svf_open) ? 255 : 128; + + drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + + if(svf_myvote==1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); + } + else if(svf_myvote==-1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); + } + + drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); + drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); + + drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); + if(svf_tags[0]) + drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); + else + drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); + + drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); + + drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); + drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); + if(svf_login) + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); + else + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); + drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); + + if(sys_pause) + { + fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); + drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + if(!legacy_enable) + { + fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + switch(cmode) + { + case 0: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); + break; + case 1: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); + break; + case 2: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); + break; + case 3: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); + break; + case 4: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); + break; + case 5: + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + break; + case 6: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255); + break; + } + drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + + if(svf_admin) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); + } + else if(svf_mod) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + }//else if(amd) + // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? +} + +typedef struct ui_edit +{ + int x, y, w, nx; + char str[256],*def; + int focus, cursor, hide; +} ui_edit; +void ui_edit_draw(pixel *vid_buf, ui_edit *ed) +{ + int cx, i; + char echo[256], *str; + + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(ed->str[0]) + { + drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } + else if(!ed->focus) + drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); + if(ed->focus) + { + cx = textnwidth(str, ed->cursor); + for(i=-3; i<9; i++) + drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); + } +} +char *shift_0="`1234567890-=[]\\;',./"; +char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; +void ui_edit_process(int mx, int my, int mb, ui_edit *ed) +{ + char ch, ts[2], echo[256], *str; + int l, i; +#ifdef RAWINPUT + char *p; +#endif + + if(mb) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } + else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } + else + ed->focus = 0; + } + if(ed->focus && sdl_key) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + l = strlen(ed->str); + switch(sdl_key) + { + case SDLK_HOME: + ed->cursor = 0; + break; + case SDLK_END: + ed->cursor = l; + break; + case SDLK_LEFT: + if(ed->cursor > 0) + ed->cursor --; + break; + case SDLK_RIGHT: + if(ed->cursor < l) + ed->cursor ++; + break; + case SDLK_DELETE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + ed->str[ed->cursor] = 0; + else if(ed->cursor < l) + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + break; + case SDLK_BACKSPACE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + { + if(ed->cursor > 0) + memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); + ed->cursor = 0; + } + else if(ed->cursor > 0) + { + ed->cursor--; + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + } + break; + default: +#ifdef RAWINPUT + if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) + { + ch = sdl_key; + if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) + { + if(ch>='a' && ch<='z') + ch &= ~0x20; + p = strchr(shift_0, ch); + if(p) + ch = shift_1[p-shift_0]; + } + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#else + if(sdl_ascii>=' ' && sdl_ascii<127) + { + ch = sdl_ascii; + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#endif + break; + } + } +} +typedef struct ui_checkbox +{ + int x, y; + int focus, checked; +} ui_checkbox; +void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) +{ + int w = 12; + if(ed->checked) + { + drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); + } + if(ed->focus) + { + drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); + } + else + { + drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); + } +} +void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) +{ + int w = 12; + + if(mb && !mbq) + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->checked = (ed->checked)?0:1; + } + } + else + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->focus = 1; + } + else + { + ed->focus = 0; + } + } +} + +void error_ui(pixel *vid_buf, int err, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + char *msg; + + msg = malloc(strlen(txt)+16); + if(err) + sprintf(msg, "%03d %s", err, txt); + else + sprintf(msg, "%s", txt); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + if(err) + drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); + else + drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + free(msg); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_ui(pixel *vid_buf, char *top, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); + drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_box(pixel *vid_buf, char *msg) +{ + int w = textwidth(msg)+16; + int x0=(XRES-w)/2,y0=(YRES-24)/2; + + clearrect(vid_buf, x0-2, y0-2, w+4, 28); + drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); +} + +int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + int ret = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); + drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); + drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); + drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) + { + ret = 1; + break; + } + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + { + ret = 1; + break; + } + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + return ret; +} + +int execute_tagop(pixel *vid_buf, char *op, char *tag) +{ + int status; + char *result; + + char *names[] = {"ID", "Tag", NULL}; + char *parts[2]; + + char *uri = malloc(strlen(SERVER)+strlen(op)+36); + sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); + + parts[0] = svf_id; + parts[1] = tag; + + result = http_multipart_post( + uri, + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + free(uri); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 1; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 1; + } + + if(result[2]) + { + strncpy(svf_tags, result+3, 255); + svf_id[15] = 0; + } + + if(result) + free(result); + + return 0; +} + +struct strlist +{ + char *str; + struct strlist *next; +}; +void strlist_add(struct strlist **list, char *str) +{ + struct strlist *item = malloc(sizeof(struct strlist)); + item->str = mystrdup(str); + item->next = *list; + *list = item; +} +int strlist_find(struct strlist **list, char *str) +{ + struct strlist *item; + for(item=*list; item; item=item->next) + if(!strcmp(item->str, str)) + return 1; + return 0; +} +void strlist_free(struct strlist **list) +{ + struct strlist *item; + while(*list) + { + item = *list; + *list = (*list)->next; + free(item); + } +} + +void tag_list_ui(pixel *vid_buf) +{ + int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; + char *p,*q,s; + char *tag=NULL, *op=NULL; + ui_edit ed; + struct strlist *vote=NULL,*down=NULL; + + ed.x = x0+25; + ed.y = y0+221; + ed.w = 158; + ed.nx = 1; + ed.def = "[new tag]"; + ed.focus = 0; + ed.hide = 0; + ed.cursor = 0; + strcpy(ed.str, ""); + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + op = tag = NULL; + + drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 256); + drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); + p = svf_tags; + s = svf_tags[0] ? ' ' : 0; + y = 36 + y0; + while(s) + { + q = strchr(p, ' '); + if(!q) + q = p+strlen(p); + s = *q; + *q = 0; + if(svf_own || svf_admin || svf_mod) + { + drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); + d = 14; + if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) + { + if(!ed1.focus) + break; + ed1.focus = 0; + ed2.focus = 1; + } + if(sdl_key==SDLK_ESCAPE) + { + if(!ed1.focus && !ed2.focus) + return; + ed1.focus = 0; + ed2.focus = 0; + } + } + + strcpy(svf_user, ed1.str); + md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); + + res = http_multipart_post( + "http://" SERVER "/Login.api", + NULL, NULL, NULL, + svf_user, svf_pass, + &err, NULL); + if(err != 200) + { + error_ui(vid_buf, err, http_ret_text(err)); + if(res) + free(res); + goto fail; + } + if(res && !strncmp(res, "OK", 2)) + { + if(!strcmp(res, "OK ADMIN")) + { + svf_admin = 1; + svf_mod = 0; + } + else if(!strcmp(res, "OK MOD")) + { + svf_admin = 0; + svf_mod = 1; + } + else + { + svf_admin = 0; + svf_mod = 0; + } + free(res); + svf_login = 1; + return; + } + if(!res) + res = mystrdup("Unspecified Error"); + error_ui(vid_buf, 0, res); + free(res); + +fail: + strcpy(svf_user, ""); + strcpy(svf_pass, ""); + svf_login = 0; + svf_own = 0; + svf_admin = 0; + svf_mod = 0; +} + +void execute_delete(pixel *vid_buf, char *id) +{ + int status; + char *result; + + char *names[] = {"ID", NULL}; + char *parts[1]; + + parts[0] = id; + + result = http_multipart_post( + "http://" SERVER "/Delete.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result) + free(result); +} + +int execute_vote(pixel *vid_buf, char *id, char *action) +{ + int status; + char *result; + + char *names[] = {"ID", "Action", NULL}; + char *parts[2]; + + parts[0] = id; + parts[1] = action; + + result = http_multipart_post( + "http://" SERVER "/Vote.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 0; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 0; + } + + if(result) + free(result); + return 1; +} + +static char hex[] = "0123456789ABCDEF"; +void strcaturl(char *dst, char *src) +{ + char *d; + unsigned char *s; + + for(d=dst; *d; d++) ; + + for(s=(unsigned char *)src; *s; s++) + { + if((*s>='0' && *s<='9') || + (*s>='a' && *s<='z') || + (*s>='A' && *s<='Z')) + *(d++) = *s; + else + { + *(d++) = '%'; + *(d++) = hex[*s>>4]; + *(d++) = hex[*s&15]; + } + } + *d = 0; +} + +#define THUMB_CACHE_SIZE 256 + +char *thumb_cache_id[THUMB_CACHE_SIZE]; +void *thumb_cache_data[THUMB_CACHE_SIZE]; +int thumb_cache_size[THUMB_CACHE_SIZE]; +int thumb_cache_lru[THUMB_CACHE_SIZE]; + +void thumb_cache_inval(char *id) +{ + int i,j; + for(i=0; i= THUMB_CACHE_SIZE) + return; + free(thumb_cache_id[i]); + free(thumb_cache_data[i]); + thumb_cache_id[i] = NULL; + for(j=0; j thumb_cache_lru[i]) + thumb_cache_lru[j]--; +} +void thumb_cache_add(char *id, void *thumb, int size) +{ + int i,m=-1,j=-1; + thumb_cache_inval(id); + for(i=0; i m) + { + m = thumb_cache_lru[i]; + j = i; + } + } + if(i >= THUMB_CACHE_SIZE) + { + thumb_cache_inval(thumb_cache_id[j]); + i = j; + } + for(j=0; j= THUMB_CACHE_SIZE) + return 0; + for(j=0; j=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+5); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + else if(!strncmp(str, "TAG ", 4)) + { + if(j >= TAG_MAX) + { + str = p; + continue; + } + q = strchr(str+4, ' '); + if(!q) + { + str = p; + continue; + } + *(q++) = 0; + tag_names[j] = mystrdup(str+4); + tag_votes[j] = atoi(q); + j++; + } + else + { + if(i>=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + str = p; + } + if(*str) + i++; + return i; +} + +#define IMGCONNS 3 +#define TIMEOUT 100 +#define HTTP_TIMEOUT 10 + +int search_own = 0; +int search_date = 0; +int search_page = 0; +char search_expr[256] = ""; + +int search_ui(pixel *vid_buf) +{ + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; + int thumb_drawn[GRID_X*GRID_Y]; + pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + float ry; + time_t http_last_use=HTTP_TIMEOUT; + ui_edit ed; + + + void *http = NULL; + int active = 0; + char *last = NULL; + int search = 0; + int lasttime = TIMEOUT; + char *uri; + int status; + char *results; + char *tmp, ts[64]; + + void *img_http[IMGCONNS]; + char *img_id[IMGCONNS]; + void *thumb, *data; + int thlen, dlen; + + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + + memset(img_http, 0, sizeof(img_http)); + memset(img_id, 0, sizeof(img_id)); + + memset(search_ids, 0, sizeof(search_ids)); + memset(search_names, 0, sizeof(search_names)); + memset(search_scoreup, 0, sizeof(search_scoreup)); + memset(search_scoredown, 0, sizeof(search_scoredown)); + memset(search_publish, 0, sizeof(search_publish)); + memset(search_owners, 0, sizeof(search_owners)); + memset(search_thumbs, 0, sizeof(search_thumbs)); + memset(search_thsizes, 0, sizeof(search_thsizes)); + + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + + do_open = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = 65; + ed.y = 13; + ed.w = XRES-200; + ed.nx = 1; + ed.def = "[search terms]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(search_expr); + strcpy(ed.str, search_expr); + + sdl_wheel = 0; + + while(!sdl_poll()) + { + uih = 0; + bq = b; + mxq = mx; + myq = my; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + if(mx!=mxq || my!=myq || sdl_wheel || b) + mmt = 0; + else if(mmt 9) + { + drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); + drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); + } + + ui_edit_draw(vid_buf, &ed); + + if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) + { + if(search_page) + { + search_page --; + lasttime = TIMEOUT; + } + sdl_wheel = 0; + uih = 1; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) + { + lasttime = TIMEOUT; + search_page ++; + page_count = exp_res; + } + sdl_wheel = 0; + uih = 1; + } + + tp = -1; + if(is_p1) + { + drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); + for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) + for(gi=0; giTAG_MAX || !tag_names[pos]) + break; + if(tag_votes[0]) + i = 127+(128*tag_votes[pos])/tag_votes[0]; + else + i = 192; + w = textwidth(tag_names[pos]); + if(w>XRES/GRID_X-5) + w = XRES/GRID_X-5; + gx = (XRES/GRID_X)*gi; + gy = gj*14 + 46; + if(mx>=gx && mx=gy && my XRES/GRID_X-10) + { + tmp = malloc(strlen(search_names[pos])+4); + strcpy(tmp, search_names[pos]); + j = textwidthx(tmp, XRES/GRID_X-15); + strcpy(tmp+j, "..."); + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); + free(tmp); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); + j = textwidth(search_owners[pos]); + if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && + my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) + { + st = 1; + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); + if(search_thumbs[pos]&&thumb_drawn[pos]==0) + { + render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); + thumb_drawn[pos] = 1; + } + own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); + if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) + mp = pos; + if(own) + { + if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) + { + mp = -1; + dp = pos; + } + } + if(mp==pos && !st) + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); + else + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); + if(own) + { + if(dp == pos) + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); + else + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); + } + if(!search_publish[pos]) + { + drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); + drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } + if(view_own || svf_admin || svf_mod) + { + sprintf(ts+1, "%d", search_votes[pos]); + ts[0] = 0xBB; + for(j=1; ts[j]; j++) + ts[j] = 0xBC; + ts[j-1] = 0xB9; + ts[j] = 0xBA; + ts[j+1] = 0; + w = gx+XRES/GRID_S-2-textwidth(ts); + h = gy+YRES/GRID_S-11; + drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); + for(j=0; ts[j]; j++) + ts[j] -= 14; + drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); + sprintf(ts, "%d", search_votes[pos]); + for(j=0; ts[j]; j++) + ts[j] += 127; + drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); + } + if(search_scoreup[pos]>0||search_scoredown[pos]>0) + { + lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); + + if(((YRES/GRID_S+3)/2)>lv) + { + ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); + if(lv<8) + { + ry = ry/(8-lv); + } + nyu = search_scoreup[pos]*ry; + nyd = search_scoredown[pos]*ry; + } + else + { + ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); + nyu = search_scoreup[pos]/ry; + nyd = search_scoredown[pos]/ry; + } + + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); + + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); + } + } + + if(mp!=-1 && mmt>=TIMEOUT/5 && !st) + { + gi = mp % GRID_X; + gj = mp / GRID_X; + if(is_p1) + gj += GRID_Y-GRID_P; + gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; + gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; + i = w = textwidth(search_names[mp]); + h = YRES/GRID_Z+30; + if(w=XRES-2) gx=XRES-3-w; + if(gy<32) gy=32; + if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; + clearrect(vid_buf, gx-2, gy-3, w+4, h); + drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); + if(search_thumbs[mp]) + render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); + drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); + drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); + } + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(sdl_key==SDLK_RETURN) + { + if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) + lasttime = TIMEOUT; + else if(search_ids[0] && !search_ids[1]) + { + bq = 0; + b = 1; + mp = 0; + } + } + if(sdl_key==SDLK_ESCAPE) + goto finish; + + if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) + { + search_own = !search_own; + lasttime = TIMEOUT; + } + if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) + { + search_date = !search_date; + lasttime = TIMEOUT; + } + + if(b && !bq && dp!=-1) + if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) + { + execute_delete(vid_buf, search_ids[dp]); + lasttime = TIMEOUT; + if(last) + { + free(last); + last = NULL; + } + } + + if(b && !bq && tp!=-1) + { + strncpy(ed.str, tag_names[tp], 255); + lasttime = TIMEOUT; + } + + if(b && !bq && mp!=-1 && st) + { + sprintf(ed.str, "user:%s", search_owners[mp]); + lasttime = TIMEOUT; + } + + if(do_open==1) + { + mp = 0; + } + + if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) + { + fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); + info_box(vid_buf, "Loading..."); + + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + data = http_simple_get(uri, &status, &dlen); + free(uri); + + if(status == 200) + { + status = parse_save(data, dlen, 1, 0, 0); + switch(status) + { + case 1: + error_ui(vid_buf, 0, "Simulation corrupted"); + break; + case 2: + error_ui(vid_buf, 0, "Simulation from a newer version"); + break; + case 3: + error_ui(vid_buf, 0, "Simulation on a too large grid"); + break; + } + if(!status) + { + char *tnames[] = {"ID", NULL}; + char *tparts[1]; + int tplens[1]; + if(svf_last) + free(svf_last); + svf_last = data; + svf_lsize = dlen; + + tparts[0] = search_ids[mp]; + tplens[0] = strlen(search_ids[mp]); + data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); + + svf_open = 1; + svf_own = svf_login && !strcmp(search_owners[mp], svf_user); + svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); + + strcpy(svf_id, search_ids[mp]); + strcpy(svf_name, search_names[mp]); + if(status == 200) + { + if(data) + { + strncpy(svf_tags, data, 255); + svf_tags[255] = 0; + } + else + svf_tags[0] = 0; + } + else + { + svf_tags[0] = 0; + } + + if(svf_login) + { + char *names[] = {"ID", NULL}; + char *parts[1]; + parts[0] = search_ids[mp]; + data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); + if(status == 200) + { + if(data) + { + if(!strcmp(data, "Up")) + { + svf_myvote = 1; + } + else if(!strcmp(data, "Down")) + { + svf_myvote = -1; + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + } + else + { + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + } + } + else + error_ui(vid_buf, status, http_ret_text(status)); + + if(data) + free(data); + goto finish; + } + + if(!last) + { + search = 1; + } + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) + { + search = 1; + if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) + { + search_page = 0; + page_count = 0; + } + free(last); + last = NULL; + } + else + search = 0; + + if(search && lasttime>=TIMEOUT) + { + lasttime = 0; + last = mystrdup(ed.str); + last_own = search_own; + last_date = search_date; + last_page = search_page; + active = 1; + uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); + if(search_own || svf_admin || svf_mod) + tmp = "&ShowVotes=true"; + else + tmp = ""; + if(!search_own && !search_date && !*last) + { + if(search_page) + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); + } + else + { + exp_res = GRID_X*GRID_P; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); + } + } + else + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); + } + strcaturl(uri, last); + if(search_own) + { + strcaturl(uri, " user:"); + strcaturl(uri, svf_user); + } + if(search_date) + strcaturl(uri, " sort:date"); + + http = http_async_req_start(http, uri, NULL, 0, 1); + if(svf_login) + { + http_auth_headers(http, svf_user, svf_pass); + } + http_last_use = time(NULL); + free(uri); + } + + if(active && http_async_req_status(http)) + { + http_last_use = time(NULL); + results = http_async_req_stop(http, &status, NULL); + view_own = last_own; + if(status == 200) + { + page_count = search_results(results, last_own||svf_admin||svf_mod); + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + } + is_p1 = (exp_res < GRID_X*GRID_Y); + free(results); + active = 0; + } + + if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) + { + http_async_req_close(http); + http = NULL; + } + + for(i=0; i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) + { + if(stamp_page) + { + stamp_page --; + } + sdl_wheel = 0; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; +} + +void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) +{ + char t[2]; + t[0] = ch; + t[1] = 0; + if(flag) + { + fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); + } + else + { + drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); + } +} + +void render_signs(pixel *vid_buf) +{ + int i, j, x, y, w, h, dx, dy; + char buff[30]; //Buffer + for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature + else + sprintf(buff, "Temp: 0.00"); //...tempirature + drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); + } + + //Usual text + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); + x = signs[i].x; + y = signs[i].y; + dx = 1 - signs[i].ju; + dy = (signs[i].y > 18) ? -1 : 1; + for(j=0; j<4; j++) + { + drawpixel(vid_buf, x, y, 192, 192, 192, 255); + x+=dx; + y+=dy; + } + } +} + +void add_sign_ui(pixel *vid_buf, int mx, int my) +{ + int i, w, h, x, y, nm=0, ju; + int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; + ui_edit ed; + + // check if it is an existing sign + for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) + break; + } + // else look for empty spot + if(i >= MAXSIGNS) + { + nm = 1; + for(i=0; i= MAXSIGNS) + return; + + if(nm) + { + signs[i].x = mx; + signs[i].y = my; + signs[i].ju = 1; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = x0+25; + ed.y = y0+25; + ed.w = 158; + ed.nx = 1; + ed.def = "[message]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(signs[i].text); + strcpy(ed.str, signs[i].text); + ju = signs[i].ju; + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed); + drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); + draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); + draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); + draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); + + if(!nm) + { + drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); + drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); + drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); + } + + drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) + ju = 0; + if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) + ju = 1; + if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) + ju = 2; + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) + { + signs[i].text[0] = 0; + return; + } + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + { + if(!ed.focus) + return; + ed.focus = 0; + } + } + + strcpy(signs[i].text, ed.str); + signs[i].ju = ju; +} + +/*********************************************************** + * CONFIG FILE * + ***********************************************************/ + +char http_proxy[256] = ""; + +void save_string(FILE *f, char *str) +{ + int li = strlen(str); + unsigned char lb[2]; + lb[0] = li; + lb[1] = li >> 8; + fwrite(lb, 2, 1, f); + fwrite(str, li, 1, f); +} + +int load_string(FILE *f, char *str, int max) +{ + int li; + unsigned char lb[2]; + fread(lb, 2, 1, f); + li = lb[0] | (lb[1] << 8); + if(li > max) + { + str[0] = 0; + return 1; + } + fread(str, li, 1, f); + str[li] = 0; + return 0; +} + +unsigned char last_major=0, last_minor=0, update_flag=0; + +void save_presets(int do_update) +{ + FILE *f=fopen("powder.def", "wb"); + unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; + unsigned char tmp = sdl_scale; + if(!f) + return; + fwrite(sig, 1, 4, f); + save_string(f, svf_user); + save_string(f, svf_pass); + fwrite(&tmp, 1, 1, f); + tmp = cmode; + fwrite(&tmp, 1, 1, f); + tmp = svf_admin; + fwrite(&tmp, 1, 1, f); + tmp = svf_mod; + fwrite(&tmp, 1, 1, f); + save_string(f, http_proxy); + tmp = SAVE_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = MINOR_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = do_update; + fwrite(&tmp, 1, 1, f); + fclose(f); +} + +void load_presets(void) +{ + FILE *f=fopen("powder.def", "rb"); + unsigned char sig[4], tmp; + if(!f) + return; + fread(sig, 1, 4, f); + if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) + { + if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) + { + if(fseek(f, -3, SEEK_END)) + { + remove("powder.def"); + return; + } + if(fread(sig, 1, 3, f) != 3) + { + remove("powder.def"); + goto fail; + } + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; + } + fclose(f); + remove("powder.def"); + return; + } + if(load_string(f, svf_user, 63)) + goto fail; + if(load_string(f, svf_pass, 63)) + goto fail; + svf_login = !!svf_user[0]; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + sdl_scale = (tmp == 2) ? 2 : 1; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + cmode = tmp%7; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_admin = tmp; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_mod = tmp; + if(load_string(f, http_proxy, 255)) + goto fail; + if(fread(sig, 1, 3, f) != 3) + goto fail; + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; +fail: + fclose(f); +} + +void dim_copy(pixel *dst, pixel *src) +{ + int i,r,g,b; + for(i=0; i0) + r--; + if(g>0) + g--; + if(b>0) + b--; + dst[i] = PIXRGB(r,g,b); + } +} + +unsigned int fire_alpha[CELL*3][CELL*3]; +void prepare_alpha(void) +{ + int x,y,i,j; + float temp[CELL*3][CELL*3]; + memset(temp, 0, sizeof(temp)); + for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; + fire_g[j][i] = g>4 ? g-4 : 0; + fire_b[j][i] = b>4 ? b-4 : 0; + } +} + +int zoom_en = 0; +int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; +int zoom_wx=0, zoom_wy=0; +void render_zoom(pixel *img) +{ + int x, y, i, j; + pixel pix; + drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); + drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); + clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); + for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) + { + xor_pixel(x+i, y+j, vid); + if(j) xor_pixel(x+i, y-j, vid); + if(i) xor_pixel(x-i, y+j, vid); + if(i&&j) xor_pixel(x-i, y-j, vid); + } + } + else + { + int tc; + c = (r/CELL) * CELL; + x = (x/CELL) * CELL; + y = (y/CELL) * CELL; + + tc = !((c%(CELL*2))==0); + + x -= c/2; + y -= c/2; + + x += tc*(CELL/2); + y += tc*(CELL/2); + + for(i=0; i2) + { + pthread_t pth; + pthread_create(&pth,NULL,update_air_th,""); + } + else + { + update_air(); + } +#else + update_air(); +#endif + } + if(cmode==0 || cmode==1) + { + draw_air(vid_buf); + } + else if(cmode==2) + { + memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); + memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); + } + else + { + memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + } + update_particles(vid_buf); + + if(cmode==2) + { + if(!fire_fc) + { + dim_copy(fire_bg, vid_buf); + } + else + { + memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); + } + fire_fc = (fire_fc+1) % 3; + } + if(cmode==3||cmode==4||cmode==6) + render_fire(vid_buf); + + render_signs(vid_buf); + + memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); + clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); + + draw_svf_ui(vid_buf); + + if(http_ver_check) + { + if(!do_check && http_async_req_status(http_ver_check)) + { + ver_data = http_async_req_stop(http_ver_check, &http_ret, NULL); + if(http_ret==200 && ver_data) + { +#ifdef BETA + if(sscanf(ver_data, "%d.%d.%d", &major, &minor, &is_beta)==3) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) + old_version = 1; +#else + if(sscanf(ver_data, "%d.%d", &major, &minor)==2) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) + old_version = 1; +#endif + free(ver_data); + } + http_ver_check = NULL; + } + do_check = (do_check+1) & 15; + } + + if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) + { + if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) + { + break; + } + } + if(sdl_key=='d') + { + death = !(death); + } + if(sdl_key=='f') + { + framerender = 1; + } + if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) + { + if(load_mode) + { + free(load_img); + free(load_data); + load_mode = 0; + load_data = NULL; + load_img = NULL; + } + if(it > 50) + it = 50; + if(sdl_key=='k' && stamps[1].name[0]) + { + j = stamp_ui(vid_buf); + if(j>=0) + load_data = stamp_load(j, &load_size); + else + load_data = NULL; + } + else + load_data = stamp_load(0, &load_size); + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + if(sdl_key=='s') + { + if(it > 50) + it = 50; + save_mode = 1; + } + if(sdl_key=='1') + { + set_cmode(0); + } + if(sdl_key=='2') + { + set_cmode(1); + } + if(sdl_key=='3') + { + set_cmode(2); + } + if(sdl_key=='4') + { + set_cmode(3); + } + if(sdl_key=='5') + { + set_cmode(4); + } + if(sdl_key=='6') + { + set_cmode(5); + } + if(sdl_key=='7') + { + set_cmode(6); + } + if(sdl_key==SDLK_SPACE) + sys_pause = !sys_pause; + if(sdl_key=='h') + hud_enable = !hud_enable; + if(sdl_key=='p') + dump_frame(vid_buf, XRES, YRES, XRES); + if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + if(clipboard_ready==1) + { + load_data = malloc(clipboard_length); + memcpy(load_data, clipboard_data, clipboard_length); + load_size = clipboard_length; + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + } + if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 2; + } + if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 1; + } + else if(sdl_key=='c') + { + set_cmode((cmode+1) % 7); + if(it > 50) + it = 50; + } + if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo + { + int cbx, cby, cbi; + + for(cbi=0; cbi32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + sdl_wheel = 0; + } + else + { + bs += sdl_wheel; + if(bs>1224) + bs = 1224; + if(bs<0) + bs = 0; + sdl_wheel = 0; + /*if(su >= PT_NUM) { + if(sl < PT_NUM) + su = sl; + if(sr < PT_NUM) + su = sr; + }*/ + } + } + + bq = b; + b = SDL_GetMouseState(&x, &y); + + for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy + && x0 && y0 && x>8)>=NPART || !cr)) + { +#ifdef BETA + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); +#else + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); +#endif + } + else + { + sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + } + } + mx = x; + my = y; + if(update_flag) + { + info_box(vid_buf, "Finalizing update..."); + if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) + { + update_cleanup(); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + { + if(update_finish()) + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + else + info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); + } + update_flag = 0; + } + + if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && + x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) + { + tmp = malloc(64); +#ifdef BETA + if(is_beta) + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); + } + else + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); + } +#else + sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); +#endif + if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) + { + free(tmp); + tmp = download_ui(vid_buf, my_uri, &i); + if(tmp) + { + save_presets(1); + if(update_start(tmp, i)) + { + update_cleanup(); + save_presets(0); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + return 0; + } + } + else + free(tmp); + } + if(y>=sdl_scale*(YRES+(MENUSIZE-20))) + { + if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) + { + db = (svf_myvote==1) ? 273 : 274; + if(da < 51) + da ++; + } + else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) + { + db = svf_own ? 257 : 256; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) + { + db = 270; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) + { + db = 266; + if(da < 51) + da ++; + } + else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) + { + db = 259; + if(svf_open && svf_own && x<=55*sdl_scale) + db = 258; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) + { + db = svf_login ? 261 : 260; + if(svf_admin) + { + db = 268; + } + else if(svf_mod) + { + db = 271; + } + if(da < 51) + da ++; + } + else if(x>=sdl_scale && x<=17*sdl_scale) + { + db = 262; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) + { + db = sys_pause ? 264 : 263; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) + { + db = 267; + if(da < 51) + da ++; + } + else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) + { + db = 265; + if(da < 51) + da ++; + } + else if(da > 0) + da --; + } + else if(da > 0) + da --; + + if(!sdl_zoom_trig && zoom_en==1) + zoom_en = 0; + + if(sdl_key==Z_keysym && zoom_en==2) + zoom_en = 1; + + if(load_mode) + { + load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); + load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); + if(load_x+load_w>XRES) load_x=XRES-load_w; + if(load_y+load_h>YRES) load_y=YRES-load_h; + if(load_x<0) load_x=0; + if(load_y<0) load_y=0; + if(bq==1 && !b) + { + parse_save(load_data, load_size, 0, load_x, load_y); + free(load_data); + free(load_img); + load_mode = 0; + } + else if(bq==4 && !b) + { + free(load_data); + free(load_img); + load_mode = 0; + } + } + else if(save_mode==1) + { + save_x = (mx/sdl_scale)/CELL; + save_y = (my/sdl_scale)/CELL; + if(save_x >= XRES/CELL) save_x = XRES/CELL-1; + if(save_y >= YRES/CELL) save_y = YRES/CELL-1; + save_w = 1; + save_h = 1; + if(b==1) + { + save_mode = 2; + } + else if(b==4) + { + save_mode = 0; + copy_mode = 0; + } + } + else if(save_mode==2) + { + save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; + save_h = (my/sdl_scale+CELL/2)/CELL - save_y; + if(save_w>XRES/CELL) save_w = XRES/CELL; + if(save_h>YRES/CELL) save_h = YRES/CELL; + if(save_w<1) save_w = 1; + if(save_h<1) save_h = 1; + if(!b) + { + if(copy_mode==1) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + } + else if(copy_mode==2) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + } + else + { + stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + save_mode = 0; + } + } + } + else if(sdl_zoom_trig && zoom_en<2) + { + x /= sdl_scale; + y /= sdl_scale; + x -= ZSIZE/2; + y -= ZSIZE/2; + if(x<0) x=0; + if(y<0) y=0; + if(x>XRES-ZSIZE) x=XRES-ZSIZE; + if(y>YRES-ZSIZE) y=YRES-ZSIZE; + zoom_x = x; + zoom_y = y; + zoom_wx = (x 50) + it = 50; + x /= sdl_scale; + y /= sdl_scale; + if(y>=YRES+(MENUSIZE-20)) + { + if(!lb) + { + if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Up")) + { + svf_myvote = 1; + } + } + if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Down")) + { + svf_myvote = -1; + } + } + if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) + tag_list_ui(vid_buf); + if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) + { + legacy_enable = !legacy_enable; + } + if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) + { + memset(signs, 0, sizeof(signs)); + memset(pv, 0, sizeof(pv)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(fvx, 0, sizeof(fvx)); + memset(fvy, 0, sizeof(fvy)); + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(parts, 0, sizeof(particle)*NPART); + for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) + { + login_ui(vid_buf); + if(svf_login) + save_presets(0); + } + if(x>=37 && x<=187 && svf_login) + { + if(!svf_open || !svf_own || x>51) + { + if(save_name_ui(vid_buf)) + execute_save(vid_buf); + } + else + execute_save(vid_buf); + while(!sdl_poll()) + if(!SDL_GetMouseState(&x, &y)) + break; + b = bq = 0; + } + if(x>=1 && x<=17) + { + search_ui(vid_buf); + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + } + if(x>=19 && x<=35 && svf_last && svf_open) + parse_save(svf_last, svf_lsize, 1, 0, 0); + if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) + { + if(b & SDL_BUTTON_LMASK) + set_cmode((cmode+1) % 7); + if(b & SDL_BUTTON_RMASK) + set_cmode((cmode+6) % 7); + save_presets(0); + } + if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) + sys_pause = !sys_pause; + lb = 0; + } + } + else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) + { + c = sl = cr&0xFF; + } + else + { + //Something + } + } + lx = x; + ly = y; + lb = 0; + lm = 0; + } + else + { + //Copy state before drawing any particles (for undo)7 + int cbx, cby, cbi; + + for(cbi=0; cbi=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) + create_line(lx, ly, x, y, bs, c); + } + else + create_box(lx, ly, x, y, c); + lm = 0; + } + lb = 0; + } + + if(load_mode) + { + draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); + xor_rect(vid_buf, load_x, load_y, load_w, load_h); + } + + if(save_mode) + { + xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + da = 51; + db = 269; + } + + if(zoom_en!=1 && !load_mode && !save_mode) + { + render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); + mousex = mx/sdl_scale; + mousey = my/sdl_scale; + } + + if(zoom_en) + render_zoom(vid_buf); + + if(da) + switch(db) + { + case 256: + drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); + break; + case 257: + drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); + break; + case 258: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); + break; + case 259: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); + break; + case 260: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); + break; + case 261: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); + break; + case 262: + drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); + break; + case 263: + drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); + break; + case 264: + drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); + break; + case 265: + drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); + break; + case 266: + drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); + break; + case 267: + drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); + break; + case 268: + drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); + break; + case 269: + drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); + break; + case 270: + drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); + break; + case 271: + drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); + break; + case 272: + drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); + break; + case 273: + drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); + break; + case 274: + drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); + break; + case 275: + drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); + break; + default: + drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); + } + if(itc) + { + itc--; + drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); + } + if(it) + { + it--; + drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); + } + + if(old_version) + { + clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); +#ifdef BETA + if(is_beta) + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); + } + else + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); + } +#else + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); +#endif + drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); + } + + if(hud_enable) + { + currentTime = SDL_GetTicks(); + if(currentTime-past>=16) + { + past = SDL_GetTicks(); + FPS++; + } + if(currentTime-pastFPS>=1000) + { +#ifdef BETA + sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#else + sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#endif + FPSB = FPS; + FPS = 0; + pastFPS = currentTime; + } + if(sdl_zoom_trig||zoom_en) + { + if(zoom_x Date: Sun, 22 Aug 2010 16:55:07 -0400 Subject: Added new element PT_INWR diff --git a/powder.c b/powder.c index 0191eab..f4161da 100644 --- a/powder.c +++ b/powder.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -598,7 +598,8 @@ struct menu_section msections[] = #define PT_STKM 55 #define PT_SWCH 56 #define PT_SMKE 57 -#define PT_NUM 58 +#define PT_INWR 58 +#define PT_NUM 59 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -671,6 +672,7 @@ const struct part_type ptypes[] = {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, }; #define ST_NONE 0 @@ -738,6 +740,7 @@ const struct part_state pstates[] = /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static const unsigned char can_move[PT_NUM][PT_NUM] = { @@ -745,68 +748,69 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ - /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S*/ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M*/ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K*/ - /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n m l l m d N d s n a r m d e E y y M H E*/ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1}, - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - /* OILL */ {0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, - /* NBLE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* BTRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* LCRY */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* STKM */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0}, + /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L F B W R L H S G C B T P E N N B L S S S I*/ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N o H H b R S a l s G h l t i B t C T W M N*/ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 a o o d b C n a c l d s r c L r r K C K W*/ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w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,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0}, + /* INWR */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, }; #define FLAG_STAGNANT 1 @@ -1014,7 +1018,8 @@ inline int create_part(int p, int x, int y, int t) (pmap[y][x]&0xFF)!=PT_LRBD && (pmap[y][x]&0xFF)!=PT_ETRD && (pmap[y][x]&0xFF)!=PT_BRMT && - (pmap[y][x]&0xFF)!=PT_NBLE) + (pmap[y][x]&0xFF)!=PT_NBLE && + (pmap[y][x]&0xFF)!=PT_INWR) return -1; parts[pmap[y][x]>>8].type = PT_SPRK; parts[pmap[y][x]>>8].life = 4; @@ -1388,7 +1393,7 @@ void update_particles_i(pixel *vid, int start, int inc) { if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) parts[i].life--; - if(parts[i].life<=0 && t!=PT_METL && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_HSCN && t!=PT_CSCN && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY) + if(parts[i].life<=0 && t!=PT_METL && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_HSCN && t!=PT_CSCN && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR) { kill_part(i); continue; @@ -1722,7 +1727,7 @@ void update_particles_i(pixel *vid, int start, int inc) pt = parts[i].temp -= 2.5f; } - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE) + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) { nx = x % CELL; if(nx == 0) @@ -1740,7 +1745,7 @@ void update_particles_i(pixel *vid, int start, int inc) ny = y/CELL; if(nx>=0 && ny>=0 && nx>8)>=NPART || !r) continue; - if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) && parts[r>>8].ctype!=PT_SPRK ) + if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) { t = parts[i].type = PT_NONE; parts[r>>8].ctype = parts[r>>8].type; @@ -1820,7 +1825,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if(t==PT_HSCN||t==PT_CSCN) + else if(t==PT_HSCN||t==PT_CSCN||t==PT_INWR) { for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) @@ -2148,7 +2153,7 @@ void update_particles_i(pixel *vid, int start, int inc) continue; rt = parts[r>>8].type; if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH)) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { parts[r>>8].type = PT_FIRE; @@ -2162,7 +2167,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(lpv < 1) lpv = 1; if(legacy_enable) { - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT)) && + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && ptypes[rt].meltable*lpv>(rand()%1000)) { if(t!=PT_LAVA || parts[i].life>0) @@ -2237,12 +2242,12 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) + if(!(rt==PT_PSCN&&parts[i].ctype==PT_NSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp>=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) { parts[r>>8].type = PT_SPRK; parts[r>>8].life = 4; parts[r>>8].ctype = rt; - if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN)) + if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN||rt==PT_INWR)) parts[r>>8].temp = parts[r>>8].temp+10.0f; } } @@ -2266,7 +2271,17 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].ctype = rt; } } - if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + if(t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; -- cgit v0.9.2-21-gd62e From 98835f22596f6455e546cd400b12cc928cd7550a Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 23 Aug 2010 17:40:31 -0400 Subject: fix gravity diff --git a/powder.c b/powder.c index 6db7f0f..6e49a49 100644 --- a/powder.c +++ b/powder.c @@ -1531,47 +1531,48 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; } else { parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - if(gravityd == 1) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] - ptypes[t].gravity; - } - if(gravityd == 2) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - if(gravityd == 3) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + ptypes[t].gravity; - } - if(gravityd == 4) - { - parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; - } - if(gravityd == 5) - { - parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL]; - } - if(gravityd == 6) - { - parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - if(gravityd == 7) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] - ptypes[t].gravity; - } - if(gravityd == 8) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; - } - if(gravityd == 9) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + ptypes[t].gravity; - } - } + if(gravityd == 1) //gravity control stuff + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] - ptypes[t].gravity; + } + if(gravityd == 2) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + if(gravityd == 3) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + ptypes[t].gravity; + } + if(gravityd == 4) + { + parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; + } + if(gravityd == 5) + { + parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + } + if(gravityd == 6) + { + parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + if(gravityd == 7) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] - ptypes[t].gravity; + } + if(gravityd == 8) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; + } + if(gravityd == 9) + { + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + ptypes[t].gravity; + } + } if(ptypes[t].diffusion) { -- cgit v0.9.2-21-gd62e From eb063c8e079cef33dad927a3581af7252c593a7f Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 23 Aug 2010 17:55:17 -0400 Subject: made PT_HSCN and PT_CSCN PT_NTCT and PT_PTCT respectfully diff --git a/powder.c b/powder.c index 6e49a49..5ecf8e6 100644 --- a/powder.c +++ b/powder.c @@ -583,10 +583,10 @@ struct menu_section msections[] = #define PT_WHOL 40 #define PT_RBDM 41 #define PT_LRBD 42 -#define PT_HSCN 43 +#define PT_NTCT 43 #define PT_SAND 44 #define PT_GLAS 45 -#define PT_CSCN 46 +#define PT_PTCT 46 #define PT_BGLA 47 #define PT_THDR 48 #define PT_PLSM 49 @@ -1034,8 +1034,8 @@ inline int create_part(int p, int x, int y, int t) if((pmap[y][x]&0xFF)!=PT_METL && (pmap[y][x]&0xFF)!=PT_PSCN && (pmap[y][x]&0xFF)!=PT_NSCN && - (pmap[y][x]&0xFF)!=PT_HSCN && - (pmap[y][x]&0xFF)!=PT_CSCN && + (pmap[y][x]&0xFF)!=PT_NTCT && + (pmap[y][x]&0xFF)!=PT_PTCT && (pmap[y][x]&0xFF)!=PT_WATR && (pmap[y][x]&0xFF)!=PT_SLTW && (pmap[y][x]&0xFF)!=PT_BMTL && @@ -1427,7 +1427,7 @@ void update_particles_i(pixel *vid, int start, int inc) { if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) parts[i].life--; - if(parts[i].life<=0 && t!=PT_METL && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_HSCN && t!=PT_CSCN && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR) + if(parts[i].life<=0 && t!=PT_METL && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR) { kill_part(i); continue; @@ -1813,16 +1813,16 @@ void update_particles_i(pixel *vid, int start, int inc) pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); } } - if(t==PT_CSCN&&parts[i].temp>24.0f) + if(t==PT_PTCT&&parts[i].temp>24.0f) { pt = parts[i].temp -= 2.5f; } - if(t==PT_HSCN&&parts[i].temp>24.0f) + if(t==PT_NTCT&&parts[i].temp>24.0f) { pt = parts[i].temp -= 2.5f; } - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_HSCN || t==PT_CSCN || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_NTCT || t==PT_PTCT || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) { nx = x % CELL; if(nx == 0) @@ -1840,7 +1840,7 @@ void update_particles_i(pixel *vid, int start, int inc) ny = y/CELL; if(nx>=0 && ny>=0 && nx>8)>=NPART || !r) continue; - if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_HSCN || (r&0xFF)==PT_CSCN || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) + if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) { t = parts[i].type = PT_NONE; parts[r>>8].ctype = parts[r>>8].type; @@ -1920,7 +1920,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if(t==PT_HSCN||t==PT_CSCN||t==PT_INWR) + else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) { for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) @@ -2254,7 +2254,7 @@ void update_particles_i(pixel *vid, int start, int inc) continue; rt = parts[r>>8].type; if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { parts[r>>8].type = PT_FIRE; @@ -2268,7 +2268,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(lpv < 1) lpv = 1; if(legacy_enable) { - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_HSCN && rt!=PT_CSCN && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && ptypes[rt].meltable*lpv>(rand()%1000)) { if(t!=PT_LAVA || parts[i].life>0) @@ -2343,29 +2343,29 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_HSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_CSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) + if(!(rt==PT_PSCN&&parts[i].ctype==PT_NSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp>=100.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) { parts[r>>8].type = PT_SPRK; parts[r>>8].life = 4; parts[r>>8].ctype = rt; - if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_HSCN||rt==PT_CSCN||rt==PT_INWR)) + if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) parts[r>>8].temp = parts[r>>8].temp+10.0f; } } - if(t==PT_SPRK && rt==PT_HSCN && parts[r>>8].life==0 && + if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) + if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_NTCT||(parts[i].ctype==PT_PSCN&&parts[r>>8].temp>100.0f))&&pavg != PT_INSL) { parts[r>>8].type = PT_SPRK; parts[r>>8].life = 4; parts[r>>8].ctype = rt; } } - if(t==PT_SPRK && rt==PT_CSCN && parts[r>>8].life==0 && + if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) + if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_PTCT||(parts[i].ctype==PT_PSCN&&parts[r>>8].temp<100.0f))&&pavg != PT_INSL) { parts[r>>8].type = PT_SPRK; parts[r>>8].life = 4; -- cgit v0.9.2-21-gd62e From 26c7944d64010f18eded8eef2a922de98271bb99 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 24 Aug 2010 12:32:37 -0400 Subject: changed LOX to LO2 diff --git a/powder.c b/powder.c index 5ecf8e6..db9dcae 100644 --- a/powder.c +++ b/powder.c @@ -601,7 +601,7 @@ struct menu_section msections[] = #define PT_PLAS 58 #define PT_DESL 59 #define PT_COAL 60 -#define PT_LOX 61 +#define PT_LO2 61 #define PT_O2 62 #define PT_INWR 63 #define PT_NUM 64 @@ -680,7 +680,7 @@ const struct part_type ptypes[] = {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.0f * CFDS, 0, 0, 0, 1, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0.01f, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f, 200, "Solid. Burns slowly."}, - {"LOX", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 5.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Oxygen helps make things burn."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description @@ -754,8 +754,8 @@ const struct part_state pstates[] = /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OILL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 62.0f}, /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, - /* LOX */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, -180.0f, PT_NONE, 0.0f}, - /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LOX, -190.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, -180.0f, PT_NONE, 0.0f}, + /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, -190.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static const unsigned char can_move[PT_NUM][PT_NUM] = @@ -829,7 +829,7 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = /* PLAS */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Plas */ /* DESL */ {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Desl */ /* COAL */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Coal */ -/* LOX */ {0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0}, /* LOX */ +/* LO2 */ {0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0}, /* LO2 */ /* O2 */ {0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0}, /* O2 */ /* INWR */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* INWR */ /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O*/ -- cgit v0.9.2-21-gd62e From 5e032885a247a6a0141e3ea725fa78bb6c07f1a3 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 24 Aug 2010 19:58:17 +0100 Subject: Fix everything diff --git a/powder.c b/powder.c index db9dcae..abc9404 100644 --- a/powder.c +++ b/powder.c @@ -151,7 +151,7 @@ float mheat = 0.0f; int do_open = 0; int sys_pause = 0; int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. -int death = 1, gravityd = 2, framerender = 0; +int death = 1, framerender = 0; int amd = 1; unsigned char fire_r[YRES/CELL][XRES/CELL]; @@ -710,7 +710,7 @@ const struct part_state pstates[] = /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_COAL, 300.0f, PT_FIRE, 600.0f}, + /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 300.0f}, @@ -1411,17 +1411,8 @@ void update_particles_i(pixel *vid, int start, int inc) ly = parts[i].y; t = parts[i].type; - if(sys_pause) - { - if(framerender) - { - sys_pause = 0; - } - else - { - goto justdraw; - } - } + if(sys_pause&&!framerender) + goto justdraw; if(parts[i].life && t!=PT_ACID && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM) { @@ -1525,52 +1516,13 @@ void update_particles_i(pixel *vid, int start, int inc) } else { - if(t==PT_PLAS && pv[y/CELL][x/CELL]>25.0f) - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - } else { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - if(gravityd == 1) //gravity control stuff - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] - ptypes[t].gravity; - } - if(gravityd == 2) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - if(gravityd == 3) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + ptypes[t].gravity; - } - if(gravityd == 4) - { - parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; - } - if(gravityd == 5) + if(t==PT_PLAS && pv[y/CELL][x/CELL]>25.0f) { - parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - } - if(gravityd == 6) - { - parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - if(gravityd == 7) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] - ptypes[t].gravity; - } - if(gravityd == 8) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; - } - if(gravityd == 9) - { - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity; - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + ptypes[t].gravity; + } else { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; } } @@ -1640,27 +1592,19 @@ void update_particles_i(pixel *vid, int start, int inc) { if(t==PT_WTRV && pv[y/CELL][x/CELL]>4.0f) t = parts[i].type = PT_DSTW; - if(t==PT_OILL && pv[y/CELL][x/CELL]>8.0f) - t = parts[i].type = PT_PLAS; if(t==PT_DESL && pv[y/CELL][x/CELL]<-6.0f) t = parts[i].type = PT_GASS; if(t==PT_GASS && pv[y/CELL][x/CELL]>6.0f) t = parts[i].type = PT_DESL; if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) t = parts[i].type = PT_FIRE; - if(t==PT_WOOD && pv[y/CELL][x/CELL]>6.0f) - t = parts[i].type = PT_COAL; } - if(t==PT_OILL && pv[y/CELL][x/CELL]>20.0f) - t = parts[i].type = PT_PLAS; if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f) t = parts[i].type = PT_GASS; if(t==PT_DESL && pv[y/CELL][x/CELL]>50.0f) // Only way I know to make it t = parts[i].type = PT_FIRE; // combust under pressure. if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f) t = parts[i].type = PT_DESL; - if(t==PT_WOOD && pv[y/CELL][x/CELL]>30.0f) - t = parts[i].type = PT_COAL; if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) @@ -3048,7 +2992,7 @@ justdraw: } } } else { - blendpixel(vid, x, y, cr, cg, cb, 255); + blendpixel(vid, nx, ny, cr, cg, cb, 255); } if(cmode==4) @@ -3640,15 +3584,11 @@ justdraw: blendpixel(vid, nx+1, ny+1, R, G, B, 112); blendpixel(vid, nx-1, ny+1, R, G, B, 112); } - } - if(framerender == 1) - { - sys_pause = 1; - framerender= 0; - } - - } + if(framerender){ + framerender = 0; + sys_pause = 1; + } } void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) @@ -3949,7 +3889,7 @@ void update_particles(pixel *vid) fire_b[y][x] = cb; } } - if(emap[y][x] && !sys_pause) + if(emap[y][x] && (!sys_pause||framerender)) emap[y][x] --; } } @@ -4168,7 +4108,7 @@ void update_particles(pixel *vid) fire_b[y][x] = cb; } } - if(emap[y][x] && !sys_pause) + if(emap[y][x] && (!sys_pause||framerender)) emap[y][x] --; } } @@ -4401,42 +4341,6 @@ int sdl_poll(void) { player[0] = (int)(player[0])|0x08; //Go left command } - if(event.key.keysym.sym == SDLK_KP1) //gravity direction commands - { - gravityd = 1; - } - if(event.key.keysym.sym == SDLK_KP2) - { - gravityd = 2; - } - if(event.key.keysym.sym == SDLK_KP3) - { - gravityd = 3; - } - if(event.key.keysym.sym == SDLK_KP4) - { - gravityd = 4; - } - if(event.key.keysym.sym == SDLK_KP5) - { - gravityd = 5; - } - if(event.key.keysym.sym == SDLK_KP6) - { - gravityd = 6; - } - if(event.key.keysym.sym == SDLK_KP7) - { - gravityd = 7; - } - if(event.key.keysym.sym == SDLK_KP8) - { - gravityd = 8; - } - if(event.key.keysym.sym == SDLK_KP9) - { - gravityd = 9; - } if(event.key.keysym.sym == SDLK_UP && ((int)(player[0])&0x04)!=0x04) { player[0] = (int)(player[0])|0x04; //Jump command @@ -10066,7 +9970,7 @@ int main(int argc, char *argv[]) } } - if(!sys_pause) + if(!sys_pause||framerender) { #ifdef MT if(numCores>2) diff --git a/version.h b/version.h index 6e08742..0acf9d0 100755 --- a/version.h +++ b/version.h @@ -22,10 +22,10 @@ #define SAVE_VERSION 41 #define MINOR_VERSION 3 -#define IDENT_VERSION "A" //Change this if you're not Simon! It should be a single letter. +#define IDENT_VERSION "S" //Change this if you're not Simon! It should be a single letter. #define MENUV3 -#define BETA +//#define BETA #define HEAT_ENABLE #endif -- cgit v0.9.2-21-gd62e From 8d089bba50937b572df918c849afc28181f852c6 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 24 Aug 2010 21:01:04 +0100 Subject: Yeast diff --git a/powder.c b/powder.c index abc9404..3bb3b06 100644 --- a/powder.c +++ b/powder.c @@ -604,7 +604,9 @@ struct menu_section msections[] = #define PT_LO2 61 #define PT_O2 62 #define PT_INWR 63 -#define PT_NUM 64 +#define PT_YEST 64 +#define PT_DYST 65 +#define PT_NUM 66 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -616,7 +618,7 @@ static unsigned char TYPE_SOLID = 0x04; //4 static unsigned char TYPE_GAS = 0x08; //8 static unsigned char PROP_CONDUCTS = 0x10; //16 -const struct part_type ptypes[] = +const struct part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, @@ -683,6 +685,8 @@ const struct part_type ptypes[] = {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 5.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Oxygen helps make things burn."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f, 70, "Deat Yeast."}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; @@ -690,7 +694,7 @@ const struct part_type ptypes[] = #define ST_SOLID 1 #define ST_LIQUID 2 #define ST_GAS 3 -const struct part_state pstates[] = +const struct part_state pstates[PT_NUM] = { // Name Solid Frzp Liquid Mpnt Gas Bpoint /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -757,6 +761,8 @@ const struct part_state pstates[] = /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, -180.0f, PT_NONE, 0.0f}, /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, -190.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 60.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static const unsigned char can_move[PT_NUM][PT_NUM] = { @@ -764,78 +770,80 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ -/* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I*/ -/* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2 N*/ -/* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X W*/ -/* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l R*/ -/* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ -/* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0}, /* Dust */ -/* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0}, /* Watr */ -/* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Oill */ -/* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Fire */ -/* STNE */ {0,1,1,1,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, /* Stne */ -/* LAVA */ {0,1,1,1,1,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0}, /* O2 */ -/* INWR */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* INWR */ -/* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O*/ -/* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2*/ -/* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X */ -/* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l */ +/* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y */ +/* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ +/* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X W S*/ +/* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l R T*/ +/* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ +/* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* INWR */ +/* YEST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* YEST */ +/* DYST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* DYST */ +/* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y*/ +/* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ +/* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X W S*/ +/* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l R T*/ }; #define FLAG_STAGNANT 1 @@ -1997,6 +2005,22 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_YEST) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_DYST && 1>(rand()%30) && !legacy_enable) + { + t = parts[i].type = PT_DYST; + } + } + } else if(t==PT_ACID) { for(nx=-2; nx<3; nx++) @@ -2061,6 +2085,15 @@ void update_particles_i(pixel *vid, int start, int inc) } if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) parts[r>>8].type = PT_DUST; + if((r&0xFF)==PT_DYST && 15>(rand()%1000)) + parts[r>>8].type = PT_YEST; + if((r&0xFF)==PT_YEST){ + if(15>(rand()%100000)&&isplayer==0) + parts[r>>8].type = PT_STKM; + else + parts[r>>8].type = PT_DYST; + } + if((r&0xFF)==PT_WATR && 15>(rand()%100)) parts[r>>8].type = PT_DSTW; if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) @@ -2752,6 +2785,12 @@ killed: else create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); } + if(t==PT_YEST) + { + if(parts[i].temp>30&&parts[i].temp<44){ + create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST); + } + } if(t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1) { parts[i].type = PT_NBLE; -- cgit v0.9.2-21-gd62e From 470519c92ed917b41c6ccae2e193eb59bdfe2ece Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 25 Aug 2010 12:22:41 +0100 Subject: Seperation WIP diff --git a/air.h b/air.h new file mode 100644 index 0000000..add56b0 --- /dev/null +++ b/air.h @@ -0,0 +1,14 @@ +#ifndef AIR_H +#define AIR_H + +float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float cb_vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float cb_vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float cb_pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; + +#endif \ No newline at end of file diff --git a/defines.h b/defines.h new file mode 100644 index 0000000..b08407f --- /dev/null +++ b/defines.h @@ -0,0 +1,35 @@ +#ifndef DEFINE_H +#define DEFINE_H + +#define SERVER "powdertoy.co.uk" + +#undef PLOSS + +#ifdef MENUV3 +#define MENUSIZE 40 +#else +#define MENUSIZE 20 +#endif +#define BARSIZE 14 +#define XRES 612 +#define YRES 384 +#define NPART XRES*YRES + +#define ZSIZE_D 16 +#define ZFACTOR_D 8 +static unsigned char ZFACTOR = 256/ZSIZE_D; +static unsigned char ZSIZE = ZSIZE_D; + +#define CELL 4 +#define ISTP (CELL/2) +#define CFDS (4.0f/CELL) + +#define TSTEPP 0.3f +#define TSTEPV 0.4f +#define VADV 0.3f +#define VLOSS 0.999f +#define PLOSS 0.9999f + +typedef unsigned char uint8; + +#endif \ No newline at end of file diff --git a/font.h b/font.h index ffed995..018e474 100644 --- a/font.h +++ b/font.h @@ -18,6 +18,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#ifndef FONT_H_CHECK +#define FONT_H_CHECK #define FONT_H 10 char font_data[] = { @@ -26,4 +28,5 @@ char font_data[] = short font_ptrs[] = { 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2, 0x01c0, 0x01ce, 0x01d7, 0x01e5, 0x01f5, 0x0205, 0x0218, 0x0228, 0x0231, 0x023c, 0x0247, 0x0257, 0x0267, 0x0272, 0x0280, 0x0289, 0x0299, 0x02a9, 0x02b7, 0x02c7, 0x02d7, 0x02e7, 0x02f7, 0x0307, 0x0317, 0x0327, 0x0337, 0x0340, 0x034b, 0x035b, 0x036b, 0x037b, 0x038b, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x042b, 0x043b, 0x044e, 0x045e, 0x0473, 0x0486, 0x0499, 0x04a9, 0x04bc, 0x04cc, 0x04dc, 0x04ec, 0x04ff, 0x050f, 0x0524, 0x0537, 0x0547, 0x055a, 0x0565, 0x0573, 0x057e, 0x0589, 0x0599, 0x05a2, 0x05b0, 0x05be, 0x05cc, 0x05da, 0x05e8, 0x05f3, 0x0601, 0x060f, 0x061a, 0x0625, 0x0633, 0x063e, 0x064e, 0x065c, 0x066a, 0x0678, 0x0686, 0x068f, 0x069d, 0x06a8, 0x06b6, 0x06c4, 0x06d4, 0x06e2, 0x06f0, 0x06fe, 0x0709, 0x070f, 0x071a, 0x072a, 0x0735, 0x074a, 0x0769, 0x0788, 0x07a2, 0x07c1, 0x07db, 0x07f5, 0x080f, 0x0829, 0x0843, 0x085d, 0x0877, 0x0896, 0x08a6, 0x08c0, 0x08da, 0x08f4, 0x090e, 0x0923, 0x0940, 0x095d, 0x097c, 0x099b, 0x09b3, 0x09cb, 0x09e3, 0x09fb, 0x0a13, 0x0a2b, 0x0a43, 0x0a5b, 0x0a73, 0x0a8b, 0x0aa3, 0x0abd, 0x0ada, 0x0af7, 0x0b0c, 0x0b26, 0x0b40, 0x0b5a, 0x0b74, 0x0b8c, 0x0b97, 0x0ba0, 0x0ba9, 0x0bb7, 0x0bc5, 0x0bd3, 0x0be1, 0x0bef, 0x0bfd, 0x0c0b, 0x0c19, 0x0c27, 0x0c35, 0x0c43, 0x0c4e, 0x0c57, 0x0c60, 0x0c6e, 0x0c7e, 0x0c8e, 0x0ca8, 0x0cc2, 0x0cdc, 0x0cf6, 0x0d10, 0x0d2a, 0x0d44, 0x0d5e, 0x0d78, 0x0d92, 0x0dac, 0x0dc6, 0x0de0, 0x0dfa, 0x0e14, 0x0e2e, 0x0e46, 0x0e60, 0x0e7a, 0x0e8a, 0x0e9a, 0x0eaa, 0x0eba, 0x0eca, 0x0eda, 0x0eea, 0x0efa, 0x0f0a, 0x0f1a, 0x0f2a, 0x0f3a, 0x0f4a, 0x0f5a, 0x0f6a, 0x0f7a, 0x0f8a, 0x0f9a, 0x0faa, 0x0fba, 0x0fca, 0x0fda, 0x0fea, 0x0ffa, 0x100a, 0x101a, 0x102a, 0x103a, 0x104a, 0x105a, 0x106a, 0x107a, 0x108a, 0x109a, 0x10aa, 0x10ba, 0x10ca, 0x10da, 0x10ea, 0x10fa, 0x110a, 0x111a, 0x112a, 0x113a, 0x114a, -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/graphics.c b/graphics.c new file mode 100644 index 0000000..4282e5c --- /dev/null +++ b/graphics.c @@ -0,0 +1,1098 @@ +#include "defines.h" +#include "air.h" +#include "powder.h" +#include "graphics.h" +#include "font.h" +#include + +pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f) +{ + int i,j,x,y,w,h,r,g,b,c; + pixel p, *q; + w = (sw+f-1)/f; + h = (sh+f-1)/f; + q = malloc(w*h*PIXELSIZE); + for(y=0; y1) + { + r = (r+c/2)/c; + g = (g+c/2)/c; + b = (b+c/2)/c; + } + q[y*w+x] = PIXRGB(r, g, b); + } + *qw = w; + *qh = h; + return q; +} + +void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0; jpitch/PIXELSIZE; + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} + +void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + int i,k; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0; jpitch/PIXELSIZE; + } + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} + +void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) +{ + if(sdl_scale == 2) + sdl_blit_2(x, y, w, h, src, pitch); + else + sdl_blit_1(x, y, w, h, src, pitch); +} + +void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) +{ + blendpixel(vid, x+1, y, cr, cg, cb, 112); + blendpixel(vid, x-1, y, cr, cg, cb, 112); + blendpixel(vid, x, y+1, cr, cg, cb, 112); + blendpixel(vid, x, y-1, cr, cg, cb, 112); + + blendpixel(vid, x+1, y-1, cr, cg, cb, 64); + blendpixel(vid, x-1, y-1, cr, cg, cb, 64); + blendpixel(vid, x+1, y+1, cr, cg, cb, 64); + blendpixel(vid, x-1, y+1, cr, cg, cb, 64); +} + +void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) +{ + int x, y, i, j, c; + int bo = b; + if(iswall==1) + { + b = b-100; + x = (2+32*((b-22)/1)); + y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + x = 2+32*(b/2); + y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + if(bo==sl || bo==sr) + { + c = 0; + if(bo==sl) + c |= PIXPACK(0xFF0000); + if(bo==sr) + c |= PIXPACK(0x0000FF); + for(i=0; i<30; i++) + { + vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; + } + for(j=0; j<18; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; + } + } +} + +int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) +{ + int i, j, c; + if(b>=121) + { + b = b-100; + //x = (2+32*((b-22)/1)); + //y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + case 40: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + //x = 2+32*(b/2); + //y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + return 26; +} + +void draw_menu(pixel *vid_buf, int i, int hover) +{ + + //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); +#ifdef MENUV3 + drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + if(hover==i) + { + fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + } +#else + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); +#endif +} + +#ifdef WIN32 +_inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#else +inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#endif +{ + pixel t; + if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +#ifdef WIN32 +_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +#else +inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +#endif +{ + int i, j, w, bn = 0, ba = 0; + char *rp = font_data + font_ptrs[c]; + w = *(rp++); + for(j=0; j>= 2; + bn -= 2; + } + return x + w; +} + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) +{ + int sx = x; + for(; *s; s++) + { + if(*s == '\n') + { + x = sx; + y += FONT_H+2; + } + else if(*s == '\b') + { + switch(s[1]) + { + case 'w': + r = g = b = 255; + break; + case 'g': + r = g = b = 192; + break; + case 'o': + r = 255; + g = 216; + b = 32; + break; + case 'r': + r = 255; + g = b = 0; + break; + case 'b': + r = g = 0; + b = 255; + break; + } + s++; + } + else + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + return x; +} + +void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) +{ + int i; + for(i=0; i<=w; i++) + { + drawpixel(vid, x+i, y, r, g, b, a); + drawpixel(vid, x+i, y+h, r, g, b, a); + } + for(i=1; i=w && x+textwidth(s)>=w+5) + break; + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + if(*s) + for(i=0; i<3; i++) + x = drawchar(vid, x, y, '.', r, g, b, a); + return x; +} + +int textnwidth(char *s, int n) +{ + int x = 0; + for(; *s; s++) + { + if(!n) + break; + x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + n--; + } + return x-1; +} + +int textwidthx(char *s, int w) +{ + int x=0,n=0,cw; + for(; *s; s++) + { + cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + if(x+(cw/2) >= w) + break; + x += cw; + n++; + } + return n; +} + +#ifdef WIN32 +_inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#else +inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#endif +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) +{ + char t[2]; + t[0] = ch; + t[1] = 0; + if(flag) + { + fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); + } + else + { + drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); + } +} + +void draw_air(pixel *vid) +{ + int x, y, i, j; + pixel c; + + if(cmode == 2) + return; + + for(y=0; y 0.0f) + c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); + else + c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); + } + else + c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), + clamp_flt(pv[y][x], 0.0f, 8.0f), + clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); + for(j=0; jdx) + { + dx = dx+dy; + dy = dx-dy; + dx = dx-dy; + check = 1; + } + + e = (dy<<2)-dx; + for (i=0; i<=dx; i++) + { + vid[x+y*a] =PIXRGB(r, g, b); + if (e>=0) + { + if (check==1) + x = x+sx; + else + y = y+sy; + e = e-(dx<<2); + } + if (check==1) + y = y+sy; + else + x = x+sx; + e = e+(dy<<2); + } +} + +void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + 255*PIXR(t)) >> 8; + g = (a*g + 255*PIXG(t)) >> 8; + b = (a*b + 255*PIXB(t)) >> 8; + if(r>255) + r = 255; + if(g>255) + g = 255; + if(b>255) + b = 255; + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +void xor_pixel(int x, int y, pixel *vid) +{ + int c; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + c = vid[y*(XRES+BARSIZE)+x]; + c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); + if(c<512) + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); + else + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); +} + +void xor_line(int x1, int y1, int x2, int y2, pixel *vid) +{ + int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + e -= 1.0f; + } + } +} + +void xor_rect(pixel *vid, int x, int y, int w, int h) +{ + int i; + for(i=0; i + +#ifdef PIX16 +#define PIXELSIZE 2 +typedef unsigned short pixel; +#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) +#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) +#define PIXR(x) (((x)>>8)&0xF8) +#define PIXG(x) (((x)>>3)&0xFC) +#define PIXB(x) (((x)<<3)&0xF8) +#else +#define PIXELSIZE 4 +typedef unsigned int pixel; +#ifdef PIX32BGR +#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) +#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) +#define PIXR(x) ((x)&0xFF) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)>>16) +#else +#ifdef PIX32BGRA +#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) +#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) +#define PIXR(x) (((x)>>8)&0xFF) +#define PIXG(x) (((x)>>16)&0xFF) +#define PIXB(x) (((x)>>24)) +#else +#define PIXPACK(x) (x) +#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) +#define PIXR(x) ((x)>>16) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)&0xFF) +#endif +#endif +#endif + +unsigned cmode = 3; +SDL_Surface *sdl_scrn; +int sdl_scale = 1; + +pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f); + +void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch); + +void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch); + +void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch); + +void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb); + +void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall); + +int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc); + +void draw_menu(pixel *vid_buf, int i, int hover); + +#ifdef WIN32 +_inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +#else +inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +#endif + +#ifdef WIN32 +_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); +#else +inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); +#endif + +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); + +void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); + +void fillrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); + +void clearrect(pixel *vid, int x, int y, int w, int h); + +void drawdots(pixel *vid, int x, int y, int h, int r, int g, int b, int a); + +int textwidth(char *s); + +int drawtextmax(pixel *vid, int x, int y, int w, char *s, int r, int g, int b, int a); + +int textnwidth(char *s, int n); + +int textwidthx(char *s, int w); + +#ifdef WIN32 +_inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +#else +inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +#endif + +void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag); + +void draw_air(pixel *vid); + +void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a); + +void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a); + +void xor_pixel(int x, int y, pixel *vid); + +void xor_line(int x1, int y1, int x2, int y2, pixel *vid); + +void xor_rect(pixel *vid, int x, int y, int w, int h); + +#endif \ No newline at end of file diff --git a/interface.h b/interface.h new file mode 100644 index 0000000..dfa0ba6 --- /dev/null +++ b/interface.h @@ -0,0 +1,63 @@ +#ifndef INTERFACE_H +#define INTERFACE_H + +struct menu_section +{ + char *icon; + const char *name; + int itemcount; +}; +struct menu_wall +{ + pixel colour; + const char *descs; +}; + +const struct menu_wall mwalls[] = +{ + {PIXPACK(0xC0C0C0), "Wall. Indestructible. Blocks everything. Conductive."}, + {PIXPACK(0x808080), "E-Wall. Becomes transparent when electricity is connected."}, + {PIXPACK(0xFF8080), "Detector. Generates electricity when a particle is inside."}, + {PIXPACK(0x808080), "Streamline. Set start point of a streamline."}, + {PIXPACK(0x808080), "Sign. Click on a sign to edit it or anywhere else to place a new one."}, + {PIXPACK(0x8080FF), "Fan. Accelerates air. Use line tool to set direction and strength."}, + {PIXPACK(0xC0C0C0), "Wall. Blocks most particles but lets liquids through. Conductive."}, + {PIXPACK(0x808080), "Wall. Absorbs particles but lets air currents through."}, + {PIXPACK(0x808080), "Erases walls."}, + {PIXPACK(0x808080), "Wall. Indestructible. Blocks everything."}, + {PIXPACK(0x3C3C3C), "Wall. Indestructible. Blocks particles, allows air"}, + {PIXPACK(0x575757), "Wall. Indestructible. Blocks liquids and gasses, allows solids"}, + {PIXPACK(0xFFFF22), "Conductor, allows particles, conducts electricity"}, + {PIXPACK(0x242424), "E-Hole, absorbs particles, release them when powered"}, + {PIXPACK(0xFFFFFF), "Air, creates airflow and pressure"}, + {PIXPACK(0xFFBB00), "Heats the targetted element."}, + {PIXPACK(0x00BBFF), "Cools the targetted element."}, + {PIXPACK(0x303030), "Vacuum, reduces air pressure."}, + {PIXPACK(0x579777), "Wall. Indestructible. Blocks liquids and solids, allows gasses"}, +}; + +#define SC_WALL 0 +#define SC_SPECIAL 8 +#define SC_POWDERS 5 +#define SC_SOLIDS 6 +#define SC_ELEC 1 +#define SC_EXPLOSIVE 2 +#define SC_GAS 3 +#define SC_LIQUID 4 +#define SC_NUCLEAR 7 +#define SC_TOTAL 9 + +struct menu_section msections[] = +{ + {"\xC1", "Walls", 0}, + {"\xC2", "Electronics", 0}, + {"\xC3", "Explosives", 0}, + {"\xC5", "Gasses", 0}, + {"\xC4", "Liquids", 0}, + {"\xD0", "Powders", 0}, + {"\xD1", "Solids", 0}, + {"\xC6", "Radioactive", 0}, + {"\xCC", "Special", 0}, +}; + +#endif \ No newline at end of file diff --git a/powder.c b/powder.c index 3bb3b06..63d67ea 100644 --- a/powder.c +++ b/powder.c @@ -37,71 +37,16 @@ #include #endif - +#include "font.h" +#include "defines.h" +#include "powder.h" +#include "graphics.h" #include "version.h" #include "http.h" #include "md5.h" #include "update.h" #include "hmap.h" - -#define SERVER "powdertoy.co.uk" - -#undef PLOSS - -#ifdef MENUV3 -#define MENUSIZE 40 -#else -#define MENUSIZE 20 -#endif -#define BARSIZE 14 -#define XRES 612 -#define YRES 384 -#define NPART XRES*YRES - -#define ZSIZE_D 16 -#define ZFACTOR_D 8 -unsigned char ZFACTOR = 256/ZSIZE_D; -unsigned char ZSIZE = ZSIZE_D; - -#define CELL 4 -#define ISTP (CELL/2) -#define CFDS (4.0f/CELL) - -typedef unsigned char uint8; - -#ifdef PIX16 -#define PIXELSIZE 2 -typedef unsigned short pixel; -#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) -#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) -#define PIXR(x) (((x)>>8)&0xF8) -#define PIXG(x) (((x)>>3)&0xFC) -#define PIXB(x) (((x)<<3)&0xF8) -#else -#define PIXELSIZE 4 -typedef unsigned int pixel; -#ifdef PIX32BGR -#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) -#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) -#define PIXR(x) ((x)&0xFF) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)>>16) -#else -#ifdef PIX32BGRA -#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) -#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) -#define PIXR(x) (((x)>>8)&0xFF) -#define PIXG(x) (((x)>>16)&0xFF) -#define PIXB(x) (((x)>>24)) -#else -#define PIXPACK(x) (x) -#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) -#define PIXR(x) ((x)>>16) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)&0xFF) -#endif -#endif -#endif +#include "air.h" char *it_msg = "\brThe Powder Toy\n" @@ -176,22 +121,6 @@ unsigned char emap[YRES/CELL][XRES/CELL]; unsigned char cb_bmap[YRES/CELL][XRES/CELL]; unsigned char cb_emap[YRES/CELL][XRES/CELL]; -unsigned cmode = 3; - -float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; - -float cb_vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float cb_vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float cb_pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; - -float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; -#define TSTEPP 0.3f -#define TSTEPV 0.4f -#define VADV 0.3f -#define VLOSS 0.999f -#define PLOSS 0.9999f int numCores = 4; float kernel[9]; void make_kernel(void) @@ -378,485 +307,9 @@ inline float restrict_flt(float f, float min, float max) return f; } -void draw_air(pixel *vid) -{ - int x, y, i, j; - pixel c; - - if(cmode == 2) - return; - - for(y=0; y 0.0f) - c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); - else - c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); - } - else - c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), - clamp_flt(pv[y][x], 0.0f, 8.0f), - clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); - for(j=0; j=XRES || y>=YRES) - return; - if(a!=255) - { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - //Signum function #ifdef WIN32 _inline int sign(float i) @@ -1230,64 +664,6 @@ inline int sign(float i) return 0; } -void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a) //Draws a line -{ - int dx, dy, i, sx, sy, check, e, x, y; - - dx = abs(x1-x2); - dy = abs(y1-y2); - sx = sign(x2-x1); - sy = sign(y2-y1); - x = x1; - y = y1; - check = 0; - - if (dy>dx) - { - dx = dx+dy; - dy = dx-dy; - dx = dx-dy; - check = 1; - } - - e = (dy<<2)-dx; - for (i=0; i<=dx; i++) - { - vid[x+y*a] =PIXRGB(r, g, b); - if (e>=0) - { - if (check==1) - x = x+sx; - else - y = y+sy; - e = e-(dx<<2); - } - if (check==1) - y = y+sy; - else - x = x+sx; - e = e+(dy<<2); - } -} - -void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -{ - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + 255*PIXR(t)) >> 8; - g = (a*g + 255*PIXG(t)) >> 8; - b = (a*b + 255*PIXB(t)) >> 8; - if(r>255) - r = 255; - if(g>255) - g = 255; - if(b>255) - b = 255; - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); #ifdef WIN32 @@ -3630,19 +3006,6 @@ justdraw: } } -void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) -{ - blendpixel(vid, x+1, y, cr, cg, cb, 112); - blendpixel(vid, x-1, y, cr, cg, cb, 112); - blendpixel(vid, x, y+1, cr, cg, cb, 112); - blendpixel(vid, x, y-1, cr, cg, cb, 112); - - blendpixel(vid, x+1, y-1, cr, cg, cb, 64); - blendpixel(vid, x-1, y-1, cr, cg, cb, 64); - blendpixel(vid, x+1, y+1, cr, cg, cb, 64); - blendpixel(vid, x-1, y+1, cr, cg, cb, 64); -} - void update_particles_i_th(void *arg) { upstruc *newup = (upstruc*)arg; @@ -4215,8 +3578,6 @@ void update_particles_th(void *arg) * SDL OUTPUT * ***********************************************************/ -int sdl_scale = 1; -SDL_Surface *sdl_scrn; SDLMod sdl_mod; int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; @@ -4261,59 +3622,6 @@ void sdl_open(void) //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); } -void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0; jpitch/PIXELSIZE; - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} - -void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - int i,k; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0; jpitch/PIXELSIZE; - } - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} -void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) -{ - if(sdl_scale == 2) - sdl_blit_2(x, y, w, h, src, pitch); - else - sdl_blit_1(x, y, w, h, src, pitch); -} - int frame_idx=0; void dump_frame(pixel *src, int w, int h, int pitch) { @@ -4490,7 +3798,6 @@ void *build_thumb(int *size, int bzip2) return d; } -void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl) { unsigned char *d,*c=thumb; @@ -5201,6 +4508,7 @@ corrupt: #define STAMP_X 4 #define STAMP_Y 4 #define STAMP_MAX 120 + struct stamp_info { char name[11]; @@ -5272,43 +4580,6 @@ void stamp_update(void) fclose(f); } -pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f) -{ - int i,j,x,y,w,h,r,g,b,c; - pixel p, *q; - w = (sw+f-1)/f; - h = (sh+f-1)/f; - q = malloc(w*h*PIXELSIZE); - for(y=0; y1) - { - r = (r+c/2)/c; - g = (g+c/2)/c; - b = (b+c/2)/c; - } - q[y*w+x] = PIXRGB(r, g, b); - } - *qw = w; - *qh = h; - return q; -} - #define GRID_X 5 #define GRID_Y 4 #define GRID_P 3 @@ -5444,855 +4715,56 @@ void del_stamp(int d) stamp_count = 0; stamp_init(); } -/*********************************************************** - * FONT DRAWING * - ***********************************************************/ - -#include "font.h" - -#ifdef WIN32 -_inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#else -inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#endif -{ - pixel t; - if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) - return; - if(a!=255) - { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -#ifdef WIN32 -_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) -#else -inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) -#endif -{ - int i, j, w, bn = 0, ba = 0; - char *rp = font_data + font_ptrs[c]; - w = *(rp++); - for(j=0; j>= 2; - bn -= 2; - } - return x + w; -} - -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) -{ - int sx = x; - for(; *s; s++) - { - if(*s == '\n') - { - x = sx; - y += FONT_H+2; - } - else if(*s == '\b') - { - switch(s[1]) - { - case 'w': - r = g = b = 255; - break; - case 'g': - r = g = b = 192; - break; - case 'o': - r = 255; - g = 216; - b = 32; - break; - case 'r': - r = 255; - g = b = 0; - break; - case 'b': - r = g = 0; - b = 255; - break; - } - s++; - } - else - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - return x; -} - -void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) -{ - int i; - for(i=0; i<=w; i++) - { - drawpixel(vid, x+i, y, r, g, b, a); - drawpixel(vid, x+i, y+h, r, g, b, a); - } - for(i=1; i=w && x+textwidth(s)>=w+5) - break; - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - if(*s) - for(i=0; i<3; i++) - x = drawchar(vid, x, y, '.', r, g, b, a); - return x; -} + int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; + pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); + fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); -int textnwidth(char *s, int n) -{ - int x = 0; - for(; *s; s++) - { - if(!n) - break; - x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - n--; - } - return x-1; -} -int textwidthx(char *s, int w) -{ - int x=0,n=0,cw; - for(; *s; s++) + while(!sdl_poll()) { - cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - if(x+(cw/2) >= w) + b = SDL_GetMouseState(&mx, &my); + if(!b) break; - x += cw; - n++; } - return n; -} - -/*********************************************************** - * MAIN PROGRAM * - ***********************************************************/ - -void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) -{ - int x, y, i, j, c; - int bo = b; - if(iswall==1) + while(!sdl_poll()) { - b = b-100; - x = (2+32*((b-22)/1)); - y = YRES+2+40; - switch(b) + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + rows = ceil((float)msections[i].itemcount/16.0f); + height = (ceil((float)msections[i].itemcount/16.0f)*18); + width = restrict_flt(msections[i].itemcount*31, 0, 16*31); + //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); + h = -1; + x = XRES-BARSIZE-26; + y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; + sy = y; + //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); + fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); + fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); + drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); + drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); + if(i==SC_WALL) { - case WL_WALLELEC: - for(j=1; j<15; j++) + for(n = 122; n<122+UI_WALLCOUNT; n++) { - for(i=1; i<27; i++) + if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM) { - if(!(i%2) && !(j%2)) + if(x-26<=60) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + x = XRES-BARSIZE-26; + y += 19; } - else + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) - { - for(i=1; i<6+j; i++) - { - if(!(i&j&1)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) - { - if(i&j&1) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) - { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<13; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) - { - for(i=14; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - default: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } - else - { - x = 2+32*(b/2); - y = YRES+2+20*(b%2); - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - if(bo==sl || bo==sr) - { - c = 0; - if(bo==sl) - c |= PIXPACK(0xFF0000); - if(bo==sr) - c |= PIXPACK(0x0000FF); - for(i=0; i<30; i++) - { - vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; - } - for(j=0; j<18; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; - } - } -} - -int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) -{ - int i, j, c; - if(b>=121) - { - b = b-100; - //x = (2+32*((b-22)/1)); - //y = YRES+2+40; - switch(b) - { - case WL_WALLELEC: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - else - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) - { - for(i=1; i<6+j; i++) - { - if(!(i&j&1)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) - { - if(i&j&1) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) - { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<13; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) - { - for(i=14; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - case 40: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - default: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } - else - { - //x = 2+32*(b/2); - //y = YRES+2+20*(b%2); - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - return 26; -} - -void draw_menu(pixel *vid_buf, int i, int hover) -{ - - //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); -#ifdef MENUV3 - drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - if(hover==i) - { - fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); - } -#else - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); -#endif -} - -void menu_ui(pixel *vid_buf, int i, int *sl, int *sr) -{ - int b=1,bq,mx,my,h,x,y,n=0,height,width,sy,rows=0; - pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); - fillrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE, 0, 0, 0, 192); - memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - rows = ceil((float)msections[i].itemcount/16.0f); - height = (ceil((float)msections[i].itemcount/16.0f)*18); - width = restrict_flt(msections[i].itemcount*31, 0, 16*31); - //clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); - h = -1; - x = XRES-BARSIZE-26; - y = (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-(height/2)+(FONT_H/2)+1; - sy = y; - //clearrect(vid_buf, (XRES-BARSIZE-width)+1, y-4, width+4, height+4+rows); - fillrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE-width)-7, y-10, width+16, height+16+rows, 255, 255, 255, 255); - fillrect(vid_buf, (XRES-BARSIZE)+11, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 15, FONT_H+3, 0, 0, 0, 100); - drawrect(vid_buf, (XRES-BARSIZE)+10, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-2, 16, FONT_H+3, 255, 255, 255, 255); - drawrect(vid_buf, (XRES-BARSIZE)+9, (((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2))-1, 1, FONT_H+1, 0, 0, 0, 255); - if(i==SC_WALL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM) - { - if(x-26<=60) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; } else if(n==*sl) { @@ -6875,65 +5347,6 @@ int flood_parts(int x, int y, int c, int cm, int bm) return 1; } -static void xor_pixel(int x, int y, pixel *vid) -{ - int c; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - c = vid[y*(XRES+BARSIZE)+x]; - c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); - if(c<512) - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); - else - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); -} - -void xor_line(int x1, int y1, int x2, int y2, pixel *vid) -{ - int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - e -= 1.0f; - } - } -} - void draw_svf_ui(pixel *vid_buf) { int c; @@ -7061,6 +5474,7 @@ typedef struct ui_edit char str[256],*def; int focus, cursor, hide; } ui_edit; + void ui_edit_draw(pixel *vid_buf, ui_edit *ed) { int cx, i; @@ -7090,8 +5504,10 @@ void ui_edit_draw(pixel *vid_buf, ui_edit *ed) drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); } } + char *shift_0="`1234567890-=[]\\;',./"; char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; + void ui_edit_process(int mx, int my, int mb, ui_edit *ed) { char ch, ts[2], echo[256], *str; @@ -7212,11 +5628,13 @@ void ui_edit_process(int mx, int my, int mb, ui_edit *ed) } } } + typedef struct ui_checkbox { int x, y; int focus, checked; } ui_checkbox; + void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) { int w = 12; @@ -7233,6 +5651,7 @@ void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); } } + void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) { int w = 12; @@ -7475,6 +5894,7 @@ struct strlist char *str; struct strlist *next; }; + void strlist_add(struct strlist **list, char *str) { struct strlist *item = malloc(sizeof(struct strlist)); @@ -7482,6 +5902,7 @@ void strlist_add(struct strlist **list, char *str) item->next = *list; *list = item; } + int strlist_find(struct strlist **list, char *str) { struct strlist *item; @@ -7490,6 +5911,7 @@ int strlist_find(struct strlist **list, char *str) return 1; return 0; } + void strlist_free(struct strlist **list) { struct strlist *item; @@ -7758,6 +6180,7 @@ int save_name_ui(pixel *vid_buf) } void thumb_cache_inval(char *id); + void execute_save(pixel *vid_buf) { int status; @@ -8031,6 +6454,7 @@ int execute_vote(pixel *vid_buf, char *id, char *action) } static char hex[] = "0123456789ABCDEF"; + void strcaturl(char *dst, char *src) { char *d; @@ -9034,21 +7458,6 @@ void draw_image(pixel *vid, pixel *img, int x, int y, int w, int h, int a) } } -void xor_rect(pixel *vid, int x, int y, int w, int h) -{ - int i; - for(i=0; i 18) ? signs[i].y - 18 : signs[i].y + 4; } -void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) -{ - char t[2]; - t[0] = ch; - t[1] = 0; - if(flag) - { - fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); - } - else - { - drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); - } -} - void render_signs(pixel *vid_buf) { int i, j, x, y, w, h, dx, dy; diff --git a/powder.h b/powder.h new file mode 100644 index 0000000..cef0fbf --- /dev/null +++ b/powder.h @@ -0,0 +1,397 @@ +#ifndef POWDER_H +#define POWDER_H + +#include "graphics.h" +#include "defines.h" +#include "interface.h" + +#define CM_COUNT 7 +#define CM_FANCY 6 +#define CM_HEAT 5 +#define CM_BLOB 4 +#define CM_FIRE 3 +#define CM_PERS 2 +#define CM_PRESS 1 +#define CM_VEL 0 + +#define UI_WALLSTART 37 +#define UI_WALLCOUNT 19 + +#define SPC_AIR 136 +#define SPC_HEAT 137 +#define SPC_COOL 138 +#define SPC_VACUUM 139 + +#define WL_WALLELEC 22 +#define WL_EWALL 23 +#define WL_DETECT 24 +#define WL_STREAM 25 +#define WL_SIGN 26 +#define WL_FAN 27 +#define WL_ALLOWLIQUID 28 +#define WL_DESTROYALL 29 +#define WL_ERASE 30 +#define WL_WALL 31 +#define WL_ALLOWAIR 32 +#define WL_ALLOWSOLID 33 +#define WL_ALLOWALLELEC 34 +#define WL_EHOLE 35 +#define WL_ALLOWGAS 40 + +#define PT_NONE 0 +#define PT_DUST 1 +#define PT_WATR 2 +#define PT_OILL 3 +#define PT_FIRE 4 +#define PT_STNE 5 +#define PT_LAVA 6 +#define PT_GUNP 7 +#define PT_NITR 8 +#define PT_CLNE 9 +#define PT_GASS 10 +#define PT_PLEX 11 +#define PT_DFRM 12 +#define PT_ICEI 13 +#define PT_METL 14 +#define PT_SPRK 15 +#define PT_SNOW 16 +#define PT_WOOD 17 +#define PT_NEUT 18 +#define PT_PLUT 19 +#define PT_PLNT 20 +#define PT_ACID 21 +#define PT_VOID 22 +#define PT_WTRV 23 +#define PT_CNCT 24 +#define PT_DSTW 25 +#define PT_SALT 26 +#define PT_SLTW 27 +#define PT_DMND 28 +#define PT_BMTL 29 +#define PT_BRMT 30 +#define PT_PHOT 31 +#define PT_URAN 32 +#define PT_WAX 33 +#define PT_MWAX 34 +#define PT_PSCN 35 +#define PT_NSCN 36 +#define PT_LNTG 37 +#define PT_INSL 38 +#define PT_BHOL 39 +#define PT_WHOL 40 +#define PT_RBDM 41 +#define PT_LRBD 42 +#define PT_NTCT 43 +#define PT_SAND 44 +#define PT_GLAS 45 +#define PT_PTCT 46 +#define PT_BGLA 47 +#define PT_THDR 48 +#define PT_PLSM 49 +#define PT_ETRD 50 +#define PT_NICE 51 +#define PT_NBLE 52 +#define PT_BTRY 53 +#define PT_LCRY 54 +#define PT_STKM 55 +#define PT_SWCH 56 +#define PT_SMKE 57 +#define PT_PLAS 58 +#define PT_DESL 59 +#define PT_COAL 60 +#define PT_LO2 61 +#define PT_O2 62 +#define PT_INWR 63 +#define PT_YEST 64 +#define PT_DYST 65 +#define PT_NUM 66 + +#define R_TEMP 22 +#define MAX_TEMP 3500 +#define MIN_TEMP -273 + +#define ST_NONE 0 +#define ST_SOLID 1 +#define ST_LIQUID 2 +#define ST_GAS 3 + +static unsigned char TYPE_PART = 0x01; //1 +static unsigned char TYPE_LIQUID = 0x02; //2 +static unsigned char TYPE_SOLID = 0x04; //4 +static unsigned char TYPE_GAS = 0x08; //8 +static unsigned char PROP_CONDUCTS = 0x10; //16 +#define FLAG_STAGNANT 1 + +typedef struct +{ + int type; + int life, ctype; + float x, y, vx, vy; + float temp; + float pavg[2]; + int flags; +} particle; + +struct part_type +{ + const char *name; + pixel pcolors; + float advection; + float airdrag; + float airloss; + float loss; + float collision; + float gravity; + float diffusion; + float hotair; + int falldown; + int flammable; + int explosive; + int meltable; + int hardness; + int menu; + int menusection; + float heat; + unsigned char hconduct; + const char *descs; + unsigned char properties; +}; + +struct part_state +{ + char state; + int solid; + float stemp; + int liquid; + float ltemp; + int gas; + float gtemp; + int burn; + float btemp; +}; + +const struct part_type ptypes[PT_NUM] = +{ + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Very light dust. Flammable."}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Flammable. Solidifies under pressure"}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f, 88, "Ignites flammable materials. Heats air."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Heavy particles. Meltable."}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 97, "Light dust. Explosive."}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 50, "Liquid. Pressure sensitive explosive."}, + {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Solid. Duplicates any particles it touches."}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 88, "Solid. Pressure sensitive explosive."}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms and disappears under pressure."}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+-50.0f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, + {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Conducts electricity. Meltable."}, + {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electricity. Conducted by metal and water."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP+-30.0f, 46, "Light particles."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f, 164, "Solid. Flammable. Can be pressurised into COAL"}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 60, "Neutrons. Interact with matter in odd ways."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 65, "Plant, drinks water and grows."}, + {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f, 34, "Dissolves almost everything."}, + {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Hole, will drain away any particles."}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f, 48, "Steam, heats up air, produced from hot water."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f, 100, "Concrete, stronger than stone."}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 23, "Distilled water, does not conduct electricity."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 110, "Salt, dissolves in water."}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f, 75, "Saltwater, conducts electricity, difficult to freeze."}, + {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 251, "Breakable metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f, 211, "Broken metal."}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f, 251, "Photons. Travel in straight lines."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f, 251, "Heavy particles. Generates heat under pressure."}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 44, "Wax. Melts at moderately high temperatures."}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f, 44, "Liquid Wax."}, + {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "P-Type Silicon, Will transfer current to any conductor."}, + {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -205.0f, 70, "Liquid Nitrogen. Very cold."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f, 0, "Insulator, does not conduct heat or electricity."}, + {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f, 255, "Black hole, sucks in other particles and heats up."}, + {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f, 255, "White hole, pushes other particles away."}, + {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f, 170, "Liquid Rubidium."}, + {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Sand, Heavy particles. Meltable."}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 150, "Solid. Meltable. Shatters under pressure"}, + {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f, 115, "Plasma, extremely hot."}, + {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, -250.0f, 46, "Nitrogen Ice."}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Generates Electricity."}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, + {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.0f * CFDS, 0, 0, 0, 1, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0.01f, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f, 200, "Solid. Burns slowly."}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 5.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Oxygen helps make things burn."}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f, 70, "Deat Yeast."}, + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description +}; + +const struct part_state pstates[PT_NUM] = +{ + // Name Solid Frzp Liquid Mpnt Gas Bpoint + /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WATR */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, + /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2500.0f}, + /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 710.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LAVA */ {ST_LIQUID, PT_STNE, 700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 300.0f}, + /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, + /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 300.0f}, + /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WTRV */ {ST_GAS, PT_ICEI, 0.0f, PT_DSTW, 98.0f, PT_NONE, 100.0f, PT_NONE, 0.0f}, + /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 850.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DSTW */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, + /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 900.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SLTW */ {ST_LIQUID, PT_ICEI, -40.0f, PT_NONE, 0.0f, PT_WTRV, 110.0f, PT_NONE, 0.0f}, + /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2100.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 46.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* MWAX */ {ST_LIQUID, PT_WAX, 45.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LNTG */ {ST_SOLID, PT_NICE, -210.0f, PT_NONE, 0.0f, PT_NONE, -195.8f, PT_NONE, 0.0f}, + /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 39.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, + /* LRBD */ {ST_LIQUID, PT_RBDM, 38.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, + /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, -209.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2000.0f}, + /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OILL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 62.0f}, + /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, + /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, -180.0f, PT_NONE, 0.0f}, + /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, -190.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 60.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, +}; +static const unsigned char can_move[PT_NUM][PT_NUM] = +{ + /* A B */ + /* A 0 1 | B ligher than A */ + /* B 1 0 | A heavier than B */ + +/* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y */ +/* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ +/* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X W S*/ +/* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l R T*/ +/* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ +/* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0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+/* INWR */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* INWR */ +/* YEST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* YEST */ +/* DYST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* DYST */ +/* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y*/ +/* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ +/* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X W S*/ +/* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l R T*/ +}; + +#endif \ No newline at end of file -- cgit v0.9.2-21-gd62e From 5751fea35f31640fddfaea1459503e366ae39729 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 26 Aug 2010 10:53:15 +0100 Subject: More work diff --git a/font.h b/font.h index 018e474..f8f9a58 100644 --- a/font.h +++ b/font.h @@ -21,11 +21,11 @@ #ifndef FONT_H_CHECK #define FONT_H_CHECK #define FONT_H 10 -char font_data[] = +static char font_data[] = { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc7, 0x31, 0x0c, 0x02, 0x70, 0x04, 0x00, 0x00, 0x05, 0xcc, 0x74, 0x23, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x19, 0xcc, 0xe0, 0x3f, 0xcc, 0xf0, 0x2f, 0xcc, 0x90, 0x09, 0x00, 0x00, 0x00, 0x06, 0x30, 0xd0, 0x3f, 0x33, 0xe1, 0x07, 0xf4, 0x12, 0x33, 0xff, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x2d, 0xce, 0xcc, 0xe1, 0x1d, 0xc0, 0x03, 0x74, 0x4b, 0x33, 0xb3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7d, 0x30, 0x0c, 0x13, 0xd0, 0x32, 0xb3, 0x33, 0x1c, 0x7d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x4c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x34, 0x1d, 0x07, 0x03, 0x07, 0x1d, 0x34, 0x00, 0x00, 0x00, 0x04, 0x07, 0x1d, 0x34, 0x30, 0x34, 0x1d, 0x07, 0x00, 0x00, 0x00, 0x06, 0x44, 0xd0, 0x1c, 0x64, 0xf0, 0x3f, 0x64, 0xd0, 0x1c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x02, 0x30, 0xe0, 0x2f, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x06, 0x80, 0x02, 0x0c, 0xa0, 0x00, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, 0xe0, 0x39, 0x07, 0x33, 0x32, 0x03, 0xb3, 0x38, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x30, 0xf0, 0x60, 0x03, 0x0c, 0x30, 0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x41, 0x03, 0x0a, 0x2c, 0x70, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0x71, 0x34, 0x01, 0x03, 0x1e, 0x00, 0x33, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xc0, 0x03, 0x37, 0x1c, 0x73, 0x34, 0xbf, 0x03, 0x30, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x00, 0x57, 0xe0, 0x2f, 0x00, 0x13, 0x30, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd3, 0x00, 0x07, 0xf0, 0x1f, 0x03, 0x33, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x07, 0x34, 0x80, 0x03, 0x0e, 0x38, 0xd0, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xd3, 0x1f, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xc3, 0x3f, 0x40, 0x23, 0x30, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x70, 0x04, 0x40, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc0, 0xc3, 0x0b, 0x1b, 0xc0, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x0f, 0x90, 0x83, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfd, 0x71, 0x30, 0x81, 0x03, 0x0e, 0x34, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0x0f, 0x1d, 0x30, 0xe7, 0x37, 0x73, 0x1c, 0xe3, 0x2f, 0x07, 0x00, 0xfd, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x74, 0xd0, 0x1d, 0x47, 0x33, 0x30, 0xff, 0x33, 0x30, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xbf, 0x30, 0x38, 0x43, 0xf3, 0x1f, 0x43, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x31, 0x00, 0x03, 0x70, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x33, 0x30, 0x03, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x32, 0x00, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x10, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x10, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x30, 0x3e, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x47, 0x33, 0x30, 0x03, 0xf3, 0x3f, 0x03, 0x33, 0x30, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x06, 0xd0, 0x01, 0x0c, 0xc0, 0x00, 0x0c, 0xc0, 0x10, 0x0d, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0xc3, 0x34, 0x70, 0x03, 0xbc, 0x00, 0xb3, 0xc0, 0xb0, 0x70, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x30, 0x10, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x1f, 0x3d, 0x7b, 0x3b, 0xe3, 0x32, 0x83, 0x30, 0x03, 0x30, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0xcd, 0x03, 0x73, 0xc3, 0x8c, 0x32, 0xc3, 0xcd, 0xc0, 0x33, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xc7, 0x71, 0xd0, 0x0c, 0x30, 0x03, 0xcd, 0xd1, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x73, 0x34, 0xff, 0x31, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xd3, 0x71, 0xd0, 0x0c, 0x30, 0xc3, 0xcd, 0xd1, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x31, 0x34, 0x03, 0xf3, 0x0f, 0xd7, 0x30, 0x34, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x31, 0x07, 0xd0, 0x0f, 0x90, 0x23, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x13, 0x13, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xcc, 0x00, 0x33, 0xc0, 0x0c, 0x30, 0x03, 0xcd, 0xd2, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x33, 0x30, 0x03, 0xb3, 0x38, 0xcd, 0xc1, 0x0d, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x43, 0x30, 0xc7, 0x34, 0xcd, 0x1c, 0xed, 0x1e, 0x2c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0x4c, 0xc3, 0x81, 0x3b, 0xd0, 0x03, 0xdc, 0x42, 0xc3, 0x31, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0xb3, 0x38, 0xdc, 0x40, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xd0, 0x02, 0x2c, 0xc0, 0x02, 0x2d, 0xc0, 0x06, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x2f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x30, 0x80, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x37, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x47, 0x30, 0xfc, 0x0c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x07, 0x0c, 0xf0, 0xc7, 0x35, 0xc3, 0x0c, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc3, 0x25, 0x03, 0x4c, 0xd2, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd0, 0x00, 0x83, 0x8f, 0x33, 0xc3, 0x1c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xbf, 0x0c, 0xd0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3d, 0x07, 0x03, 0x2f, 0x03, 0x03, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xcb, 0x32, 0xc3, 0xf4, 0x03, 0x4c, 0x30, 0x7e, 0x00, 0x00, 0x05, 0x03, 0x0c, 0xf0, 0xc7, 0x39, 0xc3, 0x0c, 0x73, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x1c, 0x00, 0x0d, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x30, 0x00, 0x34, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x05, 0x03, 0x0c, 0x31, 0xce, 0x0e, 0x1f, 0xcc, 0x31, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x47, 0x3d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x9b, 0x71, 0x37, 0x33, 0x33, 0x32, 0x43, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x0c, 0x33, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x31, 0xc3, 0x4c, 0xd3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x4c, 0xf3, 0xc7, 0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xdf, 0x31, 0xc3, 0x4c, 0xd3, 0x0f, 0x30, 0xc0, 0x00, 0x05, 0x03, 0x00, 0x30, 0x7f, 0xc7, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xc7, 0x10, 0x3c, 0x04, 0xf3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x1c, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x70, 0xdc, 0x30, 0xc3, 0x4c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xd3, 0xdc, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x33, 0x32, 0x33, 0x73, 0x37, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcd, 0x32, 0x7d, 0x8c, 0x73, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xc7, 0x74, 0x43, 0x07, 0x0c, 0x1f, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x4f, 0x2c, 0x2c, 0x2c, 0xf1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x04, 0x38, 0x0c, 0x0c, 0x03, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x02, 0x32, 0x33, 0x33, 0x13, 0x00, 0x04, 0x0b, 0x0c, 0x0c, 0x30, 0x0c, 0x0c, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x72, 0x37, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, 0x07, 0xff, 0x1f, 0xff, 0x7f, 0xff, 0x1b, 0xbf, 0x01, 0x1b, 0x00, 0x0c, 0x00, 0x40, 0xff, 0x00, 0x00, 0xf8, 0xf0, 0x3f, 0xee, 0x2c, 0x30, 0xcb, 0x0b, 0x30, 0x42, 0xc3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xf3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xff, 0x3f, 0x00, 0x0c, 0xc2, 0x00, 0x00, 0xcb, 0x00, 0x00, 0xee, 0xc0, 0xff, 0xf8, 0xb0, 0xc0, 0xff, 0x2c, 0xc0, 0x00, 0x0c, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xcc, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0x0d, 0x00, 0x70, 0x00, 0x00, 0xf3, 0xff, 0xd3, 0x03, 0xe0, 0x3c, 0x3f, 0x38, 0x03, 0xd0, 0x33, 0xff, 0x38, 0x03, 0xe0, 0xf0, 0xff, 0x03, 0x0c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x8b, 0xf7, 0x0c, 0x13, 0x9f, 0x3b, 0x37, 0x00, 0xc0, 0x23, 0xff, 0xff, 0x8b, 0x03, 0x00, 0xf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0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0xff, 0x0f, 0xfc, 0xff, 0x3f, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb8, 0xe0, 0x2f, 0xff, 0xe3, 0x2f, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0xff, 0x2f, 0xfd, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0xf8, 0xff, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x01, 0x00, 0x02, 0x00, 0xc8, 0x07, 0x10, 0xc3, 0x00, 0x31, 0x0d, 0x00, 0xfd, 0x01, 0x00, 0x74, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x0a, 0x40, 0x05, 0x80, 0xff, 0x8b, 0x1e, 0xd0, 0x2e, 0x00, 0xf0, 0x00, 0xe0, 0xff, 0x0b, 0x00, 0x0f, 0x00, 0xb8, 0x03, 0xb0, 0xe2, 0xff, 0x02, 0x50, 0x01, 0x08, 0xff, 0x07, 0x03, 0x1e, 0x03, 0x73, 0x03, 0xef, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x2f, 0xe0, 0x1b, 0x0c, 0x1d, 0x00, 0xff, 0x03, 0xbe, 0xf0, 0xc1, 0x01, 0xad, 0x34, 0xc0, 0x36, 0x0b, 0x30, 0xdc, 0xe4, 0x07, 0xfd, 0x1b, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0xa0, 0xaa, 0x00, 0xa8, 0xc2, 0x0f, 0x2a, 0xff, 0x03, 0xca, 0x3f, 0x80, 0xfc, 0x0f, 0x20, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x07, 0xaa, 0xea, 0x1f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xaa, 0xea, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x03, 0x00, 0xd0, 0x03, 0x00, 0xf4, 0xab, 0xaa, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xf4, 0xab, 0xaa, 0xd0, 0x03, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x09, 0xfe, 0xff, 0xe3, 0xff, 0x0f, 0xaa, 0x3e, 0x0a, 0xf8, 0x2e, 0xe0, 0xbf, 0x80, 0xff, 0xaa, 0xfe, 0xff, 0xe2, 0xff, 0x02, 0x02, 0x00, 0x00, 0x09, 0x00, 0x80, 0x04, 0xd0, 0xe2, 0xff, 0x02, 0x00, 0x00, 0xff, 0x6f, 0x00, 0x40, 0xe6, 0xaf, 0x50, 0x00, 0x09, 0x00, 0x20, 0x00, 0x64, 0x00, 0x09, 0xe0, 0x3f, 0x70, 0x60, 0x63, 0xc0, 0xe4, 0x80, 0xc2, 0x03, 0x07, 0x0f, 0x1e, 0x6c, 0xff, 0x27, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x09, 0x44, 0x44, 0x00, 0x12, 0x41, 0x88, 0x04, 0x21, 0x21, 0x84, 0x48, 0x20, 0x23, 0xc2, 0xcc, 0x08, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x1d, 0x00, 0x78, 0x00, 0xb4, 0x07, 0xf0, 0x2f, 0xc0, 0xfb, 0x00, 0xbe, 0x02, 0xf4, 0x07, 0xfd, 0xff, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0x00, 0x19, 0x00, 0xa8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf0, 0xdc, 0xcb, 0x03, 0x00, 0xff, 0xff, 0x4f, 0x07, 0x40, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0xff, 0x3f, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0x07, 0x00, 0xbd, 0x02, 0xe8, 0xb3, 0xe0, 0x3c, 0xac, 0xc3, 0x03, 0x0f, 0x3c, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x0b, 0xc0, 0xc8, 0xc0, 0x91, 0x1b, 0xcd, 0x36, 0xe7, 0x00, 0x47, 0x03, 0xa7, 0x80, 0x36, 0xfd, 0xff, 0xc1, 0x9b, 0xf9, 0xb8, 0xb8, 0xb8, 0xb7, 0x99, 0xf7, 0xff, 0xff, 0x0f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x03, 0x00, 0xfc, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0xff, 0x3f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0xcf, 0xff, 0xff, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1f, 0xcb, 0x30, 0xc3, 0x3f, 0xc7, 0x00, 0x7e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0xc3, 0xfc, 0x33, 0x0c, 0x24, 0xc3, 0xc0, 0x31, 0x0c, 0x06, 0xc3, 0x30, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0xff, 0x3f, 0x30, 0x00, 0x03, 0xc3, 0x30, 0x30, 0x3f, 0xff, 0xff, 0x3f, 0x3c, 0x00, 0xff, 0xff, 0xff, 0x0c, 0x0c, 0xc3, 0xc0, 0x00, 0x0c, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x3c, 0x00, 0xc0, 0x03, 0xf0, 0x3f, 0x00, 0xff, 0x03, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xb8, 0xec, 0x9b, 0xf9, 0xbf, 0xf8, 0xbf, 0x99, 0xef, 0xb8, 0x2c, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x87, 0x87, 0xc3, 0x30, 0x0c, 0xe3, 0xde, 0x01, 0x03, 0x74, 0xbb, 0x0c, 0xc3, 0x30, 0x2c, 0x2d, 0x0d, 0x05, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x34, 0xc3, 0x0c, 0x73, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x39, 0xc0, 0x00, 0x43, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0x60, 0x60, 0x60, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0xb8, 0x00, 0x23, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x36, 0xc6, 0xfc, 0x03, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xcb, 0x00, 0x7f, 0x40, 0x13, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xcb, 0x10, 0x2f, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x0f, 0x30, 0x60, 0x60, 0xc0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0x7d, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xc6, 0xe0, 0x03, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x03, 0xc0, 0xf0, 0x3c, 0xcf, 0xf3, 0x3c, 0x03, 0x00, 0x03, 0x00, 0xcc, 0xf3, 0x3c, 0xcf, 0xf3, 0x30, 0x00, 0x05, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x30, 0xc0, 0x0f, 0x30, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0xd0, 0x7f, 0x40, 0xff, 0x1f, 0xfc, 0xff, 0x43, 0xff, 0x1f, 0x40, 0x15, 0x00, 0x00, 0x00, 0x0a, 0xe4, 0x06, 0x90, 0x91, 0x01, 0x06, 0x24, 0x30, 0x90, 0x1b, 0x46, 0x6e, 0x96, 0xb9, 0x91, 0xe4, 0x06, 0x0c, 0x18, 0x90, 0x40, 0x46, 0x06, 0x90, 0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x02, 0xc2, 0xab, 0xaa, 0x3e, 0x20, 0xe0, 0xab, 0xaa, 0x3e, 0x02, 0xc2, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x02, 0xc0, 0x30, 0x00, 0x0c, 0x03, 0xf0, 0xff, 0x00, 0xfe, 0x0b, 0xd0, 0x7f, 0x00, 0xa4, 0x01, 0x00, 0x0a, 0x00, 0xa0, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x81, 0x24, 0x10, 0x85, 0x00, 0x20, 0x66, 0x40, 0x15, 0x45, 0x62, 0x90, 0x4d, 0xd0, 0xf1, 0x23, 0x01, 0xfd, 0x41, 0x41, 0x07, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x00, 0xf8, 0x02, 0xd0, 0x7f, 0x00, 0xfe, 0x0b, 0xf0, 0xff, 0x00, 0xff, 0x0f, 0xd0, 0x7f, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0xd4, 0x01, 0xd0, 0x06, 0x40, 0x7f, 0x00, 0xfd, 0x01, 0xf4, 0x07, 0xd0, 0x1f, 0x00, 0x7f, 0x00, 0xd0, 0x01, 0x00, 0x0a, 0x40, 0x15, 0x00, 0xfe, 0x0b, 0x88, 0x2f, 0x52, 0xf0, 0x50, 0x01, 0x0a, 0xd4, 0xaf, 0x7f, 0xfd, 0xf5, 0xc7, 0x0b, 0x3e, 0x70, 0xd0, 0x00, 0xa4, 0x01, 0x0a, 0x80, 0x2f, 0x80, 0x5f, 0x2f, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x01, 0x34, 0x34, 0xc0, 0x01, 0x07, 0x0d, 0xd0, 0x75, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xf4, 0x01, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xe0, 0xef, 0x00, 0xbb, 0x0b, 0xa0, 0xaa, 0x00, 0xaa, 0x0a, 0x80, 0x19, 0x00, 0x64, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x2d, 0x80, 0xe7, 0x0b, 0xbe, 0xf8, 0xfa, 0x02, 0xfe, 0x0b, 0x80, 0x2f, 0x00, 0x50, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xaf, 0x2f, 0xbe, 0xe0, 0xdb, 0x02, 0x78, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x50, 0xfe, 0x5b, 0xfd, 0xff, 0x47, 0xff, 0x1f, 0xe0, 0xbf, 0x00, 0xfe, 0x0b, 0xf0, 0xf5, 0x40, 0x01, 0x14, 0x0a, 0x40, 0x1a, 0x00, 0x09, 0x06, 0x20, 0x80, 0x00, 0x02, 0x08, 0xfc, 0xff, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x0a, 0xf0, 0xff, 0x00, 0xaa, 0x0a, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xff, 0xed, 0xff, 0xe1, 0xdf, 0xe1, 0x2f, 0xe1, 0xef, 0xe2, 0x2f, 0xef, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x0a, 0xc0, 0x31, 0x00, 0x30, 0x01, 0x40, 0x34, 0x00, 0xcc, 0x00, 0x00, 0x0a, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xff, 0x2f, 0xfe, 0xff, 0xfb, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x80, 0xff, 0x2f, 0xfc, 0xff, 0xc3, 0x07, 0x3d, 0x3c, 0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x99, 0x31, 0x30, 0x89, 0x41, 0x07, }; -short font_ptrs[] = +static short font_ptrs[] = { 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2, 0x01c0, 0x01ce, 0x01d7, 0x01e5, 0x01f5, 0x0205, 0x0218, 0x0228, 0x0231, 0x023c, 0x0247, 0x0257, 0x0267, 0x0272, 0x0280, 0x0289, 0x0299, 0x02a9, 0x02b7, 0x02c7, 0x02d7, 0x02e7, 0x02f7, 0x0307, 0x0317, 0x0327, 0x0337, 0x0340, 0x034b, 0x035b, 0x036b, 0x037b, 0x038b, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x042b, 0x043b, 0x044e, 0x045e, 0x0473, 0x0486, 0x0499, 0x04a9, 0x04bc, 0x04cc, 0x04dc, 0x04ec, 0x04ff, 0x050f, 0x0524, 0x0537, 0x0547, 0x055a, 0x0565, 0x0573, 0x057e, 0x0589, 0x0599, 0x05a2, 0x05b0, 0x05be, 0x05cc, 0x05da, 0x05e8, 0x05f3, 0x0601, 0x060f, 0x061a, 0x0625, 0x0633, 0x063e, 0x064e, 0x065c, 0x066a, 0x0678, 0x0686, 0x068f, 0x069d, 0x06a8, 0x06b6, 0x06c4, 0x06d4, 0x06e2, 0x06f0, 0x06fe, 0x0709, 0x070f, 0x071a, 0x072a, 0x0735, 0x074a, 0x0769, 0x0788, 0x07a2, 0x07c1, 0x07db, 0x07f5, 0x080f, 0x0829, 0x0843, 0x085d, 0x0877, 0x0896, 0x08a6, 0x08c0, 0x08da, 0x08f4, 0x090e, 0x0923, 0x0940, 0x095d, 0x097c, 0x099b, 0x09b3, 0x09cb, 0x09e3, 0x09fb, 0x0a13, 0x0a2b, 0x0a43, 0x0a5b, 0x0a73, 0x0a8b, 0x0aa3, 0x0abd, 0x0ada, 0x0af7, 0x0b0c, 0x0b26, 0x0b40, 0x0b5a, 0x0b74, 0x0b8c, 0x0b97, 0x0ba0, 0x0ba9, 0x0bb7, 0x0bc5, 0x0bd3, 0x0be1, 0x0bef, 0x0bfd, 0x0c0b, 0x0c19, 0x0c27, 0x0c35, 0x0c43, 0x0c4e, 0x0c57, 0x0c60, 0x0c6e, 0x0c7e, 0x0c8e, 0x0ca8, 0x0cc2, 0x0cdc, 0x0cf6, 0x0d10, 0x0d2a, 0x0d44, 0x0d5e, 0x0d78, 0x0d92, 0x0dac, 0x0dc6, 0x0de0, 0x0dfa, 0x0e14, 0x0e2e, 0x0e46, 0x0e60, 0x0e7a, 0x0e8a, 0x0e9a, 0x0eaa, 0x0eba, 0x0eca, 0x0eda, 0x0eea, 0x0efa, 0x0f0a, 0x0f1a, 0x0f2a, 0x0f3a, 0x0f4a, 0x0f5a, 0x0f6a, 0x0f7a, 0x0f8a, 0x0f9a, 0x0faa, 0x0fba, 0x0fca, 0x0fda, 0x0fea, 0x0ffa, 0x100a, 0x101a, 0x102a, 0x103a, 0x104a, 0x105a, 0x106a, 0x107a, 0x108a, 0x109a, 0x10aa, 0x10ba, 0x10ca, 0x10da, 0x10ea, 0x10fa, 0x110a, 0x111a, 0x112a, 0x113a, 0x114a, }; diff --git a/graphics.c b/graphics.c index 4282e5c..5874116 100644 --- a/graphics.c +++ b/graphics.c @@ -3,8 +3,14 @@ #include "powder.h" #include "graphics.h" #include "font.h" +#include "utils.h" +#include #include +unsigned cmode = 3; +SDL_Surface *sdl_scrn; +int sdl_scale = 1; + pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f) { int i,j,x,y,w,h,r,g,b,c; diff --git a/graphics.h b/graphics.h index 935dd43..7779b09 100644 --- a/graphics.h +++ b/graphics.h @@ -36,9 +36,9 @@ typedef unsigned int pixel; #endif #endif -unsigned cmode = 3; -SDL_Surface *sdl_scrn; -int sdl_scale = 1; +extern unsigned cmode; +extern SDL_Surface *sdl_scrn; +extern int sdl_scale; pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f); diff --git a/interface.h b/interface.h index dfa0ba6..5816897 100644 --- a/interface.h +++ b/interface.h @@ -7,13 +7,16 @@ struct menu_section const char *name; int itemcount; }; +typedef struct menu_section menu_section; + struct menu_wall { pixel colour; const char *descs; }; +typedef struct menu_wall menu_wall; -const struct menu_wall mwalls[] = +static menu_wall mwalls[] = { {PIXPACK(0xC0C0C0), "Wall. Indestructible. Blocks everything. Conductive."}, {PIXPACK(0x808080), "E-Wall. Becomes transparent when electricity is connected."}, @@ -47,7 +50,7 @@ const struct menu_wall mwalls[] = #define SC_NUCLEAR 7 #define SC_TOTAL 9 -struct menu_section msections[] = +static menu_section msections[] = { {"\xC1", "Walls", 0}, {"\xC2", "Electronics", 0}, diff --git a/powder.c b/powder.c index 63d67ea..c0ff76d 100644 --- a/powder.c +++ b/powder.c @@ -37,6 +37,7 @@ #include #endif +#include "utils.h" #include "font.h" #include "defines.h" #include "powder.h" @@ -281,32 +282,6 @@ void *update_air_th(void *arg) return NULL; } -#ifdef WIN32 -_inline unsigned clamp_flt(float f, float min, float max) -#else -inline unsigned clamp_flt(float f, float min, float max) -#endif -{ - if(fmax) - return 255; - return (int)(255.0f*(f-min)/(max-min)); -} - -#ifdef WIN32 -_inline float restrict_flt(float f, float min, float max) -#else -inline float restrict_flt(float f, float min, float max) -#endif -{ - if(fmax) - return max; - return f; -} - /*********************************************************** * PARTICLE SIMULATOR * ***********************************************************/ @@ -650,22 +625,6 @@ inline void delete_part(int x, int y) pmap[y][x] = 0; // just in case } -//Signum function -#ifdef WIN32 -_inline int sign(float i) -#else -inline int sign(float i) -#endif -{ - if (i<0) - return -1; - if (i>0) - return 1; - return 0; -} - -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); - #ifdef WIN32 _inline int is_wire(int x, int y) #else diff --git a/powder.h b/powder.h index cef0fbf..5f0ca71 100644 --- a/powder.h +++ b/powder.h @@ -122,7 +122,7 @@ static unsigned char TYPE_GAS = 0x08; //8 static unsigned char PROP_CONDUCTS = 0x10; //16 #define FLAG_STAGNANT 1 -typedef struct +struct particle { int type; int life, ctype; @@ -130,7 +130,8 @@ typedef struct float temp; float pavg[2]; int flags; -} particle; +}; +typedef struct particle particle; struct part_type { @@ -156,6 +157,7 @@ struct part_type const char *descs; unsigned char properties; }; +typedef struct part_type part_type; struct part_state { @@ -169,8 +171,9 @@ struct part_state int burn; float btemp; }; +typedef struct part_state part_state; -const struct part_type ptypes[PT_NUM] = +static part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, @@ -242,7 +245,7 @@ const struct part_type ptypes[PT_NUM] = //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; -const struct part_state pstates[PT_NUM] = +static part_state pstates[PT_NUM] = { // Name Solid Frzp Liquid Mpnt Gas Bpoint /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -312,7 +315,7 @@ const struct part_state pstates[PT_NUM] = /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 60.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; -static const unsigned char can_move[PT_NUM][PT_NUM] = +static unsigned char can_move[PT_NUM][PT_NUM] = { /* A B */ /* A 0 1 | B ligher than A */ diff --git a/utils.c b/utils.c new file mode 100644 index 0000000..dfa9a3b --- /dev/null +++ b/utils.c @@ -0,0 +1,41 @@ +#include "utils.h" + +//Signum function +#ifdef WIN32 +_inline int sign(float i) +#else +inline int sign(float i) +#endif +{ + if (i<0) + return -1; + if (i>0) + return 1; + return 0; +} + +#ifdef WIN32 +_inline unsigned clamp_flt(float f, float min, float max) +#else +inline unsigned clamp_flt(float f, float min, float max) +#endif +{ + if(fmax) + return 255; + return (int)(255.0f*(f-min)/(max-min)); +} + +#ifdef WIN32 +_inline float restrict_flt(float f, float min, float max) +#else +inline float restrict_flt(float f, float min, float max) +#endif +{ + if(fmax) + return max; + return f; +} \ No newline at end of file diff --git a/utils.h b/utils.h new file mode 100644 index 0000000..71c1df0 --- /dev/null +++ b/utils.h @@ -0,0 +1,23 @@ +#ifndef UTILS_H +#define UTILS_H + +//Signum function +#ifdef WIN32 +_inline int sign(float i); +#else +inline int sign(float i); +#endif + +#ifdef WIN32 +_inline unsigned clamp_flt(float f, float min, float max); +#else +inline unsigned clamp_flt(float f, float min, float max); +#endif + +#ifdef WIN32 +_inline float restrict_flt(float f, float min, float max); +#else +inline float restrict_flt(float f, float min, float max); +#endif + +#endif \ No newline at end of file -- cgit v0.9.2-21-gd62e From 72a1d17fe42ccc74ac25328dcd272b7a2bf6856c Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 26 Aug 2010 12:20:16 +0100 Subject: This build works, but still a work in progress diff --git a/defines.h b/defines.h index b08407f..5b5daaa 100644 --- a/defines.h +++ b/defines.h @@ -5,11 +5,7 @@ #undef PLOSS -#ifdef MENUV3 #define MENUSIZE 40 -#else -#define MENUSIZE 20 -#endif #define BARSIZE 14 #define XRES 612 #define YRES 384 diff --git a/graphics.c b/graphics.c index 5874116..15f50c6 100644 --- a/graphics.c +++ b/graphics.c @@ -3,7 +3,7 @@ #include "powder.h" #include "graphics.h" #include "font.h" -#include "utils.h" +#include "misc.h" #include #include @@ -716,9 +716,6 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) void draw_menu(pixel *vid_buf, int i, int hover) { - - //drawtext(vid_buf, XRES+1, /*(12*i)+2*/((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2), msections[i].icon, 255, 255, 255, 255); -#ifdef MENUV3 drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); if(hover==i) { @@ -729,9 +726,6 @@ void draw_menu(pixel *vid_buf, int i, int hover) { drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); } -#else - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); -#endif } #ifdef WIN32 diff --git a/misc.c b/misc.c new file mode 100644 index 0000000..fe50b32 --- /dev/null +++ b/misc.c @@ -0,0 +1,41 @@ +#include "misc.h" + +//Signum function +#ifdef WIN32 +_inline int sign(float i) +#else +inline int sign(float i) +#endif +{ + if (i<0) + return -1; + if (i>0) + return 1; + return 0; +} + +#ifdef WIN32 +_inline unsigned clamp_flt(float f, float min, float max) +#else +inline unsigned clamp_flt(float f, float min, float max) +#endif +{ + if(fmax) + return 255; + return (int)(255.0f*(f-min)/(max-min)); +} + +#ifdef WIN32 +_inline float restrict_flt(float f, float min, float max) +#else +inline float restrict_flt(float f, float min, float max) +#endif +{ + if(fmax) + return max; + return f; +} \ No newline at end of file diff --git a/misc.h b/misc.h new file mode 100644 index 0000000..a42396d --- /dev/null +++ b/misc.h @@ -0,0 +1,23 @@ +#ifndef UTILS_H +#define UTILS_H + +//Signum function +#ifdef WIN32 +extern _inline int sign(float i); +#else +extern inline int sign(float i); +#endif + +#ifdef WIN32 +extern _inline unsigned clamp_flt(float f, float min, float max); +#else +extern inline unsigned clamp_flt(float f, float min, float max); +#endif + +#ifdef WIN32 +extern _inline float restrict_flt(float f, float min, float max); +#else +extern inline float restrict_flt(float f, float min, float max); +#endif + +#endif \ No newline at end of file diff --git a/powder.c b/powder.c index c0ff76d..b166535 100644 --- a/powder.c +++ b/powder.c @@ -37,7 +37,7 @@ #include #endif -#include "utils.h" +#include "misc.h" #include "font.h" #include "defines.h" #include "powder.h" @@ -8619,15 +8619,7 @@ int main(int argc, char *argv[]) { draw_menu(vid_buf, i, active_menu); } -#ifndef MENUV3 - for(i=0; i=sdl_scale*(XRES+1) && x= sdl_scale*(((YRES/SC_TOTAL)*i)+((YRES/SC_TOTAL)/2)-2) && y=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy && x Date: Thu, 26 Aug 2010 12:20:39 +0100 Subject: Remove utils.c diff --git a/utils.c b/utils.c deleted file mode 100644 index dfa9a3b..0000000 --- a/utils.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "utils.h" - -//Signum function -#ifdef WIN32 -_inline int sign(float i) -#else -inline int sign(float i) -#endif -{ - if (i<0) - return -1; - if (i>0) - return 1; - return 0; -} - -#ifdef WIN32 -_inline unsigned clamp_flt(float f, float min, float max) -#else -inline unsigned clamp_flt(float f, float min, float max) -#endif -{ - if(fmax) - return 255; - return (int)(255.0f*(f-min)/(max-min)); -} - -#ifdef WIN32 -_inline float restrict_flt(float f, float min, float max) -#else -inline float restrict_flt(float f, float min, float max) -#endif -{ - if(fmax) - return max; - return f; -} \ No newline at end of file diff --git a/utils.h b/utils.h deleted file mode 100644 index 71c1df0..0000000 --- a/utils.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef UTILS_H -#define UTILS_H - -//Signum function -#ifdef WIN32 -_inline int sign(float i); -#else -inline int sign(float i); -#endif - -#ifdef WIN32 -_inline unsigned clamp_flt(float f, float min, float max); -#else -inline unsigned clamp_flt(float f, float min, float max); -#endif - -#ifdef WIN32 -_inline float restrict_flt(float f, float min, float max); -#else -inline float restrict_flt(float f, float min, float max); -#endif - -#endif \ No newline at end of file -- cgit v0.9.2-21-gd62e From f426ee42e7170260088b78a1091bba43713822fe Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 26 Aug 2010 12:38:24 +0100 Subject: More re-arranging diff --git a/main.c b/main.c new file mode 100644 index 0000000..b166535 --- /dev/null +++ b/main.c @@ -0,0 +1,9309 @@ +/** + * Powder Toy - Main source + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw + * Copyright (c) 2010 Skresanov Savely + * Copyright (c) 2010 Bryan Hoyle + * Copyright (c) 2010 Nathan Cousins + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#else +#include +#include +#endif + +#include "misc.h" +#include "font.h" +#include "defines.h" +#include "powder.h" +#include "graphics.h" +#include "version.h" +#include "http.h" +#include "md5.h" +#include "update.h" +#include "hmap.h" +#include "air.h" + +char *it_msg = + "\brThe Powder Toy\n" + "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" + "\n" + "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" + "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" + "\bgPick your material from the menu using mouse left/right buttons.\n" + "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" + "Shift+drag will create straight lines of particles.\n" + "Ctrl+drag will result in filled rectangles.\n" + "Ctrl+Shift+click will flood-fill a closed area.\n" + "Ctrl+Z will act as Undo.\n" + "Middle click or Alt+Click to \"sample\" the particles.\n" + "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" + "Use 'S' to save parts of the window as 'stamps'.\n" + "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" + "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" + "Use the mouse scroll wheel to change the tool size for particles.\n" + "'Q' will quit the application.\n" + "The spacebar can be used to pause physics.\n" + "'P' will take a screenshot and save it into the current directory.\n" + "\n" + "\brhttp://powdertoy.co.uk/\n" + "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" + "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" + "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" + "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" + "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" + "\n" + "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" + "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" + ; + +typedef struct +{ + int start, inc; + pixel *vid; +} upstruc; + +#ifdef BETA +char *old_ver_msg_beta = "A new beta is available - click here!"; +#endif +char *old_ver_msg = "A new version is available - click here!"; +float mheat = 0.0f; + +int do_open = 0; +int sys_pause = 0; +int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. +int death = 1, framerender = 0; +int amd = 1; + +unsigned char fire_r[YRES/CELL][XRES/CELL]; +unsigned char fire_g[YRES/CELL][XRES/CELL]; +unsigned char fire_b[YRES/CELL][XRES/CELL]; + +#define MAXSIGNS 16 + +struct sign +{ + int x,y,ju; + char text[256]; +} signs[MAXSIGNS]; + +/*********************************************************** + * AIR FLOW SIMULATOR * + ***********************************************************/ + +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; + +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; + +int numCores = 4; +float kernel[9]; +void make_kernel(void) +{ + int i, j; + float s = 0.0f; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + { + kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); + s += kernel[(i+1)+3*(j+1)]; + } + s = 1.0f / s; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + kernel[(i+1)+3*(j+1)] *= s; +} + +int core_count() +{ + int numCPU = 1; +#ifdef MT +#ifdef WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + numCPU = sysinfo.dwNumberOfProcessors; +#else +#ifdef MACOSX + numCPU = 4; +#else + numCPU = sysconf( _SC_NPROCESSORS_ONLN ); +#endif +#endif + + printf("Cpus: %d\n", numCPU); + if(numCPU>1) + printf("Multithreading enabled\n"); + else + printf("Multithreading disabled\n"); +#endif + return numCPU; +} + +void update_air(void) +{ + int x, y, i, j; + float dp, dx, dy, f, tx, ty; + + for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; + if(dp < -256.0f) dp = -256.0f; + if(dx > 256.0f) dx = 256.0f; + if(dx < -256.0f) dx = -256.0f; + if(dy > 256.0f) dy = 256.0f; + if(dy < -256.0f) dy = -256.0f; + + ovx[y][x] = dx; + ovy[y][x] = dy; + opv[y][x] = dp; + } + memcpy(vx, ovx, sizeof(vx)); + memcpy(vy, ovy, sizeof(vy)); + memcpy(pv, opv, sizeof(pv)); +} + +void *update_air_th(void *arg) +{ + update_air(); + return NULL; +} + +/*********************************************************** + * PARTICLE SIMULATOR * + ***********************************************************/ +particle *parts; +particle *cb_parts; + +float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index +int isplayer = 0; //It shows is player spawned or not +int mousex, mousey = 0; //They contain mouse position + +void menu_count(void) +{ + int i=0; + msections[SC_WALL].itemcount = UI_WALLCOUNT-4; + msections[SC_SPECIAL].itemcount = 4; + for(i=0; i=XRES || ny>=YRES) + return 0; + if(x==nx && y==ny) + return 1; + r = pmap[ny][nx]; + if(r && (r>>8)>8].type; + + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) + { + return 1; + } + + if((r&0xFF)==PT_VOID) + { + parts[i].type=PT_NONE; + return 0; + } + if((r&0xFF)==PT_BHOL) + { + parts[i].type=PT_NONE; + if(!legacy_enable) + { + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; + } + return 0; + } + + if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide + { + return 1; + } + + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) + { + return 1; + } + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) + { + return 0; + } + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) + { + return 0; + } + + if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; + if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + return 0; + if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) + return 0; + + if(parts[i].type==PT_CNCT && y>8)>= 8; + parts[r].x += x-nx; + parts[r].y += y-ny; + } + + return 1; +} + +void kill_part(int i) +{ + int x, y; + parts[i].type = PT_NONE; + + x = (int)(parts[i].x+0.5f); + y = (int)(parts[i].y+0.5f); + + if(x>=0 && y>=0 && x=XRES || y>=YRES) + return -1; + + if(t==SPC_HEAT||t==SPC_COOL) + { + if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + } + if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) + { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + } + return pmap[y][x]>>8; + } + else + { + return -1; + } + } + if(t==SPC_AIR) + { + pv[y/CELL][x/CELL] += 0.03f; + if(y+CELL>8].type = PT_SPRK; + parts[pmap[y][x]>>8].life = 4; + parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; + pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; + return pmap[y][x]>>8; + } + + if(p==-1) + { + if(pmap[y][x]) + return -1; + if(pfree == -1) + return -1; + i = pfree; + pfree = parts[i].life; + } + else + i = p; + + if(t==PT_GLAS) + { + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + } + if(t!=PT_STKM) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + } + if(t==PT_ACID) + { + parts[i].life = 75; + } + /*Testing + if(t==PT_WOOD){ + parts[i].life = 150; + } + End Testing*/ + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_PLSM) + parts[i].life = rand()%150+50; + if(t==PT_LAVA) + parts[i].life = rand()%120+240; + if(t==PT_NBLE) + parts[i].life = 0; + if(t==PT_NEUT) + { + float r = (rand()%128+128)/127.0f; + float a = (rand()%360)*3.14159f/180.0f; + parts[i].life = rand()%480+480; + parts[i].vx = r*cosf(a); + parts[i].vy = r*sinf(a); + } + if(t==PT_PHOT) + { + float r = (rand()%3-1)*3; + float a = (rand()%3-1)*3; + parts[i].life = 680; + if(a==0.0f&&r==0.0f) + { + parts[i].life = 0; + parts[i].type = PT_NONE; + return -1; + } + else + { + parts[i].vx = a; + parts[i].vy = r; + } + //} else { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + //}/ + } + + if(t!=PT_STKM) + pmap[y][x] = t|(i<<8); + else + { + if(isplayer==0) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + + + + player[3] = x-1; //Setting legs positions + player[4] = y+6; + player[5] = x-1; + player[6] = y+6; + + player[7] = x-3; + player[8] = y+12; + player[9] = x-3; + player[10] = y+12; + + player[11] = x+1; + player[12] = y+6; + player[13] = x+1; + player[14] = y+6; + + player[15] = x+3; + player[16] = y+12; + player[17] = x+3; + player[18] = y+12; + + isplayer = 1; + } + } + + return i; +} + +#ifdef WIN32 +_inline void delete_part(int x, int y) +#else +inline void delete_part(int x, int y) +#endif +{ + unsigned i; + + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + i = pmap[y][x]; + if(!i || (i>>8)>=NPART) + return; + + kill_part(i>>8); + pmap[y][x] = 0; // just in case +} + +#ifdef WIN32 +_inline int is_wire(int x, int y) +#else +inline int is_wire(int x, int y) +#endif +{ + return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; +} + +#ifdef WIN32 +_inline int is_wire_off(int x, int y) +#else +inline int is_wire_off(int x, int y) +#endif +{ + return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; +} + +void set_emap(int x, int y) +{ + int x1, x2; + + if(!is_wire_off(x, y)) + return; + + // go left as far as possible + x1 = x2 = x; + while(x1>0) + { + if(!is_wire_off(x1-1, y)) + break; + x1--; + } + while(x21 && x1==x2 && + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + set_emap(x1, y-2); + else if(y>0) + for(x=x1; x<=x2; x++) + if(is_wire_off(x, y-1)) + { + if(x==x1 || x==x2 || y>=YRES/CELL-1 || + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + set_emap(x, y-1); + } + + if(y>8) < NPART && (pmr>>8) >= 0) + { + return parts[pmr>>8].type; + } + else + { + return PT_NONE; + } +} +int nearest_part(int ci, int t) +{ + int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); + int ndistance = 0; + int id = -1; + int i = 0; + int cx = (int)parts[ci].x; + int cy = (int)parts[ci].y; + for(i=0; i=XRES || y>=YRES || + ((bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) + { + kill_part(i); + continue; + } + + vx[y/CELL][x/CELL] *= ptypes[t].airloss; + vy[y/CELL][x/CELL] *= ptypes[t].airloss; + vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + if(t==PT_GASS||t==PT_NBLE) + { + if(pv[y/CELL][x/CELL]<3.5f) + pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); + if(y+CELL2.5f) + { + parts[i].life = rand()%80+180; + rt = parts[i].type = PT_FIRE; + parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + pv[y/CELL][x/CELL] += 0.25f * CFDS; + t = PT_FIRE; + } + + parts[i].vx *= ptypes[t].loss; + parts[i].vy *= ptypes[t].loss; + + if(t==PT_DFRM && !parts[i].life) + { + if(pv[y/CELL][x/CELL]>1.0f) + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].life = rand()%80+300; + } + } + else + { + if(t==PT_PLAS && pv[y/CELL][x/CELL]>25.0f) + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + } else { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + } + + if(ptypes[t].diffusion) + { + parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + } + + // interpolator +#ifdef WIN32 + mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#else + mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#endif + if(mv < ISTP) + { + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + } + else + { + dx = parts[i].vx*ISTP/mv; + dy = parts[i].vy*ISTP/mv; + ix = parts[i].x; + iy = parts[i].y; + while(1) + { + mv -= ISTP; + if(mv <= 0.0f) + { + // nothing found + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + break; + } + ix += dx; + iy += dy; + nx = (int)(ix+0.5f); + ny = (int)(iy+0.5f); + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) + { + parts[i].x = ix; + parts[i].y = iy; + break; + } + } + } + + a = nt = 0; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx4.0f) + t = parts[i].type = PT_DSTW; + if(t==PT_DESL && pv[y/CELL][x/CELL]<-6.0f) + t = parts[i].type = PT_GASS; + if(t==PT_GASS && pv[y/CELL][x/CELL]>6.0f) + t = parts[i].type = PT_DESL; + if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) + t = parts[i].type = PT_FIRE; + } + if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f) + t = parts[i].type = PT_GASS; + if(t==PT_DESL && pv[y/CELL][x/CELL]>50.0f) // Only way I know to make it + t = parts[i].type = PT_FIRE; // combust under pressure. + if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f) + t = parts[i].type = PT_DESL; + if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) + t = parts[i].type = PT_BRMT; + //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) + // t = parts[i].type = PT_BGLA; + if(t==PT_GLAS) + { + parts[i].pavg[0] = parts[i].pavg[1]; + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) + { + parts[i].type = PT_BGLA; + } + } + if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) + t = parts[i].type = PT_SNOW; + if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) + { + t = PT_NEUT; + create_part(i, x, y, t); + } + + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) + { + nearp = nearest_part(i, PT_ETRD); + if(nearp!=-1) + { + create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[nearp].type = PT_SPRK; + parts[nearp].life = 9; + parts[nearp].ctype = PT_ETRD; + } + } + + if(!legacy_enable) + { + int ctemp = pv[y/CELL][x/CELL]*2; + c_heat = 0.0f; + h_count = 0; + if(ptypes[t].hconduct>(rand()%250)) + { + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + h_count++; + c_heat += parts[r>>8].temp; + } + } + } + } + pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + parts[r>>8].temp = parts[i].temp; + } + } + } + } + if(pt>=pstates[t].btemp&&pstates[t].burn) + { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE||t==PT_PLSM) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) + { + if(t==PT_LAVA&&parts[i].ctype) + { + parts[i].life = 0; + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) + { + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } + else + { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } + else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) + { + if(pstates[t].liquid==PT_LAVA) + { + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } + else if(t==PT_ICEI&&parts[i].ctype) + { + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else + { + t = parts[i].type = pstates[t].liquid; + } + } + else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) + { + t = parts[i].type = pstates[t].liquid; + } + else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) + { + if(t==PT_SLTW&&1>rand()%6) + { + t = parts[i].type = PT_SALT; + } + else + { + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) + { + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA) + { + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } + } + if(t==PT_PTCT&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + if(t==PT_NTCT&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_NTCT || t==PT_PTCT || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) + { + nx = x % CELL; + if(nx == 0) + nx = x/CELL - 1; + else if(nx == CELL-1) + nx = x/CELL + 1; + else + nx = x/CELL; + ny = y % CELL; + if(ny == 0) + ny = y/CELL - 1; + else if(ny == CELL-1) + ny = y/CELL + 1; + else + ny = y/CELL; + if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) + { + t = parts[i].type = PT_NONE; + parts[r>>8].ctype = parts[r>>8].type; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + } + else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) + { + pv[y/CELL][x/CELL] += 100.0f; + if(legacy_enable&&1>(rand()%200)) + { + parts[i].life = rand()%50+120; + t = parts[i].type = PT_FIRE; + } + else + { + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_ICEI || t==PT_SNOW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if(legacy_enable) + { + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; + } + } + } + else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL) + { + parts[i].temp = 200.0f; + } + } + } + //PLANT + else if(t==PT_PLNT) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR && 1>(rand()%250)) + { + t = parts[i].type = PT_PLNT; + parts[r>>8].type = PT_PLNT; + } + else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WATR||t==PT_DSTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%250)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_WATR; + } + if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_SLTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) + { + parts[r>>8].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_WTRV) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + parts[r>>8].type = PT_WATR; + } + + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; + } + } + } + else if(t==PT_YEST) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_DYST && 1>(rand()%30) && !legacy_enable) + { + t = parts[i].type = PT_DYST; + } + } + } + else if(t==PT_ACID) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)!=PT_ACID) + { + if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) + { + t = parts[i].type = PT_FIRE; + parts[i].life = 4; + parts[r>>8].type = PT_FIRE; + parts[r>>8].life = 4; + } + else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) + { + parts[i].life--; + parts[r>>8].type = PT_NONE; + } + else if (parts[i].life==50) + { + parts[i].life = 0; + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_NEUT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) + { + if(33>rand()%100) + { + create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); + } + else + { + create_part(r>>8, x+nx, y+ny, PT_NEUT); + parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; + parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; + } + pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + fe ++; + } + if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + parts[r>>8].type = PT_DUST; + if((r&0xFF)==PT_DYST && 15>(rand()%1000)) + parts[r>>8].type = PT_YEST; + if((r&0xFF)==PT_YEST){ + if(15>(rand()%100000)&&isplayer==0) + parts[r>>8].type = PT_STKM; + else + parts[r>>8].type = PT_DYST; + } + + if((r&0xFF)==PT_WATR && 15>(rand()%100)) + parts[r>>8].type = PT_DSTW; + if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) + parts[r>>8].type = PT_DFRM; + if((r&0xFF)==PT_NITR && 15>(rand()%1000)) + parts[r>>8].type = PT_DESL; + if((r&0xFF)==PT_OILL && 5>(rand()%1000)) + parts[r>>8].type = PT_PLAS; + if((r&0xFF)==PT_PLNT && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + if((r&0xFF)==PT_PLAS && 5>(rand()%1000)) + parts[r>>8].type = PT_OILL; + if((r&0xFF)==PT_DESL && 15>(rand()%1000)) + parts[r>>8].type = PT_GASS; + if((r&0xFF)==PT_COAL && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + } + } + else if(t==PT_PHOT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=0; nx<1; nx++) + for(ny=0; ny<1; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + } + } + else if(t==PT_LCRY) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_LCRY) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_BTRY) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts_avg(i,r>>8) != PT_INSL) + { + if((rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) + { + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + parts[r>>8].type = PT_SPRK; + } + } + } + }else if(t==PT_SWCH) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8)!=PT_INSL) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + if(t==PT_SWCH) + if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) + { + parts[i].life--; + } + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) + continue; + rt = parts[r>>8].type; + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) + { + parts[r>>8].type = PT_FIRE; + parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + parts[r>>8].life = rand()%80+180; + if(ptypes[rt].explosive) + pv[y/CELL][x/CELL] += 0.25f * CFDS; + continue; + } + lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; + if(lpv < 1) lpv = 1; + if(legacy_enable) + { + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && + ptypes[rt].meltable*lpv>(rand()%1000)) + { + if(t!=PT_LAVA || parts[i].life>0) + { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } + else + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) + { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = PT_STNE; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) + { + kill_part(r>>8); + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; + parts[i].ctype = PT_NONE; + goto killed; + } + } + } + pavg = parts_avg(i, r>>8); + if(rt==PT_SWCH && t==PT_SPRK) + { + pavg = parts_avg(r>>8, i); + if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) + parts[r>>8].life = 10; + if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) + parts[r>>8].life = 9; + if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].ctype = PT_SWCH; + parts[r>>8].life = 4; + } + } + pavg = parts_avg(i, r>>8); + if(pavg != PT_INSL) + { + if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) + parts[r>>8].temp = parts[r>>8].temp+10.0f; + } + } + if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 6; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 5; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) + { + if(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) + { + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) + { + parts[i].life = rand()%150+50; + parts[i].type = PT_PLSM; + parts[i].ctype = PT_NBLE; + parts[i].temp = 3500; + pv[y/CELL][x/CELL] += 1; + } + if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) + { + parts[i].type = PT_SWCH; + parts[i].life = 11; + } + } + } +killed: + if(parts[i].type == PT_NONE) + continue; + } + if(t==PT_STKM) + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<0 && (death == 1)) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; + player[10] += 2; + player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; + player[18] += 2; + player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; + player[10] += 1; + player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; + player[18] += 1; + player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; + player[10] += 2; + player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; + player[18] += 2; + player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; + player[10] += 1; + player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; + player[18] += 1; + player[13] -= 1; + } + + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) + || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) + { + int random = abs(rand()%3-1)*3; + if (random==0) + { + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + } + else + { + parts[r>>8].vy = 0; + parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; + } + } + + } + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[10] += 1; + player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } + if(t==PT_CLNE) + { + if(!parts[i].ctype) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx30&&parts[i].temp<44){ + create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST); + } + } + if(t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1) + { + parts[i].type = PT_NBLE; + parts[i].life = 0; + } + if (t==PT_FIRE && parts[i].life <=1) + { + t = parts[i].type = PT_SMKE; + parts[i].life = rand()%20+250; + } + + nx = (int)(parts[i].x+0.5f); + ny = (int)(parts[i].y+0.5f); + + if(nx=XRES-CELL || + ny=YRES-CELL) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + continue; + } + + rt = parts[i].flags & FLAG_STAGNANT; + parts[i].flags &= ~FLAG_STAGNANT; + if(!try_move(i, x, y, nx, ny)) + { + parts[i].x = lx; + parts[i].y = ly; + if(ptypes[t].falldown) + { + if(nx!=x && try_move(i, x, y, nx, y)) + { + parts[i].x = ix; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x, ny)) + { + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else + { + r = (rand()%2)*2-1; + if(ny!=y && try_move(i, x, y, x+r, ny)) + { + parts[i].x += r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x-r, ny)) + { + parts[i].x -= r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y+r)) + { + parts[i].x = ix; + parts[i].y += r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y-r)) + { + parts[i].x = ix; + parts[i].y -= r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) + { + s = 0; + if(!rt || nt) + rt = 50; + else + rt = 10; + for(j=x+r; j>=0 && j>=x-rt && j0) + r = 1; + else + r = -1; + if(s) + for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny(rand()%1000)) + { + kill_part(i); + continue; + } + else if(try_move(i, x, y, 2*x-nx, ny)) + { + parts[i].x = (float)(2*x-nx); + parts[i].y = (float)iy; + parts[i].vx *= ptypes[t].collision; + } + else if(try_move(i, x, y, nx, 2*y-ny)) + { + parts[i].x = (float)ix; + parts[i].y = (float)(2*y-ny); + parts[i].vy *= ptypes[t].collision; + } + else + { + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + } + } + +justdraw: + + nx = (int)(parts[i].x+0.5f); + ny = (int)(parts[i].y+0.5f); + + if(nx=XRES-CELL || + ny=YRES-CELL) + { + kill_part(i); + continue; + } + if(cmode!=CM_HEAT) + { + if(t==PT_STKM) //Just draw head here + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; + vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; + vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; + vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; + } + draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); + draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); + draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); + draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); + + isplayer = 1; //It's a secret. Tssss... + } + if(t==PT_MWAX&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,224,224,170,255); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,224,224,170,20); + else + blendpixel(vid,x+nx,y+ny,224,224,170,40); + } + } + + } + else if(t==PT_ACID) + { + if(parts[i].life>255) parts[i].life = 255; + if(parts[i].life<47) parts[i].life = 48; + s = (255/((parts[i].life-46)*28)); + if(s==0) s = 1; + cr = PIXR(ptypes[t].pcolors)/s; + cg = PIXG(ptypes[t].pcolors)/s; + cb = PIXB(ptypes[t].pcolors)/s; + if(cmode==6){ + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); + } + } + } else { + blendpixel(vid, nx, ny, cr, cg, cb, 255); + } + + if(cmode==4) + { + blendpixel(vid, nx+1, ny, cr, cg, cb, 223); + blendpixel(vid, nx-1, ny, cr, cg, cb, 223); + blendpixel(vid, nx, ny+1, cr, cg, cb, 223); + blendpixel(vid, nx, ny-1, cr, cg, cb, 223); + + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); + } + } + else if(t==PT_OILL&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,64,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,64,16,40); + } + } + } + else if(t==PT_NEUT) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 8; + cb = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = 0x20; + cg = 0xE0; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLUT&&cmode == 6) + { + int tempx; + int tempy; + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(tempx = 2; tempx < 10; tempx++) { + for(tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_URAN&&cmode == 6) + { + int tempx; + int tempy; + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(tempx = 2; tempx < 10; tempx++) { + for(tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_SLTW&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,80,240,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,80,240,50); + } + } + } + else if(t==PT_PHOT) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 12; + cb = 12; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_SWCH && parts[i].life == 10) + { + x = nx; + y = ny; + blendpixel(vid,x,y,17,217,24,255); + } + else if(t==PT_LNTG&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,128,160,223,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,128,160,223,50); + } + } + } + else if(t==PT_SMKE) + { + if(cmode == 3||cmode==4 || cmode==6) + { + x = nx/CELL; + y = ny/CELL; + cg = 10; + cb = 10; + cr = 10; + cg += fire_g[y][x]; + if(cg > 50) cg = 50; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 50) cb = 50; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 50) cr = 50; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,100,100,100,30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,100,100,100,10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,100,100,100,20); + } + } + } + } + else if(t==PT_WATR&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + + } else if(t==PT_DSTW&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + } + else if(t==PT_NITR&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,224,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,224,16,50); + } + } + + } + else if(t==PT_LRBD&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,170,170,170,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,170,170,170,50); + } + } + + } + + else if(t==PT_NBLE&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,235,73,23,100); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,235,73,23,30); + else + blendpixel(vid,x+nx,y+ny,235,73,23,50); + } + } + + } + else if(t==PT_GASS&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,255,255,0,180); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,255,255,0,50); + else + blendpixel(vid,x+nx,y+ny,255,255,0,80); + } + } + + } + else if(t==PT_WTRV) + { + if(cmode == 3||cmode==4 || cmode==6) + { + x = nx/CELL; + y = ny/CELL; + cg = PIXG(ptypes[t].pcolors)/3; + cb = PIXB(ptypes[t].pcolors)/3; + cr = PIXR(ptypes[t].pcolors)/3; + cg += fire_g[y][x]; + if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); + } + } + } + } + else if(t==PT_THDR) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 16; + cb = 20; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xA0; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LCRY) + { + if(cmode == 3||cmode==4 || cmode==6) + { + //cr = R/8; + //cg = G/8; + //cb = B/8; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); + //x = nx/CELL; + //y = ny/CELL; + //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } + else + { + cr = 0x50+(parts[i].life*10); + cg = 0x50+(parts[i].life*10); + cb = 0x50+(parts[i].life*10); + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLSM) + { + float ttemp = parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = plasma_data[caddress]; + uint8 G = plasma_data[caddress+1]; + uint8 B = plasma_data[caddress+2]; + if(cmode == 3||cmode==4 || cmode==6) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_FIRE && parts[i].life) + { + if(cmode == 3||cmode==4 || cmode==6) + { + cr = parts[i].life / 4; + cg = parts[i].life / 16; + cb = parts[i].life / 32; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = parts[i].life * 8; + cg = parts[i].life * 2; + cb = parts[i].life; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LAVA && parts[i].life) + { + cr = parts[i].life * 2 + 0xE0; + cg = parts[i].life * 1 + 0x50; + cb = parts[i].life/2 + 0x10; + if(cr>255) cr = 255; + if(cg>192) cg = 192; + if(cb>128) cb = 128; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 64); + blendpixel(vid, nx-1, ny, cr, cg, cb, 64); + blendpixel(vid, nx, ny+1, cr, cg, cb, 64); + blendpixel(vid, nx, ny-1, cr, cg, cb, 64); + if(cmode == 3||cmode==4 || cmode==6) + { + cr /= 32; + cg /= 32; + cb /= 32; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else if(t==PT_LAVA || t==PT_SPRK) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + if(cmode == 3 || cmode==4 || cmode==6) + { + if(t == PT_LAVA) + { + cr = 3; + cg = i%2; + cb = 0; + } + else + { + cr = 8; + cg = 12; + cb = 16; + } + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + } + else + { + float ttemp = parts[i].temp+(-MIN_TEMP); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); + uint8 R = color_data[caddress]; + uint8 G = color_data[caddress+1]; + uint8 B = color_data[caddress+2]; + + if(t==PT_STKM) //Stick man should be visible in heat mode + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); + vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); + vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); + vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); + } + draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); + draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); + draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); + draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); + } + else + { + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); + //blendpixel(vid, nx+1, ny, R, G, B, 255); + } + } + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) + { + uint8 R = PIXR(ptypes[t].pcolors); + uint8 G = PIXG(ptypes[t].pcolors); + uint8 B = PIXB(ptypes[t].pcolors); + + //if(vid[(ny-1)*YRES+(nx-1)]!=0){ + // blendpixel(vid, nx, ny-1, R, G, B, 46); + //} + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + } + if(framerender){ + framerender = 0; + sys_pause = 1; + } +} + +void update_particles_i_th(void *arg) +{ + upstruc *newup = (upstruc*)arg; + update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); + return; +} + +void update_particles(pixel *vid) +{ + int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; + float lx, ly; +#ifdef MT + int pt = 0, pc = 0; + pthread_t *InterThreads; +#endif + + isplayer = 0; //Needed for player spawning + memset(pmap, 0, sizeof(pmap)); + r = rand()%2; + for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==13) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && (!sys_pause||framerender)) + emap[y][x] --; + } + } + } + else + { + for(y=0; y>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==9) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && (!sys_pause||framerender)) + emap[y][x] --; + } + } + } + +#ifdef MT + if(numCores > 1) + { + InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); + for(pc = 0; pc=XRES || ny<0 || ny>=YRES) + break; + addpixel(vid, nx, ny, 255, 255, 255, 64); + i = nx/CELL; + j = ny/CELL; + lx += vx[j][i]*0.125f; + ly += vy[j][i]*0.125f; + if(bmap[j][i]==5 && i!=x && j!=y) + break; + } + drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); + } + +} + +void update_particles_th(void *arg) +{ + update_particles((pixel*)arg); + return; +} + +/*********************************************************** + * SDL OUTPUT * + ***********************************************************/ + +SDLMod sdl_mod; +int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; + +#include "icon.h" +void sdl_seticon(void) +{ +#ifdef WIN32 + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else +#ifdef MACOSX + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else + SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#endif +#endif +} + +void sdl_open(void) +{ + if(SDL_Init(SDL_INIT_VIDEO)<0) + { + fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); + exit(1); + } + atexit(SDL_Quit); +#ifdef PIX16 + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); +#else + sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); +#endif + if(!sdl_scrn) + { + fprintf(stderr, "Creating window: %s\n", SDL_GetError()); + exit(1); + } + SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); + sdl_seticon(); + SDL_EnableUNICODE(1); + //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); +} + +int frame_idx=0; +void dump_frame(pixel *src, int w, int h, int pitch) +{ + char frame_name[32]; + int j,i; + unsigned char c[3]; + FILE *f; + sprintf(frame_name,"frame%04d.ppm",frame_idx); + f=fopen(frame_name,"wb"); + fprintf(f,"P6\n%d %d\n255\n",w,h); + for(j=0; j=0 && x=0 && yPT_NUM) + return 2; + if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) + return 3; + i = XRES*YRES; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) + return 1; + size = i; + } + else + d = c; + + if(size < XRES*YRES) + { + if(bzip2) + free(d); + return 1; + } + + sy = 0; + for(y=0; y+scl<=YRES; y+=scl) + { + sx = 0; + for(x=0; x+scl<=XRES; x+=scl) + { + a = 0; + r = g = b = 0; + for(j=0; j=PT_NUM) + goto corrupt; + r += PIXR(ptypes[t].pcolors); + g += PIXG(ptypes[t].pcolors); + b += PIXB(ptypes[t].pcolors); + a ++; + } + } + if(a) + { + a = 256/a; + r = (r*a)>>8; + g = (g*a)>>8; + b = (b*a)>>8; + } + + drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); + sx++; + } + sy++; + } + + if(bzip2) + free(d); + return 0; + +corrupt: + if(bzip2) + free(d); + return 1; +} + +static char *mystrdup(char *s) +{ + char *x; + if(s) + { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; + } + return s; +} + +void *build_save(int *size, int x0, int y0, int w, int h) +{ + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; + int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); + int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + // save the required air state + for(y=by0; y255) i=255; + d[p++] = i; + } + for(y=by0; y255) i=255; + d[p++] = i; + } + + // save the particle map + for(i=0; i=x0 && x=y0 && y255) x=255; + if(y<0) y=0; + if(y>255) y=255; + d[p++] = x; + d[p++] = y; + } + } + for(j=0; j255) tttemp=255; + d[p++] = tttemp; + } + } + for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; + d[p++] = (signs[i].y-y0); + d[p++] = (signs[i].y-y0)>>8; + d[p++] = signs[i].ju; + x = strlen(signs[i].text); + d[p++] = x; + memcpy(d+p, signs[i].text, x); + p+=x; + } + + i = (p*101+99)/100 + 612; + c = malloc(i); + c[0] = 0x66; + c[1] = 0x75; + c[2] = 0x43; + c[3] = legacy_enable; + c[4] = SAVE_VERSION; + c[5] = CELL; + c[6] = bw; + c[7] = bh; + c[8] = p; + c[9] = p >> 8; + c[10] = p >> 16; + c[11] = p >> 24; + + i -= 12; + + if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) + { + free(d); + free(c); + return NULL; + } + free(d); + + *size = i+12; + return c; +} + +int parse_save(void *save, int size, int replace, int x0, int y0) +{ + unsigned char *d,*c=save; + int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; + int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; + int fp[NPART], nf=0; + + if(size<16) + return 1; + if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) + return 1; + if(c[4]>SAVE_VERSION) + return 2; + ver = c[4]; + + if(ver<34) + { + legacy_enable = 1; + } + else + { + if(c[3]==1||c[3]==0) + legacy_enable = c[3]; + else + legacy_beta = 1; + } + + bw = c[6]; + bh = c[7]; + if(bx0+bw > XRES/CELL) + bx0 = XRES/CELL - bw; + if(by0+bh > YRES/CELL) + by0 = YRES/CELL - bh; + if(bx0 < 0) + bx0 = 0; + if(by0 < 0) + by0 = 0; + + if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) + return 3; + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + return 1; + size = i; + + if(size < bw*bh) + return 1; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + if(replace) + { + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(signs, 0, sizeof(signs)); + memset(parts, 0, sizeof(particle)*NPART); + memset(pmap, 0, sizeof(pmap)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(pv, 0, sizeof(pv)); + } + + // make a catalog of free parts + memset(pmap, 0, sizeof(pmap)); + for(i=0; i= size) + goto corrupt; + fvx[y][x] = (d[p++]-127.0f)/64.0f; + } + for(y=by0; y= size) + goto corrupt; + fvy[y][x] = (d[p++]-127.0f)/64.0f; + } + + // load the particle map + i = 0; + pty = p; + for(y=y0; y= size) + goto corrupt; + j=d[p++]; + if(j >= PT_NUM) + goto corrupt; + if(j && !(isplayer == 1 && j==PT_STKM)) + { + if(pmap[y][x]) + { + k = pmap[y][x]>>8; + parts[k].type = j; + parts[k].x = (float)x; + parts[k].y = (float)y; + m[(x-x0)+(y-y0)*w] = k+1; + } + else if(i < nf) + { + parts[fp[i]].type = j; + parts[fp[i]].x = (float)x; + parts[fp[i]].y = (float)y; + m[(x-x0)+(y-y0)*w] = fp[i]+1; + i++; + } + else + m[(x-x0)+(y-y0)*w] = NPART+1; + } + } + + // load particle properties + for(j=0; j= size) + goto corrupt; + if(i < NPART) + { + parts[i].vx = (d[p++]-127.0f)/16.0f; + parts[i].vy = (d[p++]-127.0f)/16.0f; + if(parts[i].type == PT_STKM) + { + player[2] = PT_DUST; + + player[3] = parts[i].x-1; //Setting legs positions + player[4] = parts[i].y+6; + player[5] = parts[i].x-1; + player[6] = parts[i].y+6; + + player[7] = parts[i].x-3; + player[8] = parts[i].y+12; + player[9] = parts[i].x-3; + player[10] = parts[i].y+12; + + player[11] = parts[i].x+1; + player[12] = parts[i].y+6; + player[13] = parts[i].x+1; + player[14] = parts[i].y+6; + + player[15] = parts[i].x+3; + player[16] = parts[i].y+12; + player[17] = parts[i].x+3; + player[18] = parts[i].y+12; + + } + } + else + p += 2; + } + } + for(j=0; j= size) + goto corrupt; + if(i <= NPART) + parts[i-1].life = d[p++]*4; + else + p++; + } + } + for(j=0; j=34&&legacy_beta==0) + { + if(p >= size) + { + goto corrupt; + } + if(i <= NPART) + { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } + else + { + p++; + } + } + else + { + parts[i-1].temp = ptypes[parts[i-1].type].heat; + } + } + } + for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) + { + if(p >= size) + goto corrupt; + if(i <= NPART) + parts[i-1].ctype = d[p++]; + else + p++; + } + } + + if(p >= size) + goto version1; + j = d[p++]; + for(i=0; i size) + goto corrupt; + for(k=0; k size) + goto corrupt; + if(kSAVE_VERSION) + return NULL; + + bw = c[6]; + bh = c[7]; + w = bw*CELL; + h = bh*CELL; + + if(c[5]!=CELL) + return NULL; + + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return NULL; + fb = calloc(w*h, PIXELSIZE); + if(!fb) + { + free(d); + return NULL; + } + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + goto corrupt; + size = i; + + if(size < bw*bh) + goto corrupt; + + k = 0; + for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) + goto corrupt; + + for(y=0; y= size) + goto corrupt; + j=d[p++]; + if(j0) + { + if(j==PT_STKM) //Stickman should be drawed another way + { + //Stickman drawing + for(k=-2; k<=1; k++) + { + fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); + fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); + fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); + fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); + } + draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); + draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); + draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); + draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); + } + else + fb[y*w+x] = ptypes[j].pcolors; + } + } + + free(d); + *width = w; + *height = h; + return fb; + +corrupt: + free(d); + free(fb); + return NULL; +} + +/* NO, I DON'T THINK SO + #include "fbi.h" + + pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) + { + unsigned char *tmp; + pixel *res; + int i; + + tmp = malloc(width*height*3); + if(!tmp) + return NULL; + res = malloc(width*height*PIXELSIZE); + if(!res) { + free(tmp); + return NULL; + } + + i = width*height*3; + if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { + free(res); + free(tmp); + return NULL; + } + + for(i=0; iXRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) + { + factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); + factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); + if(factor_y > factor_x) + factor_x = factor_y; + tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); + free(stamps[i].thumb); + stamps[i].thumb = tmp; + } + } + + free(data); +} + +int clipboard_ready = 0; +void *clipboard_data = 0; +int clipboard_length = 0; + +void stamp_save(int x, int y, int w, int h) +{ + FILE *f; + int n; + char fn[64], sn[16]; + void *s=build_save(&n, x, y, w, h); + +#ifdef WIN32 + _mkdir("stamps"); +#else + mkdir("stamps", 0755); +#endif + + stamp_gen_name(sn); + sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); + + f = fopen(fn, "wb"); + if(!f) + return; + fwrite(s, n, 1, f); + fclose(f); + + free(s); + + if(stamps[STAMP_MAX-1].thumb) + free(stamps[STAMP_MAX-1].thumb); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); + memset(stamps, 0, sizeof(struct stamp_info)); + if(stamp_count0) + { + memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); + memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); + memcpy(stamps, &tmp, sizeof(struct stamp_info)); + + stamp_update(); + } + + return data; +} + +void stamp_init(void) +{ + int i; + FILE *f; + + memset(stamps, 0, sizeof(stamps)); + + f=fopen("stamps" PATH_SEP "stamps.def", "rb"); + if(!f) + return; + for(i=0; i=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=60) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=20) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(!bq && mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + if(b==1&&h!=-1) + { + *sl = h; + } + if(b==4&&h!=-1) + { + *sr = h; + } +} + +int create_parts(int x, int y, int r, int c) +{ + int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; + + if(c == 125) + { + i = x / CELL; + j = y / CELL; + for(v=-1; v<2; v++) + for(u=-1; u<2; u++) + if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) + { + if(cp) + create_parts(y, x, r, c); + else + create_parts(x, y, r, c); + } + e -= 1.0f; + } + } +} + +void create_box(int x1, int y1, int x2, int y2, int c) +{ + int i, j; + if(x1>x2) + { + i = x2; + x2 = x1; + x1 = i; + } + if(y1>y2) + { + j = y2; + y2 = y1; + y1 = j; + } + for(j=y1; j<=y2; j++) + for(i=x1; i<=x2; i++) + create_parts(i, j, 1, c); +} + +int flood_parts(int x, int y, int c, int cm, int bm) +{ + int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) + { + c = c-100; + } + if(cm==-1) + { + if(c==0) + { + cm = pmap[y][x]&0xFF; + if(!cm) + return 0; + } + else + cm = 0; + } + if(bm==-1) + { + if(c==30) + { + bm = bmap[y/CELL][x/CELL]; + if(!bm) + return 0; + if(bm==1) + cm = 0xFF; + } + else + bm = 0; + } + + if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) + return 1; + + // go left as far as possible + x1 = x2 = x; + while(x1>=CELL) + { + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + break; + x1--; + } + while(x2=CELL+dy) + for(x=x1; x<=x2; x++) + if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) + if(!flood_parts(x, y-dy, co, cm, bm)) + return 0; + if(yhide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(ed->str[0]) + { + drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } + else if(!ed->focus) + drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); + if(ed->focus) + { + cx = textnwidth(str, ed->cursor); + for(i=-3; i<9; i++) + drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); + } +} + +char *shift_0="`1234567890-=[]\\;',./"; +char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; + +void ui_edit_process(int mx, int my, int mb, ui_edit *ed) +{ + char ch, ts[2], echo[256], *str; + int l, i; +#ifdef RAWINPUT + char *p; +#endif + + if(mb) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } + else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } + else + ed->focus = 0; + } + if(ed->focus && sdl_key) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + l = strlen(ed->str); + switch(sdl_key) + { + case SDLK_HOME: + ed->cursor = 0; + break; + case SDLK_END: + ed->cursor = l; + break; + case SDLK_LEFT: + if(ed->cursor > 0) + ed->cursor --; + break; + case SDLK_RIGHT: + if(ed->cursor < l) + ed->cursor ++; + break; + case SDLK_DELETE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + ed->str[ed->cursor] = 0; + else if(ed->cursor < l) + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + break; + case SDLK_BACKSPACE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + { + if(ed->cursor > 0) + memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); + ed->cursor = 0; + } + else if(ed->cursor > 0) + { + ed->cursor--; + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + } + break; + default: +#ifdef RAWINPUT + if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) + { + ch = sdl_key; + if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) + { + if(ch>='a' && ch<='z') + ch &= ~0x20; + p = strchr(shift_0, ch); + if(p) + ch = shift_1[p-shift_0]; + } + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#else + if(sdl_ascii>=' ' && sdl_ascii<127) + { + ch = sdl_ascii; + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#endif + break; + } + } +} + +typedef struct ui_checkbox +{ + int x, y; + int focus, checked; +} ui_checkbox; + +void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) +{ + int w = 12; + if(ed->checked) + { + drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); + } + if(ed->focus) + { + drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); + } + else + { + drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); + } +} + +void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) +{ + int w = 12; + + if(mb && !mbq) + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->checked = (ed->checked)?0:1; + } + } + else + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->focus = 1; + } + else + { + ed->focus = 0; + } + } +} + +void error_ui(pixel *vid_buf, int err, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + char *msg; + + msg = malloc(strlen(txt)+16); + if(err) + sprintf(msg, "%03d %s", err, txt); + else + sprintf(msg, "%s", txt); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + if(err) + drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); + else + drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + free(msg); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_ui(pixel *vid_buf, char *top, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); + drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_box(pixel *vid_buf, char *msg) +{ + int w = textwidth(msg)+16; + int x0=(XRES-w)/2,y0=(YRES-24)/2; + + clearrect(vid_buf, x0-2, y0-2, w+4, 28); + drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); +} + +int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + int ret = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); + drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); + drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); + drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) + { + ret = 1; + break; + } + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + { + ret = 1; + break; + } + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + return ret; +} + +int execute_tagop(pixel *vid_buf, char *op, char *tag) +{ + int status; + char *result; + + char *names[] = {"ID", "Tag", NULL}; + char *parts[2]; + + char *uri = malloc(strlen(SERVER)+strlen(op)+36); + sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); + + parts[0] = svf_id; + parts[1] = tag; + + result = http_multipart_post( + uri, + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + free(uri); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 1; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 1; + } + + if(result[2]) + { + strncpy(svf_tags, result+3, 255); + svf_id[15] = 0; + } + + if(result) + free(result); + + return 0; +} + +struct strlist +{ + char *str; + struct strlist *next; +}; + +void strlist_add(struct strlist **list, char *str) +{ + struct strlist *item = malloc(sizeof(struct strlist)); + item->str = mystrdup(str); + item->next = *list; + *list = item; +} + +int strlist_find(struct strlist **list, char *str) +{ + struct strlist *item; + for(item=*list; item; item=item->next) + if(!strcmp(item->str, str)) + return 1; + return 0; +} + +void strlist_free(struct strlist **list) +{ + struct strlist *item; + while(*list) + { + item = *list; + *list = (*list)->next; + free(item); + } +} + +void tag_list_ui(pixel *vid_buf) +{ + int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; + char *p,*q,s; + char *tag=NULL, *op=NULL; + ui_edit ed; + struct strlist *vote=NULL,*down=NULL; + + ed.x = x0+25; + ed.y = y0+221; + ed.w = 158; + ed.nx = 1; + ed.def = "[new tag]"; + ed.focus = 0; + ed.hide = 0; + ed.cursor = 0; + strcpy(ed.str, ""); + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + op = tag = NULL; + + drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 256); + drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); + p = svf_tags; + s = svf_tags[0] ? ' ' : 0; + y = 36 + y0; + while(s) + { + q = strchr(p, ' '); + if(!q) + q = p+strlen(p); + s = *q; + *q = 0; + if(svf_own || svf_admin || svf_mod) + { + drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); + d = 14; + if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) + { + if(!ed1.focus) + break; + ed1.focus = 0; + ed2.focus = 1; + } + if(sdl_key==SDLK_ESCAPE) + { + if(!ed1.focus && !ed2.focus) + return; + ed1.focus = 0; + ed2.focus = 0; + } + } + + strcpy(svf_user, ed1.str); + md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); + + res = http_multipart_post( + "http://" SERVER "/Login.api", + NULL, NULL, NULL, + svf_user, svf_pass, + &err, NULL); + if(err != 200) + { + error_ui(vid_buf, err, http_ret_text(err)); + if(res) + free(res); + goto fail; + } + if(res && !strncmp(res, "OK", 2)) + { + if(!strcmp(res, "OK ADMIN")) + { + svf_admin = 1; + svf_mod = 0; + } + else if(!strcmp(res, "OK MOD")) + { + svf_admin = 0; + svf_mod = 1; + } + else + { + svf_admin = 0; + svf_mod = 0; + } + free(res); + svf_login = 1; + return; + } + if(!res) + res = mystrdup("Unspecified Error"); + error_ui(vid_buf, 0, res); + free(res); + +fail: + strcpy(svf_user, ""); + strcpy(svf_pass, ""); + svf_login = 0; + svf_own = 0; + svf_admin = 0; + svf_mod = 0; +} + +void execute_delete(pixel *vid_buf, char *id) +{ + int status; + char *result; + + char *names[] = {"ID", NULL}; + char *parts[1]; + + parts[0] = id; + + result = http_multipart_post( + "http://" SERVER "/Delete.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result) + free(result); +} + +int execute_vote(pixel *vid_buf, char *id, char *action) +{ + int status; + char *result; + + char *names[] = {"ID", "Action", NULL}; + char *parts[2]; + + parts[0] = id; + parts[1] = action; + + result = http_multipart_post( + "http://" SERVER "/Vote.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 0; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 0; + } + + if(result) + free(result); + return 1; +} + +static char hex[] = "0123456789ABCDEF"; + +void strcaturl(char *dst, char *src) +{ + char *d; + unsigned char *s; + + for(d=dst; *d; d++) ; + + for(s=(unsigned char *)src; *s; s++) + { + if((*s>='0' && *s<='9') || + (*s>='a' && *s<='z') || + (*s>='A' && *s<='Z')) + *(d++) = *s; + else + { + *(d++) = '%'; + *(d++) = hex[*s>>4]; + *(d++) = hex[*s&15]; + } + } + *d = 0; +} + +#define THUMB_CACHE_SIZE 256 + +char *thumb_cache_id[THUMB_CACHE_SIZE]; +void *thumb_cache_data[THUMB_CACHE_SIZE]; +int thumb_cache_size[THUMB_CACHE_SIZE]; +int thumb_cache_lru[THUMB_CACHE_SIZE]; + +void thumb_cache_inval(char *id) +{ + int i,j; + for(i=0; i= THUMB_CACHE_SIZE) + return; + free(thumb_cache_id[i]); + free(thumb_cache_data[i]); + thumb_cache_id[i] = NULL; + for(j=0; j thumb_cache_lru[i]) + thumb_cache_lru[j]--; +} +void thumb_cache_add(char *id, void *thumb, int size) +{ + int i,m=-1,j=-1; + thumb_cache_inval(id); + for(i=0; i m) + { + m = thumb_cache_lru[i]; + j = i; + } + } + if(i >= THUMB_CACHE_SIZE) + { + thumb_cache_inval(thumb_cache_id[j]); + i = j; + } + for(j=0; j= THUMB_CACHE_SIZE) + return 0; + for(j=0; j=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+5); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + else if(!strncmp(str, "TAG ", 4)) + { + if(j >= TAG_MAX) + { + str = p; + continue; + } + q = strchr(str+4, ' '); + if(!q) + { + str = p; + continue; + } + *(q++) = 0; + tag_names[j] = mystrdup(str+4); + tag_votes[j] = atoi(q); + j++; + } + else + { + if(i>=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + str = p; + } + if(*str) + i++; + return i; +} + +#define IMGCONNS 3 +#define TIMEOUT 100 +#define HTTP_TIMEOUT 10 + +int search_own = 0; +int search_date = 0; +int search_page = 0; +char search_expr[256] = ""; + +int search_ui(pixel *vid_buf) +{ + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; + int thumb_drawn[GRID_X*GRID_Y]; + pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + float ry; + time_t http_last_use=HTTP_TIMEOUT; + ui_edit ed; + + + void *http = NULL; + int active = 0; + char *last = NULL; + int search = 0; + int lasttime = TIMEOUT; + char *uri; + int status; + char *results; + char *tmp, ts[64]; + + void *img_http[IMGCONNS]; + char *img_id[IMGCONNS]; + void *thumb, *data; + int thlen, dlen; + + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + + memset(img_http, 0, sizeof(img_http)); + memset(img_id, 0, sizeof(img_id)); + + memset(search_ids, 0, sizeof(search_ids)); + memset(search_names, 0, sizeof(search_names)); + memset(search_scoreup, 0, sizeof(search_scoreup)); + memset(search_scoredown, 0, sizeof(search_scoredown)); + memset(search_publish, 0, sizeof(search_publish)); + memset(search_owners, 0, sizeof(search_owners)); + memset(search_thumbs, 0, sizeof(search_thumbs)); + memset(search_thsizes, 0, sizeof(search_thsizes)); + + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + + do_open = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = 65; + ed.y = 13; + ed.w = XRES-200; + ed.nx = 1; + ed.def = "[search terms]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(search_expr); + strcpy(ed.str, search_expr); + + sdl_wheel = 0; + + while(!sdl_poll()) + { + uih = 0; + bq = b; + mxq = mx; + myq = my; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + if(mx!=mxq || my!=myq || sdl_wheel || b) + mmt = 0; + else if(mmt 9) + { + drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); + drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); + } + + ui_edit_draw(vid_buf, &ed); + + if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) + { + if(search_page) + { + search_page --; + lasttime = TIMEOUT; + } + sdl_wheel = 0; + uih = 1; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) + { + lasttime = TIMEOUT; + search_page ++; + page_count = exp_res; + } + sdl_wheel = 0; + uih = 1; + } + + tp = -1; + if(is_p1) + { + drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); + for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) + for(gi=0; giTAG_MAX || !tag_names[pos]) + break; + if(tag_votes[0]) + i = 127+(128*tag_votes[pos])/tag_votes[0]; + else + i = 192; + w = textwidth(tag_names[pos]); + if(w>XRES/GRID_X-5) + w = XRES/GRID_X-5; + gx = (XRES/GRID_X)*gi; + gy = gj*14 + 46; + if(mx>=gx && mx=gy && my XRES/GRID_X-10) + { + tmp = malloc(strlen(search_names[pos])+4); + strcpy(tmp, search_names[pos]); + j = textwidthx(tmp, XRES/GRID_X-15); + strcpy(tmp+j, "..."); + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); + free(tmp); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); + j = textwidth(search_owners[pos]); + if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && + my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) + { + st = 1; + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); + if(search_thumbs[pos]&&thumb_drawn[pos]==0) + { + render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); + thumb_drawn[pos] = 1; + } + own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); + if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) + mp = pos; + if(own) + { + if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) + { + mp = -1; + dp = pos; + } + } + if(mp==pos && !st) + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); + else + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); + if(own) + { + if(dp == pos) + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); + else + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); + } + if(!search_publish[pos]) + { + drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); + drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } + if(view_own || svf_admin || svf_mod) + { + sprintf(ts+1, "%d", search_votes[pos]); + ts[0] = 0xBB; + for(j=1; ts[j]; j++) + ts[j] = 0xBC; + ts[j-1] = 0xB9; + ts[j] = 0xBA; + ts[j+1] = 0; + w = gx+XRES/GRID_S-2-textwidth(ts); + h = gy+YRES/GRID_S-11; + drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); + for(j=0; ts[j]; j++) + ts[j] -= 14; + drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); + sprintf(ts, "%d", search_votes[pos]); + for(j=0; ts[j]; j++) + ts[j] += 127; + drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); + } + if(search_scoreup[pos]>0||search_scoredown[pos]>0) + { + lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); + + if(((YRES/GRID_S+3)/2)>lv) + { + ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); + if(lv<8) + { + ry = ry/(8-lv); + } + nyu = search_scoreup[pos]*ry; + nyd = search_scoredown[pos]*ry; + } + else + { + ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); + nyu = search_scoreup[pos]/ry; + nyd = search_scoredown[pos]/ry; + } + + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); + + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); + } + } + + if(mp!=-1 && mmt>=TIMEOUT/5 && !st) + { + gi = mp % GRID_X; + gj = mp / GRID_X; + if(is_p1) + gj += GRID_Y-GRID_P; + gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; + gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; + i = w = textwidth(search_names[mp]); + h = YRES/GRID_Z+30; + if(w=XRES-2) gx=XRES-3-w; + if(gy<32) gy=32; + if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; + clearrect(vid_buf, gx-2, gy-3, w+4, h); + drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); + if(search_thumbs[mp]) + render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); + drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); + drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); + } + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(sdl_key==SDLK_RETURN) + { + if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) + lasttime = TIMEOUT; + else if(search_ids[0] && !search_ids[1]) + { + bq = 0; + b = 1; + mp = 0; + } + } + if(sdl_key==SDLK_ESCAPE) + goto finish; + + if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) + { + search_own = !search_own; + lasttime = TIMEOUT; + } + if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) + { + search_date = !search_date; + lasttime = TIMEOUT; + } + + if(b && !bq && dp!=-1) + if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) + { + execute_delete(vid_buf, search_ids[dp]); + lasttime = TIMEOUT; + if(last) + { + free(last); + last = NULL; + } + } + + if(b && !bq && tp!=-1) + { + strncpy(ed.str, tag_names[tp], 255); + lasttime = TIMEOUT; + } + + if(b && !bq && mp!=-1 && st) + { + sprintf(ed.str, "user:%s", search_owners[mp]); + lasttime = TIMEOUT; + } + + if(do_open==1) + { + mp = 0; + } + + if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) + { + fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); + info_box(vid_buf, "Loading..."); + + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + data = http_simple_get(uri, &status, &dlen); + free(uri); + + if(status == 200) + { + status = parse_save(data, dlen, 1, 0, 0); + switch(status) + { + case 1: + error_ui(vid_buf, 0, "Simulation corrupted"); + break; + case 2: + error_ui(vid_buf, 0, "Simulation from a newer version"); + break; + case 3: + error_ui(vid_buf, 0, "Simulation on a too large grid"); + break; + } + if(!status) + { + char *tnames[] = {"ID", NULL}; + char *tparts[1]; + int tplens[1]; + if(svf_last) + free(svf_last); + svf_last = data; + svf_lsize = dlen; + + tparts[0] = search_ids[mp]; + tplens[0] = strlen(search_ids[mp]); + data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); + + svf_open = 1; + svf_own = svf_login && !strcmp(search_owners[mp], svf_user); + svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); + + strcpy(svf_id, search_ids[mp]); + strcpy(svf_name, search_names[mp]); + if(status == 200) + { + if(data) + { + strncpy(svf_tags, data, 255); + svf_tags[255] = 0; + } + else + svf_tags[0] = 0; + } + else + { + svf_tags[0] = 0; + } + + if(svf_login) + { + char *names[] = {"ID", NULL}; + char *parts[1]; + parts[0] = search_ids[mp]; + data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); + if(status == 200) + { + if(data) + { + if(!strcmp(data, "Up")) + { + svf_myvote = 1; + } + else if(!strcmp(data, "Down")) + { + svf_myvote = -1; + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + } + else + { + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + } + } + else + error_ui(vid_buf, status, http_ret_text(status)); + + if(data) + free(data); + goto finish; + } + + if(!last) + { + search = 1; + } + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) + { + search = 1; + if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) + { + search_page = 0; + page_count = 0; + } + free(last); + last = NULL; + } + else + search = 0; + + if(search && lasttime>=TIMEOUT) + { + lasttime = 0; + last = mystrdup(ed.str); + last_own = search_own; + last_date = search_date; + last_page = search_page; + active = 1; + uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); + if(search_own || svf_admin || svf_mod) + tmp = "&ShowVotes=true"; + else + tmp = ""; + if(!search_own && !search_date && !*last) + { + if(search_page) + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); + } + else + { + exp_res = GRID_X*GRID_P; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); + } + } + else + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); + } + strcaturl(uri, last); + if(search_own) + { + strcaturl(uri, " user:"); + strcaturl(uri, svf_user); + } + if(search_date) + strcaturl(uri, " sort:date"); + + http = http_async_req_start(http, uri, NULL, 0, 1); + if(svf_login) + { + http_auth_headers(http, svf_user, svf_pass); + } + http_last_use = time(NULL); + free(uri); + } + + if(active && http_async_req_status(http)) + { + http_last_use = time(NULL); + results = http_async_req_stop(http, &status, NULL); + view_own = last_own; + if(status == 200) + { + page_count = search_results(results, last_own||svf_admin||svf_mod); + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + } + is_p1 = (exp_res < GRID_X*GRID_Y); + free(results); + active = 0; + } + + if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) + { + http_async_req_close(http); + http = NULL; + } + + for(i=0; i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) + { + if(stamp_page) + { + stamp_page --; + } + sdl_wheel = 0; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; +} + +void render_signs(pixel *vid_buf) +{ + int i, j, x, y, w, h, dx, dy; + char buff[30]; //Buffer + for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature + else + sprintf(buff, "Temp: 0.00"); //...tempirature + drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); + } + + //Usual text + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); + x = signs[i].x; + y = signs[i].y; + dx = 1 - signs[i].ju; + dy = (signs[i].y > 18) ? -1 : 1; + for(j=0; j<4; j++) + { + drawpixel(vid_buf, x, y, 192, 192, 192, 255); + x+=dx; + y+=dy; + } + } +} + +void add_sign_ui(pixel *vid_buf, int mx, int my) +{ + int i, w, h, x, y, nm=0, ju; + int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; + ui_edit ed; + + // check if it is an existing sign + for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) + break; + } + // else look for empty spot + if(i >= MAXSIGNS) + { + nm = 1; + for(i=0; i= MAXSIGNS) + return; + + if(nm) + { + signs[i].x = mx; + signs[i].y = my; + signs[i].ju = 1; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = x0+25; + ed.y = y0+25; + ed.w = 158; + ed.nx = 1; + ed.def = "[message]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(signs[i].text); + strcpy(ed.str, signs[i].text); + ju = signs[i].ju; + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed); + drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); + draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); + draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); + draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); + + if(!nm) + { + drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); + drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); + drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); + } + + drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) + ju = 0; + if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) + ju = 1; + if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) + ju = 2; + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) + { + signs[i].text[0] = 0; + return; + } + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + { + if(!ed.focus) + return; + ed.focus = 0; + } + } + + strcpy(signs[i].text, ed.str); + signs[i].ju = ju; +} + +/*********************************************************** + * CONFIG FILE * + ***********************************************************/ + +char http_proxy[256] = ""; + +void save_string(FILE *f, char *str) +{ + int li = strlen(str); + unsigned char lb[2]; + lb[0] = li; + lb[1] = li >> 8; + fwrite(lb, 2, 1, f); + fwrite(str, li, 1, f); +} + +int load_string(FILE *f, char *str, int max) +{ + int li; + unsigned char lb[2]; + fread(lb, 2, 1, f); + li = lb[0] | (lb[1] << 8); + if(li > max) + { + str[0] = 0; + return 1; + } + fread(str, li, 1, f); + str[li] = 0; + return 0; +} + +unsigned char last_major=0, last_minor=0, update_flag=0; + +void save_presets(int do_update) +{ + FILE *f=fopen("powder.def", "wb"); + unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; + unsigned char tmp = sdl_scale; + if(!f) + return; + fwrite(sig, 1, 4, f); + save_string(f, svf_user); + save_string(f, svf_pass); + fwrite(&tmp, 1, 1, f); + tmp = cmode; + fwrite(&tmp, 1, 1, f); + tmp = svf_admin; + fwrite(&tmp, 1, 1, f); + tmp = svf_mod; + fwrite(&tmp, 1, 1, f); + save_string(f, http_proxy); + tmp = SAVE_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = MINOR_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = do_update; + fwrite(&tmp, 1, 1, f); + fclose(f); +} + +void load_presets(void) +{ + FILE *f=fopen("powder.def", "rb"); + unsigned char sig[4], tmp; + if(!f) + return; + fread(sig, 1, 4, f); + if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) + { + if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) + { + if(fseek(f, -3, SEEK_END)) + { + remove("powder.def"); + return; + } + if(fread(sig, 1, 3, f) != 3) + { + remove("powder.def"); + goto fail; + } + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; + } + fclose(f); + remove("powder.def"); + return; + } + if(load_string(f, svf_user, 63)) + goto fail; + if(load_string(f, svf_pass, 63)) + goto fail; + svf_login = !!svf_user[0]; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + sdl_scale = (tmp == 2) ? 2 : 1; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + cmode = tmp%7; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_admin = tmp; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_mod = tmp; + if(load_string(f, http_proxy, 255)) + goto fail; + if(fread(sig, 1, 3, f) != 3) + goto fail; + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; +fail: + fclose(f); +} + +void dim_copy(pixel *dst, pixel *src) +{ + int i,r,g,b; + for(i=0; i0) + r--; + if(g>0) + g--; + if(b>0) + b--; + dst[i] = PIXRGB(r,g,b); + } +} + +unsigned int fire_alpha[CELL*3][CELL*3]; +void prepare_alpha(void) +{ + int x,y,i,j; + float temp[CELL*3][CELL*3]; + memset(temp, 0, sizeof(temp)); + for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; + fire_g[j][i] = g>4 ? g-4 : 0; + fire_b[j][i] = b>4 ? b-4 : 0; + } +} + +int zoom_en = 0; +int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; +int zoom_wx=0, zoom_wy=0; +void render_zoom(pixel *img) +{ + int x, y, i, j; + pixel pix; + drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); + drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); + clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); + for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) + { + xor_pixel(x+i, y+j, vid); + if(j) xor_pixel(x+i, y-j, vid); + if(i) xor_pixel(x-i, y+j, vid); + if(i&&j) xor_pixel(x-i, y-j, vid); + } + } + else + { + int tc; + c = (r/CELL) * CELL; + x = (x/CELL) * CELL; + y = (y/CELL) * CELL; + + tc = !((c%(CELL*2))==0); + + x -= c/2; + y -= c/2; + + x += tc*(CELL/2); + y += tc*(CELL/2); + + for(i=0; i2) + { + pthread_t pth; + pthread_create(&pth,NULL,update_air_th,""); + } + else + { + update_air(); + } +#else + update_air(); +#endif + } + if(cmode==0 || cmode==1) + { + draw_air(vid_buf); + } + else if(cmode==2) + { + memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); + memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); + } + else + { + memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + } + update_particles(vid_buf); + + if(cmode==2) + { + if(!fire_fc) + { + dim_copy(fire_bg, vid_buf); + } + else + { + memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); + } + fire_fc = (fire_fc+1) % 3; + } + if(cmode==3||cmode==4||cmode==6) + render_fire(vid_buf); + + render_signs(vid_buf); + + memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); + clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); + + draw_svf_ui(vid_buf); + + if(http_ver_check) + { + if(!do_check && http_async_req_status(http_ver_check)) + { + ver_data = http_async_req_stop(http_ver_check, &http_ret, NULL); + if(http_ret==200 && ver_data) + { +#ifdef BETA + if(sscanf(ver_data, "%d.%d.%d", &major, &minor, &is_beta)==3) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) + old_version = 1; +#else + if(sscanf(ver_data, "%d.%d", &major, &minor)==2) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) + old_version = 1; +#endif + free(ver_data); + } + http_ver_check = NULL; + } + do_check = (do_check+1) & 15; + } + + if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) + { + if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) + { + break; + } + } + if(sdl_key=='d') + { + death = !(death); + } + if(sdl_key=='f') + { + framerender = 1; + } + if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) + { + if(load_mode) + { + free(load_img); + free(load_data); + load_mode = 0; + load_data = NULL; + load_img = NULL; + } + if(it > 50) + it = 50; + if(sdl_key=='k' && stamps[1].name[0]) + { + j = stamp_ui(vid_buf); + if(j>=0) + load_data = stamp_load(j, &load_size); + else + load_data = NULL; + } + else + load_data = stamp_load(0, &load_size); + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + if(sdl_key=='s') + { + if(it > 50) + it = 50; + save_mode = 1; + } + if(sdl_key=='1') + { + set_cmode(0); + } + if(sdl_key=='2') + { + set_cmode(1); + } + if(sdl_key=='3') + { + set_cmode(2); + } + if(sdl_key=='4') + { + set_cmode(3); + } + if(sdl_key=='5') + { + set_cmode(4); + } + if(sdl_key=='6') + { + set_cmode(5); + } + if(sdl_key=='7') + { + set_cmode(6); + } + if(sdl_key==SDLK_SPACE) + sys_pause = !sys_pause; + if(sdl_key=='h') + hud_enable = !hud_enable; + if(sdl_key=='p') + dump_frame(vid_buf, XRES, YRES, XRES); + if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + if(clipboard_ready==1) + { + load_data = malloc(clipboard_length); + memcpy(load_data, clipboard_data, clipboard_length); + load_size = clipboard_length; + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + } + if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 2; + } + if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 1; + } + else if(sdl_key=='c') + { + set_cmode((cmode+1) % 7); + if(it > 50) + it = 50; + } + if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo + { + int cbx, cby, cbi; + + for(cbi=0; cbi32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + sdl_wheel = 0; + } + else + { + bs += sdl_wheel; + if(bs>1224) + bs = 1224; + if(bs<0) + bs = 0; + sdl_wheel = 0; + /*if(su >= PT_NUM) { + if(sl < PT_NUM) + su = sl; + if(sr < PT_NUM) + su = sr; + }*/ + } + } + + bq = b; + b = SDL_GetMouseState(&x, &y); + + for(i=0; i=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy + && x0 && y0 && x>8)>=NPART || !cr)) + { +#ifdef BETA + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); +#else + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); +#endif + } + else + { + sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + } + } + mx = x; + my = y; + if(update_flag) + { + info_box(vid_buf, "Finalizing update..."); + if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) + { + update_cleanup(); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + { + if(update_finish()) + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + else + info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); + } + update_flag = 0; + } + + if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && + x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) + { + tmp = malloc(64); +#ifdef BETA + if(is_beta) + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); + } + else + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); + } +#else + sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); +#endif + if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) + { + free(tmp); + tmp = download_ui(vid_buf, my_uri, &i); + if(tmp) + { + save_presets(1); + if(update_start(tmp, i)) + { + update_cleanup(); + save_presets(0); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + return 0; + } + } + else + free(tmp); + } + if(y>=sdl_scale*(YRES+(MENUSIZE-20))) + { + if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) + { + db = (svf_myvote==1) ? 273 : 274; + if(da < 51) + da ++; + } + else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) + { + db = svf_own ? 257 : 256; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) + { + db = 270; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) + { + db = 266; + if(da < 51) + da ++; + } + else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) + { + db = 259; + if(svf_open && svf_own && x<=55*sdl_scale) + db = 258; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) + { + db = svf_login ? 261 : 260; + if(svf_admin) + { + db = 268; + } + else if(svf_mod) + { + db = 271; + } + if(da < 51) + da ++; + } + else if(x>=sdl_scale && x<=17*sdl_scale) + { + db = 262; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) + { + db = sys_pause ? 264 : 263; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) + { + db = 267; + if(da < 51) + da ++; + } + else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) + { + db = 265; + if(da < 51) + da ++; + } + else if(da > 0) + da --; + } + else if(da > 0) + da --; + + if(!sdl_zoom_trig && zoom_en==1) + zoom_en = 0; + + if(sdl_key==Z_keysym && zoom_en==2) + zoom_en = 1; + + if(load_mode) + { + load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); + load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); + if(load_x+load_w>XRES) load_x=XRES-load_w; + if(load_y+load_h>YRES) load_y=YRES-load_h; + if(load_x<0) load_x=0; + if(load_y<0) load_y=0; + if(bq==1 && !b) + { + parse_save(load_data, load_size, 0, load_x, load_y); + free(load_data); + free(load_img); + load_mode = 0; + } + else if(bq==4 && !b) + { + free(load_data); + free(load_img); + load_mode = 0; + } + } + else if(save_mode==1) + { + save_x = (mx/sdl_scale)/CELL; + save_y = (my/sdl_scale)/CELL; + if(save_x >= XRES/CELL) save_x = XRES/CELL-1; + if(save_y >= YRES/CELL) save_y = YRES/CELL-1; + save_w = 1; + save_h = 1; + if(b==1) + { + save_mode = 2; + } + else if(b==4) + { + save_mode = 0; + copy_mode = 0; + } + } + else if(save_mode==2) + { + save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; + save_h = (my/sdl_scale+CELL/2)/CELL - save_y; + if(save_w>XRES/CELL) save_w = XRES/CELL; + if(save_h>YRES/CELL) save_h = YRES/CELL; + if(save_w<1) save_w = 1; + if(save_h<1) save_h = 1; + if(!b) + { + if(copy_mode==1) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + } + else if(copy_mode==2) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + } + else + { + stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + save_mode = 0; + } + } + } + else if(sdl_zoom_trig && zoom_en<2) + { + x /= sdl_scale; + y /= sdl_scale; + x -= ZSIZE/2; + y -= ZSIZE/2; + if(x<0) x=0; + if(y<0) y=0; + if(x>XRES-ZSIZE) x=XRES-ZSIZE; + if(y>YRES-ZSIZE) y=YRES-ZSIZE; + zoom_x = x; + zoom_y = y; + zoom_wx = (x 50) + it = 50; + x /= sdl_scale; + y /= sdl_scale; + if(y>=YRES+(MENUSIZE-20)) + { + if(!lb) + { + if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Up")) + { + svf_myvote = 1; + } + } + if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Down")) + { + svf_myvote = -1; + } + } + if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) + tag_list_ui(vid_buf); + if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) + { + legacy_enable = !legacy_enable; + } + if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) + { + memset(signs, 0, sizeof(signs)); + memset(pv, 0, sizeof(pv)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(fvx, 0, sizeof(fvx)); + memset(fvy, 0, sizeof(fvy)); + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(parts, 0, sizeof(particle)*NPART); + for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) + { + login_ui(vid_buf); + if(svf_login) + save_presets(0); + } + if(x>=37 && x<=187 && svf_login) + { + if(!svf_open || !svf_own || x>51) + { + if(save_name_ui(vid_buf)) + execute_save(vid_buf); + } + else + execute_save(vid_buf); + while(!sdl_poll()) + if(!SDL_GetMouseState(&x, &y)) + break; + b = bq = 0; + } + if(x>=1 && x<=17) + { + search_ui(vid_buf); + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + } + if(x>=19 && x<=35 && svf_last && svf_open) + parse_save(svf_last, svf_lsize, 1, 0, 0); + if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) + { + if(b & SDL_BUTTON_LMASK) + set_cmode((cmode+1) % 7); + if(b & SDL_BUTTON_RMASK) + set_cmode((cmode+6) % 7); + save_presets(0); + } + if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) + sys_pause = !sys_pause; + lb = 0; + } + } + else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) + { + c = sl = cr&0xFF; + } + else + { + //Something + } + } + lx = x; + ly = y; + lb = 0; + lm = 0; + } + else + { + //Copy state before drawing any particles (for undo)7 + int cbx, cby, cbi; + + for(cbi=0; cbi=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) + create_line(lx, ly, x, y, bs, c); + } + else + create_box(lx, ly, x, y, c); + lm = 0; + } + lb = 0; + } + + if(load_mode) + { + draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); + xor_rect(vid_buf, load_x, load_y, load_w, load_h); + } + + if(save_mode) + { + xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + da = 51; + db = 269; + } + + if(zoom_en!=1 && !load_mode && !save_mode) + { + render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); + mousex = mx/sdl_scale; + mousey = my/sdl_scale; + } + + if(zoom_en) + render_zoom(vid_buf); + + if(da) + switch(db) + { + case 256: + drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); + break; + case 257: + drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); + break; + case 258: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); + break; + case 259: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); + break; + case 260: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); + break; + case 261: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); + break; + case 262: + drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); + break; + case 263: + drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); + break; + case 264: + drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); + break; + case 265: + drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); + break; + case 266: + drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); + break; + case 267: + drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); + break; + case 268: + drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); + break; + case 269: + drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); + break; + case 270: + drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); + break; + case 271: + drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); + break; + case 272: + drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); + break; + case 273: + drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); + break; + case 274: + drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); + break; + case 275: + drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); + break; + default: + drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); + } + if(itc) + { + itc--; + drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); + } + if(it) + { + it--; + drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); + } + + if(old_version) + { + clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); +#ifdef BETA + if(is_beta) + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); + } + else + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); + } +#else + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); +#endif + drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); + } + + if(hud_enable) + { + currentTime = SDL_GetTicks(); + if(currentTime-past>=16) + { + past = SDL_GetTicks(); + FPS++; + } + if(currentTime-pastFPS>=1000) + { +#ifdef BETA + sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#else + sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#endif + FPSB = FPS; + FPS = 0; + pastFPS = currentTime; + } + if(sdl_zoom_trig||zoom_en) + { + if(zoom_x0) + player[2] = sr; + else + player[2] = PT_DUST; + } + + http_done(); + return 0; +} diff --git a/powder.c b/powder.c index b166535..e69de29 100644 --- a/powder.c +++ b/powder.c @@ -1,9309 +0,0 @@ -/** - * Powder Toy - Main source - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * Copyright (c) 2010 Simon Robertshaw - * Copyright (c) 2010 Skresanov Savely - * Copyright (c) 2010 Bryan Hoyle - * Copyright (c) 2010 Nathan Cousins - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#else -#include -#include -#endif - -#include "misc.h" -#include "font.h" -#include "defines.h" -#include "powder.h" -#include "graphics.h" -#include "version.h" -#include "http.h" -#include "md5.h" -#include "update.h" -#include "hmap.h" -#include "air.h" - -char *it_msg = - "\brThe Powder Toy\n" - "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" - "\n" - "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" - "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" - "\bgPick your material from the menu using mouse left/right buttons.\n" - "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" - "Shift+drag will create straight lines of particles.\n" - "Ctrl+drag will result in filled rectangles.\n" - "Ctrl+Shift+click will flood-fill a closed area.\n" - "Ctrl+Z will act as Undo.\n" - "Middle click or Alt+Click to \"sample\" the particles.\n" - "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" - "Use 'S' to save parts of the window as 'stamps'.\n" - "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" - "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" - "Use the mouse scroll wheel to change the tool size for particles.\n" - "'Q' will quit the application.\n" - "The spacebar can be used to pause physics.\n" - "'P' will take a screenshot and save it into the current directory.\n" - "\n" - "\brhttp://powdertoy.co.uk/\n" - "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" - "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" - "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" - "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" - "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" - "\n" - "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" - "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" - ; - -typedef struct -{ - int start, inc; - pixel *vid; -} upstruc; - -#ifdef BETA -char *old_ver_msg_beta = "A new beta is available - click here!"; -#endif -char *old_ver_msg = "A new version is available - click here!"; -float mheat = 0.0f; - -int do_open = 0; -int sys_pause = 0; -int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. -int death = 1, framerender = 0; -int amd = 1; - -unsigned char fire_r[YRES/CELL][XRES/CELL]; -unsigned char fire_g[YRES/CELL][XRES/CELL]; -unsigned char fire_b[YRES/CELL][XRES/CELL]; - -#define MAXSIGNS 16 - -struct sign -{ - int x,y,ju; - char text[256]; -} signs[MAXSIGNS]; - -/*********************************************************** - * AIR FLOW SIMULATOR * - ***********************************************************/ - -unsigned char bmap[YRES/CELL][XRES/CELL]; -unsigned char emap[YRES/CELL][XRES/CELL]; - -unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -unsigned char cb_emap[YRES/CELL][XRES/CELL]; - -int numCores = 4; -float kernel[9]; -void make_kernel(void) -{ - int i, j; - float s = 0.0f; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - { - kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); - s += kernel[(i+1)+3*(j+1)]; - } - s = 1.0f / s; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - kernel[(i+1)+3*(j+1)] *= s; -} - -int core_count() -{ - int numCPU = 1; -#ifdef MT -#ifdef WIN32 - SYSTEM_INFO sysinfo; - GetSystemInfo( &sysinfo ); - numCPU = sysinfo.dwNumberOfProcessors; -#else -#ifdef MACOSX - numCPU = 4; -#else - numCPU = sysconf( _SC_NPROCESSORS_ONLN ); -#endif -#endif - - printf("Cpus: %d\n", numCPU); - if(numCPU>1) - printf("Multithreading enabled\n"); - else - printf("Multithreading disabled\n"); -#endif - return numCPU; -} - -void update_air(void) -{ - int x, y, i, j; - float dp, dx, dy, f, tx, ty; - - for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; - if(dp < -256.0f) dp = -256.0f; - if(dx > 256.0f) dx = 256.0f; - if(dx < -256.0f) dx = -256.0f; - if(dy > 256.0f) dy = 256.0f; - if(dy < -256.0f) dy = -256.0f; - - ovx[y][x] = dx; - ovy[y][x] = dy; - opv[y][x] = dp; - } - memcpy(vx, ovx, sizeof(vx)); - memcpy(vy, ovy, sizeof(vy)); - memcpy(pv, opv, sizeof(pv)); -} - -void *update_air_th(void *arg) -{ - update_air(); - return NULL; -} - -/*********************************************************** - * PARTICLE SIMULATOR * - ***********************************************************/ -particle *parts; -particle *cb_parts; - -float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index -int isplayer = 0; //It shows is player spawned or not -int mousex, mousey = 0; //They contain mouse position - -void menu_count(void) -{ - int i=0; - msections[SC_WALL].itemcount = UI_WALLCOUNT-4; - msections[SC_SPECIAL].itemcount = 4; - for(i=0; i=XRES || ny>=YRES) - return 0; - if(x==nx && y==ny) - return 1; - r = pmap[ny][nx]; - if(r && (r>>8)>8].type; - - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) - { - return 1; - } - - if((r&0xFF)==PT_VOID) - { - parts[i].type=PT_NONE; - return 0; - } - if((r&0xFF)==PT_BHOL) - { - parts[i].type=PT_NONE; - if(!legacy_enable) - { - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; - } - return 0; - } - - if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide - { - return 1; - } - - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) - { - return 1; - } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) - { - return 0; - } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) - { - return 0; - } - - if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; - if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) - return 0; - if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) - return 0; - - if(parts[i].type==PT_CNCT && y>8)>= 8; - parts[r].x += x-nx; - parts[r].y += y-ny; - } - - return 1; -} - -void kill_part(int i) -{ - int x, y; - parts[i].type = PT_NONE; - - x = (int)(parts[i].x+0.5f); - y = (int)(parts[i].y+0.5f); - - if(x>=0 && y>=0 && x=XRES || y>=YRES) - return -1; - - if(t==SPC_HEAT||t==SPC_COOL) - { - if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); - } - if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) - { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); - } - return pmap[y][x]>>8; - } - else - { - return -1; - } - } - if(t==SPC_AIR) - { - pv[y/CELL][x/CELL] += 0.03f; - if(y+CELL>8].type = PT_SPRK; - parts[pmap[y][x]>>8].life = 4; - parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; - pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; - return pmap[y][x]>>8; - } - - if(p==-1) - { - if(pmap[y][x]) - return -1; - if(pfree == -1) - return -1; - i = pfree; - pfree = parts[i].life; - } - else - i = p; - - if(t==PT_GLAS) - { - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - } - if(t!=PT_STKM) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = t; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 0; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - } - if(t==PT_ACID) - { - parts[i].life = 75; - } - /*Testing - if(t==PT_WOOD){ - parts[i].life = 150; - } - End Testing*/ - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_PLSM) - parts[i].life = rand()%150+50; - if(t==PT_LAVA) - parts[i].life = rand()%120+240; - if(t==PT_NBLE) - parts[i].life = 0; - if(t==PT_NEUT) - { - float r = (rand()%128+128)/127.0f; - float a = (rand()%360)*3.14159f/180.0f; - parts[i].life = rand()%480+480; - parts[i].vx = r*cosf(a); - parts[i].vy = r*sinf(a); - } - if(t==PT_PHOT) - { - float r = (rand()%3-1)*3; - float a = (rand()%3-1)*3; - parts[i].life = 680; - if(a==0.0f&&r==0.0f) - { - parts[i].life = 0; - parts[i].type = PT_NONE; - return -1; - } - else - { - parts[i].vx = a; - parts[i].vy = r; - } - //} else { - // parts[i].life = 0; - // parts[i].type = PT_NONE; - //}/ - } - - if(t!=PT_STKM) - pmap[y][x] = t|(i<<8); - else - { - if(isplayer==0) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - - - - player[3] = x-1; //Setting legs positions - player[4] = y+6; - player[5] = x-1; - player[6] = y+6; - - player[7] = x-3; - player[8] = y+12; - player[9] = x-3; - player[10] = y+12; - - player[11] = x+1; - player[12] = y+6; - player[13] = x+1; - player[14] = y+6; - - player[15] = x+3; - player[16] = y+12; - player[17] = x+3; - player[18] = y+12; - - isplayer = 1; - } - } - - return i; -} - -#ifdef WIN32 -_inline void delete_part(int x, int y) -#else -inline void delete_part(int x, int y) -#endif -{ - unsigned i; - - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - i = pmap[y][x]; - if(!i || (i>>8)>=NPART) - return; - - kill_part(i>>8); - pmap[y][x] = 0; // just in case -} - -#ifdef WIN32 -_inline int is_wire(int x, int y) -#else -inline int is_wire(int x, int y) -#endif -{ - return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; -} - -#ifdef WIN32 -_inline int is_wire_off(int x, int y) -#else -inline int is_wire_off(int x, int y) -#endif -{ - return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; -} - -void set_emap(int x, int y) -{ - int x1, x2; - - if(!is_wire_off(x, y)) - return; - - // go left as far as possible - x1 = x2 = x; - while(x1>0) - { - if(!is_wire_off(x1-1, y)) - break; - x1--; - } - while(x21 && x1==x2 && - is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && - !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) - set_emap(x1, y-2); - else if(y>0) - for(x=x1; x<=x2; x++) - if(is_wire_off(x, y-1)) - { - if(x==x1 || x==x2 || y>=YRES/CELL-1 || - is_wire(x-1, y-1) || is_wire(x+1, y-1) || - is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) - set_emap(x, y-1); - } - - if(y>8) < NPART && (pmr>>8) >= 0) - { - return parts[pmr>>8].type; - } - else - { - return PT_NONE; - } -} -int nearest_part(int ci, int t) -{ - int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); - int ndistance = 0; - int id = -1; - int i = 0; - int cx = (int)parts[ci].x; - int cy = (int)parts[ci].y; - for(i=0; i=XRES || y>=YRES || - ((bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) - { - kill_part(i); - continue; - } - - vx[y/CELL][x/CELL] *= ptypes[t].airloss; - vy[y/CELL][x/CELL] *= ptypes[t].airloss; - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - if(t==PT_GASS||t==PT_NBLE) - { - if(pv[y/CELL][x/CELL]<3.5f) - pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); - if(y+CELL2.5f) - { - parts[i].life = rand()%80+180; - rt = parts[i].type = PT_FIRE; - parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - pv[y/CELL][x/CELL] += 0.25f * CFDS; - t = PT_FIRE; - } - - parts[i].vx *= ptypes[t].loss; - parts[i].vy *= ptypes[t].loss; - - if(t==PT_DFRM && !parts[i].life) - { - if(pv[y/CELL][x/CELL]>1.0f) - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - parts[i].life = rand()%80+300; - } - } - else - { - if(t==PT_PLAS && pv[y/CELL][x/CELL]>25.0f) - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - } else { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - } - - if(ptypes[t].diffusion) - { - parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - } - - // interpolator -#ifdef WIN32 - mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#else - mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#endif - if(mv < ISTP) - { - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - } - else - { - dx = parts[i].vx*ISTP/mv; - dy = parts[i].vy*ISTP/mv; - ix = parts[i].x; - iy = parts[i].y; - while(1) - { - mv -= ISTP; - if(mv <= 0.0f) - { - // nothing found - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - break; - } - ix += dx; - iy += dy; - nx = (int)(ix+0.5f); - ny = (int)(iy+0.5f); - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) - { - parts[i].x = ix; - parts[i].y = iy; - break; - } - } - } - - a = nt = 0; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx4.0f) - t = parts[i].type = PT_DSTW; - if(t==PT_DESL && pv[y/CELL][x/CELL]<-6.0f) - t = parts[i].type = PT_GASS; - if(t==PT_GASS && pv[y/CELL][x/CELL]>6.0f) - t = parts[i].type = PT_DESL; - if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) - t = parts[i].type = PT_FIRE; - } - if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f) - t = parts[i].type = PT_GASS; - if(t==PT_DESL && pv[y/CELL][x/CELL]>50.0f) // Only way I know to make it - t = parts[i].type = PT_FIRE; // combust under pressure. - if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f) - t = parts[i].type = PT_DESL; - if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) - t = parts[i].type = PT_BRMT; - //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) - // t = parts[i].type = PT_BGLA; - if(t==PT_GLAS) - { - parts[i].pavg[0] = parts[i].pavg[1]; - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) - { - parts[i].type = PT_BGLA; - } - } - if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) - t = parts[i].type = PT_SNOW; - if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) - { - t = PT_NEUT; - create_part(i, x, y, t); - } - - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) - { - nearp = nearest_part(i, PT_ETRD); - if(nearp!=-1) - { - create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[nearp].type = PT_SPRK; - parts[nearp].life = 9; - parts[nearp].ctype = PT_ETRD; - } - } - - if(!legacy_enable) - { - int ctemp = pv[y/CELL][x/CELL]*2; - c_heat = 0.0f; - h_count = 0; - if(ptypes[t].hconduct>(rand()%250)) - { - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) - { - h_count++; - c_heat += parts[r>>8].temp; - } - } - } - } - pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) - { - parts[r>>8].temp = parts[i].temp; - } - } - } - } - if(pt>=pstates[t].btemp&&pstates[t].burn) - { - t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE||t==PT_PLSM) - parts[i].life = rand()%50+120; - } - else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) - { - if(t==PT_LAVA&&parts[i].ctype) - { - parts[i].life = 0; - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) - { - parts[i].ctype = parts[i].type; - t = parts[i].type = PT_ICEI; - } - else - { - parts[i].life = 0; - t = parts[i].type = pstates[t].solid; - } - } - else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) - { - if(pstates[t].liquid==PT_LAVA) - { - parts[i].life = rand()%120+240; - parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; - parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; - t = parts[i].type = pstates[t].liquid; - } - else if(t==PT_ICEI&&parts[i].ctype) - { - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else - { - t = parts[i].type = pstates[t].liquid; - } - } - else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) - { - t = parts[i].type = pstates[t].liquid; - } - else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) - { - if(t==PT_SLTW&&1>rand()%6) - { - t = parts[i].type = PT_SALT; - } - else - { - t = parts[i].type = pstates[t].gas; - pv[y/CELL][x/CELL] += 0.50f; - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - } - } - if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) - { - float atemp = parts[i].temp + (-MIN_TEMP); - pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; - } - if(t==PT_LAVA) - { - parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - } - pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - } - } - if(t==PT_PTCT&&parts[i].temp>24.0f) - { - pt = parts[i].temp -= 2.5f; - } - if(t==PT_NTCT&&parts[i].temp>24.0f) - { - pt = parts[i].temp -= 2.5f; - } - - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_NTCT || t==PT_PTCT || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) - { - nx = x % CELL; - if(nx == 0) - nx = x/CELL - 1; - else if(nx == CELL-1) - nx = x/CELL + 1; - else - nx = x/CELL; - ny = y % CELL; - if(ny == 0) - ny = y/CELL - 1; - else if(ny == CELL-1) - ny = y/CELL + 1; - else - ny = y/CELL; - if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) - { - t = parts[i].type = PT_NONE; - parts[r>>8].ctype = parts[r>>8].type; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - } - else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) - { - pv[y/CELL][x/CELL] += 100.0f; - if(legacy_enable&&1>(rand()%200)) - { - parts[i].life = rand()%50+120; - t = parts[i].type = PT_FIRE; - } - else - { - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_ICEI || t==PT_SNOW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if(legacy_enable) - { - if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_ICEI; - parts[r>>8].type = PT_ICEI; - } - if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) - t = parts[i].type = PT_WATR; - } - } - } - else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL) - { - parts[i].temp = 200.0f; - } - } - } - //PLANT - else if(t==PT_PLNT) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR && 1>(rand()%250)) - { - t = parts[i].type = PT_PLNT; - parts[r>>8].type = PT_PLNT; - } - else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_WATR||t==PT_DSTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%250)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_WATR; - } - if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_SLTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) - { - parts[r>>8].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_WTRV) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - parts[r>>8].type = PT_WATR; - } - - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - if(1>(rand()%1000)) - parts[r>>8].type = PT_WATR; - } - } - } - else if(t==PT_YEST) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_DYST && 1>(rand()%30) && !legacy_enable) - { - t = parts[i].type = PT_DYST; - } - } - } - else if(t==PT_ACID) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)!=PT_ACID) - { - if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) - { - t = parts[i].type = PT_FIRE; - parts[i].life = 4; - parts[r>>8].type = PT_FIRE; - parts[r>>8].life = 4; - } - else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) - { - parts[i].life--; - parts[r>>8].type = PT_NONE; - } - else if (parts[i].life==50) - { - parts[i].life = 0; - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_NEUT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) - { - if(33>rand()%100) - { - create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); - } - else - { - create_part(r>>8, x+nx, y+ny, PT_NEUT); - parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; - parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; - } - pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough - fe ++; - } - if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) - parts[r>>8].type = PT_DUST; - if((r&0xFF)==PT_DYST && 15>(rand()%1000)) - parts[r>>8].type = PT_YEST; - if((r&0xFF)==PT_YEST){ - if(15>(rand()%100000)&&isplayer==0) - parts[r>>8].type = PT_STKM; - else - parts[r>>8].type = PT_DYST; - } - - if((r&0xFF)==PT_WATR && 15>(rand()%100)) - parts[r>>8].type = PT_DSTW; - if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) - parts[r>>8].type = PT_DFRM; - if((r&0xFF)==PT_NITR && 15>(rand()%1000)) - parts[r>>8].type = PT_DESL; - if((r&0xFF)==PT_OILL && 5>(rand()%1000)) - parts[r>>8].type = PT_PLAS; - if((r&0xFF)==PT_PLNT && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - if((r&0xFF)==PT_PLAS && 5>(rand()%1000)) - parts[r>>8].type = PT_OILL; - if((r&0xFF)==PT_DESL && 15>(rand()%1000)) - parts[r>>8].type = PT_GASS; - if((r&0xFF)==PT_COAL && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - } - } - else if(t==PT_PHOT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=0; nx<1; nx++) - for(ny=0; ny<1; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - } - } - else if(t==PT_LCRY) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK) - { - if(parts[r>>8].ctype==PT_PSCN) - { - parts[i].life = 10; - } - else if(parts[r>>8].ctype==PT_NSCN) - { - parts[i].life = 9; - } - } - if(rt==PT_LCRY) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - else if(t==PT_BTRY) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(parts_avg(i,r>>8) != PT_INSL) - { - if((rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) - { - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - parts[r>>8].type = PT_SPRK; - } - } - } - }else if(t==PT_SWCH) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8)!=PT_INSL) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - if(t==PT_SWCH) - if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) - { - parts[i].life--; - } - if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) - continue; - rt = parts[r>>8].type; - if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && - ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) - { - parts[r>>8].type = PT_FIRE; - parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - parts[r>>8].life = rand()%80+180; - if(ptypes[rt].explosive) - pv[y/CELL][x/CELL] += 0.25f * CFDS; - continue; - } - lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; - if(lpv < 1) lpv = 1; - if(legacy_enable) - { - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && - ptypes[rt].meltable*lpv>(rand()%1000)) - { - if(t!=PT_LAVA || parts[i].life>0) - { - parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; - parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; - parts[r>>8].type = PT_LAVA; - parts[r>>8].life = rand()%120+240; - } - else - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; - parts[i].ctype = PT_NONE;//rt; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) - { - parts[r>>8].type = PT_WATR; - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = PT_STNE; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) - { - kill_part(r>>8); - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; - parts[i].ctype = PT_NONE; - goto killed; - } - } - } - pavg = parts_avg(i, r>>8); - if(rt==PT_SWCH && t==PT_SPRK) - { - pavg = parts_avg(r>>8, i); - if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) - parts[r>>8].life = 10; - if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) - parts[r>>8].life = 9; - if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].ctype = PT_SWCH; - parts[r>>8].life = 4; - } - } - pavg = parts_avg(i, r>>8); - if(pavg != PT_INSL) - { - if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) - parts[r>>8].temp = parts[r>>8].temp+10.0f; - } - } - if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 6; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 5; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) - { - if(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) - { - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - - if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) - { - parts[i].life = rand()%150+50; - parts[i].type = PT_PLSM; - parts[i].ctype = PT_NBLE; - parts[i].temp = 3500; - pv[y/CELL][x/CELL] += 1; - } - if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) - { - parts[i].type = PT_SWCH; - parts[i].life = 11; - } - } - } -killed: - if(parts[i].type == PT_NONE) - continue; - } - if(t==PT_STKM) - { - //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) - parts[i].temp += 1; - - //Death - if(parts[i].life<0 && (death == 1)) //If his HP is less that 0 or there is very big wind... - { - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - //Verlet integration - pp = 2*player[3]-player[5]; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+1; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+1; - player[18] = player[16]; - player[16] = pp; - - //Go left - if (((int)(player[0])&0x01) == 0x01) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] += 3; - player[10] += 2; - player[5] += 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 3; - player[18] += 2; - player[13] +=2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[9] += 1; - player[10] += 1; - player[5] += 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 1; - player[18] += 1; - player[13] +=1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 3; - player[10] += 2; - player[5] -= 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 3; - player[18] += 2; - player[13] -= 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 1; - player[10] += 1; - player[5] -= 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 1; - player[18] += 1; - player[13] -= 1; - } - - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)) - { - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - create_part(-1, nx, ny, player[2]); - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) - { - int random = abs(rand()%3-1)*3; - if (random==0) - { - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; - } - else - { - parts[r>>8].vy = 0; - parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; - } - } - - } - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[10] += 1; - player[18] += 1; - } - - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; - player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; - player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; - player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; - player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; - parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; - player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; - parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; - player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) - player[15] -= nx; - - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= 10+ny; - parts[i].vy = -10; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[7] += 0.2; - player[15] -= 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[3] += 0.2; - player[11] -= 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[16] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[8] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } - if(t==PT_CLNE) - { - if(!parts[i].ctype) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx30&&parts[i].temp<44){ - create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST); - } - } - if(t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1) - { - parts[i].type = PT_NBLE; - parts[i].life = 0; - } - if (t==PT_FIRE && parts[i].life <=1) - { - t = parts[i].type = PT_SMKE; - parts[i].life = rand()%20+250; - } - - nx = (int)(parts[i].x+0.5f); - ny = (int)(parts[i].y+0.5f); - - if(nx=XRES-CELL || - ny=YRES-CELL) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - continue; - } - - rt = parts[i].flags & FLAG_STAGNANT; - parts[i].flags &= ~FLAG_STAGNANT; - if(!try_move(i, x, y, nx, ny)) - { - parts[i].x = lx; - parts[i].y = ly; - if(ptypes[t].falldown) - { - if(nx!=x && try_move(i, x, y, nx, y)) - { - parts[i].x = ix; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x, ny)) - { - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else - { - r = (rand()%2)*2-1; - if(ny!=y && try_move(i, x, y, x+r, ny)) - { - parts[i].x += r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x-r, ny)) - { - parts[i].x -= r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y+r)) - { - parts[i].x = ix; - parts[i].y += r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y-r)) - { - parts[i].x = ix; - parts[i].y -= r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) - { - s = 0; - if(!rt || nt) - rt = 50; - else - rt = 10; - for(j=x+r; j>=0 && j>=x-rt && j0) - r = 1; - else - r = -1; - if(s) - for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; - if(nxy+ISTP) ny=y+ISTP; - if(ny(rand()%1000)) - { - kill_part(i); - continue; - } - else if(try_move(i, x, y, 2*x-nx, ny)) - { - parts[i].x = (float)(2*x-nx); - parts[i].y = (float)iy; - parts[i].vx *= ptypes[t].collision; - } - else if(try_move(i, x, y, nx, 2*y-ny)) - { - parts[i].x = (float)ix; - parts[i].y = (float)(2*y-ny); - parts[i].vy *= ptypes[t].collision; - } - else - { - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - } - } - -justdraw: - - nx = (int)(parts[i].x+0.5f); - ny = (int)(parts[i].y+0.5f); - - if(nx=XRES-CELL || - ny=YRES-CELL) - { - kill_part(i); - continue; - } - if(cmode!=CM_HEAT) - { - if(t==PT_STKM) //Just draw head here - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; - vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; - vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; - vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; - } - draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); - draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); - draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); - draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); - - isplayer = 1; //It's a secret. Tssss... - } - if(t==PT_MWAX&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,224,170,255); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,224,224,170,20); - else - blendpixel(vid,x+nx,y+ny,224,224,170,40); - } - } - - } - else if(t==PT_ACID) - { - if(parts[i].life>255) parts[i].life = 255; - if(parts[i].life<47) parts[i].life = 48; - s = (255/((parts[i].life-46)*28)); - if(s==0) s = 1; - cr = PIXR(ptypes[t].pcolors)/s; - cg = PIXG(ptypes[t].pcolors)/s; - cb = PIXB(ptypes[t].pcolors)/s; - if(cmode==6){ - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); - } - } - } else { - blendpixel(vid, nx, ny, cr, cg, cb, 255); - } - - if(cmode==4) - { - blendpixel(vid, nx+1, ny, cr, cg, cb, 223); - blendpixel(vid, nx-1, ny, cr, cg, cb, 223); - blendpixel(vid, nx, ny+1, cr, cg, cb, 223); - blendpixel(vid, nx, ny-1, cr, cg, cb, 223); - - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); - } - } - else if(t==PT_OILL&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,64,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,64,16,40); - } - } - } - else if(t==PT_NEUT) - { - if(cmode == 3||cmode==4 || cmode==6) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 8; - cb = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = 0x20; - cg = 0xE0; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_PLUT&&cmode == 6) - { - int tempx; - int tempy; - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(tempx = 2; tempx < 10; tempx++) { - for(tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_URAN&&cmode == 6) - { - int tempx; - int tempy; - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(tempx = 2; tempx < 10; tempx++) { - for(tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_SLTW&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,80,240,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,80,240,50); - } - } - } - else if(t==PT_PHOT) - { - if(cmode == 3||cmode==4 || cmode==6) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 12; - cb = 12; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_SWCH && parts[i].life == 10) - { - x = nx; - y = ny; - blendpixel(vid,x,y,17,217,24,255); - } - else if(t==PT_LNTG&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,128,160,223,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,128,160,223,50); - } - } - } - else if(t==PT_SMKE) - { - if(cmode == 3||cmode==4 || cmode==6) - { - x = nx/CELL; - y = ny/CELL; - cg = 10; - cb = 10; - cr = 10; - cg += fire_g[y][x]; - if(cg > 50) cg = 50; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 50) cb = 50; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 50) cr = 50; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny,100,100,100,30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,100,100,100,10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,100,100,100,20); - } - } - } - } - else if(t==PT_WATR&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - - } else if(t==PT_DSTW&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - } - else if(t==PT_NITR&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,224,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,224,16,50); - } - } - - } - else if(t==PT_LRBD&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,170,170,170,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,170,170,170,50); - } - } - - } - - else if(t==PT_NBLE&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,235,73,23,100); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,235,73,23,30); - else - blendpixel(vid,x+nx,y+ny,235,73,23,50); - } - } - - } - else if(t==PT_GASS&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,255,255,0,180); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,255,255,0,50); - else - blendpixel(vid,x+nx,y+ny,255,255,0,80); - } - } - - } - else if(t==PT_WTRV) - { - if(cmode == 3||cmode==4 || cmode==6) - { - x = nx/CELL; - y = ny/CELL; - cg = PIXG(ptypes[t].pcolors)/3; - cb = PIXB(ptypes[t].pcolors)/3; - cr = PIXR(ptypes[t].pcolors)/3; - cg += fire_g[y][x]; - if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); - } - } - } - } - else if(t==PT_THDR) - { - if(cmode == 3||cmode==4 || cmode==6) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 16; - cb = 20; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xA0; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LCRY) - { - if(cmode == 3||cmode==4 || cmode==6) - { - //cr = R/8; - //cg = G/8; - //cb = B/8; - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); - //x = nx/CELL; - //y = ny/CELL; - //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } - else - { - cr = 0x50+(parts[i].life*10); - cg = 0x50+(parts[i].life*10); - cb = 0x50+(parts[i].life*10); - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_PLSM) - { - float ttemp = parts[i].life; - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = plasma_data[caddress]; - uint8 G = plasma_data[caddress+1]; - uint8 B = plasma_data[caddress+2]; - if(cmode == 3||cmode==4 || cmode==6) - { - cr = R/8; - cg = G/8; - cb = B/8; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_FIRE && parts[i].life) - { - if(cmode == 3||cmode==4 || cmode==6) - { - cr = parts[i].life / 4; - cg = parts[i].life / 16; - cb = parts[i].life / 32; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = parts[i].life * 8; - cg = parts[i].life * 2; - cb = parts[i].life; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LAVA && parts[i].life) - { - cr = parts[i].life * 2 + 0xE0; - cg = parts[i].life * 1 + 0x50; - cb = parts[i].life/2 + 0x10; - if(cr>255) cr = 255; - if(cg>192) cg = 192; - if(cb>128) cb = 128; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 64); - blendpixel(vid, nx-1, ny, cr, cg, cb, 64); - blendpixel(vid, nx, ny+1, cr, cg, cb, 64); - blendpixel(vid, nx, ny-1, cr, cg, cb, 64); - if(cmode == 3||cmode==4 || cmode==6) - { - cr /= 32; - cg /= 32; - cb /= 32; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else if(t==PT_LAVA || t==PT_SPRK) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - if(cmode == 3 || cmode==4 || cmode==6) - { - if(t == PT_LAVA) - { - cr = 3; - cg = i%2; - cb = 0; - } - else - { - cr = 8; - cg = 12; - cb = 16; - } - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - } - else - { - float ttemp = parts[i].temp+(-MIN_TEMP); - int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); - uint8 R = color_data[caddress]; - uint8 G = color_data[caddress+1]; - uint8 B = color_data[caddress+2]; - - if(t==PT_STKM) //Stick man should be visible in heat mode - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); - vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); - vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); - vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); - } - draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); - draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); - draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); - draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); - } - else - { - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); - //blendpixel(vid, nx+1, ny, R, G, B, 255); - } - } - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) - { - uint8 R = PIXR(ptypes[t].pcolors); - uint8 G = PIXG(ptypes[t].pcolors); - uint8 B = PIXB(ptypes[t].pcolors); - - //if(vid[(ny-1)*YRES+(nx-1)]!=0){ - // blendpixel(vid, nx, ny-1, R, G, B, 46); - //} - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); - } - } - if(framerender){ - framerender = 0; - sys_pause = 1; - } -} - -void update_particles_i_th(void *arg) -{ - upstruc *newup = (upstruc*)arg; - update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); - return; -} - -void update_particles(pixel *vid) -{ - int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; - float lx, ly; -#ifdef MT - int pt = 0, pc = 0; - pthread_t *InterThreads; -#endif - - isplayer = 0; //Needed for player spawning - memset(pmap, 0, sizeof(pmap)); - r = rand()%2; - for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==13) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && (!sys_pause||framerender)) - emap[y][x] --; - } - } - } - else - { - for(y=0; y>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==9) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && (!sys_pause||framerender)) - emap[y][x] --; - } - } - } - -#ifdef MT - if(numCores > 1) - { - InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); - for(pc = 0; pc=XRES || ny<0 || ny>=YRES) - break; - addpixel(vid, nx, ny, 255, 255, 255, 64); - i = nx/CELL; - j = ny/CELL; - lx += vx[j][i]*0.125f; - ly += vy[j][i]*0.125f; - if(bmap[j][i]==5 && i!=x && j!=y) - break; - } - drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); - } - -} - -void update_particles_th(void *arg) -{ - update_particles((pixel*)arg); - return; -} - -/*********************************************************** - * SDL OUTPUT * - ***********************************************************/ - -SDLMod sdl_mod; -int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; - -#include "icon.h" -void sdl_seticon(void) -{ -#ifdef WIN32 - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else -#ifdef MACOSX - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else - SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#endif -#endif -} - -void sdl_open(void) -{ - if(SDL_Init(SDL_INIT_VIDEO)<0) - { - fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); - exit(1); - } - atexit(SDL_Quit); -#ifdef PIX16 - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); -#else - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); -#endif - if(!sdl_scrn) - { - fprintf(stderr, "Creating window: %s\n", SDL_GetError()); - exit(1); - } - SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); - sdl_seticon(); - SDL_EnableUNICODE(1); - //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); -} - -int frame_idx=0; -void dump_frame(pixel *src, int w, int h, int pitch) -{ - char frame_name[32]; - int j,i; - unsigned char c[3]; - FILE *f; - sprintf(frame_name,"frame%04d.ppm",frame_idx); - f=fopen(frame_name,"wb"); - fprintf(f,"P6\n%d %d\n255\n",w,h); - for(j=0; j=0 && x=0 && yPT_NUM) - return 2; - if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) - return 3; - i = XRES*YRES; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) - return 1; - size = i; - } - else - d = c; - - if(size < XRES*YRES) - { - if(bzip2) - free(d); - return 1; - } - - sy = 0; - for(y=0; y+scl<=YRES; y+=scl) - { - sx = 0; - for(x=0; x+scl<=XRES; x+=scl) - { - a = 0; - r = g = b = 0; - for(j=0; j=PT_NUM) - goto corrupt; - r += PIXR(ptypes[t].pcolors); - g += PIXG(ptypes[t].pcolors); - b += PIXB(ptypes[t].pcolors); - a ++; - } - } - if(a) - { - a = 256/a; - r = (r*a)>>8; - g = (g*a)>>8; - b = (b*a)>>8; - } - - drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); - sx++; - } - sy++; - } - - if(bzip2) - free(d); - return 0; - -corrupt: - if(bzip2) - free(d); - return 1; -} - -static char *mystrdup(char *s) -{ - char *x; - if(s) - { - x = malloc(strlen(s)+1); - strcpy(x, s); - return x; - } - return s; -} - -void *build_save(int *size, int x0, int y0, int w, int h) -{ - unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; - int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); - int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - // save the required air state - for(y=by0; y255) i=255; - d[p++] = i; - } - for(y=by0; y255) i=255; - d[p++] = i; - } - - // save the particle map - for(i=0; i=x0 && x=y0 && y255) x=255; - if(y<0) y=0; - if(y>255) y=255; - d[p++] = x; - d[p++] = y; - } - } - for(j=0; j255) tttemp=255; - d[p++] = tttemp; - } - } - for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; - d[p++] = (signs[i].y-y0); - d[p++] = (signs[i].y-y0)>>8; - d[p++] = signs[i].ju; - x = strlen(signs[i].text); - d[p++] = x; - memcpy(d+p, signs[i].text, x); - p+=x; - } - - i = (p*101+99)/100 + 612; - c = malloc(i); - c[0] = 0x66; - c[1] = 0x75; - c[2] = 0x43; - c[3] = legacy_enable; - c[4] = SAVE_VERSION; - c[5] = CELL; - c[6] = bw; - c[7] = bh; - c[8] = p; - c[9] = p >> 8; - c[10] = p >> 16; - c[11] = p >> 24; - - i -= 12; - - if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) - { - free(d); - free(c); - return NULL; - } - free(d); - - *size = i+12; - return c; -} - -int parse_save(void *save, int size, int replace, int x0, int y0) -{ - unsigned char *d,*c=save; - int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; - int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; - int fp[NPART], nf=0; - - if(size<16) - return 1; - if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) - return 1; - if(c[4]>SAVE_VERSION) - return 2; - ver = c[4]; - - if(ver<34) - { - legacy_enable = 1; - } - else - { - if(c[3]==1||c[3]==0) - legacy_enable = c[3]; - else - legacy_beta = 1; - } - - bw = c[6]; - bh = c[7]; - if(bx0+bw > XRES/CELL) - bx0 = XRES/CELL - bw; - if(by0+bh > YRES/CELL) - by0 = YRES/CELL - bh; - if(bx0 < 0) - bx0 = 0; - if(by0 < 0) - by0 = 0; - - if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) - return 3; - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - return 1; - size = i; - - if(size < bw*bh) - return 1; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - if(replace) - { - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(signs, 0, sizeof(signs)); - memset(parts, 0, sizeof(particle)*NPART); - memset(pmap, 0, sizeof(pmap)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(pv, 0, sizeof(pv)); - } - - // make a catalog of free parts - memset(pmap, 0, sizeof(pmap)); - for(i=0; i= size) - goto corrupt; - fvx[y][x] = (d[p++]-127.0f)/64.0f; - } - for(y=by0; y= size) - goto corrupt; - fvy[y][x] = (d[p++]-127.0f)/64.0f; - } - - // load the particle map - i = 0; - pty = p; - for(y=y0; y= size) - goto corrupt; - j=d[p++]; - if(j >= PT_NUM) - goto corrupt; - if(j && !(isplayer == 1 && j==PT_STKM)) - { - if(pmap[y][x]) - { - k = pmap[y][x]>>8; - parts[k].type = j; - parts[k].x = (float)x; - parts[k].y = (float)y; - m[(x-x0)+(y-y0)*w] = k+1; - } - else if(i < nf) - { - parts[fp[i]].type = j; - parts[fp[i]].x = (float)x; - parts[fp[i]].y = (float)y; - m[(x-x0)+(y-y0)*w] = fp[i]+1; - i++; - } - else - m[(x-x0)+(y-y0)*w] = NPART+1; - } - } - - // load particle properties - for(j=0; j= size) - goto corrupt; - if(i < NPART) - { - parts[i].vx = (d[p++]-127.0f)/16.0f; - parts[i].vy = (d[p++]-127.0f)/16.0f; - if(parts[i].type == PT_STKM) - { - player[2] = PT_DUST; - - player[3] = parts[i].x-1; //Setting legs positions - player[4] = parts[i].y+6; - player[5] = parts[i].x-1; - player[6] = parts[i].y+6; - - player[7] = parts[i].x-3; - player[8] = parts[i].y+12; - player[9] = parts[i].x-3; - player[10] = parts[i].y+12; - - player[11] = parts[i].x+1; - player[12] = parts[i].y+6; - player[13] = parts[i].x+1; - player[14] = parts[i].y+6; - - player[15] = parts[i].x+3; - player[16] = parts[i].y+12; - player[17] = parts[i].x+3; - player[18] = parts[i].y+12; - - } - } - else - p += 2; - } - } - for(j=0; j= size) - goto corrupt; - if(i <= NPART) - parts[i-1].life = d[p++]*4; - else - p++; - } - } - for(j=0; j=34&&legacy_beta==0) - { - if(p >= size) - { - goto corrupt; - } - if(i <= NPART) - { - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; - } - else - { - p++; - } - } - else - { - parts[i-1].temp = ptypes[parts[i-1].type].heat; - } - } - } - for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) - { - if(p >= size) - goto corrupt; - if(i <= NPART) - parts[i-1].ctype = d[p++]; - else - p++; - } - } - - if(p >= size) - goto version1; - j = d[p++]; - for(i=0; i size) - goto corrupt; - for(k=0; k size) - goto corrupt; - if(kSAVE_VERSION) - return NULL; - - bw = c[6]; - bh = c[7]; - w = bw*CELL; - h = bh*CELL; - - if(c[5]!=CELL) - return NULL; - - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return NULL; - fb = calloc(w*h, PIXELSIZE); - if(!fb) - { - free(d); - return NULL; - } - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - goto corrupt; - size = i; - - if(size < bw*bh) - goto corrupt; - - k = 0; - for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) - goto corrupt; - - for(y=0; y= size) - goto corrupt; - j=d[p++]; - if(j0) - { - if(j==PT_STKM) //Stickman should be drawed another way - { - //Stickman drawing - for(k=-2; k<=1; k++) - { - fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); - fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); - fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); - fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); - } - draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); - draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); - draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); - draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); - } - else - fb[y*w+x] = ptypes[j].pcolors; - } - } - - free(d); - *width = w; - *height = h; - return fb; - -corrupt: - free(d); - free(fb); - return NULL; -} - -/* NO, I DON'T THINK SO - #include "fbi.h" - - pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) - { - unsigned char *tmp; - pixel *res; - int i; - - tmp = malloc(width*height*3); - if(!tmp) - return NULL; - res = malloc(width*height*PIXELSIZE); - if(!res) { - free(tmp); - return NULL; - } - - i = width*height*3; - if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { - free(res); - free(tmp); - return NULL; - } - - for(i=0; iXRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) - { - factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); - factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); - if(factor_y > factor_x) - factor_x = factor_y; - tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); - free(stamps[i].thumb); - stamps[i].thumb = tmp; - } - } - - free(data); -} - -int clipboard_ready = 0; -void *clipboard_data = 0; -int clipboard_length = 0; - -void stamp_save(int x, int y, int w, int h) -{ - FILE *f; - int n; - char fn[64], sn[16]; - void *s=build_save(&n, x, y, w, h); - -#ifdef WIN32 - _mkdir("stamps"); -#else - mkdir("stamps", 0755); -#endif - - stamp_gen_name(sn); - sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); - - f = fopen(fn, "wb"); - if(!f) - return; - fwrite(s, n, 1, f); - fclose(f); - - free(s); - - if(stamps[STAMP_MAX-1].thumb) - free(stamps[STAMP_MAX-1].thumb); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*(STAMP_MAX-1)); - memset(stamps, 0, sizeof(struct stamp_info)); - if(stamp_count0) - { - memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); - memcpy(stamps, &tmp, sizeof(struct stamp_info)); - - stamp_update(); - } - - return data; -} - -void stamp_init(void) -{ - int i; - FILE *f; - - memset(stamps, 0, sizeof(stamps)); - - f=fopen("stamps" PATH_SEP "stamps.def", "rb"); - if(!f) - return; - for(i=0; i=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=60) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=20) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - if(b==1&&h!=-1) - { - *sl = h; - } - if(b==4&&h!=-1) - { - *sr = h; - } -} - -int create_parts(int x, int y, int r, int c) -{ - int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; - - if(c == 125) - { - i = x / CELL; - j = y / CELL; - for(v=-1; v<2; v++) - for(u=-1; u<2; u++) - if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) - { - if(cp) - create_parts(y, x, r, c); - else - create_parts(x, y, r, c); - } - e -= 1.0f; - } - } -} - -void create_box(int x1, int y1, int x2, int y2, int c) -{ - int i, j; - if(x1>x2) - { - i = x2; - x2 = x1; - x1 = i; - } - if(y1>y2) - { - j = y2; - y2 = y1; - y1 = j; - } - for(j=y1; j<=y2; j++) - for(i=x1; i<=x2; i++) - create_parts(i, j, 1, c); -} - -int flood_parts(int x, int y, int c, int cm, int bm) -{ - int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) - { - c = c-100; - } - if(cm==-1) - { - if(c==0) - { - cm = pmap[y][x]&0xFF; - if(!cm) - return 0; - } - else - cm = 0; - } - if(bm==-1) - { - if(c==30) - { - bm = bmap[y/CELL][x/CELL]; - if(!bm) - return 0; - if(bm==1) - cm = 0xFF; - } - else - bm = 0; - } - - if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) - return 1; - - // go left as far as possible - x1 = x2 = x; - while(x1>=CELL) - { - if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) - break; - x1--; - } - while(x2=CELL+dy) - for(x=x1; x<=x2; x++) - if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) - if(!flood_parts(x, y-dy, co, cm, bm)) - return 0; - if(yhide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(ed->str[0]) - { - drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); - drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); - } - else if(!ed->focus) - drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); - if(ed->focus) - { - cx = textnwidth(str, ed->cursor); - for(i=-3; i<9; i++) - drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); - } -} - -char *shift_0="`1234567890-=[]\\;',./"; -char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; - -void ui_edit_process(int mx, int my, int mb, ui_edit *ed) -{ - char ch, ts[2], echo[256], *str; - int l, i; -#ifdef RAWINPUT - char *p; -#endif - - if(mb) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = 0; - ed->str[0] = 0; - } - else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = textwidthx(str, mx-ed->x); - } - else - ed->focus = 0; - } - if(ed->focus && sdl_key) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - l = strlen(ed->str); - switch(sdl_key) - { - case SDLK_HOME: - ed->cursor = 0; - break; - case SDLK_END: - ed->cursor = l; - break; - case SDLK_LEFT: - if(ed->cursor > 0) - ed->cursor --; - break; - case SDLK_RIGHT: - if(ed->cursor < l) - ed->cursor ++; - break; - case SDLK_DELETE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - ed->str[ed->cursor] = 0; - else if(ed->cursor < l) - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - break; - case SDLK_BACKSPACE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - { - if(ed->cursor > 0) - memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); - ed->cursor = 0; - } - else if(ed->cursor > 0) - { - ed->cursor--; - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - } - break; - default: -#ifdef RAWINPUT - if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) - { - ch = sdl_key; - if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) - { - if(ch>='a' && ch<='z') - ch &= ~0x20; - p = strchr(shift_0, ch); - if(p) - ch = shift_1[p-shift_0]; - } - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#else - if(sdl_ascii>=' ' && sdl_ascii<127) - { - ch = sdl_ascii; - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#endif - break; - } - } -} - -typedef struct ui_checkbox -{ - int x, y; - int focus, checked; -} ui_checkbox; - -void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) -{ - int w = 12; - if(ed->checked) - { - drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); - } - if(ed->focus) - { - drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); - } - else - { - drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); - } -} - -void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) -{ - int w = 12; - - if(mb && !mbq) - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->checked = (ed->checked)?0:1; - } - } - else - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->focus = 1; - } - else - { - ed->focus = 0; - } - } -} - -void error_ui(pixel *vid_buf, int err, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - char *msg; - - msg = malloc(strlen(txt)+16); - if(err) - sprintf(msg, "%03d %s", err, txt); - else - sprintf(msg, "%s", txt); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - if(err) - drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); - else - drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - free(msg); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_ui(pixel *vid_buf, char *top, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); - drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_box(pixel *vid_buf, char *msg) -{ - int w = textwidth(msg)+16; - int x0=(XRES-w)/2,y0=(YRES-24)/2; - - clearrect(vid_buf, x0-2, y0-2, w+4, 28); - drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); -} - -int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - int ret = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); - drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); - drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); - drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) - { - ret = 1; - break; - } - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - { - ret = 1; - break; - } - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - return ret; -} - -int execute_tagop(pixel *vid_buf, char *op, char *tag) -{ - int status; - char *result; - - char *names[] = {"ID", "Tag", NULL}; - char *parts[2]; - - char *uri = malloc(strlen(SERVER)+strlen(op)+36); - sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); - - parts[0] = svf_id; - parts[1] = tag; - - result = http_multipart_post( - uri, - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - free(uri); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 1; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 1; - } - - if(result[2]) - { - strncpy(svf_tags, result+3, 255); - svf_id[15] = 0; - } - - if(result) - free(result); - - return 0; -} - -struct strlist -{ - char *str; - struct strlist *next; -}; - -void strlist_add(struct strlist **list, char *str) -{ - struct strlist *item = malloc(sizeof(struct strlist)); - item->str = mystrdup(str); - item->next = *list; - *list = item; -} - -int strlist_find(struct strlist **list, char *str) -{ - struct strlist *item; - for(item=*list; item; item=item->next) - if(!strcmp(item->str, str)) - return 1; - return 0; -} - -void strlist_free(struct strlist **list) -{ - struct strlist *item; - while(*list) - { - item = *list; - *list = (*list)->next; - free(item); - } -} - -void tag_list_ui(pixel *vid_buf) -{ - int y,d,x0=(XRES-192)/2,y0=(YRES-256)/2,b=1,bq,mx,my,vp,vn; - char *p,*q,s; - char *tag=NULL, *op=NULL; - ui_edit ed; - struct strlist *vote=NULL,*down=NULL; - - ed.x = x0+25; - ed.y = y0+221; - ed.w = 158; - ed.nx = 1; - ed.def = "[new tag]"; - ed.focus = 0; - ed.hide = 0; - ed.cursor = 0; - strcpy(ed.str, ""); - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - op = tag = NULL; - - drawrect(vid_buf, x0, y0, 192, 256, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 256); - drawtext(vid_buf, x0+8, y0+8, "Current tags:", 255, 255, 255, 255); - p = svf_tags; - s = svf_tags[0] ? ' ' : 0; - y = 36 + y0; - while(s) - { - q = strchr(p, ' '); - if(!q) - q = p+strlen(p); - s = *q; - *q = 0; - if(svf_own || svf_admin || svf_mod) - { - drawtext(vid_buf, x0+20, y-1, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+20, y-1, "\x85", 255, 255, 255, 255); - d = 14; - if(b && !bq && mx>=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) - { - if(!ed1.focus) - break; - ed1.focus = 0; - ed2.focus = 1; - } - if(sdl_key==SDLK_ESCAPE) - { - if(!ed1.focus && !ed2.focus) - return; - ed1.focus = 0; - ed2.focus = 0; - } - } - - strcpy(svf_user, ed1.str); - md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); - - res = http_multipart_post( - "http://" SERVER "/Login.api", - NULL, NULL, NULL, - svf_user, svf_pass, - &err, NULL); - if(err != 200) - { - error_ui(vid_buf, err, http_ret_text(err)); - if(res) - free(res); - goto fail; - } - if(res && !strncmp(res, "OK", 2)) - { - if(!strcmp(res, "OK ADMIN")) - { - svf_admin = 1; - svf_mod = 0; - } - else if(!strcmp(res, "OK MOD")) - { - svf_admin = 0; - svf_mod = 1; - } - else - { - svf_admin = 0; - svf_mod = 0; - } - free(res); - svf_login = 1; - return; - } - if(!res) - res = mystrdup("Unspecified Error"); - error_ui(vid_buf, 0, res); - free(res); - -fail: - strcpy(svf_user, ""); - strcpy(svf_pass, ""); - svf_login = 0; - svf_own = 0; - svf_admin = 0; - svf_mod = 0; -} - -void execute_delete(pixel *vid_buf, char *id) -{ - int status; - char *result; - - char *names[] = {"ID", NULL}; - char *parts[1]; - - parts[0] = id; - - result = http_multipart_post( - "http://" SERVER "/Delete.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return; - } - - if(result) - free(result); -} - -int execute_vote(pixel *vid_buf, char *id, char *action) -{ - int status; - char *result; - - char *names[] = {"ID", "Action", NULL}; - char *parts[2]; - - parts[0] = id; - parts[1] = action; - - result = http_multipart_post( - "http://" SERVER "/Vote.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 0; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 0; - } - - if(result) - free(result); - return 1; -} - -static char hex[] = "0123456789ABCDEF"; - -void strcaturl(char *dst, char *src) -{ - char *d; - unsigned char *s; - - for(d=dst; *d; d++) ; - - for(s=(unsigned char *)src; *s; s++) - { - if((*s>='0' && *s<='9') || - (*s>='a' && *s<='z') || - (*s>='A' && *s<='Z')) - *(d++) = *s; - else - { - *(d++) = '%'; - *(d++) = hex[*s>>4]; - *(d++) = hex[*s&15]; - } - } - *d = 0; -} - -#define THUMB_CACHE_SIZE 256 - -char *thumb_cache_id[THUMB_CACHE_SIZE]; -void *thumb_cache_data[THUMB_CACHE_SIZE]; -int thumb_cache_size[THUMB_CACHE_SIZE]; -int thumb_cache_lru[THUMB_CACHE_SIZE]; - -void thumb_cache_inval(char *id) -{ - int i,j; - for(i=0; i= THUMB_CACHE_SIZE) - return; - free(thumb_cache_id[i]); - free(thumb_cache_data[i]); - thumb_cache_id[i] = NULL; - for(j=0; j thumb_cache_lru[i]) - thumb_cache_lru[j]--; -} -void thumb_cache_add(char *id, void *thumb, int size) -{ - int i,m=-1,j=-1; - thumb_cache_inval(id); - for(i=0; i m) - { - m = thumb_cache_lru[i]; - j = i; - } - } - if(i >= THUMB_CACHE_SIZE) - { - thumb_cache_inval(thumb_cache_id[j]); - i = j; - } - for(j=0; j= THUMB_CACHE_SIZE) - return 0; - for(j=0; j=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str+5); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - else if(!strncmp(str, "TAG ", 4)) - { - if(j >= TAG_MAX) - { - str = p; - continue; - } - q = strchr(str+4, ' '); - if(!q) - { - str = p; - continue; - } - *(q++) = 0; - tag_names[j] = mystrdup(str+4); - tag_votes[j] = atoi(q); - j++; - } - else - { - if(i>=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - str = p; - } - if(*str) - i++; - return i; -} - -#define IMGCONNS 3 -#define TIMEOUT 100 -#define HTTP_TIMEOUT 10 - -int search_own = 0; -int search_date = 0; -int search_page = 0; -char search_expr[256] = ""; - -int search_ui(pixel *vid_buf) -{ - int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; - int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; - int thumb_drawn[GRID_X*GRID_Y]; - pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - float ry; - time_t http_last_use=HTTP_TIMEOUT; - ui_edit ed; - - - void *http = NULL; - int active = 0; - char *last = NULL; - int search = 0; - int lasttime = TIMEOUT; - char *uri; - int status; - char *results; - char *tmp, ts[64]; - - void *img_http[IMGCONNS]; - char *img_id[IMGCONNS]; - void *thumb, *data; - int thlen, dlen; - - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - - memset(img_http, 0, sizeof(img_http)); - memset(img_id, 0, sizeof(img_id)); - - memset(search_ids, 0, sizeof(search_ids)); - memset(search_names, 0, sizeof(search_names)); - memset(search_scoreup, 0, sizeof(search_scoreup)); - memset(search_scoredown, 0, sizeof(search_scoredown)); - memset(search_publish, 0, sizeof(search_publish)); - memset(search_owners, 0, sizeof(search_owners)); - memset(search_thumbs, 0, sizeof(search_thumbs)); - memset(search_thsizes, 0, sizeof(search_thsizes)); - - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - - do_open = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = 65; - ed.y = 13; - ed.w = XRES-200; - ed.nx = 1; - ed.def = "[search terms]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(search_expr); - strcpy(ed.str, search_expr); - - sdl_wheel = 0; - - while(!sdl_poll()) - { - uih = 0; - bq = b; - mxq = mx; - myq = my; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - if(mx!=mxq || my!=myq || sdl_wheel || b) - mmt = 0; - else if(mmt 9) - { - drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); - drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); - } - - ui_edit_draw(vid_buf, &ed); - - if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) - { - if(search_page) - { - search_page --; - lasttime = TIMEOUT; - } - sdl_wheel = 0; - uih = 1; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) - { - lasttime = TIMEOUT; - search_page ++; - page_count = exp_res; - } - sdl_wheel = 0; - uih = 1; - } - - tp = -1; - if(is_p1) - { - drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); - for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) - for(gi=0; giTAG_MAX || !tag_names[pos]) - break; - if(tag_votes[0]) - i = 127+(128*tag_votes[pos])/tag_votes[0]; - else - i = 192; - w = textwidth(tag_names[pos]); - if(w>XRES/GRID_X-5) - w = XRES/GRID_X-5; - gx = (XRES/GRID_X)*gi; - gy = gj*14 + 46; - if(mx>=gx && mx=gy && my XRES/GRID_X-10) - { - tmp = malloc(strlen(search_names[pos])+4); - strcpy(tmp, search_names[pos]); - j = textwidthx(tmp, XRES/GRID_X-15); - strcpy(tmp+j, "..."); - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); - free(tmp); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); - j = textwidth(search_owners[pos]); - if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && - my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) - { - st = 1; - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); - if(search_thumbs[pos]&&thumb_drawn[pos]==0) - { - render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); - thumb_drawn[pos] = 1; - } - own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); - if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) - mp = pos; - if(own) - { - if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) - { - mp = -1; - dp = pos; - } - } - if(mp==pos && !st) - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); - else - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); - if(own) - { - if(dp == pos) - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); - else - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); - } - if(!search_publish[pos]) - { - drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); - drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); - } - if(view_own || svf_admin || svf_mod) - { - sprintf(ts+1, "%d", search_votes[pos]); - ts[0] = 0xBB; - for(j=1; ts[j]; j++) - ts[j] = 0xBC; - ts[j-1] = 0xB9; - ts[j] = 0xBA; - ts[j+1] = 0; - w = gx+XRES/GRID_S-2-textwidth(ts); - h = gy+YRES/GRID_S-11; - drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); - for(j=0; ts[j]; j++) - ts[j] -= 14; - drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); - sprintf(ts, "%d", search_votes[pos]); - for(j=0; ts[j]; j++) - ts[j] += 127; - drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); - } - if(search_scoreup[pos]>0||search_scoredown[pos]>0) - { - lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); - - if(((YRES/GRID_S+3)/2)>lv) - { - ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); - if(lv<8) - { - ry = ry/(8-lv); - } - nyu = search_scoreup[pos]*ry; - nyd = search_scoredown[pos]*ry; - } - else - { - ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); - nyu = search_scoreup[pos]/ry; - nyd = search_scoredown[pos]/ry; - } - - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); - - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); - } - } - - if(mp!=-1 && mmt>=TIMEOUT/5 && !st) - { - gi = mp % GRID_X; - gj = mp / GRID_X; - if(is_p1) - gj += GRID_Y-GRID_P; - gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; - gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; - i = w = textwidth(search_names[mp]); - h = YRES/GRID_Z+30; - if(w=XRES-2) gx=XRES-3-w; - if(gy<32) gy=32; - if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; - clearrect(vid_buf, gx-2, gy-3, w+4, h); - drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); - if(search_thumbs[mp]) - render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); - drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); - drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); - } - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(sdl_key==SDLK_RETURN) - { - if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) - lasttime = TIMEOUT; - else if(search_ids[0] && !search_ids[1]) - { - bq = 0; - b = 1; - mp = 0; - } - } - if(sdl_key==SDLK_ESCAPE) - goto finish; - - if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) - { - search_own = !search_own; - lasttime = TIMEOUT; - } - if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) - { - search_date = !search_date; - lasttime = TIMEOUT; - } - - if(b && !bq && dp!=-1) - if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) - { - execute_delete(vid_buf, search_ids[dp]); - lasttime = TIMEOUT; - if(last) - { - free(last); - last = NULL; - } - } - - if(b && !bq && tp!=-1) - { - strncpy(ed.str, tag_names[tp], 255); - lasttime = TIMEOUT; - } - - if(b && !bq && mp!=-1 && st) - { - sprintf(ed.str, "user:%s", search_owners[mp]); - lasttime = TIMEOUT; - } - - if(do_open==1) - { - mp = 0; - } - - if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) - { - fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); - info_box(vid_buf, "Loading..."); - - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - data = http_simple_get(uri, &status, &dlen); - free(uri); - - if(status == 200) - { - status = parse_save(data, dlen, 1, 0, 0); - switch(status) - { - case 1: - error_ui(vid_buf, 0, "Simulation corrupted"); - break; - case 2: - error_ui(vid_buf, 0, "Simulation from a newer version"); - break; - case 3: - error_ui(vid_buf, 0, "Simulation on a too large grid"); - break; - } - if(!status) - { - char *tnames[] = {"ID", NULL}; - char *tparts[1]; - int tplens[1]; - if(svf_last) - free(svf_last); - svf_last = data; - svf_lsize = dlen; - - tparts[0] = search_ids[mp]; - tplens[0] = strlen(search_ids[mp]); - data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); - - svf_open = 1; - svf_own = svf_login && !strcmp(search_owners[mp], svf_user); - svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); - - strcpy(svf_id, search_ids[mp]); - strcpy(svf_name, search_names[mp]); - if(status == 200) - { - if(data) - { - strncpy(svf_tags, data, 255); - svf_tags[255] = 0; - } - else - svf_tags[0] = 0; - } - else - { - svf_tags[0] = 0; - } - - if(svf_login) - { - char *names[] = {"ID", NULL}; - char *parts[1]; - parts[0] = search_ids[mp]; - data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); - if(status == 200) - { - if(data) - { - if(!strcmp(data, "Up")) - { - svf_myvote = 1; - } - else if(!strcmp(data, "Down")) - { - svf_myvote = -1; - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - } - else - { - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - } - } - else - error_ui(vid_buf, status, http_ret_text(status)); - - if(data) - free(data); - goto finish; - } - - if(!last) - { - search = 1; - } - else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) - { - search = 1; - if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) - { - search_page = 0; - page_count = 0; - } - free(last); - last = NULL; - } - else - search = 0; - - if(search && lasttime>=TIMEOUT) - { - lasttime = 0; - last = mystrdup(ed.str); - last_own = search_own; - last_date = search_date; - last_page = search_page; - active = 1; - uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); - if(search_own || svf_admin || svf_mod) - tmp = "&ShowVotes=true"; - else - tmp = ""; - if(!search_own && !search_date && !*last) - { - if(search_page) - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); - } - else - { - exp_res = GRID_X*GRID_P; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); - } - } - else - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); - } - strcaturl(uri, last); - if(search_own) - { - strcaturl(uri, " user:"); - strcaturl(uri, svf_user); - } - if(search_date) - strcaturl(uri, " sort:date"); - - http = http_async_req_start(http, uri, NULL, 0, 1); - if(svf_login) - { - http_auth_headers(http, svf_user, svf_pass); - } - http_last_use = time(NULL); - free(uri); - } - - if(active && http_async_req_status(http)) - { - http_last_use = time(NULL); - results = http_async_req_stop(http, &status, NULL); - view_own = last_own; - if(status == 200) - { - page_count = search_results(results, last_own||svf_admin||svf_mod); - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - } - is_p1 = (exp_res < GRID_X*GRID_Y); - free(results); - active = 0; - } - - if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) - { - http_async_req_close(http); - http = NULL; - } - - for(i=0; i=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) - { - if(stamp_page) - { - stamp_page --; - } - sdl_wheel = 0; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; -} - -void render_signs(pixel *vid_buf) -{ - int i, j, x, y, w, h, dx, dy; - char buff[30]; //Buffer - for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature - else - sprintf(buff, "Temp: 0.00"); //...tempirature - drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); - } - - //Usual text - if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) - drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); - x = signs[i].x; - y = signs[i].y; - dx = 1 - signs[i].ju; - dy = (signs[i].y > 18) ? -1 : 1; - for(j=0; j<4; j++) - { - drawpixel(vid_buf, x, y, 192, 192, 192, 255); - x+=dx; - y+=dy; - } - } -} - -void add_sign_ui(pixel *vid_buf, int mx, int my) -{ - int i, w, h, x, y, nm=0, ju; - int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; - ui_edit ed; - - // check if it is an existing sign - for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) - break; - } - // else look for empty spot - if(i >= MAXSIGNS) - { - nm = 1; - for(i=0; i= MAXSIGNS) - return; - - if(nm) - { - signs[i].x = mx; - signs[i].y = my; - signs[i].ju = 1; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = x0+25; - ed.y = y0+25; - ed.w = 158; - ed.nx = 1; - ed.def = "[message]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(signs[i].text); - strcpy(ed.str, signs[i].text); - ju = signs[i].ju; - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 80); - drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); - ui_edit_draw(vid_buf, &ed); - drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); - draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); - draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); - draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); - - if(!nm) - { - drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); - drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); - drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); - } - - drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) - ju = 0; - if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) - ju = 1; - if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) - ju = 2; - - if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) - { - signs[i].text[0] = 0; - return; - } - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - { - if(!ed.focus) - return; - ed.focus = 0; - } - } - - strcpy(signs[i].text, ed.str); - signs[i].ju = ju; -} - -/*********************************************************** - * CONFIG FILE * - ***********************************************************/ - -char http_proxy[256] = ""; - -void save_string(FILE *f, char *str) -{ - int li = strlen(str); - unsigned char lb[2]; - lb[0] = li; - lb[1] = li >> 8; - fwrite(lb, 2, 1, f); - fwrite(str, li, 1, f); -} - -int load_string(FILE *f, char *str, int max) -{ - int li; - unsigned char lb[2]; - fread(lb, 2, 1, f); - li = lb[0] | (lb[1] << 8); - if(li > max) - { - str[0] = 0; - return 1; - } - fread(str, li, 1, f); - str[li] = 0; - return 0; -} - -unsigned char last_major=0, last_minor=0, update_flag=0; - -void save_presets(int do_update) -{ - FILE *f=fopen("powder.def", "wb"); - unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; - unsigned char tmp = sdl_scale; - if(!f) - return; - fwrite(sig, 1, 4, f); - save_string(f, svf_user); - save_string(f, svf_pass); - fwrite(&tmp, 1, 1, f); - tmp = cmode; - fwrite(&tmp, 1, 1, f); - tmp = svf_admin; - fwrite(&tmp, 1, 1, f); - tmp = svf_mod; - fwrite(&tmp, 1, 1, f); - save_string(f, http_proxy); - tmp = SAVE_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = MINOR_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = do_update; - fwrite(&tmp, 1, 1, f); - fclose(f); -} - -void load_presets(void) -{ - FILE *f=fopen("powder.def", "rb"); - unsigned char sig[4], tmp; - if(!f) - return; - fread(sig, 1, 4, f); - if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) - { - if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) - { - if(fseek(f, -3, SEEK_END)) - { - remove("powder.def"); - return; - } - if(fread(sig, 1, 3, f) != 3) - { - remove("powder.def"); - goto fail; - } - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; - } - fclose(f); - remove("powder.def"); - return; - } - if(load_string(f, svf_user, 63)) - goto fail; - if(load_string(f, svf_pass, 63)) - goto fail; - svf_login = !!svf_user[0]; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - sdl_scale = (tmp == 2) ? 2 : 1; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - cmode = tmp%7; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_admin = tmp; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_mod = tmp; - if(load_string(f, http_proxy, 255)) - goto fail; - if(fread(sig, 1, 3, f) != 3) - goto fail; - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; -fail: - fclose(f); -} - -void dim_copy(pixel *dst, pixel *src) -{ - int i,r,g,b; - for(i=0; i0) - r--; - if(g>0) - g--; - if(b>0) - b--; - dst[i] = PIXRGB(r,g,b); - } -} - -unsigned int fire_alpha[CELL*3][CELL*3]; -void prepare_alpha(void) -{ - int x,y,i,j; - float temp[CELL*3][CELL*3]; - memset(temp, 0, sizeof(temp)); - for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; - fire_g[j][i] = g>4 ? g-4 : 0; - fire_b[j][i] = b>4 ? b-4 : 0; - } -} - -int zoom_en = 0; -int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; -int zoom_wx=0, zoom_wy=0; -void render_zoom(pixel *img) -{ - int x, y, i, j; - pixel pix; - drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); - drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); - clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); - for(j=0; jr*r || i*i+(j+1)*(j+1)>r*r)) - { - xor_pixel(x+i, y+j, vid); - if(j) xor_pixel(x+i, y-j, vid); - if(i) xor_pixel(x-i, y+j, vid); - if(i&&j) xor_pixel(x-i, y-j, vid); - } - } - else - { - int tc; - c = (r/CELL) * CELL; - x = (x/CELL) * CELL; - y = (y/CELL) * CELL; - - tc = !((c%(CELL*2))==0); - - x -= c/2; - y -= c/2; - - x += tc*(CELL/2); - y += tc*(CELL/2); - - for(i=0; i2) - { - pthread_t pth; - pthread_create(&pth,NULL,update_air_th,""); - } - else - { - update_air(); - } -#else - update_air(); -#endif - } - if(cmode==0 || cmode==1) - { - draw_air(vid_buf); - } - else if(cmode==2) - { - memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE); - memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE)); - } - else - { - memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); - } - update_particles(vid_buf); - - if(cmode==2) - { - if(!fire_fc) - { - dim_copy(fire_bg, vid_buf); - } - else - { - memcpy(fire_bg, vid_buf, XRES*YRES*PIXELSIZE); - } - fire_fc = (fire_fc+1) % 3; - } - if(cmode==3||cmode==4||cmode==6) - render_fire(vid_buf); - - render_signs(vid_buf); - - memset(vid_buf+((XRES+BARSIZE)*YRES), 0, (PIXELSIZE*(XRES+BARSIZE))*MENUSIZE); - clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); - - draw_svf_ui(vid_buf); - - if(http_ver_check) - { - if(!do_check && http_async_req_status(http_ver_check)) - { - ver_data = http_async_req_stop(http_ver_check, &http_ret, NULL); - if(http_ret==200 && ver_data) - { -#ifdef BETA - if(sscanf(ver_data, "%d.%d.%d", &major, &minor, &is_beta)==3) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) - old_version = 1; -#else - if(sscanf(ver_data, "%d.%d", &major, &minor)==2) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) - old_version = 1; -#endif - free(ver_data); - } - http_ver_check = NULL; - } - do_check = (do_check+1) & 15; - } - - if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) - { - if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) - { - break; - } - } - if(sdl_key=='d') - { - death = !(death); - } - if(sdl_key=='f') - { - framerender = 1; - } - if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) - { - if(load_mode) - { - free(load_img); - free(load_data); - load_mode = 0; - load_data = NULL; - load_img = NULL; - } - if(it > 50) - it = 50; - if(sdl_key=='k' && stamps[1].name[0]) - { - j = stamp_ui(vid_buf); - if(j>=0) - load_data = stamp_load(j, &load_size); - else - load_data = NULL; - } - else - load_data = stamp_load(0, &load_size); - if(load_data) - { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - if(sdl_key=='s') - { - if(it > 50) - it = 50; - save_mode = 1; - } - if(sdl_key=='1') - { - set_cmode(0); - } - if(sdl_key=='2') - { - set_cmode(1); - } - if(sdl_key=='3') - { - set_cmode(2); - } - if(sdl_key=='4') - { - set_cmode(3); - } - if(sdl_key=='5') - { - set_cmode(4); - } - if(sdl_key=='6') - { - set_cmode(5); - } - if(sdl_key=='7') - { - set_cmode(6); - } - if(sdl_key==SDLK_SPACE) - sys_pause = !sys_pause; - if(sdl_key=='h') - hud_enable = !hud_enable; - if(sdl_key=='p') - dump_frame(vid_buf, XRES, YRES, XRES); - if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - if(clipboard_ready==1) - { - load_data = malloc(clipboard_length); - memcpy(load_data, clipboard_data, clipboard_length); - load_size = clipboard_length; - if(load_data) - { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - } - if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 2; - } - if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 1; - } - else if(sdl_key=='c') - { - set_cmode((cmode+1) % 7); - if(it > 50) - it = 50; - } - if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo - { - int cbx, cby, cbi; - - for(cbi=0; cbi32) - ZSIZE = 32; - if(ZSIZE<2) - ZSIZE = 2; - ZFACTOR = 256/ZSIZE; - sdl_wheel = 0; - } - else - { - bs += sdl_wheel; - if(bs>1224) - bs = 1224; - if(bs<0) - bs = 0; - sdl_wheel = 0; - /*if(su >= PT_NUM) { - if(sl < PT_NUM) - su = sl; - if(sr < PT_NUM) - su = sr; - }*/ - } - } - - bq = b; - b = SDL_GetMouseState(&x, &y); - - for(i=0; i=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy - && x0 && y0 && x>8)>=NPART || !cr)) - { -#ifdef BETA - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); -#else - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); -#endif - } - else - { - sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); - } - } - mx = x; - my = y; - if(update_flag) - { - info_box(vid_buf, "Finalizing update..."); - if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) - { - update_cleanup(); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } - else - { - if(update_finish()) - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - else - info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); - } - update_flag = 0; - } - - if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && - x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) - { - tmp = malloc(64); -#ifdef BETA - if(is_beta) - { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); - } - else - { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); - } -#else - sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); -#endif - if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) - { - free(tmp); - tmp = download_ui(vid_buf, my_uri, &i); - if(tmp) - { - save_presets(1); - if(update_start(tmp, i)) - { - update_cleanup(); - save_presets(0); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } - else - return 0; - } - } - else - free(tmp); - } - if(y>=sdl_scale*(YRES+(MENUSIZE-20))) - { - if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) - { - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } - else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) - { - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } - else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) - { - db = (svf_myvote==1) ? 273 : 274; - if(da < 51) - da ++; - } - else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) - { - db = svf_own ? 257 : 256; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) - { - db = 270; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) - { - db = 266; - if(da < 51) - da ++; - } - else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) - { - db = 259; - if(svf_open && svf_own && x<=55*sdl_scale) - db = 258; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) - { - db = svf_login ? 261 : 260; - if(svf_admin) - { - db = 268; - } - else if(svf_mod) - { - db = 271; - } - if(da < 51) - da ++; - } - else if(x>=sdl_scale && x<=17*sdl_scale) - { - db = 262; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) - { - db = sys_pause ? 264 : 263; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) - { - db = 267; - if(da < 51) - da ++; - } - else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) - { - db = 265; - if(da < 51) - da ++; - } - else if(da > 0) - da --; - } - else if(da > 0) - da --; - - if(!sdl_zoom_trig && zoom_en==1) - zoom_en = 0; - - if(sdl_key==Z_keysym && zoom_en==2) - zoom_en = 1; - - if(load_mode) - { - load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); - load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); - if(load_x+load_w>XRES) load_x=XRES-load_w; - if(load_y+load_h>YRES) load_y=YRES-load_h; - if(load_x<0) load_x=0; - if(load_y<0) load_y=0; - if(bq==1 && !b) - { - parse_save(load_data, load_size, 0, load_x, load_y); - free(load_data); - free(load_img); - load_mode = 0; - } - else if(bq==4 && !b) - { - free(load_data); - free(load_img); - load_mode = 0; - } - } - else if(save_mode==1) - { - save_x = (mx/sdl_scale)/CELL; - save_y = (my/sdl_scale)/CELL; - if(save_x >= XRES/CELL) save_x = XRES/CELL-1; - if(save_y >= YRES/CELL) save_y = YRES/CELL-1; - save_w = 1; - save_h = 1; - if(b==1) - { - save_mode = 2; - } - else if(b==4) - { - save_mode = 0; - copy_mode = 0; - } - } - else if(save_mode==2) - { - save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; - save_h = (my/sdl_scale+CELL/2)/CELL - save_y; - if(save_w>XRES/CELL) save_w = XRES/CELL; - if(save_h>YRES/CELL) save_h = YRES/CELL; - if(save_w<1) save_w = 1; - if(save_h<1) save_h = 1; - if(!b) - { - if(copy_mode==1) - { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - } - else if(copy_mode==2) - { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - } - else - { - stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - save_mode = 0; - } - } - } - else if(sdl_zoom_trig && zoom_en<2) - { - x /= sdl_scale; - y /= sdl_scale; - x -= ZSIZE/2; - y -= ZSIZE/2; - if(x<0) x=0; - if(y<0) y=0; - if(x>XRES-ZSIZE) x=XRES-ZSIZE; - if(y>YRES-ZSIZE) y=YRES-ZSIZE; - zoom_x = x; - zoom_y = y; - zoom_wx = (x 50) - it = 50; - x /= sdl_scale; - y /= sdl_scale; - if(y>=YRES+(MENUSIZE-20)) - { - if(!lb) - { - if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) - { - if(execute_vote(vid_buf, svf_id, "Up")) - { - svf_myvote = 1; - } - } - if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) - { - if(execute_vote(vid_buf, svf_id, "Down")) - { - svf_myvote = -1; - } - } - if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) - tag_list_ui(vid_buf); - if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) - { - legacy_enable = !legacy_enable; - } - if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) - { - memset(signs, 0, sizeof(signs)); - memset(pv, 0, sizeof(pv)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(fvx, 0, sizeof(fvx)); - memset(fvy, 0, sizeof(fvy)); - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(parts, 0, sizeof(particle)*NPART); - for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) - { - login_ui(vid_buf); - if(svf_login) - save_presets(0); - } - if(x>=37 && x<=187 && svf_login) - { - if(!svf_open || !svf_own || x>51) - { - if(save_name_ui(vid_buf)) - execute_save(vid_buf); - } - else - execute_save(vid_buf); - while(!sdl_poll()) - if(!SDL_GetMouseState(&x, &y)) - break; - b = bq = 0; - } - if(x>=1 && x<=17) - { - search_ui(vid_buf); - memset(fire_bg, 0, XRES*YRES*PIXELSIZE); - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - } - if(x>=19 && x<=35 && svf_last && svf_open) - parse_save(svf_last, svf_lsize, 1, 0, 0); - if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) - { - if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 7); - if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+6) % 7); - save_presets(0); - } - if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) - sys_pause = !sys_pause; - lb = 0; - } - } - else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) - { - c = sl = cr&0xFF; - } - else - { - //Something - } - } - lx = x; - ly = y; - lb = 0; - lm = 0; - } - else - { - //Copy state before drawing any particles (for undo)7 - int cbx, cby, cbi; - - for(cbi=0; cbi=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) - create_line(lx, ly, x, y, bs, c); - } - else - create_box(lx, ly, x, y, c); - lm = 0; - } - lb = 0; - } - - if(load_mode) - { - draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); - xor_rect(vid_buf, load_x, load_y, load_w, load_h); - } - - if(save_mode) - { - xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - da = 51; - db = 269; - } - - if(zoom_en!=1 && !load_mode && !save_mode) - { - render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); - mousex = mx/sdl_scale; - mousey = my/sdl_scale; - } - - if(zoom_en) - render_zoom(vid_buf); - - if(da) - switch(db) - { - case 256: - drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); - break; - case 257: - drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); - break; - case 258: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); - break; - case 259: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); - break; - case 260: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); - break; - case 261: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); - break; - case 262: - drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); - break; - case 263: - drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); - break; - case 264: - drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); - break; - case 265: - drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); - break; - case 266: - drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); - break; - case 267: - drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); - break; - case 268: - drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); - break; - case 269: - drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); - break; - case 270: - drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); - break; - case 271: - drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); - break; - case 272: - drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); - break; - case 273: - drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); - break; - case 274: - drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); - break; - case 275: - drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); - break; - default: - drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); - } - if(itc) - { - itc--; - drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); - } - if(it) - { - it--; - drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); - } - - if(old_version) - { - clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); -#ifdef BETA - if(is_beta) - { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); - } - else - { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); - } -#else - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); -#endif - drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); - } - - if(hud_enable) - { - currentTime = SDL_GetTicks(); - if(currentTime-past>=16) - { - past = SDL_GetTicks(); - FPS++; - } - if(currentTime-pastFPS>=1000) - { -#ifdef BETA - sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#else - sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#endif - FPSB = FPS; - FPS = 0; - pastFPS = currentTime; - } - if(sdl_zoom_trig||zoom_en) - { - if(zoom_x0) - player[2] = sr; - else - player[2] = PT_DUST; - } - - http_done(); - return 0; -} -- cgit v0.9.2-21-gd62e From bb88587d9dd932c9f67add15f2ca7c83b02a5371 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 26 Aug 2010 14:46:56 +0100 Subject: More rearrangement, particle drawing in own function diff --git a/air.c b/air.c new file mode 100644 index 0000000..55108d6 --- /dev/null +++ b/air.c @@ -0,0 +1,141 @@ +#include +#include "air.h" +#include "powder.h" +#include "defines.h" +float kernel[9]; + +float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float cb_vx[YRES/CELL][XRES/CELL], cb_ovx[YRES/CELL][XRES/CELL]; +float cb_vy[YRES/CELL][XRES/CELL], cb_ovy[YRES/CELL][XRES/CELL]; +float cb_pv[YRES/CELL][XRES/CELL], cb_opv[YRES/CELL][XRES/CELL]; + +float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; + +void make_kernel(void) +{ + int i, j; + float s = 0.0f; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + { + kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); + s += kernel[(i+1)+3*(j+1)]; + } + s = 1.0f / s; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + kernel[(i+1)+3*(j+1)] *= s; +} +void update_air(void) +{ + int x, y, i, j; + float dp, dx, dy, f, tx, ty; + + for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; + if(dp < -256.0f) dp = -256.0f; + if(dx > 256.0f) dx = 256.0f; + if(dx < -256.0f) dx = -256.0f; + if(dy > 256.0f) dy = 256.0f; + if(dy < -256.0f) dy = -256.0f; + + ovx[y][x] = dx; + ovy[y][x] = dy; + opv[y][x] = dp; + } + memcpy(vx, ovx, sizeof(vx)); + memcpy(vy, ovy, sizeof(vy)); + memcpy(pv, opv, sizeof(pv)); +} \ No newline at end of file diff --git a/air.h b/air.h index add56b0..d9e04f6 100644 --- a/air.h +++ b/air.h @@ -1,14 +1,21 @@ #ifndef AIR_H #define AIR_H +#include "defines.h" -float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; +extern float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +extern float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +extern float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; -float cb_vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float cb_vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float cb_pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; +extern float cb_vx[YRES/CELL][XRES/CELL], cb_ovx[YRES/CELL][XRES/CELL]; +extern float cb_vy[YRES/CELL][XRES/CELL], cb_ovy[YRES/CELL][XRES/CELL]; +extern float cb_pv[YRES/CELL][XRES/CELL], cb_opv[YRES/CELL][XRES/CELL]; -float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; +extern float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; + +extern float kernel[9]; + +void make_kernel(void); + +void update_air(void); #endif \ No newline at end of file diff --git a/defines.h b/defines.h index 5b5daaa..aa27b90 100644 --- a/defines.h +++ b/defines.h @@ -28,4 +28,12 @@ static unsigned char ZSIZE = ZSIZE_D; typedef unsigned char uint8; +extern int legacy_enable; + +extern int sys_pause; +extern int framerender; + +extern int mousex, mousey; +extern int death; + #endif \ No newline at end of file diff --git a/graphics.c b/graphics.c index 15f50c6..0f6c040 100644 --- a/graphics.c +++ b/graphics.c @@ -1,16 +1,21 @@ +#include +#include #include "defines.h" #include "air.h" #include "powder.h" #include "graphics.h" #include "font.h" #include "misc.h" -#include -#include + unsigned cmode = 3; SDL_Surface *sdl_scrn; int sdl_scale = 1; +unsigned char fire_r[YRES/CELL][XRES/CELL]; +unsigned char fire_g[YRES/CELL][XRES/CELL]; +unsigned char fire_b[YRES/CELL][XRES/CELL]; + pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f) { int i,j,x,y,w,h,r,g,b,c; @@ -1095,4 +1100,673 @@ void xor_rect(pixel *vid, int x, int y, int w, int h) xor_pixel(x, y+i, vid); xor_pixel(x+w-1, y+i, vid); } +} + +void draw_parts(pixel *vid) +{ + int i, j, x, y, t, nx, ny, r, a, cr,cg,cb, s, rt, fe, nt, lpv, nearp, pavg; + float mv, dx, dy, ix, iy, lx, ly, d, pp; + float pt = R_TEMP; + for(i = 0; i(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; + vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; + vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; + vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; + } + draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); + draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); + draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); + draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); + + isplayer = 1; //It's a secret. Tssss... + } + if(t==PT_MWAX&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,224,224,170,255); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,224,224,170,20); + else + blendpixel(vid,x+nx,y+ny,224,224,170,40); + } + } + + } + else if(t==PT_ACID) + { + if(parts[i].life>255) parts[i].life = 255; + if(parts[i].life<47) parts[i].life = 48; + s = (255/((parts[i].life-46)*28)); + if(s==0) s = 1; + cr = PIXR(ptypes[t].pcolors)/s; + cg = PIXG(ptypes[t].pcolors)/s; + cb = PIXB(ptypes[t].pcolors)/s; + if(cmode==6){ + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); + } + } + } else { + blendpixel(vid, nx, ny, cr, cg, cb, 255); + } + + if(cmode==4) + { + blendpixel(vid, nx+1, ny, cr, cg, cb, 223); + blendpixel(vid, nx-1, ny, cr, cg, cb, 223); + blendpixel(vid, nx, ny+1, cr, cg, cb, 223); + blendpixel(vid, nx, ny-1, cr, cg, cb, 223); + + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); + } + } + else if(t==PT_OILL&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,64,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,64,16,40); + } + } + } + else if(t==PT_NEUT) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 8; + cb = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = 0x20; + cg = 0xE0; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLUT&&cmode == 6) + { + int tempx; + int tempy; + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(tempx = 2; tempx < 10; tempx++) { + for(tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_URAN&&cmode == 6) + { + int tempx; + int tempy; + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(tempx = 2; tempx < 10; tempx++) { + for(tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_SLTW&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,80,240,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,80,240,50); + } + } + } + else if(t==PT_PHOT) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 12; + cb = 12; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_SWCH && parts[i].life == 10) + { + x = nx; + y = ny; + blendpixel(vid,x,y,17,217,24,255); + } + else if(t==PT_LNTG&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,128,160,223,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,128,160,223,50); + } + } + } + else if(t==PT_SMKE) + { + if(cmode == 3||cmode==4 || cmode==6) + { + x = nx/CELL; + y = ny/CELL; + cg = 10; + cb = 10; + cr = 10; + cg += fire_g[y][x]; + if(cg > 50) cg = 50; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 50) cb = 50; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 50) cr = 50; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,100,100,100,30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,100,100,100,10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,100,100,100,20); + } + } + } + } + else if(t==PT_WATR&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + + } else if(t==PT_DSTW&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + } + else if(t==PT_NITR&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,224,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,224,16,50); + } + } + + } + else if(t==PT_LRBD&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,170,170,170,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,170,170,170,50); + } + } + + } + + else if(t==PT_NBLE&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,235,73,23,100); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,235,73,23,30); + else + blendpixel(vid,x+nx,y+ny,235,73,23,50); + } + } + + } + else if(t==PT_GASS&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,255,255,0,180); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,255,255,0,50); + else + blendpixel(vid,x+nx,y+ny,255,255,0,80); + } + } + + } + else if(t==PT_WTRV) + { + if(cmode == 3||cmode==4 || cmode==6) + { + x = nx/CELL; + y = ny/CELL; + cg = PIXG(ptypes[t].pcolors)/3; + cb = PIXB(ptypes[t].pcolors)/3; + cr = PIXR(ptypes[t].pcolors)/3; + cg += fire_g[y][x]; + if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); + } + } + } + } + else if(t==PT_THDR) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 16; + cb = 20; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xA0; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LCRY) + { + if(cmode == 3||cmode==4 || cmode==6) + { + //cr = R/8; + //cg = G/8; + //cb = B/8; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); + //x = nx/CELL; + //y = ny/CELL; + //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; + //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; + //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; + } + else + { + cr = 0x50+(parts[i].life*10); + cg = 0x50+(parts[i].life*10); + cb = 0x50+(parts[i].life*10); + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLSM) + { + float ttemp = parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = plasma_data[caddress]; + uint8 G = plasma_data[caddress+1]; + uint8 B = plasma_data[caddress+2]; + if(cmode == 3||cmode==4 || cmode==6) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_FIRE && parts[i].life) + { + if(cmode == 3||cmode==4 || cmode==6) + { + cr = parts[i].life / 4; + cg = parts[i].life / 16; + cb = parts[i].life / 32; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = parts[i].life * 8; + cg = parts[i].life * 2; + cb = parts[i].life; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LAVA && parts[i].life) + { + cr = parts[i].life * 2 + 0xE0; + cg = parts[i].life * 1 + 0x50; + cb = parts[i].life/2 + 0x10; + if(cr>255) cr = 255; + if(cg>192) cg = 192; + if(cb>128) cb = 128; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 64); + blendpixel(vid, nx-1, ny, cr, cg, cb, 64); + blendpixel(vid, nx, ny+1, cr, cg, cb, 64); + blendpixel(vid, nx, ny-1, cr, cg, cb, 64); + if(cmode == 3||cmode==4 || cmode==6) + { + cr /= 32; + cg /= 32; + cb /= 32; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else if(t==PT_LAVA || t==PT_SPRK) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + if(cmode == 3 || cmode==4 || cmode==6) + { + if(t == PT_LAVA) + { + cr = 3; + cg = i%2; + cb = 0; + } + else + { + cr = 8; + cg = 12; + cb = 16; + } + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + } + else + { + float ttemp = parts[i].temp+(-MIN_TEMP); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); + uint8 R = color_data[caddress]; + uint8 G = color_data[caddress+1]; + uint8 B = color_data[caddress+2]; + + if(t==PT_STKM) //Stick man should be visible in heat mode + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", (int)parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); + vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); + vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); + vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); + } + draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); + draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); + draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); + draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); + } + else + { + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); + //blendpixel(vid, nx+1, ny, R, G, B, 255); + } + } + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) + { + uint8 R = PIXR(ptypes[t].pcolors); + uint8 G = PIXG(ptypes[t].pcolors); + uint8 B = PIXB(ptypes[t].pcolors); + + //if(vid[(ny-1)*YRES+(nx-1)]!=0){ + // blendpixel(vid, nx, ny-1, R, G, B, 46); + //} + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + } } \ No newline at end of file diff --git a/graphics.h b/graphics.h index 7779b09..3932a2f 100644 --- a/graphics.h +++ b/graphics.h @@ -1,6 +1,8 @@ #ifndef GRAPHICS_H #define GRAPHICS_H #include +#include "defines.h" +#include "hmap.h" #ifdef PIX16 #define PIXELSIZE 2 @@ -40,6 +42,10 @@ extern unsigned cmode; extern SDL_Surface *sdl_scrn; extern int sdl_scale; +extern unsigned char fire_r[YRES/CELL][XRES/CELL]; +extern unsigned char fire_g[YRES/CELL][XRES/CELL]; +extern unsigned char fire_b[YRES/CELL][XRES/CELL]; + pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f); void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch); diff --git a/hmap.h b/hmap.h index a356fd2..8af6e71 100755 --- a/hmap.h +++ b/hmap.h @@ -17,5 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ -unsigned char color_data[] = {0xD9,0xFF,0xFE,0xD4,0xFB,0xFC,0xCF,0xF6,0xF9,0xC9,0xF1,0xF6,0xC2,0xEB,0xF4,0xBB,0xE5,0xF0,0xB3,0xDE,0xED,0xAA,0xD6,0xE9,0xA1,0xCF,0xE5,0x98,0xC7,0xE2,0x8E,0xBF,0xDD,0x85,0xB6,0xD9,0x7B,0xAD,0xD5,0x71,0xA5,0xD0,0x67,0x9C,0xCC,0x5D,0x93,0xC7,0x53,0x8A,0xC3,0x4A,0x82,0xBE,0x41,0x79,0xB9,0x38,0x71,0xB5,0x30,0x69,0xB0,0x28,0x61,0xAC,0x21,0x5A,0xA8,0x1B,0x53,0xA3,0x16,0x4D,0x9F,0x12,0x47,0x9B,0x0F,0x42,0x98,0x0F,0x3D,0x94,0x0F,0x39,0x90,0x0F,0x34,0x8C,0x0F,0x30,0x89,0x0F,0x2C,0x85,0x0F,0x28,0x81,0x0F,0x24,0x7D,0x0F,0x20,0x7A,0x0F,0x1D,0x76,0x0F,0x1A,0x72,0x0F,0x16,0x6F,0x0F,0x13,0x6B,0x0F,0x11,0x67,0x10,0x0E,0x64,0x12,0x0C,0x60,0x15,0x0A,0x5D,0x18,0x08,0x59,0x1B,0x06,0x56,0x1D,0x04,0x53,0x20,0x03,0x4F,0x23,0x02,0x4C,0x26,0x01,0x49,0x29,0x01,0x46,0x2C,0x00,0x43,0x2F,0x00,0x40,0x30,0x00,0x3F,0x31,0x00,0x3F,0x31,0x00,0x3E,0x32,0x00,0x3E,0x32,0x00,0x3D,0x33,0x00,0x3D,0x33,0x00,0x3C,0x34,0x00,0x3C,0x34,0x00,0x3B,0x35,0x01,0x3B,0x36,0x01,0x3B,0x36,0x01,0x3A,0x37,0x01,0x3A,0x37,0x01,0x39,0x38,0x01,0x39,0x39,0x01,0x38,0x39,0x02,0x38,0x3A,0x02,0x37,0x3B,0x02,0x37,0x3B,0x02,0x36,0x3C,0x02,0x36,0x3C,0x03,0x35,0x3D,0x03,0x35,0x3E,0x03,0x34,0x3F,0x03,0x34,0x3F,0x04,0x34,0x40,0x04,0x33,0x41,0x04,0x33,0x41,0x04,0x32,0x42,0x05,0x32,0x43,0x05,0x31,0x43,0x05,0x31,0x44,0x06,0x30,0x45,0x06,0x30,0x46,0x06,0x30,0x46,0x07,0x2F,0x47,0x07,0x2F,0x48,0x08,0x2E,0x49,0x08,0x2E,0x49,0x08,0x2E,0x4A,0x09,0x2D,0x4B,0x09,0x2D,0x4C,0x09,0x2C,0x4C,0x0A,0x2C,0x4D,0x0A,0x2B,0x4E,0x0B,0x2B,0x4F,0x0B,0x2B,0x4F,0x0C,0x2A,0x50,0x0C,0x2A,0x51,0x0D,0x29,0x52,0x0D,0x29,0x53,0x0D,0x29,0x53,0x0E,0x28,0x54,0x0E,0x28,0x55,0x0F,0x27,0x56,0x0F,0x27,0x57,0x10,0x27,0x58,0x10,0x26,0x58,0x11,0x26,0x59,0x11,0x26,0x5A,0x12,0x25,0x5B,0x13,0x25,0x5C,0x13,0x24,0x5D,0x14,0x24,0x5D,0x14,0x24,0x5E,0x15,0x23,0x5F,0x15,0x23,0x60,0x16,0x23,0x61,0x16,0x22,0x62,0x17,0x22,0x62,0x18,0x22,0x63,0x18,0x21,0x64,0x19,0x21,0x65,0x19,0x21,0x66,0x1A,0x20,0x67,0x1B,0x20,0x67,0x1B,0x20,0x68,0x1C,0x1F,0x69,0x1C,0x1F,0x6A,0x1D,0x1F,0x6B,0x1E,0x1E,0x6C,0x1E,0x1E,0x6D,0x1F,0x1E,0x6D,0x1F,0x1D,0x6E,0x20,0x1D,0x6F,0x21,0x1D,0x70,0x21,0x1C,0x71,0x22,0x1C,0x72,0x23,0x1C,0x73,0x23,0x1B,0x73,0x24,0x1B,0x74,0x25,0x1B,0x75,0x25,0x1A,0x76,0x26,0x1A,0x77,0x27,0x1A,0x78,0x27,0x1A,0x78,0x28,0x19,0x79,0x29,0x19,0x7A,0x29,0x19,0x7B,0x2A,0x18,0x7C,0x2B,0x18,0x7D,0x2B,0x18,0x7E,0x2C,0x18,0x7E,0x2D,0x17,0x7F,0x2D,0x17,0x80,0x2E,0x17,0x81,0x2F,0x16,0x82,0x2F,0x16,0x82,0x30,0x16,0x83,0x31,0x16,0x84,0x31,0x15,0x85,0x32,0x15,0x86,0x33,0x15,0x87,0x33,0x15,0x87,0x34,0x14,0x88,0x35,0x14,0x89,0x36,0x14,0x8A,0x36,0x14,0x8A,0x37,0x13,0x8B,0x38,0x13,0x8C,0x38,0x13,0x8D,0x39,0x13,0x8E,0x3A,0x13,0x8E,0x3A,0x12,0x8F,0x3B,0x12,0x90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00,0x55,0x00,0x02,0x55,0x02,0x03,0x55,0x03,0x06,0x55,0x03,0x07,0x55,0x05,0x09,0x55,0x06,0x0C,0x55,0x06,0x0F,0x55,0x07,0x10,0x55,0x09,0x13,0x55,0x0A,0x16,0x55,0x0C,0x1A,0x55,0x0C,0x1D,0x54,0x0E,0x20,0x53,0x10,0x23,0x54,0x11,0x26,0x53,0x13,0x2A,0x52,0x14,0x2E,0x51,0x15,0x31,0x50,0x17,0x35,0x50,0x19,0x38,0x4E,0x1A,0x3D,0x4D,0x1C,0x40,0x4D,0x1D,0x44,0x4C,0x1F,0x47,0x4B,0x21,0x4C,0x4A,0x23,0x4F,0x49,0x24,0x54,0x48,0x25,0x57,0x47,0x28,0x5B,0x46,0x29,0x5F,0x45,0x2B,0x62,0x44,0x2D,0x66,0x44,0x2E,0x6A,0x43,0x30,0x6E,0x42,0x32,0x72,0x41,0x33,0x76,0x40,0x35,0x79,0x3F,0x38,0x7C,0x3F,0x39,0x7F,0x3E,0x3B,0x83,0x3D,0x3D,0x86,0x3C,0x3F,0x8A,0x3B,0x40,0x8C,0x3B,0x43,0x8F,0x3B,0x44,0x92,0x3A,0x46,0x95,0x39,0x48,0x98,0x39,0x4A,0x9B,0x39,0x4C,0x9C,0x39,0x4E,0x9F,0x3A,0x4F,0xA1,0x39,0x51,0xA3,0x39,0x52,0xA4,0x39,0x54,0xA6,0x39,0x56,0xA7,0x39,0x57,0xA8,0x39,0x58,0xA8,0x3A,0x5A,0xA9,0x3A,0x5C,0xA8,0x3A,0x5D,0xA8,0x3B,0x5F,0xA8,0x3C,0x61,0xA8,0x3D,0x62,0xA8,0x3D,0x64,0xA9,0x3E,0x66,0xA8,0x3E,0x67,0xA9,0x3F,0x68,0xA8,0x40,0x6A,0xA8,0x41,0x6C,0xA8,0x42,0x6E,0xA8,0x42,0x70,0xA8,0x43,0x71,0xA8,0x44,0x73,0xA8,0x45,0x74,0xA9,0x46,0x76,0xA8,0x48,0x79,0xA8,0x49,0x7A,0xA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,0x64,0x12,0x0C,0x60,0x15,0x0A,0x5D,0x18,0x08,0x59,0x1B,0x06,0x56,0x1D,0x04,0x53,0x20,0x03,0x4F,0x23,0x02,0x4C,0x26,0x01,0x49,0x29,0x01,0x46,0x2C,0x00,0x43,0x2F,0x00,0x40,0x30,0x00,0x3F,0x31,0x00,0x3F,0x31,0x00,0x3E,0x32,0x00,0x3E,0x32,0x00,0x3D,0x33,0x00,0x3D,0x33,0x00,0x3C,0x34,0x00,0x3C,0x34,0x00,0x3B,0x35,0x01,0x3B,0x36,0x01,0x3B,0x36,0x01,0x3A,0x37,0x01,0x3A,0x37,0x01,0x39,0x38,0x01,0x39,0x39,0x01,0x38,0x39,0x02,0x38,0x3A,0x02,0x37,0x3B,0x02,0x37,0x3B,0x02,0x36,0x3C,0x02,0x36,0x3C,0x03,0x35,0x3D,0x03,0x35,0x3E,0x03,0x34,0x3F,0x03,0x34,0x3F,0x04,0x34,0x40,0x04,0x33,0x41,0x04,0x33,0x41,0x04,0x32,0x42,0x05,0x32,0x43,0x05,0x31,0x43,0x05,0x31,0x44,0x06,0x30,0x45,0x06,0x30,0x46,0x06,0x30,0x46,0x07,0x2F,0x47,0x07,0x2F,0x48,0x08,0x2E,0x49,0x08,0x2E,0x49,0x08,0x2E,0x4A,0x09,0x2D,0x4B,0x09,0x2D,0x4C,0x09,0x2C,0x4C,0x0A,0x2C,0x4D,0x0A,0x2B,0x4E,0x0B,0x2B,0x4F,0x0B,0x2B,0x4F,0x0C,0x2A,0x50,0x0C,0x2A,0x51,0x0D,0x29,0x52,0x0D,0x29,0x53,0x0D,0x29,0x53,0x0E,0x28,0x54,0x0E,0x28,0x55,0x0F,0x27,0x56,0x0F,0x27,0x57,0x10,0x27,0x58,0x10,0x26,0x58,0x11,0x26,0x59,0x11,0x26,0x5A,0x12,0x25,0x5B,0x13,0x25,0x5C,0x13,0x24,0x5D,0x14,0x24,0x5D,0x14,0x24,0x5E,0x15,0x23,0x5F,0x15,0x23,0x60,0x16,0x23,0x61,0x16,0x22,0x62,0x17,0x22,0x62,0x18,0x22,0x63,0x18,0x21,0x64,0x19,0x21,0x65,0x19,0x21,0x66,0x1A,0x20,0x67,0x1B,0x20,0x67,0x1B,0x20,0x68,0x1C,0x1F,0x69,0x1C,0x1F,0x6A,0x1D,0x1F,0x6B,0x1E,0x1E,0x6C,0x1E,0x1E,0x6D,0x1F,0x1E,0x6D,0x1F,0x1D,0x6E,0x20,0x1D,0x6F,0x21,0x1D,0x70,0x21,0x1C,0x71,0x22,0x1C,0x72,0x23,0x1C,0x73,0x23,0x1B,0x73,0x24,0x1B,0x74,0x25,0x1B,0x75,0x25,0x1A,0x76,0x26,0x1A,0x77,0x27,0x1A,0x78,0x27,0x1A,0x78,0x28,0x19,0x79,0x29,0x19,0x7A,0x29,0x19,0x7B,0x2A,0x18,0x7C,0x2B,0x18,0x7D,0x2B,0x18,0x7E,0x2C,0x18,0x7E,0x2D,0x17,0x7F,0x2D,0x17,0x80,0x2E,0x17,0x81,0x2F,0x16,0x82,0x2F,0x16,0x82,0x30,0x16,0x83,0x31,0x16,0x84,0x31,0x15,0x85,0x32,0x15,0x86,0x33,0x15,0x87,0x33,0x15,0x87,0x34,0x14,0x88,0x35,0x14,0x89,0x36,0x14,0x8A,0x36,0x14,0x8A,0x37,0x13,0x8B,0x38,0x13,0x8C,0x38,0x13,0x8D,0x39,0x13,0x8E,0x3A,0x13,0x8E,0x3A,0x12,0x8F,0x3B,0x12,0x90,0x3C,0x12,0x91,0x3C,0x12,0x91,0x3D,0x11,0x92,0x3E,0x11,0x93,0x3E,0x11,0x94,0x3F,0x11,0x94,0x40,0x11,0x95,0x40,0x10,0x96,0x41,0x10,0x97,0x42,0x10,0x97,0x42,0x10,0x98,0x43,0x10,0x99,0x44,0x0F,0x99,0x44,0x0F,0x9A,0x45,0x0F,0x9A,0x45,0x0F,0x9B,0x46,0x0F,0x9C,0x47,0x0F,0x9C,0x47,0x0E,0x9D,0x48,0x0E,0x9D,0x48,0x0E,0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,0xFE,0xF5,0xD8,0xFE,0xF6,0xDA,0xFE,0xF6,0xDB,0xFE,0xF6,0xDD,0xFE,0xF7,0xDE,0xFE,0xF7,0xE0,0xFE,0xF7,0xE1,0xFE,0xF8,0xE3,0xFE,0xF8,0xE4,0xFE,0xF8,0xE5,0xFE,0xF9,0xE7,0xFE,0xF9,0xE8,0xFE,0xF9,0xE9,0xFE,0xFA,0xEB,0xFE,0xFA,0xEC,0xFE,0xFA,0xED,0xFE,0xFB,0xEF,0xFE,0xFB,0xF0,0xFE,0xFB,0xF1,0xFE,0xFC,0xF2,0xFF,0xFC,0xF3,0xFF,0xFC,0xF5,0xFF,0xFC,0xF6,0xFF,0xFD,0xF7,0xFF,0xFD,0xF8,0xFF,0xFD,0xF9,0xFF,0xFE,0xFA,0xFF,0xFE,0xFB,0xFF,0xFE,0xFC,0xFF,0xFE,0xFC,0xFF,0xFF,0xFD,0xFF,0xFF,0xFE}; +static char plasma_data[] = {0x00,0x00,0x00,0x03,0x00,0x00,0x05,0x00,0x00,0x09,0x00,0x00,0x0E,0x00,0x00,0x12,0x00,0x00,0x17,0x00,0x00,0x1C,0x00,0x00,0x22,0x00,0x00,0x27,0x00,0x00,0x2C,0x00,0x00,0x32,0x00,0x00,0x37,0x00,0x00,0x3C,0x00,0x00,0x41,0x00,0x00,0x45,0x00,0x00,0x4A,0x00,0x00,0x4D,0x00,0x00,0x51,0x00,0x00,0x53,0x00,0x00,0x55,0x00,0x00,0x55,0x00,0x02,0x55,0x02,0x03,0x55,0x03,0x06,0x55,0x03,0x07,0x55,0x05,0x09,0x55,0x06,0x0C,0x55,0x06,0x0F,0x55,0x07,0x10,0x55,0x09,0x13,0x55,0x0A,0x16,0x55,0x0C,0x1A,0x55,0x0C,0x1D,0x54,0x0E,0x20,0x53,0x10,0x23,0x54,0x11,0x26,0x53,0x13,0x2A,0x52,0x14,0x2E,0x51,0x15,0x31,0x50,0x17,0x35,0x50,0x19,0x38,0x4E,0x1A,0x3D,0x4D,0x1C,0x40,0x4D,0x1D,0x44,0x4C,0x1F,0x47,0x4B,0x21,0x4C,0x4A,0x23,0x4F,0x49,0x24,0x54,0x48,0x25,0x57,0x47,0x28,0x5B,0x46,0x29,0x5F,0x45,0x2B,0x62,0x44,0x2D,0x66,0x44,0x2E,0x6A,0x43,0x30,0x6E,0x42,0x32,0x72,0x41,0x33,0x76,0x40,0x35,0x79,0x3F,0x38,0x7C,0x3F,0x39,0x7F,0x3E,0x3B,0x83,0x3D,0x3D,0x86,0x3C,0x3F,0x8A,0x3B,0x40,0x8C,0x3B,0x43,0x8F,0x3B,0x44,0x92,0x3A,0x46,0x95,0x39,0x48,0x98,0x39,0x4A,0x9B,0x39,0x4C,0x9C,0x39,0x4E,0x9F,0x3A,0x4F,0xA1,0x39,0x51,0xA3,0x39,0x52,0xA4,0x39,0x54,0xA6,0x39,0x56,0xA7,0x39,0x57,0xA8,0x39,0x58,0xA8,0x3A,0x5A,0xA9,0x3A,0x5C,0xA8,0x3A,0x5D,0xA8,0x3B,0x5F,0xA8,0x3C,0x61,0xA8,0x3D,0x62,0xA8,0x3D,0x64,0xA9,0x3E,0x66,0xA8,0x3E,0x67,0xA9,0x3F,0x68,0xA8,0x40,0x6A,0xA8,0x41,0x6C,0xA8,0x42,0x6E,0xA8,0x42,0x70,0xA8,0x43,0x71,0xA8,0x44,0x73,0xA8,0x45,0x74,0xA9,0x46,0x76,0xA8,0x48,0x79,0xA8,0x49,0x7A,0xA7,0x4A,0x7C,0xA6,0x4A,0x7D,0xA5,0x4C,0x7F,0xA4,0x4D,0x81,0xA3,0x4E,0x83,0xA2,0x4E,0x85,0xA1,0x50,0x86,0xA0,0x51,0x88,0x9F,0x52,0x8A,0x9D,0x53,0x8B,0x9D,0x55,0x8D,0x9B,0x56,0x8F,0x9A,0x57,0x91,0x98,0x58,0x92,0x98,0x5A,0x94,0x97,0x5B,0x96,0x95,0x5C,0x97,0x94,0x5E,0x99,0x93,0x5F,0x9A,0x91,0x60,0x9C,0x90,0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0xBC,0xBE,0xC4,0xBD,0xBF,0xC4,0xBE,0xBF,0xC4,0xBF,0xC0,0xC4,0xC0,0xC1,0xC4,0xC1,0xC2,0xC4,0xC2,0xC2,0xC4,0xC3,0xC4,0xC4,0xC3,0xC4,0xC4,0xC4}; +#endif \ No newline at end of file diff --git a/interface.c b/interface.c new file mode 100644 index 0000000..bb8f7cd --- /dev/null +++ b/interface.c @@ -0,0 +1,15 @@ +#include "powder.h" +#include "interface.h" + + +void menu_count(void) +{ + int i=0; + msections[SC_WALL].itemcount = UI_WALLCOUNT-4; + msections[SC_SPECIAL].itemcount = 4; + for(i=0; i1) - printf("Multithreading enabled\n"); - else - printf("Multithreading disabled\n"); -#endif - return numCPU; -} - -void update_air(void) -{ - int x, y, i, j; - float dp, dx, dy, f, tx, ty; - - for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; - if(dp < -256.0f) dp = -256.0f; - if(dx > 256.0f) dx = 256.0f; - if(dx < -256.0f) dx = -256.0f; - if(dy > 256.0f) dy = 256.0f; - if(dy < -256.0f) dy = -256.0f; - - ovx[y][x] = dx; - ovy[y][x] = dy; - opv[y][x] = dp; - } - memcpy(vx, ovx, sizeof(vx)); - memcpy(vy, ovy, sizeof(vy)); - memcpy(pv, opv, sizeof(pv)); -} - -void *update_air_th(void *arg) -{ - update_air(); - return NULL; -} - -/*********************************************************** - * PARTICLE SIMULATOR * - ***********************************************************/ -particle *parts; -particle *cb_parts; - -float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index -int isplayer = 0; //It shows is player spawned or not -int mousex, mousey = 0; //They contain mouse position - -void menu_count(void) -{ - int i=0; - msections[SC_WALL].itemcount = UI_WALLCOUNT-4; - msections[SC_SPECIAL].itemcount = 4; - for(i=0; i=XRES || ny>=YRES) - return 0; - if(x==nx && y==ny) - return 1; - r = pmap[ny][nx]; - if(r && (r>>8)>8].type; - - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) - { - return 1; - } - - if((r&0xFF)==PT_VOID) - { - parts[i].type=PT_NONE; - return 0; - } - if((r&0xFF)==PT_BHOL) - { - parts[i].type=PT_NONE; - if(!legacy_enable) - { - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; - } - return 0; - } - - if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide - { - return 1; - } - - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) - { - return 1; - } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) - { - return 0; - } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) - { - return 0; - } - - if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; - if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) - return 0; - if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) - return 0; - - if(parts[i].type==PT_CNCT && y>8)>= 8; - parts[r].x += x-nx; - parts[r].y += y-ny; - } - - return 1; -} - -void kill_part(int i) -{ - int x, y; - parts[i].type = PT_NONE; - - x = (int)(parts[i].x+0.5f); - y = (int)(parts[i].y+0.5f); - - if(x>=0 && y>=0 && x=XRES || y>=YRES) - return -1; - - if(t==SPC_HEAT||t==SPC_COOL) - { - if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); - } - if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) - { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); - } - return pmap[y][x]>>8; - } - else - { - return -1; - } - } - if(t==SPC_AIR) - { - pv[y/CELL][x/CELL] += 0.03f; - if(y+CELL>8].type = PT_SPRK; - parts[pmap[y][x]>>8].life = 4; - parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; - pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; - return pmap[y][x]>>8; - } - - if(p==-1) - { - if(pmap[y][x]) - return -1; - if(pfree == -1) - return -1; - i = pfree; - pfree = parts[i].life; - } - else - i = p; - - if(t==PT_GLAS) - { - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - } - if(t!=PT_STKM) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = t; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 0; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - } - if(t==PT_ACID) - { - parts[i].life = 75; - } - /*Testing - if(t==PT_WOOD){ - parts[i].life = 150; - } - End Testing*/ - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_PLSM) - parts[i].life = rand()%150+50; - if(t==PT_LAVA) - parts[i].life = rand()%120+240; - if(t==PT_NBLE) - parts[i].life = 0; - if(t==PT_NEUT) - { - float r = (rand()%128+128)/127.0f; - float a = (rand()%360)*3.14159f/180.0f; - parts[i].life = rand()%480+480; - parts[i].vx = r*cosf(a); - parts[i].vy = r*sinf(a); - } - if(t==PT_PHOT) - { - float r = (rand()%3-1)*3; - float a = (rand()%3-1)*3; - parts[i].life = 680; - if(a==0.0f&&r==0.0f) - { - parts[i].life = 0; - parts[i].type = PT_NONE; - return -1; - } - else - { - parts[i].vx = a; - parts[i].vy = r; - } - //} else { - // parts[i].life = 0; - // parts[i].type = PT_NONE; - //}/ - } - - if(t!=PT_STKM) - pmap[y][x] = t|(i<<8); - else - { - if(isplayer==0) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - - - - player[3] = x-1; //Setting legs positions - player[4] = y+6; - player[5] = x-1; - player[6] = y+6; - - player[7] = x-3; - player[8] = y+12; - player[9] = x-3; - player[10] = y+12; - - player[11] = x+1; - player[12] = y+6; - player[13] = x+1; - player[14] = y+6; - - player[15] = x+3; - player[16] = y+12; - player[17] = x+3; - player[18] = y+12; - - isplayer = 1; - } - } - - return i; -} - -#ifdef WIN32 -_inline void delete_part(int x, int y) -#else -inline void delete_part(int x, int y) -#endif -{ - unsigned i; - - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - i = pmap[y][x]; - if(!i || (i>>8)>=NPART) - return; - - kill_part(i>>8); - pmap[y][x] = 0; // just in case -} - -#ifdef WIN32 -_inline int is_wire(int x, int y) -#else -inline int is_wire(int x, int y) -#endif -{ - return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; -} - -#ifdef WIN32 -_inline int is_wire_off(int x, int y) -#else -inline int is_wire_off(int x, int y) -#endif -{ - return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; -} - -void set_emap(int x, int y) -{ - int x1, x2; - - if(!is_wire_off(x, y)) - return; - - // go left as far as possible - x1 = x2 = x; - while(x1>0) - { - if(!is_wire_off(x1-1, y)) - break; - x1--; - } - while(x21 && x1==x2 && - is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && - !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) - set_emap(x1, y-2); - else if(y>0) - for(x=x1; x<=x2; x++) - if(is_wire_off(x, y-1)) - { - if(x==x1 || x==x2 || y>=YRES/CELL-1 || - is_wire(x-1, y-1) || is_wire(x+1, y-1) || - is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) - set_emap(x, y-1); - } - - if(y>8) < NPART && (pmr>>8) >= 0) - { - return parts[pmr>>8].type; - } - else - { - return PT_NONE; - } -} -int nearest_part(int ci, int t) -{ - int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); - int ndistance = 0; - int id = -1; - int i = 0; - int cx = (int)parts[ci].x; - int cy = (int)parts[ci].y; - for(i=0; i=XRES || y>=YRES || - ((bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) - { - kill_part(i); - continue; - } - - vx[y/CELL][x/CELL] *= ptypes[t].airloss; - vy[y/CELL][x/CELL] *= ptypes[t].airloss; - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - if(t==PT_GASS||t==PT_NBLE) - { - if(pv[y/CELL][x/CELL]<3.5f) - pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); - if(y+CELL2.5f) - { - parts[i].life = rand()%80+180; - rt = parts[i].type = PT_FIRE; - parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - pv[y/CELL][x/CELL] += 0.25f * CFDS; - t = PT_FIRE; - } - - parts[i].vx *= ptypes[t].loss; - parts[i].vy *= ptypes[t].loss; - - if(t==PT_DFRM && !parts[i].life) - { - if(pv[y/CELL][x/CELL]>1.0f) - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - parts[i].life = rand()%80+300; - } - } - else - { - if(t==PT_PLAS && pv[y/CELL][x/CELL]>25.0f) - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - } else { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - } - - if(ptypes[t].diffusion) - { - parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - } - - // interpolator -#ifdef WIN32 - mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#else - mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#endif - if(mv < ISTP) - { - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - } - else - { - dx = parts[i].vx*ISTP/mv; - dy = parts[i].vy*ISTP/mv; - ix = parts[i].x; - iy = parts[i].y; - while(1) - { - mv -= ISTP; - if(mv <= 0.0f) - { - // nothing found - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - break; - } - ix += dx; - iy += dy; - nx = (int)(ix+0.5f); - ny = (int)(iy+0.5f); - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) - { - parts[i].x = ix; - parts[i].y = iy; - break; - } - } - } - - a = nt = 0; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx4.0f) - t = parts[i].type = PT_DSTW; - if(t==PT_DESL && pv[y/CELL][x/CELL]<-6.0f) - t = parts[i].type = PT_GASS; - if(t==PT_GASS && pv[y/CELL][x/CELL]>6.0f) - t = parts[i].type = PT_DESL; - if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) - t = parts[i].type = PT_FIRE; - } - if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f) - t = parts[i].type = PT_GASS; - if(t==PT_DESL && pv[y/CELL][x/CELL]>50.0f) // Only way I know to make it - t = parts[i].type = PT_FIRE; // combust under pressure. - if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f) - t = parts[i].type = PT_DESL; - if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) - t = parts[i].type = PT_BRMT; - //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) - // t = parts[i].type = PT_BGLA; - if(t==PT_GLAS) - { - parts[i].pavg[0] = parts[i].pavg[1]; - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) - { - parts[i].type = PT_BGLA; - } - } - if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) - t = parts[i].type = PT_SNOW; - if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) - { - t = PT_NEUT; - create_part(i, x, y, t); - } - - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) - { - nearp = nearest_part(i, PT_ETRD); - if(nearp!=-1) - { - create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[nearp].type = PT_SPRK; - parts[nearp].life = 9; - parts[nearp].ctype = PT_ETRD; - } - } - - if(!legacy_enable) - { - int ctemp = pv[y/CELL][x/CELL]*2; - c_heat = 0.0f; - h_count = 0; - if(ptypes[t].hconduct>(rand()%250)) - { - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) - { - h_count++; - c_heat += parts[r>>8].temp; - } - } - } - } - pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) - { - parts[r>>8].temp = parts[i].temp; - } - } - } - } - if(pt>=pstates[t].btemp&&pstates[t].burn) - { - t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE||t==PT_PLSM) - parts[i].life = rand()%50+120; - } - else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) - { - if(t==PT_LAVA&&parts[i].ctype) - { - parts[i].life = 0; - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) - { - parts[i].ctype = parts[i].type; - t = parts[i].type = PT_ICEI; - } - else - { - parts[i].life = 0; - t = parts[i].type = pstates[t].solid; - } - } - else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) - { - if(pstates[t].liquid==PT_LAVA) - { - parts[i].life = rand()%120+240; - parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; - parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; - t = parts[i].type = pstates[t].liquid; - } - else if(t==PT_ICEI&&parts[i].ctype) - { - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else - { - t = parts[i].type = pstates[t].liquid; - } - } - else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) - { - t = parts[i].type = pstates[t].liquid; - } - else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) - { - if(t==PT_SLTW&&1>rand()%6) - { - t = parts[i].type = PT_SALT; - } - else - { - t = parts[i].type = pstates[t].gas; - pv[y/CELL][x/CELL] += 0.50f; - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - } - } - if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) - { - float atemp = parts[i].temp + (-MIN_TEMP); - pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; - } - if(t==PT_LAVA) - { - parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - } - pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - } - } - if(t==PT_PTCT&&parts[i].temp>24.0f) - { - pt = parts[i].temp -= 2.5f; - } - if(t==PT_NTCT&&parts[i].temp>24.0f) - { - pt = parts[i].temp -= 2.5f; - } - - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_NTCT || t==PT_PTCT || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) - { - nx = x % CELL; - if(nx == 0) - nx = x/CELL - 1; - else if(nx == CELL-1) - nx = x/CELL + 1; - else - nx = x/CELL; - ny = y % CELL; - if(ny == 0) - ny = y/CELL - 1; - else if(ny == CELL-1) - ny = y/CELL + 1; - else - ny = y/CELL; - if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) - { - t = parts[i].type = PT_NONE; - parts[r>>8].ctype = parts[r>>8].type; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - } - else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) - { - pv[y/CELL][x/CELL] += 100.0f; - if(legacy_enable&&1>(rand()%200)) - { - parts[i].life = rand()%50+120; - t = parts[i].type = PT_FIRE; - } - else - { - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_ICEI || t==PT_SNOW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if(legacy_enable) - { - if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_ICEI; - parts[r>>8].type = PT_ICEI; - } - if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) - t = parts[i].type = PT_WATR; - } - } - } - else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL) - { - parts[i].temp = 200.0f; - } - } - } - //PLANT - else if(t==PT_PLNT) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR && 1>(rand()%250)) - { - t = parts[i].type = PT_PLNT; - parts[r>>8].type = PT_PLNT; - } - else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_WATR||t==PT_DSTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%250)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_WATR; - } - if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_SLTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) - { - parts[r>>8].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_WTRV) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - parts[r>>8].type = PT_WATR; - } - - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - if(1>(rand()%1000)) - parts[r>>8].type = PT_WATR; - } - } - } - else if(t==PT_YEST) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_DYST && 1>(rand()%30) && !legacy_enable) - { - t = parts[i].type = PT_DYST; - } - } - } - else if(t==PT_ACID) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)!=PT_ACID) - { - if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) - { - t = parts[i].type = PT_FIRE; - parts[i].life = 4; - parts[r>>8].type = PT_FIRE; - parts[r>>8].life = 4; - } - else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) - { - parts[i].life--; - parts[r>>8].type = PT_NONE; - } - else if (parts[i].life==50) - { - parts[i].life = 0; - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_NEUT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) - { - if(33>rand()%100) - { - create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); - } - else - { - create_part(r>>8, x+nx, y+ny, PT_NEUT); - parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; - parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; - } - pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough - fe ++; - } - if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) - parts[r>>8].type = PT_DUST; - if((r&0xFF)==PT_DYST && 15>(rand()%1000)) - parts[r>>8].type = PT_YEST; - if((r&0xFF)==PT_YEST){ - if(15>(rand()%100000)&&isplayer==0) - parts[r>>8].type = PT_STKM; - else - parts[r>>8].type = PT_DYST; - } - - if((r&0xFF)==PT_WATR && 15>(rand()%100)) - parts[r>>8].type = PT_DSTW; - if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) - parts[r>>8].type = PT_DFRM; - if((r&0xFF)==PT_NITR && 15>(rand()%1000)) - parts[r>>8].type = PT_DESL; - if((r&0xFF)==PT_OILL && 5>(rand()%1000)) - parts[r>>8].type = PT_PLAS; - if((r&0xFF)==PT_PLNT && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - if((r&0xFF)==PT_PLAS && 5>(rand()%1000)) - parts[r>>8].type = PT_OILL; - if((r&0xFF)==PT_DESL && 15>(rand()%1000)) - parts[r>>8].type = PT_GASS; - if((r&0xFF)==PT_COAL && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - } - } - else if(t==PT_PHOT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=0; nx<1; nx++) - for(ny=0; ny<1; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - } - } - else if(t==PT_LCRY) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK) - { - if(parts[r>>8].ctype==PT_PSCN) - { - parts[i].life = 10; - } - else if(parts[r>>8].ctype==PT_NSCN) - { - parts[i].life = 9; - } - } - if(rt==PT_LCRY) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - else if(t==PT_BTRY) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(parts_avg(i,r>>8) != PT_INSL) - { - if((rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) - { - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - parts[r>>8].type = PT_SPRK; - } - } - } - }else if(t==PT_SWCH) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8)!=PT_INSL) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - if(t==PT_SWCH) - if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) - { - parts[i].life--; - } - if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) - continue; - rt = parts[r>>8].type; - if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && - ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) - { - parts[r>>8].type = PT_FIRE; - parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - parts[r>>8].life = rand()%80+180; - if(ptypes[rt].explosive) - pv[y/CELL][x/CELL] += 0.25f * CFDS; - continue; - } - lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; - if(lpv < 1) lpv = 1; - if(legacy_enable) - { - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && - ptypes[rt].meltable*lpv>(rand()%1000)) - { - if(t!=PT_LAVA || parts[i].life>0) - { - parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; - parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; - parts[r>>8].type = PT_LAVA; - parts[r>>8].life = rand()%120+240; - } - else - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; - parts[i].ctype = PT_NONE;//rt; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) - { - parts[r>>8].type = PT_WATR; - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = PT_STNE; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) - { - kill_part(r>>8); - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; - parts[i].ctype = PT_NONE; - goto killed; - } - } - } - pavg = parts_avg(i, r>>8); - if(rt==PT_SWCH && t==PT_SPRK) - { - pavg = parts_avg(r>>8, i); - if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) - parts[r>>8].life = 10; - if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) - parts[r>>8].life = 9; - if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].ctype = PT_SWCH; - parts[r>>8].life = 4; - } - } - pavg = parts_avg(i, r>>8); - if(pavg != PT_INSL) - { - if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) - parts[r>>8].temp = parts[r>>8].temp+10.0f; - } - } - if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 6; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 5; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) - { - if(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) - { - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - - if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) - { - parts[i].life = rand()%150+50; - parts[i].type = PT_PLSM; - parts[i].ctype = PT_NBLE; - parts[i].temp = 3500; - pv[y/CELL][x/CELL] += 1; - } - if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) - { - parts[i].type = PT_SWCH; - parts[i].life = 11; - } - } - } -killed: - if(parts[i].type == PT_NONE) - continue; - } - if(t==PT_STKM) - { - //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) - parts[i].temp += 1; - - //Death - if(parts[i].life<0 && (death == 1)) //If his HP is less that 0 or there is very big wind... - { - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - //Verlet integration - pp = 2*player[3]-player[5]; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+1; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+1; - player[18] = player[16]; - player[16] = pp; - - //Go left - if (((int)(player[0])&0x01) == 0x01) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] += 3; - player[10] += 2; - player[5] += 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 3; - player[18] += 2; - player[13] +=2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[9] += 1; - player[10] += 1; - player[5] += 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] += 1; - player[18] += 1; - player[13] +=1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 3; - player[10] += 2; - player[5] -= 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 3; - player[18] += 2; - player[13] -= 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[9] -= 1; - player[10] += 1; - player[5] -= 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[17] -= 1; - player[18] += 1; - player[13] -= 1; - } - - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)) - { - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - create_part(-1, nx, ny, player[2]); - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) - { - int random = abs(rand()%3-1)*3; - if (random==0) - { - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; - } - else - { - parts[r>>8].vy = 0; - parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; - } - } - - } - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[10] += 1; - player[18] += 1; - } - - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; - player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; - player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; - player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; - player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; - parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; - player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; - parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; - player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) - player[15] -= nx; - - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; - } - else - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= 10+ny; - parts[i].vy = -10; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[7] += 0.2; - player[15] -= 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[3] += 0.2; - player[11] -= 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[16] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) - { - parts[i].life -= 2; - player[8] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } - if(t==PT_CLNE) - { - if(!parts[i].ctype) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx30&&parts[i].temp<44){ - create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST); - } - } - if(t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1) - { - parts[i].type = PT_NBLE; - parts[i].life = 0; - } - if (t==PT_FIRE && parts[i].life <=1) - { - t = parts[i].type = PT_SMKE; - parts[i].life = rand()%20+250; - } - - nx = (int)(parts[i].x+0.5f); - ny = (int)(parts[i].y+0.5f); - - if(nx=XRES-CELL || - ny=YRES-CELL) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - continue; - } - - rt = parts[i].flags & FLAG_STAGNANT; - parts[i].flags &= ~FLAG_STAGNANT; - if(!try_move(i, x, y, nx, ny)) - { - parts[i].x = lx; - parts[i].y = ly; - if(ptypes[t].falldown) - { - if(nx!=x && try_move(i, x, y, nx, y)) - { - parts[i].x = ix; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x, ny)) - { - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else - { - r = (rand()%2)*2-1; - if(ny!=y && try_move(i, x, y, x+r, ny)) - { - parts[i].x += r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x-r, ny)) - { - parts[i].x -= r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y+r)) - { - parts[i].x = ix; - parts[i].y += r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y-r)) - { - parts[i].x = ix; - parts[i].y -= r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) - { - s = 0; - if(!rt || nt) - rt = 50; - else - rt = 10; - for(j=x+r; j>=0 && j>=x-rt && j0) - r = 1; - else - r = -1; - if(s) - for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; - if(nxy+ISTP) ny=y+ISTP; - if(ny(rand()%1000)) - { - kill_part(i); - continue; - } - else if(try_move(i, x, y, 2*x-nx, ny)) - { - parts[i].x = (float)(2*x-nx); - parts[i].y = (float)iy; - parts[i].vx *= ptypes[t].collision; - } - else if(try_move(i, x, y, nx, 2*y-ny)) - { - parts[i].x = (float)ix; - parts[i].y = (float)(2*y-ny); - parts[i].vy *= ptypes[t].collision; - } - else - { - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - } - } - -justdraw: - - nx = (int)(parts[i].x+0.5f); - ny = (int)(parts[i].y+0.5f); - - if(nx=XRES-CELL || - ny=YRES-CELL) - { - kill_part(i); - continue; - } - if(cmode!=CM_HEAT) - { - if(t==PT_STKM) //Just draw head here - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; - vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; - vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; - vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; - } - draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); - draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); - draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); - draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); - - isplayer = 1; //It's a secret. Tssss... - } - if(t==PT_MWAX&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,224,170,255); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,224,224,170,20); - else - blendpixel(vid,x+nx,y+ny,224,224,170,40); - } - } - - } - else if(t==PT_ACID) - { - if(parts[i].life>255) parts[i].life = 255; - if(parts[i].life<47) parts[i].life = 48; - s = (255/((parts[i].life-46)*28)); - if(s==0) s = 1; - cr = PIXR(ptypes[t].pcolors)/s; - cg = PIXG(ptypes[t].pcolors)/s; - cb = PIXB(ptypes[t].pcolors)/s; - if(cmode==6){ - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); - } - } - } else { - blendpixel(vid, nx, ny, cr, cg, cb, 255); - } - - if(cmode==4) - { - blendpixel(vid, nx+1, ny, cr, cg, cb, 223); - blendpixel(vid, nx-1, ny, cr, cg, cb, 223); - blendpixel(vid, nx, ny+1, cr, cg, cb, 223); - blendpixel(vid, nx, ny-1, cr, cg, cb, 223); - - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); - } - } - else if(t==PT_OILL&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,64,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,64,16,40); - } - } - } - else if(t==PT_NEUT) - { - if(cmode == 3||cmode==4 || cmode==6) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 8; - cb = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = 0x20; - cg = 0xE0; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_PLUT&&cmode == 6) - { - int tempx; - int tempy; - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(tempx = 2; tempx < 10; tempx++) { - for(tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_URAN&&cmode == 6) - { - int tempx; - int tempy; - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(tempx = 2; tempx < 10; tempx++) { - for(tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_SLTW&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,80,240,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,80,240,50); - } - } - } - else if(t==PT_PHOT) - { - if(cmode == 3||cmode==4 || cmode==6) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 12; - cb = 12; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_SWCH && parts[i].life == 10) - { - x = nx; - y = ny; - blendpixel(vid,x,y,17,217,24,255); - } - else if(t==PT_LNTG&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,128,160,223,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,128,160,223,50); - } - } - } - else if(t==PT_SMKE) - { - if(cmode == 3||cmode==4 || cmode==6) - { - x = nx/CELL; - y = ny/CELL; - cg = 10; - cb = 10; - cr = 10; - cg += fire_g[y][x]; - if(cg > 50) cg = 50; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 50) cb = 50; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 50) cr = 50; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny,100,100,100,30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,100,100,100,10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,100,100,100,20); - } - } - } - } - else if(t==PT_WATR&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - - } else if(t==PT_DSTW&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - } - else if(t==PT_NITR&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,224,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,224,16,50); - } - } - - } - else if(t==PT_LRBD&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,170,170,170,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,170,170,170,50); - } - } - - } - - else if(t==PT_NBLE&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,235,73,23,100); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,235,73,23,30); - else - blendpixel(vid,x+nx,y+ny,235,73,23,50); - } - } - - } - else if(t==PT_GASS&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,255,255,0,180); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,255,255,0,50); - else - blendpixel(vid,x+nx,y+ny,255,255,0,80); - } - } - - } - else if(t==PT_WTRV) - { - if(cmode == 3||cmode==4 || cmode==6) - { - x = nx/CELL; - y = ny/CELL; - cg = PIXG(ptypes[t].pcolors)/3; - cb = PIXB(ptypes[t].pcolors)/3; - cr = PIXR(ptypes[t].pcolors)/3; - cg += fire_g[y][x]; - if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); - } - } - } - } - else if(t==PT_THDR) - { - if(cmode == 3||cmode==4 || cmode==6) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 16; - cb = 20; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xA0; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LCRY) - { - if(cmode == 3||cmode==4 || cmode==6) - { - //cr = R/8; - //cg = G/8; - //cb = B/8; - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); - //x = nx/CELL; - //y = ny/CELL; - //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } - else - { - cr = 0x50+(parts[i].life*10); - cg = 0x50+(parts[i].life*10); - cb = 0x50+(parts[i].life*10); - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_PLSM) - { - float ttemp = parts[i].life; - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = plasma_data[caddress]; - uint8 G = plasma_data[caddress+1]; - uint8 B = plasma_data[caddress+2]; - if(cmode == 3||cmode==4 || cmode==6) - { - cr = R/8; - cg = G/8; - cb = B/8; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_FIRE && parts[i].life) - { - if(cmode == 3||cmode==4 || cmode==6) - { - cr = parts[i].life / 4; - cg = parts[i].life / 16; - cb = parts[i].life / 32; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = parts[i].life * 8; - cg = parts[i].life * 2; - cb = parts[i].life; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LAVA && parts[i].life) - { - cr = parts[i].life * 2 + 0xE0; - cg = parts[i].life * 1 + 0x50; - cb = parts[i].life/2 + 0x10; - if(cr>255) cr = 255; - if(cg>192) cg = 192; - if(cb>128) cb = 128; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 64); - blendpixel(vid, nx-1, ny, cr, cg, cb, 64); - blendpixel(vid, nx, ny+1, cr, cg, cb, 64); - blendpixel(vid, nx, ny-1, cr, cg, cb, 64); - if(cmode == 3||cmode==4 || cmode==6) - { - cr /= 32; - cg /= 32; - cb /= 32; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else if(t==PT_LAVA || t==PT_SPRK) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - if(cmode == 3 || cmode==4 || cmode==6) - { - if(t == PT_LAVA) - { - cr = 3; - cg = i%2; - cb = 0; - } - else - { - cr = 8; - cg = 12; - cb = 16; - } - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - } - else - { - float ttemp = parts[i].temp+(-MIN_TEMP); - int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); - uint8 R = color_data[caddress]; - uint8 G = color_data[caddress+1]; - uint8 B = color_data[caddress+2]; - if(t==PT_STKM) //Stick man should be visible in heat mode - { - char buff[10]; //Buffer for HP +#define MAXSIGNS 16 - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } +struct sign +{ + int x,y,ju; + char text[256]; +} signs[MAXSIGNS]; - for(r=-2; r<=1; r++) - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); - vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); - vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); - vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); - } - draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); - draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); - draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); - draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); - } - else - { - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); - //blendpixel(vid, nx+1, ny, R, G, B, 255); - } - } - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) - { - uint8 R = PIXR(ptypes[t].pcolors); - uint8 G = PIXG(ptypes[t].pcolors); - uint8 B = PIXB(ptypes[t].pcolors); - - //if(vid[(ny-1)*YRES+(nx-1)]!=0){ - // blendpixel(vid, nx, ny-1, R, G, B, 46); - //} - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); - } - } - if(framerender){ - framerender = 0; - sys_pause = 1; - } -} +/*********************************************************** + * AIR FLOW SIMULATOR * + ***********************************************************/ -void update_particles_i_th(void *arg) -{ - upstruc *newup = (upstruc*)arg; - update_particles_i(newup[0].vid, newup[0].start, newup[0].inc); - return; -} +int numCores = 4; -void update_particles(pixel *vid) +int core_count() { - int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; - float lx, ly; + int numCPU = 1; #ifdef MT - int pt = 0, pc = 0; - pthread_t *InterThreads; +#ifdef WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + numCPU = sysinfo.dwNumberOfProcessors; +#else +#ifdef MACOSX + numCPU = 4; +#else + numCPU = sysconf( _SC_NPROCESSORS_ONLN ); +#endif #endif - isplayer = 0; //Needed for player spawning - memset(pmap, 0, sizeof(pmap)); - r = rand()%2; - for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==13) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && (!sys_pause||framerender)) - emap[y][x] --; - } - } - } - else - { - for(y=0; y>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==9) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && (!sys_pause||framerender)) - emap[y][x] --; - } - } - } - -#ifdef MT - if(numCores > 1) - { - InterThreads = (pthread_t *)calloc(sizeof(pthread_t), numCores); - for(pc = 0; pc1) + printf("Multithreading enabled\n"); else - { - update_particles_i(vid, 0, 1); - } -#else - update_particles_i(vid, 0, 1); + printf("Multithreading disabled\n"); #endif - //update_particles_i(vid, 0); - //update_particles_i(vid, 1); + return numCPU; +} + +/*********************************************************** + * PARTICLE SIMULATOR * + ***********************************************************/ +int mousex, mousey = 0; //They contain mouse position - for(y=0; y=XRES || ny<0 || ny>=YRES) - break; - addpixel(vid, nx, ny, 255, 255, 255, 64); - i = nx/CELL; - j = ny/CELL; - lx += vx[j][i]*0.125f; - ly += vy[j][i]*0.125f; - if(bmap[j][i]==5 && i!=x && j!=y) - break; - } - drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); - } -} -void update_particles_th(void *arg) -{ - update_particles((pixel*)arg); - return; -} /*********************************************************** * SDL OUTPUT * @@ -8390,6 +5006,7 @@ int main(int argc, char *argv[]) memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); } update_particles(vid_buf); + draw_parts(vid_buf); if(cmode==2) { @@ -9307,3 +5924,4 @@ int main(int argc, char *argv[]) http_done(); return 0; } + diff --git a/powder.c b/powder.c index e69de29..d6b71d9 100644 --- a/powder.c +++ b/powder.c @@ -0,0 +1,2547 @@ +#include +#include "defines.h" +#include "powder.h" +#include "air.h" +#include "misc.h" + +int isplayer = 0; +float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index + +particle *parts; +particle *cb_parts; + +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; + +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; + +int pfree; + +unsigned pmap[YRES][XRES]; +unsigned cb_pmap[YRES][XRES]; + +int try_move(int i, int x, int y, int nx, int ny) +{ + unsigned r; + + + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) + return 0; + if(x==nx && y==ny) + return 1; + r = pmap[ny][nx]; + if(r && (r>>8)>8].type; + + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) + { + return 1; + } + + if((r&0xFF)==PT_VOID) + { + parts[i].type=PT_NONE; + return 0; + } + if((r&0xFF)==PT_BHOL) + { + parts[i].type=PT_NONE; + if(!legacy_enable) + { + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; + } + return 0; + } + + if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide + { + return 1; + } + + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) + { + return 1; + } + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) + { + return 0; + } + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) + { + return 0; + } + + if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; + if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + return 0; + if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) + return 0; + + if(parts[i].type==PT_CNCT && y>8)>= 8; + parts[r].x += x-nx; + parts[r].y += y-ny; + } + + return 1; +} + +void kill_part(int i) +{ + int x, y; + parts[i].type = PT_NONE; + + x = (int)(parts[i].x+0.5f); + y = (int)(parts[i].y+0.5f); + + if(x>=0 && y>=0 && x=XRES || y>=YRES) + return -1; + + if(t==SPC_HEAT||t==SPC_COOL) + { + if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + } + if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) + { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + } + return pmap[y][x]>>8; + } + else + { + return -1; + } + } + if(t==SPC_AIR) + { + pv[y/CELL][x/CELL] += 0.03f; + if(y+CELL>8].type = PT_SPRK; + parts[pmap[y][x]>>8].life = 4; + parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; + pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; + return pmap[y][x]>>8; + } + + if(p==-1) + { + if(pmap[y][x]) + return -1; + if(pfree == -1) + return -1; + i = pfree; + pfree = parts[i].life; + } + else + i = p; + + if(t==PT_GLAS) + { + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + } + if(t!=PT_STKM) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + } + if(t==PT_ACID) + { + parts[i].life = 75; + } + /*Testing + if(t==PT_WOOD){ + parts[i].life = 150; + } + End Testing*/ + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_PLSM) + parts[i].life = rand()%150+50; + if(t==PT_LAVA) + parts[i].life = rand()%120+240; + if(t==PT_NBLE) + parts[i].life = 0; + if(t==PT_NEUT) + { + float r = (rand()%128+128)/127.0f; + float a = (rand()%360)*3.14159f/180.0f; + parts[i].life = rand()%480+480; + parts[i].vx = r*cosf(a); + parts[i].vy = r*sinf(a); + } + if(t==PT_PHOT) + { + float r = (rand()%3-1)*3; + float a = (rand()%3-1)*3; + parts[i].life = 680; + if(a==0.0f&&r==0.0f) + { + parts[i].life = 0; + parts[i].type = PT_NONE; + return -1; + } + else + { + parts[i].vx = a; + parts[i].vy = r; + } + //} else { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + //}/ + } + + if(t!=PT_STKM) + pmap[y][x] = t|(i<<8); + else + { + if(isplayer==0) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + + + + player[3] = x-1; //Setting legs positions + player[4] = y+6; + player[5] = x-1; + player[6] = y+6; + + player[7] = x-3; + player[8] = y+12; + player[9] = x-3; + player[10] = y+12; + + player[11] = x+1; + player[12] = y+6; + player[13] = x+1; + player[14] = y+6; + + player[15] = x+3; + player[16] = y+12; + player[17] = x+3; + player[18] = y+12; + + isplayer = 1; + } + } + + return i; +} + +#ifdef WIN32 +_inline void delete_part(int x, int y) +#else +inline void delete_part(int x, int y) +#endif +{ + unsigned i; + + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + i = pmap[y][x]; + if(!i || (i>>8)>=NPART) + return; + + kill_part(i>>8); + pmap[y][x] = 0; // just in case +} + +#ifdef WIN32 +_inline int is_wire(int x, int y) +#else +inline int is_wire(int x, int y) +#endif +{ + return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; +} + +#ifdef WIN32 +_inline int is_wire_off(int x, int y) +#else +inline int is_wire_off(int x, int y) +#endif +{ + return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; +} + +void set_emap(int x, int y) +{ + int x1, x2; + + if(!is_wire_off(x, y)) + return; + + // go left as far as possible + x1 = x2 = x; + while(x1>0) + { + if(!is_wire_off(x1-1, y)) + break; + x1--; + } + while(x21 && x1==x2 && + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + set_emap(x1, y-2); + else if(y>0) + for(x=x1; x<=x2; x++) + if(is_wire_off(x, y-1)) + { + if(x==x1 || x==x2 || y>=YRES/CELL-1 || + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + set_emap(x, y-1); + } + + if(y>8) < NPART && (pmr>>8) >= 0) + { + return parts[pmr>>8].type; + } + else + { + return PT_NONE; + } +} + +int nearest_part(int ci, int t) +{ + int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); + int ndistance = 0; + int id = -1; + int i = 0; + int cx = (int)parts[ci].x; + int cy = (int)parts[ci].y; + for(i=0; i=XRES || y>=YRES || + ((bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) + { + kill_part(i); + continue; + } + + vx[y/CELL][x/CELL] *= ptypes[t].airloss; + vy[y/CELL][x/CELL] *= ptypes[t].airloss; + vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + if(t==PT_GASS||t==PT_NBLE) + { + if(pv[y/CELL][x/CELL]<3.5f) + pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); + if(y+CELL2.5f) + { + parts[i].life = rand()%80+180; + rt = parts[i].type = PT_FIRE; + parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + pv[y/CELL][x/CELL] += 0.25f * CFDS; + t = PT_FIRE; + } + + parts[i].vx *= ptypes[t].loss; + parts[i].vy *= ptypes[t].loss; + + if(t==PT_DFRM && !parts[i].life) + { + if(pv[y/CELL][x/CELL]>1.0f) + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].life = rand()%80+300; + } + } + else + { + if(t==PT_PLAS && pv[y/CELL][x/CELL]>25.0f) + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + } else { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + } + + if(ptypes[t].diffusion) + { + parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + } + + // interpolator +#ifdef WIN32 + mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#else + mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#endif + if(mv < ISTP) + { + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + } + else + { + dx = parts[i].vx*ISTP/mv; + dy = parts[i].vy*ISTP/mv; + ix = parts[i].x; + iy = parts[i].y; + while(1) + { + mv -= ISTP; + if(mv <= 0.0f) + { + // nothing found + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + break; + } + ix += dx; + iy += dy; + nx = (int)(ix+0.5f); + ny = (int)(iy+0.5f); + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) + { + parts[i].x = ix; + parts[i].y = iy; + break; + } + } + } + + a = nt = 0; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx4.0f) + t = parts[i].type = PT_DSTW; + if(t==PT_DESL && pv[y/CELL][x/CELL]<-6.0f) + t = parts[i].type = PT_GASS; + if(t==PT_GASS && pv[y/CELL][x/CELL]>6.0f) + t = parts[i].type = PT_DESL; + if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) + t = parts[i].type = PT_FIRE; + } + if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f) + t = parts[i].type = PT_GASS; + if(t==PT_DESL && pv[y/CELL][x/CELL]>50.0f) // Only way I know to make it + t = parts[i].type = PT_FIRE; // combust under pressure. + if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f) + t = parts[i].type = PT_DESL; + if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) + t = parts[i].type = PT_BRMT; + //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) + // t = parts[i].type = PT_BGLA; + if(t==PT_GLAS) + { + parts[i].pavg[0] = parts[i].pavg[1]; + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) + { + parts[i].type = PT_BGLA; + } + } + if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) + t = parts[i].type = PT_SNOW; + if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) + { + t = PT_NEUT; + create_part(i, x, y, t); + } + + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) + { + nearp = nearest_part(i, PT_ETRD); + if(nearp!=-1) + { + create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[nearp].type = PT_SPRK; + parts[nearp].life = 9; + parts[nearp].ctype = PT_ETRD; + } + } + + if(!legacy_enable) + { + int ctemp = pv[y/CELL][x/CELL]*2; + c_heat = 0.0f; + h_count = 0; + if(ptypes[t].hconduct>(rand()%250)) + { + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + h_count++; + c_heat += parts[r>>8].temp; + } + } + } + } + pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + { + parts[r>>8].temp = parts[i].temp; + } + } + } + } + if(pt>=pstates[t].btemp&&pstates[t].burn) + { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE||t==PT_PLSM) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) + { + if(t==PT_LAVA&&parts[i].ctype) + { + parts[i].life = 0; + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) + { + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } + else + { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } + else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) + { + if(pstates[t].liquid==PT_LAVA) + { + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } + else if(t==PT_ICEI&&parts[i].ctype) + { + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else + { + t = parts[i].type = pstates[t].liquid; + } + } + else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) + { + t = parts[i].type = pstates[t].liquid; + } + else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) + { + if(t==PT_SLTW&&1>rand()%6) + { + t = parts[i].type = PT_SALT; + } + else + { + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) + { + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA) + { + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } + } + if(t==PT_PTCT&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + if(t==PT_NTCT&&parts[i].temp>24.0f) + { + pt = parts[i].temp -= 2.5f; + } + + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_NTCT || t==PT_PTCT || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) + { + nx = x % CELL; + if(nx == 0) + nx = x/CELL - 1; + else if(nx == CELL-1) + nx = x/CELL + 1; + else + nx = x/CELL; + ny = y % CELL; + if(ny == 0) + ny = y/CELL - 1; + else if(ny == CELL-1) + ny = y/CELL + 1; + else + ny = y/CELL; + if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) + { + t = parts[i].type = PT_NONE; + parts[r>>8].ctype = parts[r>>8].type; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + } + else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) + { + pv[y/CELL][x/CELL] += 100.0f; + if(legacy_enable&&1>(rand()%200)) + { + parts[i].life = rand()%50+120; + t = parts[i].type = PT_FIRE; + } + else + { + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_ICEI || t==PT_SNOW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if(legacy_enable) + { + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; + } + } + } + else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL) + { + parts[i].temp = 200.0f; + } + } + } + //PLANT + else if(t==PT_PLNT) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR && 1>(rand()%250)) + { + t = parts[i].type = PT_PLNT; + parts[r>>8].type = PT_PLNT; + } + else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WATR||t==PT_DSTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%250)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_WATR; + } + if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_SLTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) + { + parts[r>>8].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_WTRV) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + parts[r>>8].type = PT_WATR; + } + + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; + } + } + } + else if(t==PT_YEST) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_DYST && 1>(rand()%30) && !legacy_enable) + { + t = parts[i].type = PT_DYST; + } + } + } + else if(t==PT_ACID) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)!=PT_ACID) + { + if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) + { + t = parts[i].type = PT_FIRE; + parts[i].life = 4; + parts[r>>8].type = PT_FIRE; + parts[r>>8].life = 4; + } + else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) + { + parts[i].life--; + parts[r>>8].type = PT_NONE; + } + else if (parts[i].life==50) + { + parts[i].life = 0; + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_NEUT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) + { + if(33>rand()%100) + { + create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); + } + else + { + create_part(r>>8, x+nx, y+ny, PT_NEUT); + parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; + parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; + } + pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + fe ++; + } + if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + parts[r>>8].type = PT_DUST; + if((r&0xFF)==PT_DYST && 15>(rand()%1000)) + parts[r>>8].type = PT_YEST; + if((r&0xFF)==PT_YEST){ + if(15>(rand()%100000)&&isplayer==0) + parts[r>>8].type = PT_STKM; + else + parts[r>>8].type = PT_DYST; + } + + if((r&0xFF)==PT_WATR && 15>(rand()%100)) + parts[r>>8].type = PT_DSTW; + if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) + parts[r>>8].type = PT_DFRM; + if((r&0xFF)==PT_NITR && 15>(rand()%1000)) + parts[r>>8].type = PT_DESL; + if((r&0xFF)==PT_OILL && 5>(rand()%1000)) + parts[r>>8].type = PT_PLAS; + if((r&0xFF)==PT_PLNT && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + if((r&0xFF)==PT_PLAS && 5>(rand()%1000)) + parts[r>>8].type = PT_OILL; + if((r&0xFF)==PT_DESL && 15>(rand()%1000)) + parts[r>>8].type = PT_GASS; + if((r&0xFF)==PT_COAL && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + } + } + else if(t==PT_PHOT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=0; nx<1; nx++) + for(ny=0; ny<1; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + } + } + else if(t==PT_LCRY) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_LCRY) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_BTRY) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts_avg(i,r>>8) != PT_INSL) + { + if((rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) + { + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + parts[r>>8].type = PT_SPRK; + } + } + } + }else if(t==PT_SWCH) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8)!=PT_INSL) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + if(t==PT_SWCH) + if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) + { + parts[i].life--; + } + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) + continue; + rt = parts[r>>8].type; + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) + { + parts[r>>8].type = PT_FIRE; + parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + parts[r>>8].life = rand()%80+180; + if(ptypes[rt].explosive) + pv[y/CELL][x/CELL] += 0.25f * CFDS; + continue; + } + lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; + if(lpv < 1) lpv = 1; + if(legacy_enable) + { + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && + ptypes[rt].meltable*lpv>(rand()%1000)) + { + if(t!=PT_LAVA || parts[i].life>0) + { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } + else + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) + { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = PT_STNE; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) + { + kill_part(r>>8); + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; + parts[i].ctype = PT_NONE; + goto killed; + } + } + } + pavg = parts_avg(i, r>>8); + if(rt==PT_SWCH && t==PT_SPRK) + { + pavg = parts_avg(r>>8, i); + if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) + parts[r>>8].life = 10; + if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) + parts[r>>8].life = 9; + if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].ctype = PT_SWCH; + parts[r>>8].life = 4; + } + } + pavg = parts_avg(i, r>>8); + if(pavg != PT_INSL) + { + if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) + parts[r>>8].temp = parts[r>>8].temp+10.0f; + } + } + if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 6; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 5; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) + { + if(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) + { + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) + { + parts[i].life = rand()%150+50; + parts[i].type = PT_PLSM; + parts[i].ctype = PT_NBLE; + parts[i].temp = 3500; + pv[y/CELL][x/CELL] += 1; + } + if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) + { + parts[i].type = PT_SWCH; + parts[i].life = 11; + } + } + } +killed: + if(parts[i].type == PT_NONE) + continue; + } + if(t==PT_STKM) + { + //Tempirature handling + if(parts[i].temp<-30) + parts[i].life -= 0.2; + if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + parts[i].temp += 1; + + //Death + if(parts[i].life<0 && (death == 1)) //If his HP is less that 0 or there is very big wind... + { + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + //Verlet integration + pp = 2*player[3]-player[5]; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+1; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+1; + player[18] = player[16]; + player[16] = pp; + + //Go left + if (((int)(player[0])&0x01) == 0x01) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] += 3; + player[10] += 2; + player[5] += 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 3; + player[18] += 2; + player[13] +=2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[9] += 1; + player[10] += 1; + player[5] += 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] += 1; + player[18] += 1; + player[13] +=1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 3; + player[10] += 2; + player[5] -= 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 3; + player[18] += 2; + player[13] -= 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[9] -= 1; + player[10] += 1; + player[5] -= 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[17] -= 1; + player[18] += 1; + player[13] -= 1; + } + + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM + && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) + || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) + { + int random = abs(rand()%3-1)*3; + if (random==0) + { + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + } + else + { + parts[r>>8].vy = 0; + parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; + } + } + + } + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[10] += 1; + player[18] += 1; + } + + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + player[15] -= nx; + + if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[9] = player[7]; + } + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5; + } + else + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy; + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= 10+ny; + parts[i].vy = -10; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[7] += 0.2; + player[15] -= 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[3] += 0.2; + player[11] -= 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[16] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + { + parts[i].life -= 2; + player[8] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } + if(t==PT_CLNE) + { + if(!parts[i].ctype) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx30&&parts[i].temp<44){ + create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST); + } + } + if(t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1) + { + parts[i].type = PT_NBLE; + parts[i].life = 0; + } + if (t==PT_FIRE && parts[i].life <=1) + { + t = parts[i].type = PT_SMKE; + parts[i].life = rand()%20+250; + } + + nx = (int)(parts[i].x+0.5f); + ny = (int)(parts[i].y+0.5f); + + if(nx=XRES-CELL || + ny=YRES-CELL) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + continue; + } + + rt = parts[i].flags & FLAG_STAGNANT; + parts[i].flags &= ~FLAG_STAGNANT; + if(!try_move(i, x, y, nx, ny)) + { + parts[i].x = lx; + parts[i].y = ly; + if(ptypes[t].falldown) + { + if(nx!=x && try_move(i, x, y, nx, y)) + { + parts[i].x = ix; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x, ny)) + { + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else + { + r = (rand()%2)*2-1; + if(ny!=y && try_move(i, x, y, x+r, ny)) + { + parts[i].x += r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x-r, ny)) + { + parts[i].x -= r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y+r)) + { + parts[i].x = ix; + parts[i].y += r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y-r)) + { + parts[i].x = ix; + parts[i].y -= r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) + { + s = 0; + if(!rt || nt) + rt = 50; + else + rt = 10; + for(j=x+r; j>=0 && j>=x-rt && j0) + r = 1; + else + r = -1; + if(s) + for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny(rand()%1000)) + { + kill_part(i); + continue; + } + else if(try_move(i, x, y, 2*x-nx, ny)) + { + parts[i].x = (float)(2*x-nx); + parts[i].y = (float)iy; + parts[i].vx *= ptypes[t].collision; + } + else if(try_move(i, x, y, nx, 2*y-ny)) + { + parts[i].x = (float)ix; + parts[i].y = (float)(2*y-ny); + parts[i].vy *= ptypes[t].collision; + } + else + { + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + } + } + if(nx=XRES-CELL || ny=YRES-CELL) + { + kill_part(i); + continue; + } + } + if(framerender){ + framerender = 0; + sys_pause = 1; + } +} + +void update_particles(pixel *vid) +{ + int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; + float lx, ly; +#ifdef MT + int pt = 0, pc = 0; + pthread_t *InterThreads; +#endif + + isplayer = 0; //Needed for player spawning + memset(pmap, 0, sizeof(pmap)); + r = rand()%2; + for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==13) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && (!sys_pause||framerender)) + emap[y][x] --; + } + } + } + else + { + for(y=0; y>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==9) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && (!sys_pause||framerender)) + emap[y][x] --; + } + } + } + + update_particles_i(vid, 0, 1); + + for(y=0; y=XRES || ny<0 || ny>=YRES) + break; + addpixel(vid, nx, ny, 255, 255, 255, 64); + i = nx/CELL; + j = ny/CELL; + lx += vx[j][i]*0.125f; + ly += vy[j][i]*0.125f; + if(bmap[j][i]==5 && i!=x && j!=y) + break; + } + drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); + } + +} \ No newline at end of file diff --git a/powder.h b/powder.h index 5f0ca71..9757d5a 100644 --- a/powder.h +++ b/powder.h @@ -397,4 +397,63 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l R T*/ }; +extern int isplayer; +extern float player[20]; + +extern particle *parts; +extern particle *cb_parts; + +extern unsigned char bmap[YRES/CELL][XRES/CELL]; +extern unsigned char emap[YRES/CELL][XRES/CELL]; + +extern unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +extern unsigned char cb_emap[YRES/CELL][XRES/CELL]; + +extern int pfree; + +extern unsigned pmap[YRES][XRES]; +unsigned cb_pmap[YRES][XRES]; + +int try_move(int i, int x, int y, int nx, int ny); + +void kill_part(int i); + +#ifdef WIN32 +extern _inline int create_part(int p, int x, int y, int t); +#else +extern inline int create_part(int p, int x, int y, int t); +#endif + +#ifdef WIN32 +extern _inline void delete_part(int x, int y); +#else +extern inline void delete_part(int x, int y); +#endif + +#ifdef WIN32 +extern _inline int is_wire(int x, int y); +#else +extern inline int is_wire(int x, int y); +#endif + +#ifdef WIN32 +extern _inline int is_wire_off(int x, int y); +#else +extern inline int is_wire_off(int x, int y); +#endif + +void set_emap(int x, int y); + +#ifdef WIN32 +_inline int parts_avg(int ci, int ni); +#else +inline int parts_avg(int ci, int ni); +#endif + +int nearest_part(int ci, int t); + +void update_particles_i(pixel *vid, int start, int inc); + +void update_particles(pixel *vid); + #endif \ No newline at end of file -- cgit v0.9.2-21-gd62e From 0d25cae647b2d0827c366165257c5e812a8d8ddb Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 26 Aug 2010 14:09:38 -0400 Subject: changed some defines to make more sense diff --git a/graphics.c b/graphics.c index 0f6c040..2112183 100644 --- a/graphics.c +++ b/graphics.c @@ -1192,7 +1192,7 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); } } - else if(t==PT_OILL&&cmode == 6) + else if(t==PT_OIL&&cmode == 6) { for(x=-1; x<=1; x++) { @@ -1450,7 +1450,7 @@ void draw_parts(pixel *vid) } } - else if(t==PT_GASS&&cmode == 6) + else if(t==PT_GAS&&cmode == 6) { for(x=-1; x<=1; x++) { diff --git a/powder.c b/powder.c index d6b71d9..ea07e06 100644 --- a/powder.c +++ b/powder.c @@ -524,7 +524,7 @@ void update_particles_i(pixel *vid, int start, int inc) vy[y/CELL][x/CELL] *= ptypes[t].airloss; vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - if(t==PT_GASS||t==PT_NBLE) + if(t==PT_GAS||t==PT_NBLE) { if(pv[y/CELL][x/CELL]<3.5f) pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); @@ -562,7 +562,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].vx *= ptypes[t].loss; parts[i].vy *= ptypes[t].loss; - if(t==PT_DFRM && !parts[i].life) + if(t==PT_GOO && !parts[i].life) { if(pv[y/CELL][x/CELL]>1.0f) { @@ -650,17 +650,17 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_WTRV && pv[y/CELL][x/CELL]>4.0f) t = parts[i].type = PT_DSTW; if(t==PT_DESL && pv[y/CELL][x/CELL]<-6.0f) - t = parts[i].type = PT_GASS; - if(t==PT_GASS && pv[y/CELL][x/CELL]>6.0f) + t = parts[i].type = PT_GAS; + if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) t = parts[i].type = PT_DESL; if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) t = parts[i].type = PT_FIRE; } if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f) - t = parts[i].type = PT_GASS; + t = parts[i].type = PT_GAS; if(t==PT_DESL && pv[y/CELL][x/CELL]>50.0f) // Only way I know to make it t = parts[i].type = PT_FIRE; // combust under pressure. - if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f) + if(t==PT_GAS && pv[y/CELL][x/CELL]>20.0f) t = parts[i].type = PT_DESL; if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; @@ -1146,17 +1146,17 @@ void update_particles_i(pixel *vid, int start, int inc) if((r&0xFF)==PT_WATR && 15>(rand()%100)) parts[r>>8].type = PT_DSTW; if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) - parts[r>>8].type = PT_DFRM; + parts[r>>8].type = PT_GOO; if((r&0xFF)==PT_NITR && 15>(rand()%1000)) parts[r>>8].type = PT_DESL; - if((r&0xFF)==PT_OILL && 5>(rand()%1000)) + if((r&0xFF)==PT_OIL && 5>(rand()%1000)) parts[r>>8].type = PT_PLAS; if((r&0xFF)==PT_PLNT && 5>(rand()%100)) parts[r>>8].type = PT_WOOD; if((r&0xFF)==PT_PLAS && 5>(rand()%1000)) - parts[r>>8].type = PT_OILL; + parts[r>>8].type = PT_OIL; if((r&0xFF)==PT_DESL && 15>(rand()%1000)) - parts[r>>8].type = PT_GASS; + parts[r>>8].type = PT_GAS; if((r&0xFF)==PT_COAL && 5>(rand()%100)) parts[r>>8].type = PT_WOOD; } diff --git a/powder.h b/powder.h index 9757d5a..fa75435 100644 --- a/powder.h +++ b/powder.h @@ -41,16 +41,16 @@ #define PT_NONE 0 #define PT_DUST 1 #define PT_WATR 2 -#define PT_OILL 3 +#define PT_OIL 3 #define PT_FIRE 4 #define PT_STNE 5 #define PT_LAVA 6 #define PT_GUNP 7 #define PT_NITR 8 #define PT_CLNE 9 -#define PT_GASS 10 +#define PT_GAS 10 #define PT_PLEX 11 -#define PT_DFRM 12 +#define PT_GOO 12 #define PT_ICEI 13 #define PT_METL 14 #define PT_SPRK 15 @@ -306,7 +306,7 @@ static part_state pstates[PT_NUM] = /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OILL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OIL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 62.0f}, /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, -180.0f, PT_NONE, 0.0f}, -- cgit v0.9.2-21-gd62e From 07ade7ed72face5ece3408e953198b5ebcf1170c Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 27 Aug 2010 13:01:20 +0100 Subject: More work diff --git a/defines.h b/defines.h index aa27b90..6f0dab3 100644 --- a/defines.h +++ b/defines.h @@ -11,6 +11,8 @@ #define YRES 384 #define NPART XRES*YRES +#define MAXSIGNS 16 + #define ZSIZE_D 16 #define ZFACTOR_D 8 static unsigned char ZFACTOR = 256/ZSIZE_D; @@ -36,4 +38,13 @@ extern int framerender; extern int mousex, mousey; extern int death; +struct sign +{ + int x,y,ju; + char text[256]; +}; +typedef struct sign sign; + +extern sign signs[MAXSIGNS]; + #endif \ No newline at end of file diff --git a/graphics.c b/graphics.c index 2112183..226a984 100644 --- a/graphics.c +++ b/graphics.c @@ -976,8 +976,8 @@ void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, dx = abs(x1-x2); dy = abs(y1-y2); - sx = sign(x2-x1); - sy = sign(y2-y1); + sx = isign(x2-x1); + sy = isign(y2-y1); x = x1; y = y1; check = 0; diff --git a/graphics.h b/graphics.h index 3932a2f..e7f120d 100644 --- a/graphics.h +++ b/graphics.h @@ -112,4 +112,6 @@ void xor_line(int x1, int y1, int x2, int y2, pixel *vid); void xor_rect(pixel *vid, int x, int y, int w, int h); +void draw_parts(pixel *vid); + #endif \ No newline at end of file diff --git a/interface.c b/interface.c index bb8f7cd..cb61054 100644 --- a/interface.c +++ b/interface.c @@ -1,6 +1,33 @@ +#include +#include +#include +#include "defines.h" #include "powder.h" #include "interface.h" +SDLMod sdl_mod; +int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; + +char *shift_0="`1234567890-=[]\\;',./"; +char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; + +int svf_login = 0; +int svf_admin = 0; +int svf_mod = 0; +char svf_user[64] = ""; +char svf_pass[64] = ""; + +int svf_open = 0; +int svf_own = 0; +int svf_myvote = 0; +int svf_publish = 0; +char svf_id[16] = ""; +char svf_name[64] = ""; +char svf_tags[256] = ""; +void *svf_last = NULL; +int svf_lsize; + +int Z_keysym = 'z'; void menu_count(void) { @@ -12,4 +39,809 @@ void menu_count(void) msections[ptypes[i].menusection].itemcount+=ptypes[i].menu; } +} + +void add_sign_ui(pixel *vid_buf, int mx, int my) +{ + int i, w, h, x, y, nm=0, ju; + int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; + ui_edit ed; + + // check if it is an existing sign + for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) + break; + } + // else look for empty spot + if(i >= MAXSIGNS) + { + nm = 1; + for(i=0; i= MAXSIGNS) + return; + + if(nm) + { + signs[i].x = mx; + signs[i].y = my; + signs[i].ju = 1; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = x0+25; + ed.y = y0+25; + ed.w = 158; + ed.nx = 1; + ed.def = "[message]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(signs[i].text); + strcpy(ed.str, signs[i].text); + ju = signs[i].ju; + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed); + drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); + draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); + draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); + draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); + + if(!nm) + { + drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); + drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); + drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); + } + + drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) + ju = 0; + if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) + ju = 1; + if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) + ju = 2; + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) + { + signs[i].text[0] = 0; + return; + } + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + { + if(!ed.focus) + return; + ed.focus = 0; + } + } + + strcpy(signs[i].text, ed.str); + signs[i].ju = ju; +} + +void ui_edit_draw(pixel *vid_buf, ui_edit *ed) +{ + int cx, i; + char echo[256], *str; + + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(ed->str[0]) + { + drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } + else if(!ed->focus) + drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); + if(ed->focus) + { + cx = textnwidth(str, ed->cursor); + for(i=-3; i<9; i++) + drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); + } +} + +void ui_edit_process(int mx, int my, int mb, ui_edit *ed) +{ + char ch, ts[2], echo[256], *str; + int l, i; +#ifdef RAWINPUT + char *p; +#endif + + if(mb) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } + else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } + else + ed->focus = 0; + } + if(ed->focus && sdl_key) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + l = strlen(ed->str); + switch(sdl_key) + { + case SDLK_HOME: + ed->cursor = 0; + break; + case SDLK_END: + ed->cursor = l; + break; + case SDLK_LEFT: + if(ed->cursor > 0) + ed->cursor --; + break; + case SDLK_RIGHT: + if(ed->cursor < l) + ed->cursor ++; + break; + case SDLK_DELETE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + ed->str[ed->cursor] = 0; + else if(ed->cursor < l) + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + break; + case SDLK_BACKSPACE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + { + if(ed->cursor > 0) + memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); + ed->cursor = 0; + } + else if(ed->cursor > 0) + { + ed->cursor--; + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + } + break; + default: +#ifdef RAWINPUT + if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) + { + ch = sdl_key; + if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) + { + if(ch>='a' && ch<='z') + ch &= ~0x20; + p = strchr(shift_0, ch); + if(p) + ch = shift_1[p-shift_0]; + } + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#else + if(sdl_ascii>=' ' && sdl_ascii<127) + { + ch = sdl_ascii; + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#endif + break; + } + } +} + +void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) +{ + int w = 12; + if(ed->checked) + { + drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); + } + if(ed->focus) + { + drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); + } + else + { + drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); + } +} + +void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) +{ + int w = 12; + + if(mb && !mbq) + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->checked = (ed->checked)?0:1; + } + } + else + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->focus = 1; + } + else + { + ed->focus = 0; + } + } +} + +void draw_svf_ui(pixel *vid_buf) +{ + int c; + + drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); + drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + c = svf_open ? 255 : 128; + drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); + drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); + + c = svf_login ? 255 : 128; + drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); + if(svf_open) + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); + else + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); + drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); + if(svf_open && svf_own) + drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); + + c = (svf_login && svf_open) ? 255 : 128; + + drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + + if(svf_myvote==1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); + } + else if(svf_myvote==-1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); + } + + drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); + drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); + + drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); + if(svf_tags[0]) + drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); + else + drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); + + drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); + + drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); + drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); + if(svf_login) + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); + else + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); + drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); + + if(sys_pause) + { + fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); + drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + if(!legacy_enable) + { + fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + switch(cmode) + { + case 0: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); + break; + case 1: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); + break; + case 2: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); + break; + case 3: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); + break; + case 4: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); + break; + case 5: + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + break; + case 6: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255); + break; + } + drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + + if(svf_admin) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); + } + else if(svf_mod) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + }//else if(amd) + // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? +} + +void error_ui(pixel *vid_buf, int err, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + char *msg; + + msg = malloc(strlen(txt)+16); + if(err) + sprintf(msg, "%03d %s", err, txt); + else + sprintf(msg, "%s", txt); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + if(err) + drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); + else + drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + free(msg); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_ui(pixel *vid_buf, char *top, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); + drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_box(pixel *vid_buf, char *msg) +{ + int w = textwidth(msg)+16; + int x0=(XRES-w)/2,y0=(YRES-24)/2; + + clearrect(vid_buf, x0-2, y0-2, w+4, 28); + drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); +} + +int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + int ret = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); + drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); + drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); + drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) + { + ret = 1; + break; + } + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + { + ret = 1; + break; + } + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + return ret; +} + +void login_ui(pixel *vid_buf) +{ + int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq,mx,my,err; + ui_edit ed1,ed2; + char *res; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed1.x = x0+25; + ed1.y = y0+25; + ed1.w = 158; + ed1.nx = 1; + ed1.def = "[user name]"; + ed1.focus = 1; + ed1.hide = 0; + ed1.cursor = strlen(svf_user); + strcpy(ed1.str, svf_user); + ed2.x = x0+25; + ed2.y = y0+45; + ed2.w = 158; + ed2.nx = 1; + ed2.def = "[password]"; + ed2.focus = 0; + ed2.hide = 1; + ed2.cursor = 0; + strcpy(ed2.str, ""); + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, "Server login:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\x8B", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\x8A", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + drawtext(vid_buf, x0+11, y0+44, "\x8C", 160, 144, 32, 255); + drawtext(vid_buf, x0+11, y0+44, "\x84", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+40, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed1); + ui_edit_draw(vid_buf, &ed2); + drawtext(vid_buf, x0+5, y0+69, "Sign in", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed1); + ui_edit_process(mx, my, b, &ed2); + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) + { + if(!ed1.focus) + break; + ed1.focus = 0; + ed2.focus = 1; + } + if(sdl_key==SDLK_ESCAPE) + { + if(!ed1.focus && !ed2.focus) + return; + ed1.focus = 0; + ed2.focus = 0; + } + } + + strcpy(svf_user, ed1.str); + md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); + + res = http_multipart_post( + "http://" SERVER "/Login.api", + NULL, NULL, NULL, + svf_user, svf_pass, + &err, NULL); + if(err != 200) + { + error_ui(vid_buf, err, http_ret_text(err)); + if(res) + free(res); + goto fail; + } + if(res && !strncmp(res, "OK", 2)) + { + if(!strcmp(res, "OK ADMIN")) + { + svf_admin = 1; + svf_mod = 0; + } + else if(!strcmp(res, "OK MOD")) + { + svf_admin = 0; + svf_mod = 1; + } + else + { + svf_admin = 0; + svf_mod = 0; + } + free(res); + svf_login = 1; + return; + } + if(!res) + res = mystrdup("Unspecified Error"); + error_ui(vid_buf, 0, res); + free(res); + +fail: + strcpy(svf_user, ""); + strcpy(svf_pass, ""); + svf_login = 0; + svf_own = 0; + svf_admin = 0; + svf_mod = 0; +} + +int sdl_poll(void) +{ + SDL_Event event; + sdl_key=sdl_wheel=sdl_ascii=0; + while(SDL_PollEvent(&event)) + { + switch (event.type) + { + case SDL_KEYDOWN: + sdl_key=event.key.keysym.sym; + sdl_ascii=event.key.keysym.unicode; + if(event.key.keysym.sym == SDLK_CAPSLOCK) + sdl_caps = 1; + if(event.key.keysym.unicode=='z' || event.key.keysym.unicode=='Z') + { + sdl_zoom_trig = 1; + Z_keysym = event.key.keysym.sym; + } + if( event.key.keysym.sym == SDLK_PLUS || event.key.keysym.sym == SDLK_RIGHTBRACKET) + { + sdl_wheel++; + } + if( event.key.keysym.sym == SDLK_MINUS || event.key.keysym.sym == SDLK_LEFTBRACKET) + { + sdl_wheel--; + } + // 4 + //1 8 2 + if(event.key.keysym.sym == SDLK_RIGHT) + { + player[0] = (int)(player[0])|0x02; //Go right command + } + if(event.key.keysym.sym == SDLK_LEFT) + { + player[0] = (int)(player[0])|0x01; //Go left command + } + if(event.key.keysym.sym == SDLK_DOWN && ((int)(player[0])&0x08)!=0x08) + { + player[0] = (int)(player[0])|0x08; //Go left command + } + if(event.key.keysym.sym == SDLK_UP && ((int)(player[0])&0x04)!=0x04) + { + player[0] = (int)(player[0])|0x04; //Jump command + } + break; + + case SDL_KEYUP: + if(event.key.keysym.sym == SDLK_CAPSLOCK) + sdl_caps = 0; + if(event.key.keysym.sym == Z_keysym) + sdl_zoom_trig = 0; + if(event.key.keysym.sym == SDLK_RIGHT || event.key.keysym.sym == SDLK_LEFT) + { + player[1] = player[0]; //Saving last movement + player[0] = (int)(player[0])&12; //Stop command + } + if(event.key.keysym.sym == SDLK_UP) + { + player[0] = (int)(player[0])&11; + } + if(event.key.keysym.sym == SDLK_DOWN) + { + player[0] = (int)(player[0])&7; + } + break; + case SDL_MOUSEBUTTONDOWN: + if(event.button.button == SDL_BUTTON_WHEELUP) + sdl_wheel++; + if(event.button.button == SDL_BUTTON_WHEELDOWN) + sdl_wheel--; + break; + case SDL_QUIT: + return 1; + } + } + sdl_mod = SDL_GetModState(); + return 0; } \ No newline at end of file diff --git a/interface.h b/interface.h index e37fa0c..4d97f6b 100644 --- a/interface.h +++ b/interface.h @@ -63,5 +63,66 @@ static menu_section msections[] = {"\xCC", "Special", 0}, }; +struct ui_edit +{ + int x, y, w, nx; + char str[256],*def; + int focus, cursor, hide; +}; +typedef struct ui_edit ui_edit; + +struct ui_checkbox +{ + int x, y; + int focus, checked; +}; +typedef struct ui_checkbox ui_checkbox; + +extern SDLMod sdl_mod; +extern int sdl_key, sdl_wheel, sdl_caps, sdl_ascii, sdl_zoom_trig; +extern char *shift_0; +extern char *shift_1; +extern int svf_login; +extern int svf_admin; +extern int svf_mod; +extern char svf_user[64]; +extern char svf_pass[64]; + +extern int svf_open; +extern int svf_own; +extern int svf_myvote; +extern int svf_publish; +extern char svf_id[16]; +extern char svf_name[64]; +extern char svf_tags[256]; +extern void *svf_last; +extern int svf_lsize; + +extern int Z_keysym; + void menu_count(void); + +void add_sign_ui(pixel *vid_buf, int mx, int my); + +void ui_edit_draw(pixel *vid_buf, ui_edit *ed); + +void ui_edit_process(int mx, int my, int mb, ui_edit *ed); + +void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed); + +void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed); + +void draw_svf_ui(pixel *vid_buf); + +void error_ui(pixel *vid_buf, int err, char *txt); + +void info_ui(pixel *vid_buf, char *top, char *txt); + +void info_box(pixel *vid_buf, char *msg); + +int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn); + +void login_ui(pixel *vid_buf); + +int sdl_poll(void); #endif \ No newline at end of file diff --git a/main.c b/main.c index 8252279..ce1d634 100644 --- a/main.c +++ b/main.c @@ -100,15 +100,7 @@ int legacy_enable = 0; //Used to disable new features such as heat, will be set int death = 1, framerender = 0; int amd = 1; - - -#define MAXSIGNS 16 - -struct sign -{ - int x,y,ju; - char text[256]; -} signs[MAXSIGNS]; +sign signs[MAXSIGNS]; /*********************************************************** * AIR FLOW SIMULATOR * @@ -153,9 +145,6 @@ int mousex, mousey = 0; //They contain mouse position * SDL OUTPUT * ***********************************************************/ -SDLMod sdl_mod; -int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; - #include "icon.h" void sdl_seticon(void) { @@ -222,106 +211,10 @@ void dump_frame(pixel *src, int w, int h, int pitch) frame_idx++; } -int Z_keysym = 'z'; -int sdl_poll(void) -{ - SDL_Event event; - sdl_key=sdl_wheel=sdl_ascii=0; - while(SDL_PollEvent(&event)) - { - switch (event.type) - { - case SDL_KEYDOWN: - sdl_key=event.key.keysym.sym; - sdl_ascii=event.key.keysym.unicode; - if(event.key.keysym.sym == SDLK_CAPSLOCK) - sdl_caps = 1; - if(event.key.keysym.unicode=='z' || event.key.keysym.unicode=='Z') - { - sdl_zoom_trig = 1; - Z_keysym = event.key.keysym.sym; - } - if( event.key.keysym.sym == SDLK_PLUS || event.key.keysym.sym == SDLK_RIGHTBRACKET) - { - sdl_wheel++; - } - if( event.key.keysym.sym == SDLK_MINUS || event.key.keysym.sym == SDLK_LEFTBRACKET) - { - sdl_wheel--; - } - // 4 - //1 8 2 - if(event.key.keysym.sym == SDLK_RIGHT) - { - player[0] = (int)(player[0])|0x02; //Go right command - } - if(event.key.keysym.sym == SDLK_LEFT) - { - player[0] = (int)(player[0])|0x01; //Go left command - } - if(event.key.keysym.sym == SDLK_DOWN && ((int)(player[0])&0x08)!=0x08) - { - player[0] = (int)(player[0])|0x08; //Go left command - } - if(event.key.keysym.sym == SDLK_UP && ((int)(player[0])&0x04)!=0x04) - { - player[0] = (int)(player[0])|0x04; //Jump command - } - break; - - case SDL_KEYUP: - if(event.key.keysym.sym == SDLK_CAPSLOCK) - sdl_caps = 0; - if(event.key.keysym.sym == Z_keysym) - sdl_zoom_trig = 0; - if(event.key.keysym.sym == SDLK_RIGHT || event.key.keysym.sym == SDLK_LEFT) - { - player[1] = player[0]; //Saving last movement - player[0] = (int)(player[0])&12; //Stop command - } - if(event.key.keysym.sym == SDLK_UP) - { - player[0] = (int)(player[0])&11; - } - if(event.key.keysym.sym == SDLK_DOWN) - { - player[0] = (int)(player[0])&7; - } - break; - case SDL_MOUSEBUTTONDOWN: - if(event.button.button == SDL_BUTTON_WHEELUP) - sdl_wheel++; - if(event.button.button == SDL_BUTTON_WHEELDOWN) - sdl_wheel--; - break; - case SDL_QUIT: - return 1; - } - } - sdl_mod = SDL_GetModState(); - return 0; -} - /*********************************************************** * STATE MANAGEMENT * ***********************************************************/ -int svf_login = 0; -int svf_admin = 0; -int svf_mod = 0; -char svf_user[64] = ""; -char svf_pass[64] = ""; - -int svf_open = 0; -int svf_own = 0; -int svf_myvote = 0; -int svf_publish = 0; -char svf_id[16] = ""; -char svf_name[64] = ""; -char svf_tags[256] = ""; -void *svf_last = NULL; -int svf_lsize; - void *build_thumb(int *size, int bzip2) { unsigned char *d=calloc(1,XRES*YRES), *c; @@ -460,18 +353,6 @@ corrupt: return 1; } -static char *mystrdup(char *s) -{ - char *x; - if(s) - { - x = malloc(strlen(s)+1); - strcpy(x, s); - return x; - } - return s; -} - void *build_save(int *size, int x0, int y0, int w, int h) { unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; @@ -1922,500 +1803,6 @@ int flood_parts(int x, int y, int c, int cm, int bm) return 1; } -void draw_svf_ui(pixel *vid_buf) -{ - int c; - - drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); - drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - c = svf_open ? 255 : 128; - drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); - drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); - - c = svf_login ? 255 : 128; - drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); - if(svf_open) - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); - else - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); - drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); - if(svf_open && svf_own) - drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); - - c = (svf_login && svf_open) ? 255 : 128; - - drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - - if(svf_myvote==1 && (svf_login && svf_open)) - { - fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); - } - else if(svf_myvote==-1 && (svf_login && svf_open)) - { - fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); - } - - drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); - drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); - - drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); - if(svf_tags[0]) - drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); - else - drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); - - drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); - - drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); - drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); - if(svf_login) - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); - else - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); - drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); - - if(sys_pause) - { - fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); - drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - if(!legacy_enable) - { - fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - switch(cmode) - { - case 0: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); - break; - case 1: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); - break; - case 2: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); - break; - case 3: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); - break; - case 4: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); - break; - case 5: - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - break; - case 6: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255); - break; - } - drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - - if(svf_admin) - { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); - } - else if(svf_mod) - { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - }//else if(amd) - // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? -} - -typedef struct ui_edit -{ - int x, y, w, nx; - char str[256],*def; - int focus, cursor, hide; -} ui_edit; - -void ui_edit_draw(pixel *vid_buf, ui_edit *ed) -{ - int cx, i; - char echo[256], *str; - - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(ed->str[0]) - { - drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); - drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); - } - else if(!ed->focus) - drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); - if(ed->focus) - { - cx = textnwidth(str, ed->cursor); - for(i=-3; i<9; i++) - drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); - } -} - -char *shift_0="`1234567890-=[]\\;',./"; -char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; - -void ui_edit_process(int mx, int my, int mb, ui_edit *ed) -{ - char ch, ts[2], echo[256], *str; - int l, i; -#ifdef RAWINPUT - char *p; -#endif - - if(mb) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = 0; - ed->str[0] = 0; - } - else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = textwidthx(str, mx-ed->x); - } - else - ed->focus = 0; - } - if(ed->focus && sdl_key) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - l = strlen(ed->str); - switch(sdl_key) - { - case SDLK_HOME: - ed->cursor = 0; - break; - case SDLK_END: - ed->cursor = l; - break; - case SDLK_LEFT: - if(ed->cursor > 0) - ed->cursor --; - break; - case SDLK_RIGHT: - if(ed->cursor < l) - ed->cursor ++; - break; - case SDLK_DELETE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - ed->str[ed->cursor] = 0; - else if(ed->cursor < l) - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - break; - case SDLK_BACKSPACE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - { - if(ed->cursor > 0) - memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); - ed->cursor = 0; - } - else if(ed->cursor > 0) - { - ed->cursor--; - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - } - break; - default: -#ifdef RAWINPUT - if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) - { - ch = sdl_key; - if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) - { - if(ch>='a' && ch<='z') - ch &= ~0x20; - p = strchr(shift_0, ch); - if(p) - ch = shift_1[p-shift_0]; - } - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#else - if(sdl_ascii>=' ' && sdl_ascii<127) - { - ch = sdl_ascii; - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#endif - break; - } - } -} - -typedef struct ui_checkbox -{ - int x, y; - int focus, checked; -} ui_checkbox; - -void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) -{ - int w = 12; - if(ed->checked) - { - drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); - } - if(ed->focus) - { - drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); - } - else - { - drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); - } -} - -void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) -{ - int w = 12; - - if(mb && !mbq) - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->checked = (ed->checked)?0:1; - } - } - else - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->focus = 1; - } - else - { - ed->focus = 0; - } - } -} - -void error_ui(pixel *vid_buf, int err, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - char *msg; - - msg = malloc(strlen(txt)+16); - if(err) - sprintf(msg, "%03d %s", err, txt); - else - sprintf(msg, "%s", txt); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - if(err) - drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); - else - drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - free(msg); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_ui(pixel *vid_buf, char *top, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); - drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_box(pixel *vid_buf, char *msg) -{ - int w = textwidth(msg)+16; - int x0=(XRES-w)/2,y0=(YRES-24)/2; - - clearrect(vid_buf, x0-2, y0-2, w+4, 28); - drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); -} - -int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - int ret = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); - drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); - drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); - drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) - { - ret = 1; - break; - } - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - { - ret = 1; - break; - } - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - return ret; -} - int execute_tagop(pixel *vid_buf, char *op, char *tag) { int status; @@ -2827,137 +2214,6 @@ void execute_save(pixel *vid_buf) free(result); } -void login_ui(pixel *vid_buf) -{ - int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq,mx,my,err; - ui_edit ed1,ed2; - char *res; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed1.x = x0+25; - ed1.y = y0+25; - ed1.w = 158; - ed1.nx = 1; - ed1.def = "[user name]"; - ed1.focus = 1; - ed1.hide = 0; - ed1.cursor = strlen(svf_user); - strcpy(ed1.str, svf_user); - ed2.x = x0+25; - ed2.y = y0+45; - ed2.w = 158; - ed2.nx = 1; - ed2.def = "[password]"; - ed2.focus = 0; - ed2.hide = 1; - ed2.cursor = 0; - strcpy(ed2.str, ""); - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 80); - drawtext(vid_buf, x0+8, y0+8, "Server login:", 255, 255, 255, 255); - drawtext(vid_buf, x0+12, y0+23, "\x8B", 32, 64, 128, 255); - drawtext(vid_buf, x0+12, y0+23, "\x8A", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); - drawtext(vid_buf, x0+11, y0+44, "\x8C", 160, 144, 32, 255); - drawtext(vid_buf, x0+11, y0+44, "\x84", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+40, 176, 16, 192, 192, 192, 255); - ui_edit_draw(vid_buf, &ed1); - ui_edit_draw(vid_buf, &ed2); - drawtext(vid_buf, x0+5, y0+69, "Sign in", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed1); - ui_edit_process(mx, my, b, &ed2); - - if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) - { - if(!ed1.focus) - break; - ed1.focus = 0; - ed2.focus = 1; - } - if(sdl_key==SDLK_ESCAPE) - { - if(!ed1.focus && !ed2.focus) - return; - ed1.focus = 0; - ed2.focus = 0; - } - } - - strcpy(svf_user, ed1.str); - md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); - - res = http_multipart_post( - "http://" SERVER "/Login.api", - NULL, NULL, NULL, - svf_user, svf_pass, - &err, NULL); - if(err != 200) - { - error_ui(vid_buf, err, http_ret_text(err)); - if(res) - free(res); - goto fail; - } - if(res && !strncmp(res, "OK", 2)) - { - if(!strcmp(res, "OK ADMIN")) - { - svf_admin = 1; - svf_mod = 0; - } - else if(!strcmp(res, "OK MOD")) - { - svf_admin = 0; - svf_mod = 1; - } - else - { - svf_admin = 0; - svf_mod = 0; - } - free(res); - svf_login = 1; - return; - } - if(!res) - res = mystrdup("Unspecified Error"); - error_ui(vid_buf, 0, res); - free(res); - -fail: - strcpy(svf_user, ""); - strcpy(svf_pass, ""); - svf_login = 0; - svf_own = 0; - svf_admin = 0; - svf_mod = 0; -} - void execute_delete(pixel *vid_buf, char *id) { int status; @@ -4232,123 +3488,6 @@ void render_signs(pixel *vid_buf) } } -void add_sign_ui(pixel *vid_buf, int mx, int my) -{ - int i, w, h, x, y, nm=0, ju; - int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; - ui_edit ed; - - // check if it is an existing sign - for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) - break; - } - // else look for empty spot - if(i >= MAXSIGNS) - { - nm = 1; - for(i=0; i= MAXSIGNS) - return; - - if(nm) - { - signs[i].x = mx; - signs[i].y = my; - signs[i].ju = 1; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = x0+25; - ed.y = y0+25; - ed.w = 158; - ed.nx = 1; - ed.def = "[message]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(signs[i].text); - strcpy(ed.str, signs[i].text); - ju = signs[i].ju; - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 80); - drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); - ui_edit_draw(vid_buf, &ed); - drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); - draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); - draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); - draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); - - if(!nm) - { - drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); - drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); - drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); - } - - drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) - ju = 0; - if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) - ju = 1; - if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) - ju = 2; - - if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) - { - signs[i].text[0] = 0; - return; - } - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - { - if(!ed.focus) - return; - ed.focus = 0; - } - } - - strcpy(signs[i].text, ed.str); - signs[i].ju = ju; -} - /*********************************************************** * CONFIG FILE * ***********************************************************/ @@ -4978,19 +4117,7 @@ int main(int argc, char *argv[]) if(!sys_pause||framerender) { -#ifdef MT - if(numCores>2) - { - pthread_t pth; - pthread_create(&pth,NULL,update_air_th,""); - } - else - { - update_air(); - } -#else update_air(); -#endif } if(cmode==0 || cmode==1) { diff --git a/misc.c b/misc.c index fe50b32..ade3c3c 100644 --- a/misc.c +++ b/misc.c @@ -1,10 +1,12 @@ +#include +#include #include "misc.h" //Signum function #ifdef WIN32 -_inline int sign(float i) +_inline int isign(float i) #else -inline int sign(float i) +inline int isign(float i) #endif { if (i<0) @@ -38,4 +40,16 @@ inline float restrict_flt(float f, float min, float max) if(f>max) return max; return f; +} + +char *mystrdup(char *s) +{ + char *x; + if(s) + { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; + } + return s; } \ No newline at end of file diff --git a/misc.h b/misc.h index a42396d..556cc97 100644 --- a/misc.h +++ b/misc.h @@ -3,9 +3,9 @@ //Signum function #ifdef WIN32 -extern _inline int sign(float i); +extern _inline int isign(float i); #else -extern inline int sign(float i); +extern inline int isign(float i); #endif #ifdef WIN32 @@ -20,4 +20,6 @@ extern _inline float restrict_flt(float f, float min, float max); extern inline float restrict_flt(float f, float min, float max); #endif +char *mystrdup(char *s); + #endif \ No newline at end of file -- cgit v0.9.2-21-gd62e From a23f3777314312f8dfb70b779258dbb2f948bd08 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 28 Aug 2010 11:40:49 +0100 Subject: Even more work, something broke though diff --git a/defines.h b/defines.h index 6f0dab3..bbce8b2 100644 --- a/defines.h +++ b/defines.h @@ -1,6 +1,12 @@ #ifndef DEFINE_H #define DEFINE_H +#ifdef WIN32 +#define PATH_SEP "\\" +#else +#define PATH_SEP "/" +#endif + #define SERVER "powdertoy.co.uk" #undef PLOSS @@ -28,6 +34,22 @@ static unsigned char ZSIZE = ZSIZE_D; #define VLOSS 0.999f #define PLOSS 0.9999f +#define GRID_X 5 +#define GRID_Y 4 +#define GRID_P 3 +#define GRID_S 6 +#define GRID_Z 3 + +#define STAMP_X 4 +#define STAMP_Y 4 +#define STAMP_MAX 120 + +#ifdef PIX16 +typedef unsigned short pixel; +#else +typedef unsigned int pixel; +#endif + typedef unsigned char uint8; extern int legacy_enable; @@ -45,6 +67,18 @@ struct sign }; typedef struct sign sign; +struct stamp +{ + char name[11]; + pixel *thumb; + int thumb_w, thumb_h, dodelete; +}; +typedef struct stamp stamp; + extern sign signs[MAXSIGNS]; +extern stamp stamps[STAMP_MAX]; +extern int stamp_count; +extern int itc; +extern char itc_msg[64]; #endif \ No newline at end of file diff --git a/graphics.c b/graphics.c index 226a984..8f5c6ae 100644 --- a/graphics.c +++ b/graphics.c @@ -1,5 +1,6 @@ #include #include +#include #include "defines.h" #include "air.h" #include "powder.h" @@ -16,6 +17,9 @@ unsigned char fire_r[YRES/CELL][XRES/CELL]; unsigned char fire_g[YRES/CELL][XRES/CELL]; unsigned char fire_b[YRES/CELL][XRES/CELL]; +unsigned int fire_alpha[CELL*3][CELL*3]; +pixel *fire_bg; + pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f) { int i,j,x,y,w,h,r,g,b,c; @@ -1769,4 +1773,124 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny+1, R, G, B, 112); } } -} \ No newline at end of file +} + +void render_signs(pixel *vid_buf) +{ + int i, j, x, y, w, h, dx, dy; + char buff[30]; //Buffer + for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature + else + sprintf(buff, "Temp: 0.00"); //...tempirature + drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); + } + + //Usual text + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); + x = signs[i].x; + y = signs[i].y; + dx = 1 - signs[i].ju; + dy = (signs[i].y > 18) ? -1 : 1; + for(j=0; j<4; j++) + { + drawpixel(vid_buf, x, y, 192, 192, 192, 255); + x+=dx; + y+=dy; + } + } +} + +void render_fire(pixel *dst) +{ + int i,j,x,y,r,g,b; + for(j=0; j=0 && j+y>=0 && i+x4 ? r-4 : 0; + fire_g[j][i] = g>4 ? g-4 : 0; + fire_b[j][i] = b>4 ? b-4 : 0; + } +} + +void prepare_alpha(void) +{ + int x,y,i,j; + float temp[CELL*3][CELL*3]; + memset(temp, 0, sizeof(temp)); + for(x=0; x>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) #define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) #define PIXR(x) (((x)>>8)&0xF8) @@ -14,7 +13,6 @@ typedef unsigned short pixel; #define PIXB(x) (((x)<<3)&0xF8) #else #define PIXELSIZE 4 -typedef unsigned int pixel; #ifdef PIX32BGR #define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) #define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) @@ -46,6 +44,9 @@ extern unsigned char fire_r[YRES/CELL][XRES/CELL]; extern unsigned char fire_g[YRES/CELL][XRES/CELL]; extern unsigned char fire_b[YRES/CELL][XRES/CELL]; +extern unsigned int fire_alpha[CELL*3][CELL*3]; +extern pixel *fire_bg; + pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f); void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch); @@ -114,4 +115,10 @@ void xor_rect(pixel *vid, int x, int y, int w, int h); void draw_parts(pixel *vid); +void render_signs(pixel *vid_buf); + +void render_fire(pixel *dst); + +void prepare_alpha(void); + #endif \ No newline at end of file diff --git a/interface.c b/interface.c index cb61054..f40fadc 100644 --- a/interface.c +++ b/interface.c @@ -1,6 +1,7 @@ #include #include #include +#include "font.h" #include "defines.h" #include "powder.h" #include "interface.h" @@ -41,6 +42,24 @@ void menu_count(void) } +void get_sign_pos(int i, int *x0, int *y0, int *w, int *h) +{ + //Changing width if sign have special content + if(strcmp(signs[i].text, "{p}")==0) + *w = textwidth("Pressure: -000.00"); + + if(strcmp(signs[i].text, "{t}")==0) + *w = textwidth("Temp: 0000.00"); + + //Ususal width + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + *w = textwidth(signs[i].text) + 5; + *h = 14; + *x0 = (signs[i].ju == 2) ? signs[i].x - *w : + (signs[i].ju == 1) ? signs[i].x - *w/2 : signs[i].x; + *y0 = (signs[i].y > 18) ? signs[i].y - 18 : signs[i].y + 4; +} + void add_sign_ui(pixel *vid_buf, int mx, int my) { int i, w, h, x, y, nm=0, ju; @@ -767,6 +786,735 @@ fail: svf_mod = 0; } +int stamp_ui(pixel *vid_buf) +{ + int b=1,bq,mx,my,d=-1,i,j,k,x,gx,gy,y,w,h,r=-1,stamp_page=0,per_page=STAMP_X*STAMP_Y,page_count; + char page_info[64]; + page_count = ceil((float)stamp_count/(float)per_page); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); + k = stamp_page*per_page;//0; + r = -1; + d = -1; + for(j=0; j=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) + { + if(stamp_page) + { + stamp_page --; + } + sdl_wheel = 0; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=60) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=20) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(!bq && mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + if(b==1&&h!=-1) + { + *sl = h; + } + if(b==4&&h!=-1) + { + *sr = h; + } +} + int sdl_poll(void) { SDL_Event event; @@ -844,4 +1592,44 @@ int sdl_poll(void) } sdl_mod = SDL_GetModState(); return 0; +} + +void set_cmode(int cm) +{ + cmode = cm; + itc = 51; + if(cmode==4) + { + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + strcpy(itc_msg, "Blob Display"); + } + else if(cmode==5) + { + strcpy(itc_msg, "Heat Display"); + } + else if(cmode==6) + { + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + strcpy(itc_msg, "Fancy Display"); + } + else if(cmode==3) + { + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + strcpy(itc_msg, "Fire Display"); + } + else if(cmode==2) + { + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + strcpy(itc_msg, "Persistent Display"); + } + else if(cmode==1) + strcpy(itc_msg, "Pressure Display"); + else + strcpy(itc_msg, "Velocity Display"); } \ No newline at end of file diff --git a/interface.h b/interface.h index 4d97f6b..14ae878 100644 --- a/interface.h +++ b/interface.h @@ -102,6 +102,8 @@ extern int Z_keysym; void menu_count(void); +void get_sign_pos(int i, int *x0, int *y0, int *w, int *h); + void add_sign_ui(pixel *vid_buf, int mx, int my); void ui_edit_draw(pixel *vid_buf, ui_edit *ed); @@ -124,5 +126,17 @@ int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn); void login_ui(pixel *vid_buf); +int stamp_ui(pixel *vid_buf); + +void tag_list_ui(pixel *vid_buf); + +int save_name_ui(pixel *vid_buf); + +void menu_ui(pixel *vid_buf, int i, int *sl, int *sr); + +void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my); + int sdl_poll(void); + +void set_cmode(int cm); #endif \ No newline at end of file diff --git a/main.c b/main.c index ce1d634..88b712c 100644 --- a/main.c +++ b/main.c @@ -927,50 +927,9 @@ corrupt: return NULL; } -/* NO, I DON'T THINK SO - #include "fbi.h" - - pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) - { - unsigned char *tmp; - pixel *res; - int i; - - tmp = malloc(width*height*3); - if(!tmp) - return NULL; - res = malloc(width*height*PIXELSIZE); - if(!res) { - free(tmp); - return NULL; - } - - i = width*height*3; - if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) { - free(res); - free(tmp); - return NULL; - } - - for(i=0; i0) { - memcpy(&tmp, stamps+i, sizeof(struct stamp_info)); - memmove(stamps+1, stamps, sizeof(struct stamp_info)*i); - memcpy(stamps, &tmp, sizeof(struct stamp_info)); + memcpy(&tmp, stamps+i, sizeof(struct stamp)); + memmove(stamps+1, stamps, sizeof(struct stamp)*i); + memcpy(stamps, &tmp, sizeof(struct stamp)); stamp_update(); } @@ -1155,652 +1102,21 @@ void stamp_init(void) return; for(i=0; i=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=60) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=20) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - if(b==1&&h!=-1) - { - *sl = h; - } - if(b==4&&h!=-1) - { - *sr = h; - } -} - -int create_parts(int x, int y, int r, int c) -{ - int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0; //n; - - if(c == 125) - { - i = x / CELL; - j = y / CELL; - for(v=-1; v<2; v++) - for(u=-1; u<2; u++) - if(i+u>=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) - { - if(cp) - create_parts(y, x, r, c); - else - create_parts(x, y, r, c); - } - e -= 1.0f; - } - } -} - -void create_box(int x1, int y1, int x2, int y2, int c) -{ - int i, j; - if(x1>x2) - { - i = x2; - x2 = x1; - x1 = i; - } - if(y1>y2) - { - j = y2; - y2 = y1; - y1 = j; - } - for(j=y1; j<=y2; j++) - for(i=x1; i<=x2; i++) - create_parts(i, j, 1, c); -} - -int flood_parts(int x, int y, int c, int cm, int bm) -{ - int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) - { - c = c-100; - } - if(cm==-1) - { - if(c==0) - { - cm = pmap[y][x]&0xFF; - if(!cm) - return 0; - } - else - cm = 0; - } - if(bm==-1) - { - if(c==30) - { - bm = bmap[y/CELL][x/CELL]; - if(!bm) - return 0; - if(bm==1) - cm = 0xFF; - } - else - bm = 0; - } - - if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) - return 1; - - // go left as far as possible - x1 = x2 = x; - while(x1>=CELL) - { - if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) - break; - x1--; - } - while(x2=CELL+dy) - for(x=x1; x<=x2; x++) - if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) - if(!flood_parts(x, y-dy, co, cm, bm)) - return 0; - if(y=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) - { - if(stamp_page) - { - stamp_page --; - } - sdl_wheel = 0; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my 18) ? signs[i].y - 18 : signs[i].y + 4; -} - -void render_signs(pixel *vid_buf) -{ - int i, j, x, y, w, h, dx, dy; - char buff[30]; //Buffer - for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature - else - sprintf(buff, "Temp: 0.00"); //...tempirature - drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); - } - - //Usual text - if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) - drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); - x = signs[i].x; - y = signs[i].y; - dx = 1 - signs[i].ju; - dy = (signs[i].y > 18) ? -1 : 1; - for(j=0; j<4; j++) - { - drawpixel(vid_buf, x, y, 192, 192, 192, 255); - x+=dx; - y+=dy; - } - } -} - /*********************************************************** * CONFIG FILE * ***********************************************************/ @@ -3624,52 +2489,6 @@ void dim_copy(pixel *dst, pixel *src) } } -unsigned int fire_alpha[CELL*3][CELL*3]; -void prepare_alpha(void) -{ - int x,y,i,j; - float temp[CELL*3][CELL*3]; - memset(temp, 0, sizeof(temp)); - for(x=0; x=0 && j+y>=0 && i+x4 ? r-4 : 0; - fire_g[j][i] = g>4 ? g-4 : 0; - fire_b[j][i] = b>4 ? b-4 : 0; - } -} - int zoom_en = 0; int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; int zoom_wx=0, zoom_wy=0; @@ -3798,47 +2617,6 @@ char *tag = "(c) 2008-9 Stanislaw Skowronek"; int itc = 0; char itc_msg[64] = "[?]"; -pixel *fire_bg; -void set_cmode(int cm) -{ - cmode = cm; - itc = 51; - if(cmode==4) - { - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - strcpy(itc_msg, "Blob Display"); - } - else if(cmode==5) - { - strcpy(itc_msg, "Heat Display"); - } - else if(cmode==6) - { - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - strcpy(itc_msg, "Fancy Display"); - } - else if(cmode==3) - { - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - strcpy(itc_msg, "Fire Display"); - } - else if(cmode==2) - { - memset(fire_bg, 0, XRES*YRES*PIXELSIZE); - strcpy(itc_msg, "Persistent Display"); - } - else if(cmode==1) - strcpy(itc_msg, "Pressure Display"); - else - strcpy(itc_msg, "Velocity Display"); -} - char my_uri[] = "http://" SERVER "/Update.api?Action=Download&Architecture=" #if defined WIN32 "Windows32" @@ -3955,20 +2733,6 @@ corrupt: return NULL; } -void clear_area(int area_x, int area_y, int area_w, int area_h) -{ - int cx = 0; - int cy = 0; - for(cy=0; cyx2) + { + i = x2; + x2 = x1; + x1 = i; + } + if(y1>y2) + { + j = y2; + y2 = y1; + y1 = j; + } + for(j=y1; j<=y2; j++) + for(i=x1; i<=x2; i++) + create_parts(i, j, 1, c); +} + +int flood_parts(int x, int y, int c, int cm, int bm) +{ + int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) + { + c = c-100; + } + if(cm==-1) + { + if(c==0) + { + cm = pmap[y][x]&0xFF; + if(!cm) + return 0; + } + else + cm = 0; + } + if(bm==-1) + { + if(c==30) + { + bm = bmap[y/CELL][x/CELL]; + if(!bm) + return 0; + if(bm==1) + cm = 0xFF; + } + else + bm = 0; + } + + if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) + return 1; + + // go left as far as possible + x1 = x2 = x; + while(x1>=CELL) + { + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + break; + x1--; + } + while(x2=CELL+dy) + for(x=x1; x<=x2; x++) + if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) + if(!flood_parts(x, y-dy, co, cm, bm)) + return 0; + if(y=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) + { + if(cp) + create_parts(y, x, r, c); + else + create_parts(x, y, r, c); + } + e -= 1.0f; + } + } } \ No newline at end of file diff --git a/powder.h b/powder.h index fa75435..a12c37a 100644 --- a/powder.h +++ b/powder.h @@ -456,4 +456,14 @@ void update_particles_i(pixel *vid, int start, int inc); void update_particles(pixel *vid); +void clear_area(int area_x, int area_y, int area_w, int area_h); + +void create_box(int x1, int y1, int x2, int y2, int c); + +int flood_parts(int x, int y, int c, int cm, int bm); + +int create_parts(int x, int y, int r, int c); + +void create_line(int x1, int y1, int x2, int y2, int r, int c); + #endif \ No newline at end of file -- cgit v0.9.2-21-gd62e From c0563111f822f5253264c7805917a864e1ddda5d Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 29 Aug 2010 10:25:53 +0100 Subject: Include some headers and move some functions diff --git a/interface.c b/interface.c index f40fadc..d5d87e5 100644 --- a/interface.c +++ b/interface.c @@ -1,10 +1,14 @@ #include #include #include +#include +#include "http.h" +#include "md5.h" #include "font.h" #include "defines.h" #include "powder.h" #include "interface.h" +#include "misc.h" SDLMod sdl_mod; int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; diff --git a/main.c b/main.c index 88b712c..e30a972 100644 --- a/main.c +++ b/main.c @@ -1167,40 +1167,6 @@ int execute_tagop(pixel *vid_buf, char *op, char *tag) return 0; } -struct strlist -{ - char *str; - struct strlist *next; -}; - -void strlist_add(struct strlist **list, char *str) -{ - struct strlist *item = malloc(sizeof(struct strlist)); - item->str = mystrdup(str); - item->next = *list; - *list = item; -} - -int strlist_find(struct strlist **list, char *str) -{ - struct strlist *item; - for(item=*list; item; item=item->next) - if(!strcmp(item->str, str)) - return 1; - return 0; -} - -void strlist_free(struct strlist **list) -{ - struct strlist *item; - while(*list) - { - item = *list; - *list = (*list)->next; - free(item); - } -} - void thumb_cache_inval(char *id); void execute_save(pixel *vid_buf) diff --git a/misc.c b/misc.c index ade3c3c..a74b0e4 100644 --- a/misc.c +++ b/misc.c @@ -52,4 +52,32 @@ char *mystrdup(char *s) return x; } return s; +} + +void strlist_add(struct strlist **list, char *str) +{ + struct strlist *item = malloc(sizeof(struct strlist)); + item->str = mystrdup(str); + item->next = *list; + *list = item; +} + +int strlist_find(struct strlist **list, char *str) +{ + struct strlist *item; + for(item=*list; item; item=item->next) + if(!strcmp(item->str, str)) + return 1; + return 0; +} + +void strlist_free(struct strlist **list) +{ + struct strlist *item; + while(*list) + { + item = *list; + *list = (*list)->next; + free(item); + } } \ No newline at end of file diff --git a/misc.h b/misc.h index 556cc97..e279093 100644 --- a/misc.h +++ b/misc.h @@ -22,4 +22,16 @@ extern inline float restrict_flt(float f, float min, float max); char *mystrdup(char *s); +struct strlist +{ + char *str; + struct strlist *next; +}; + +void strlist_add(struct strlist **list, char *str); + +int strlist_find(struct strlist **list, char *str); + +void strlist_free(struct strlist **list); + #endif \ No newline at end of file diff --git a/powder.c b/powder.c index d1c8321..0f31577 100644 --- a/powder.c +++ b/powder.c @@ -463,6 +463,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(i=start; i<(NPART-starti); i+=inc) if(parts[i].type) { + //printf("parts[%d].type: %d\n", i, parts[i].type); lx = parts[i].x; ly = parts[i].y; -- cgit v0.9.2-21-gd62e From 0b072510f0e8b7dc4944fb367ca42c8ec92503dc Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sun, 29 Aug 2010 12:41:45 +0200 Subject: changed makefile diff --git a/Makefile b/Makefile index c02fb2e..1e1860a 100755 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SOURCES := powder.c http.c md5.c update.c +SOURCES := *.c HEADERS := font.h hmap.h http.h md5.h icon.h update.h version.h CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L diff --git a/interface.h b/interface.h index 14ae878..6fa96ef 100644 --- a/interface.h +++ b/interface.h @@ -1,6 +1,7 @@ #ifndef INTERFACE_H #define INTERFACE_H - +#include "http.h" +#include "md5.h" struct menu_section { char *icon; @@ -139,4 +140,4 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int sdl_poll(void); void set_cmode(int cm); -#endif \ No newline at end of file +#endif diff --git a/powder b/powder new file mode 100755 index 0000000..1dbdac4 Binary files /dev/null and b/powder differ -- cgit v0.9.2-21-gd62e From 0a283cee5d112b6f5976f44f3dd52537c8e2d15f Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sun, 29 Aug 2010 12:42:00 +0200 Subject: removed executable diff --git a/powder b/powder deleted file mode 100755 index 1dbdac4..0000000 Binary files a/powder and /dev/null differ -- cgit v0.9.2-21-gd62e From 1af2d330de825a585c2c5ad8b6f840c639237034 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 29 Aug 2010 13:10:58 +0100 Subject: Moves and fixes diff --git a/Makefile b/Makefile index c02fb2e..1e1860a 100755 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SOURCES := powder.c http.c md5.c update.c +SOURCES := *.c HEADERS := font.h hmap.h http.h md5.h icon.h update.h version.h CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L diff --git a/defines.h b/defines.h index bbce8b2..7a14da2 100644 --- a/defines.h +++ b/defines.h @@ -7,10 +7,20 @@ #define PATH_SEP "/" #endif +#define SAVE_VERSION 41 +#define MINOR_VERSION 3 +#define IDENT_VERSION "S" //Change this if you're not Simon! It should be a single letter. + #define SERVER "powdertoy.co.uk" #undef PLOSS +#define THUMB_CACHE_SIZE 256 + +#define IMGCONNS 3 +#define TIMEOUT 100 +#define HTTP_TIMEOUT 10 + #define MENUSIZE 40 #define BARSIZE 14 #define XRES 612 @@ -18,6 +28,7 @@ #define NPART XRES*YRES #define MAXSIGNS 16 +#define TAG_MAX 256 #define ZSIZE_D 16 #define ZFACTOR_D 8 @@ -81,4 +92,13 @@ extern int stamp_count; extern int itc; extern char itc_msg[64]; +extern int do_open; +extern int sys_pause; +extern int legacy_enable; //Used to disable new features such as heat, will be set by commandline or save. +extern int death, framerender; + +extern unsigned char last_major, last_minor, update_flag; + +extern char http_proxy_string[256]; + #endif \ No newline at end of file diff --git a/graphics.c b/graphics.c index 8f5c6ae..c058d43 100644 --- a/graphics.c +++ b/graphics.c @@ -1893,4 +1893,65 @@ pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) free(tmp); return res; } - \ No newline at end of file + +void draw_image(pixel *vid, pixel *img, int x, int y, int w, int h, int a) +{ + int i, j, r, g, b; + for(j=0; j0) + r--; + if(g>0) + g--; + if(b>0) + b--; + dst[i] = PIXRGB(r,g,b); + } +} + +void render_zoom(pixel *img) +{ + int x, y, i, j; + pixel pix; + drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); + drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); + clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); + for(j=0; j #endif -#include "version.h" +#include "defines.h" #include "http.h" #include "md5.h" diff --git a/interface.c b/interface.c index d5d87e5..9a3fe4c 100644 --- a/interface.c +++ b/interface.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "http.h" #include "md5.h" @@ -32,8 +33,30 @@ char svf_tags[256] = ""; void *svf_last = NULL; int svf_lsize; +char *search_ids[GRID_X*GRID_Y]; +int search_votes[GRID_X*GRID_Y]; +int search_publish[GRID_X*GRID_Y]; +int search_scoredown[GRID_X*GRID_Y]; +int search_scoreup[GRID_X*GRID_Y]; +char *search_names[GRID_X*GRID_Y]; +char *search_owners[GRID_X*GRID_Y]; +void *search_thumbs[GRID_X*GRID_Y]; +int search_thsizes[GRID_X*GRID_Y]; + +int search_own = 0; +int search_date = 0; +int search_page = 0; +char search_expr[256] = ""; + +char *tag_names[TAG_MAX]; +int tag_votes[TAG_MAX]; + int Z_keysym = 'z'; +int zoom_en = 0; +int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; +int zoom_wx=0, zoom_wy=0; + void menu_count(void) { int i=0; @@ -1636,4 +1659,772 @@ void set_cmode(int cm) strcpy(itc_msg, "Pressure Display"); else strcpy(itc_msg, "Velocity Display"); +} + +char *download_ui(pixel *vid_buf, char *uri, int *len) +{ + int dstate = 0; + void *http = http_async_req_start(NULL, uri, NULL, 0, 0); + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2; + int done, total, i, ret, zlen, ulen; + char str[16], *tmp, *res; + + while(!http_async_req_status(http)) + { + sdl_poll(); + + http_async_get_length(http, &total, &done); + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, "Please wait", 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, "Downloading update...", 255, 255, 255, 255); + + if(total) + { + i = (236*done)/total; + fillrect(vid_buf, x0+1, y0+45, i+1, 14, 255, 216, 32, 255); + i = (100*done)/total; + sprintf(str, "%d%%", i); + if(i<50) + drawtext(vid_buf, x0+120-textwidth(str)/2, y0+48, str, 192, 192, 192, 255); + else + drawtext(vid_buf, x0+120-textwidth(str)/2, y0+48, str, 0, 0, 0, 255); + } + else + drawtext(vid_buf, x0+120-textwidth("Waiting...")/2, y0+48, "Waiting...", 255, 216, 32, 255); + + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + } + + tmp = http_async_req_stop(http, &ret, &zlen); + if(ret!=200) + { + error_ui(vid_buf, ret, http_ret_text(ret)); + if(tmp) + free(tmp); + return NULL; + } + if(!tmp) + { + error_ui(vid_buf, 0, "Server did not return data"); + return NULL; + } + + if(zlen<16) + { + printf("ZLen is not 16!\n"); + goto corrupt; + } + if(tmp[0]!=0x42 || tmp[1]!=0x75 || tmp[2]!=0x54 || tmp[3]!=0x54) + { + printf("Tmperr %d, %d, %d, %d\n", tmp[0], tmp[1], tmp[2], tmp[3]); + goto corrupt; + } + + ulen = (unsigned char)tmp[4]; + ulen |= ((unsigned char)tmp[5])<<8; + ulen |= ((unsigned char)tmp[6])<<16; + ulen |= ((unsigned char)tmp[7])<<24; + + res = (char *)malloc(ulen); + if(!res) + { + printf("No res!\n"); + goto corrupt; + } + dstate = BZ2_bzBuffToBuffDecompress((char *)res, (unsigned *)&ulen, (char *)(tmp+8), zlen-8, 0, 0); + if(dstate) + { + printf("Decompression failure: %d!\n", dstate); + free(res); + goto corrupt; + } + + free(tmp); + if(len) + *len = ulen; + return res; + +corrupt: + error_ui(vid_buf, 0, "Downloaded update is corrupted"); + free(tmp); + return NULL; +} + +int search_ui(pixel *vid_buf) +{ + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; + int thumb_drawn[GRID_X*GRID_Y]; + pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + float ry; + time_t http_last_use=HTTP_TIMEOUT; + ui_edit ed; + + + void *http = NULL; + int active = 0; + char *last = NULL; + int search = 0; + int lasttime = TIMEOUT; + char *uri; + int status; + char *results; + char *tmp, ts[64]; + + void *img_http[IMGCONNS]; + char *img_id[IMGCONNS]; + void *thumb, *data; + int thlen, dlen; + + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + + memset(img_http, 0, sizeof(img_http)); + memset(img_id, 0, sizeof(img_id)); + + memset(search_ids, 0, sizeof(search_ids)); + memset(search_names, 0, sizeof(search_names)); + memset(search_scoreup, 0, sizeof(search_scoreup)); + memset(search_scoredown, 0, sizeof(search_scoredown)); + memset(search_publish, 0, sizeof(search_publish)); + memset(search_owners, 0, sizeof(search_owners)); + memset(search_thumbs, 0, sizeof(search_thumbs)); + memset(search_thsizes, 0, sizeof(search_thsizes)); + + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + + do_open = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = 65; + ed.y = 13; + ed.w = XRES-200; + ed.nx = 1; + ed.def = "[search terms]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(search_expr); + strcpy(ed.str, search_expr); + + sdl_wheel = 0; + + while(!sdl_poll()) + { + uih = 0; + bq = b; + mxq = mx; + myq = my; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + if(mx!=mxq || my!=myq || sdl_wheel || b) + mmt = 0; + else if(mmt 9) + { + drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); + drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); + } + + ui_edit_draw(vid_buf, &ed); + + if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) + { + if(search_page) + { + search_page --; + lasttime = TIMEOUT; + } + sdl_wheel = 0; + uih = 1; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) + { + lasttime = TIMEOUT; + search_page ++; + page_count = exp_res; + } + sdl_wheel = 0; + uih = 1; + } + + tp = -1; + if(is_p1) + { + drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); + for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) + for(gi=0; giTAG_MAX || !tag_names[pos]) + break; + if(tag_votes[0]) + i = 127+(128*tag_votes[pos])/tag_votes[0]; + else + i = 192; + w = textwidth(tag_names[pos]); + if(w>XRES/GRID_X-5) + w = XRES/GRID_X-5; + gx = (XRES/GRID_X)*gi; + gy = gj*14 + 46; + if(mx>=gx && mx=gy && my XRES/GRID_X-10) + { + tmp = malloc(strlen(search_names[pos])+4); + strcpy(tmp, search_names[pos]); + j = textwidthx(tmp, XRES/GRID_X-15); + strcpy(tmp+j, "..."); + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); + free(tmp); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); + j = textwidth(search_owners[pos]); + if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && + my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) + { + st = 1; + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); + if(search_thumbs[pos]&&thumb_drawn[pos]==0) + { + render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); + thumb_drawn[pos] = 1; + } + own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); + if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) + mp = pos; + if(own) + { + if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) + { + mp = -1; + dp = pos; + } + } + if(mp==pos && !st) + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); + else + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); + if(own) + { + if(dp == pos) + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); + else + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); + } + if(!search_publish[pos]) + { + drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); + drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } + if(view_own || svf_admin || svf_mod) + { + sprintf(ts+1, "%d", search_votes[pos]); + ts[0] = 0xBB; + for(j=1; ts[j]; j++) + ts[j] = 0xBC; + ts[j-1] = 0xB9; + ts[j] = 0xBA; + ts[j+1] = 0; + w = gx+XRES/GRID_S-2-textwidth(ts); + h = gy+YRES/GRID_S-11; + drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); + for(j=0; ts[j]; j++) + ts[j] -= 14; + drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); + sprintf(ts, "%d", search_votes[pos]); + for(j=0; ts[j]; j++) + ts[j] += 127; + drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); + } + if(search_scoreup[pos]>0||search_scoredown[pos]>0) + { + lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); + + if(((YRES/GRID_S+3)/2)>lv) + { + ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); + if(lv<8) + { + ry = ry/(8-lv); + } + nyu = search_scoreup[pos]*ry; + nyd = search_scoredown[pos]*ry; + } + else + { + ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); + nyu = search_scoreup[pos]/ry; + nyd = search_scoredown[pos]/ry; + } + + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); + + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); + } + } + + if(mp!=-1 && mmt>=TIMEOUT/5 && !st) + { + gi = mp % GRID_X; + gj = mp / GRID_X; + if(is_p1) + gj += GRID_Y-GRID_P; + gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; + gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; + i = w = textwidth(search_names[mp]); + h = YRES/GRID_Z+30; + if(w=XRES-2) gx=XRES-3-w; + if(gy<32) gy=32; + if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; + clearrect(vid_buf, gx-2, gy-3, w+4, h); + drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); + if(search_thumbs[mp]) + render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); + drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); + drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); + } + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(sdl_key==SDLK_RETURN) + { + if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) + lasttime = TIMEOUT; + else if(search_ids[0] && !search_ids[1]) + { + bq = 0; + b = 1; + mp = 0; + } + } + if(sdl_key==SDLK_ESCAPE) + goto finish; + + if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) + { + search_own = !search_own; + lasttime = TIMEOUT; + } + if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) + { + search_date = !search_date; + lasttime = TIMEOUT; + } + + if(b && !bq && dp!=-1) + if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) + { + execute_delete(vid_buf, search_ids[dp]); + lasttime = TIMEOUT; + if(last) + { + free(last); + last = NULL; + } + } + + if(b && !bq && tp!=-1) + { + strncpy(ed.str, tag_names[tp], 255); + lasttime = TIMEOUT; + } + + if(b && !bq && mp!=-1 && st) + { + sprintf(ed.str, "user:%s", search_owners[mp]); + lasttime = TIMEOUT; + } + + if(do_open==1) + { + mp = 0; + } + + if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) + { + fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); + info_box(vid_buf, "Loading..."); + + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + data = http_simple_get(uri, &status, &dlen); + free(uri); + + if(status == 200) + { + status = parse_save(data, dlen, 1, 0, 0); + switch(status) + { + case 1: + error_ui(vid_buf, 0, "Simulation corrupted"); + break; + case 2: + error_ui(vid_buf, 0, "Simulation from a newer version"); + break; + case 3: + error_ui(vid_buf, 0, "Simulation on a too large grid"); + break; + } + if(!status) + { + char *tnames[] = {"ID", NULL}; + char *tparts[1]; + int tplens[1]; + if(svf_last) + free(svf_last); + svf_last = data; + svf_lsize = dlen; + + tparts[0] = search_ids[mp]; + tplens[0] = strlen(search_ids[mp]); + data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); + + svf_open = 1; + svf_own = svf_login && !strcmp(search_owners[mp], svf_user); + svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); + + strcpy(svf_id, search_ids[mp]); + strcpy(svf_name, search_names[mp]); + if(status == 200) + { + if(data) + { + strncpy(svf_tags, data, 255); + svf_tags[255] = 0; + } + else + svf_tags[0] = 0; + } + else + { + svf_tags[0] = 0; + } + + if(svf_login) + { + char *names[] = {"ID", NULL}; + char *parts[1]; + parts[0] = search_ids[mp]; + data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); + if(status == 200) + { + if(data) + { + if(!strcmp(data, "Up")) + { + svf_myvote = 1; + } + else if(!strcmp(data, "Down")) + { + svf_myvote = -1; + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + } + else + { + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + } + } + else + error_ui(vid_buf, status, http_ret_text(status)); + + if(data) + free(data); + goto finish; + } + + if(!last) + { + search = 1; + } + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) + { + search = 1; + if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) + { + search_page = 0; + page_count = 0; + } + free(last); + last = NULL; + } + else + search = 0; + + if(search && lasttime>=TIMEOUT) + { + lasttime = 0; + last = mystrdup(ed.str); + last_own = search_own; + last_date = search_date; + last_page = search_page; + active = 1; + uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); + if(search_own || svf_admin || svf_mod) + tmp = "&ShowVotes=true"; + else + tmp = ""; + if(!search_own && !search_date && !*last) + { + if(search_page) + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); + } + else + { + exp_res = GRID_X*GRID_P; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); + } + } + else + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); + } + strcaturl(uri, last); + if(search_own) + { + strcaturl(uri, " user:"); + strcaturl(uri, svf_user); + } + if(search_date) + strcaturl(uri, " sort:date"); + + http = http_async_req_start(http, uri, NULL, 0, 1); + if(svf_login) + { + http_auth_headers(http, svf_user, svf_pass); + } + http_last_use = time(NULL); + free(uri); + } + + if(active && http_async_req_status(http)) + { + http_last_use = time(NULL); + results = http_async_req_stop(http, &status, NULL); + view_own = last_own; + if(status == 200) + { + page_count = search_results(results, last_own||svf_admin||svf_mod); + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + } + is_p1 = (exp_res < GRID_X*GRID_Y); + free(results); + active = 0; + } + + if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) + { + http_async_req_close(http); + http = NULL; + } + + for(i=0; i +#include "graphics.h" struct menu_section { @@ -98,8 +100,30 @@ extern char svf_tags[256]; extern void *svf_last; extern int svf_lsize; +extern char *search_ids[GRID_X*GRID_Y]; +extern int search_votes[GRID_X*GRID_Y]; +extern int search_publish[GRID_X*GRID_Y]; +extern int search_scoredown[GRID_X*GRID_Y]; +extern int search_scoreup[GRID_X*GRID_Y]; +extern char *search_names[GRID_X*GRID_Y]; +extern char *search_owners[GRID_X*GRID_Y]; +extern void *search_thumbs[GRID_X*GRID_Y]; +extern int search_thsizes[GRID_X*GRID_Y]; + +extern int search_own; +extern int search_date; +extern int search_page; +extern char search_expr[256]; + +extern char *tag_names[TAG_MAX]; +extern int tag_votes[TAG_MAX]; + extern int Z_keysym; +extern int zoom_en; +extern int zoom_x, zoom_y; +extern int zoom_wx, zoom_wy; + void menu_count(void); void get_sign_pos(int i, int *x0, int *y0, int *w, int *h); @@ -139,4 +163,8 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int sdl_poll(void); void set_cmode(int cm); + +char *download_ui(pixel *vid_buf, char *uri, int *len); + +int search_ui(pixel *vid_buf); #endif \ No newline at end of file diff --git a/main.c b/main.c index e30a972..1d818a8 100644 --- a/main.c +++ b/main.c @@ -145,7 +145,6 @@ int mousex, mousey = 0; //They contain mouse position * SDL OUTPUT * ***********************************************************/ -#include "icon.h" void sdl_seticon(void) { #ifdef WIN32 @@ -1335,8 +1334,6 @@ void strcaturl(char *dst, char *src) *d = 0; } -#define THUMB_CACHE_SIZE 256 - char *thumb_cache_id[THUMB_CACHE_SIZE]; void *thumb_cache_data[THUMB_CACHE_SIZE]; int thumb_cache_size[THUMB_CACHE_SIZE]; @@ -1402,20 +1399,6 @@ int thumb_cache_find(char *id, void **thumb, int *size) return 1; } -char *search_ids[GRID_X*GRID_Y]; -int search_votes[GRID_X*GRID_Y]; -int search_publish[GRID_X*GRID_Y]; -int search_scoredown[GRID_X*GRID_Y]; -int search_scoreup[GRID_X*GRID_Y]; -char *search_names[GRID_X*GRID_Y]; -char *search_owners[GRID_X*GRID_Y]; -void *search_thumbs[GRID_X*GRID_Y]; -int search_thsizes[GRID_X*GRID_Y]; - -#define TAG_MAX 256 -char *tag_names[TAG_MAX]; -int tag_votes[TAG_MAX]; - int search_results(char *str, int votes) { int i,j; @@ -1616,705 +1599,6 @@ int search_results(char *str, int votes) return i; } -#define IMGCONNS 3 -#define TIMEOUT 100 -#define HTTP_TIMEOUT 10 - -int search_own = 0; -int search_date = 0; -int search_page = 0; -char search_expr[256] = ""; - -int search_ui(pixel *vid_buf) -{ - int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; - int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; - int thumb_drawn[GRID_X*GRID_Y]; - pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - float ry; - time_t http_last_use=HTTP_TIMEOUT; - ui_edit ed; - - - void *http = NULL; - int active = 0; - char *last = NULL; - int search = 0; - int lasttime = TIMEOUT; - char *uri; - int status; - char *results; - char *tmp, ts[64]; - - void *img_http[IMGCONNS]; - char *img_id[IMGCONNS]; - void *thumb, *data; - int thlen, dlen; - - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - - memset(img_http, 0, sizeof(img_http)); - memset(img_id, 0, sizeof(img_id)); - - memset(search_ids, 0, sizeof(search_ids)); - memset(search_names, 0, sizeof(search_names)); - memset(search_scoreup, 0, sizeof(search_scoreup)); - memset(search_scoredown, 0, sizeof(search_scoredown)); - memset(search_publish, 0, sizeof(search_publish)); - memset(search_owners, 0, sizeof(search_owners)); - memset(search_thumbs, 0, sizeof(search_thumbs)); - memset(search_thsizes, 0, sizeof(search_thsizes)); - - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - - do_open = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = 65; - ed.y = 13; - ed.w = XRES-200; - ed.nx = 1; - ed.def = "[search terms]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(search_expr); - strcpy(ed.str, search_expr); - - sdl_wheel = 0; - - while(!sdl_poll()) - { - uih = 0; - bq = b; - mxq = mx; - myq = my; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - if(mx!=mxq || my!=myq || sdl_wheel || b) - mmt = 0; - else if(mmt 9) - { - drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); - drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); - } - - ui_edit_draw(vid_buf, &ed); - - if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) - { - if(search_page) - { - search_page --; - lasttime = TIMEOUT; - } - sdl_wheel = 0; - uih = 1; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) - { - lasttime = TIMEOUT; - search_page ++; - page_count = exp_res; - } - sdl_wheel = 0; - uih = 1; - } - - tp = -1; - if(is_p1) - { - drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); - for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) - for(gi=0; giTAG_MAX || !tag_names[pos]) - break; - if(tag_votes[0]) - i = 127+(128*tag_votes[pos])/tag_votes[0]; - else - i = 192; - w = textwidth(tag_names[pos]); - if(w>XRES/GRID_X-5) - w = XRES/GRID_X-5; - gx = (XRES/GRID_X)*gi; - gy = gj*14 + 46; - if(mx>=gx && mx=gy && my XRES/GRID_X-10) - { - tmp = malloc(strlen(search_names[pos])+4); - strcpy(tmp, search_names[pos]); - j = textwidthx(tmp, XRES/GRID_X-15); - strcpy(tmp+j, "..."); - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); - free(tmp); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); - j = textwidth(search_owners[pos]); - if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && - my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) - { - st = 1; - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); - if(search_thumbs[pos]&&thumb_drawn[pos]==0) - { - render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); - thumb_drawn[pos] = 1; - } - own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); - if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) - mp = pos; - if(own) - { - if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) - { - mp = -1; - dp = pos; - } - } - if(mp==pos && !st) - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); - else - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); - if(own) - { - if(dp == pos) - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); - else - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); - } - if(!search_publish[pos]) - { - drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); - drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); - } - if(view_own || svf_admin || svf_mod) - { - sprintf(ts+1, "%d", search_votes[pos]); - ts[0] = 0xBB; - for(j=1; ts[j]; j++) - ts[j] = 0xBC; - ts[j-1] = 0xB9; - ts[j] = 0xBA; - ts[j+1] = 0; - w = gx+XRES/GRID_S-2-textwidth(ts); - h = gy+YRES/GRID_S-11; - drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); - for(j=0; ts[j]; j++) - ts[j] -= 14; - drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); - sprintf(ts, "%d", search_votes[pos]); - for(j=0; ts[j]; j++) - ts[j] += 127; - drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); - } - if(search_scoreup[pos]>0||search_scoredown[pos]>0) - { - lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); - - if(((YRES/GRID_S+3)/2)>lv) - { - ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); - if(lv<8) - { - ry = ry/(8-lv); - } - nyu = search_scoreup[pos]*ry; - nyd = search_scoredown[pos]*ry; - } - else - { - ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); - nyu = search_scoreup[pos]/ry; - nyd = search_scoredown[pos]/ry; - } - - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); - - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); - } - } - - if(mp!=-1 && mmt>=TIMEOUT/5 && !st) - { - gi = mp % GRID_X; - gj = mp / GRID_X; - if(is_p1) - gj += GRID_Y-GRID_P; - gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; - gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; - i = w = textwidth(search_names[mp]); - h = YRES/GRID_Z+30; - if(w=XRES-2) gx=XRES-3-w; - if(gy<32) gy=32; - if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; - clearrect(vid_buf, gx-2, gy-3, w+4, h); - drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); - if(search_thumbs[mp]) - render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); - drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); - drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); - } - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(sdl_key==SDLK_RETURN) - { - if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) - lasttime = TIMEOUT; - else if(search_ids[0] && !search_ids[1]) - { - bq = 0; - b = 1; - mp = 0; - } - } - if(sdl_key==SDLK_ESCAPE) - goto finish; - - if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) - { - search_own = !search_own; - lasttime = TIMEOUT; - } - if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) - { - search_date = !search_date; - lasttime = TIMEOUT; - } - - if(b && !bq && dp!=-1) - if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) - { - execute_delete(vid_buf, search_ids[dp]); - lasttime = TIMEOUT; - if(last) - { - free(last); - last = NULL; - } - } - - if(b && !bq && tp!=-1) - { - strncpy(ed.str, tag_names[tp], 255); - lasttime = TIMEOUT; - } - - if(b && !bq && mp!=-1 && st) - { - sprintf(ed.str, "user:%s", search_owners[mp]); - lasttime = TIMEOUT; - } - - if(do_open==1) - { - mp = 0; - } - - if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) - { - fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); - info_box(vid_buf, "Loading..."); - - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - data = http_simple_get(uri, &status, &dlen); - free(uri); - - if(status == 200) - { - status = parse_save(data, dlen, 1, 0, 0); - switch(status) - { - case 1: - error_ui(vid_buf, 0, "Simulation corrupted"); - break; - case 2: - error_ui(vid_buf, 0, "Simulation from a newer version"); - break; - case 3: - error_ui(vid_buf, 0, "Simulation on a too large grid"); - break; - } - if(!status) - { - char *tnames[] = {"ID", NULL}; - char *tparts[1]; - int tplens[1]; - if(svf_last) - free(svf_last); - svf_last = data; - svf_lsize = dlen; - - tparts[0] = search_ids[mp]; - tplens[0] = strlen(search_ids[mp]); - data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); - - svf_open = 1; - svf_own = svf_login && !strcmp(search_owners[mp], svf_user); - svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); - - strcpy(svf_id, search_ids[mp]); - strcpy(svf_name, search_names[mp]); - if(status == 200) - { - if(data) - { - strncpy(svf_tags, data, 255); - svf_tags[255] = 0; - } - else - svf_tags[0] = 0; - } - else - { - svf_tags[0] = 0; - } - - if(svf_login) - { - char *names[] = {"ID", NULL}; - char *parts[1]; - parts[0] = search_ids[mp]; - data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); - if(status == 200) - { - if(data) - { - if(!strcmp(data, "Up")) - { - svf_myvote = 1; - } - else if(!strcmp(data, "Down")) - { - svf_myvote = -1; - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - } - else - { - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - } - } - else - error_ui(vid_buf, status, http_ret_text(status)); - - if(data) - free(data); - goto finish; - } - - if(!last) - { - search = 1; - } - else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) - { - search = 1; - if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) - { - search_page = 0; - page_count = 0; - } - free(last); - last = NULL; - } - else - search = 0; - - if(search && lasttime>=TIMEOUT) - { - lasttime = 0; - last = mystrdup(ed.str); - last_own = search_own; - last_date = search_date; - last_page = search_page; - active = 1; - uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); - if(search_own || svf_admin || svf_mod) - tmp = "&ShowVotes=true"; - else - tmp = ""; - if(!search_own && !search_date && !*last) - { - if(search_page) - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); - } - else - { - exp_res = GRID_X*GRID_P; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); - } - } - else - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); - } - strcaturl(uri, last); - if(search_own) - { - strcaturl(uri, " user:"); - strcaturl(uri, svf_user); - } - if(search_date) - strcaturl(uri, " sort:date"); - - http = http_async_req_start(http, uri, NULL, 0, 1); - if(svf_login) - { - http_auth_headers(http, svf_user, svf_pass); - } - http_last_use = time(NULL); - free(uri); - } - - if(active && http_async_req_status(http)) - { - http_last_use = time(NULL); - results = http_async_req_stop(http, &status, NULL); - view_own = last_own; - if(status == 200) - { - page_count = search_results(results, last_own||svf_admin||svf_mod); - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - } - is_p1 = (exp_res < GRID_X*GRID_Y); - free(results); - active = 0; - } - - if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) - { - http_async_req_close(http); - http = NULL; - } - - for(i=0; i> 8; - fwrite(lb, 2, 1, f); - fwrite(str, li, 1, f); -} - -int load_string(FILE *f, char *str, int max) -{ - int li; - unsigned char lb[2]; - fread(lb, 2, 1, f); - li = lb[0] | (lb[1] << 8); - if(li > max) - { - str[0] = 0; - return 1; - } - fread(str, li, 1, f); - str[li] = 0; - return 0; -} +char http_proxy_string[256] = ""; unsigned char last_major=0, last_minor=0, update_flag=0; -void save_presets(int do_update) -{ - FILE *f=fopen("powder.def", "wb"); - unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; - unsigned char tmp = sdl_scale; - if(!f) - return; - fwrite(sig, 1, 4, f); - save_string(f, svf_user); - save_string(f, svf_pass); - fwrite(&tmp, 1, 1, f); - tmp = cmode; - fwrite(&tmp, 1, 1, f); - tmp = svf_admin; - fwrite(&tmp, 1, 1, f); - tmp = svf_mod; - fwrite(&tmp, 1, 1, f); - save_string(f, http_proxy); - tmp = SAVE_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = MINOR_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = do_update; - fwrite(&tmp, 1, 1, f); - fclose(f); -} - -void load_presets(void) -{ - FILE *f=fopen("powder.def", "rb"); - unsigned char sig[4], tmp; - if(!f) - return; - fread(sig, 1, 4, f); - if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) - { - if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) - { - if(fseek(f, -3, SEEK_END)) - { - remove("powder.def"); - return; - } - if(fread(sig, 1, 3, f) != 3) - { - remove("powder.def"); - goto fail; - } - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; - } - fclose(f); - remove("powder.def"); - return; - } - if(load_string(f, svf_user, 63)) - goto fail; - if(load_string(f, svf_pass, 63)) - goto fail; - svf_login = !!svf_user[0]; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - sdl_scale = (tmp == 2) ? 2 : 1; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - cmode = tmp%7; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_admin = tmp; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_mod = tmp; - if(load_string(f, http_proxy, 255)) - goto fail; - if(fread(sig, 1, 3, f) != 3) - goto fail; - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; -fail: - fclose(f); -} - -void dim_copy(pixel *dst, pixel *src) -{ - int i,r,g,b; - for(i=0; i0) - r--; - if(g>0) - g--; - if(b>0) - b--; - dst[i] = PIXRGB(r,g,b); - } -} - -int zoom_en = 0; -int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; -int zoom_wx=0, zoom_wy=0; -void render_zoom(pixel *img) -{ - int x, y, i, j; - pixel pix; - drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); - drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); - clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); - for(j=0; j #include #include #include "misc.h" +#include "defines.h" +#include "interface.h" +#include "graphics.h" //Signum function #ifdef WIN32 @@ -80,4 +84,114 @@ void strlist_free(struct strlist **list) *list = (*list)->next; free(item); } +} + +void save_presets(int do_update) +{ + FILE *f=fopen("powder.def", "wb"); + unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; + unsigned char tmp = sdl_scale; + if(!f) + return; + fwrite(sig, 1, 4, f); + save_string(f, svf_user); + save_string(f, svf_pass); + fwrite(&tmp, 1, 1, f); + tmp = cmode; + fwrite(&tmp, 1, 1, f); + tmp = svf_admin; + fwrite(&tmp, 1, 1, f); + tmp = svf_mod; + fwrite(&tmp, 1, 1, f); + save_string(f, http_proxy_string); + tmp = SAVE_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = MINOR_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = do_update; + fwrite(&tmp, 1, 1, f); + fclose(f); +} + +void load_presets(void) +{ + FILE *f=fopen("powder.def", "rb"); + unsigned char sig[4], tmp; + if(!f) + return; + fread(sig, 1, 4, f); + if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) + { + if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) + { + if(fseek(f, -3, SEEK_END)) + { + remove("powder.def"); + return; + } + if(fread(sig, 1, 3, f) != 3) + { + remove("powder.def"); + goto fail; + } + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; + } + fclose(f); + remove("powder.def"); + return; + } + if(load_string(f, svf_user, 63)) + goto fail; + if(load_string(f, svf_pass, 63)) + goto fail; + svf_login = !!svf_user[0]; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + sdl_scale = (tmp == 2) ? 2 : 1; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + cmode = tmp%7; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_admin = tmp; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_mod = tmp; + if(load_string(f, http_proxy_string, 255)) + goto fail; + if(fread(sig, 1, 3, f) != 3) + goto fail; + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; +fail: + fclose(f); +} + +void save_string(FILE *f, char *str) +{ + int li = strlen(str); + unsigned char lb[2]; + lb[0] = li; + lb[1] = li >> 8; + fwrite(lb, 2, 1, f); + fwrite(str, li, 1, f); +} + +int load_string(FILE *f, char *str, int max) +{ + int li; + unsigned char lb[2]; + fread(lb, 2, 1, f); + li = lb[0] | (lb[1] << 8); + if(li > max) + { + str[0] = 0; + return 1; + } + fread(str, li, 1, f); + str[li] = 0; + return 0; } \ No newline at end of file diff --git a/misc.h b/misc.h index e279093..dbc2b84 100644 --- a/misc.h +++ b/misc.h @@ -1,5 +1,7 @@ #ifndef UTILS_H #define UTILS_H +#include +#include //Signum function #ifdef WIN32 @@ -34,4 +36,12 @@ int strlist_find(struct strlist **list, char *str); void strlist_free(struct strlist **list); +void save_presets(int do_update); + +void load_presets(void); + +void save_string(FILE *f, char *str); + +int load_string(FILE *f, char *str, int max); + #endif \ No newline at end of file diff --git a/version.h b/version.h index 4f37911..41e9672 100755 --- a/version.h +++ b/version.h @@ -20,8 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define SAVE_VERSION 41 -#define MINOR_VERSION 3 -#define IDENT_VERSION "S" //Change this if you're not Simon! It should be a single letter. + #endif -- cgit v0.9.2-21-gd62e From 75d3e18fbfb3dfb8f757cbe3d36d5953c2621956 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 29 Aug 2010 15:37:22 +0100 Subject: Rendering bugfixes, added Thermite diff --git a/graphics.c b/graphics.c index c058d43..ba13d95 100644 --- a/graphics.c +++ b/graphics.c @@ -1112,8 +1112,10 @@ void draw_parts(pixel *vid) float mv, dx, dy, ix, iy, lx, ly, d, pp; float pt = R_TEMP; for(i = 0; i0) + { + parts[i].tmp--; + parts[i].temp = 3500; + } } pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); } @@ -938,7 +948,6 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - //PLANT else if(t==PT_PLNT) { for(nx=-2; nx<3; nx++) @@ -963,6 +972,34 @@ void update_particles_i(pixel *vid, int start, int inc) //t = parts[i].type = PT_WATR; } } + else if(t==PT_THRM) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA)) + { + if(1>(rand()%500)){ + t = parts[i].type = PT_LAVA; + parts[i].ctype = PT_BMTL; + pt = parts[i].temp = 3500.0f; + pv[y/CELL][x/CELL] += 50.0f; + } else { + t = parts[i].type = PT_LAVA; + parts[i].life = 400; + parts[i].ctype = PT_THRM; + pt = parts[i].temp = 3500.0f; + parts[i].tmp = 20; + } + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } else if(t==PT_WATR||t==PT_DSTW) { for(nx=-2; nx<3; nx++) diff --git a/powder.h b/powder.h index a12c37a..18ce896 100644 --- a/powder.h +++ b/powder.h @@ -104,7 +104,8 @@ #define PT_INWR 63 #define PT_YEST 64 #define PT_DYST 65 -#define PT_NUM 66 +#define PT_THRM 66 +#define PT_NUM 67 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -130,6 +131,7 @@ struct particle float temp; float pavg[2]; int flags; + int tmp; }; typedef struct particle particle; @@ -242,6 +244,7 @@ static part_type ptypes[PT_NUM] = {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Yeast, grows when warm (~37C)."}, {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f, 70, "Deat Yeast."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f, 211, "Thermite."}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; @@ -306,14 +309,15 @@ static part_state pstates[PT_NUM] = /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OIL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OIL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 62.0f}, /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, -180.0f, PT_NONE, 0.0f}, /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, -190.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 60.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static unsigned char can_move[PT_NUM][PT_NUM] = { @@ -325,72 +329,73 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X W S*/ /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l R T*/ -/* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ -/* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* Dust */ -/* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0}, /* Watr */ -/* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,1,0}, /* Brml */ /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y*/ /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X W S*/ -- cgit v0.9.2-21-gd62e From cf85eabee95be1e4947935183d1366cba6f42245 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 1 Sep 2010 11:40:29 +0100 Subject: Fixed zoom, removed plastic, fixed oil, more moving around. Experimental Neutron behaviour diff --git a/defines.h b/defines.h index 7a14da2..c38de16 100644 --- a/defines.h +++ b/defines.h @@ -32,8 +32,8 @@ #define ZSIZE_D 16 #define ZFACTOR_D 8 -static unsigned char ZFACTOR = 256/ZSIZE_D; -static unsigned char ZSIZE = ZSIZE_D; +extern unsigned char ZFACTOR; +extern unsigned char ZSIZE; #define CELL 4 #define ISTP (CELL/2) @@ -63,6 +63,8 @@ typedef unsigned int pixel; typedef unsigned char uint8; +extern int amd; + extern int legacy_enable; extern int sys_pause; @@ -101,4 +103,13 @@ extern unsigned char last_major, last_minor, update_flag; extern char http_proxy_string[256]; +//Functions in main.c +void thumb_cache_inval(char *id); +void thumb_cache_add(char *id, void *thumb, int size); +int thumb_cache_find(char *id, void **thumb, int *size); +void *build_thumb(int *size, int bzip2); +void *build_save(int *size, int x0, int y0, int w, int h); +int parse_save(void *save, int size, int replace, int x0, int y0); +void del_stamp(int d); +void sdl_seticon(void); #endif \ No newline at end of file diff --git a/graphics.c b/graphics.c index ba13d95..fa742be 100644 --- a/graphics.c +++ b/graphics.c @@ -1108,8 +1108,8 @@ void xor_rect(pixel *vid, int x, int y, int w, int h) void draw_parts(pixel *vid) { - int i, j, x, y, t, nx, ny, r, a, cr,cg,cb, s, rt, fe, nt, lpv, nearp, pavg; - float mv, dx, dy, ix, iy, lx, ly, d, pp; + int i, x, y, t, nx, ny, r, s; + int cr, cg, cb; float pt = R_TEMP; for(i = 0; iSAVE_VERSION) + return NULL; + + bw = c[6]; + bh = c[7]; + w = bw*CELL; + h = bh*CELL; + + if(c[5]!=CELL) + return NULL; + + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return NULL; + fb = calloc(w*h, PIXELSIZE); + if(!fb) + { + free(d); + return NULL; + } + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + goto corrupt; + size = i; + + if(size < bw*bh) + goto corrupt; + + k = 0; + for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) + goto corrupt; + + for(y=0; y= size) + goto corrupt; + j=d[p++]; + if(j0) + { + if(j==PT_STKM) //Stickman should be drawed another way + { + //Stickman drawing + for(k=-2; k<=1; k++) + { + fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); + fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); + fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); + fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); + } + draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); + draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); + draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); + draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); + } + else + fb[y*w+x] = ptypes[j].pcolors; + } + } + + free(d); + *width = w; + *height = h; + return fb; + +corrupt: + free(d); + free(fb); + return NULL; +} + +int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl) +{ + unsigned char *d,*c=thumb; + int i,j,x,y,a,t,r,g,b,sx,sy; + + if(bzip2) + { + if(size<16) + return 1; + if(c[3]!=0x74 || c[2]!=0x49 || c[1]!=0x68 || c[0]!=0x53) + return 1; + if(c[4]>PT_NUM) + return 2; + if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) + return 3; + i = XRES*YRES; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) + return 1; + size = i; + } + else + d = c; + + if(size < XRES*YRES) + { + if(bzip2) + free(d); + return 1; + } + + sy = 0; + for(y=0; y+scl<=YRES; y+=scl) + { + sx = 0; + for(x=0; x+scl<=XRES; x+=scl) + { + a = 0; + r = g = b = 0; + for(j=0; j=PT_NUM) + goto corrupt; + r += PIXR(ptypes[t].pcolors); + g += PIXG(ptypes[t].pcolors); + b += PIXB(ptypes[t].pcolors); + a ++; + } + } + if(a) + { + a = 256/a; + r = (r*a)>>8; + g = (g*a)>>8; + b = (b*a)>>8; + } + + drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); + sx++; + } + sy++; + } + + if(bzip2) + free(d); + return 0; + +corrupt: + if(bzip2) + free(d); + return 1; +} + +void render_cursor(pixel *vid, int x, int y, int t, int r) +{ + int i,j,c; + if(tr*r || i*i+(j+1)*(j+1)>r*r)) + { + xor_pixel(x+i, y+j, vid); + if(j) xor_pixel(x+i, y-j, vid); + if(i) xor_pixel(x-i, y+j, vid); + if(i&&j) xor_pixel(x-i, y-j, vid); + } + } + else + { + int tc; + c = (r/CELL) * CELL; + x = (x/CELL) * CELL; + y = (y/CELL) * CELL; + + tc = !((c%(CELL*2))==0); + + x -= c/2; + y -= c/2; + + x += tc*(CELL/2); + y += tc*(CELL/2); + + for(i=0; i #include #include +#include #include "http.h" #include "md5.h" #include "font.h" @@ -56,6 +57,8 @@ int Z_keysym = 'z'; int zoom_en = 0; int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; int zoom_wx=0, zoom_wy=0; +unsigned char ZFACTOR = 256/ZSIZE_D; +unsigned char ZSIZE = ZSIZE_D; void menu_count(void) { @@ -2427,4 +2430,393 @@ finish: strcpy(search_expr, ed.str); return 0; +} + +int search_results(char *str, int votes) +{ + int i,j; + char *p,*q,*r,*s,*vu,*vd,*pu; + + for(i=0; i=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+5); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + else if(!strncmp(str, "TAG ", 4)) + { + if(j >= TAG_MAX) + { + str = p; + continue; + } + q = strchr(str+4, ' '); + if(!q) + { + str = p; + continue; + } + *(q++) = 0; + tag_names[j] = mystrdup(str+4); + tag_votes[j] = atoi(q); + j++; + } + else + { + if(i>=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + str = p; + } + if(*str) + i++; + return i; +} + +int execute_tagop(pixel *vid_buf, char *op, char *tag) +{ + int status; + char *result; + + char *names[] = {"ID", "Tag", NULL}; + char *parts[2]; + + char *uri = malloc(strlen(SERVER)+strlen(op)+36); + sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); + + parts[0] = svf_id; + parts[1] = tag; + + result = http_multipart_post( + uri, + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + free(uri); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 1; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 1; + } + + if(result[2]) + { + strncpy(svf_tags, result+3, 255); + svf_id[15] = 0; + } + + if(result) + free(result); + + return 0; +} + +void execute_save(pixel *vid_buf) +{ + int status; + char *result; + + char *names[] = {"Name", "Data:save.bin", "Thumb:thumb.bin", "Publish", "ID", NULL}; + char *parts[5]; + int plens[5]; + + parts[0] = svf_name; + plens[0] = strlen(svf_name); + parts[1] = build_save(plens+1, 0, 0, XRES, YRES); + parts[2] = build_thumb(plens+2, 1); + parts[3] = (svf_publish==1)?"Public":"Private"; + plens[3] = strlen((svf_publish==1)?"Public":"Private"); + + if(svf_id[0]) + { + parts[4] = svf_id; + plens[4] = strlen(svf_id); + } + else + names[4] = NULL; + + result = http_multipart_post( + "http://" SERVER "/Save.api", + names, parts, plens, + svf_user, svf_pass, + &status, NULL); + + if(svf_last) + free(svf_last); + svf_last = parts[1]; + svf_lsize = plens[1]; + + free(parts[2]); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result[2]) + { + strncpy(svf_id, result+3, 15); + svf_id[15] = 0; + } + + if(!svf_id[0]) + { + error_ui(vid_buf, 0, "No ID supplied by server"); + free(result); + return; + } + + thumb_cache_inval(svf_id); + + svf_own = 1; + if(result) + free(result); +} + +void execute_delete(pixel *vid_buf, char *id) +{ + int status; + char *result; + + char *names[] = {"ID", NULL}; + char *parts[1]; + + parts[0] = id; + + result = http_multipart_post( + "http://" SERVER "/Delete.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result) + free(result); +} + +int execute_vote(pixel *vid_buf, char *id, char *action) +{ + int status; + char *result; + + char *names[] = {"ID", "Action", NULL}; + char *parts[2]; + + parts[0] = id; + parts[1] = action; + + result = http_multipart_post( + "http://" SERVER "/Vote.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 0; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 0; + } + + if(result) + free(result); + return 1; } \ No newline at end of file diff --git a/interface.h b/interface.h index 76536eb..7910c66 100644 --- a/interface.h +++ b/interface.h @@ -168,5 +168,15 @@ char *download_ui(pixel *vid_buf, char *uri, int *len); int search_ui(pixel *vid_buf); +int search_results(char *str, int votes); + +int execute_tagop(pixel *vid_buf, char *op, char *tag); + +void execute_save(pixel *vid_buf); + +void execute_delete(pixel *vid_buf, char *id); + +int execute_vote(pixel *vid_buf, char *id, char *action); + #endif diff --git a/main.c b/main.c index 1d818a8..7d20ff2 100644 --- a/main.c +++ b/main.c @@ -102,10 +102,6 @@ int amd = 1; sign signs[MAXSIGNS]; -/*********************************************************** - * AIR FLOW SIMULATOR * - ***********************************************************/ - int numCores = 4; int core_count() @@ -133,18 +129,8 @@ int core_count() return numCPU; } -/*********************************************************** - * PARTICLE SIMULATOR * - ***********************************************************/ int mousex, mousey = 0; //They contain mouse position - - - -/*********************************************************** - * SDL OUTPUT * - ***********************************************************/ - void sdl_seticon(void) { #ifdef WIN32 @@ -161,30 +147,6 @@ void sdl_seticon(void) #endif } -void sdl_open(void) -{ - if(SDL_Init(SDL_INIT_VIDEO)<0) - { - fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError()); - exit(1); - } - atexit(SDL_Quit); -#ifdef PIX16 - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_SWSURFACE); -#else - sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_SWSURFACE); -#endif - if(!sdl_scrn) - { - fprintf(stderr, "Creating window: %s\n", SDL_GetError()); - exit(1); - } - SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); - sdl_seticon(); - SDL_EnableUNICODE(1); - //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); -} - int frame_idx=0; void dump_frame(pixel *src, int w, int h, int pitch) { @@ -265,93 +227,6 @@ void *build_thumb(int *size, int bzip2) return d; } -int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl) -{ - unsigned char *d,*c=thumb; - int i,j,x,y,a,t,r,g,b,sx,sy; - - if(bzip2) - { - if(size<16) - return 1; - if(c[3]!=0x74 || c[2]!=0x49 || c[1]!=0x68 || c[0]!=0x53) - return 1; - if(c[4]>PT_NUM) - return 2; - if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) - return 3; - i = XRES*YRES; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) - return 1; - size = i; - } - else - d = c; - - if(size < XRES*YRES) - { - if(bzip2) - free(d); - return 1; - } - - sy = 0; - for(y=0; y+scl<=YRES; y+=scl) - { - sx = 0; - for(x=0; x+scl<=XRES; x+=scl) - { - a = 0; - r = g = b = 0; - for(j=0; j=PT_NUM) - goto corrupt; - r += PIXR(ptypes[t].pcolors); - g += PIXG(ptypes[t].pcolors); - b += PIXB(ptypes[t].pcolors); - a ++; - } - } - if(a) - { - a = 256/a; - r = (r*a)>>8; - g = (g*a)>>8; - b = (b*a)>>8; - } - - drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); - sx++; - } - sy++; - } - - if(bzip2) - free(d); - return 0; - -corrupt: - if(bzip2) - free(d); - return 1; -} - void *build_save(int *size, int x0, int y0, int w, int h) { unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; @@ -788,144 +663,6 @@ corrupt: return 1; } -pixel *prerender_save(void *save, int size, int *width, int *height) -{ - unsigned char *d,*c=save; - int i,j,k,x,y,rx,ry,p=0; - int bw,bh,w,h; - pixel *fb; - - if(size<16) - return NULL; - if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) - return NULL; - if(c[4]>SAVE_VERSION) - return NULL; - - bw = c[6]; - bh = c[7]; - w = bw*CELL; - h = bh*CELL; - - if(c[5]!=CELL) - return NULL; - - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return NULL; - fb = calloc(w*h, PIXELSIZE); - if(!fb) - { - free(d); - return NULL; - } - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - goto corrupt; - size = i; - - if(size < bw*bh) - goto corrupt; - - k = 0; - for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) - goto corrupt; - - for(y=0; y= size) - goto corrupt; - j=d[p++]; - if(j0) - { - if(j==PT_STKM) //Stickman should be drawed another way - { - //Stickman drawing - for(k=-2; k<=1; k++) - { - fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); - fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); - fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); - fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); - } - draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); - draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); - draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); - draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); - } - else - fb[y*w+x] = ptypes[j].pcolors; - } - } - - free(d); - *width = w; - *height = h; - return fb; - -corrupt: - free(d); - free(fb); - return NULL; -} - // stamps library stamp stamps[STAMP_MAX];//[STAMP_X*STAMP_Y]; @@ -948,27 +685,6 @@ void stamp_gen_name(char *fn) sprintf(fn, "%08x%02x", last_time, last_name); } -void *file_load(char *fn, int *size) -{ - FILE *f = fopen(fn, "rb"); - void *s; - - if(!f) - return NULL; - fseek(f, 0, SEEK_END); - *size = ftell(f); - fseek(f, 0, SEEK_SET); - s = malloc(*size); - if(!s) - { - fclose(f); - return NULL; - } - fread(s, *size, 1, f); - fclose(f); - return s; -} - void stamp_update(void) { FILE *f; @@ -1118,222 +834,8 @@ void del_stamp(int d) stamp_init(); } -int execute_tagop(pixel *vid_buf, char *op, char *tag) -{ - int status; - char *result; - - char *names[] = {"ID", "Tag", NULL}; - char *parts[2]; - - char *uri = malloc(strlen(SERVER)+strlen(op)+36); - sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); - - parts[0] = svf_id; - parts[1] = tag; - - result = http_multipart_post( - uri, - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - free(uri); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 1; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 1; - } - - if(result[2]) - { - strncpy(svf_tags, result+3, 255); - svf_id[15] = 0; - } - - if(result) - free(result); - - return 0; -} - void thumb_cache_inval(char *id); -void execute_save(pixel *vid_buf) -{ - int status; - char *result; - - char *names[] = {"Name", "Data:save.bin", "Thumb:thumb.bin", "Publish", "ID", NULL}; - char *parts[5]; - int plens[5]; - - parts[0] = svf_name; - plens[0] = strlen(svf_name); - parts[1] = build_save(plens+1, 0, 0, XRES, YRES); - parts[2] = build_thumb(plens+2, 1); - parts[3] = (svf_publish==1)?"Public":"Private"; - plens[3] = strlen((svf_publish==1)?"Public":"Private"); - - if(svf_id[0]) - { - parts[4] = svf_id; - plens[4] = strlen(svf_id); - } - else - names[4] = NULL; - - result = http_multipart_post( - "http://" SERVER "/Save.api", - names, parts, plens, - svf_user, svf_pass, - &status, NULL); - - if(svf_last) - free(svf_last); - svf_last = parts[1]; - svf_lsize = plens[1]; - - free(parts[2]); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return; - } - - if(result[2]) - { - strncpy(svf_id, result+3, 15); - svf_id[15] = 0; - } - - if(!svf_id[0]) - { - error_ui(vid_buf, 0, "No ID supplied by server"); - free(result); - return; - } - - thumb_cache_inval(svf_id); - - svf_own = 1; - if(result) - free(result); -} - -void execute_delete(pixel *vid_buf, char *id) -{ - int status; - char *result; - - char *names[] = {"ID", NULL}; - char *parts[1]; - - parts[0] = id; - - result = http_multipart_post( - "http://" SERVER "/Delete.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return; - } - - if(result) - free(result); -} - -int execute_vote(pixel *vid_buf, char *id, char *action) -{ - int status; - char *result; - - char *names[] = {"ID", "Action", NULL}; - char *parts[2]; - - parts[0] = id; - parts[1] = action; - - result = http_multipart_post( - "http://" SERVER "/Vote.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 0; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 0; - } - - if(result) - free(result); - return 1; -} - -static char hex[] = "0123456789ABCDEF"; - -void strcaturl(char *dst, char *src) -{ - char *d; - unsigned char *s; - - for(d=dst; *d; d++) ; - - for(s=(unsigned char *)src; *s; s++) - { - if((*s>='0' && *s<='9') || - (*s>='a' && *s<='z') || - (*s>='A' && *s<='Z')) - *(d++) = *s; - else - { - *(d++) = '%'; - *(d++) = hex[*s>>4]; - *(d++) = hex[*s&15]; - } - } - *d = 0; -} - char *thumb_cache_id[THUMB_CACHE_SIZE]; void *thumb_cache_data[THUMB_CACHE_SIZE]; int thumb_cache_size[THUMB_CACHE_SIZE]; @@ -1399,309 +901,10 @@ int thumb_cache_find(char *id, void **thumb, int *size) return 1; } -int search_results(char *str, int votes) -{ - int i,j; - char *p,*q,*r,*s,*vu,*vd,*pu; - - for(i=0; i=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str+5); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - else if(!strncmp(str, "TAG ", 4)) - { - if(j >= TAG_MAX) - { - str = p; - continue; - } - q = strchr(str+4, ' '); - if(!q) - { - str = p; - continue; - } - *(q++) = 0; - tag_names[j] = mystrdup(str+4); - tag_votes[j] = atoi(q); - j++; - } - else - { - if(i>=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - str = p; - } - if(*str) - i++; - return i; -} - -/*********************************************************** - * MESSAGE SIGNS * - ***********************************************************/ - -/*********************************************************** - * CONFIG FILE * - ***********************************************************/ - char http_proxy_string[256] = ""; unsigned char last_major=0, last_minor=0, update_flag=0; -void render_cursor(pixel *vid, int x, int y, int t, int r) -{ - int i,j,c; - if(tr*r || i*i+(j+1)*(j+1)>r*r)) - { - xor_pixel(x+i, y+j, vid); - if(j) xor_pixel(x+i, y-j, vid); - if(i) xor_pixel(x-i, y+j, vid); - if(i&&j) xor_pixel(x-i, y-j, vid); - } - } - else - { - int tc; - c = (r/CELL) * CELL; - x = (x/CELL) * CELL; - y = (y/CELL) * CELL; - - tc = !((c%(CELL*2))==0); - - x -= c/2; - y -= c/2; - - x += tc*(CELL/2); - y += tc*(CELL/2); - - for(i=0; i='0' && *s<='9') || + (*s>='a' && *s<='z') || + (*s>='A' && *s<='Z')) + *(d++) = *s; + else + { + *(d++) = '%'; + *(d++) = hex[*s>>4]; + *(d++) = hex[*s&15]; + } + } + *d = 0; +} + +void *file_load(char *fn, int *size) +{ + FILE *f = fopen(fn, "rb"); + void *s; + + if(!f) + return NULL; + fseek(f, 0, SEEK_END); + *size = ftell(f); + fseek(f, 0, SEEK_SET); + s = malloc(*size); + if(!s) + { + fclose(f); + return NULL; + } + fread(s, *size, 1, f); + fclose(f); + return s; +} + +int cpu_check(void) +{ +#ifdef MACOSX + return 0; +#else +#ifdef X86 + unsigned af,bf,cf,df; + x86_cpuid(0, af, bf, cf, df); + if(bf==0x68747541 && cf==0x444D4163 && df==0x69746E65) + amd = 1; + x86_cpuid(1, af, bf, cf, df); +#ifdef X86_SSE + if(!(df&(1<<25))) + return 1; +#endif +#ifdef X86_SSE2 + if(!(df&(1<<26))) + return 1; +#endif +#ifdef X86_SSE3 + if(!(cf&1)) + return 1; +#endif +#endif +#endif + return 0; } \ No newline at end of file diff --git a/misc.h b/misc.h index dbc2b84..106d216 100644 --- a/misc.h +++ b/misc.h @@ -3,6 +3,23 @@ #include #include +#ifdef WIN32 +#define x86_cpuid(func,af,bf,cf,df) \ + do {\ + __asm mov eax, func\ + __asm cpuid\ + __asm mov af, eax\ + __asm mov bf, ebx\ + __asm mov cf, ecx\ + __asm mov df, edx\ + } while(0) +#else +#define x86_cpuid(func,af,bf,cf,df) \ +__asm__ __volatile ("cpuid":\ + "=a" (af), "=b" (bf), "=c" (cf), "=d" (df) : "a" (func)); +#endif + +static char hex[] = "0123456789ABCDEF"; //Signum function #ifdef WIN32 extern _inline int isign(float i); @@ -44,4 +61,10 @@ void save_string(FILE *f, char *str); int load_string(FILE *f, char *str, int max); +void strcaturl(char *dst, char *src); + +void *file_load(char *fn, int *size); + +int cpu_check(void); + #endif \ No newline at end of file diff --git a/powder.c b/powder.c index 9b489a1..706c962 100644 --- a/powder.c +++ b/powder.c @@ -454,7 +454,7 @@ int nearest_part(int ci, int t) void update_particles_i(pixel *vid, int start, int inc) { - int i, j, x, y, t, nx, ny, r, a, cr,cg,cb, s, rt, fe, nt, lpv, nearp, pavg; + int i, j, x, y, t, nx, ny, r, a, s, rt, fe, nt, lpv, nearp, pavg; float mv, dx, dy, ix, iy, lx, ly, d, pp; float pt = R_TEMP; float c_heat = 0.0f; @@ -574,14 +574,8 @@ void update_particles_i(pixel *vid, int start, int inc) } else { - if(t==PT_PLAS && pv[y/CELL][x/CELL]>25.0f) - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - } else { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; } if(ptypes[t].diffusion) @@ -1170,7 +1164,7 @@ void update_particles_i(pixel *vid, int start, int inc) pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough fe ++; } - if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + /*if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) parts[r>>8].type = PT_DUST; if((r&0xFF)==PT_DYST && 15>(rand()%1000)) parts[r>>8].type = PT_YEST; @@ -1187,16 +1181,14 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_GOO; if((r&0xFF)==PT_NITR && 15>(rand()%1000)) parts[r>>8].type = PT_DESL; - if((r&0xFF)==PT_OIL && 5>(rand()%1000)) - parts[r>>8].type = PT_PLAS; if((r&0xFF)==PT_PLNT && 5>(rand()%100)) parts[r>>8].type = PT_WOOD; - if((r&0xFF)==PT_PLAS && 5>(rand()%1000)) - parts[r>>8].type = PT_OIL; if((r&0xFF)==PT_DESL && 15>(rand()%1000)) parts[r>>8].type = PT_GAS; if((r&0xFF)==PT_COAL && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; + parts[r>>8].type = PT_WOOD;*/ + if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && 15>(rand()%1000)) + parts[r>>8].type--; } } else if(t==PT_PHOT) diff --git a/powder.h b/powder.h index 18ce896..34f623f 100644 --- a/powder.h +++ b/powder.h @@ -96,16 +96,15 @@ #define PT_STKM 55 #define PT_SWCH 56 #define PT_SMKE 57 -#define PT_PLAS 58 -#define PT_DESL 59 -#define PT_COAL 60 -#define PT_LO2 61 -#define PT_O2 62 -#define PT_INWR 63 -#define PT_YEST 64 -#define PT_DYST 65 -#define PT_THRM 66 -#define PT_NUM 67 +#define PT_DESL 58 +#define PT_COAL 59 +#define PT_LO2 60 +#define PT_O2 61 +#define PT_INWR 62 +#define PT_YEST 63 +#define PT_DYST 64 +#define PT_THRM 65 +#define PT_NUM 66 #define R_TEMP 22 #define MAX_TEMP 3500 @@ -233,11 +232,10 @@ static part_type ptypes[PT_NUM] = {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Generates Electricity."}, {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0X000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, + {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, - {"PLAS", PIXPACK(0x444444), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.0f * CFDS, 0, 0, 0, 1, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms under really high pressure."}, - {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0.01f, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f, 200, "Solid. Burns slowly."}, {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 5.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Oxygen helps make things burn."}, @@ -254,7 +252,7 @@ static part_state pstates[PT_NUM] = /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WATR */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, - /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 60.0f, PT_NONE, 0.0f}, /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2500.0f}, /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 710.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* LAVA */ {ST_LIQUID, PT_STNE, 700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -268,7 +266,7 @@ static part_state pstates[PT_NUM] = /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, + /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 300.0f}, @@ -309,7 +307,6 @@ static part_state pstates[PT_NUM] = /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_OIL, 250.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 62.0f}, /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, -180.0f, PT_NONE, 0.0f}, @@ -317,7 +314,7 @@ static part_state pstates[PT_NUM] = /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 60.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static unsigned char can_move[PT_NUM][PT_NUM] = { @@ -329,73 +326,72 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X W S*/ /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l R T*/ -/* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ -/* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0}, /* Dust */ -/* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0}, /* Watr */ -/* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Oill */ -/* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Fire */ -/* STNE */ {0,1,1,1,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,0}, /* Stne */ -/* LAVA */ {0,1,1,1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,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0}, /* O2 */ +/* INWR */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* INWR */ +/* YEST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* YEST */ +/* DYST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* DYST */ +/* BRMT */ {0,1,1,1,1,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0}, /* Brml */ /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y*/ /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X W S*/ -- cgit v0.9.2-21-gd62e From 33db9e22f70a19b1c1b18f39d023d85d2d133cb4 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 1 Sep 2010 14:49:45 +0100 Subject: Starting work on OpenGL diff --git a/graphics.c b/graphics.c index fa742be..851e152 100644 --- a/graphics.c +++ b/graphics.c @@ -1,6 +1,17 @@ #include #include #include + +#ifdef OpenGL +#ifdef MACOSX +#include +#include +#else +#include +#include +#endif +#endif + #include "defines.h" #include "air.h" #include "powder.h" @@ -105,10 +116,14 @@ void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) { +#ifdef OpenGL + RenderScene(); +#else if(sdl_scale == 2) sdl_blit_2(x, y, w, h, src, pitch); else sdl_blit_1(x, y, w, h, src, pitch); +#endif } void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) @@ -1112,6 +1127,18 @@ void draw_parts(pixel *vid) int cr, cg, cb; float pt = R_TEMP; for(i = 0; i Date: Thu, 2 Sep 2010 15:49:40 +0100 Subject: More OpenGL work diff --git a/graphics.c b/graphics.c index 851e152..a6f83f3 100644 --- a/graphics.c +++ b/graphics.c @@ -707,6 +707,9 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) { //x = 2+32*(b/2); //y = YRES+2+20*(b%2); +#ifdef OpenGL + fillrect(vid_buf, x, y, 28, 16, PIXR(pc), PIXG(pc), PIXB(pc), 255); +#else for(j=1; j<15; j++) { for(i=1; i<27; i++) @@ -714,6 +717,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; } } +#endif if(b==0) { for(j=4; j<12; j++) @@ -797,6 +801,8 @@ inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) { +#ifdef OpenGL +#else int sx = x; for(; *s; s++) { @@ -834,11 +840,21 @@ int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) else x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); } +#endif return x; } void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) { +#ifdef OpenGL + glBegin(GL_LINE_LOOP); + glColor4ub(r, g, b, a); + glVertex2i(x, y); + glVertex2i(x+w, y); + glVertex2i(x+w, y+h); + glVertex2i(x, y+h); + glEnd(); +#else int i; for(i=0; i<=w; i++) { @@ -850,14 +866,25 @@ void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a drawpixel(vid, x, y+i, r, g, b, a); drawpixel(vid, x+w, y+i, r, g, b, a); } +#endif } void fillrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) { +#ifdef OpenGL + glBegin(GL_QUADS); + glColor4ub(r, g, b, a); + glVertex2i(x, y); + glVertex2i(x+w, y); + glVertex2i(x+w, y+h); + glVertex2i(x, y+h); + glEnd(); +#else int i,j; for(j=1; j Date: Thu, 2 Sep 2010 22:59:48 +0200 Subject: does not compile at the moment, cause unknown, also. always use // for one line comments diff --git a/Makefile b/Makefile index 1e1860a..6db5e87 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ SOURCES := *.c -HEADERS := font.h hmap.h http.h md5.h icon.h update.h version.h +HEADERS := *.h CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations @@ -11,7 +11,7 @@ MFLAGS_SSE3 := -march=k8 -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2 -msse2 MFLAGS_SSE := -march=pentium3 -DX86 -DX86_SSE FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -O2 -march=k8 -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lpthread -lbz2 -COMPILER := gcc +COMPILER := clang LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 WIN32_TARG := powder-sse.exe powder-sse2.exe diff --git a/graphics.c b/graphics.c index a6f83f3..e06122b 100644 --- a/graphics.c +++ b/graphics.c @@ -756,11 +756,11 @@ void draw_menu(pixel *vid_buf, int i, int hover) } } -#ifdef WIN32 +/*#ifdef WIN32 _inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#else +#else*/ inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#endif +//#endif { pixel t; if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) @@ -799,7 +799,7 @@ inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) return x + w; } -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) +int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a) { #ifdef OpenGL #else @@ -2352,4 +2352,4 @@ void ClearScreen() { glClear(GL_COLOR_BUFFER_BIT); } -#endif \ No newline at end of file +#endif diff --git a/graphics.h b/graphics.h index edeab38..7f1c744 100644 --- a/graphics.h +++ b/graphics.h @@ -75,7 +75,7 @@ _inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); #endif -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); +int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a); void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); @@ -141,4 +141,4 @@ void RenderScene (); void ClearScreen(); #endif -#endif \ No newline at end of file +#endif diff --git a/interface.c b/interface.c index f6ef749..bb9c37c 100644 --- a/interface.c +++ b/interface.c @@ -11,7 +11,7 @@ #include "powder.h" #include "interface.h" #include "misc.h" - +#include "graphics.h" SDLMod sdl_mod; int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; @@ -2819,4 +2819,4 @@ int execute_vote(pixel *vid_buf, char *id, char *action) if(result) free(result); return 1; -} \ No newline at end of file +} diff --git a/main.c b/main.c index 9b9b4d2..5fc9ac1 100644 --- a/main.c +++ b/main.c @@ -49,7 +49,7 @@ #include "hmap.h" #include "air.h" -char *it_msg = +static const char *it_msg = "\brThe Powder Toy\n" "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" "\n" @@ -129,7 +129,7 @@ int core_count() return numCPU; } -int mousex, mousey = 0; //They contain mouse position +int mousex = 0, mousey = 0; //They contain mouse position void sdl_seticon(void) { @@ -140,10 +140,12 @@ void sdl_seticon(void) #ifdef MACOSX //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else +/* Does currently not work #else SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); + SDL_WM_SetIcon(icon, NULLapp_icon_mask)//app_icon mask; +*/ #endif + #endif } diff --git a/powder.c b/powder.c index 706c962..78906f6 100644 --- a/powder.c +++ b/powder.c @@ -4,22 +4,6 @@ #include "air.h" #include "misc.h" -int isplayer = 0; -float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index - -particle *parts; -particle *cb_parts; - -unsigned char bmap[YRES/CELL][XRES/CELL]; -unsigned char emap[YRES/CELL][XRES/CELL]; - -unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -unsigned char cb_emap[YRES/CELL][XRES/CELL]; - -int pfree; - -unsigned pmap[YRES][XRES]; -unsigned cb_pmap[YRES][XRES]; int try_move(int i, int x, int y, int nx, int ny) { @@ -2871,4 +2855,4 @@ void create_line(int x1, int y1, int x2, int y2, int r, int c) e -= 1.0f; } } -} \ No newline at end of file +} diff --git a/powder.h b/powder.h index 7bd2a9c..b2e70a9 100644 --- a/powder.h +++ b/powder.h @@ -174,7 +174,7 @@ struct part_state }; typedef struct part_state part_state; -static part_type ptypes[PT_NUM] = +static const part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, @@ -246,7 +246,7 @@ static part_type ptypes[PT_NUM] = //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; -static part_state pstates[PT_NUM] = +static const part_state pstates[PT_NUM] = { // Name Solid Frzp Liquid Mpnt Gas Bpoint /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -316,7 +316,7 @@ static part_state pstates[PT_NUM] = /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; -static unsigned char can_move[PT_NUM][PT_NUM] = +static const unsigned char can_move[PT_NUM][PT_NUM] = { /* A B */ /* A 0 1 | B ligher than A */ @@ -398,21 +398,21 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l R T*/ }; -extern int isplayer; -extern float player[20]; +int isplayer; +float player[20]; -extern particle *parts; -extern particle *cb_parts; +particle *parts; +particle *cb_parts; -extern unsigned char bmap[YRES/CELL][XRES/CELL]; -extern unsigned char emap[YRES/CELL][XRES/CELL]; +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; -extern unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -extern unsigned char cb_emap[YRES/CELL][XRES/CELL]; +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; -extern int pfree; +int pfree; -extern unsigned pmap[YRES][XRES]; +unsigned pmap[YRES][XRES]; unsigned cb_pmap[YRES][XRES]; int try_move(int i, int x, int y, int nx, int ny); @@ -467,4 +467,4 @@ int create_parts(int x, int y, int r, int c); void create_line(int x1, int y1, int x2, int y2, int r, int c); -#endif \ No newline at end of file +#endif -- cgit v0.9.2-21-gd62e From 274383105a675af4235c250e7c0690a86e71a8c0 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 3 Sep 2010 00:06:18 +0100 Subject: Revert "does not compile at the moment, cause unknown, also. always use // for one line comments" This reverts commit 32b1a2c3ab928bec980601f257487db39b0b8e33. diff --git a/Makefile b/Makefile index 6db5e87..1e1860a 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ SOURCES := *.c -HEADERS := *.h +HEADERS := font.h hmap.h http.h md5.h icon.h update.h version.h CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations @@ -11,7 +11,7 @@ MFLAGS_SSE3 := -march=k8 -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2 -msse2 MFLAGS_SSE := -march=pentium3 -DX86 -DX86_SSE FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -O2 -march=k8 -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lpthread -lbz2 -COMPILER := clang +COMPILER := gcc LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 WIN32_TARG := powder-sse.exe powder-sse2.exe diff --git a/graphics.c b/graphics.c index e06122b..a6f83f3 100644 --- a/graphics.c +++ b/graphics.c @@ -756,11 +756,11 @@ void draw_menu(pixel *vid_buf, int i, int hover) } } -/*#ifdef WIN32 +#ifdef WIN32 _inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#else*/ +#else inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -//#endif +#endif { pixel t; if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) @@ -799,7 +799,7 @@ inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) return x + w; } -int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a) +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) { #ifdef OpenGL #else @@ -2352,4 +2352,4 @@ void ClearScreen() { glClear(GL_COLOR_BUFFER_BIT); } -#endif +#endif \ No newline at end of file diff --git a/graphics.h b/graphics.h index 7f1c744..edeab38 100644 --- a/graphics.h +++ b/graphics.h @@ -75,7 +75,7 @@ _inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); #endif -int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a); +int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); @@ -141,4 +141,4 @@ void RenderScene (); void ClearScreen(); #endif -#endif +#endif \ No newline at end of file diff --git a/interface.c b/interface.c index bb9c37c..f6ef749 100644 --- a/interface.c +++ b/interface.c @@ -11,7 +11,7 @@ #include "powder.h" #include "interface.h" #include "misc.h" -#include "graphics.h" + SDLMod sdl_mod; int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; @@ -2819,4 +2819,4 @@ int execute_vote(pixel *vid_buf, char *id, char *action) if(result) free(result); return 1; -} +} \ No newline at end of file diff --git a/main.c b/main.c index 5fc9ac1..9b9b4d2 100644 --- a/main.c +++ b/main.c @@ -49,7 +49,7 @@ #include "hmap.h" #include "air.h" -static const char *it_msg = +char *it_msg = "\brThe Powder Toy\n" "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" "\n" @@ -129,7 +129,7 @@ int core_count() return numCPU; } -int mousex = 0, mousey = 0; //They contain mouse position +int mousex, mousey = 0; //They contain mouse position void sdl_seticon(void) { @@ -140,12 +140,10 @@ void sdl_seticon(void) #ifdef MACOSX //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -/* Does currently not work #else +#else SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - SDL_WM_SetIcon(icon, NULLapp_icon_mask)//app_icon mask; -*/ + SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); #endif - #endif } diff --git a/powder.c b/powder.c index 78906f6..706c962 100644 --- a/powder.c +++ b/powder.c @@ -4,6 +4,22 @@ #include "air.h" #include "misc.h" +int isplayer = 0; +float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index + +particle *parts; +particle *cb_parts; + +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; + +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; + +int pfree; + +unsigned pmap[YRES][XRES]; +unsigned cb_pmap[YRES][XRES]; int try_move(int i, int x, int y, int nx, int ny) { @@ -2855,4 +2871,4 @@ void create_line(int x1, int y1, int x2, int y2, int r, int c) e -= 1.0f; } } -} +} \ No newline at end of file diff --git a/powder.h b/powder.h index b2e70a9..7bd2a9c 100644 --- a/powder.h +++ b/powder.h @@ -174,7 +174,7 @@ struct part_state }; typedef struct part_state part_state; -static const part_type ptypes[PT_NUM] = +static part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, @@ -246,7 +246,7 @@ static const part_type ptypes[PT_NUM] = //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; -static const part_state pstates[PT_NUM] = +static part_state pstates[PT_NUM] = { // Name Solid Frzp Liquid Mpnt Gas Bpoint /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -316,7 +316,7 @@ static const part_state pstates[PT_NUM] = /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; -static const unsigned char can_move[PT_NUM][PT_NUM] = +static unsigned char can_move[PT_NUM][PT_NUM] = { /* A B */ /* A 0 1 | B ligher than A */ @@ -398,21 +398,21 @@ static const unsigned char can_move[PT_NUM][PT_NUM] = /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l R T*/ }; -int isplayer; -float player[20]; +extern int isplayer; +extern float player[20]; -particle *parts; -particle *cb_parts; +extern particle *parts; +extern particle *cb_parts; -unsigned char bmap[YRES/CELL][XRES/CELL]; -unsigned char emap[YRES/CELL][XRES/CELL]; +extern unsigned char bmap[YRES/CELL][XRES/CELL]; +extern unsigned char emap[YRES/CELL][XRES/CELL]; -unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -unsigned char cb_emap[YRES/CELL][XRES/CELL]; +extern unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +extern unsigned char cb_emap[YRES/CELL][XRES/CELL]; -int pfree; +extern int pfree; -unsigned pmap[YRES][XRES]; +extern unsigned pmap[YRES][XRES]; unsigned cb_pmap[YRES][XRES]; int try_move(int i, int x, int y, int nx, int ny); @@ -467,4 +467,4 @@ int create_parts(int x, int y, int r, int c); void create_line(int x1, int y1, int x2, int y2, int r, int c); -#endif +#endif \ No newline at end of file -- cgit v0.9.2-21-gd62e From 5fef47a1c213870754f2f11ead0ab142400cdb41 Mon Sep 17 00:00:00 2001 From: FacialTurd Date: Thu, 2 Sep 2010 16:09:40 -0700 Subject: diff --git a/defines.h b/defines.h index c38de16..3599d37 100644 --- a/defines.h +++ b/defines.h @@ -7,9 +7,10 @@ #define PATH_SEP "/" #endif -#define SAVE_VERSION 41 -#define MINOR_VERSION 3 -#define IDENT_VERSION "S" //Change this if you're not Simon! It should be a single letter. +#define SAVE_VERSION 42 +#define MINOR_VERSION 0 +#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. +#define BETA #define SERVER "powdertoy.co.uk" -- cgit v0.9.2-21-gd62e From 2f0d0f5d92312fc02dc34d30f99b7cdeb09eccc9 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 3 Sep 2010 10:32:37 +0100 Subject: Fix for Linux building diff --git a/Makefile b/Makefile index 1e1860a..38608b3 100755 --- a/Makefile +++ b/Makefile @@ -4,13 +4,10 @@ HEADERS := font.h hmap.h http.h md5.h icon.h update.h version.h CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations LFLAGS := -lSDL -lm -lbz2 -LFLAGS_MTW32 := -lpthreadGC2 -LFLAGS_MT := $(LFLAGS) -lpthread -MFLAGS_MT := -march=k8 -DX86 -DX86_SSE3 -DMT -msse3 MFLAGS_SSE3 := -march=k8 -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2 -msse2 MFLAGS_SSE := -march=pentium3 -DX86 -DX86_SSE -FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -O2 -march=k8 -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lpthread -lbz2 +FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -O2 -march=k8 -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lbz2 COMPILER := gcc LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 WIN32_TARG := powder-sse.exe powder-sse2.exe @@ -23,9 +20,6 @@ powder-debug: $(SOURCES) $(HEADERS) powder-sse3: $(SOURCES) $(HEADERS) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 strip $@ -powder-mt: $(SOURCES) $(HEADERS) - $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -DLIN32 - strip $@ powder-sse2: $(SOURCES) $(HEADERS) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN32 strip $@ @@ -47,10 +41,6 @@ powder-sse3.exe: $(SOURCES) $(HEADERS) powder-res.o i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 strip $@ chmod 0644 $@ -powder-mt.exe: $(SOURCES) $(HEADERS) powder-res.o - i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_MT) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS_MTW32) -mwindows -DWIN32 - strip $@ - chmod 0644 $@ powder-sse2.exe: $(SOURCES) $(HEADERS) powder-res.o i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 strip $@ @@ -59,33 +49,10 @@ powder-sse.exe: $(SOURCES) $(HEADERS) powder-res.o i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 strip $@ chmod 0644 $@ + powder-x: $(SOURCES) $(HEADERS) gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -ggdb strip $@ -powder-x-mt: $(SOURCES) $(HEADERS) - gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_MT) $(MFLAGS_MT) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -powder-src.tar.bz2: *.c *.h *.rc *.ico Makefile - mkdir powder-src - cp *.c *.h *.rc *.ico Makefile powder-src/ - tar cfj powder-src.tar.bz2 powder-src - rm -rf powder-src - -release: $(LINUX_TARG) $(WIN32_TARG) powder-src.tar.bz2 - tar cfz powder-linux.tar.gz $(LINUX_TARG) - cp /usr/i586-mingw32msvc/bin/SDL.dll ./ - zip powder-win32.zip $(WIN32_TARG) SDL.dll - mkdir -p release - mv powder-linux.tar.gz release/ - mv powder-win32.zip release/ - mv powder-src.tar.bz2 release/ - cp powder-sse.exe powder.exe - rm -f release/powder.zip - zip release/powder.zip powder.exe SDL.dll - cp powder-64-sse2 release/powder64 - rm -f release/powder64.gz - gzip release/powder64 - rm -f release/powder.gz - cp powder-sse release/powder - gzip release/powder - cd release; tar czf powder-bin.tar.gz powder.gz powder64.gz powder-linux.tar.gz powder-win32.zip powder.zip; cd .. - rm -f $(LINUX_TARG) $(WIN32_TARG) SDL.dll powder.exe +powder-x-ogl: $(SOURCES) $(HEADERS) + gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DOpenGL -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework OpenGL -ggdb + strip $@ diff --git a/graphics.h b/graphics.h index edeab38..2bfacaa 100644 --- a/graphics.h +++ b/graphics.h @@ -66,13 +66,13 @@ void draw_menu(pixel *vid_buf, int i, int hover); #ifdef WIN32 _inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); #else -inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +extern inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); #endif #ifdef WIN32 _inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); #else -inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); +extern inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); #endif int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); -- cgit v0.9.2-21-gd62e From bda99a105fea992fd530a0788a33b78c6dd25fee Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 3 Sep 2010 10:35:02 +0100 Subject: Whoop, missed something diff --git a/main.c b/main.c index 9b9b4d2..82e407f 100644 --- a/main.c +++ b/main.c @@ -48,6 +48,7 @@ #include "update.h" #include "hmap.h" #include "air.h" +#include "icon.h" char *it_msg = "\brThe Powder Toy\n" -- cgit v0.9.2-21-gd62e From 62b3d7842493a07947b3f5c0a0e31453ebdea8a6 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Fri, 3 Sep 2010 14:26:54 +0200 Subject: added opengl target for linux diff --git a/Makefile b/Makefile index 38608b3..ccff97d 100755 --- a/Makefile +++ b/Makefile @@ -26,7 +26,9 @@ powder-sse2: $(SOURCES) $(HEADERS) powder-sse: $(SOURCES) $(HEADERS) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32 strip $@ - +powder-64-sse3-opengl : $(SOURCES) $(HEADERS) + $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -lGL -lGLU -DOpenGL + strip $@ powder-64-sse3: $(SOURCES) $(HEADERS) $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 strip $@ -- cgit v0.9.2-21-gd62e From 49ba3f196f706472344a9a10105dad349bf1a0e0 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Fri, 3 Sep 2010 14:55:31 +0200 Subject: added various things diff --git a/graphics.c b/graphics.c index a6f83f3..ce5e893 100644 --- a/graphics.c +++ b/graphics.c @@ -884,7 +884,7 @@ void fillrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a for(j=1; j=XRES || y>=YRES) return; @@ -969,6 +979,7 @@ inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) b = (a*b + (255-a)*PIXB(t)) >> 8; } vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +#endif //OpenGL } void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) @@ -2352,4 +2363,4 @@ void ClearScreen() { glClear(GL_COLOR_BUFFER_BIT); } -#endif \ No newline at end of file +#endif -- cgit v0.9.2-21-gd62e From aba3109f6f70aeff6353869f53aa9a9876adcc36 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Fri, 3 Sep 2010 15:03:37 +0200 Subject: forgot to remove one thing diff --git a/graphics.c b/graphics.c index ce5e893..0cca507 100644 --- a/graphics.c +++ b/graphics.c @@ -966,7 +966,6 @@ inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) #endif { #ifdef OpenGL - gl_ #else pixel t; if(x<0 || y<0 || x>=XRES || y>=YRES) -- cgit v0.9.2-21-gd62e From 5b5a80c0af4d66c9a247366fe6aedb34b277b67b Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Fri, 3 Sep 2010 16:05:09 +0200 Subject: Added todo, const correctness. diff --git a/graphics.c b/graphics.c index 0cca507..7508c57 100644 --- a/graphics.c +++ b/graphics.c @@ -799,7 +799,7 @@ inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) return x + w; } -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a) +int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a) { #ifdef OpenGL #else diff --git a/graphics.h b/graphics.h index 2bfacaa..6a1507e 100644 --- a/graphics.h +++ b/graphics.h @@ -75,7 +75,7 @@ _inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a extern inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); #endif -int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a); +int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a); void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); @@ -141,4 +141,4 @@ void RenderScene (); void ClearScreen(); #endif -#endif \ No newline at end of file +#endif diff --git a/main.c b/main.c index 82e407f..30c86e6 100644 --- a/main.c +++ b/main.c @@ -50,7 +50,7 @@ #include "air.h" #include "icon.h" -char *it_msg = +static const char *it_msg = "\brThe Powder Toy\n" "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" "\n" @@ -90,9 +90,9 @@ typedef struct } upstruc; #ifdef BETA -char *old_ver_msg_beta = "A new beta is available - click here!"; +static const char *old_ver_msg_beta = "A new beta is available - click here!"; #endif -char *old_ver_msg = "A new version is available - click here!"; +static const char *old_ver_msg = "A new version is available - click here!"; float mheat = 0.0f; int do_open = 0; @@ -130,7 +130,7 @@ int core_count() return numCPU; } -int mousex, mousey = 0; //They contain mouse position +int mousex = 0, mousey = 0; //They contain mouse position void sdl_seticon(void) { @@ -964,7 +964,7 @@ int main(int argc, char *argv[]) #ifdef MT numCores = core_count(); #endif - +//TODO: Move out version stuff #ifdef BETA if(is_beta) { diff --git a/powder.h b/powder.h index 7bd2a9c..6b6610a 100644 --- a/powder.h +++ b/powder.h @@ -114,12 +114,15 @@ #define ST_SOLID 1 #define ST_LIQUID 2 #define ST_GAS 3 - -static unsigned char TYPE_PART = 0x01; //1 -static unsigned char TYPE_LIQUID = 0x02; //2 -static unsigned char TYPE_SOLID = 0x04; //4 -static unsigned char TYPE_GAS = 0x08; //8 -static unsigned char PROP_CONDUCTS = 0x10; //16 +/* + We should start to implement these. +*/ +static const unsigned short TYPE_PART = 0x01; //1 +static const unsigned short TYPE_LIQUID = 0x02; //2 +static const unsigned short TYPE_SOLID = 0x04; //4 +static const unsigned short TYPE_GAS = 0x08; //8 +static const unsigned short PROP_CONDUCTS = 0x10; //16 +static const unsigned short PROP_DEADLY = 0x12; //18 Is deadly for stickman. #define FLAG_STAGNANT 1 struct particle @@ -156,7 +159,7 @@ struct part_type float heat; unsigned char hconduct; const char *descs; - unsigned char properties; + const unsigned short properties; }; typedef struct part_type part_type; @@ -173,8 +176,8 @@ struct part_state float btemp; }; typedef struct part_state part_state; - -static part_type ptypes[PT_NUM] = +//Should probably be const. +static const part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, @@ -467,4 +470,4 @@ int create_parts(int x, int y, int r, int c); void create_line(int x1, int y1, int x2, int y2, int r, int c); -#endif \ No newline at end of file +#endif -- cgit v0.9.2-21-gd62e From 8b92a1eb9b2dd91286e70dc72b2ac007fe7db61c Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Fri, 3 Sep 2010 22:23:41 +0200 Subject: fixed http://powdertoy.co.uk/Forum.html?action=vthread&forum=5&topic=783 diff --git a/main.c b/main.c index 30c86e6..8d37a88 100644 --- a/main.c +++ b/main.c @@ -66,7 +66,7 @@ static const char *it_msg = "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" "Use 'S' to save parts of the window as 'stamps'.\n" "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" - "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 6 will do the same\n" + "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 7 will do the same\n" "Use the mouse scroll wheel to change the tool size for particles.\n" "'Q' will quit the application.\n" "The spacebar can be used to pause physics.\n" -- cgit v0.9.2-21-gd62e From 5a65265228b80e976703ec2ac86f9fdc275248d5 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 4 Sep 2010 15:07:01 +0100 Subject: Thing of the Windows Users diff --git a/graphics.c b/graphics.c index 7508c57..7b96720 100644 --- a/graphics.c +++ b/graphics.c @@ -896,9 +896,10 @@ void clearrect(pixel *vid, int x, int y, int w, int h) void drawdots(pixel *vid, int x, int y, int h, int r, int g, int b, int a) { #ifdef OpenGL + int i; glBegin(GL_QUADS); glColor4ub(r, g, b, a); - for(int i = 0; i <= h; i +=2) + for(i = 0; i <= h; i +=2) glVertex2i(x, y+i); glEnd(); #else -- cgit v0.9.2-21-gd62e From 81923fae6e048bba268d261f37843d5a0bb46233 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 4 Sep 2010 16:49:08 +0200 Subject: Changed O2 diffussion, changed description diff --git a/powder.h b/powder.h index 6b6610a..5b0900f 100644 --- a/powder.h +++ b/powder.h @@ -241,7 +241,7 @@ static const part_type ptypes[PT_NUM] = {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f, 200, "Solid. Burns slowly."}, {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 5.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Oxygen helps make things burn."}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Oxygen helps make things burn."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Yeast, grows when warm (~37C)."}, {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f, 70, "Deat Yeast."}, -- cgit v0.9.2-21-gd62e From 525f87fd6be3e7168eb23ed362f90a44e8992dd7 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 4 Sep 2010 17:25:44 +0200 Subject: Partly converted into Kelvin scale diff --git a/powder.h b/powder.h index 5b0900f..9334ee6 100644 --- a/powder.h +++ b/powder.h @@ -107,8 +107,8 @@ #define PT_NUM 66 #define R_TEMP 22 -#define MAX_TEMP 3500 -#define MIN_TEMP -273 +#define MAX_TEMP 9999 +#define MIN_TEMP 0 #define ST_NONE 0 #define ST_SOLID 1 @@ -241,7 +241,7 @@ static const part_type ptypes[PT_NUM] = {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f, 200, "Solid. Burns slowly."}, {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Oxygen helps make things burn."}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Ignites easily."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Yeast, grows when warm (~37C)."}, {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f, 70, "Deat Yeast."}, @@ -287,36 +287,36 @@ static part_state pstates[PT_NUM] = /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2100.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 46.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* MWAX */ {ST_LIQUID, PT_WAX, 45.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, - /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LNTG */ {ST_SOLID, PT_NICE, -210.0f, PT_NONE, 0.0f, PT_NONE, -195.8f, PT_NONE, 0.0f}, + /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LNTG */ {ST_SOLID, PT_NICE, 75.0f, PT_NONE, 0.0f, PT_NONE, 78.0f, PT_NONE, 0.0f}, /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 39.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, + /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, /* LRBD */ {ST_LIQUID, PT_RBDM, 38.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, - /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, -209.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 77.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2000.0f}, - /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, + /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 62.0f}, - /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, - /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, -180.0f, PT_NONE, 0.0f}, - /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, -190.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 60.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 200.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, + /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 453.0f, PT_NONE, 0.0f}, + /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 50.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static unsigned char can_move[PT_NUM][PT_NUM] = -- cgit v0.9.2-21-gd62e From a11d64774290b524f0fd4496e47506d654bd66b4 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 4 Sep 2010 17:40:26 +0200 Subject: more work on kelvin diff --git a/powder.c b/powder.c index 706c962..58fed0c 100644 --- a/powder.c +++ b/powder.c @@ -1161,7 +1161,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; } - pv[y/CELL][x/CELL] += 10.00f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + pv[y/CELL][x/CELL] += 20.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough fe ++; } /*if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) @@ -2871,4 +2871,4 @@ void create_line(int x1, int y1, int x2, int y2, int r, int c) e -= 1.0f; } } -} \ No newline at end of file +} diff --git a/powder.h b/powder.h index 9334ee6..dc65f16 100644 --- a/powder.h +++ b/powder.h @@ -254,47 +254,47 @@ static part_state pstates[PT_NUM] = // Name Solid Frzp Liquid Mpnt Gas Bpoint /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WATR */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, - /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 60.0f, PT_NONE, 0.0f}, - /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2500.0f}, - /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 710.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LAVA */ {ST_LIQUID, PT_STNE, 700.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, - /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* WATR */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f}, + /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f}, + /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LAVA */ {ST_LIQUID, PT_STNE, 973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 300.0f}, - /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, + /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f}, + /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 300.0f}, + /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WTRV */ {ST_GAS, PT_ICEI, 0.0f, PT_DSTW, 98.0f, PT_NONE, 100.0f, PT_NONE, 0.0f}, - /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 850.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DSTW */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 100.0f, PT_NONE, 0.0f}, - /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 900.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SLTW */ {ST_LIQUID, PT_ICEI, -40.0f, PT_NONE, 0.0f, PT_WTRV, 110.0f, PT_NONE, 0.0f}, + /* WTRV */ {ST_GAS, PT_ICEI, 0.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, + /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DSTW */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f}, /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2100.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 46.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* MWAX */ {ST_LIQUID, PT_WAX, 45.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 400.0f}, + /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* LNTG */ {ST_SOLID, PT_NICE, 75.0f, PT_NONE, 0.0f, PT_NONE, 78.0f, PT_NONE, 0.0f}, /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, - /* LRBD */ {ST_LIQUID, PT_RBDM, 38.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 688.0f}, + /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, + /* LRBD */ {ST_LIQUID, PT_RBDM, 311.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, -- cgit v0.9.2-21-gd62e From 21863c088b5f4c266e33b41813ec697a7d3fa46d Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 4 Sep 2010 17:12:41 -0400 Subject: made makefile work properly diff --git a/Makefile b/Makefile index ccff97d..72e2617 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ SOURCES := *.c -HEADERS := font.h hmap.h http.h md5.h icon.h update.h version.h CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations @@ -12,49 +11,49 @@ COMPILER := gcc LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 WIN32_TARG := powder-sse.exe powder-sse2.exe -powder: $(SOURCES) $(HEADERS) +powder: $(SOURCES) $(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -powder-debug: $(SOURCES) $(HEADERS) +powder-debug: $(SOURCES) $(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) -powder-sse3: $(SOURCES) $(HEADERS) +powder-sse3: $(SOURCES) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 strip $@ -powder-sse2: $(SOURCES) $(HEADERS) +powder-sse2: $(SOURCES) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN32 strip $@ -powder-sse: $(SOURCES) $(HEADERS) +powder-sse: $(SOURCES) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32 strip $@ -powder-64-sse3-opengl : $(SOURCES) $(HEADERS) +powder-64-sse3-opengl: $(SOURCES) $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -lGL -lGLU -DOpenGL strip $@ -powder-64-sse3: $(SOURCES) $(HEADERS) +powder-64-sse3: $(SOURCES) $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 strip $@ -powder-64-sse2: $(SOURCES) $(HEADERS) +powder-64-sse2: $(SOURCES) $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64 strip $@ powder-res.o: powder-res.rc powder.ico i586-mingw32msvc-windres powder-res.rc powder-res.o -powder-sse3.exe: $(SOURCES) $(HEADERS) powder-res.o +powder-sse3.exe: $(SOURCES) powder-res.o i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 strip $@ chmod 0644 $@ -powder-sse2.exe: $(SOURCES) $(HEADERS) powder-res.o +powder-sse2.exe: $(SOURCES) powder-res.o i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 strip $@ chmod 0644 $@ -powder-sse.exe: $(SOURCES) $(HEADERS) powder-res.o +powder-sse.exe: $(SOURCES) powder-res.o i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 strip $@ chmod 0644 $@ -powder-x: $(SOURCES) $(HEADERS) +powder-x: $(SOURCES) gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -ggdb strip $@ -powder-x-ogl: $(SOURCES) $(HEADERS) +powder-x-ogl: $(SOURCES) gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DOpenGL -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework OpenGL -ggdb strip $@ -- cgit v0.9.2-21-gd62e From 240eb4ba33f8720de6d2a40fd0302ad5f927dc79 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 5 Sep 2010 11:35:38 +0100 Subject: Stickman fixes from savask and temperature fixes diff --git a/defines.h b/defines.h index 3599d37..f59eb4e 100644 --- a/defines.h +++ b/defines.h @@ -66,6 +66,8 @@ typedef unsigned char uint8; extern int amd; +extern int FPSB; + extern int legacy_enable; extern int sys_pause; diff --git a/graphics.c b/graphics.c index 7b96720..2cb1a26 100644 --- a/graphics.c +++ b/graphics.c @@ -1191,7 +1191,7 @@ void draw_parts(pixel *vid) if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP + sprintf(buff, "%3d", parts[i].life); //Show HP drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); } @@ -1796,7 +1796,7 @@ void draw_parts(pixel *vid) if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head { - sprintf(buff, "%3d", (int)parts[i].life); //Show HP + sprintf(buff, "%3d", parts[i].life); //Show HP drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); } @@ -1812,6 +1812,8 @@ void draw_parts(pixel *vid) draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); + + isplayer = 1; //It's a secret. Tssss... } else { diff --git a/main.c b/main.c index 8d37a88..833a468 100644 --- a/main.c +++ b/main.c @@ -98,8 +98,9 @@ float mheat = 0.0f; int do_open = 0; int sys_pause = 0; int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. -int death = 1, framerender = 0; +int death = 0, framerender = 0; int amd = 1; +int FPSB = 0; sign signs[MAXSIGNS]; @@ -533,7 +534,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0) parts[i].vy = (d[p++]-127.0f)/16.0f; if(parts[i].type == PT_STKM) { - player[2] = PT_DUST; + //player[2] = PT_DUST; player[3] = parts[i].x-1; //Setting legs positions player[4] = parts[i].y+6; @@ -588,7 +589,11 @@ int parse_save(void *save, int size, int replace, int x0, int y0) } if(i <= NPART) { - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + if(ver>=42){ + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } else { + parts[i-1].temp = ((d[p++]*(((3500.0f)+(-(-273)))/255))+(-273)) + 273.15f; + } } else { @@ -943,7 +948,7 @@ int main(int argc, char *argv[]) char uitext[48] = ""; char heattext[64] = ""; int currentTime = 0; - int FPS = 0, FPSB = 0; + int FPS = 0; int pastFPS = 0; int past = 0; pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); @@ -1155,9 +1160,10 @@ int main(int argc, char *argv[]) break; } } - if(sdl_key=='d') + if(sdl_key=='d' && isplayer) { - death = !(death); + death = 1; + //death = !(death); } if(sdl_key=='f') { @@ -1355,9 +1361,9 @@ int main(int argc, char *argv[]) if(!((cr>>8)>=NPART || !cr)) { #ifdef BETA - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp, parts[cr>>8].life); + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); #else - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp); + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f); #endif } else @@ -2009,11 +2015,15 @@ int main(int argc, char *argv[]) } sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE); - //Setting an element for the stick man - if(ptypes[sr].falldown>0) - player[2] = sr; - else - player[2] = PT_DUST; + //Setting an element for the stick man + if(isplayer==0) + { + if(ptypes[sr].falldown>0 || sr == PT_NEUT || sr == PT_PHOT) + player[2] = sr; + else + player[2] = PT_DUST; + } + } http_done(); diff --git a/powder.c b/powder.c index 58fed0c..53f84c6 100644 --- a/powder.c +++ b/powder.c @@ -5,7 +5,7 @@ #include "misc.h" int isplayer = 0; -float player[20]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index +float player[27]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index, [19]-[26] are accelerations particle *parts; particle *cb_parts; @@ -485,7 +485,7 @@ void update_particles_i(pixel *vid, int start, int inc) { t = parts[i].ctype; if(t!=PT_METL&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM&&t!=PT_BTRY&&t!=PT_NBLE) - parts[i].temp = R_TEMP; + parts[i].temp = R_TEMP + 273.15f; if(!t) t = PT_METL; parts[i].type = t; @@ -819,11 +819,11 @@ void update_particles_i(pixel *vid, int start, int inc) pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); } } - if(t==PT_PTCT&&parts[i].temp>24.0f) + if(t==PT_PTCT&&parts[i].temp>249.0f) { pt = parts[i].temp -= 2.5f; } - if(t==PT_NTCT&&parts[i].temp>24.0f) + if(t==PT_NTCT&&parts[i].temp>249.0f) { pt = parts[i].temp -= 2.5f; } @@ -938,7 +938,7 @@ void update_particles_i(pixel *vid, int start, int inc) continue; if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL) { - parts[i].temp = 200.0f; + parts[i].temp = 473.0f; } } } @@ -1161,7 +1161,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; } - pv[y/CELL][x/CELL] += 20.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough fe ++; } /*if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) @@ -1399,19 +1399,19 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)=100.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=100.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) + if(!(rt==PT_PSCN&&parts[i].ctype==PT_NSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp>=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) { parts[r>>8].type = PT_SPRK; parts[r>>8].life = 4; parts[r>>8].ctype = rt; - if(parts[r>>8].temp+10.0f<400.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) + if(parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) parts[r>>8].temp = parts[r>>8].temp+10.0f; } } if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)>8].temp>100.0f))&&pavg != PT_INSL) + if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_NTCT||(parts[i].ctype==PT_PSCN&&parts[r>>8].temp>373.0f))&&pavg != PT_INSL) { parts[r>>8].type = PT_SPRK; parts[r>>8].life = 4; @@ -1421,7 +1421,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)>8].temp<100.0f))&&pavg != PT_INSL) + if((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_PTCT||(parts[i].ctype==PT_PSCN&&parts[r>>8].temp<373.0f))&&pavg != PT_INSL) { parts[r>>8].type = PT_SPRK; parts[r>>8].life = 4; @@ -1486,15 +1486,17 @@ killed: } if(t==PT_STKM) { + float dt = 0.9;///(FPSB*FPSB); //Delta time in square //Tempirature handling - if(parts[i].temp<-30) - parts[i].life -= 0.2; - if((parts[i].temp<36.6f) && (parts[i].temp>=-30)) + if(parts[i].temp<243) + parts[i].life -= 1; + if((parts[i].temp<309.6f) && (parts[i].temp>=243)) parts[i].temp += 1; //Death - if(parts[i].life<0 && (death == 1)) //If his HP is less that 0 or there is very big wind... + if(parts[i].life<1 || death == 1 || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... { + death = 0; for(r=-2; r<=1; r++) { create_part(-1, x+r, y-2, player[2]); @@ -1506,112 +1508,138 @@ killed: goto killed; } + parts[i].vy += -0.7*dt; //Head up! + //Verlet integration - pp = 2*player[3]-player[5]; + pp = 2*player[3]-player[5]+player[19]*dt*dt;; player[5] = player[3]; player[3] = pp; - pp = 2*player[4]-player[6]; + pp = 2*player[4]-player[6]+player[20]*dt*dt;; player[6] = player[4]; player[4] = pp; - pp = 2*player[7]-player[9]; + pp = 2*player[7]-player[9]+player[21]*dt*dt;; player[9] = player[7]; player[7] = pp; - pp = 2*player[8]-player[10]+1; + pp = 2*player[8]-player[10]+(player[22]+1)*dt*dt;; player[10] = player[8]; player[8] = pp; - pp = 2*player[11]-player[13]; + pp = 2*player[11]-player[13]+player[23]*dt*dt;; player[13] = player[11]; player[11] = pp; - pp = 2*player[12]-player[14]; + pp = 2*player[12]-player[14]+player[24]*dt*dt;; player[14] = player[12]; player[12] = pp; - pp = 2*player[15]-player[17]; + pp = 2*player[15]-player[17]+player[25]*dt*dt;; player[17] = player[15]; player[15] = pp; - pp = 2*player[16]-player[18]+1; + pp = 2*player[16]-player[18]+(player[26]+1)*dt*dt;; player[18] = player[16]; player[16] = pp; + //Setting acceleration to 0 + player[19] = 0; + player[20] = 0; + + player[21] = 0; + player[22] = 0; + + player[23] = 0; + player[24] = 0; + + player[25] = 0; + player[26] = 0; + //Go left - if (((int)(player[0])&0x01) == 0x01) + if (((int)(player[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) { if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { - player[9] += 3; - player[10] += 2; - player[5] += 2; + player[21] = -3; + player[22] = -2; + player[19] = -2; } if (pmap[(int)(player[16]-1)][(int)(player[15])]) { - player[17] += 3; - player[18] += 2; - player[13] +=2; + player[25] = -3; + player[26] = -2; + player[23] = -2; } } else { if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids { - player[9] += 1; - player[10] += 1; - player[5] += 1; + player[21] = -1; + player[22] = -1; + player[19] = -1; } if (pmap[(int)(player[16]-1)][(int)(player[15])]) { - player[17] += 1; - player[18] += 1; - player[13] +=1; + player[25] = -1; + player[26] = -1; + player[23] = -1; } } } //Go right - if (((int)(player[0])&0x02) == 0x02) + if (((int)(player[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) { if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { - player[9] -= 3; - player[10] += 2; - player[5] -= 2; +player[21] = 3; +player[22] = -2; +player[19] = 2; } if (pmap[(int)(player[16]-1)][(int)(player[15])]) { - player[17] -= 3; - player[18] += 2; - player[13] -= 2; +player[25] = 3; +player[26] = -2; +player[23] = 2; } } else { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { - player[9] -= 1; - player[10] += 1; - player[5] -= 1; +player[21] = 1; +player[22] = -1; +player[19] = 1; } if (pmap[(int)(player[16]-1)][(int)(player[15])]) { - player[17] -= 1; - player[18] += 1; - player[13] -= 1; +player[25] = 1; +player[26] = -1; +player[23] = 1; } } } + //Jump + if (((int)(player[0])&0x04) == 0x04 && (pstates[pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF].state != ST_GAS || pstates[pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF].state != ST_GAS)) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[22] -= 1; + player[26] -= 1; + } + } + //Charge detector wall if foot inside if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) set_emap((int)player[7]/CELL, (int)player[8]/CELL); @@ -1624,12 +1652,10 @@ killed: { if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) continue; - if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM - && (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL) - || (pmap[ny+y][nx+x]&0xFF) == PT_LNTG) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } + if(ptypes[pmap[ny+y][nx+x]&0xFF].falldown!=0 || (pmap[ny+y][nx+x]&0xFF) == PT_NEUT || (pmap[ny+y][nx+x]&0xFF) == PT_PHOT) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP { if(parts[i].life<=95) @@ -1644,6 +1670,8 @@ killed: parts[i].life -= (102-parts[i].life)/2; kill_part(pmap[ny+y][nx+x]>>8); } + if(bmap[(ny+y)/CELL][(nx+x)/CELL]==4) + player[2] = SPC_AIR; } //Head position @@ -1663,9 +1691,13 @@ killed: } else { - create_part(-1, nx, ny, player[2]); + if(player[2] == SPC_AIR) + create_parts(nx + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01), ny, 4, SPC_AIR); + else + create_part(-1, nx, ny, player[2]); + r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT) + if( ((r>>8) < NPART) && (r>>8)>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR) parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) { @@ -1686,18 +1718,6 @@ killed: } } - //Jump - if (((int)(player[0])&0x04) == 0x04) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[10] += 1; - player[18] += 1; - } - - } - //Simulation of joints d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance player[7] -= (player[3]-player[7])*d; @@ -1726,10 +1746,12 @@ killed: //Side collisions checking for(nx = -3; nx <= 3; nx++) { - if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)]) + r = pmap[(int)(player[16]-2)][(int)(player[15]+nx)]; + if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID) player[15] -= nx; - if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)]) + r = pmap[(int)(player[8]-2)][(int)(player[7]+nx)]; + if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID) player[7] -= nx; } @@ -1741,19 +1763,22 @@ killed: //For left leg if (r && (r&0xFF)!=PT_STKM) { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks + if(pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks //Liquid checks { if(parts[i].y<(player[8]-10)) - parts[i].vy = 1; + parts[i].vy = 1*dt; else parts[i].vy = 0; if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; + parts[i].vx *= 0.5*dt; } else { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; + if(pstates[r&0xFF].state != ST_GAS) + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy*dt; + } } player[9] = player[7]; } @@ -1763,19 +1788,22 @@ killed: //For right leg if (r && (r&0xFF)!=PT_STKM) { - if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) + if(pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) { if(parts[i].y<(player[16]-10)) - parts[i].vy = 1; + parts[i].vy = 1*dt; else parts[i].vy = 0; if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5; + parts[i].vx *= 0.5*dt; } else { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy; + if(pstates[r&0xFF].state != ST_GAS) + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy*dt; + } } player[17] = player[15]; } @@ -1783,8 +1811,8 @@ killed: //If it falls too fast if (parts[i].vy>=30) { - parts[i].y -= 10+ny; - parts[i].vy = -10; + parts[i].y -= (10+ny)*dt; + parts[i].vy = -10*dt; } } @@ -1792,14 +1820,14 @@ killed: //Keeping legs distance if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) { - player[7] += 0.2; - player[15] -= 0.2; + player[21] -= 0.2; + player[25] += 0.2; } if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) { - player[3] += 0.2; - player[11] -= 0.2; + player[19] -= 0.2; + player[23] += 0.2; } //If legs touch something @@ -1811,10 +1839,10 @@ killed: if (r>0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + if(parts[r>>8].temp>=323 || parts[r>>8].temp<=243) { parts[i].life -= 2; - player[16] -= 1; + player[26] -= 1; } } @@ -1832,10 +1860,10 @@ killed: if(r>0 && (r>>8)>8].temp>=50 || parts[r>>8].temp<=-30) + if(parts[r>>8].temp>=323 || parts[r>>8].temp<=243) { parts[i].life -= 2; - player[8] -= 1; + player[22] -= 1; } } @@ -1866,7 +1894,7 @@ killed: } if(t==PT_YEST) { - if(parts[i].temp>30&&parts[i].temp<44){ + if(parts[i].temp>303&&parts[i].temp<317){ create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST); } } diff --git a/powder.h b/powder.h index dc65f16..6cad71c 100644 --- a/powder.h +++ b/powder.h @@ -180,72 +180,72 @@ typedef struct part_state part_state; static const part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description - {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Very light dust. Flammable."}, - {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Flammable. Solidifies under pressure"}, - {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Heavy particles. Meltable."}, - {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, - {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 97, "Light dust. Explosive."}, - {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 50, "Liquid. Pressure sensitive explosive."}, - {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Solid. Duplicates any particles it touches."}, - {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 88, "Solid. Pressure sensitive explosive."}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f, 75, "Solid. Deforms and disappears under pressure."}, - {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+-50.0f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, - {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Conducts electricity. Meltable."}, - {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP+-30.0f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f, 164, "Solid. Flammable. Can be pressurised into COAL"}, - {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 65, "Plant, drinks water and grows."}, - {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f, 34, "Dissolves almost everything."}, - {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Hole, will drain away any particles."}, - {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f, 100, "Concrete, stronger than stone."}, - {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 110, "Salt, dissolves in water."}, - {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f, 75, "Saltwater, conducts electricity, difficult to freeze."}, - {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. - {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f, 211, "Broken metal."}, - {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f, 251, "Heavy particles. Generates heat under pressure."}, - {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f, 44, "Wax. Melts at moderately high temperatures."}, - {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f, 44, "Liquid Wax."}, - {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "P-Type Silicon, Will transfer current to any conductor."}, - {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -205.0f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f, 0, "Insulator, does not conduct heat or electricity."}, - {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f, 255, "Black hole, sucks in other particles and heats up."}, - {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f, 255, "White hole, pushes other particles away."}, - {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, - {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f, 170, "Liquid Rubidium."}, - {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f, 150, "Solid. Meltable. Shatters under pressure"}, - {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f, 115, "Plasma, extremely hot."}, - {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, -250.0f, 46, "Nitrogen Ice."}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, - {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Generates Electricity."}, - {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, -0.7f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f, 0, "Stickman. Don't kill him!"}, - {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f, 88, "Smoke"}, - {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, - {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f, 70, "Gas. Ignites easily."}, - {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f, 211, "Thermite."}, + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f+273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable. Solidifies under pressure"}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f+273.15f, 88, "Ignites flammable materials. Heats air."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f+273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, + {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+-50.0f+273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, + {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, + {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP+-30.0f+273.15f, 46, "Light particles."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, + {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, + {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f+273.15f, 23, "Distilled water, does not conduct electricity."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, + {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f+273.15f, 251, "Photons. Travel in straight lines."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure."}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax."}, + {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, + {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -205.0f +273.15f, 70, "Liquid Nitrogen. Very cold."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, + {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up."}, + {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f+273.15f, 255, "White hole, pushes other particles away."}, + {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f+273.15f, 170, "Liquid Rubidium."}, + {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, + {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f +273.15f, 115, "Plasma, extremely hot."}, + {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, -250.0f +273.15f, 46, "Nitrogen Ice."}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!"}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f+273.15f, 88, "Smoke"}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f +273.15f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Thermite."}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; @@ -254,7 +254,7 @@ static part_state pstates[PT_NUM] = // Name Solid Frzp Liquid Mpnt Gas Bpoint /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WATR */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f}, /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f}, /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -265,7 +265,7 @@ static part_state pstates[PT_NUM] = /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -277,15 +277,15 @@ static part_state pstates[PT_NUM] = /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WTRV */ {ST_GAS, PT_ICEI, 0.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DSTW */ {ST_LIQUID, PT_ICEI, 0.0f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f}, /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 46.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -307,12 +307,12 @@ static part_state pstates[PT_NUM] = /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, - /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 453.0f, PT_NONE, 0.0f}, + /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 453.0f, PT_NONE, 0.0f}, /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 50.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -402,7 +402,7 @@ static unsigned char can_move[PT_NUM][PT_NUM] = }; extern int isplayer; -extern float player[20]; +extern float player[27]; extern particle *parts; extern particle *cb_parts; -- cgit v0.9.2-21-gd62e From 719ad7c3595686d817e97e3235cb8eb755d9fc40 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 5 Sep 2010 11:44:22 +0100 Subject: Fire only turns into smoke when cold, fix neutrons diff --git a/powder.c b/powder.c index 53f84c6..550f5b1 100644 --- a/powder.c +++ b/powder.c @@ -1187,7 +1187,11 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_GAS; if((r&0xFF)==PT_COAL && 5>(rand()%100)) parts[r>>8].type = PT_WOOD;*/ - if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && 15>(rand()%1000)) + if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && + (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| + ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| + ptypes[parts[r>>8].type-1].menusection==SC_GAS|| + ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000)) parts[r>>8].type--; } } @@ -1903,7 +1907,7 @@ player[23] = 1; parts[i].type = PT_NBLE; parts[i].life = 0; } - if (t==PT_FIRE && parts[i].life <=1) + if (t==PT_FIRE && parts[i].life <=1 && parts[i].temp<673) { t = parts[i].type = PT_SMKE; parts[i].life = rand()%20+250; diff --git a/powder.h b/powder.h index 6cad71c..b69ec5b 100644 --- a/powder.h +++ b/powder.h @@ -309,7 +309,7 @@ static part_state pstates[PT_NUM] = /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 453.0f, PT_NONE, 0.0f}, -- cgit v0.9.2-21-gd62e From 6409b2ae2cd57674848cadc401ed0a9121e3817c Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 5 Sep 2010 11:58:43 +0100 Subject: OpenGL Blending diff --git a/graphics.c b/graphics.c index 2cb1a26..62546b7 100644 --- a/graphics.c +++ b/graphics.c @@ -2356,6 +2356,12 @@ void Enable2D () glMatrixMode (GL_MODELVIEW); glPushMatrix (); glLoadIdentity (); + + glEnable (GL_BLEND); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glHint( GL_LINE_SMOOTH_HINT, GL_NICEST); + glHint( GL_POINT_SMOOTH_HINT, GL_NICEST); } void RenderScene () { -- cgit v0.9.2-21-gd62e From a8e1e336053156e5e4f4339af8a8d18a211d5fb6 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 5 Sep 2010 18:34:25 +0100 Subject: Heat fix diff --git a/main.c b/main.c index 833a468..854fbf3 100644 --- a/main.c +++ b/main.c @@ -592,7 +592,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0) if(ver>=42){ parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; } else { - parts[i-1].temp = ((d[p++]*(((3500.0f)+(-(-273)))/255))+(-273)) + 273.15f; + parts[i-1].temp = ((d[p++]*((O_MAX_TEMP+(-O_MIN_TEMP))/255))+O_MIN_TEMP)+273; } } else @@ -1985,6 +1985,7 @@ int main(int argc, char *argv[]) { #ifdef BETA sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); + //printf("%s\n", uitext); #else sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); #endif diff --git a/powder.h b/powder.h index b69ec5b..e2ba4d2 100644 --- a/powder.h +++ b/powder.h @@ -109,6 +109,8 @@ #define R_TEMP 22 #define MAX_TEMP 9999 #define MIN_TEMP 0 +#define O_MAX_TEMP 3500 +#define O_MIN_TEMP -273 #define ST_NONE 0 #define ST_SOLID 1 -- cgit v0.9.2-21-gd62e From e4d256a0ee8644d35a16255d9e8c8826e367bd69 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 6 Sep 2010 11:46:11 +0100 Subject: Added Glow and Brick, fix some oil stuff and fix LCRY diff --git a/graphics.c b/graphics.c index 62546b7..f576f90 100644 --- a/graphics.c +++ b/graphics.c @@ -1163,6 +1163,7 @@ void draw_parts(pixel *vid) { int i, x, y, t, nx, ny, r, s; int cr, cg, cb; + float fr, fg, fb; float pt = R_TEMP; for(i = 0; i0){ + fg = 6 * pv[ny/CELL][nx/CELL]; + fb = 4 * pv[ny/CELL][nx/CELL]; + fr = 2 * pv[ny/CELL][nx/CELL]; + } + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255)); if(cmode == 3||cmode==4 || cmode==6) { - //cr = R/8; - //cg = G/8; - //cb = B/8; - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(0x50+(parts[i].life*10), 0x50+(parts[i].life*10), 0x50+(parts[i].life*10)); - //x = nx/CELL; - //y = ny/CELL; - //cg += fire_g[y][x]; if(cg > 255) cg = 255; fire_g[y][x] = cg; - //cb += fire_b[y][x]; if(cb > 255) cb = 255; fire_b[y][x] = cb; - //cr += fire_r[y][x]; if(cr > 255) cr = 255; fire_r[y][x] = cr; - } - else - { - cr = 0x50+(parts[i].life*10); - cg = 0x50+(parts[i].life*10); - cb = 0x50+(parts[i].life*10); - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + x = nx/CELL; + y = ny/CELL; + fg += fire_g[y][x]; + if(fg > 255) fg = 255; + fire_g[y][x] = fg; + fb += fire_b[y][x]; + if(fb > 255) fb = 255; + fire_b[y][x] = fb; + fr += fire_r[y][x]; + if(fr > 255) fr = 255; + fire_r[y][x] = fr; } + if(cmode == 4){ + uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255); + uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255); + uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255); + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + } + else if(t==PT_LCRY) + { + uint8 GR = 0x50+(parts[i].life*10); + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, GR); + if(cmode == 4){ + blendpixel(vid, nx+1, ny, GR, GR, GR, 223); + blendpixel(vid, nx-1, ny, GR, GR, GR, 223); + blendpixel(vid, nx, ny+1, GR, GR, GR, 223); + blendpixel(vid, nx, ny-1, GR, GR, GR, 223); + + blendpixel(vid, nx+1, ny-1, GR, GR, GR, 112); + blendpixel(vid, nx-1, ny-1, GR, GR, GR, 112); + blendpixel(vid, nx+1, ny+1, GR, GR, GR, 112); + blendpixel(vid, nx-1, ny+1, GR, GR, GR, 112); + } } else if(t==PT_PLSM) { float ttemp = (float)parts[i].life; @@ -1821,7 +1849,7 @@ void draw_parts(pixel *vid) //blendpixel(vid, nx+1, ny, R, G, B, 255); } } - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID) + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH) { uint8 R = PIXR(ptypes[t].pcolors); uint8 G = PIXG(ptypes[t].pcolors); diff --git a/powder.c b/powder.c index 550f5b1..cbe1fb7 100644 --- a/powder.c +++ b/powder.c @@ -644,21 +644,23 @@ void update_particles_i(pixel *vid, int start, int inc) { if(t==PT_WTRV && pv[y/CELL][x/CELL]>4.0f) t = parts[i].type = PT_DSTW; - if(t==PT_DESL && pv[y/CELL][x/CELL]<-6.0f) + if(t==PT_OIL && pv[y/CELL][x/CELL]<-6.0f) t = parts[i].type = PT_GAS; if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) - t = parts[i].type = PT_DESL; + t = parts[i].type = PT_OIL; if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) t = parts[i].type = PT_FIRE; } - if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f) - t = parts[i].type = PT_GAS; - if(t==PT_DESL && pv[y/CELL][x/CELL]>50.0f) // Only way I know to make it + if(t==PT_GAS && pv[y/CELL][x/CELL]<-6.0f) + t = parts[i].type = PT_OIL; + if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) // Only way I know to make it t = parts[i].type = PT_FIRE; // combust under pressure. - if(t==PT_GAS && pv[y/CELL][x/CELL]>20.0f) - t = parts[i].type = PT_DESL; + if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) + t = parts[i].type = PT_OIL; if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; + if(t==PT_BRCK && pv[y/CELL][x/CELL]>2.8f) + t = parts[i].type = PT_STNE; //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) // t = parts[i].type = PT_BGLA; if(t==PT_GLAS) @@ -1164,7 +1166,7 @@ void update_particles_i(pixel *vid, int start, int inc) pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough fe ++; } - /*if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) parts[r>>8].type = PT_DUST; if((r&0xFF)==PT_DYST && 15>(rand()%1000)) parts[r>>8].type = PT_YEST; @@ -1186,13 +1188,13 @@ void update_particles_i(pixel *vid, int start, int inc) if((r&0xFF)==PT_DESL && 15>(rand()%1000)) parts[r>>8].type = PT_GAS; if((r&0xFF)==PT_COAL && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD;*/ - if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && + parts[r>>8].type = PT_WOOD; + /*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| ptypes[parts[r>>8].type-1].menusection==SC_GAS|| ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000)) - parts[r>>8].type--; + parts[r>>8].type--;*/ } } else if(t==PT_PHOT) diff --git a/powder.h b/powder.h index e2ba4d2..866015f 100644 --- a/powder.h +++ b/powder.h @@ -104,7 +104,9 @@ #define PT_YEST 63 #define PT_DYST 64 #define PT_THRM 65 -#define PT_NUM 66 +#define PT_GLOW 66 +#define PT_BRCK 67 +#define PT_NUM 68 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -248,6 +250,8 @@ static const part_type ptypes[PT_NUM] = {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Thermite."}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow."}, + {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; @@ -320,6 +324,8 @@ static part_state pstates[PT_NUM] = /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static unsigned char can_move[PT_NUM][PT_NUM] = { @@ -331,72 +337,74 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X W S*/ /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l R T*/ -/* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ -/* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0}, /* Dust */ -/* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}, /* Watr */ -/* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, /* Oill */ -/* FIRE */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+/* GLOW */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0}, +/* BRCK */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y*/ /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X W S*/ -- cgit v0.9.2-21-gd62e From 6b27bc06ff48b22417193d7ac2ca7609c94100e3 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 6 Sep 2010 14:30:09 +0100 Subject: Fix METL heating NTCT or PTCT through insulator diff --git a/powder.c b/powder.c index cbe1fb7..5d1355a 100644 --- a/powder.c +++ b/powder.c @@ -938,7 +938,7 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL) + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL && pavg(i, r>>8)!=PT_INSL) { parts[i].temp = 473.0f; } -- cgit v0.9.2-21-gd62e From 6abf6602b3d41a257c657d294ce839a6b1f8bebd Mon Sep 17 00:00:00 2001 From: FacialTurd Date: Mon, 6 Sep 2010 15:07:14 -0700 Subject: diff --git a/powder.c b/powder.c index 5d1355a..bfe4329 100644 --- a/powder.c +++ b/powder.c @@ -938,7 +938,7 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL && pavg(i, r>>8)!=PT_INSL) + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL && parts_avg(i, r>>8)!=PT_INSL) { parts[i].temp = 473.0f; } -- cgit v0.9.2-21-gd62e From 19cf0df2df444f389daf962f1aaa49a9658e127f Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Tue, 7 Sep 2010 08:39:16 +0200 Subject: Astyle diff --git a/graphics.c b/graphics.c index f576f90..8962698 100644 --- a/graphics.c +++ b/graphics.c @@ -117,7 +117,7 @@ void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) { #ifdef OpenGL - RenderScene(); + RenderScene(); #else if(sdl_scale == 2) sdl_blit_2(x, y, w, h, src, pitch); @@ -708,7 +708,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) //x = 2+32*(b/2); //y = YRES+2+20*(b%2); #ifdef OpenGL - fillrect(vid_buf, x, y, 28, 16, PIXR(pc), PIXG(pc), PIXB(pc), 255); + fillrect(vid_buf, x, y, 28, 16, PIXR(pc), PIXG(pc), PIXB(pc), 255); #else for(j=1; j<15; j++) { @@ -847,13 +847,13 @@ int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) { #ifdef OpenGL - glBegin(GL_LINE_LOOP); - glColor4ub(r, g, b, a); - glVertex2i(x, y); - glVertex2i(x+w, y); - glVertex2i(x+w, y+h); - glVertex2i(x, y+h); - glEnd(); + glBegin(GL_LINE_LOOP); + glColor4ub(r, g, b, a); + glVertex2i(x, y); + glVertex2i(x+w, y); + glVertex2i(x+w, y+h); + glVertex2i(x, y+h); + glEnd(); #else int i; for(i=0; i<=w; i++) @@ -872,13 +872,13 @@ void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a void fillrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) { #ifdef OpenGL - glBegin(GL_QUADS); - glColor4ub(r, g, b, a); - glVertex2i(x, y); - glVertex2i(x+w, y); - glVertex2i(x+w, y+h); - glVertex2i(x, y+h); - glEnd(); + glBegin(GL_QUADS); + glColor4ub(r, g, b, a); + glVertex2i(x, y); + glVertex2i(x+w, y); + glVertex2i(x+w, y+h); + glVertex2i(x, y+h); + glEnd(); #else int i,j; for(j=1; j0){ - fg = 6 * pv[ny/CELL][nx/CELL]; - fb = 4 * pv[ny/CELL][nx/CELL]; - fr = 2 * pv[ny/CELL][nx/CELL]; - } - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255)); + else if(t==PT_GLOW) + { + fg = 0; + fb = 0; + fr = 0; + if(pv[ny/CELL][nx/CELL]>0) { + fg = 6 * pv[ny/CELL][nx/CELL]; + fb = 4 * pv[ny/CELL][nx/CELL]; + fr = 2 * pv[ny/CELL][nx/CELL]; + } + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255)); if(cmode == 3||cmode==4 || cmode==6) { x = nx/CELL; @@ -1634,37 +1634,37 @@ void draw_parts(pixel *vid) if(fr > 255) fr = 255; fire_r[y][x] = fr; } - if(cmode == 4){ - uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255); - uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255); - uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255); - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); - } + if(cmode == 4) { + uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255); + uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255); + uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255); + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } } else if(t==PT_LCRY) { - uint8 GR = 0x50+(parts[i].life*10); - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, GR); - if(cmode == 4){ - blendpixel(vid, nx+1, ny, GR, GR, GR, 223); - blendpixel(vid, nx-1, ny, GR, GR, GR, 223); - blendpixel(vid, nx, ny+1, GR, GR, GR, 223); - blendpixel(vid, nx, ny-1, GR, GR, GR, 223); - - blendpixel(vid, nx+1, ny-1, GR, GR, GR, 112); - blendpixel(vid, nx-1, ny-1, GR, GR, GR, 112); - blendpixel(vid, nx+1, ny+1, GR, GR, GR, 112); - blendpixel(vid, nx-1, ny+1, GR, GR, GR, 112); - } + uint8 GR = 0x50+(parts[i].life*10); + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, GR); + if(cmode == 4) { + blendpixel(vid, nx+1, ny, GR, GR, GR, 223); + blendpixel(vid, nx-1, ny, GR, GR, GR, 223); + blendpixel(vid, nx, ny+1, GR, GR, GR, 223); + blendpixel(vid, nx, ny-1, GR, GR, GR, 223); + + blendpixel(vid, nx+1, ny-1, GR, GR, GR, 112); + blendpixel(vid, nx-1, ny-1, GR, GR, GR, 112); + blendpixel(vid, nx+1, ny+1, GR, GR, GR, 112); + blendpixel(vid, nx-1, ny+1, GR, GR, GR, 112); + } } else if(t==PT_PLSM) { float ttemp = (float)parts[i].life; @@ -1841,7 +1841,7 @@ void draw_parts(pixel *vid) draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); - isplayer = 1; //It's a secret. Tssss... + isplayer = 1; //It's a secret. Tssss... } else { @@ -1869,11 +1869,11 @@ void draw_parts(pixel *vid) blendpixel(vid, nx+1, ny+1, R, G, B, 112); blendpixel(vid, nx-1, ny+1, R, G, B, 112); } - } + } #endif - } + } #ifdef OpenGL - glFlush (); + glFlush (); #endif } @@ -1968,33 +1968,33 @@ void prepare_alpha(void) pixel *render_packed_rgb(void *image, int width, int height, int cmp_size) { - unsigned char *tmp; - pixel *res; - int i; - - tmp = malloc(width*height*3); - if(!tmp) - return NULL; - res = malloc(width*height*PIXELSIZE); - if(!res) - { - free(tmp); - return NULL; - } - - i = width*height*3; - if(BZ2_bzBuffToBuffDecompress((char *)tmp, (unsigned *)&i, (char *)image, cmp_size, 0, 0)) - { - free(res); - free(tmp); - return NULL; - } - - for(i=0; i=42){ - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; - } else { - parts[i-1].temp = ((d[p++]*((O_MAX_TEMP+(-O_MIN_TEMP))/255))+O_MIN_TEMP)+273; - } + if(ver>=42) { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } else { + parts[i-1].temp = ((d[p++]*((O_MAX_TEMP+(-O_MIN_TEMP))/255))+O_MIN_TEMP)+273; + } } else { @@ -1089,7 +1089,7 @@ int main(int argc, char *argv[]) update_air(); } #ifdef OpenGL - ClearScreen(); + ClearScreen(); #else if(cmode==0 || cmode==1) { @@ -1106,7 +1106,7 @@ int main(int argc, char *argv[]) } #endif update_particles(vid_buf); - draw_parts(vid_buf); + draw_parts(vid_buf); if(cmode==2) { @@ -1160,15 +1160,15 @@ int main(int argc, char *argv[]) break; } } - if(sdl_key=='d' && isplayer) - { - death = 1; - //death = !(death); - } - if(sdl_key=='f') - { - framerender = 1; - } + if(sdl_key=='d' && isplayer) + { + death = 1; + //death = !(death); + } + if(sdl_key=='f') + { + framerender = 1; + } if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) { if(load_mode) @@ -1985,7 +1985,7 @@ int main(int argc, char *argv[]) { #ifdef BETA sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); - //printf("%s\n", uitext); + //printf("%s\n", uitext); #else sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); #endif @@ -2014,16 +2014,16 @@ int main(int argc, char *argv[]) fillrect(vid_buf, 12, 12, textwidth(uitext)+8, 15, 0, 0, 0, 140); drawtext(vid_buf, 16, 16, uitext, 32, 216, 255, 200); } - sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE); + sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE); - //Setting an element for the stick man - if(isplayer==0) - { - if(ptypes[sr].falldown>0 || sr == PT_NEUT || sr == PT_PHOT) - player[2] = sr; - else - player[2] = PT_DUST; - } + //Setting an element for the stick man + if(isplayer==0) + { + if(ptypes[sr].falldown>0 || sr == PT_NEUT || sr == PT_PHOT) + player[2] = sr; + else + player[2] = PT_DUST; + } } diff --git a/powder.c b/powder.c index bfe4329..770e877 100644 --- a/powder.c +++ b/powder.c @@ -192,7 +192,7 @@ inline int create_part(int p, int x, int y, int t) (pmap[y][x]&0xFF)!=PT_ETRD && (pmap[y][x]&0xFF)!=PT_BRMT && (pmap[y][x]&0xFF)!=PT_NBLE && - (pmap[y][x]&0xFF)!=PT_INWR) + (pmap[y][x]&0xFF)!=PT_INWR) return -1; parts[pmap[y][x]>>8].type = PT_SPRK; parts[pmap[y][x]>>8].life = 4; @@ -289,10 +289,10 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 100; parts[i].ctype = 0; parts[i].temp = ptypes[t].heat; - - - player[3] = x-1; //Setting legs positions + + + player[3] = x-1; //Setting legs positions player[4] = y+6; player[5] = x-1; player[6] = y+6; @@ -463,14 +463,14 @@ void update_particles_i(pixel *vid, int start, int inc) for(i=start; i<(NPART-starti); i+=inc) if(parts[i].type) { - //printf("parts[%d].type: %d\n", i, parts[i].type); + //printf("parts[%d].type: %d\n", i, parts[i].type); lx = parts[i].x; ly = parts[i].y; t = parts[i].type; if(sys_pause&&!framerender) - return; + return; if(parts[i].life && t!=PT_ACID && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM) { @@ -574,8 +574,8 @@ void update_particles_i(pixel *vid, int start, int inc) } else { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; } if(ptypes[t].diffusion) @@ -659,7 +659,7 @@ void update_particles_i(pixel *vid, int start, int inc) t = parts[i].type = PT_OIL; if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; - if(t==PT_BRCK && pv[y/CELL][x/CELL]>2.8f) + if(t==PT_BRCK && pv[y/CELL][x/CELL]>2.8f) t = parts[i].type = PT_STNE; //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) // t = parts[i].type = PT_BGLA; @@ -747,11 +747,11 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_LAVA&&parts[i].ctype) { parts[i].life = 0; - if(parts[i].ctype==PT_THRM) - { - parts[i].tmp = 0; - parts[i].ctype = PT_BMTL; - } + if(parts[i].ctype==PT_THRM) + { + parts[i].tmp = 0; + parts[i].ctype = PT_BMTL; + } t = parts[i].type = parts[i].ctype; parts[i].ctype = PT_NONE; } @@ -812,11 +812,11 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_LAVA) { parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - if(parts[i].ctype==PT_THRM&&parts[i].tmp>0) - { - parts[i].tmp--; - parts[i].temp = 3500; - } + if(parts[i].ctype==PT_THRM&&parts[i].tmp>0) + { + parts[i].tmp--; + parts[i].temp = 3500; + } } pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); } @@ -968,7 +968,7 @@ void update_particles_i(pixel *vid, int start, int inc) //t = parts[i].type = PT_WATR; } } - else if(t==PT_THRM) + else if(t==PT_THRM) { for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) @@ -979,18 +979,18 @@ void update_particles_i(pixel *vid, int start, int inc) continue; if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA)) { - if(1>(rand()%500)){ - t = parts[i].type = PT_LAVA; - parts[i].ctype = PT_BMTL; - pt = parts[i].temp = 3500.0f; - pv[y/CELL][x/CELL] += 50.0f; - } else { - t = parts[i].type = PT_LAVA; - parts[i].life = 400; - parts[i].ctype = PT_THRM; - pt = parts[i].temp = 3500.0f; - parts[i].tmp = 20; - } + if(1>(rand()%500)) { + t = parts[i].type = PT_LAVA; + parts[i].ctype = PT_BMTL; + pt = parts[i].temp = 3500.0f; + pv[y/CELL][x/CELL] += 50.0f; + } else { + t = parts[i].type = PT_LAVA; + parts[i].life = 400; + parts[i].ctype = PT_THRM; + pt = parts[i].temp = 3500.0f; + parts[i].tmp = 20; + } } //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) //t = parts[i].type = PT_WATR; @@ -1170,13 +1170,13 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_DUST; if((r&0xFF)==PT_DYST && 15>(rand()%1000)) parts[r>>8].type = PT_YEST; - if((r&0xFF)==PT_YEST){ - if(15>(rand()%100000)&&isplayer==0) - parts[r>>8].type = PT_STKM; - else - parts[r>>8].type = PT_DYST; - } - + if((r&0xFF)==PT_YEST) { + if(15>(rand()%100000)&&isplayer==0) + parts[r>>8].type = PT_STKM; + else + parts[r>>8].type = PT_DYST; + } + if((r&0xFF)==PT_WATR && 15>(rand()%100)) parts[r>>8].type = PT_DSTW; if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) @@ -1189,12 +1189,12 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_GAS; if((r&0xFF)==PT_COAL && 5>(rand()%100)) parts[r>>8].type = PT_WOOD; - /*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && - (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| - ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| - ptypes[parts[r>>8].type-1].menusection==SC_GAS|| - ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000)) - parts[r>>8].type--;*/ + /*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && + (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| + ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| + ptypes[parts[r>>8].type-1].menusection==SC_GAS|| + ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000)) + parts[r>>8].type--;*/ } } else if(t==PT_PHOT) @@ -1256,7 +1256,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1272,36 +1272,36 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - }else if(t==PT_SWCH) + } else if(t==PT_SWCH) { rt = 3 + (int)pv[y/CELL][x/CELL]; for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) continue; rt = parts[r>>8].type; - if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8)!=PT_INSL) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } + if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8)!=PT_INSL) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } } - if(t==PT_SWCH) - if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) - { - parts[i].life--; - } + if(t==PT_SWCH) + if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) + { + parts[i].life--; + } if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) { for(nx=-2; nx<3; nx++) @@ -1444,7 +1444,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].ctype = rt; } } - if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; @@ -1492,7 +1492,7 @@ killed: } if(t==PT_STKM) { - float dt = 0.9;///(FPSB*FPSB); //Delta time in square + float dt = 0.9;///(FPSB*FPSB); //Delta time in square //Tempirature handling if(parts[i].temp<243) parts[i].life -= 1; @@ -1502,7 +1502,7 @@ killed: //Death if(parts[i].life<1 || death == 1 || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... { - death = 0; + death = 0; for(r=-2; r<=1; r++) { create_part(-1, x+r, y-2, player[2]); @@ -1514,7 +1514,7 @@ killed: goto killed; } - parts[i].vy += -0.7*dt; //Head up! + parts[i].vy += -0.7*dt; //Head up! //Verlet integration pp = 2*player[3]-player[5]+player[19]*dt*dt;; @@ -1545,18 +1545,18 @@ killed: player[18] = player[16]; player[16] = pp; - //Setting acceleration to 0 - player[19] = 0; - player[20] = 0; + //Setting acceleration to 0 + player[19] = 0; + player[20] = 0; - player[21] = 0; - player[22] = 0; + player[21] = 0; + player[22] = 0; - player[23] = 0; - player[24] = 0; + player[23] = 0; + player[24] = 0; - player[25] = 0; - player[26] = 0; + player[25] = 0; + player[26] = 0; //Go left if (((int)(player[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) @@ -1566,32 +1566,32 @@ killed: { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { - player[21] = -3; - player[22] = -2; - player[19] = -2; + player[21] = -3; + player[22] = -2; + player[19] = -2; } if (pmap[(int)(player[16]-1)][(int)(player[15])]) { player[25] = -3; - player[26] = -2; - player[23] = -2; + player[26] = -2; + player[23] = -2; } } else { if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids { - player[21] = -1; - player[22] = -1; - player[19] = -1; + player[21] = -1; + player[22] = -1; + player[19] = -1; } if (pmap[(int)(player[16]-1)][(int)(player[15])]) { - player[25] = -1; - player[26] = -1; - player[23] = -1; + player[25] = -1; + player[26] = -1; + player[23] = -1; } } } @@ -1604,47 +1604,47 @@ killed: { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { -player[21] = 3; -player[22] = -2; -player[19] = 2; + player[21] = 3; + player[22] = -2; + player[19] = 2; } if (pmap[(int)(player[16]-1)][(int)(player[15])]) { -player[25] = 3; -player[26] = -2; -player[23] = 2; + player[25] = 3; + player[26] = -2; + player[23] = 2; } } else { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { -player[21] = 1; -player[22] = -1; -player[19] = 1; + player[21] = 1; + player[22] = -1; + player[19] = 1; } if (pmap[(int)(player[16]-1)][(int)(player[15])]) { -player[25] = 1; -player[26] = -1; -player[23] = 1; + player[25] = 1; + player[26] = -1; + player[23] = 1; } } } - //Jump - if (((int)(player[0])&0x04) == 0x04 && (pstates[pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF].state != ST_GAS || pstates[pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF].state != ST_GAS)) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[22] -= 1; - player[26] -= 1; - } - } + //Jump + if (((int)(player[0])&0x04) == 0x04 && (pstates[pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF].state != ST_GAS || pstates[pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF].state != ST_GAS)) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[22] -= 1; + player[26] -= 1; + } + } //Charge detector wall if foot inside if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) @@ -1659,9 +1659,9 @@ player[23] = 1; if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) continue; if(ptypes[pmap[ny+y][nx+x]&0xFF].falldown!=0 || (pmap[ny+y][nx+x]&0xFF) == PT_NEUT || (pmap[ny+y][nx+x]&0xFF) == PT_PHOT) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP { if(parts[i].life<=95) @@ -1676,8 +1676,8 @@ player[23] = 1; parts[i].life -= (102-parts[i].life)/2; kill_part(pmap[ny+y][nx+x]>>8); } - if(bmap[(ny+y)/CELL][(nx+x)/CELL]==4) - player[2] = SPC_AIR; + if(bmap[(ny+y)/CELL][(nx+x)/CELL]==4) + player[2] = SPC_AIR; } //Head position @@ -1697,10 +1697,10 @@ player[23] = 1; } else { - if(player[2] == SPC_AIR) - create_parts(nx + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01), ny, 4, SPC_AIR); - else - create_part(-1, nx, ny, player[2]); + if(player[2] == SPC_AIR) + create_parts(nx + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01), ny, 4, SPC_AIR); + else + create_part(-1, nx, ny, player[2]); r = pmap[ny][nx]; if( ((r>>8) < NPART) && (r>>8)>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR) @@ -1753,11 +1753,11 @@ player[23] = 1; for(nx = -3; nx <= 3; nx++) { r = pmap[(int)(player[16]-2)][(int)(player[15]+nx)]; - if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID) + if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID) player[15] -= nx; r = pmap[(int)(player[8]-2)][(int)(player[7]+nx)]; - if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID) + if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID) player[7] -= nx; } @@ -1780,11 +1780,11 @@ player[23] = 1; } else { - if(pstates[r&0xFF].state != ST_GAS) - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy*dt; - } + if(pstates[r&0xFF].state != ST_GAS) + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy*dt; + } } player[9] = player[7]; } @@ -1806,10 +1806,10 @@ player[23] = 1; else { if(pstates[r&0xFF].state != ST_GAS) - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy*dt; - } + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy*dt; + } } player[17] = player[15]; } @@ -1826,14 +1826,14 @@ player[23] = 1; //Keeping legs distance if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) { - player[21] -= 0.2; - player[25] += 0.2; + player[21] -= 0.2; + player[25] += 0.2; } if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) { player[19] -= 0.2; - player[23] += 0.2; + player[23] += 0.2; } //If legs touch something @@ -1900,16 +1900,16 @@ player[23] = 1; } if(t==PT_YEST) { - if(parts[i].temp>303&&parts[i].temp<317){ - create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST); - } + if(parts[i].temp>303&&parts[i].temp<317) { + create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST); + } } if(t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1) { parts[i].type = PT_NBLE; parts[i].life = 0; } - if (t==PT_FIRE && parts[i].life <=1 && parts[i].temp<673) + if (t==PT_FIRE && parts[i].life <=1 && parts[i].temp<673) { t = parts[i].type = PT_SMKE; parts[i].life = rand()%20+250; @@ -2068,16 +2068,16 @@ player[23] = 1; } } } - if(nx=XRES-CELL || ny=YRES-CELL) - { + if(nx=XRES-CELL || ny=YRES-CELL) + { kill_part(i); continue; } } - if(framerender){ - framerender = 0; - sys_pause = 1; - } + if(framerender) { + framerender = 0; + sys_pause = 1; + } } void update_particles(pixel *vid) diff --git a/powder.h b/powder.h index 866015f..d4bc90f 100644 --- a/powder.h +++ b/powder.h @@ -137,7 +137,7 @@ struct particle float temp; float pavg[2]; int flags; - int tmp; + int tmp; }; typedef struct particle particle; @@ -244,15 +244,15 @@ static const part_type ptypes[PT_NUM] = {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f+273.15f, 88, "Smoke"}, {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f +273.15f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, - {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Thermite."}, - {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow."}, - {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f +273.15f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Thermite."}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow."}, + {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; static part_state pstates[PT_NUM] = @@ -320,11 +320,11 @@ static part_state pstates[PT_NUM] = /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 453.0f, PT_NONE, 0.0f}, /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 50.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static unsigned char can_move[PT_NUM][PT_NUM] = @@ -333,82 +333,82 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ -/* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y */ -/* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ -/* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X W S*/ -/* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l R T*/ -/* NONE */ {0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0}, -/* BRCK */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, -/* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y*/ -/* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ -/* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X W S*/ -/* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l R T*/ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X W S*/ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l R T*/ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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B T P E N N B L S S S P D C L O I Y*/ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X W S*/ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l R T*/ }; extern int isplayer; -- cgit v0.9.2-21-gd62e From 17f7caf5d5adee680d511e692bb757afe1402e5d Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Tue, 7 Sep 2010 20:38:08 +0200 Subject: added auto update and build file.. will see if it works diff --git a/script.sh b/script.sh new file mode 100755 index 0000000..682a4ae --- /dev/null +++ b/script.sh @@ -0,0 +1,11 @@ +#!/bin/bash +git pull +make powder-64-sse3 +make powder-64-sse2 +make powder-sse3 +make powder-debug +make powder-sse2 +make powder +make powder-sse +tar czf PowderToyGit.tar.gz ./ + -- cgit v0.9.2-21-gd62e From 89dc0c34c1ac946dcc3589f5c6268f7b380ed4b1 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Fri, 10 Sep 2010 15:28:53 +0200 Subject: fixed LN2 freezing. diff --git a/powder.h b/powder.h index d4bc90f..a25951b 100644 --- a/powder.h +++ b/powder.h @@ -221,7 +221,7 @@ static const part_type ptypes[PT_NUM] = {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax."}, {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -205.0f +273.15f, 70, "Liquid Nitrogen. Very cold."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -195.0f +273.15f, 70, "Liquid Nitrogen. Very cold."}, {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up."}, {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f+273.15f, 255, "White hole, pushes other particles away."}, @@ -295,7 +295,7 @@ static part_state pstates[PT_NUM] = /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LNTG */ {ST_SOLID, PT_NICE, 75.0f, PT_NONE, 0.0f, PT_NONE, 78.0f, PT_NONE, 0.0f}, + /* LNTG */ {ST_SOLID, PT_NICE, 76.0f, PT_NONE, 0.0f, PT_NONE, 78.0f, PT_NONE, 0.0f}, /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, -- cgit v0.9.2-21-gd62e From b89be2174921dc4f4e15911ce59546ef16f65dd6 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Fri, 10 Sep 2010 15:32:49 +0200 Subject: changed temperature of THDR and PLSM diff --git a/powder.h b/powder.h index a25951b..469b45d 100644 --- a/powder.h +++ b/powder.h @@ -232,8 +232,8 @@ static const part_type ptypes[PT_NUM] = {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 3500.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 3500.0f +273.15f, 115, "Plasma, extremely hot."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, -250.0f +273.15f, 46, "Nitrogen Ice."}, {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, -- cgit v0.9.2-21-gd62e From 959f3a24c61f234d7c2cab86072011076b14be17 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Fri, 10 Sep 2010 22:10:41 +0200 Subject: added a test blendpixel for opengl. No idea if it works diff --git a/Makefile b/Makefile index 72e2617..233d493 100755 --- a/Makefile +++ b/Makefile @@ -3,9 +3,9 @@ SOURCES := *.c CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations LFLAGS := -lSDL -lm -lbz2 -MFLAGS_SSE3 := -march=k8 -DX86 -DX86_SSE3 -msse3 -MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2 -msse2 -MFLAGS_SSE := -march=pentium3 -DX86 -DX86_SSE +MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3 +MFLAGS_SSE2 := -march=native-DX86 -DX86_SSE2 -msse2 +MFLAGS_SSE := -march=native -DX86 -DX86_SSE FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -O2 -march=k8 -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lbz2 COMPILER := gcc LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 diff --git a/graphics.c b/graphics.c index 8962698..6c1afdb 100644 --- a/graphics.c +++ b/graphics.c @@ -967,6 +967,14 @@ inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) #endif { #ifdef OpenGL + if(x<0 || y<0 || x>=XRES || r>=YRES) + return; + if(a!=255) + { + glBegin (GL_QUADS); + glColor4ub(r,g,b,a); + glVertex2i(x, y); + } #else pixel t; if(x<0 || y<0 || x>=XRES || y>=YRES) -- cgit v0.9.2-21-gd62e From d640bd26d8b7f5b53f0f685e53ce5181f349fad4 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 10 Sep 2010 21:13:29 +0100 Subject: Some changes diff --git a/interface.c b/interface.c index f6ef749..a17caca 100644 --- a/interface.c +++ b/interface.c @@ -2002,6 +2002,7 @@ int search_ui(pixel *vid_buf) dp = pos; } } + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, YRES/GRID_S+3, 128, 128, 128, 255); if(mp==pos && !st) drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); else @@ -2060,11 +2061,11 @@ int search_ui(pixel *vid_buf) nyd = search_scoredown[pos]/ry; } - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 187, 40, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 40, 0, 255); + fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 57, 187, 57, 255); + fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 57, 57, 255); - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); + //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); } } diff --git a/powder.c b/powder.c index 770e877..449693f 100644 --- a/powder.c +++ b/powder.c @@ -63,7 +63,7 @@ int try_move(int i, int x, int y, int nx, int ny) { return 1; } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE) + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) { return 0; } @@ -514,6 +514,7 @@ void update_particles_i(pixel *vid, int start, int inc) (bmap[y/CELL][x/CELL]==2) || (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) { -- cgit v0.9.2-21-gd62e From c083860ea1f3547090b71d18f77bc3527333252e Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Fri, 10 Sep 2010 22:33:01 +0200 Subject: added some opengl stuff, strange bug with rendering it tho diff --git a/graphics.c b/graphics.c index 6c1afdb..eeb0d50 100644 --- a/graphics.c +++ b/graphics.c @@ -975,6 +975,7 @@ inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) glColor4ub(r,g,b,a); glVertex2i(x, y); } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); #else pixel t; if(x<0 || y<0 || x>=XRES || y>=YRES) @@ -1175,6 +1176,48 @@ void draw_parts(pixel *vid) float pt = R_TEMP; for(i = 0; i Date: Fri, 10 Sep 2010 22:48:19 +0200 Subject: no idea what I changed, check commit diff --git a/powder-64-sse3-opengl b/powder-64-sse3-opengl deleted file mode 100755 index 5253a6a..0000000 Binary files a/powder-64-sse3-opengl and /dev/null differ -- cgit v0.9.2-21-gd62e From 812cf13ed22ff195be6c5bdaa90286b562c7e9cc Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 11 Sep 2010 22:11:05 +0100 Subject: Half-Implemented history diff --git a/defines.h b/defines.h index f59eb4e..73ab019 100644 --- a/defines.h +++ b/defines.h @@ -8,7 +8,7 @@ #endif #define SAVE_VERSION 42 -#define MINOR_VERSION 0 +#define MINOR_VERSION 1 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. #define BETA diff --git a/graphics.c b/graphics.c index eeb0d50..cc0e491 100644 --- a/graphics.c +++ b/graphics.c @@ -2114,13 +2114,16 @@ pixel *prerender_save(void *save, int size, int *width, int *height) { unsigned char *d,*c=save; int i,j,k,x,y,rx,ry,p=0; - int bw,bh,w,h; + int bw,bh,w,h,new_format = 0; pixel *fb; if(size<16) return NULL; - if(c[2]!=0x43 || c[1]!=0x75 || c[0]!=0x66) + if(!(c[2]==0x43 && c[1]==0x75 && c[0]==0x66) && !(c[2]==0x76 && c[1]==0x53 && c[0]==0x50)) return NULL; + if(c[2]==0x43 && c[1]==0x75 && c[0]==0x66){ + new_format = 1; + } if(c[4]>SAVE_VERSION) return NULL; diff --git a/interface.c b/interface.c index a17caca..31d28ca 100644 --- a/interface.c +++ b/interface.c @@ -35,6 +35,7 @@ void *svf_last = NULL; int svf_lsize; char *search_ids[GRID_X*GRID_Y]; +char *search_dates[GRID_X*GRID_Y]; int search_votes[GRID_X*GRID_Y]; int search_publish[GRID_X*GRID_Y]; int search_scoredown[GRID_X*GRID_Y]; @@ -1563,11 +1564,11 @@ int sdl_poll(void) sdl_zoom_trig = 1; Z_keysym = event.key.keysym.sym; } - if( event.key.keysym.sym == SDLK_PLUS || event.key.keysym.sym == SDLK_RIGHTBRACKET) + if( event.key.keysym.sym == SDLK_PLUS) { sdl_wheel++; } - if( event.key.keysym.sym == SDLK_MINUS || event.key.keysym.sym == SDLK_LEFTBRACKET) + if( event.key.keysym.sym == SDLK_MINUS) { sdl_wheel--; } @@ -1788,6 +1789,7 @@ int search_ui(pixel *vid_buf) memset(img_id, 0, sizeof(img_id)); memset(search_ids, 0, sizeof(search_ids)); + memset(search_dates, 0, sizeof(search_dates)); memset(search_names, 0, sizeof(search_names)); memset(search_scoreup, 0, sizeof(search_scoreup)); memset(search_scoredown, 0, sizeof(search_scoredown)); @@ -1962,7 +1964,7 @@ int search_ui(pixel *vid_buf) } else pos = gi+GRID_X*gj; - if(!search_ids[pos]) + if(!search_dates[pos]) break; gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; gy = ((((YRES-(MENUSIZE-20))+15)/GRID_Y)*gj) + ((YRES-(MENUSIZE-20))/GRID_Y-(YRES-(MENUSIZE-20))/GRID_S+10)/2 + 18; @@ -2003,6 +2005,9 @@ int search_ui(pixel *vid_buf) } } drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, YRES/GRID_S+3, 128, 128, 128, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, 1+(YRES/GRID_S+3)/2, 0, 107, 10, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 6, 1+(YRES/GRID_S+3)/2, 107, 10, 0, 255); + if(mp==pos && !st) drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); else @@ -2061,10 +2066,10 @@ int search_ui(pixel *vid_buf) nyd = search_scoredown[pos]/ry; } - fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 57, 187, 57, 255); - fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 187, 57, 57, 255); - //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-1+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 57, 187, 57, 255); + fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 4, nyd, 187, 57, 57, 255); + //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); } } @@ -2157,9 +2162,17 @@ int search_ui(pixel *vid_buf) fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); info_box(vid_buf, "Loading..."); - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); + if(search_dates[mp]){ + uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + strcaturl(uri, "&Date="); + strcaturl(uri, search_dates[mp]); + } else { + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + } data = http_simple_get(uri, &status, &dlen); free(uri); @@ -2436,7 +2449,7 @@ finish: int search_results(char *str, int votes) { int i,j; - char *p,*q,*r,*s,*vu,*vd,*pu; + char *p,*q,*r,*s,*vu,*vd,*pu,*sd; for(i=0; i=GRID_X*GRID_Y) + break; + if(votes) + { + sd = strchr(str+8, ' '); + if(!sd) + return i; + *(sd++) = 0; + pu = strchr(sd, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + sd = strchr(str+8, ' '); + if(!sd) + return i; + *(sd++) = 0; + pu = strchr(sd, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+8); + + search_dates[i] = mystrdup(sd); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str+8, search_thumbs+i, search_thsizes+i); i++; } else if(!strncmp(str, "TAG ", 4)) diff --git a/interface.h b/interface.h index 7910c66..7f13064 100644 --- a/interface.h +++ b/interface.h @@ -101,6 +101,7 @@ extern void *svf_last; extern int svf_lsize; extern char *search_ids[GRID_X*GRID_Y]; +extern char *search_dates[GRID_X*GRID_Y]; extern int search_votes[GRID_X*GRID_Y]; extern int search_publish[GRID_X*GRID_Y]; extern int search_scoredown[GRID_X*GRID_Y]; diff --git a/main.c b/main.c index a5f88ed..f8e11f6 100644 --- a/main.c +++ b/main.c @@ -231,7 +231,7 @@ void *build_thumb(int *size, int bzip2) void *build_save(int *size, int x0, int y0, int w, int h) { - unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*7+MAXSIGNS*262), *c; + unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*8+MAXSIGNS*262), *c; int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)); int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL; @@ -310,10 +310,10 @@ void *build_save(int *size, int x0, int y0, int w, int h) i = m[j]; if(i) { - unsigned char tttemp = (unsigned char)((parts[i-1].temp+(-MIN_TEMP))/((MAX_TEMP+(-MIN_TEMP))/255)); - //if(tttemp<0) tttemp=0; - //if(tttemp>255) tttemp=255; - d[p++] = tttemp; + //New Temperature saving uses a 16bit unsigned int for temperatures, giving a precision of 1 degree versus 36 for the old format + int tttemp = (int)parts[i-1].temp; + d[p++] = ((tttemp&0xFF00)>>8); + d[p++] = (tttemp&0x00FF); } } for(j=0; jSAVE_VERSION) return 2; ver = c[4]; @@ -590,7 +600,13 @@ int parse_save(void *save, int size, int replace, int x0, int y0) if(i <= NPART) { if(ver>=42) { - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + if(new_format){ + ttv = (d[p++])<<8; + ttv |= (d[p++]); + parts[i-1].temp = ttv; + } else { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } } else { parts[i-1].temp = ((d[p++]*((O_MAX_TEMP+(-O_MIN_TEMP))/255))+O_MIN_TEMP)+273; } @@ -598,6 +614,9 @@ int parse_save(void *save, int size, int replace, int x0, int y0) else { p++; + if(new_format){ + p++; + } } } else @@ -1234,6 +1253,50 @@ int main(int argc, char *argv[]) { set_cmode(6); } + if(sdl_key==SDLK_LEFTBRACKET){ + if(sdl_zoom_trig==1) + { + ZSIZE -= 1; + if(ZSIZE>32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + } + else + { + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + bs -= 1; + else + bs -= ceil((bs/5)+0.5f); + if(bs>1224) + bs = 1224; + if(bs<0) + bs = 0; + } + } + if(sdl_key==SDLK_RIGHTBRACKET){ + if(sdl_zoom_trig==1) + { + ZSIZE += 1; + if(ZSIZE>32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + } + else + { + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + bs += 1; + else + bs += ceil((bs/5)+0.5f); + if(bs>1224) + bs = 1224; + if(bs<0) + bs = 0; + } + } if(sdl_key==SDLK_SPACE) sys_pause = !sys_pause; if(sdl_key=='h') diff --git a/powder.c b/powder.c index 449693f..c9a55c3 100644 --- a/powder.c +++ b/powder.c @@ -245,6 +245,8 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = rand()%120+240; if(t==PT_NBLE) parts[i].life = 0; + if(t==PT_ICEI) + parts[i].ctype = PT_WATR; if(t==PT_NEUT) { float r = (rand()%128+128)/127.0f; @@ -701,6 +703,8 @@ void update_particles_i(pixel *vid, int start, int inc) int ctemp = pv[y/CELL][x/CELL]*2; c_heat = 0.0f; h_count = 0; + if(t==PT_ICEI && !parts[i].ctype) + parts[i].ctype = PT_WATR; if(ptypes[t].hconduct>(rand()%250)) { for(nx=-1; nx<2; nx++) @@ -822,11 +826,11 @@ void update_particles_i(pixel *vid, int start, int inc) pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); } } - if(t==PT_PTCT&&parts[i].temp>249.0f) + if(t==PT_PTCT&&parts[i].temp>295.0f) { pt = parts[i].temp -= 2.5f; } - if(t==PT_NTCT&&parts[i].temp>249.0f) + if(t==PT_NTCT&&parts[i].temp>295.0f) { pt = parts[i].temp -= 2.5f; } diff --git a/powder.h b/powder.h index 469b45d..efbea86 100644 --- a/powder.h +++ b/powder.h @@ -221,7 +221,7 @@ static const part_type ptypes[PT_NUM] = {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax."}, {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, -195.0f +273.15f, 70, "Liquid Nitrogen. Very cold."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up."}, {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f+273.15f, 255, "White hole, pushes other particles away."}, @@ -232,10 +232,10 @@ static const part_type ptypes[PT_NUM] = {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, -250.0f +273.15f, 46, "Nitrogen Ice."}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, @@ -244,7 +244,7 @@ static const part_type ptypes[PT_NUM] = {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f+273.15f, 88, "Smoke"}, {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, -210.0f +273.15f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, @@ -274,14 +274,14 @@ static part_state pstates[PT_NUM] = /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WTRV */ {ST_GAS, PT_ICEI, 0.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, + /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -295,7 +295,7 @@ static part_state pstates[PT_NUM] = /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LNTG */ {ST_SOLID, PT_NICE, 76.0f, PT_NONE, 0.0f, PT_NONE, 78.0f, PT_NONE, 0.0f}, + /* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f}, /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -309,7 +309,7 @@ static part_state pstates[PT_NUM] = /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 77.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -318,10 +318,10 @@ static part_state pstates[PT_NUM] = /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 453.0f, PT_NONE, 0.0f}, - /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 50.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, + /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, -- cgit v0.9.2-21-gd62e From a92da37559aa6e68d9165ff4f69f83517594bcc4 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 13 Sep 2010 22:36:43 +0100 Subject: History almost complete, couple of bug fixes diff --git a/interface.c b/interface.c index 31d28ca..1f972b3 100644 --- a/interface.c +++ b/interface.c @@ -1964,7 +1964,7 @@ int search_ui(pixel *vid_buf) } else pos = gi+GRID_X*gj; - if(!search_dates[pos]) + if(!search_ids[pos]) break; gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; gy = ((((YRES-(MENUSIZE-20))+15)/GRID_Y)*gj) + ((YRES-(MENUSIZE-20))/GRID_Y-(YRES-(MENUSIZE-20))/GRID_S+10)/2 + 18; @@ -2166,7 +2166,7 @@ int search_ui(pixel *vid_buf) uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71); strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); strcaturl(uri, search_ids[mp]); - strcaturl(uri, "&Date="); + strappend(uri, "&Date="); strcaturl(uri, search_dates[mp]); } else { uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); @@ -2384,9 +2384,22 @@ int search_ui(pixel *vid_buf) thlen = 4; } thumb_cache_add(img_id[i], thumb, thlen); - for(pos=0; pos Date: Thu, 16 Sep 2010 13:37:53 +0100 Subject: Fix Part_avg function and COAL, temperature signs diff --git a/graphics.c b/graphics.c index cc0e491..47c843f 100644 --- a/graphics.c +++ b/graphics.c @@ -1950,7 +1950,7 @@ void render_signs(pixel *vid_buf) if(strcmp(signs[i].text, "{t}")==0) { if((pmap[signs[i].y][signs[i].x]>>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp); //...tempirature + sprintf(buff, "Temp: %4.2f", parts[pmap[signs[i].y][signs[i].x]>>8].temp-273.15); //...tempirature else sprintf(buff, "Temp: 0.00"); //...tempirature drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); diff --git a/powder.c b/powder.c index c9a55c3..b5db6ff 100644 --- a/powder.c +++ b/powder.c @@ -421,7 +421,7 @@ inline int parts_avg(int ci, int ni) #endif { int pmr = pmap[(int)((parts[ci].y + parts[ni].y)/2)][(int)((parts[ci].x + parts[ni].x)/2)]; - if((pmr>>8) < NPART && (pmr>>8) >= 0) + if((pmr>>8) < NPART && (pmr>>8) >= 1) { return parts[pmr>>8].type; } diff --git a/powder.h b/powder.h index d42d8db..2461455 100644 --- a/powder.h +++ b/powder.h @@ -333,82 +333,82 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K a s a X W S*/ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E s l l R T*/ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0}, /* Dust */ - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0}, /* Watr */ - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0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1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0}, /* YEST */ - /* DYST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0}, /* DYST */ - /* THRM */ {0,1,1,1,1,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,1,0,1,0}, /* THRM */ - /* GLOW */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0}, - /* BRCK */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S P D C L O I Y*/ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M l e o O 2 N E*/ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K a s a X W S*/ - /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E s l l R T*/ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E*/ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S*/ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T*/ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0}, /* Dust */ + /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0}, /* Watr */ + /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, /* Oill */ + /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},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0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0}, /* THRM */ + /* GLOW */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0}, + /* BRCK */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y*/ + /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M e o O 2 N E*/ + /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K s a X W S*/ + /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E l l R T*/ }; extern int isplayer; -- cgit v0.9.2-21-gd62e From 2ba8be7e492d0f3e964e51e7f0e5240ada0db6d8 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 16 Sep 2010 17:58:55 +0100 Subject: Improved Thermograph gradient diff --git a/hmap.h b/hmap.h index 8af6e71..92605f2 100755 --- a/hmap.h +++ b/hmap.h @@ -19,6 +19,13 @@ */ #ifndef HMAP_H #define HMAP_H -static char color_data[] = {0xD9,0xFF,0xFE,0xD4,0xFB,0xFC,0xCF,0xF6,0xF9,0xC9,0xF1,0xF6,0xC2,0xEB,0xF4,0xBB,0xE5,0xF0,0xB3,0xDE,0xED,0xAA,0xD6,0xE9,0xA1,0xCF,0xE5,0x98,0xC7,0xE2,0x8E,0xBF,0xDD,0x85,0xB6,0xD9,0x7B,0xAD,0xD5,0x71,0xA5,0xD0,0x67,0x9C,0xCC,0x5D,0x93,0xC7,0x53,0x8A,0xC3,0x4A,0x82,0xBE,0x41,0x79,0xB9,0x38,0x71,0xB5,0x30,0x69,0xB0,0x28,0x61,0xAC,0x21,0x5A,0xA8,0x1B,0x53,0xA3,0x16,0x4D,0x9F,0x12,0x47,0x9B,0x0F,0x42,0x98,0x0F,0x3D,0x94,0x0F,0x39,0x90,0x0F,0x34,0x8C,0x0F,0x30,0x89,0x0F,0x2C,0x85,0x0F,0x28,0x81,0x0F,0x24,0x7D,0x0F,0x20,0x7A,0x0F,0x1D,0x76,0x0F,0x1A,0x72,0x0F,0x16,0x6F,0x0F,0x13,0x6B,0x0F,0x11,0x67,0x10,0x0E,0x64,0x12,0x0C,0x60,0x15,0x0A,0x5D,0x18,0x08,0x59,0x1B,0x06,0x56,0x1D,0x04,0x53,0x20,0x03,0x4F,0x23,0x02,0x4C,0x26,0x01,0x49,0x29,0x01,0x46,0x2C,0x00,0x43,0x2F,0x00,0x40,0x30,0x00,0x3F,0x31,0x00,0x3F,0x31,0x00,0x3E,0x32,0x00,0x3E,0x32,0x00,0x3D,0x33,0x00,0x3D,0x33,0x00,0x3C,0x34,0x00,0x3C,0x34,0x00,0x3B,0x35,0x01,0x3B,0x36,0x01,0x3B,0x36,0x01,0x3A,0x37,0x01,0x3A,0x37,0x01,0x39,0x38,0x01,0x39,0x39,0x01,0x38,0x39,0x02,0x38,0x3A,0x02,0x37,0x3B,0x02,0x37,0x3B,0x02,0x36,0x3C,0x02,0x36,0x3C,0x03,0x35,0x3D,0x03,0x35,0x3E,0x03,0x34,0x3F,0x03,0x34,0x3F,0x04,0x34,0x40,0x04,0x33,0x41,0x04,0x33,0x41,0x04,0x32,0x42,0x05,0x32,0x43,0x05,0x31,0x43,0x05,0x31,0x44,0x06,0x30,0x45,0x06,0x30,0x46,0x06,0x30,0x46,0x07,0x2F,0x47,0x07,0x2F,0x48,0x08,0x2E,0x49,0x08,0x2E,0x49,0x08,0x2E,0x4A,0x09,0x2D,0x4B,0x09,0x2D,0x4C,0x09,0x2C,0x4C,0x0A,0x2C,0x4D,0x0A,0x2B,0x4E,0x0B,0x2B,0x4F,0x0B,0x2B,0x4F,0x0C,0x2A,0x50,0x0C,0x2A,0x51,0x0D,0x29,0x52,0x0D,0x29,0x53,0x0D,0x29,0x53,0x0E,0x28,0x54,0x0E,0x28,0x55,0x0F,0x27,0x56,0x0F,0x27,0x57,0x10,0x27,0x58,0x10,0x26,0x58,0x11,0x26,0x59,0x11,0x26,0x5A,0x12,0x25,0x5B,0x13,0x25,0x5C,0x13,0x24,0x5D,0x14,0x24,0x5D,0x14,0x24,0x5E,0x15,0x23,0x5F,0x15,0x23,0x60,0x16,0x23,0x61,0x16,0x22,0x62,0x17,0x22,0x62,0x18,0x22,0x63,0x18,0x21,0x64,0x19,0x21,0x65,0x19,0x21,0x66,0x1A,0x20,0x67,0x1B,0x20,0x67,0x1B,0x20,0x68,0x1C,0x1F,0x69,0x1C,0x1F,0x6A,0x1D,0x1F,0x6B,0x1E,0x1E,0x6C,0x1E,0x1E,0x6D,0x1F,0x1E,0x6D,0x1F,0x1D,0x6E,0x20,0x1D,0x6F,0x21,0x1D,0x70,0x21,0x1C,0x71,0x22,0x1C,0x72,0x23,0x1C,0x73,0x23,0x1B,0x73,0x24,0x1B,0x74,0x25,0x1B,0x75,0x25,0x1A,0x76,0x26,0x1A,0x77,0x27,0x1A,0x78,0x27,0x1A,0x78,0x28,0x19,0x79,0x29,0x19,0x7A,0x29,0x19,0x7B,0x2A,0x18,0x7C,0x2B,0x18,0x7D,0x2B,0x18,0x7E,0x2C,0x18,0x7E,0x2D,0x17,0x7F,0x2D,0x17,0x80,0x2E,0x17,0x81,0x2F,0x16,0x82,0x2F,0x16,0x82,0x30,0x16,0x83,0x31,0x16,0x84,0x31,0x15,0x85,0x32,0x15,0x86,0x33,0x15,0x87,0x33,0x15,0x87,0x34,0x14,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E9,0xA1,0xCF,0xE5,0x98,0xC7,0xE2,0x8E,0xBF,0xDD,0x85,0xB6,0xD9,0x7B,0xAD,0xD5,0x71,0xA5,0xD0,0x67,0x9C,0xCC,0x5D,0x93,0xC7,0x53,0x8A,0xC3,0x4A,0x82,0xBE,0x41,0x79,0xB9,0x38,0x71,0xB5,0x30,0x69,0xB0,0x28,0x61,0xAC,0x21,0x5A,0xA8,0x1B,0x53,0xA3,0x16,0x4D,0x9F,0x12,0x47,0x9B,0x0F,0x42,0x98,0x0F,0x3D,0x94,0x0F,0x39,0x90,0x0F,0x34,0x8C,0x0F,0x30,0x89,0x0F,0x2C,0x85,0x0F,0x28,0x81,0x0F,0x24,0x7D,0x0F,0x20,0x7A,0x0F,0x1D,0x76,0x0F,0x1A,0x72,0x0F,0x16,0x6F,0x0F,0x13,0x6B,0x0F,0x11,0x67,0x10,0x0E,0x64,0x12,0x0C,0x60,0x15,0x0A,0x5D,0x18,0x08,0x59,0x1B,0x06,0x56,0x1D,0x04,0x53,0x20,0x03,0x4F,0x23,0x02,0x4C,0x26,0x01,0x49,0x29,0x01,0x46,0x2C,0x00,0x43,0x2F,0x00,0x40,0x30,0x00,0x3F,0x31,0x00,0x3F,0x31,0x00,0x3E,0x32,0x00,0x3E,0x32,0x00,0x3D,0x33,0x00,0x3D,0x33,0x00,0x3C,0x34,0x00,0x3C,0x34,0x00,0x3B,0x35,0x01,0x3B,0x36,0x01,0x3B,0x36,0x01,0x3A,0x37,0x01,0x3A,0x37,0x01,0x39,0x38,0x01,0x39,0x39,0x01,0x38,0x39,0x02,0x38,0x3A,0x02,0x37,0x3B,0x02,0x37,0x3B,0x02,0x36,0x3C,0x02,0x36,0x3C,0x03,0x35,0x3D,0x03,0x35,0x3E,0x03,0x34,0x3F,0x03,0x34,0x3F,0x04,0x34,0x40,0x04,0x33,0x41,0x04,0x33,0x41,0x04,0x32,0x42,0x05,0x32,0x43,0x05,0x31,0x43,0x05,0x31,0x44,0x06,0x30,0x45,0x06,0x30,0x46,0x06,0x30,0x46,0x07,0x2F,0x47,0x07,0x2F,0x48,0x08,0x2E,0x49,0x08,0x2E,0x49,0x08,0x2E,0x4A,0x09,0x2D,0x4B,0x09,0x2D,0x4C,0x09,0x2C,0x4C,0x0A,0x2C,0x4D,0x0A,0x2B,0x4E,0x0B,0x2B,0x4F,0x0B,0x2B,0x4F,0x0C,0x2A,0x50,0x0C,0x2A,0x51,0x0D,0x29,0x52,0x0D,0x29,0x53,0x0D,0x29,0x53,0x0E,0x28,0x54,0x0E,0x28,0x55,0x0F,0x27,0x56,0x0F,0x27,0x57,0x10,0x27,0x58,0x10,0x26,0x58,0x11,0x26,0x59,0x11,0x26,0x5A,0x12,0x25,0x5B,0x13,0x25,0x5C,0x13,0x24,0x5D,0x14,0x24,0x5D,0x14,0x24,0x5E,0x15,0x23,0x5F,0x15,0x23,0x60,0x16,0x23,0x61,0x16,0x22,0x62,0x17,0x22,0x62,0x18,0x22,0x63,0x18,0x21,0x64,0x19,0x21,0x65,0x19,0x21,0x66,0x1A,0x20,0x67,0x1B,0x20,0x67,0x1B,0x20,0x68,0x1C,0x1F,0x69,0x1C,0x1F,0x6A,0x1D,0x1F,0x6B,0x1E,0x1E,0x6C,0x1E,0x1E,0x6D,0x1F,0x1E,0x6D,0x1F,0x1D,0x6E,0x20,0x1D,0x6F,0x21,0x1D,0x70,0x21,0x1C,0x71,0x22,0x1C,0x72,0x23,0x1C,0x73,0x23,0x1B,0x73,0x24,0x1B,0x74,0x25,0x1B,0x75,0x25,0x1A,0x76,0x26,0x1A,0x77,0x27,0x1A,0x78,0x27,0x1A,0x78,0x28,0x19,0x79,0x29,0x19,0x7A,0x29,0x19,0x7B,0x2A,0x18,0x7C,0x2B,0x18,0x7D,0x2B,0x18,0x7E,0x2C,0x18,0x7E,0x2D,0x17,0x7F,0x2D,0x17,0x80,0x2E,0x17,0x81,0x2F,0x16,0x82,0x2F,0x16,0x82,0x30,0x16,0x83,0x31,0x16,0x84,0x31,0x15,0x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0x0B,0x0E,0x00,0x0D,0x11,0x00,0x10,0x14,0x00,0x13,0x17,0x00,0x16,0x1B,0x00,0x19,0x1E,0x00,0x1C,0x22,0x00,0x1F,0x26,0x00,0x22,0x29,0x00,0x26,0x2D,0x00,0x29,0x32,0x00,0x2D,0x36,0x00,0x30,0x3A,0x00,0x34,0x3E,0x00,0x38,0x43,0x00,0x3C,0x47,0x00,0x40,0x4C,0x00,0x44,0x51,0x00,0x48,0x55,0x00,0x4C,0x5A,0x00,0x50,0x5F,0x00,0x54,0x64,0x00,0x59,0x69,0x00,0x5D,0x6E,0x00,0x61,0x73,0x00,0x66,0x77,0x00,0x6A,0x7C,0x00,0x6E,0x81,0x00,0x73,0x86,0x00,0x77,0x8B,0x00,0x7C,0x90,0x00,0x80,0x95,0x00,0x85,0x9A,0x00,0x89,0x9F,0x00,0x8D,0xA3,0x00,0x92,0xA8,0x00,0x96,0xAD,0x00,0x9B,0xB1,0x00,0x9F,0xB6,0x00,0xA3,0xBA,0x00,0xA8,0xBF,0x00,0xAC,0xC3,0x00,0xB0,0xC7,0x00,0xB4,0xCB,0x00,0xB8,0xCF,0x00,0xBD,0xD3,0x00,0xC1,0xD7,0x00,0xC4,0xDB,0x00,0xC8,0xDE,0x00,0xCC,0xE1,0x00,0xD0,0xE5,0x00,0xD4,0xE8,0x00,0xD7,0xEA,0x00,0xDB,0xED,0x00,0xDE,0xF0,0x00,0xE1,0xF2,0x00,0xE4,0xF4,0x00,0xE8,0xF6,0x00,0xEB,0xF8,0x00,0xED,0xFA,0x00,0xF0,0xFB,0x00,0xF3,0xFC,0x00,0xF5,0xFD,0x00,0xF8,0xFE,0x00,0xFA,0xFF,0x00,0xFC,0xFF,0x00,0xFE,0xFF,0x00,0xFF,0xFF,0x00,0xFF,0xFE,0x00,0xFF,0xFE,0x00,0xFF,0xFD,0x00,0xFF,0xFC,0x00,0xFF,0xFB,0x00,0xFF,0xF9,0x00,0xFF,0xF8,0x00,0xFF,0xF6,0x00,0xFF,0xF4,0x00,0xFF,0xF2,0x00,0xFF,0xF0,0x00,0xFF,0xEE,0x00,0xFF,0xEB,0x00,0xFF,0xE9,0x00,0xFF,0xE6,0x00,0xFF,0xE3,0x00,0xFF,0xE0,0x00,0xFF,0xDD,0x00,0xFF,0xD9,0x00,0xFF,0xD6,0x00,0xFF,0xD3,0x00,0xFF,0xCF,0x00,0xFF,0xCB,0x00,0xFF,0xC7,0x00,0xFF,0xC4,0x00,0xFF,0xC0,0x00,0xFF,0xBC,0x00,0xFF,0xB7,0x00,0xFF,0xB3,0x00,0xFF,0xAF,0x00,0xFF,0xAB,0x00,0xFF,0xA6,0x00,0xFF,0xA2,0x00,0xFF,0x9E,0x00,0xFF,0x99,0x00,0xFF,0x95,0x00,0xFF,0x90,0x00,0xFF,0x8B,0x00,0xFF,0x87,0x00,0xFF,0x82,0x00,0xFF,0x7E,0x00,0xFF,0x79,0x00,0xFF,0x74,0x00,0xFF,0x70,0x00,0xFF,0x6B,0x00,0xFF,0x67,0x00,0xFF,0x62,0x00,0xFF,0x5E,0x00,0xFF,0x59,0x00,0xFF,0x55,0x00,0xFF,0x50,0x00,0xFF,0x4C,0x00,0xFF,0x48,0x00,0xFF,0x43,0x00,0xFF,0x3F,0x00,0xFF,0x3B,0x00,0xFF,0x37,0x00,0xFF,0x33,0x00,0xFF,0x2F,0x00,0xFF,0x2B,0x00,0xFF,0x28,0x00,0xFF,0x24,0x00,0xFF,0x21,0x00,0xFF,0x1D,0x00,0xFF,0x1A,0x00,0xFF,0x17,0x00,0xFF,0x14,0x00,0xFF,0x11,0x00,0xFF,0x0E,0x00,0xFF,0x0C,0x00,0xFF,0x09,0x00,0xFF,0x07,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x01,0x00,0xFF,0x00,0x01,0xFF,0x00,0x03,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x09,0xFF,0x00,0x0C,0xFF,0x00,0x0F,0xFF,0x00,0x11,0xFF,0x00,0x14,0x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FF,0xE1,0x00,0xFF,0xDD,0x00,0xFF,0xDA,0x00,0xFF,0xD6,0x00,0xFF,0xD3,0x00,0xFF,0xCF,0x00,0xFF,0xCB,0x00,0xFF,0xC8,0x00,0xFF,0xC4,0x00,0xFF,0xC0,0x00,0xFF,0xBC,0x00,0xFF,0xB8,0x00,0xFF,0xB4,0x00,0xFF,0xAF,0x00,0xFF,0xAB,0x00,0xFF,0xA7,0x00,0xFF,0xA3,0x00,0xFF,0x9E,0x00,0xFF,0x9A,0x00,0xFF,0x96,0x00,0xFF,0x91,0x00,0xFF,0x8D,0x00,0xFF,0x88,0x00,0xFF,0x84,0x00,0xFF,0x80,0x00,0xFF,0x7B,0x00,0xFF,0x77,0x00,0xFF,0x72,0x00,0xFF,0x6E,0x00,0xFF,0x69,0x00,0xFF,0x65,0x00,0xFF,0x61,0x00,0xFF,0x5C,0x00,0xFF,0x58,0x00,0xFF,0x54,0x00,0xFF,0x50,0x00,0xFF,0x4B,0x00,0xFF,0x47,0x00,0xFF,0x43,0x00,0xFF,0x3F,0x00,0xFF,0x3B,0x00,0xFF,0x37,0x00,0xFF,0x34,0x00,0xFF,0x30,0x00,0xFF,0x2C,0x00,0xFF,0x29,0x00,0xFF,0x25,0x00,0xFF,0x22,0x00,0xFF,0x1E,0x00,0xFF,0x1B,0x00,0xFF,0x18,0x00,0xFF,0x15,0x00,0xFF,0x12,0x00,0xFF,0x10,0x00,0xFF,0x0D,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x04,0x00,0xFF,0x02,0x00,0xFF,0x00,0x02,0xFD,0x00,0x04,0xFB,0x00,0x06,0xF9,0x00,0x09,0xF6,0x00,0x0B,0xF3,0x00,0x0E,0xF1,0x00,0x10,0xEE,0x00,0x13,0xEB,0x00,0x16,0xE7,0x00,0x19,0xE4,0x00,0x1C,0xE0,0x00,0x1F,0xDD,0x00,0x23,0xD9,0x00,0x26,0xD5,0x00,0x29,0xD1,0x00,0x2D,0xCD,0x00,0x31,0xC9,0x00,0x35,0xC4,0x00,0x38,0xC0,0x00,0x3C,0xBC,0x00,0x40,0xB7,0x00,0x44,0xB2,0x00,0x48,0xAE,0x00,0x4C,0xA9,0x00,0x51,0xA4,0x00,0x55,0x9F,0x00,0x59,0x9B,0x00,0x5D,0x96,0x00,0x62,0x91,0x00,0x66,0x8C,0x00,0x6A,0x87,0x00,0x6F,0x82,0x00,0x73,0x7D,0x00,0x78,0x78,0x00,0x7C,0x73,0x00,0x81,0x6E,0x00,0x85,0x69,0x00,0x8A,0x65,0x00,0x8E,0x60,0x00,0x92,0x5B,0x00,0x97,0x56,0x00,0x9B,0x52,0x00,0xA0,0x4D,0x00,0xA4,0x49,0x00,0xA8,0x44,0x00,0xAC,0x40,0x00,0xB1,0x3B,0x00,0xB5,0x37,0x00,0xB9,0x33,0x00,0xBD,0x2F,0x00,0xC1,0x2B,0x00,0xC5,0x28,0x00,0xC9,0x24,0x00,0xCD,0x21,0x00,0xD0,0x1D,0x00,0xD4,0x1A,0x00,0xD8,0x17,0x00,0xDB,0x14,0x00,0xDE,0x11,0x00,0xE2,0x0F,0x00,0xE5,0x0D,0x00,0xE8,0x0A,0x00,0xEB,0x08,0x00,0xEE,0x07,0x00,0xF0,0x05,0x00,0xF3,0x04,0x00,0xF6,0x02,0x00,0xF8,0x01,0x00,0xFA,0x01,0x00,0xFC,0x00,0x00,0xFE,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x02,0x00,0xFF,0x03,0x00,0xFF,0x04,0x00,0xFF,0x06,0x00,0xFF,0x07,0x00,0xFF,0x09,0x00,0xFF,0x0B,0x00,0xFF,0x0D,0x00,0xFF,0x0F,0x00,0xFF,0x12,0x00,0xFF,0x14,0x00,0xFF,0x17,0x00,0xFF,0x1A,0x00,0xFF,0x1C,0x00,0xFF,0x1F,0x00,0xFF,0x23,0x00,0xFF,0x26,0x00,0xFF,0x29,0x00,0xF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E,0x00,0xFF,0xDC,0x00,0xFF,0xD9,0x00,0xFF,0xD6,0x00,0xFF,0xD4,0x00,0xFF,0xD1,0x00,0xFF,0xCE,0x00,0xFF,0xCC,0x00,0xFF,0xC9,0x00,0xFF,0xC6,0x00,0xFF,0xC3,0x00,0xFF,0xC1,0x00,0xFF,0xBE,0x00,0xFF,0xBB,0x00,0xFF,0xB8,0x00,0xFF,0xB5,0x00,0xFF,0xB2,0x00,0xFF,0xAF,0x00,0xFF,0xAC,0x00,0xFF,0xA9,0x00,0xFF,0xA7,0x00,0xFF,0xA4,0x00,0xFF,0xA1,0x00,0xFF,0x9E,0x00,0xFF,0x9B,0x00,0xFF,0x98,0x00,0xFF,0x95,0x00,0xFF,0x93,0x00,0xFF,0x90,0x00,0xFF,0x8D,0x00,0xFF,0x8A,0x00,0xFF,0x88,0x00,0xFF,0x85,0x00,0xFF,0x83,0x00,0xFF,0x80,0x00,0xFF,0x7E,0x00,0xFF,0x7B,0x00,0xFF,0x78,0x00,0xFF,0x76,0x00,0xFF,0x73,0x00,0xFF,0x70,0x00,0xFF,0x6E,0x00,0xFF,0x6B,0x00,0xFF,0x68,0x00,0xFF,0x65,0x00,0xFF,0x63,0x00,0xFF,0x60,0x00,0xFF,0x5D,0x00,0xFF,0x5A,0x00,0xFF,0x57,0x00,0xFF,0x54,0x00,0xFF,0x51,0x00,0xFF,0x4E,0x00,0xFF,0x4B,0x00,0xFF,0x49,0x00,0xFF,0x46,0x00,0xFF,0x43,0x00,0xFF,0x40,0x00,0xFF,0x3D,0x00,0xFF,0x3A,0x00,0xFF,0x37,0x00,0xFF,0x35,0x00,0xFF,0x32,0x00,0xFF,0x2F,0x00,0xFF,0x2C,0x00,0xFF,0x2A,0x00,0xFF,0x27,0x00,0xFF,0x25,0x00,0xFF,0x22,0x00,0xFF,0x20,0x00,0xFF,0x1D,0x00,0xFF,0x1B,0x00,0xFF,0x18,0x00,0xFF,0x16,0x00,0xFF,0x14,0x00,0xFF,0x12,0x00,0xFF,0x10,0x00,0xFF,0x0E,0x00,0xFF,0x0C,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x00,0x00,0xFF,0x00,0x01,0xFF,0x00,0x02,0xFF,0x00,0x04,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x08,0xFF,0x00,0x0A,0xFF,0x00,0x0C,0xFF,0x00,0x0E,0xFF,0x00,0x10,0xFF,0x00,0x12,0xFF,0x00,0x14,0xFF,0x00,0x16,0xFF,0x00,0x19,0xFF,0x00,0x1B,0xFF,0x00,0x1D,0xFF,0x00,0x20,0xFF,0x00,0x22,0xFF,0x00,0x25,0xFF,0x00,0x28,0xFF,0x00,0x2A,0xFF,0x00,0x2D,0xFF,0x00,0x30,0xFF,0x00,0x32,0xFF,0x00,0x35,0xFF,0x00,0x38,0xFF,0x00,0x3B,0xFF,0x00,0x3D,0xFF,0x00,0x40,0xFF,0x00,0x43,0xFF,0x00,0x46,0xFF,0x00,0x49,0xFF,0x00,0x4C,0xFF,0x00,0x4F,0xFF,0x00,0x52,0xFF,0x00,0x55,0xFF,0x00,0x57,0xFF,0x00,0x5A,0xFF,0x00,0x5D,0xFF,0x00,0x60,0xFF,0x00,0x63,0xFF,0x00,0x66,0xFF,0x00,0x69,0xFF,0x00,0x6B,0xFF,0x00,0x6E,0xFF,0x00,0x71,0xFF,0x00,0x74,0xFF,0x00,0x76,0xFF,0x00,0x79,0xFF,0x00,0x7B,0xFF,0x00,0x7E,0xFF,0x00,0x80,0xFF,0x00,0x83,0xFF,0x00,0x86,0xFF,0x00,0x88,0xFF,0x00,0x8B,0xFF,0x00,0x8E,0xFF,0x00,0x90,0xFF,0x00,0x93,0xFF,0x00,0x96,0xFF,0x00,0x99,0xFF,0x00,0x9B,0xFF,0x00,0x9E,0xFF,0x00,0xA1,0xFF,0x00,0xA4,0xFF,0x00,0xA7,0xFF,0x00,0x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,0xA6,0x00,0xFF,0xA3,0x00,0xFF,0xA0,0x00,0xFF,0x9D,0x00,0xFF,0x9A,0x00,0xFF,0x98,0x00,0xFF,0x95,0x00,0xFF,0x92,0x00,0xFF,0x8F,0x00,0xFF,0x8C,0x00,0xFF,0x8A,0x00,0xFF,0x87,0x00,0xFF,0x85,0x00,0xFF,0x82,0x00,0xFF,0x80,0x00,0xFF,0x7D,0x00,0xFF,0x7A,0x00,0xFF,0x78,0x00,0xFF,0x75,0x00,0xFF,0x73,0x00,0xFF,0x70,0x00,0xFF,0x6D,0x00,0xFF,0x6A,0x00,0xFF,0x67,0x00,0xFF,0x65,0x00,0xFF,0x62,0x00,0xFF,0x5F,0x00,0xFF,0x5C,0x00,0xFF,0x59,0x00,0xFF,0x56,0x00,0xFF,0x53,0x00,0xFF,0x51,0x00,0xFF,0x4E,0x00,0xFF,0x4B,0x00,0xFF,0x48,0x00,0xFF,0x45,0x00,0xFF,0x42,0x00,0xFF,0x3F,0x00,0xFF,0x3C,0x00,0xFF,0x3A,0x00,0xFF,0x37,0x00,0xFF,0x34,0x00,0xFF,0x31,0x00,0xFF,0x2E,0x00,0xFF,0x2C,0x00,0xFF,0x29,0x00,0xFF,0x27,0x00,0xFF,0x24,0x00,0xFF,0x21,0x00,0xFF,0x1F,0x00,0xFF,0x1D,0x00,0xFF,0x1A,0x00,0xFF,0x18,0x00,0xFF,0x16,0x00,0xFF,0x13,0x00,0xFF,0x11,0x00,0xFF,0x0F,0x00,0xFF,0x0D,0x00,0xFF,0x0B,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x00,0x01,0xFF,0x00,0x02,0xFF,0x00,0x04,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x09,0xFF,0x00,0x0A,0xFF,0x00,0x0C,0xFF,0x00,0x0E,0xFF,0x00,0x10,0xFF,0x00,0x12,0xFF,0x00,0x15,0xFF,0x00,0x17,0xFF,0x00,0x19,0xFF,0x00,0x1B,0xFF,0x00,0x1E,0xFF,0x00,0x20,0xFF,0x00,0x23,0xFF,0x00,0x25,0xFF,0x00,0x28,0xFF,0x00,0x2A,0xFF,0x00,0x2D,0xFF,0x00,0x30,0xFF,0x00,0x33,0xFF,0x00,0x35,0xFF,0x00,0x38,0xFF,0x00,0x3B,0xFF,0x00,0x3E,0xFF,0x00,0x41,0xFF,0x00,0x44,0xFF,0x00,0x46,0xFF,0x00,0x49,0xFF,0x00,0x4C,0xFF,0x00,0x4F,0xFF,0x00,0x52,0xFF,0x00,0x55,0xFF,0x00,0x58,0xFF,0x00,0x5B,0xFF,0x00,0x5E,0xFF,0x00,0x61,0xFF,0x00,0x63,0xFF,0x00,0x66,0xFF,0x00,0x69,0xFF,0x00,0x6C,0xFF,0x00,0x6F,0xFF,0x00,0x71,0xFF,0x00,0x74,0xFF,0x00,0x77,0xFF,0x00,0x79,0xFF,0x00,0x7C,0xFF,0x00,0x7F,0xFF,0x00,0x81,0xFF,0x00,0x84,0xFF,0x00,0x86,0xFF,0x00,0x89,0xFF,0x00,0x8B,0xFF,0x00,0x8E,0xFF,0x00,0x91,0xFF,0x00,0x94,0xFF,0x00,0x96,0xFF,0x00,0x99,0xFF,0x00,0x9C,0xFF,0x00,0x9F,0xFF,0x00,0xA2,0xFF,0x00,0xA5,0xFF,0x00,0xA8,0xFF,0x00,0xAA,0xFF,0x00,0xAD,0xFF,0x00,0xB0,0xFF,0x00,0xB3,0xFF,0x00,0xB6,0xFF,0x00,0xB9,0xFF,0x00,0xBC,0xFF,0x00,0xBF,0xFF,0x00,0xC2,0xFF,0x00,0xC4,0xFF,0x00,0xC7,0xFF,0x00,0xCA,0xFF,0x00,0xCD,0xFF,0x00,0xCF,0xFF,0x00,0xD2,0xFF,0x00,0xD5,0xFF,0x00,0xD7,0xFF,0x00,0xDA,0xFF,0x00,0xDD,0xFF,0x00,0xDF,0xFF,0x00,0xE2,0xF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C,0x00,0xFF,0x6A,0x00,0xFF,0x67,0x00,0xFF,0x64,0x00,0xFF,0x61,0x00,0xFF,0x5E,0x00,0xFF,0x5B,0x00,0xFF,0x58,0x00,0xFF,0x56,0x00,0xFF,0x53,0x00,0xFF,0x50,0x00,0xFF,0x4D,0x00,0xFF,0x4A,0x00,0xFF,0x47,0x00,0xFF,0x44,0x00,0xFF,0x41,0x00,0xFF,0x3E,0x00,0xFF,0x3C,0x00,0xFF,0x39,0x00,0xFF,0x36,0x00,0xFF,0x33,0x00,0xFF,0x31,0x00,0xFF,0x2E,0x00,0xFF,0x2B,0x00,0xFF,0x29,0x00,0xFF,0x26,0x00,0xFF,0x23,0x00,0xFF,0x21,0x00,0xFF,0x1E,0x00,0xFF,0x1C,0x00,0xFF,0x1A,0x00,0xFF,0x17,0x00,0xFF,0x15,0x00,0xFF,0x13,0x00,0xFF,0x11,0x00,0xFF,0x0F,0x00,0xFF,0x0D,0x00,0xFF,0x0B,0x00,0xFF,0x09,0x00,0xFF,0x07,0x00,0xFF,0x06,0x00,0xFF,0x04,0x00,0xFF,0x03,0x00,0xFF,0x01,0x00}; +//Scaled Hue Scale +static char color_data[] = {0xFF,0x00,0xFF,0xF1,0x00,0xFF,0xDE,0x00,0xFF,0xC7,0x00,0xFF,0xAF,0x00,0xFF,0x97,0x00,0xFF,0x82,0x00,0xFF,0x6C,0x00,0xFF,0x56,0x00,0xFF,0x41,0x00,0xFF,0x2E,0x00,0xFF,0x21,0x05,0xFF,0x16,0x0F,0xFF,0x0E,0x1B,0xFF,0x07,0x29,0xFF,0x02,0x39,0xFF,0x00,0x4B,0xFF,0x00,0x5E,0xFF,0x00,0x74,0xFF,0x00,0x8A,0xFF,0x00,0xA0,0xFF,0x00,0xAF,0xFF,0x00,0xB8,0xFE,0x00,0xC2,0xFD,0x00,0xCC,0xFD,0x00,0xD5,0xFC,0x00,0xDF,0xFA,0x00,0xE7,0xF9,0x00,0xEF,0xF6,0x00,0xF6,0xF3,0x00,0xFC,0xEE,0x00,0xFF,0xE8,0x00,0xFF,0xE1,0x00,0xFF,0xD8,0x00,0xFF,0xCE,0x00,0xFF,0xC4,0x00,0xFF,0xB9,0x00,0xFF,0xAD,0x00,0xFF,0xA1,0x00,0xFF,0x96,0x00,0xFF,0x8A,0x00,0xFF,0x80,0x00,0xFF,0x7C,0x00,0xFF,0x78,0x00,0xFF,0x75,0x00,0xFF,0x71,0x00,0xFF,0x6D,0x00,0xFF,0x69,0x00,0xFF,0x66,0x00,0xFF,0x62,0x00,0xFF,0x5E,0x00,0xFF,0x5A,0x00,0xFF,0x56,0x00,0xFF,0x52,0x00,0xFF,0x4E,0x00,0xFF,0x4A,0x00,0xFF,0x47,0x00,0xFF,0x43,0x00,0xFF,0x3F,0x00,0xFF,0x3B,0x00,0xFF,0x38,0x00,0xFF,0x34,0x00,0xFF,0x31,0x00,0xFF,0x2D,0x00,0xFF,0x2A,0x00,0xFF,0x27,0x00,0xFF,0x24,0x00,0xFF,0x21,0x00,0xFF,0x1E,0x00,0xFF,0x1B,0x00,0xFF,0x19,0x00,0xFF,0x17,0x01,0xFF,0x14,0x02,0xFF,0x13,0x04,0xFF,0x11,0x06,0xFF,0x0F,0x07,0xFF,0x0E,0x0A,0xFF,0x0C,0x0C,0xFF,0x0B,0x0E,0xFF,0x0A,0x10,0xFF,0x09,0x13,0xFF,0x08,0x16,0xFF,0x07,0x18,0xFF,0x06,0x1B,0xFF,0x06,0x1E,0xFF,0x05,0x21,0xFF,0x04,0x24,0xFF,0x04,0x27,0xFF,0x04,0x2A,0xFF,0x03,0x2D,0xFF,0x03,0x30,0xFF,0x03,0x34,0xFF,0x02,0x37,0xFF,0x02,0x3A,0xFF,0x02,0x3D,0xFF,0x02,0x41,0xFF,0x02,0x44,0xFF,0x01,0x47,0xFF,0x01,0x4A,0xFF,0x01,0x4E,0xFF,0x01,0x51,0xFF,0x00,0x54,0xFF,0x00,0x56,0xFF,0x00,0x58,0xFF,0x00,0x5A,0xFF,0x00,0x5C,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FF,0x73,0x00,0xFF,0x72,0x00,0xFF,0x71,0x00,0xFF,0x70,0x00,0xFF,0x6F,0x00,0xFF,0x6E,0x00,0xFF,0x6D,0x00,0xFF,0x6C,0x00,0xFF,0x6B,0x00,0xFF,0x6A,0x00,0xFF,0x6A,0x00,0xFF,0x69,0x00,0xFF,0x68,0x00,0xFF,0x68,0x00,0xFF,0x67,0x00,0xFF,0x66,0x00,0xFF,0x66,0x00,0xFF,0x65,0x00,0xFF,0x65,0x00,0xFF,0x64,0x00,0xFF,0x63,0x00,0xFF,0x63,0x00,0xFF,0x62,0x00,0xFF,0x61,0x00,0xFF,0x61,0x00,0xFF,0x60,0x00,0xFF,0x5F,0x00,0xFF,0x5F,0x00,0xFF,0x5E,0x00,0xFF,0x5D,0x00,0xFF,0x5D,0x00,0xFF,0x5C,0x00,0xFF,0x5B,0x00,0xFF,0x5B,0x00,0xFF,0x5A,0x00,0xFF,0x59,0x00,0xFF,0x59,0x00,0xFF,0x58,0x00,0xFF,0x57,0x00,0xFF,0x57,0x00,0xFF,0x56,0x00,0xFF,0x55,0x00,0xFF,0x54,0x00,0xFF,0x54,0x00,0xFF,0x53,0x00,0xFF,0x52,0x00,0xFF,0x52,0x00,0xFF,0x51,0x00,0xFF,0x50,0x00,0xFF,0x50,0x00,0xFF,0x4F,0x00,0xFF,0x4E,0x00,0xFF,0x4E,0x00,0xFF,0x4D,0x00,0xFF,0x4C,0x00,0xFF,0x4B,0x00,0xFF,0x4B,0x00,0xFF,0x4A,0x00,0xFF,0x49,0x00,0xFF,0x49,0x00,0xFF,0x48,0x00,0xFF,0x47,0x00,0xFF,0x46,0x00,0xFF,0x46,0x00,0xFF,0x45,0x00,0xFF,0x44,0x00,0xFF,0x44,0x00,0xFF,0x43,0x00,0xFF,0x42,0x00,0xFF,0x41,0x00,0xFF,0x41,0x00,0xFF,0x40,0x00,0xFF,0x3F,0x00,0xFF,0x3F,0x00,0xFF,0x3E,0x00,0xFF,0x3D,0x00,0xFF,0x3C,0x00,0xFF,0x3C,0x00,0xFF,0x3B,0x00,0xFF,0x3A,0x00,0xFF,0x3A,0x00,0xFF,0x39,0x00,0xFF,0x38,0x00,0xFF,0x38,0x00,0xFF,0x37,0x00,0xFF,0x36,0x00,0xFF,0x35,0x00,0xFF,0x35,0x00,0xFF,0x34,0x00,0xFF,0x33,0x00,0xFF,0x33,0x00,0xFF,0x32,0x00,0xFF,0x31,0x00,0xFF,0x31,0x00,0xFF,0x30,0x00,0xFF,0x2F,0x00,0xFF,0x2E,0x00,0xFF,0x2E,0x00,0xFF,0x2D,0x00,0xFF,0x2C,0x00,0xFF,0x2C,0x00,0xFF,0x2B,0x00,0xFF,0x2A,0x00,0xFF,0x2A,0x00,0xFF,0x29,0x00,0xFF,0x28,0x00,0xFF,0x28,0x00,0xFF,0x27,0x00,0xFF,0x26,0x00,0xFF,0x26,0x00,0xFF,0x25,0x00,0xFF,0x24,0x00,0xFF,0x24,0x00,0xFF,0x23,0x00,0xFF,0x22,0x00,0xFF,0x22,0x00,0xFF,0x21,0x00,0xFF,0x21,0x00,0xFF,0x20,0x00,0xFF,0x1F,0x00,0xFF,0x1F,0x00,0xFF,0x1E,0x00,0xFF,0x1D,0x00,0xFF,0x1D,0x00,0xFF,0x1C,0x00,0xFF,0x1C,0x00,0xFF,0x1B,0x00,0xFF,0x1A,0x00,0xFF,0x1A,0x00,0xFF,0x19,0x00,0xFF,0x19,0x00,0xFF,0x18,0x00,0xFF,0x17,0x00,0xFF,0x17,0x00,0xFF,0x16,0x00,0xFF,0x16,0x00,0xFF,0x15,0x00,0xFF,0x14,0x00,0xFF,0x14,0x00,0xFF,0x13,0x00,0xFF,0x13,0x00,0xFF,0x12,0x00,0xFF,0x12,0x00,0xFF,0x11,0x00,0xFF,0x11,0x00,0xFF,0x10,0x00,0xFF,0x10,0x00,0xFF,0x0F,0x00,0xFF,0x0F,0x00,0xFF,0x0E,0x00,0xFF,0x0E,0x00,0xFF,0x0D,0x00,0xFF,0x0D,0x00,0xFF,0x0C,0x00,0xFF,0x0C,0x00,0xFF,0x0B,0x00,0xFF,0x0B,0x00,0xFF,0x0A,0x00,0xFF,0x0A,0x00,0xFF,0x09,0x00,0xFF,0x09,0x00,0xFF,0x08,0x00,0xFF,0x08,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x06,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x05,0x00,0xFF,0x05,0x00,0xFF,0x04,0x00,0xFF,0x04,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x02,0x00,0xFF,0x02,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x00,0x00}; static char plasma_data[] = {0x00,0x00,0x00,0x03,0x00,0x00,0x05,0x00,0x00,0x09,0x00,0x00,0x0E,0x00,0x00,0x12,0x00,0x00,0x17,0x00,0x00,0x1C,0x00,0x00,0x22,0x00,0x00,0x27,0x00,0x00,0x2C,0x00,0x00,0x32,0x00,0x00,0x37,0x00,0x00,0x3C,0x00,0x00,0x41,0x00,0x00,0x45,0x00,0x00,0x4A,0x00,0x00,0x4D,0x00,0x00,0x51,0x00,0x00,0x53,0x00,0x00,0x55,0x00,0x00,0x55,0x00,0x02,0x55,0x02,0x03,0x55,0x03,0x06,0x55,0x03,0x07,0x55,0x05,0x09,0x55,0x06,0x0C,0x55,0x06,0x0F,0x55,0x07,0x10,0x55,0x09,0x13,0x55,0x0A,0x16,0x55,0x0C,0x1A,0x55,0x0C,0x1D,0x54,0x0E,0x20,0x53,0x10,0x23,0x54,0x11,0x26,0x53,0x13,0x2A,0x52,0x14,0x2E,0x51,0x15,0x31,0x50,0x17,0x35,0x50,0x19,0x38,0x4E,0x1A,0x3D,0x4D,0x1C,0x40,0x4D,0x1D,0x44,0x4C,0x1F,0x47,0x4B,0x21,0x4C,0x4A,0x23,0x4F,0x49,0x24,0x54,0x48,0x25,0x57,0x47,0x28,0x5B,0x46,0x29,0x5F,0x45,0x2B,0x62,0x44,0x2D,0x66,0x44,0x2E,0x6A,0x43,0x30,0x6E,0x42,0x32,0x72,0x41,0x33,0x76,0x40,0x35,0x79,0x3F,0x38,0x7C,0x3F,0x39,0x7F,0x3E,0x3B,0x83,0x3D,0x3D,0x86,0x3C,0x3F,0x8A,0x3B,0x40,0x8C,0x3B,0x43,0x8F,0x3B,0x44,0x92,0x3A,0x46,0x95,0x39,0x48,0x98,0x39,0x4A,0x9B,0x39,0x4C,0x9C,0x39,0x4E,0x9F,0x3A,0x4F,0xA1,0x39,0x51,0xA3,0x39,0x52,0xA4,0x39,0x54,0xA6,0x39,0x56,0xA7,0x39,0x57,0xA8,0x39,0x58,0xA8,0x3A,0x5A,0xA9,0x3A,0x5C,0xA8,0x3A,0x5D,0xA8,0x3B,0x5F,0xA8,0x3C,0x61,0xA8,0x3D,0x62,0xA8,0x3D,0x64,0xA9,0x3E,0x66,0xA8,0x3E,0x67,0xA9,0x3F,0x68,0xA8,0x40,0x6A,0xA8,0x41,0x6C,0xA8,0x42,0x6E,0xA8,0x42,0x70,0xA8,0x43,0x71,0xA8,0x44,0x73,0xA8,0x45,0x74,0xA9,0x46,0x76,0xA8,0x48,0x79,0xA8,0x49,0x7A,0xA7,0x4A,0x7C,0xA6,0x4A,0x7D,0xA5,0x4C,0x7F,0xA4,0x4D,0x81,0xA3,0x4E,0x83,0xA2,0x4E,0x85,0xA1,0x50,0x86,0xA0,0x51,0x88,0x9F,0x52,0x8A,0x9D,0x53,0x8B,0x9D,0x55,0x8D,0x9B,0x56,0x8F,0x9A,0x57,0x91,0x98,0x58,0x92,0x98,0x5A,0x94,0x97,0x5B,0x96,0x95,0x5C,0x97,0x94,0x5E,0x99,0x93,0x5F,0x9A,0x91,0x60,0x9C,0x90,0x61,0x9D,0x90,0x62,0x9F,0x8E,0x64,0xA1,0x8D,0x65,0xA2,0x8C,0x67,0xA3,0x8B,0x68,0xA5,0x8A,0x6A,0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4,0xC2,0xC2,0xC4,0xC3,0xC4,0xC4,0xC3,0xC4,0xC4,0xC4}; #endif \ No newline at end of file -- cgit v0.9.2-21-gd62e From fa099338bb87d25ea660e74b16811d18256e7d51 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 17 Sep 2010 11:34:24 +0100 Subject: Fix Coal and DESL diff --git a/powder.c b/powder.c index b5db6ff..ae7ba8f 100644 --- a/powder.c +++ b/powder.c @@ -237,6 +237,8 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 150; } End Testing*/ + if(t==PT_COAL) + parts[i].life = 110; if(t==PT_FIRE) parts[i].life = rand()%50+120; if(t==PT_PLSM) @@ -474,7 +476,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(sys_pause&&!framerender) return; - if(parts[i].life && t!=PT_ACID && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM) + if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM) { if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) parts[i].life--; @@ -656,7 +658,7 @@ void update_particles_i(pixel *vid, int start, int inc) } if(t==PT_GAS && pv[y/CELL][x/CELL]<-6.0f) t = parts[i].type = PT_OIL; - if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) // Only way I know to make it + if(t==PT_DESL && pv[y/CELL][x/CELL]>5.0f) // Only way I know to make it t = parts[i].type = PT_FIRE; // combust under pressure. if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) t = parts[i].type = PT_OIL; @@ -933,6 +935,34 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_COAL) + { + if(parts[i].life<=0){ + t = PT_NONE; + kill_part(i); + create_part(-1, x, y, PT_FIRE); + goto killed; + } else if(parts[i].life < 100){ + parts[i].life--; + create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); + } + + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) + { + if(parts[i].life>100){ + parts[i].life = 99; + } + } + } + } else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) { for(nx=-2; nx<3; nx++) diff --git a/powder.h b/powder.h index 2461455..cf9069f 100644 --- a/powder.h +++ b/powder.h @@ -243,13 +243,13 @@ static const part_type ptypes[PT_NUM] = {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f+273.15f, 88, "Smoke"}, {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, - {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 10, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Thermite."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite."}, {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow."}, {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description @@ -395,7 +395,7 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* STKM */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, /* StkM */ /* SWCH */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Swch */ /* SMKE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Smke */ - /* DESL */ {0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Desl */ + /* DESL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Desl */ /* COAL */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Coal */ /* LO2 */ {0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0}, /* LO2 */ /* O2 */ {0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0}, /* O2 */ -- cgit v0.9.2-21-gd62e From 99ae022d5544ecc252ff943f83dba3aa6614ec57 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 18 Sep 2010 09:52:14 +0200 Subject: astyle diff --git a/graphics.c b/graphics.c index 47c843f..7f9cf8c 100644 --- a/graphics.c +++ b/graphics.c @@ -2121,9 +2121,9 @@ pixel *prerender_save(void *save, int size, int *width, int *height) return NULL; if(!(c[2]==0x43 && c[1]==0x75 && c[0]==0x66) && !(c[2]==0x76 && c[1]==0x53 && c[0]==0x50)) return NULL; - if(c[2]==0x43 && c[1]==0x75 && c[0]==0x66){ - new_format = 1; - } + if(c[2]==0x43 && c[1]==0x75 && c[0]==0x66) { + new_format = 1; + } if(c[4]>SAVE_VERSION) return NULL; diff --git a/interface.c b/interface.c index 1f972b3..7bbde73 100644 --- a/interface.c +++ b/interface.c @@ -1789,7 +1789,7 @@ int search_ui(pixel *vid_buf) memset(img_id, 0, sizeof(img_id)); memset(search_ids, 0, sizeof(search_ids)); - memset(search_dates, 0, sizeof(search_dates)); + memset(search_dates, 0, sizeof(search_dates)); memset(search_names, 0, sizeof(search_names)); memset(search_scoreup, 0, sizeof(search_scoreup)); memset(search_scoredown, 0, sizeof(search_scoredown)); @@ -2004,8 +2004,8 @@ int search_ui(pixel *vid_buf) dp = pos; } } - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, YRES/GRID_S+3, 128, 128, 128, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, 1+(YRES/GRID_S+3)/2, 0, 107, 10, 255); + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, YRES/GRID_S+3, 128, 128, 128, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, 1+(YRES/GRID_S+3)/2, 0, 107, 10, 255); fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 6, 1+(YRES/GRID_S+3)/2, 107, 10, 0, 255); if(mp==pos && !st) @@ -2069,7 +2069,7 @@ int search_ui(pixel *vid_buf) fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-1+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 57, 187, 57, 255); fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 4, nyd, 187, 57, 57, 255); - //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); } } @@ -2162,17 +2162,17 @@ int search_ui(pixel *vid_buf) fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); info_box(vid_buf, "Loading..."); - if(search_dates[mp]){ - uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - strappend(uri, "&Date="); - strcaturl(uri, search_dates[mp]); - } else { - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - } + if(search_dates[mp]) { + uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + strappend(uri, "&Date="); + strcaturl(uri, search_dates[mp]); + } else { + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + } data = http_simple_get(uri, &status, &dlen); free(uri); @@ -2384,22 +2384,22 @@ int search_ui(pixel *vid_buf) thlen = 4; } thumb_cache_add(img_id[i], thumb, thlen); - for(pos=0; pos=GRID_X*GRID_Y) break; if(votes) { sd = strchr(str+8, ' '); - if(!sd) + if(!sd) return i; *(sd++) = 0; - pu = strchr(sd, ' '); + pu = strchr(sd, ' '); if(!pu) return i; *(pu++) = 0; @@ -2624,10 +2624,10 @@ int search_results(char *str, int votes) else { sd = strchr(str+8, ' '); - if(!sd) + if(!sd) return i; *(sd++) = 0; - pu = strchr(sd, ' '); + pu = strchr(sd, ' '); if(!pu) return i; *(pu++) = 0; @@ -2650,7 +2650,7 @@ int search_results(char *str, int votes) *(r++) = 0; search_ids[i] = mystrdup(str+8); - search_dates[i] = mystrdup(sd); + search_dates[i] = mystrdup(sd); search_publish[i] = atoi(pu); search_scoreup[i] = atoi(vu); diff --git a/main.c b/main.c index f8e11f6..51fe3b0 100644 --- a/main.c +++ b/main.c @@ -310,10 +310,10 @@ void *build_save(int *size, int x0, int y0, int w, int h) i = m[j]; if(i) { - //New Temperature saving uses a 16bit unsigned int for temperatures, giving a precision of 1 degree versus 36 for the old format - int tttemp = (int)parts[i-1].temp; - d[p++] = ((tttemp&0xFF00)>>8); - d[p++] = (tttemp&0x00FF); + //New Temperature saving uses a 16bit unsigned int for temperatures, giving a precision of 1 degree versus 36 for the old format + int tttemp = (int)parts[i-1].temp; + d[p++] = ((tttemp&0xFF00)>>8); + d[p++] = (tttemp&0x00FF); } } for(j=0; jSAVE_VERSION) return 2; ver = c[4]; @@ -600,13 +600,13 @@ int parse_save(void *save, int size, int replace, int x0, int y0) if(i <= NPART) { if(ver>=42) { - if(new_format){ - ttv = (d[p++])<<8; - ttv |= (d[p++]); - parts[i-1].temp = ttv; - } else { - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; - } + if(new_format) { + ttv = (d[p++])<<8; + ttv |= (d[p++]); + parts[i-1].temp = ttv; + } else { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } } else { parts[i-1].temp = ((d[p++]*((O_MAX_TEMP+(-O_MIN_TEMP))/255))+O_MIN_TEMP)+273; } @@ -614,9 +614,9 @@ int parse_save(void *save, int size, int replace, int x0, int y0) else { p++; - if(new_format){ - p++; - } + if(new_format) { + p++; + } } } else @@ -1253,8 +1253,8 @@ int main(int argc, char *argv[]) { set_cmode(6); } - if(sdl_key==SDLK_LEFTBRACKET){ - if(sdl_zoom_trig==1) + if(sdl_key==SDLK_LEFTBRACKET) { + if(sdl_zoom_trig==1) { ZSIZE -= 1; if(ZSIZE>32) @@ -1265,18 +1265,18 @@ int main(int argc, char *argv[]) } else { - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - bs -= 1; - else - bs -= ceil((bs/5)+0.5f); + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + bs -= 1; + else + bs -= ceil((bs/5)+0.5f); if(bs>1224) bs = 1224; if(bs<0) bs = 0; } - } - if(sdl_key==SDLK_RIGHTBRACKET){ - if(sdl_zoom_trig==1) + } + if(sdl_key==SDLK_RIGHTBRACKET) { + if(sdl_zoom_trig==1) { ZSIZE += 1; if(ZSIZE>32) @@ -1287,16 +1287,16 @@ int main(int argc, char *argv[]) } else { - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - bs += 1; - else - bs += ceil((bs/5)+0.5f); + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + bs += 1; + else + bs += ceil((bs/5)+0.5f); if(bs>1224) bs = 1224; if(bs<0) bs = 0; } - } + } if(sdl_key==SDLK_SPACE) sys_pause = !sys_pause; if(sdl_key=='h') diff --git a/misc.c b/misc.c index 2eac7b2..7c551e2 100644 --- a/misc.c +++ b/misc.c @@ -228,7 +228,7 @@ void strappend(char *dst, char *src) for(s=(unsigned char *)src; *s; s++) { - *(d++) = *s; + *(d++) = *s; } *d = 0; } diff --git a/powder.c b/powder.c index ae7ba8f..b147392 100644 --- a/powder.c +++ b/powder.c @@ -237,7 +237,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 150; } End Testing*/ - if(t==PT_COAL) + if(t==PT_COAL) parts[i].life = 110; if(t==PT_FIRE) parts[i].life = rand()%50+120; @@ -518,7 +518,7 @@ void update_particles_i(pixel *vid, int start, int inc) (bmap[y/CELL][x/CELL]==2) || (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || + (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) { @@ -705,8 +705,8 @@ void update_particles_i(pixel *vid, int start, int inc) int ctemp = pv[y/CELL][x/CELL]*2; c_heat = 0.0f; h_count = 0; - if(t==PT_ICEI && !parts[i].ctype) - parts[i].ctype = PT_WATR; + if(t==PT_ICEI && !parts[i].ctype) + parts[i].ctype = PT_WATR; if(ptypes[t].hconduct>(rand()%250)) { for(nx=-1; nx<2; nx++) @@ -937,15 +937,15 @@ void update_particles_i(pixel *vid, int start, int inc) } else if(t==PT_COAL) { - if(parts[i].life<=0){ - t = PT_NONE; - kill_part(i); - create_part(-1, x, y, PT_FIRE); - goto killed; - } else if(parts[i].life < 100){ - parts[i].life--; - create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); - } + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + create_part(-1, x, y, PT_FIRE); + goto killed; + } else if(parts[i].life < 100) { + parts[i].life--; + create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); + } for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) @@ -957,9 +957,9 @@ void update_particles_i(pixel *vid, int start, int inc) continue; if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) { - if(parts[i].life>100){ - parts[i].life = 99; - } + if(parts[i].life>100) { + parts[i].life = 99; + } } } } -- cgit v0.9.2-21-gd62e From c12cdce5b650220334bdc1de03303118954fb12d Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 19 Sep 2010 17:13:06 +0100 Subject: UI stuff for history diff --git a/interface.c b/interface.c index 7bbde73..c5e9f0d 100644 --- a/interface.c +++ b/interface.c @@ -1759,7 +1759,7 @@ corrupt: int search_ui(pixel *vid_buf) { - int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,dap,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; int thumb_drawn[GRID_X*GRID_Y]; pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); @@ -1952,6 +1952,7 @@ int search_ui(pixel *vid_buf) } mp = dp = -1; + dap = -1; st = 0; for(gj=0; gj=gx-6 && mx<=gx+4 && my>=gy+YRES/GRID_S-4 && my<=gy+YRES/GRID_S+6) + { + mp = -1; + dap = pos; + } } drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, YRES/GRID_S+3, 128, 128, 128, 255); fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, 1+(YRES/GRID_S+3)/2, 0, 107, 10, 255); @@ -2025,6 +2031,16 @@ int search_ui(pixel *vid_buf) drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); } + if(!search_dates[pos] && own) + { + fillrect(vid_buf, gx-5, gy+YRES/GRID_S-3, 7, 8, 255, 255, 255, 255); + if(dap == pos){ + drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 200, 100, 80, 255); + } else { + drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 160, 70, 50, 255); + } + //drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } if(view_own || svf_admin || svf_mod) { sprintf(ts+1, "%d", search_votes[pos]); @@ -2139,6 +2155,11 @@ int search_ui(pixel *vid_buf) last = NULL; } } + if(b && !bq && dap!=-1) + { + sprintf(ed.str, "history:%s", search_ids[dap]); + lasttime = TIMEOUT; + } if(b && !bq && tp!=-1) { -- cgit v0.9.2-21-gd62e From d43b5a4fd848fe6f3fca12ee5a6be7d2e9dd9294 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 22 Sep 2010 16:01:49 +0100 Subject: Fix Thermite and Stickman reload glitch diff --git a/main.c b/main.c old mode 100644 new mode 100755 index 51fe3b0..e0c5d62 --- a/main.c +++ b/main.c @@ -506,7 +506,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0) j=d[p++]; if(j >= PT_NUM) goto corrupt; - if(j && !(isplayer == 1 && j==PT_STKM)) + if(j)// && !(isplayer == 1 && j==PT_STKM)) { if(pmap[y][x]) { @@ -1764,7 +1764,7 @@ int main(int argc, char *argv[]) memset(fire_g, 0, sizeof(fire_g)); memset(fire_b, 0, sizeof(fire_b)); } - if(x>=19 && x<=35 && svf_last && svf_open) + if(x>=19 && x<=35 && svf_last && svf_open && !bq) parse_save(svf_last, svf_lsize, 1, 0, 0); if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { diff --git a/powder.h b/powder.h old mode 100644 new mode 100755 index cf9069f..4f2736b --- a/powder.h +++ b/powder.h @@ -337,78 +337,78 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E*/ /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S*/ /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T*/ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0}, /* D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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* INWR */ - /* YEST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,1,0}, /* YEST */ - /* DYST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,1,0}, /* DYST */ - /* THRM */ {0,1,1,1,1,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0}, /* THRM */ - /* GLOW */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0}, - /* BRCK */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* N D W O F M L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y*/ - /* o u a i i e a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M e o O 2 N E*/ - /* n s t l r t v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K s a X W S*/ - /* e t r l e l a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E l l R T*/ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0}, /* Dust */ + /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0}, /* Watr */ + /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}, /* Oill */ + /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Fire */ + /* STNE */ {0,1,1,1,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,0}, /* Stne */ + /* LAVA */ {0,1,1,1,1,0,0,1,1,0,1,0,0,0,0,0,1,0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,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0}, + /* BRCK */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + /* N D W O F S L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G*/ + /* o u a i i t a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M e o O 2 N E y h l*/ + /* n s t l r n v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K s a X W S s r o*/ + /* e t r l e e a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E l l R T t m w*/ }; extern int isplayer; -- cgit v0.9.2-21-gd62e From 6d3fe4344f6e844a0401f9381047906d2dc0813d Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 24 Sep 2010 16:07:58 +0100 Subject: Few bug-fixes added Fireworks and Cold-flame diff --git a/graphics.c b/graphics.c index 7f9cf8c..8707037 100644 --- a/graphics.c +++ b/graphics.c @@ -1755,6 +1755,84 @@ void draw_parts(pixel *vid) blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } + } else if(t==PT_HFLM) + { + float ttemp = (float)parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = hflm_data[caddress]; + uint8 G = hflm_data[caddress+1]; + uint8 B = hflm_data[caddress+2]; + if(cmode == 3||cmode==4 || cmode==6) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_FIRW&&parts[i].tmp==3) + { + float ttemp = (float)parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = firw_data[caddress]; + uint8 G = firw_data[caddress+1]; + uint8 B = firw_data[caddress+2]; + if(cmode == 3||cmode==4 || cmode==6) + { + cr = R/2; + cg = G/2; + cb = B/2; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } } else if(t==PT_FIRE && parts[i].life) { @@ -1900,7 +1978,7 @@ void draw_parts(pixel *vid) //blendpixel(vid, nx+1, ny, R, G, B, 255); } } - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH) + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_HFLM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH&&t!=PT_SMKE&&t!=PT_WTRV&&!(t==PT_FIRW&&parts[i].tmp==3)) { uint8 R = PIXR(ptypes[t].pcolors); uint8 G = PIXG(ptypes[t].pcolors); diff --git a/hmap.h b/hmap.h index 92605f2..1af8013 100755 --- a/hmap.h +++ b/hmap.h @@ -28,4 +28,6 @@ //Scaled Hue Scale static char color_data[] = {0xFF,0x00,0xFF,0xF1,0x00,0xFF,0xDE,0x00,0xFF,0xC7,0x00,0xFF,0xAF,0x00,0xFF,0x97,0x00,0xFF,0x82,0x00,0xFF,0x6C,0x00,0xFF,0x56,0x00,0xFF,0x41,0x00,0xFF,0x2E,0x00,0xFF,0x21,0x05,0xFF,0x16,0x0F,0xFF,0x0E,0x1B,0xFF,0x07,0x29,0xFF,0x02,0x39,0xFF,0x00,0x4B,0xFF,0x00,0x5E,0xFF,0x00,0x74,0xFF,0x00,0x8A,0xFF,0x00,0xA0,0xFF,0x00,0xAF,0xFF,0x00,0xB8,0xFE,0x00,0xC2,0xFD,0x00,0xCC,0xFD,0x00,0xD5,0xFC,0x00,0xDF,0xFA,0x00,0xE7,0xF9,0x00,0xEF,0xF6,0x00,0xF6,0xF3,0x00,0xFC,0xEE,0x00,0xFF,0xE8,0x00,0xFF,0xE1,0x00,0xFF,0xD8,0x00,0xFF,0xCE,0x00,0xFF,0xC4,0x00,0xFF,0xB9,0x00,0xFF,0xAD,0x00,0xFF,0xA1,0x00,0xFF,0x96,0x00,0xFF,0x8A,0x00,0xFF,0x80,0x00,0xFF,0x7C,0x00,0xFF,0x78,0x00,0xFF,0x75,0x00,0xFF,0x71,0x00,0xFF,0x6D,0x00,0xFF,0x69,0x00,0xFF,0x66,0x00,0xFF,0x62,0x00,0xFF,0x5E,0x00,0xFF,0x5A,0x00,0xFF,0x56,0x00,0xFF,0x52,0x00,0xFF,0x4E,0x00,0xFF,0x4A,0x00,0xFF,0x47,0x00,0xFF,0x43,0x00,0xFF,0x3F,0x00,0xFF,0x3B,0x00,0xFF,0x38,0x00,0xFF,0x34,0x00,0xFF,0x31,0x00,0xFF,0x2D,0x00,0xFF,0x2A,0x00,0xFF,0x27,0x00,0xFF,0x24,0x00,0xFF,0x21,0x00,0xFF,0x1E,0x00,0xFF,0x1B,0x00,0xFF,0x19,0x00,0xFF,0x17,0x01,0xFF,0x14,0x02,0xFF,0x13,0x04,0xFF,0x11,0x06,0xFF,0x0F,0x07,0xFF,0x0E,0x0A,0xFF,0x0C,0x0C,0xFF,0x0B,0x0E,0xFF,0x0A,0x10,0xFF,0x09,0x13,0xFF,0x08,0x16,0xFF,0x07,0x18,0xFF,0x06,0x1B,0xFF,0x06,0x1E,0xFF,0x05,0x21,0xFF,0x04,0x24,0xFF,0x04,0x27,0xFF,0x04,0x2A,0xFF,0x03,0x2D,0xFF,0x03,0x30,0xFF,0x03,0x34,0xFF,0x02,0x37,0xFF,0x02,0x3A,0xFF,0x02,0x3D,0xFF,0x02,0x41,0xFF,0x02,0x44,0xFF,0x01,0x47,0xFF,0x01,0x4A,0xFF,0x01,0x4E,0xFF,0x01,0x51,0xFF,0x00,0x54,0xFF,0x00,0x56,0xFF,0x00,0x58,0xFF,0x00,0x5A,0xFF,0x00,0x5C,0xFF,0x00,0x5E,0xFF,0x00,0x60,0xFF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71,0x00,0xFF,0x70,0x00,0xFF,0x6F,0x00,0xFF,0x6E,0x00,0xFF,0x6D,0x00,0xFF,0x6C,0x00,0xFF,0x6B,0x00,0xFF,0x6A,0x00,0xFF,0x6A,0x00,0xFF,0x69,0x00,0xFF,0x68,0x00,0xFF,0x68,0x00,0xFF,0x67,0x00,0xFF,0x66,0x00,0xFF,0x66,0x00,0xFF,0x65,0x00,0xFF,0x65,0x00,0xFF,0x64,0x00,0xFF,0x63,0x00,0xFF,0x63,0x00,0xFF,0x62,0x00,0xFF,0x61,0x00,0xFF,0x61,0x00,0xFF,0x60,0x00,0xFF,0x5F,0x00,0xFF,0x5F,0x00,0xFF,0x5E,0x00,0xFF,0x5D,0x00,0xFF,0x5D,0x00,0xFF,0x5C,0x00,0xFF,0x5B,0x00,0xFF,0x5B,0x00,0xFF,0x5A,0x00,0xFF,0x59,0x00,0xFF,0x59,0x00,0xFF,0x58,0x00,0xFF,0x57,0x00,0xFF,0x57,0x00,0xFF,0x56,0x00,0xFF,0x55,0x00,0xFF,0x54,0x00,0xFF,0x54,0x00,0xFF,0x53,0x00,0xFF,0x52,0x00,0xFF,0x52,0x00,0xFF,0x51,0x00,0xFF,0x50,0x00,0xFF,0x50,0x00,0xFF,0x4F,0x00,0xFF,0x4E,0x00,0xFF,0x4E,0x00,0xFF,0x4D,0x00,0xFF,0x4C,0x00,0xFF,0x4B,0x00,0xFF,0x4B,0x00,0xFF,0x4A,0x00,0xFF,0x49,0x00,0xFF,0x49,0x00,0xFF,0x48,0x00,0xFF,0x47,0x00,0xFF,0x46,0x00,0xFF,0x46,0x00,0xFF,0x45,0x00,0xFF,0x44,0x00,0xFF,0x44,0x00,0xFF,0x43,0x00,0xFF,0x42,0x00,0xFF,0x41,0x00,0xFF,0x41,0x00,0xFF,0x40,0x00,0xFF,0x3F,0x00,0xFF,0x3F,0x00,0xFF,0x3E,0x00,0xFF,0x3D,0x00,0xFF,0x3C,0x00,0xFF,0x3C,0x00,0xFF,0x3B,0x00,0xFF,0x3A,0x00,0xFF,0x3A,0x00,0xFF,0x39,0x00,0xFF,0x38,0x00,0xFF,0x38,0x00,0xFF,0x37,0x00,0xFF,0x36,0x00,0xFF,0x35,0x00,0xFF,0x35,0x00,0xFF,0x34,0x00,0xFF,0x33,0x00,0xFF,0x33,0x00,0xFF,0x32,0x00,0xFF,0x31,0x00,0xFF,0x31,0x00,0xFF,0x30,0x00,0xFF,0x2F,0x00,0xFF,0x2E,0x00,0xFF,0x2E,0x00,0xFF,0x2D,0x00,0xFF,0x2C,0x00,0xFF,0x2C,0x00,0xFF,0x2B,0x00,0xFF,0x2A,0x00,0xFF,0x2A,0x00,0xFF,0x29,0x00,0xFF,0x28,0x00,0xFF,0x28,0x00,0xFF,0x27,0x00,0xFF,0x26,0x00,0xFF,0x26,0x00,0xFF,0x25,0x00,0xFF,0x24,0x00,0xFF,0x24,0x00,0xFF,0x23,0x00,0xFF,0x22,0x00,0xFF,0x22,0x00,0xFF,0x21,0x00,0xFF,0x21,0x00,0xFF,0x20,0x00,0xFF,0x1F,0x00,0xFF,0x1F,0x00,0xFF,0x1E,0x00,0xFF,0x1D,0x00,0xFF,0x1D,0x00,0xFF,0x1C,0x00,0xFF,0x1C,0x00,0xFF,0x1B,0x00,0xFF,0x1A,0x00,0xFF,0x1A,0x00,0xFF,0x19,0x00,0xFF,0x19,0x00,0xFF,0x18,0x00,0xFF,0x17,0x00,0xFF,0x17,0x00,0xFF,0x16,0x00,0xFF,0x16,0x00,0xFF,0x15,0x00,0xFF,0x14,0x00,0xFF,0x14,0x00,0xFF,0x13,0x00,0xFF,0x13,0x00,0xFF,0x12,0x00,0xFF,0x12,0x00,0xFF,0x11,0x00,0xFF,0x11,0x00,0xFF,0x10,0x00,0xFF,0x10,0x00,0xFF,0x0F,0x00,0xFF,0x0F,0x00,0xFF,0x0E,0x00,0xFF,0x0E,0x00,0xFF,0x0D,0x00,0xFF,0x0D,0x00,0xFF,0x0C,0x00,0xFF,0x0C,0x00,0xFF,0x0B,0x00,0xFF,0x0B,0x00,0xFF,0x0A,0x00,0xFF,0x0A,0x00,0xFF,0x09,0x00,0xFF,0x09,0x00,0xFF,0x08,0x00,0xFF,0x08,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x06,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x05,0x00,0xFF,0x05,0x00,0xFF,0x04,0x00,0xFF,0x04,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x02,0x00,0xFF,0x02,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x00,0x00}; static char plasma_data[] = {0x00,0x00,0x00,0x03,0x00,0x00,0x05,0x00,0x00,0x09,0x00,0x00,0x0E,0x00,0x00,0x12,0x00,0x00,0x17,0x00,0x00,0x1C,0x00,0x00,0x22,0x00,0x00,0x27,0x00,0x00,0x2C,0x00,0x00,0x32,0x00,0x00,0x37,0x00,0x00,0x3C,0x00,0x00,0x41,0x00,0x00,0x45,0x00,0x00,0x4A,0x00,0x00,0x4D,0x00,0x00,0x51,0x00,0x00,0x53,0x00,0x00,0x55,0x00,0x00,0x55,0x00,0x02,0x55,0x02,0x03,0x55,0x03,0x06,0x55,0x03,0x07,0x55,0x05,0x09,0x55,0x06,0x0C,0x55,0x06,0x0F,0x55,0x07,0x10,0x55,0x09,0x13,0x55,0x0A,0x16,0x55,0x0C,0x1A,0x55,0x0C,0x1D,0x54,0x0E,0x20,0x53,0x10,0x23,0x54,0x11,0x26,0x53,0x13,0x2A,0x52,0x14,0x2E,0x51,0x15,0x31,0x50,0x17,0x35,0x50,0x19,0x38,0x4E,0x1A,0x3D,0x4D,0x1C,0x40,0x4D,0x1D,0x44,0x4C,0x1F,0x47,0x4B,0x21,0x4C,0x4A,0x23,0x4F,0x49,0x24,0x54,0x48,0x25,0x57,0x47,0x28,0x5B,0x46,0x29,0x5F,0x45,0x2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,0xC3,0xC4,0xC4,0xC4}; +static char hflm_data[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x04, 0x02, 0x01, 0x04, 0x02, 0x03, 0x05, 0x03, 0x03, 0x07, 0x04, 0x04, 0x08, 0x04, 0x03, 0x09, 0x04, 0x04, 0x0B, 0x05, 0x04, 0x0C, 0x05, 0x05, 0x0D, 0x06, 0x05, 0x0E, 0x07, 0x06, 0x10, 0x07, 0x07, 0x11, 0x08, 0x07, 0x12, 0x09, 0x08, 0x14, 0x09, 0x08, 0x15, 0x0A, 0x09, 0x17, 0x0A, 0x09, 0x19, 0x0B, 0x0A, 0x1A, 0x0C, 0x0A, 0x1C, 0x0D, 0x0B, 0x1D, 0x0D, 0x0B, 0x1F, 0x0D, 0x0C, 0x22, 0x0F, 0x0D, 0x23, 0x0F, 0x0E, 0x25, 0x10, 0x0E, 0x26, 0x11, 0x0F, 0x28, 0x12, 0x10, 0x2A, 0x13, 0x10, 0x2C, 0x13, 0x11, 0x2E, 0x14, 0x12, 0x2F, 0x15, 0x12, 0x31, 0x15, 0x13, 0x33, 0x16, 0x14, 0x35, 0x17, 0x15, 0x36, 0x18, 0x15, 0x39, 0x19, 0x16, 0x3B, 0x19, 0x17, 0x3D, 0x1B, 0x17, 0x3E, 0x1B, 0x18, 0x40, 0x1C, 0x19, 0x42, 0x1D, 0x1A, 0x43, 0x1D, 0x1B, 0x45, 0x1E, 0x1C, 0x47, 0x1F, 0x1C, 0x49, 0x20, 0x1D, 0x4B, 0x21, 0x1F, 0x4C, 0x21, 0x1F, 0x4E, 0x22, 0x20, 0x50, 0x23, 0x21, 0x52, 0x23, 0x22, 0x53, 0x24, 0x23, 0x55, 0x25, 0x23, 0x56, 0x26, 0x24, 0x59, 0x26, 0x25, 0x5A, 0x27, 0x26, 0x5B, 0x28, 0x27, 0x5D, 0x28, 0x28, 0x5E, 0x29, 0x29, 0x60, 0x29, 0x2A, 0x62, 0x2A, 0x2B, 0x63, 0x2B, 0x2C, 0x64, 0x2C, 0x2E, 0x65, 0x2C, 0x2E, 0x66, 0x2C, 0x2F, 0x68, 0x2D, 0x31, 0x69, 0x2E, 0x32, 0x6A, 0x2F, 0x32, 0x6B, 0x2F, 0x34, 0x6C, 0x30, 0x34, 0x6D, 0x30, 0x35, 0x6F, 0x31, 0x37, 0x70, 0x31, 0x38, 0x71, 0x32, 0x39, 0x72, 0x33, 0x3B, 0x73, 0x33, 0x3C, 0x74, 0x34, 0x3D, 0x75, 0x35, 0x3E, 0x76, 0x35, 0x3F, 0x78, 0x36, 0x41, 0x78, 0x36, 0x42, 0x79, 0x36, 0x43, 0x7A, 0x37, 0x44, 0x7B, 0x37, 0x46, 0x7C, 0x38, 0x48, 0x7D, 0x39, 0x48, 0x7E, 0x3A, 0x49, 0x7F, 0x39, 0x4B, 0x80, 0x3A, 0x4C, 0x81, 0x3B, 0x4E, 0x82, 0x3C, 0x4F, 0x83, 0x3C, 0x51, 0x84, 0x3C, 0x52, 0x84, 0x3D, 0x54, 0x86, 0x3E, 0x55, 0x87, 0x3E, 0x56, 0x88, 0x3F, 0x57, 0x89, 0x40, 0x59, 0x8A, 0x40, 0x5A, 0x8A, 0x41, 0x5C, 0x8B, 0x41, 0x5D, 0x8C, 0x42, 0x5F, 0x8D, 0x41, 0x60, 0x8E, 0x42, 0x62, 0x8E, 0x42, 0x62, 0x8F, 0x44, 0x65, 0x90, 0x43, 0x65, 0x91, 0x45, 0x67, 0x91, 0x44, 0x69, 0x92, 0x45, 0x6A, 0x93, 0x46, 0x6B, 0x94, 0x46, 0x6C, 0x94, 0x46, 0x6E, 0x96, 0x47, 0x70, 0x96, 0x48, 0x70, 0x97, 0x48, 0x72, 0x98, 0x48, 0x73, 0x99, 0x49, 0x74, 0x99, 0x49, 0x76, 0x9A, 0x4A, 0x77, 0x9A, 0x4B, 0x78, 0x9B, 0x4B, 0x7A, 0x9C, 0x4B, 0x7B, 0x9D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0x9B,0xCF,0x9D,0x93}; #endif \ No newline at end of file diff --git a/powder.c b/powder.c index b147392..d4ed908 100644 --- a/powder.c +++ b/powder.c @@ -227,6 +227,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 0; parts[i].ctype = 0; parts[i].temp = ptypes[t].heat; + parts[i].tmp = 0; } if(t==PT_ACID) { @@ -243,6 +244,8 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = rand()%50+120; if(t==PT_PLSM) parts[i].life = rand()%150+50; + if(t==PT_HFLM) + parts[i].life = rand()%150+50; if(t==PT_LAVA) parts[i].life = rand()%120+240; if(t==PT_NBLE) @@ -480,7 +483,7 @@ void update_particles_i(pixel *vid, int start, int inc) { if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) parts[i].life--; - if(parts[i].life<=0 && t!=PT_METL && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR) + if(parts[i].life<=0 && t!=PT_METL && t!=PT_FIRW && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR) { kill_part(i); continue; @@ -809,6 +812,8 @@ void update_particles_i(pixel *vid, int start, int inc) pv[y/CELL][x/CELL] += 0.50f; if(t==PT_FIRE) parts[i].life = rand()%50+120; + if(t==PT_HFLM) + parts[i].life = rand()%50+120; } } if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) @@ -1285,6 +1290,60 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_FIRW){ + if(parts[i].tmp==0){ + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_FIRE) + { + parts[i].tmp = 1; + parts[i].life = rand()%50+120; + } + } + } + else if(parts[i].tmp==1){ + if(parts[i].life==0){ + parts[i].tmp=2; + } else { + float newVel = parts[i].life/50; + parts[i].flags = parts[i].flags&0xFFFFFFFE; + parts[i].vy = -newVel; + ly-=newVel; + iy-=newVel; + } + } + else if(parts[i].tmp==2){ + for(nx=-2; nx<3; nx++){ + for(ny=-2; ny<3; ny++){ + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + parts[r>>8].vx = (rand()%3-1)*tmul; + parts[r>>8].vy = (rand()%3-1)*tmul; + parts[r>>8].tmp = 3; + parts[r>>8].life = rand()%100+100; + } + } + } + pv[y/CELL][x/CELL] += 20; + kill_part(i); + } else if(parts[i].tmp==3){ + if(parts[i].life<=0){ + kill_part(i); + } + } + } else if(t==PT_BTRY) { rt = 3 + (int)pv[y/CELL][x/CELL]; @@ -1944,7 +2003,7 @@ killed: parts[i].type = PT_NBLE; parts[i].life = 0; } - if (t==PT_FIRE && parts[i].life <=1 && parts[i].temp<673) + if (t==PT_FIRE && parts[i].life <=1 && parts[i].temp<625) { t = parts[i].type = PT_SMKE; parts[i].life = rand()%20+250; diff --git a/powder.h b/powder.h index 4f2736b..8d03b3d 100755 --- a/powder.h +++ b/powder.h @@ -106,7 +106,9 @@ #define PT_THRM 65 #define PT_GLOW 66 #define PT_BRCK 67 -#define PT_NUM 68 +#define PT_HFLM 68 +#define PT_FIRW 69 +#define PT_NUM 70 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -187,7 +189,7 @@ static const part_type ptypes[PT_NUM] = {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f+273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable. Solidifies under pressure"}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f+273.15f, 88, "Ignites flammable materials. Heats air."}, {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f+273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, @@ -241,7 +243,7 @@ static const part_type ptypes[PT_NUM] = {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+400.0f+273.15f, 88, "Smoke"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke"}, {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, @@ -249,9 +251,11 @@ static const part_type ptypes[PT_NUM] = {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite."}, - {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure"}, {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; @@ -326,6 +330,8 @@ static part_state pstates[PT_NUM] = /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static unsigned char can_move[PT_NUM][PT_NUM] = { @@ -337,74 +343,76 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E*/ /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S*/ /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T*/ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0}, /* Dust */ - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0}, /* Watr */ - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}, /* Oill */ - /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,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* HFLM */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* HFlm */ + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* N D W O F S L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G*/ /* o u a i i t a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M e o O 2 N E y h l*/ /* n s t l r n v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K s a X W S s r o*/ -- cgit v0.9.2-21-gd62e From 3d6e7f8f62fc2e34c1d525842dc711c3be903a20 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 24 Sep 2010 16:23:29 +0100 Subject: Fireworks bugfixes diff --git a/powder.c b/powder.c index d4ed908..42099fe 100644 --- a/powder.c +++ b/powder.c @@ -1301,7 +1301,7 @@ void update_particles_i(pixel *vid, int start, int inc) if((r>>8)>=NPART || !r) continue; rt = parts[r>>8].type; - if(rt==PT_FIRE) + if(rt==PT_FIRE||rt==PT_PLSM||rt==PT_THDR) { parts[i].tmp = 1; parts[i].life = rand()%50+120; @@ -1314,9 +1314,11 @@ void update_particles_i(pixel *vid, int start, int inc) } else { float newVel = parts[i].life/50; parts[i].flags = parts[i].flags&0xFFFFFFFE; - parts[i].vy = -newVel; - ly-=newVel; - iy-=newVel; + if((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE){ + parts[i].vy = -newVel; + ly-=newVel; + iy-=newVel; + } } } else if(parts[i].tmp==2){ @@ -1329,10 +1331,13 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - parts[r>>8].vx = (rand()%3-1)*tmul; - parts[r>>8].vy = (rand()%3-1)*tmul; - parts[r>>8].tmp = 3; - parts[r>>8].life = rand()%100+100; + if(parts[r>>8].type==PT_FIRW){ + parts[r>>8].vx = (rand()%3-1)*tmul; + parts[r>>8].vy = (rand()%3-1)*tmul; + parts[r>>8].tmp = 3; + parts[r>>8].life = rand()%100+100; + parts[r>>8].temp = 6000.0f; + } } } } -- cgit v0.9.2-21-gd62e From fffb5300d0663924df19184b286cfda438ea50b2 Mon Sep 17 00:00:00 2001 From: FacialTurd Date: Sat, 25 Sep 2010 04:07:55 -0700 Subject: diff --git a/defines.h b/defines.h index 73ab019..a324e9f 100644 --- a/defines.h +++ b/defines.h @@ -7,8 +7,8 @@ #define PATH_SEP "/" #endif -#define SAVE_VERSION 42 -#define MINOR_VERSION 1 +#define SAVE_VERSION 43 +#define MINOR_VERSION 0 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. #define BETA -- cgit v0.9.2-21-gd62e From c7dab50b51f51d8c386123b33d2a726740d03483 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 25 Sep 2010 19:11:25 +0100 Subject: Add Anti-Matter diff --git a/defines.h b/defines.h index 73ab019..a324e9f 100644 --- a/defines.h +++ b/defines.h @@ -7,8 +7,8 @@ #define PATH_SEP "/" #endif -#define SAVE_VERSION 42 -#define MINOR_VERSION 1 +#define SAVE_VERSION 43 +#define MINOR_VERSION 0 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. #define BETA diff --git a/powder.c b/powder.c index 42099fe..6c69084 100644 --- a/powder.c +++ b/powder.c @@ -1260,7 +1260,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1290,6 +1290,35 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_AMTR) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL) + { + t = parts[i].life++; + if(parts[i].life==3) + { + parts[i].type = PT_NONE; + kill_part(i); + } + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + kill_part(r>>8); + if(2>(rand()/(RAND_MAX/100))) + create_part(r>>8, x+nx, y+ny, PT_PHOT); + pv[y/CELL][x/CELL] -= 5.0f; + continue; + } + } + } else if(t==PT_FIRW){ if(parts[i].tmp==0){ for(nx=-1; nx<2; nx++) diff --git a/powder.h b/powder.h index 8d03b3d..935af39 100755 --- a/powder.h +++ b/powder.h @@ -108,7 +108,8 @@ #define PT_BRCK 67 #define PT_HFLM 68 #define PT_FIRW 69 -#define PT_NUM 70 +#define PT_AMTR 70 +#define PT_NUM 71 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -245,7 +246,7 @@ static const part_type ptypes[PT_NUM] = {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke"}, {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, - {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, @@ -255,7 +256,8 @@ static const part_type ptypes[PT_NUM] = {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure"}, {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; @@ -332,6 +334,7 @@ static part_state pstates[PT_NUM] = /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static unsigned char can_move[PT_NUM][PT_NUM] = { @@ -343,76 +346,77 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E*/ /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S*/ /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T*/ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0}, /* Dust */ - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0}, /* Watr */ - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}, /* Oill */ - /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* N D W O F S L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G*/ /* o u a i i t a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M e o O 2 N E y h l*/ /* n s t l r n v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K s a X W S s r o*/ -- cgit v0.9.2-21-gd62e From ddde608d3e95cbeade256eacf3ea33e974c004c7 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 26 Sep 2010 03:37:13 -0400 Subject: half done commiting diff --git a/powder.c b/powder.c index 6c69084..c82c5d8 100644 --- a/powder.c +++ b/powder.c @@ -238,6 +238,10 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 150; } End Testing*/ + if(t==PT_FUSE) + parts[i].life = ((uint32_t)(50 << 24) | (uint32_t)50); + if(t==PT_FSEP) + parts[i].life = 50; if(t==PT_COAL) parts[i].life = 110; if(t==PT_FIRE) @@ -479,7 +483,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(sys_pause&&!framerender) return; - if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM) + if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP) { if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) parts[i].life--; @@ -968,6 +972,80 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_FUSE) + { + // I do a parts[i].life hack here, the first half bits is for the burn life, the last half bits is for the pressure life + tempu1 = (uint16_t)(((unsigned int)parts[i].life) >> 24); + tempu2 = (uint16_t)(((unsigned int)parts[i].life) & 0x0000FFFF); + if(tempu1<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (tempu1 < 40) { + tempu1--; + if((rand()%100)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + if(pv[y/CELL][x/CELL] > 0.8f) + tempu2--; + else if(tempu2<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_FSEP); + goto killed; + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) + { + if(tempu1>40) { + tempu1 = 39; + } + } + } + parts[i].life = ((uint32_t)(((uint32_t)tempu1 << 24) | (uint32_t)tempu2)); + } + else if(t==PT_FSEP) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%10)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) + { + if(parts[i].life>40) { + parts[i].life = 39; + } + } + } + } else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) { for(nx=-2; nx<3; nx++) -- cgit v0.9.2-21-gd62e From 7341fd94685f83956374d34323c11de5c27a9e06 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 26 Sep 2010 04:01:14 -0400 Subject: merged! diff --git a/powder.c b/powder.c index c82c5d8..ffe604b 100644 --- a/powder.c +++ b/powder.c @@ -1,3 +1,4 @@ +#include #include #include "defines.h" #include "powder.h" @@ -466,6 +467,9 @@ int nearest_part(int ci, int t) void update_particles_i(pixel *vid, int start, int inc) { int i, j, x, y, t, nx, ny, r, a, s, rt, fe, nt, lpv, nearp, pavg; + uint16_t tempu1, tempu2; + int16_t temps1, temps2; + float tempf1, tempf2; float mv, dx, dy, ix, iy, lx, ly, d, pp; float pt = R_TEMP; float c_heat = 0.0f; diff --git a/powder.h b/powder.h index 935af39..ffe2dab 100755 --- a/powder.h +++ b/powder.h @@ -108,8 +108,10 @@ #define PT_BRCK 67 #define PT_HFLM 68 #define PT_FIRW 69 -#define PT_AMTR 70 -#define PT_NUM 71 +#define PT_FUSE 70 +#define PT_FSEP 71 +#define PT_AMTR 72 +#define PT_NUM 73 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -247,7 +249,7 @@ static const part_type ptypes[PT_NUM] = {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke"}, {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, @@ -255,9 +257,11 @@ static const part_type ptypes[PT_NUM] = {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure"}, {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, - {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, + {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; @@ -333,94 +337,99 @@ static part_state pstates[PT_NUM] = /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; + static unsigned char can_move[PT_NUM][PT_NUM] = { /* A B */ /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E*/ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S*/ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T*/ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0}, /* Dust */ - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0}, /* Watr */ - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}, /* Oill */ - /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0}, /* HFlm */ - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - /* N D W O F S L G N C G P D I W S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G*/ - /* o u a i i t a u i l a l f c i p n o e l l c o t n s a l m m r h r a W S S N n H H b R S a l s G h l t i B t C T W M e o O 2 N E y h l*/ - /* n s t l r n v n t n s e r e r r o o u u n i i r c t l t n t m o a x a c c 2 s o o d b C n a c l d s r c L r r K C K s a X W S s r o*/ - /* e t r l e e a p r e s x m i e k w d t t t d d v t w t w d l t t n x n n u l l m d N d s n a r m d e E y y M H E l l R T t m w*/ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M */ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R */ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* FIRW */ + /* FUSE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* FUSE */ + /* FSEP */ {0,1,1,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0}, /* FSEP */ + /* AMTR */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* AMTR */ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M */ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R */ }; extern int isplayer; -- cgit v0.9.2-21-gd62e From 26c67a303ee159006fa63f04aef7132d95069b64 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 26 Sep 2010 12:57:02 +0100 Subject: Gah\! diff --git a/powder.c b/powder.c index ffe604b..c474009 100644 --- a/powder.c +++ b/powder.c @@ -239,10 +239,12 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 150; } End Testing*/ - if(t==PT_FUSE) - parts[i].life = ((uint32_t)(50 << 24) | (uint32_t)50); + if(t==PT_FUSE){ + parts[i].life = 50; + parts[i].tmp = 50; + } if(t==PT_FSEP) - parts[i].life = 50; + parts[i].life = 50; if(t==PT_COAL) parts[i].life = 110; if(t==PT_FIRE) @@ -467,9 +469,6 @@ int nearest_part(int ci, int t) void update_particles_i(pixel *vid, int start, int inc) { int i, j, x, y, t, nx, ny, r, a, s, rt, fe, nt, lpv, nearp, pavg; - uint16_t tempu1, tempu2; - int16_t temps1, temps2; - float tempf1, tempf2; float mv, dx, dy, ix, iy, lx, ly, d, pp; float pt = R_TEMP; float c_heat = 0.0f; @@ -978,46 +977,41 @@ void update_particles_i(pixel *vid, int start, int inc) } else if(t==PT_FUSE) { - // I do a parts[i].life hack here, the first half bits is for the burn life, the last half bits is for the pressure life - tempu1 = (uint16_t)(((unsigned int)parts[i].life) >> 24); - tempu2 = (uint16_t)(((unsigned int)parts[i].life) & 0x0000FFFF); - if(tempu1<=0) { + if(parts[i].life<=0) { t = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_PLSM); parts[r].life = 50; goto killed; - } else if (tempu1 < 40) { - tempu1--; - if((rand()%100)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; - } + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%100)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } } - if(pv[y/CELL][x/CELL] > 0.8f) - tempu2--; - else if(tempu2<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_FSEP); - goto killed; - } + if(pv[y/CELL][x/CELL] > 0.8f) + parts[i].tmp--; + else if(parts[i].tmp<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_FSEP); + goto killed; + } for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx=0 && y+ny>0 && x+nx>8)>=NPART || !r) continue; if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) { - if(tempu1>40) { - tempu1 = 39; + if(parts[i].life>40) { + parts[i].life = 39; } } } - parts[i].life = ((uint32_t)(((uint32_t)tempu1 << 24) | (uint32_t)tempu2)); } else if(t==PT_FSEP) { @@ -1025,30 +1019,28 @@ void update_particles_i(pixel *vid, int start, int inc) t = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; + parts[r].life = 50; goto killed; } else if (parts[i].life < 40) { - parts[i].life--; - if((rand()%10)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; - } + parts[i].life--; + if((rand()%10)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } } for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) - { - if(parts[i].life>40) { - parts[i].life = 39; - } - } + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) + { + if(parts[i].life>40) { + parts[i].life = 39; } + } + } } else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) { -- cgit v0.9.2-21-gd62e From 0424907d28aa847bd754b561cacbc235accf04d0 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sun, 26 Sep 2010 14:00:15 +0200 Subject: atzensty... astyle diff --git a/interface.c b/interface.c index c5e9f0d..27232c9 100644 --- a/interface.c +++ b/interface.c @@ -1952,7 +1952,7 @@ int search_ui(pixel *vid_buf) } mp = dp = -1; - dap = -1; + dap = -1; st = 0; for(gj=0; gj=gx-6 && mx<=gx+4 && my>=gy+YRES/GRID_S-4 && my<=gy+YRES/GRID_S+6) + if(!search_dates[pos] && mx>=gx-6 && mx<=gx+4 && my>=gy+YRES/GRID_S-4 && my<=gy+YRES/GRID_S+6) { mp = -1; dap = pos; @@ -2034,11 +2034,11 @@ int search_ui(pixel *vid_buf) if(!search_dates[pos] && own) { fillrect(vid_buf, gx-5, gy+YRES/GRID_S-3, 7, 8, 255, 255, 255, 255); - if(dap == pos){ - drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 200, 100, 80, 255); - } else { - drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 160, 70, 50, 255); - } + if(dap == pos) { + drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 200, 100, 80, 255); + } else { + drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 160, 70, 50, 255); + } //drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); } if(view_own || svf_admin || svf_mod) @@ -2156,10 +2156,10 @@ int search_ui(pixel *vid_buf) } } if(b && !bq && dap!=-1) - { + { sprintf(ed.str, "history:%s", search_ids[dap]); lasttime = TIMEOUT; - } + } if(b && !bq && tp!=-1) { diff --git a/powder.c b/powder.c index c474009..5a0b95b 100644 --- a/powder.c +++ b/powder.c @@ -228,7 +228,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 0; parts[i].ctype = 0; parts[i].temp = ptypes[t].heat; - parts[i].tmp = 0; + parts[i].tmp = 0; } if(t==PT_ACID) { @@ -239,10 +239,10 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 150; } End Testing*/ - if(t==PT_FUSE){ + if(t==PT_FUSE) { parts[i].life = 50; - parts[i].tmp = 50; - } + parts[i].tmp = 50; + } if(t==PT_FSEP) parts[i].life = 50; if(t==PT_COAL) @@ -819,7 +819,7 @@ void update_particles_i(pixel *vid, int start, int inc) pv[y/CELL][x/CELL] += 0.50f; if(t==PT_FIRE) parts[i].life = rand()%50+120; - if(t==PT_HFLM) + if(t==PT_HFLM) parts[i].life = rand()%50+120; } } @@ -975,73 +975,73 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if(t==PT_FUSE) + else if(t==PT_FUSE) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%100)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + if(pv[y/CELL][x/CELL] > 0.8f) + parts[i].tmp--; + else if(parts[i].tmp<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_FSEP); + goto killed; + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) + { + if(parts[i].life>40) { + parts[i].life = 39; } - if(pv[y/CELL][x/CELL] > 0.8f) - parts[i].tmp--; - else if(parts[i].tmp<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_FSEP); - goto killed; - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) - { - if(parts[i].life>40) { - parts[i].life = 39; - } - } - } - } - else if(t==PT_FSEP) - { - if(parts[i].life<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; - } else if (parts[i].life < 40) { - parts[i].life--; - if((rand()%10)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; - } + } + } + } + else if(t==PT_FSEP) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%10)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) + { + if(parts[i].life>40) { + parts[i].life = 39; } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) - { - if(parts[i].life>40) { - parts[i].life = 39; - } - } - } + } } + } else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) { for(nx=-2; nx<3; nx++) @@ -1334,7 +1334,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1369,89 +1369,89 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) continue; rt = parts[r>>8].type; - if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL) - { - t = parts[i].life++; - if(parts[i].life==3) - { - parts[i].type = PT_NONE; - kill_part(i); - } - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; - kill_part(r>>8); - if(2>(rand()/(RAND_MAX/100))) - create_part(r>>8, x+nx, y+ny, PT_PHOT); - pv[y/CELL][x/CELL] -= 5.0f; - continue; - } + if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL) + { + t = parts[i].life++; + if(parts[i].life==3) + { + parts[i].type = PT_NONE; + kill_part(i); + } + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + kill_part(r>>8); + if(2>(rand()/(RAND_MAX/100))) + create_part(r>>8, x+nx, y+ny, PT_PHOT); + pv[y/CELL][x/CELL] -= 5.0f; + continue; + } } } - else if(t==PT_FIRW){ - if(parts[i].tmp==0){ - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_FIRE||rt==PT_PLSM||rt==PT_THDR) - { - parts[i].tmp = 1; - parts[i].life = rand()%50+120; - } - } - } - else if(parts[i].tmp==1){ - if(parts[i].life==0){ - parts[i].tmp=2; - } else { - float newVel = parts[i].life/50; - parts[i].flags = parts[i].flags&0xFFFFFFFE; - if((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE){ - parts[i].vy = -newVel; - ly-=newVel; - iy-=newVel; - } - } - } - else if(parts[i].tmp==2){ - for(nx=-2; nx<3; nx++){ - for(ny=-2; ny<3; ny++){ - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type==PT_FIRW){ - parts[r>>8].vx = (rand()%3-1)*tmul; - parts[r>>8].vy = (rand()%3-1)*tmul; - parts[r>>8].tmp = 3; - parts[r>>8].life = rand()%100+100; - parts[r>>8].temp = 6000.0f; - } - } - } - } - pv[y/CELL][x/CELL] += 20; - kill_part(i); - } else if(parts[i].tmp==3){ - if(parts[i].life<=0){ - kill_part(i); - } - } - } + else if(t==PT_FIRW) { + if(parts[i].tmp==0) { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_FIRE||rt==PT_PLSM||rt==PT_THDR) + { + parts[i].tmp = 1; + parts[i].life = rand()%50+120; + } + } + } + else if(parts[i].tmp==1) { + if(parts[i].life==0) { + parts[i].tmp=2; + } else { + float newVel = parts[i].life/50; + parts[i].flags = parts[i].flags&0xFFFFFFFE; + if((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE) { + parts[i].vy = -newVel; + ly-=newVel; + iy-=newVel; + } + } + } + else if(parts[i].tmp==2) { + for(nx=-2; nx<3; nx++) { + for(ny=-2; ny<3; ny++) { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type==PT_FIRW) { + parts[r>>8].vx = (rand()%3-1)*tmul; + parts[r>>8].vy = (rand()%3-1)*tmul; + parts[r>>8].tmp = 3; + parts[r>>8].life = rand()%100+100; + parts[r>>8].temp = 6000.0f; + } + } + } + } + pv[y/CELL][x/CELL] += 20; + kill_part(i); + } else if(parts[i].tmp==3) { + if(parts[i].life<=0) { + kill_part(i); + } + } + } else if(t==PT_BTRY) { rt = 3 + (int)pv[y/CELL][x/CELL]; diff --git a/powder.h b/powder.h old mode 100755 new mode 100644 index ffe2dab..1d19a2b --- a/powder.h +++ b/powder.h @@ -353,7 +353,7 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M */ /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T */ /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0}, /* Dust */ /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0}, /* Watr */ /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Oill */ @@ -378,7 +378,7 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* VOID */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0}, /* Sltw */ /* DMND */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Dmnd */ -- cgit v0.9.2-21-gd62e From 9707323109bb04e78b1e8ed4c317c8c75f5494eb Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 26 Sep 2010 15:18:03 +0100 Subject: Added Powered Clone and Heat Switch diff --git a/graphics.c b/graphics.c index 8707037..3ea0635 100644 --- a/graphics.c +++ b/graphics.c @@ -1710,13 +1710,46 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny, GR, GR, GR, 223); blendpixel(vid, nx, ny+1, GR, GR, GR, 223); blendpixel(vid, nx, ny-1, GR, GR, GR, 223); - + blendpixel(vid, nx+1, ny-1, GR, GR, GR, 112); blendpixel(vid, nx-1, ny-1, GR, GR, GR, 112); blendpixel(vid, nx+1, ny+1, GR, GR, GR, 112); blendpixel(vid, nx-1, ny+1, GR, GR, GR, 112); } - } else if(t==PT_PLSM) + } + else if(t==PT_PCLN) + { + uint8 GR = 0x3B+(parts[i].life*19); + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, 10); + if(cmode == 4) { + blendpixel(vid, nx+1, ny, GR, GR, 10, 223); + blendpixel(vid, nx-1, ny, GR, GR, 10, 223); + blendpixel(vid, nx, ny+1, GR, GR, 10, 223); + blendpixel(vid, nx, ny-1, GR, GR, 10, 223); + + blendpixel(vid, nx+1, ny-1, GR, GR, 10, 112); + blendpixel(vid, nx-1, ny-1, GR, GR, 10, 112); + blendpixel(vid, nx+1, ny+1, GR, GR, 10, 112); + blendpixel(vid, nx-1, ny+1, GR, GR, 10, 112); + } + } + else if(t==PT_HSWC) + { + uint8 GR = 0x3B+(parts[i].life*19); + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, 10, 10); + if(cmode == 4) { + blendpixel(vid, nx+1, ny, GR, 10, 10, 223); + blendpixel(vid, nx-1, ny, GR, 10, 10, 223); + blendpixel(vid, nx, ny+1, GR, 10, 10, 223); + blendpixel(vid, nx, ny-1, GR, 10, 10, 223); + + blendpixel(vid, nx+1, ny-1, GR, 10, 10, 112); + blendpixel(vid, nx-1, ny-1, GR, 10, 10, 112); + blendpixel(vid, nx+1, ny+1, GR, 10, 10, 112); + blendpixel(vid, nx-1, ny+1, GR, 10, 10, 112); + } + } + else if(t==PT_PLSM) { float ttemp = (float)parts[i].life; int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); diff --git a/powder.c b/powder.c index 5a0b95b..5438c6b 100644 --- a/powder.c +++ b/powder.c @@ -35,7 +35,7 @@ int try_move(int i, int x, int y, int nx, int ny) if(r && (r>>8)>8].type; - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) { return 1; } @@ -488,9 +488,9 @@ void update_particles_i(pixel *vid, int start, int inc) if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP) { - if(!(parts[i].life==10&&parts[i].type==PT_LCRY)) + if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC))) parts[i].life--; - if(parts[i].life<=0 && t!=PT_METL && t!=PT_FIRW && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR) + if(parts[i].life<=0 && t!=PT_METL && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR) { kill_part(i); continue; @@ -717,7 +717,7 @@ void update_particles_i(pixel *vid, int start, int inc) h_count = 0; if(t==PT_ICEI && !parts[i].ctype) parts[i].ctype = PT_WATR; - if(ptypes[t].hconduct>(rand()%250)) + if(ptypes[t].hconduct>(rand()%250)&&!(parts[i].type==PT_HSWC&&parts[i].life!=10)) { for(nx=-1; nx<2; nx++) { @@ -728,7 +728,7 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)) { h_count++; c_heat += parts[r>>8].temp; @@ -746,7 +746,7 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0) + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)) { parts[r>>8].temp = parts[i].temp; } @@ -1364,6 +1364,76 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_PCLN) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_PCLN) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_HSWC) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_HSWC) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } else if(t==PT_AMTR) { for(nx=-1; nx<2; nx++) @@ -1375,7 +1445,7 @@ void update_particles_i(pixel *vid, int start, int inc) if((r>>8)>=NPART || !r) continue; rt = parts[r>>8].type; - if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL) + if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL) { t = parts[i].life++; if(parts[i].life==3) @@ -2100,6 +2170,25 @@ killed: else create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); } + if(parts[i].type==PT_PCLN) + { + if(!parts[i].ctype) + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx303&&parts[i].temp<317) { diff --git a/powder.h b/powder.h index 1d19a2b..5bca4c7 100644 --- a/powder.h +++ b/powder.h @@ -111,7 +111,9 @@ #define PT_FUSE 70 #define PT_FSEP 71 #define PT_AMTR 72 -#define PT_NUM 73 +#define PT_PCLN 73 +#define PT_HSWC 74 +#define PT_NUM 75 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -261,7 +263,9 @@ static const part_type ptypes[PT_NUM] = {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, + {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, + {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; @@ -340,7 +344,9 @@ static part_state pstates[PT_NUM] = /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static unsigned char can_move[PT_NUM][PT_NUM] = @@ -349,87 +355,89 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* A 0 1 | B ligher than A */ /* B 1 0 | A heavier than B */ - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M */ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T */ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0}, /* Dust */ - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0}, /* Watr */ - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0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FSEP */ - /* AMTR */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* AMTR */ - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M */ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T */ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R */ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A P H */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C S */ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T L W */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R N C */ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* HSWC */ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A P H */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C S */ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T L W */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R N C */ }; extern int isplayer; -- cgit v0.9.2-21-gd62e From 2d5558491fa864f340668df05a7869ca820ddef1 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sun, 26 Sep 2010 19:50:50 +0200 Subject: astyle again. diff --git a/graphics.c b/graphics.c index 3ea0635..aafe897 100644 --- a/graphics.c +++ b/graphics.c @@ -1710,14 +1710,14 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny, GR, GR, GR, 223); blendpixel(vid, nx, ny+1, GR, GR, GR, 223); blendpixel(vid, nx, ny-1, GR, GR, GR, 223); - + blendpixel(vid, nx+1, ny-1, GR, GR, GR, 112); blendpixel(vid, nx-1, ny-1, GR, GR, GR, 112); blendpixel(vid, nx+1, ny+1, GR, GR, GR, 112); blendpixel(vid, nx-1, ny+1, GR, GR, GR, 112); } } - else if(t==PT_PCLN) + else if(t==PT_PCLN) { uint8 GR = 0x3B+(parts[i].life*19); vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, 10); @@ -1726,14 +1726,14 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny, GR, GR, 10, 223); blendpixel(vid, nx, ny+1, GR, GR, 10, 223); blendpixel(vid, nx, ny-1, GR, GR, 10, 223); - + blendpixel(vid, nx+1, ny-1, GR, GR, 10, 112); blendpixel(vid, nx-1, ny-1, GR, GR, 10, 112); blendpixel(vid, nx+1, ny+1, GR, GR, 10, 112); blendpixel(vid, nx-1, ny+1, GR, GR, 10, 112); } } - else if(t==PT_HSWC) + else if(t==PT_HSWC) { uint8 GR = 0x3B+(parts[i].life*19); vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, 10, 10); @@ -1742,14 +1742,14 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny, GR, 10, 10, 223); blendpixel(vid, nx, ny+1, GR, 10, 10, 223); blendpixel(vid, nx, ny-1, GR, 10, 10, 223); - + blendpixel(vid, nx+1, ny-1, GR, 10, 10, 112); blendpixel(vid, nx-1, ny-1, GR, 10, 10, 112); blendpixel(vid, nx+1, ny+1, GR, 10, 10, 112); blendpixel(vid, nx-1, ny+1, GR, 10, 10, 112); } } - else if(t==PT_PLSM) + else if(t==PT_PLSM) { float ttemp = (float)parts[i].life; int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); diff --git a/powder.c b/powder.c index 5438c6b..b62a68a 100644 --- a/powder.c +++ b/powder.c @@ -1364,76 +1364,76 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if(t==PT_PCLN) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK) - { - if(parts[r>>8].ctype==PT_PSCN) - { - parts[i].life = 10; - } - else if(parts[r>>8].ctype==PT_NSCN) - { - parts[i].life = 9; - } - } - if(rt==PT_PCLN) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - else if(t==PT_HSWC) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK) - { - if(parts[r>>8].ctype==PT_PSCN) - { - parts[i].life = 10; - } - else if(parts[r>>8].ctype==PT_NSCN) - { - parts[i].life = 9; - } - } - if(rt==PT_HSWC) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } + else if(t==PT_PCLN) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_PCLN) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_HSWC) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_HSWC) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } else if(t==PT_AMTR) { for(nx=-1; nx<2; nx++) @@ -2170,25 +2170,25 @@ killed: else create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); } - if(parts[i].type==PT_PCLN) - { - if(!parts[i].ctype) - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx=0 && y+ny>0 && + x+nx303&&parts[i].temp<317) { diff --git a/powder.h b/powder.h index 5bca4c7..eda30d2 100644 --- a/powder.h +++ b/powder.h @@ -264,8 +264,8 @@ static const part_type ptypes[PT_NUM] = {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, - {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, - {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, + {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, + {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; -- cgit v0.9.2-21-gd62e From bf534e1514d37a6b1fef6163fbed32766cbc8711 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 26 Sep 2010 17:14:51 -0400 Subject: Added BCOL, changed FUSE->FSEP diff --git a/powder.c b/powder.c index ffe604b..cb93d7d 100644 --- a/powder.c +++ b/powder.c @@ -124,7 +124,7 @@ void kill_part(int i) #ifdef WIN32 _inline int create_part(int p, int x, int y, int t) #else -inline int create_part(int p, int x, int y, int t) + inline int create_part(int p, int x, int y, int t) #endif { int i; @@ -181,19 +181,19 @@ inline int create_part(int p, int x, int y, int t) if(t==PT_SPRK) { if((pmap[y][x]&0xFF)!=PT_METL && - (pmap[y][x]&0xFF)!=PT_PSCN && - (pmap[y][x]&0xFF)!=PT_NSCN && - (pmap[y][x]&0xFF)!=PT_NTCT && - (pmap[y][x]&0xFF)!=PT_PTCT && - (pmap[y][x]&0xFF)!=PT_WATR && - (pmap[y][x]&0xFF)!=PT_SLTW && - (pmap[y][x]&0xFF)!=PT_BMTL && - (pmap[y][x]&0xFF)!=PT_RBDM && - (pmap[y][x]&0xFF)!=PT_LRBD && - (pmap[y][x]&0xFF)!=PT_ETRD && - (pmap[y][x]&0xFF)!=PT_BRMT && - (pmap[y][x]&0xFF)!=PT_NBLE && - (pmap[y][x]&0xFF)!=PT_INWR) + (pmap[y][x]&0xFF)!=PT_PSCN && + (pmap[y][x]&0xFF)!=PT_NSCN && + (pmap[y][x]&0xFF)!=PT_NTCT && + (pmap[y][x]&0xFF)!=PT_PTCT && + (pmap[y][x]&0xFF)!=PT_WATR && + (pmap[y][x]&0xFF)!=PT_SLTW && + (pmap[y][x]&0xFF)!=PT_BMTL && + (pmap[y][x]&0xFF)!=PT_RBDM && + (pmap[y][x]&0xFF)!=PT_LRBD && + (pmap[y][x]&0xFF)!=PT_ETRD && + (pmap[y][x]&0xFF)!=PT_BRMT && + (pmap[y][x]&0xFF)!=PT_NBLE && + (pmap[y][x]&0xFF)!=PT_INWR) return -1; parts[pmap[y][x]>>8].type = PT_SPRK; parts[pmap[y][x]>>8].life = 4; @@ -235,16 +235,18 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 75; } /*Testing - if(t==PT_WOOD){ - parts[i].life = 150; - } - End Testing*/ + if(t==PT_WOOD){ + parts[i].life = 150; + } + End Testing*/ if(t==PT_FUSE) - parts[i].life = ((uint32_t)(50 << 24) | (uint32_t)50); + parts[i].life = ((uint32_t)(50 << 24) | (uint32_t)50); if(t==PT_FSEP) - parts[i].life = 50; + parts[i].life = 50; if(t==PT_COAL) - parts[i].life = 110; + parts[i].life = ((uint32_t)(110 << 24) | (uint32_t)50); + if(t==PT_BCOL) + parts[i].life = 110; if(t==PT_FIRE) parts[i].life = rand()%50+120; if(t==PT_PLSM) @@ -334,7 +336,7 @@ inline int create_part(int p, int x, int y, int t) #ifdef WIN32 _inline void delete_part(int x, int y) #else -inline void delete_part(int x, int y) + inline void delete_part(int x, int y) #endif { unsigned i; @@ -352,7 +354,7 @@ inline void delete_part(int x, int y) #ifdef WIN32 _inline int is_wire(int x, int y) #else -inline int is_wire(int x, int y) + inline int is_wire(int x, int y) #endif { return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; @@ -361,7 +363,7 @@ inline int is_wire(int x, int y) #ifdef WIN32 _inline int is_wire_off(int x, int y) #else -inline int is_wire_off(int x, int y) + inline int is_wire_off(int x, int y) #endif { return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; @@ -396,30 +398,30 @@ void set_emap(int x, int y) // fill children if(y>1 && x1==x2 && - is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && - !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) set_emap(x1, y-2); else if(y>0) for(x=x1; x<=x2; x++) if(is_wire_off(x, y-1)) { if(x==x1 || x==x2 || y>=YRES/CELL-1 || - is_wire(x-1, y-1) || is_wire(x+1, y-1) || - is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) set_emap(x, y-1); } if(y=XRES || y>=YRES || - ((bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) + ((bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) { kill_part(i); continue; @@ -648,8 +650,8 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -926,7 +928,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -950,128 +952,169 @@ void update_particles_i(pixel *vid, int start, int inc) } else if(t==PT_COAL) { - if(parts[i].life<=0) { + tempu1 = (uint16_t)(((unsigned int)parts[i].life) >> 24); + tempu2 = (uint16_t)(((unsigned int)parts[i].life) & 0x0000FFFF); + if(tempu1<=0) { t = PT_NONE; kill_part(i); create_part(-1, x, y, PT_FIRE); goto killed; - } else if(parts[i].life < 100) { - parts[i].life--; + } else if(tempu1 < 100) { + tempu1--; create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); } - + if((pv[y/CELL][x/CELL] > 4.3f)&&tempu2>40) + tempu2=39; + else if(tempu2<40&&tempu2>0) + tempu2--; + else if(tempu2<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_BCOL); + goto killed; + } for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) continue; if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) { - if(parts[i].life>100) { - parts[i].life = 99; + if(tempu1>100) { + tempu1 = 99; } } } - } - else if(t==PT_FUSE) - { - // I do a parts[i].life hack here, the first half bits is for the burn life, the last half bits is for the pressure life - tempu1 = (uint16_t)(((unsigned int)parts[i].life) >> 24); - tempu2 = (uint16_t)(((unsigned int)parts[i].life) & 0x0000FFFF); - if(tempu1<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; - } else if (tempu1 < 40) { - tempu1--; - if((rand()%100)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; - } - } - if(pv[y/CELL][x/CELL] > 0.8f) - tempu2--; - else if(tempu2<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_FSEP); - goto killed; - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) - { - if(tempu1>40) { - tempu1 = 39; - } - } - } - parts[i].life = ((uint32_t)(((uint32_t)tempu1 << 24) | (uint32_t)tempu2)); - } - else if(t==PT_FSEP) - { - if(parts[i].life<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; - } else if (parts[i].life < 40) { - parts[i].life--; - if((rand()%10)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; - } - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) - { - if(parts[i].life>40) { - parts[i].life = 39; - } - } - } - } - else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) + parts[i].life = ((uint32_t)(((uint32_t)tempu1 << 24) | (uint32_t)tempu2)); + } else if(t==PT_BCOL) { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + create_part(-1, x, y, PT_FIRE); + goto killed; + } else if(parts[i].life < 100) { + parts[i].life; + create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); + } + for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL && parts_avg(i, r>>8)!=PT_INSL) + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) { - parts[i].temp = 473.0f; + if(parts[i].life>100) { + parts[i].life = 99; + } } } } - else if(t==PT_PLNT) - { + else if(t==PT_FUSE) + { + // I do a parts[i].life hack here, the first half bits is for the burn life, the last half bits is for the pressure life + tempu1 = (uint16_t)(((uint32_t)parts[i].life) >> 24); + tempu2 = (uint16_t)(((uint32_t)parts[i].life) & 0xFFFF); + if(tempu1<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (tempu1 < 40) { + tempu1--; + if((rand()%100)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + if((pv[y/CELL][x/CELL] > 2.7f)&&tempu2>40) + tempu2=39; + else if(tempu2<40&&tempu2>0) + tempu2--; + else if(tempu2<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_FSEP); + goto killed; + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) + { + if(tempu1>40) { + tempu1 = 39; + } + } + } + parts[i].life = ((uint32_t)(((uint32_t)tempu1 << 24) | (uint32_t)tempu2)); + } + else if(t==PT_FSEP) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%10)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) + { + if(parts[i].life>40) { + parts[i].life = 39; + } + } + } + } + else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL && parts_avg(i, r>>8)!=PT_INSL) + { + parts[i].temp = 473.0f; + } + } + } + else if(t==PT_PLNT) + { for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1123,7 +1166,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1158,7 +1201,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1185,7 +1228,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1215,7 +1258,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1263,7 +1306,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1312,11 +1355,11 @@ void update_particles_i(pixel *vid, int start, int inc) if((r&0xFF)==PT_COAL && 5>(rand()%100)) parts[r>>8].type = PT_WOOD; /*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && - (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| - ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| - ptypes[parts[r>>8].type-1].menusection==SC_GAS|| - ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000)) - parts[r>>8].type--;*/ + (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| + ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| + ptypes[parts[r>>8].type-1].menusection==SC_GAS|| + ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000)) + parts[r>>8].type--;*/ } } else if(t==PT_PHOT) @@ -1325,7 +1368,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=0; nx<1; nx++) for(ny=0; ny<1; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1466,7 +1509,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1488,7 +1531,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1517,7 +1560,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1526,8 +1569,8 @@ void update_particles_i(pixel *vid, int start, int inc) continue; rt = parts[r>>8].type; if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && - ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { parts[r>>8].type = PT_FIRE; parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); @@ -1541,7 +1584,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(legacy_enable) { if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && - ptypes[rt].meltable*lpv>(rand()%1000)) + ptypes[rt].meltable*lpv>(rand()%1000)) { if(t!=PT_LAVA || parts[i].life>0) { @@ -1613,7 +1656,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(pavg != PT_INSL) { if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8)=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) { @@ -1625,7 +1668,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8)>8].temp>373.0f))&&pavg != PT_INSL) { @@ -1635,7 +1678,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8)>8].temp<373.0f))&&pavg != PT_INSL) { @@ -1645,7 +1688,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } if(t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8)>8].life==0 && - (parts[i].life<2 || ((r>>8)>8)>8].type = PT_SPRK; parts[r>>8].life = 6; parts[r>>8].ctype = rt; } if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8)>8].type = PT_SPRK; parts[r>>8].life = 5; @@ -1696,7 +1739,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } } -killed: + killed: if(parts[i].type == PT_NONE) continue; } @@ -1772,7 +1815,7 @@ killed: if (((int)(player[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) { if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { @@ -1810,7 +1853,7 @@ killed: if (((int)(player[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) { if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { @@ -2098,11 +2141,11 @@ killed: for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx=XRES-CELL || - ny=YRES-CELL) + ny=YRES-CELL) { parts[i].x = lx; parts[i].y = ly; @@ -2935,8 +2978,8 @@ int create_parts(int x, int y, int r, int c) for(v=-1; v<2; v++) for(u=-1; u<2; u++) if(i+u>=0 && i+u=0 && j+v=0 && j+v Date: Sun, 26 Sep 2010 17:28:27 -0400 Subject: use parts[i].tmp instead of bit hacks diff --git a/powder.c b/powder.c index cb93d7d..a60d444 100644 --- a/powder.c +++ b/powder.c @@ -239,12 +239,16 @@ _inline int create_part(int p, int x, int y, int t) parts[i].life = 150; } End Testing*/ - if(t==PT_FUSE) - parts[i].life = ((uint32_t)(50 << 24) | (uint32_t)50); + if(t==PT_FUSE) { + parts[i].life = 50; + parts[i].tmp = 50; + } if(t==PT_FSEP) parts[i].life = 50; - if(t==PT_COAL) - parts[i].life = ((uint32_t)(110 << 24) | (uint32_t)50); + if(t==PT_COAL) { + parts[i].life = 110; + parts[i].tmp = 50; + } if(t==PT_BCOL) parts[i].life = 110; if(t==PT_FIRE) @@ -952,22 +956,20 @@ void update_particles_i(pixel *vid, int start, int inc) } else if(t==PT_COAL) { - tempu1 = (uint16_t)(((unsigned int)parts[i].life) >> 24); - tempu2 = (uint16_t)(((unsigned int)parts[i].life) & 0x0000FFFF); - if(tempu1<=0) { + if(parts[i].life<=0) { t = PT_NONE; kill_part(i); create_part(-1, x, y, PT_FIRE); goto killed; - } else if(tempu1 < 100) { - tempu1--; + } else if(parts[i].life < 100) { + parts[i].life; create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); } - if((pv[y/CELL][x/CELL] > 4.3f)&&tempu2>40) - tempu2=39; - else if(tempu2<40&&tempu2>0) - tempu2--; - else if(tempu2<=0) { + if((pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40) + parts[i].tmp=39; + else if(parts[i].tmp<40&&parts[i].tmp>0) + parts[i].tmp--; + else if(parts[i].tmp<=0) { t = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_BCOL); @@ -983,12 +985,11 @@ void update_particles_i(pixel *vid, int start, int inc) continue; if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) { - if(tempu1>100) { - tempu1 = 99; + if(parts[i].life>100) { + parts[i].life = 99; } } } - parts[i].life = ((uint32_t)(((uint32_t)tempu1 << 24) | (uint32_t)tempu2)); } else if(t==PT_BCOL) { if(parts[i].life<=0) { @@ -1022,24 +1023,24 @@ void update_particles_i(pixel *vid, int start, int inc) // I do a parts[i].life hack here, the first half bits is for the burn life, the last half bits is for the pressure life tempu1 = (uint16_t)(((uint32_t)parts[i].life) >> 24); tempu2 = (uint16_t)(((uint32_t)parts[i].life) & 0xFFFF); - if(tempu1<=0) { + if(parts[i].life<=0) { t = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_PLSM); parts[r].life = 50; goto killed; - } else if (tempu1 < 40) { - tempu1--; + } else if (parts[i].life < 40) { + parts[i].life--; if((rand()%100)==0) { r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); parts[r].life = 50; } } - if((pv[y/CELL][x/CELL] > 2.7f)&&tempu2>40) - tempu2=39; - else if(tempu2<40&&tempu2>0) - tempu2--; - else if(tempu2<=0) { + if((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40) + parts[i].tmp=39; + else if(parts[i].tmp<40&&parts[i].tmp>0) + parts[i].tmp--; + else if(parts[i].tmp<=0) { t = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_FSEP); @@ -1055,8 +1056,8 @@ void update_particles_i(pixel *vid, int start, int inc) continue; if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) { - if(tempu1>40) { - tempu1 = 39; + if(parts[i].life>40) { + parts[i].life = 39; } } } -- cgit v0.9.2-21-gd62e From 5b9e55436092711d862ecfc4b7fcdd69d93b75f4 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 26 Sep 2010 19:22:27 -0400 Subject: fixed BCOL and COAL bug diff --git a/powder.c b/powder.c index 389c807..cedf3ba 100644 --- a/powder.c +++ b/powder.c @@ -962,7 +962,7 @@ void update_particles_i(pixel *vid, int start, int inc) create_part(-1, x, y, PT_FIRE); goto killed; } else if(parts[i].life < 100) { - parts[i].life; + parts[i].life--; create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); } if((pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40) @@ -999,7 +999,7 @@ void update_particles_i(pixel *vid, int start, int inc) create_part(-1, x, y, PT_FIRE); goto killed; } else if(parts[i].life < 100) { - parts[i].life; + parts[i].life--; create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); } -- cgit v0.9.2-21-gd62e From 1401817f212e1c4759f38bcb47e9ec8aecfe8444 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 26 Sep 2010 19:28:18 -0400 Subject: fixed fuse bug diff --git a/powder.c b/powder.c index cedf3ba..16941fd 100644 --- a/powder.c +++ b/powder.c @@ -1021,9 +1021,6 @@ void update_particles_i(pixel *vid, int start, int inc) } else if(t==PT_FUSE) { - // I do a parts[i].life hack here, the first half bits is for the burn life, the last half bits is for the pressure life - tempu1 = (uint16_t)(((uint32_t)parts[i].life) >> 24); - tempu2 = (uint16_t)(((uint32_t)parts[i].life) & 0xFFFF); if(parts[i].life<=0) { t = PT_NONE; kill_part(i); @@ -1055,14 +1052,13 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) + if((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20))) { if(parts[i].life>40) { parts[i].life = 39; } } } - parts[i].life = ((uint32_t)(((uint32_t)tempu1 << 24) | (uint32_t)tempu2)); } else if(t==PT_FSEP) { -- cgit v0.9.2-21-gd62e From 58d710b22484b8c7cc9dadefd305f3506d3ff139 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 27 Sep 2010 12:53:05 +0200 Subject: layout change diff --git a/.gitignore b/.gitignore index ccc72b8..a6b7508 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ powder.def powder-debug gmon.out *.*.orig +build/ diff --git a/Makefile b/Makefile index 233d493..8a25f40 100755 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -SOURCES := *.c +SOURCES := src/*.c -CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L +CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/ OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations LFLAGS := -lSDL -lm -lbz2 MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3 @@ -19,6 +19,7 @@ powder-debug: $(SOURCES) powder-sse3: $(SOURCES) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 strip $@ + mv $@ build powder-sse2: $(SOURCES) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN32 strip $@ @@ -31,6 +32,7 @@ powder-64-sse3-opengl: $(SOURCES) powder-64-sse3: $(SOURCES) $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 strip $@ + mv $@ build powder-64-sse2: $(SOURCES) $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64 strip $@ diff --git a/includes/air.h b/includes/air.h new file mode 100644 index 0000000..d9e04f6 --- /dev/null +++ b/includes/air.h @@ -0,0 +1,21 @@ +#ifndef AIR_H +#define AIR_H +#include "defines.h" + +extern float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +extern float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +extern float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +extern float cb_vx[YRES/CELL][XRES/CELL], cb_ovx[YRES/CELL][XRES/CELL]; +extern float cb_vy[YRES/CELL][XRES/CELL], cb_ovy[YRES/CELL][XRES/CELL]; +extern float cb_pv[YRES/CELL][XRES/CELL], cb_opv[YRES/CELL][XRES/CELL]; + +extern float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; + +extern float kernel[9]; + +void make_kernel(void); + +void update_air(void); + +#endif \ No newline at end of file diff --git a/includes/defines.h b/includes/defines.h new file mode 100644 index 0000000..a324e9f --- /dev/null +++ b/includes/defines.h @@ -0,0 +1,118 @@ +#ifndef DEFINE_H +#define DEFINE_H + +#ifdef WIN32 +#define PATH_SEP "\\" +#else +#define PATH_SEP "/" +#endif + +#define SAVE_VERSION 43 +#define MINOR_VERSION 0 +#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. +#define BETA + +#define SERVER "powdertoy.co.uk" + +#undef PLOSS + +#define THUMB_CACHE_SIZE 256 + +#define IMGCONNS 3 +#define TIMEOUT 100 +#define HTTP_TIMEOUT 10 + +#define MENUSIZE 40 +#define BARSIZE 14 +#define XRES 612 +#define YRES 384 +#define NPART XRES*YRES + +#define MAXSIGNS 16 +#define TAG_MAX 256 + +#define ZSIZE_D 16 +#define ZFACTOR_D 8 +extern unsigned char ZFACTOR; +extern unsigned char ZSIZE; + +#define CELL 4 +#define ISTP (CELL/2) +#define CFDS (4.0f/CELL) + +#define TSTEPP 0.3f +#define TSTEPV 0.4f +#define VADV 0.3f +#define VLOSS 0.999f +#define PLOSS 0.9999f + +#define GRID_X 5 +#define GRID_Y 4 +#define GRID_P 3 +#define GRID_S 6 +#define GRID_Z 3 + +#define STAMP_X 4 +#define STAMP_Y 4 +#define STAMP_MAX 120 + +#ifdef PIX16 +typedef unsigned short pixel; +#else +typedef unsigned int pixel; +#endif + +typedef unsigned char uint8; + +extern int amd; + +extern int FPSB; + +extern int legacy_enable; + +extern int sys_pause; +extern int framerender; + +extern int mousex, mousey; +extern int death; + +struct sign +{ + int x,y,ju; + char text[256]; +}; +typedef struct sign sign; + +struct stamp +{ + char name[11]; + pixel *thumb; + int thumb_w, thumb_h, dodelete; +}; +typedef struct stamp stamp; + +extern sign signs[MAXSIGNS]; +extern stamp stamps[STAMP_MAX]; +extern int stamp_count; +extern int itc; +extern char itc_msg[64]; + +extern int do_open; +extern int sys_pause; +extern int legacy_enable; //Used to disable new features such as heat, will be set by commandline or save. +extern int death, framerender; + +extern unsigned char last_major, last_minor, update_flag; + +extern char http_proxy_string[256]; + +//Functions in main.c +void thumb_cache_inval(char *id); +void thumb_cache_add(char *id, void *thumb, int size); +int thumb_cache_find(char *id, void **thumb, int *size); +void *build_thumb(int *size, int bzip2); +void *build_save(int *size, int x0, int y0, int w, int h); +int parse_save(void *save, int size, int replace, int x0, int y0); +void del_stamp(int d); +void sdl_seticon(void); +#endif \ No newline at end of file diff --git a/includes/font.h b/includes/font.h new file mode 100644 index 0000000..f8f9a58 --- /dev/null +++ b/includes/font.h @@ -0,0 +1,32 @@ +/** + * Powder Toy - Font Data + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +#ifndef FONT_H_CHECK +#define FONT_H_CHECK +#define FONT_H 10 +static char font_data[] = +{ + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc7, 0x31, 0x0c, 0x02, 0x70, 0x04, 0x00, 0x00, 0x05, 0xcc, 0x74, 0x23, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x19, 0xcc, 0xe0, 0x3f, 0xcc, 0xf0, 0x2f, 0xcc, 0x90, 0x09, 0x00, 0x00, 0x00, 0x06, 0x30, 0xd0, 0x3f, 0x33, 0xe1, 0x07, 0xf4, 0x12, 0x33, 0xff, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x2d, 0xce, 0xcc, 0xe1, 0x1d, 0xc0, 0x03, 0x74, 0x4b, 0x33, 0xb3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7d, 0x30, 0x0c, 0x13, 0xd0, 0x32, 0xb3, 0x33, 0x1c, 0x7d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x4c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x34, 0x1d, 0x07, 0x03, 0x07, 0x1d, 0x34, 0x00, 0x00, 0x00, 0x04, 0x07, 0x1d, 0x34, 0x30, 0x34, 0x1d, 0x07, 0x00, 0x00, 0x00, 0x06, 0x44, 0xd0, 0x1c, 0x64, 0xf0, 0x3f, 0x64, 0xd0, 0x1c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x02, 0x30, 0xe0, 0x2f, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x06, 0x80, 0x02, 0x0c, 0xa0, 0x00, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, 0xe0, 0x39, 0x07, 0x33, 0x32, 0x03, 0xb3, 0x38, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x30, 0xf0, 0x60, 0x03, 0x0c, 0x30, 0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x41, 0x03, 0x0a, 0x2c, 0x70, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0x71, 0x34, 0x01, 0x03, 0x1e, 0x00, 0x33, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xc0, 0x03, 0x37, 0x1c, 0x73, 0x34, 0xbf, 0x03, 0x30, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x00, 0x57, 0xe0, 0x2f, 0x00, 0x13, 0x30, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd3, 0x00, 0x07, 0xf0, 0x1f, 0x03, 0x33, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x07, 0x34, 0x80, 0x03, 0x0e, 0x38, 0xd0, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xd3, 0x1f, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xc3, 0x3f, 0x40, 0x23, 0x30, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x70, 0x04, 0x40, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc0, 0xc3, 0x0b, 0x1b, 0xc0, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x0f, 0x90, 0x83, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfd, 0x71, 0x30, 0x81, 0x03, 0x0e, 0x34, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0x0f, 0x1d, 0x30, 0xe7, 0x37, 0x73, 0x1c, 0xe3, 0x2f, 0x07, 0x00, 0xfd, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x74, 0xd0, 0x1d, 0x47, 0x33, 0x30, 0xff, 0x33, 0x30, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xbf, 0x30, 0x38, 0x43, 0xf3, 0x1f, 0x43, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x31, 0x00, 0x03, 0x70, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x33, 0x30, 0x03, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x32, 0x00, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x10, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x10, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x30, 0x3e, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x47, 0x33, 0x30, 0x03, 0xf3, 0x3f, 0x03, 0x33, 0x30, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x06, 0xd0, 0x01, 0x0c, 0xc0, 0x00, 0x0c, 0xc0, 0x10, 0x0d, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0xc3, 0x34, 0x70, 0x03, 0xbc, 0x00, 0xb3, 0xc0, 0xb0, 0x70, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x30, 0x10, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x1f, 0x3d, 0x7b, 0x3b, 0xe3, 0x32, 0x83, 0x30, 0x03, 0x30, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0xcd, 0x03, 0x73, 0xc3, 0x8c, 0x32, 0xc3, 0xcd, 0xc0, 0x33, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xc7, 0x71, 0xd0, 0x0c, 0x30, 0x03, 0xcd, 0xd1, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x73, 0x34, 0xff, 0x31, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xd3, 0x71, 0xd0, 0x0c, 0x30, 0xc3, 0xcd, 0xd1, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x31, 0x34, 0x03, 0xf3, 0x0f, 0xd7, 0x30, 0x34, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x31, 0x07, 0xd0, 0x0f, 0x90, 0x23, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x13, 0x13, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xcc, 0x00, 0x33, 0xc0, 0x0c, 0x30, 0x03, 0xcd, 0xd2, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x33, 0x30, 0x03, 0xb3, 0x38, 0xcd, 0xc1, 0x0d, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x43, 0x30, 0xc7, 0x34, 0xcd, 0x1c, 0xed, 0x1e, 0x2c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0x4c, 0xc3, 0x81, 0x3b, 0xd0, 0x03, 0xdc, 0x42, 0xc3, 0x31, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0xb3, 0x38, 0xdc, 0x40, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xd0, 0x02, 0x2c, 0xc0, 0x02, 0x2d, 0xc0, 0x06, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x2f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x30, 0x80, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x37, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x47, 0x30, 0xfc, 0x0c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x07, 0x0c, 0xf0, 0xc7, 0x35, 0xc3, 0x0c, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc3, 0x25, 0x03, 0x4c, 0xd2, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd0, 0x00, 0x83, 0x8f, 0x33, 0xc3, 0x1c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xbf, 0x0c, 0xd0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3d, 0x07, 0x03, 0x2f, 0x03, 0x03, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xcb, 0x32, 0xc3, 0xf4, 0x03, 0x4c, 0x30, 0x7e, 0x00, 0x00, 0x05, 0x03, 0x0c, 0xf0, 0xc7, 0x39, 0xc3, 0x0c, 0x73, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x1c, 0x00, 0x0d, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x30, 0x00, 0x34, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x05, 0x03, 0x0c, 0x31, 0xce, 0x0e, 0x1f, 0xcc, 0x31, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x47, 0x3d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x9b, 0x71, 0x37, 0x33, 0x33, 0x32, 0x43, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x0c, 0x33, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x31, 0xc3, 0x4c, 0xd3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x4c, 0xf3, 0xc7, 0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xdf, 0x31, 0xc3, 0x4c, 0xd3, 0x0f, 0x30, 0xc0, 0x00, 0x05, 0x03, 0x00, 0x30, 0x7f, 0xc7, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xc7, 0x10, 0x3c, 0x04, 0xf3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x1c, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x70, 0xdc, 0x30, 0xc3, 0x4c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xd3, 0xdc, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x33, 0x32, 0x33, 0x73, 0x37, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcd, 0x32, 0x7d, 0x8c, 0x73, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xc7, 0x74, 0x43, 0x07, 0x0c, 0x1f, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x4f, 0x2c, 0x2c, 0x2c, 0xf1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x04, 0x38, 0x0c, 0x0c, 0x03, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x02, 0x32, 0x33, 0x33, 0x13, 0x00, 0x04, 0x0b, 0x0c, 0x0c, 0x30, 0x0c, 0x0c, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x72, 0x37, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, 0x07, 0xff, 0x1f, 0xff, 0x7f, 0xff, 0x1b, 0xbf, 0x01, 0x1b, 0x00, 0x0c, 0x00, 0x40, 0xff, 0x00, 0x00, 0xf8, 0xf0, 0x3f, 0xee, 0x2c, 0x30, 0xcb, 0x0b, 0x30, 0x42, 0xc3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xf3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xff, 0x3f, 0x00, 0x0c, 0xc2, 0x00, 0x00, 0xcb, 0x00, 0x00, 0xee, 0xc0, 0xff, 0xf8, 0xb0, 0xc0, 0xff, 0x2c, 0xc0, 0x00, 0x0c, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xcc, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0x0d, 0x00, 0x70, 0x00, 0x00, 0xf3, 0xff, 0xd3, 0x03, 0xe0, 0x3c, 0x3f, 0x38, 0x03, 0xd0, 0x33, 0xff, 0x38, 0x03, 0xe0, 0xf0, 0xff, 0x03, 0x0c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x8b, 0xf7, 0x0c, 0x13, 0x9f, 0x3b, 0x37, 0x00, 0xc0, 0x23, 0xff, 0xff, 0x8b, 0x03, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0x03, 0x2c, 0x0d, 0x00, 0x37, 0x00, 0xc0, 0xf3, 0xff, 0x3c, 0xff, 0xcf, 0x03, 0x00, 0xdc, 0x00, 0x70, 0x38, 0xc0, 0x02, 0xfd, 0x07, 0x0a, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xf0, 0xff, 0xc0, 0xff, 0x3f, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0xfc, 0xff, 0x03, 0xff, 0x0f, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0x03, 0x00, 0x3c, 0xf0, 0xc0, 0xc3, 0x3a, 0x3c, 0x0b, 0xce, 0x2b, 0x80, 0x7e, 0x00, 0xd0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x0a, 0x00, 0x00, 0xc0, 0xff, 0x3f, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0x03, 0x2c, 0x0d, 0x0f, 0x37, 0xf0, 0xc0, 0xf3, 0xff, 0x3c, 0xff, 0xcf, 0x03, 0x0f, 0xdc, 0xf0, 0x70, 0x38, 0xc0, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x1f, 0x00, 0xad, 0x07, 0xb0, 0xc5, 0x00, 0x17, 0x0c, 0x70, 0xd0, 0x00, 0x0c, 0x03, 0xbc, 0xef, 0xb3, 0x11, 0xe0, 0x07, 0x05, 0x3c, 0x52, 0xc8, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xc0, 0x3f, 0x00, 0xfc, 0x03, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0xc0, 0x30, 0xc0, 0xff, 0x3f, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0xff, 0x0f, 0xfc, 0xff, 0x3f, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb8, 0xe0, 0x2f, 0xff, 0xe3, 0x2f, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0xff, 0x2f, 0xfd, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0xf8, 0xff, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x01, 0x00, 0x02, 0x00, 0xc8, 0x07, 0x10, 0xc3, 0x00, 0x31, 0x0d, 0x00, 0xfd, 0x01, 0x00, 0x74, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x0a, 0x40, 0x05, 0x80, 0xff, 0x8b, 0x1e, 0xd0, 0x2e, 0x00, 0xf0, 0x00, 0xe0, 0xff, 0x0b, 0x00, 0x0f, 0x00, 0xb8, 0x03, 0xb0, 0xe2, 0xff, 0x02, 0x50, 0x01, 0x08, 0xff, 0x07, 0x03, 0x1e, 0x03, 0x73, 0x03, 0xef, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x2f, 0xe0, 0x1b, 0x0c, 0x1d, 0x00, 0xff, 0x03, 0xbe, 0xf0, 0xc1, 0x01, 0xad, 0x34, 0xc0, 0x36, 0x0b, 0x30, 0xdc, 0xe4, 0x07, 0xfd, 0x1b, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0xa0, 0xaa, 0x00, 0xa8, 0xc2, 0x0f, 0x2a, 0xff, 0x03, 0xca, 0x3f, 0x80, 0xfc, 0x0f, 0x20, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x07, 0xaa, 0xea, 0x1f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xaa, 0xea, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x03, 0x00, 0xd0, 0x03, 0x00, 0xf4, 0xab, 0xaa, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xf4, 0xab, 0xaa, 0xd0, 0x03, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x09, 0xfe, 0xff, 0xe3, 0xff, 0x0f, 0xaa, 0x3e, 0x0a, 0xf8, 0x2e, 0xe0, 0xbf, 0x80, 0xff, 0xaa, 0xfe, 0xff, 0xe2, 0xff, 0x02, 0x02, 0x00, 0x00, 0x09, 0x00, 0x80, 0x04, 0xd0, 0xe2, 0xff, 0x02, 0x00, 0x00, 0xff, 0x6f, 0x00, 0x40, 0xe6, 0xaf, 0x50, 0x00, 0x09, 0x00, 0x20, 0x00, 0x64, 0x00, 0x09, 0xe0, 0x3f, 0x70, 0x60, 0x63, 0xc0, 0xe4, 0x80, 0xc2, 0x03, 0x07, 0x0f, 0x1e, 0x6c, 0xff, 0x27, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x09, 0x44, 0x44, 0x00, 0x12, 0x41, 0x88, 0x04, 0x21, 0x21, 0x84, 0x48, 0x20, 0x23, 0xc2, 0xcc, 0x08, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x1d, 0x00, 0x78, 0x00, 0xb4, 0x07, 0xf0, 0x2f, 0xc0, 0xfb, 0x00, 0xbe, 0x02, 0xf4, 0x07, 0xfd, 0xff, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0x00, 0x19, 0x00, 0xa8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf0, 0xdc, 0xcb, 0x03, 0x00, 0xff, 0xff, 0x4f, 0x07, 0x40, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0xff, 0x3f, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0x07, 0x00, 0xbd, 0x02, 0xe8, 0xb3, 0xe0, 0x3c, 0xac, 0xc3, 0x03, 0x0f, 0x3c, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x0b, 0xc0, 0xc8, 0xc0, 0x91, 0x1b, 0xcd, 0x36, 0xe7, 0x00, 0x47, 0x03, 0xa7, 0x80, 0x36, 0xfd, 0xff, 0xc1, 0x9b, 0xf9, 0xb8, 0xb8, 0xb8, 0xb7, 0x99, 0xf7, 0xff, 0xff, 0x0f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x03, 0x00, 0xfc, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0xff, 0x3f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0xcf, 0xff, 0xff, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1f, 0xcb, 0x30, 0xc3, 0x3f, 0xc7, 0x00, 0x7e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0xc3, 0xfc, 0x33, 0x0c, 0x24, 0xc3, 0xc0, 0x31, 0x0c, 0x06, 0xc3, 0x30, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0xff, 0x3f, 0x30, 0x00, 0x03, 0xc3, 0x30, 0x30, 0x3f, 0xff, 0xff, 0x3f, 0x3c, 0x00, 0xff, 0xff, 0xff, 0x0c, 0x0c, 0xc3, 0xc0, 0x00, 0x0c, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x3c, 0x00, 0xc0, 0x03, 0xf0, 0x3f, 0x00, 0xff, 0x03, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xb8, 0xec, 0x9b, 0xf9, 0xbf, 0xf8, 0xbf, 0x99, 0xef, 0xb8, 0x2c, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x87, 0x87, 0xc3, 0x30, 0x0c, 0xe3, 0xde, 0x01, 0x03, 0x74, 0xbb, 0x0c, 0xc3, 0x30, 0x2c, 0x2d, 0x0d, 0x05, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x34, 0xc3, 0x0c, 0x73, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x39, 0xc0, 0x00, 0x43, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0x60, 0x60, 0x60, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0xb8, 0x00, 0x23, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x36, 0xc6, 0xfc, 0x03, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xcb, 0x00, 0x7f, 0x40, 0x13, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xcb, 0x10, 0x2f, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x0f, 0x30, 0x60, 0x60, 0xc0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0x7d, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xc6, 0xe0, 0x03, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x03, 0xc0, 0xf0, 0x3c, 0xcf, 0xf3, 0x3c, 0x03, 0x00, 0x03, 0x00, 0xcc, 0xf3, 0x3c, 0xcf, 0xf3, 0x30, 0x00, 0x05, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x30, 0xc0, 0x0f, 0x30, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0xd0, 0x7f, 0x40, 0xff, 0x1f, 0xfc, 0xff, 0x43, 0xff, 0x1f, 0x40, 0x15, 0x00, 0x00, 0x00, 0x0a, 0xe4, 0x06, 0x90, 0x91, 0x01, 0x06, 0x24, 0x30, 0x90, 0x1b, 0x46, 0x6e, 0x96, 0xb9, 0x91, 0xe4, 0x06, 0x0c, 0x18, 0x90, 0x40, 0x46, 0x06, 0x90, 0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x02, 0xc2, 0xab, 0xaa, 0x3e, 0x20, 0xe0, 0xab, 0xaa, 0x3e, 0x02, 0xc2, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x02, 0xc0, 0x30, 0x00, 0x0c, 0x03, 0xf0, 0xff, 0x00, 0xfe, 0x0b, 0xd0, 0x7f, 0x00, 0xa4, 0x01, 0x00, 0x0a, 0x00, 0xa0, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x81, 0x24, 0x10, 0x85, 0x00, 0x20, 0x66, 0x40, 0x15, 0x45, 0x62, 0x90, 0x4d, 0xd0, 0xf1, 0x23, 0x01, 0xfd, 0x41, 0x41, 0x07, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x00, 0xf8, 0x02, 0xd0, 0x7f, 0x00, 0xfe, 0x0b, 0xf0, 0xff, 0x00, 0xff, 0x0f, 0xd0, 0x7f, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0xd4, 0x01, 0xd0, 0x06, 0x40, 0x7f, 0x00, 0xfd, 0x01, 0xf4, 0x07, 0xd0, 0x1f, 0x00, 0x7f, 0x00, 0xd0, 0x01, 0x00, 0x0a, 0x40, 0x15, 0x00, 0xfe, 0x0b, 0x88, 0x2f, 0x52, 0xf0, 0x50, 0x01, 0x0a, 0xd4, 0xaf, 0x7f, 0xfd, 0xf5, 0xc7, 0x0b, 0x3e, 0x70, 0xd0, 0x00, 0xa4, 0x01, 0x0a, 0x80, 0x2f, 0x80, 0x5f, 0x2f, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x01, 0x34, 0x34, 0xc0, 0x01, 0x07, 0x0d, 0xd0, 0x75, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xf4, 0x01, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xe0, 0xef, 0x00, 0xbb, 0x0b, 0xa0, 0xaa, 0x00, 0xaa, 0x0a, 0x80, 0x19, 0x00, 0x64, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x2d, 0x80, 0xe7, 0x0b, 0xbe, 0xf8, 0xfa, 0x02, 0xfe, 0x0b, 0x80, 0x2f, 0x00, 0x50, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xaf, 0x2f, 0xbe, 0xe0, 0xdb, 0x02, 0x78, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x50, 0xfe, 0x5b, 0xfd, 0xff, 0x47, 0xff, 0x1f, 0xe0, 0xbf, 0x00, 0xfe, 0x0b, 0xf0, 0xf5, 0x40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0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, +}; +static short font_ptrs[] = +{ + 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2, 0x01c0, 0x01ce, 0x01d7, 0x01e5, 0x01f5, 0x0205, 0x0218, 0x0228, 0x0231, 0x023c, 0x0247, 0x0257, 0x0267, 0x0272, 0x0280, 0x0289, 0x0299, 0x02a9, 0x02b7, 0x02c7, 0x02d7, 0x02e7, 0x02f7, 0x0307, 0x0317, 0x0327, 0x0337, 0x0340, 0x034b, 0x035b, 0x036b, 0x037b, 0x038b, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x042b, 0x043b, 0x044e, 0x045e, 0x0473, 0x0486, 0x0499, 0x04a9, 0x04bc, 0x04cc, 0x04dc, 0x04ec, 0x04ff, 0x050f, 0x0524, 0x0537, 0x0547, 0x055a, 0x0565, 0x0573, 0x057e, 0x0589, 0x0599, 0x05a2, 0x05b0, 0x05be, 0x05cc, 0x05da, 0x05e8, 0x05f3, 0x0601, 0x060f, 0x061a, 0x0625, 0x0633, 0x063e, 0x064e, 0x065c, 0x066a, 0x0678, 0x0686, 0x068f, 0x069d, 0x06a8, 0x06b6, 0x06c4, 0x06d4, 0x06e2, 0x06f0, 0x06fe, 0x0709, 0x070f, 0x071a, 0x072a, 0x0735, 0x074a, 0x0769, 0x0788, 0x07a2, 0x07c1, 0x07db, 0x07f5, 0x080f, 0x0829, 0x0843, 0x085d, 0x0877, 0x0896, 0x08a6, 0x08c0, 0x08da, 0x08f4, 0x090e, 0x0923, 0x0940, 0x095d, 0x097c, 0x099b, 0x09b3, 0x09cb, 0x09e3, 0x09fb, 0x0a13, 0x0a2b, 0x0a43, 0x0a5b, 0x0a73, 0x0a8b, 0x0aa3, 0x0abd, 0x0ada, 0x0af7, 0x0b0c, 0x0b26, 0x0b40, 0x0b5a, 0x0b74, 0x0b8c, 0x0b97, 0x0ba0, 0x0ba9, 0x0bb7, 0x0bc5, 0x0bd3, 0x0be1, 0x0bef, 0x0bfd, 0x0c0b, 0x0c19, 0x0c27, 0x0c35, 0x0c43, 0x0c4e, 0x0c57, 0x0c60, 0x0c6e, 0x0c7e, 0x0c8e, 0x0ca8, 0x0cc2, 0x0cdc, 0x0cf6, 0x0d10, 0x0d2a, 0x0d44, 0x0d5e, 0x0d78, 0x0d92, 0x0dac, 0x0dc6, 0x0de0, 0x0dfa, 0x0e14, 0x0e2e, 0x0e46, 0x0e60, 0x0e7a, 0x0e8a, 0x0e9a, 0x0eaa, 0x0eba, 0x0eca, 0x0eda, 0x0eea, 0x0efa, 0x0f0a, 0x0f1a, 0x0f2a, 0x0f3a, 0x0f4a, 0x0f5a, 0x0f6a, 0x0f7a, 0x0f8a, 0x0f9a, 0x0faa, 0x0fba, 0x0fca, 0x0fda, 0x0fea, 0x0ffa, 0x100a, 0x101a, 0x102a, 0x103a, 0x104a, 0x105a, 0x106a, 0x107a, 0x108a, 0x109a, 0x10aa, 0x10ba, 0x10ca, 0x10da, 0x10ea, 0x10fa, 0x110a, 0x111a, 0x112a, 0x113a, 0x114a, +}; +#endif \ No newline at end of file diff --git a/includes/graphics.h b/includes/graphics.h new file mode 100644 index 0000000..6a1507e --- /dev/null +++ b/includes/graphics.h @@ -0,0 +1,144 @@ +#ifndef GRAPHICS_H +#define GRAPHICS_H +#include +#include "defines.h" +#include "hmap.h" + +#ifdef PIX16 +#define PIXELSIZE 2 +#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) +#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) +#define PIXR(x) (((x)>>8)&0xF8) +#define PIXG(x) (((x)>>3)&0xFC) +#define PIXB(x) (((x)<<3)&0xF8) +#else +#define PIXELSIZE 4 +#ifdef PIX32BGR +#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) +#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) +#define PIXR(x) ((x)&0xFF) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)>>16) +#else +#ifdef PIX32BGRA +#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) +#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) +#define PIXR(x) (((x)>>8)&0xFF) +#define PIXG(x) (((x)>>16)&0xFF) +#define PIXB(x) (((x)>>24)) +#else +#define PIXPACK(x) (x) +#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) +#define PIXR(x) ((x)>>16) +#define PIXG(x) (((x)>>8)&0xFF) +#define PIXB(x) ((x)&0xFF) +#endif +#endif +#endif + +extern unsigned cmode; +extern SDL_Surface *sdl_scrn; +extern int sdl_scale; + +extern unsigned char fire_r[YRES/CELL][XRES/CELL]; +extern unsigned char fire_g[YRES/CELL][XRES/CELL]; +extern unsigned char fire_b[YRES/CELL][XRES/CELL]; + +extern unsigned int fire_alpha[CELL*3][CELL*3]; +extern pixel *fire_bg; + +pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f); + +void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch); + +void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch); + +void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch); + +void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb); + +void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall); + +int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc); + +void draw_menu(pixel *vid_buf, int i, int hover); + +#ifdef WIN32 +_inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +#else +extern inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +#endif + +#ifdef WIN32 +_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); +#else +extern inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); +#endif + +int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a); + +void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); + +void fillrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); + +void clearrect(pixel *vid, int x, int y, int w, int h); + +void drawdots(pixel *vid, int x, int y, int h, int r, int g, int b, int a); + +int textwidth(char *s); + +int drawtextmax(pixel *vid, int x, int y, int w, char *s, int r, int g, int b, int a); + +int textnwidth(char *s, int n); + +int textwidthx(char *s, int w); + +#ifdef WIN32 +_inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +#else +inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +#endif + +void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag); + +void draw_air(pixel *vid); + +void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a); + +void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a); + +void xor_pixel(int x, int y, pixel *vid); + +void xor_line(int x1, int y1, int x2, int y2, pixel *vid); + +void xor_rect(pixel *vid, int x, int y, int w, int h); + +void draw_parts(pixel *vid); + +void render_signs(pixel *vid_buf); + +void render_fire(pixel *dst); + +void prepare_alpha(void); + +void draw_image(pixel *vid, pixel *img, int x, int y, int w, int h, int a); + +void dim_copy(pixel *dst, pixel *src); + +void render_zoom(pixel *img); + +pixel *prerender_save(void *save, int size, int *width, int *height); + +int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl); + +void render_cursor(pixel *vid, int x, int y, int t, int r); + +void sdl_open(void); + +#ifdef OpenGL +void Enable2D (); +void RenderScene (); +void ClearScreen(); +#endif + +#endif diff --git a/includes/hmap.h b/includes/hmap.h new file mode 100755 index 0000000..1af8013 --- /dev/null +++ b/includes/hmap.h @@ -0,0 +1,33 @@ +/** + * Powder Toy - Heatmap Data + * + * Copyright (c) 2010 Simon Robertshaw + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +#ifndef HMAP_H +#define HMAP_H +//Original Heat Scale +//static char color_data[] = {0xD9,0xFF,0xFE,0xD4,0xFB,0xFC,0xCF,0xF6,0xF9,0xC9,0xF1,0xF6,0xC2,0xEB,0xF4,0xBB,0xE5,0xF0,0xB3,0xDE,0xED,0xAA,0xD6,0xE9,0xA1,0xCF,0xE5,0x98,0xC7,0xE2,0x8E,0xBF,0xDD,0x85,0xB6,0xD9,0x7B,0xAD,0xD5,0x71,0xA5,0xD0,0x67,0x9C,0xCC,0x5D,0x93,0xC7,0x53,0x8A,0xC3,0x4A,0x82,0xBE,0x41,0x79,0xB9,0x38,0x71,0xB5,0x30,0x69,0xB0,0x28,0x61,0xAC,0x21,0x5A,0xA8,0x1B,0x53,0xA3,0x16,0x4D,0x9F,0x12,0x47,0x9B,0x0F,0x42,0x98,0x0F,0x3D,0x94,0x0F,0x39,0x90,0x0F,0x34,0x8C,0x0F,0x30,0x89,0x0F,0x2C,0x85,0x0F,0x28,0x81,0x0F,0x24,0x7D,0x0F,0x20,0x7A,0x0F,0x1D,0x76,0x0F,0x1A,0x72,0x0F,0x16,0x6F,0x0F,0x13,0x6B,0x0F,0x11,0x67,0x10,0x0E,0x64,0x12,0x0C,0x60,0x15,0x0A,0x5D,0x18,0x08,0x59,0x1B,0x06,0x56,0x1D,0x04,0x53,0x20,0x03,0x4F,0x23,0x02,0x4C,0x26,0x01,0x49,0x29,0x01,0x46,0x2C,0x00,0x43,0x2F,0x00,0x40,0x30,0x00,0x3F,0x31,0x00,0x3F,0x31,0x00,0x3E,0x32,0x00,0x3E,0x32,0x00,0x3D,0x33,0x00,0x3D,0x33,0x00,0x3C,0x34,0x00,0x3C,0x34,0x00,0x3B,0x35,0x01,0x3B,0x36,0x01,0x3B,0x36,0x01,0x3A,0x37,0x01,0x3A,0x37,0x01,0x39,0x38,0x01,0x39,0x39,0x01,0x38,0x39,0x02,0x38,0x3A,0x02,0x37,0x3B,0x02,0x37,0x3B,0x02,0x36,0x3C,0x02,0x36,0x3C,0x03,0x35,0x3D,0x03,0x35,0x3E,0x03,0x34,0x3F,0x03,0x34,0x3F,0x04,0x34,0x40,0x04,0x33,0x41,0x04,0x33,0x41,0x04,0x32,0x42,0x05,0x32,0x43,0x05,0x31,0x43,0x05,0x31,0x44,0x06,0x30,0x45,0x06,0x30,0x46,0x06,0x30,0x46,0x07,0x2F,0x47,0x07,0x2F,0x48,0x08,0x2E,0x49,0x08,0x2E,0x49,0x08,0x2E,0x4A,0x09,0x2D,0x4B,0x09,0x2D,0x4C,0x09,0x2C,0x4C,0x0A,0x2C,0x4D,0x0A,0x2B,0x4E,0x0B,0x2B,0x4F,0x0B,0x2B,0x4F,0x0C,0x2A,0x50,0x0C,0x2A,0x51,0x0D,0x29,0x52,0x0D,0x29,0x53,0x0D,0x29,0x53,0x0E,0x28,0x54,0x0E,0x28,0x55,0x0F,0x27,0x56,0x0F,0x27,0x57,0x10,0x27,0x58,0x10,0x26,0x58,0x11,0x26,0x59,0x11,0x26,0x5A,0x12,0x25,0x5B,0x13,0x25,0x5C,0x13,0x24,0x5D,0x14,0x24,0x5D,0x14,0x24,0x5E,0x15,0x23,0x5F,0x15,0x23,0x60,0x16,0x23,0x61,0x16,0x22,0x62,0x17,0x22,0x62,0x18,0x22,0x63,0x18,0x21,0x64,0x19,0x21,0x65,0x19,0x21,0x66,0x1A,0x20,0x67,0x1B,0x20,0x67,0x1B,0x20,0x68,0x1C,0x1F,0x69,0x1C,0x1F,0x6A,0x1D,0x1F,0x6B,0x1E,0x1E,0x6C,0x1E,0x1E,0x6D,0x1F,0x1E,0x6D,0x1F,0x1D,0x6E,0x20,0x1D,0x6F,0x21,0x1D,0x70,0x21,0x1C,0x71,0x22,0x1C,0x72,0x23,0x1C,0x73,0x23,0x1B,0x73,0x24,0x1B,0x74,0x25,0x1B,0x75,0x25,0x1A,0x76,0x26,0x1A,0x77,0x27,0x1A,0x78,0x27,0x1A,0x78,0x28,0x19,0x79,0x29,0x19,0x7A,0x29,0x19,0x7B,0x2A,0x18,0x7C,0x2B,0x18,0x7D,0x2B,0x18,0x7E,0x2C,0x18,0x7E,0x2D,0x17,0x7F,0x2D,0x17,0x80,0x2E,0x17,0x81,0x2F,0x16,0x82,0x2F,0x16,0x82,0x30,0x16,0x83,0x31,0x16,0x84,0x31,0x15,0x85,0x32,0x15,0x86,0x33,0x15,0x87,0x33,0x15,0x87,0x34,0x14,0x88,0x35,0x14,0x89,0x36,0x14,0x8A,0x36,0x14,0x8A,0x37,0x13,0x8B,0x38,0x13,0x8C,0x38,0x13,0x8D,0x39,0x13,0x8E,0x3A,0x13,0x8E,0x3A,0x12,0x8F,0x3B,0x12,0x90,0x3C,0x12,0x91,0x3C,0x12,0x91,0x3D,0x11,0x92,0x3E,0x11,0x93,0x3E,0x11,0x94,0x3F,0x11,0x94,0x40,0x11,0x95,0x40,0x10,0x96,0x41,0x10,0x97,0x42,0x10,0x97,0x42,0x10,0x98,0x43,0x10,0x99,0x44,0x0F,0x99,0x44,0x0F,0x9A,0x45,0x0F,0x9A,0x45,0x0F,0x9B,0x46,0x0F,0x9C,0x47,0x0F,0x9C,0x47,0x0E,0x9D,0x48,0x0E,0x9D,0x48,0x0E,0x9E,0x49,0x0E,0x9E,0x49,0x0E,0x9F,0x4A,0x0D,0xA0,0x4B,0x0D,0xA0,0x4B,0x0D,0xA1,0x4C,0x0D,0xA1,0x4C,0x0D,0xA2,0x4D,0x0C,0xA2,0x4E,0x0C,0xA3,0x4E,0x0C,0xA4,0x4F,0x0C,0xA4,0x4F,0x0C,0xA5,0x50,0x0C,0xA5,0x51,0x0C,0xA6,0x51,0x0C,0xA7,0x52,0x0C,0xA7,0x53,0x0C,0xA8,0x53,0x0C,0xA8,0x54,0x0C,0xA9,0x55,0x0C,0xAA,0x55,0x0C,0xAA,0x56,0x0C,0xAB,0x57,0x0C,0xAB,0x57,0x0C,0xAC,0x58,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,0xF7,0xFF,0xFD,0xF8,0xFF,0xFD,0xF9,0xFF,0xFE,0xFA,0xFF,0xFE,0xFB,0xFF,0xFE,0xFC,0xFF,0xFE,0xFC,0xFF,0xFF,0xFD,0xFF,0xFF,0xFE}; +//Modified Hue Scale +//static char color_data[] = {0x00,0x00,0x00,0x02,0x00,0x02,0x04,0x00,0x04,0x06,0x00,0x06,0x09,0x00,0x08,0x0B,0x00,0x0B,0x0E,0x00,0x0D,0x11,0x00,0x10,0x14,0x00,0x13,0x17,0x00,0x16,0x1B,0x00,0x19,0x1E,0x00,0x1C,0x22,0x00,0x1F,0x26,0x00,0x22,0x29,0x00,0x26,0x2D,0x00,0x29,0x32,0x00,0x2D,0x36,0x00,0x30,0x3A,0x00,0x34,0x3E,0x00,0x38,0x43,0x00,0x3C,0x47,0x00,0x40,0x4C,0x00,0x44,0x51,0x00,0x48,0x55,0x00,0x4C,0x5A,0x00,0x50,0x5F,0x00,0x54,0x64,0x00,0x59,0x69,0x00,0x5D,0x6E,0x00,0x61,0x73,0x00,0x66,0x77,0x00,0x6A,0x7C,0x00,0x6E,0x81,0x00,0x73,0x86,0x00,0x77,0x8B,0x00,0x7C,0x90,0x00,0x80,0x95,0x00,0x85,0x9A,0x00,0x89,0x9F,0x00,0x8D,0xA3,0x00,0x92,0xA8,0x00,0x96,0xAD,0x00,0x9B,0xB1,0x00,0x9F,0xB6,0x00,0xA3,0xBA,0x00,0xA8,0xBF,0x00,0xAC,0xC3,0x00,0xB0,0xC7,0x00,0xB4,0xCB,0x00,0xB8,0xCF,0x00,0xBD,0xD3,0x00,0xC1,0xD7,0x00,0xC4,0xDB,0x00,0xC8,0xDE,0x00,0xCC,0xE1,0x00,0xD0,0xE5,0x00,0xD4,0xE8,0x00,0xD7,0xEA,0x00,0xDB,0xED,0x00,0xDE,0xF0,0x00,0xE1,0xF2,0x00,0xE4,0xF4,0x00,0xE8,0xF6,0x00,0xEB,0xF8,0x00,0xED,0xFA,0x00,0xF0,0xFB,0x00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0x00,0xFF,0x0E,0x00,0xFF,0x0C,0x00,0xFF,0x09,0x00,0xFF,0x07,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x01,0x00,0xFF,0x00,0x01,0xFF,0x00,0x03,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x09,0xFF,0x00,0x0C,0xFF,0x00,0x0F,0xFF,0x00,0x11,0xFF,0x00,0x14,0xFF,0x00,0x17,0xFF,0x00,0x1A,0xFF,0x00,0x1D,0xFF,0x00,0x20,0xFF,0x00,0x24,0xFF,0x00,0x27,0xFF,0x00,0x2B,0xFF,0x00,0x2E,0xFF,0x00,0x32,0xFF,0x00,0x36,0xFF,0x00,0x3A,0xFF,0x00,0x3E,0xFF,0x00,0x42,0xFF,0x00,0x46,0xFF,0x00,0x4A,0xFF,0x00,0x4E,0xFF,0x00,0x52,0xFF,0x00,0x56,0xFF,0x00,0x5B,0xFF,0x00,0x5F,0xFF,0x00,0x63,0xFF,0x00,0x68,0xFF,0x00,0x6C,0xFF,0x00,0x71,0xFF,0x00,0x75,0xFF,0x00,0x79,0xFF,0x00,0x7E,0xFF,0x00,0x82,0xFF,0x00,0x87,0xFF,0x00,0x8B,0xFF,0x00,0x90,0xFF,0x00,0x94,0xFF,0x00,0x98,0xFF,0x00,0x9D,0xFF,0x00,0xA1,0xFF,0x00,0xA6,0xFF,0x00,0xAA,0xFF,0x00,0xAE,0xFF,0x00,0xB2,0xFF,0x00,0xB6,0xFF,0x00,0xBA,0xFF,0x00,0xBF,0xFF,0x00,0xC2,0xFF,0x00,0xC6,0xFF,0x00,0xCA,0xFF,0x00,0xCE,0xFF,0x00,0xD2,0xFF,0x00,0xD5,0xFF,0x00,0xD9,0xFF,0x00,0xDC,0xFF,0x00,0xE0,0xFF,0x00,0xE3,0xFF,0x00,0xE6,0xFF,0x00,0xE9,0xFF,0x00,0xEC,0xFF,0x00,0xEF,0xFF,0x00,0xF1,0xFF,0x00,0xF4,0xFF,0x00,0xF6,0xFF,0x00,0xF9,0xFF,0x00,0xFB,0xFF,0x00,0xFD,0xFF,0x00,0xFF,0xFF,0x00,0xFF,0xFD,0x00,0xFF,0xFB,0x00,0xFF,0xF9,0x00,0xFF,0xF7,0x00,0xFF,0xF5,0x00,0xFF,0xF2,0x00,0xFF,0xEF,0x00,0xFF,0xED,0x00,0xFF,0xEA,0x00,0xFF,0xE7,0x00,0xFF,0xE4,0x00,0xFF,0xE1,0x00,0xFF,0xDD,0x00,0xFF,0xDA,0x00,0xFF,0xD6,0x00,0xFF,0xD3,0x00,0xFF,0xCF,0x00,0xFF,0xCB,0x00,0xFF,0xC8,0x00,0xFF,0xC4,0x00,0xFF,0xC0,0x00,0xFF,0xBC,0x00,0xFF,0xB8,0x00,0xFF,0xB4,0x00,0xFF,0xAF,0x00,0xFF,0xAB,0x00,0xFF,0xA7,0x00,0xFF,0xA3,0x00,0xFF,0x9E,0x00,0xFF,0x9A,0x00,0xFF,0x96,0x00,0xFF,0x91,0x00,0xFF,0x8D,0x00,0xFF,0x88,0x00,0xFF,0x84,0x00,0xFF,0x80,0x00,0xFF,0x7B,0x00,0xFF,0x77,0x00,0xFF,0x72,0x00,0xFF,0x6E,0x00,0xFF,0x69,0x00,0xFF,0x65,0x00,0xFF,0x61,0x00,0xFF,0x5C,0x00,0xFF,0x58,0x00,0xFF,0x54,0x00,0xFF,0x50,0x00,0xFF,0x4B,0x00,0xFF,0x47,0x00,0xFF,0x43,0x00,0xFF,0x3F,0x00,0xFF,0x3B,0x00,0xFF,0x37,0x00,0xFF,0x34,0x00,0xFF,0x30,0x00,0xFF,0x2C,0x00,0xFF,0x29,0x00,0xFF,0x25,0x00,0xFF,0x22,0x00,0xFF,0x1E,0x00,0xFF,0x1B,0x00,0xFF,0x18,0x00,0xFF,0x15,0x00,0xFF,0x12,0x00,0xFF,0x10,0x00,0xFF,0x0D,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x04,0x00,0xFF,0x02,0x00,0xFF,0x00,0x02,0xFD,0x00,0x04,0xFB,0x00,0x06,0xF9,0x00,0x09,0xF6,0x00,0x0B,0xF3,0x00,0x0E,0xF1,0x00,0x10,0xEE,0x00,0x13,0xEB,0x00,0x16,0xE7,0x00,0x19,0xE4,0x00,0x1C,0xE0,0x00,0x1F,0xDD,0x00,0x23,0xD9,0x00,0x26,0xD5,0x00,0x29,0xD1,0x00,0x2D,0xCD,0x00,0x31,0xC9,0x00,0x35,0xC4,0x00,0x38,0xC0,0x00,0x3C,0xBC,0x00,0x40,0xB7,0x00,0x44,0xB2,0x00,0x48,0xAE,0x00,0x4C,0xA9,0x00,0x51,0xA4,0x00,0x55,0x9F,0x00,0x59,0x9B,0x00,0x5D,0x96,0x00,0x62,0x91,0x00,0x66,0x8C,0x00,0x6A,0x87,0x00,0x6F,0x82,0x00,0x73,0x7D,0x00,0x78,0x78,0x00,0x7C,0x73,0x00,0x81,0x6E,0x00,0x85,0x69,0x00,0x8A,0x65,0x00,0x8E,0x60,0x00,0x92,0x5B,0x00,0x97,0x56,0x00,0x9B,0x52,0x00,0xA0,0x4D,0x00,0xA4,0x49,0x00,0xA8,0x44,0x00,0xAC,0x40,0x00,0xB1,0x3B,0x00,0xB5,0x37,0x00,0xB9,0x33,0x00,0xBD,0x2F,0x00,0xC1,0x2B,0x00,0xC5,0x28,0x00,0xC9,0x24,0x00,0xCD,0x21,0x00,0xD0,0x1D,0x00,0xD4,0x1A,0x00,0xD8,0x17,0x00,0xDB,0x14,0x00,0xDE,0x11,0x00,0xE2,0x0F,0x00,0xE5,0x0D,0x00,0xE8,0x0A,0x00,0xEB,0x08,0x00,0xEE,0x07,0x00,0xF0,0x05,0x00,0xF3,0x04,0x00,0xF6,0x02,0x00,0xF8,0x01,0x00,0xFA,0x01,0x00,0xFC,0x00,0x00,0xFE,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x02,0x00,0xFF,0x03,0x00,0xFF,0x04,0x00,0xFF,0x06,0x00,0xFF,0x07,0x00,0xFF,0x09,0x00,0xFF,0x0B,0x00,0xFF,0x0D,0x00,0xFF,0x0F,0x00,0xFF,0x12,0x00,0xFF,0x14,0x00,0xFF,0x17,0x00,0xFF,0x1A,0x00,0xFF,0x1C,0x00,0xFF,0x1F,0x00,0xFF,0x23,0x00,0xFF,0x26,0x00,0xFF,0x29,0x00,0xFF,0x2D,0x00,0xFF,0x31,0x00,0xFF,0x34,0x00,0xFF,0x38,0x00,0xFF,0x3C,0x00,0xFF,0x40,0x00,0xFF,0x44,0x00,0xFF,0x48,0x00,0xFF,0x4C,0x00,0xFF,0x51,0x00,0xFF,0x55,0x00,0xFF,0x59,0x00,0xFF,0x5E,0x00,0xFF,0x62,0x00,0xFF,0x67,0x00,0xFF,0x6B,0x00,0xFF,0x70,0x00,0xFF,0x74,0x00,0xFF,0x79,0x00,0xFF,0x7D,0x00,0xFF,0x82,0x00,0xFF,0x87,0x00,0xFF,0x8B,0x00,0xFF,0x90,0x00,0xFF,0x94,0x00,0xFF,0x99,0x00,0xFF,0x9D,0x00,0xFF,0xA2,0x00,0xFF,0xA6,0x00,0xFF,0xAB,0x00,0xFF,0xAF,0x00,0xFF,0xB4,0x00,0xFF,0xB8,0x00,0xFF,0xBC,0x00,0xFF,0xC0,0x00,0xFF,0xC4,0x00,0xFF,0xC8,0x00,0xFF,0xCC,0x00,0xFF,0xD0,0x00,0xFF,0xD4,0x00,0xFF,0xD8,0x00,0xFF,0xDB,0x00,0xFF,0xDF,0x00,0xFF,0xE2,0x00,0xFF,0xE5,0x00,0xFF,0xE9,0x00,0xFF,0xEC,0x00,0xFF,0xEE,0x00,0xFF,0xF1,0x00,0xFF,0xF4,0x00,0xFF,0xF6,0x00,0xFF,0xF8,0x00,0xFF,0xFB,0x00,0xFF,0xFD,0x00,0xFF,0xFE,0x00,0xFF,0xFF,0x01,0xFF,0xFF,0x03,0xFF,0xFF,0x05,0xFF,0xFF,0x07,0x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x00,0xFF,0x37,0x00,0xFF,0x35,0x00,0xFF,0x32,0x00,0xFF,0x2F,0x00,0xFF,0x2C,0x00,0xFF,0x2A,0x00,0xFF,0x27,0x00,0xFF,0x25,0x00,0xFF,0x22,0x00,0xFF,0x20,0x00,0xFF,0x1D,0x00,0xFF,0x1B,0x00,0xFF,0x18,0x00,0xFF,0x16,0x00,0xFF,0x14,0x00,0xFF,0x12,0x00,0xFF,0x10,0x00,0xFF,0x0E,0x00,0xFF,0x0C,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x00,0x00,0xFF,0x00,0x01,0xFF,0x00,0x02,0xFF,0x00,0x04,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x08,0xFF,0x00,0x0A,0xFF,0x00,0x0C,0xFF,0x00,0x0E,0xFF,0x00,0x10,0xFF,0x00,0x12,0xFF,0x00,0x14,0xFF,0x00,0x16,0xFF,0x00,0x19,0xFF,0x00,0x1B,0xFF,0x00,0x1D,0xFF,0x00,0x20,0xFF,0x00,0x22,0xFF,0x00,0x25,0xFF,0x00,0x28,0xFF,0x00,0x2A,0xFF,0x00,0x2D,0xFF,0x00,0x30,0xFF,0x00,0x32,0xFF,0x00,0x35,0xFF,0x00,0x38,0xFF,0x00,0x3B,0xFF,0x00,0x3D,0xFF,0x00,0x40,0xFF,0x00,0x43,0xFF,0x00,0x46,0xFF,0x00,0x49,0xFF,0x00,0x4C,0xFF,0x00,0x4F,0xFF,0x00,0x52,0xFF,0x00,0x55,0xFF,0x00,0x57,0xFF,0x00,0x5A,0xFF,0x00,0x5D,0xFF,0x00,0x60,0xFF,0x00,0x63,0xFF,0x00,0x66,0xFF,0x00,0x69,0xFF,0x00,0x6B,0xFF,0x00,0x6E,0xFF,0x00,0x71,0xFF,0x00,0x74,0xFF,0x00,0x76,0xFF,0x00,0x79,0xFF,0x00,0x7B,0xFF,0x00,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0x00,0xFF,0xD1,0x00,0xFF,0xCE,0x00,0xFF,0xCB,0x00,0xFF,0xC8,0x00,0xFF,0xC5,0x00,0xFF,0xC3,0x00,0xFF,0xC0,0x00,0xFF,0xBD,0x00,0xFF,0xBA,0x00,0xFF,0xB7,0x00,0xFF,0xB4,0x00,0xFF,0xB1,0x00,0xFF,0xAE,0x00,0xFF,0xAC,0x00,0xFF,0xA9,0x00,0xFF,0xA6,0x00,0xFF,0xA3,0x00,0xFF,0xA0,0x00,0xFF,0x9D,0x00,0xFF,0x9A,0x00,0xFF,0x98,0x00,0xFF,0x95,0x00,0xFF,0x92,0x00,0xFF,0x8F,0x00,0xFF,0x8C,0x00,0xFF,0x8A,0x00,0xFF,0x87,0x00,0xFF,0x85,0x00,0xFF,0x82,0x00,0xFF,0x80,0x00,0xFF,0x7D,0x00,0xFF,0x7A,0x00,0xFF,0x78,0x00,0xFF,0x75,0x00,0xFF,0x73,0x00,0xFF,0x70,0x00,0xFF,0x6D,0x00,0xFF,0x6A,0x00,0xFF,0x67,0x00,0xFF,0x65,0x00,0xFF,0x62,0x00,0xFF,0x5F,0x00,0xFF,0x5C,0x00,0xFF,0x59,0x00,0xFF,0x56,0x00,0xFF,0x53,0x00,0xFF,0x51,0x00,0xFF,0x4E,0x00,0xFF,0x4B,0x00,0xFF,0x48,0x00,0xFF,0x45,0x00,0xFF,0x42,0x00,0xFF,0x3F,0x00,0xFF,0x3C,0x00,0xFF,0x3A,0x00,0xFF,0x37,0x00,0xFF,0x34,0x00,0xFF,0x31,0x00,0xFF,0x2E,0x00,0xFF,0x2C,0x00,0xFF,0x29,0x00,0xFF,0x27,0x00,0xFF,0x24,0x00,0xFF,0x21,0x00,0xFF,0x1F,0x00,0xFF,0x1D,0x00,0xFF,0x1A,0x00,0xFF,0x18,0x00,0xFF,0x16,0x00,0xFF,0x13,0x00,0xFF,0x11,0x00,0xFF,0x0F,0x00,0xFF,0x0D,0x00,0xFF,0x0B,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x00,0x01,0xFF,0x00,0x02,0xFF,0x00,0x04,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x09,0xFF,0x00,0x0A,0xFF,0x00,0x0C,0xFF,0x00,0x0E,0xFF,0x00,0x10,0xFF,0x00,0x12,0xFF,0x00,0x15,0xFF,0x00,0x17,0xFF,0x00,0x19,0xFF,0x00,0x1B,0xFF,0x00,0x1E,0xFF,0x00,0x20,0xFF,0x00,0x23,0xFF,0x00,0x25,0xFF,0x00,0x28,0xFF,0x00,0x2A,0xFF,0x00,0x2D,0xFF,0x00,0x30,0xFF,0x00,0x33,0xFF,0x00,0x35,0xFF,0x00,0x38,0xFF,0x00,0x3B,0xFF,0x00,0x3E,0xFF,0x00,0x41,0xFF,0x00,0x44,0xFF,0x00,0x46,0xFF,0x00,0x49,0xFF,0x00,0x4C,0xFF,0x00,0x4F,0xFF,0x00,0x52,0xFF,0x00,0x55,0xFF,0x00,0x58,0xFF,0x00,0x5B,0xFF,0x00,0x5E,0xFF,0x00,0x61,0xFF,0x00,0x63,0xFF,0x00,0x66,0xFF,0x00,0x69,0xFF,0x00,0x6C,0xFF,0x00,0x6F,0xFF,0x00,0x71,0xFF,0x00,0x74,0xFF,0x00,0x77,0xFF,0x00,0x79,0xFF,0x00,0x7C,0xFF,0x00,0x7F,0xFF,0x00,0x81,0xFF,0x00,0x84,0xFF,0x00,0x86,0xFF,0x00,0x89,0xFF,0x00,0x8B,0xFF,0x00,0x8E,0xFF,0x00,0x91,0xFF,0x00,0x94,0xFF,0x00,0x96,0xFF,0x00,0x99,0xFF,0x00,0x9C,0xFF,0x00,0x9F,0xFF,0x00,0xA2,0xFF,0x00,0xA5,0xFF,0x00,0xA8,0xFF,0x00,0xAA,0xFF,0x00,0xAD,0xFF,0x00,0xB0,0xFF,0x00,0xB3,0xFF,0x00,0xB6,0xFF,0x00,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,0x97,0x00,0xFF,0x94,0x00,0xFF,0x91,0x00,0xFF,0x8F,0x00,0xFF,0x8C,0x00,0xFF,0x89,0x00,0xFF,0x87,0x00,0xFF,0x84,0x00,0xFF,0x81,0x00,0xFF,0x7F,0x00,0xFF,0x7C,0x00,0xFF,0x7A,0x00,0xFF,0x77,0x00,0xFF,0x75,0x00,0xFF,0x72,0x00,0xFF,0x6F,0x00,0xFF,0x6C,0x00,0xFF,0x6A,0x00,0xFF,0x67,0x00,0xFF,0x64,0x00,0xFF,0x61,0x00,0xFF,0x5E,0x00,0xFF,0x5B,0x00,0xFF,0x58,0x00,0xFF,0x56,0x00,0xFF,0x53,0x00,0xFF,0x50,0x00,0xFF,0x4D,0x00,0xFF,0x4A,0x00,0xFF,0x47,0x00,0xFF,0x44,0x00,0xFF,0x41,0x00,0xFF,0x3E,0x00,0xFF,0x3C,0x00,0xFF,0x39,0x00,0xFF,0x36,0x00,0xFF,0x33,0x00,0xFF,0x31,0x00,0xFF,0x2E,0x00,0xFF,0x2B,0x00,0xFF,0x29,0x00,0xFF,0x26,0x00,0xFF,0x23,0x00,0xFF,0x21,0x00,0xFF,0x1E,0x00,0xFF,0x1C,0x00,0xFF,0x1A,0x00,0xFF,0x17,0x00,0xFF,0x15,0x00,0xFF,0x13,0x00,0xFF,0x11,0x00,0xFF,0x0F,0x00,0xFF,0x0D,0x00,0xFF,0x0B,0x00,0xFF,0x09,0x00,0xFF,0x07,0x00,0xFF,0x06,0x00,0xFF,0x04,0x00,0xFF,0x03,0x00,0xFF,0x01,0x00}; +//Scaled Hue Scale +static char color_data[] = {0xFF,0x00,0xFF,0xF1,0x00,0xFF,0xDE,0x00,0xFF,0xC7,0x00,0xFF,0xAF,0x00,0xFF,0x97,0x00,0xFF,0x82,0x00,0xFF,0x6C,0x00,0xFF,0x56,0x00,0xFF,0x41,0x00,0xFF,0x2E,0x00,0xFF,0x21,0x05,0xFF,0x16,0x0F,0xFF,0x0E,0x1B,0xFF,0x07,0x29,0xFF,0x02,0x39,0xFF,0x00,0x4B,0xFF,0x00,0x5E,0xFF,0x00,0x74,0xFF,0x00,0x8A,0xFF,0x00,0xA0,0xFF,0x00,0xAF,0xFF,0x00,0xB8,0xFE,0x00,0xC2,0xFD,0x00,0xCC,0xFD,0x00,0xD5,0xFC,0x00,0xDF,0xFA,0x00,0xE7,0xF9,0x00,0xEF,0xF6,0x00,0xF6,0xF3,0x00,0xFC,0xEE,0x00,0xFF,0xE8,0x00,0xFF,0xE1,0x00,0xFF,0xD8,0x00,0xFF,0xCE,0x00,0xFF,0xC4,0x00,0xFF,0xB9,0x00,0xFF,0xAD,0x00,0xFF,0xA1,0x00,0xFF,0x96,0x00,0xFF,0x8A,0x00,0xFF,0x80,0x00,0xFF,0x7C,0x00,0xFF,0x78,0x00,0xFF,0x75,0x00,0xFF,0x71,0x00,0xFF,0x6D,0x00,0xFF,0x69,0x00,0xFF,0x66,0x00,0xFF,0x62,0x00,0xFF,0x5E,0x00,0xFF,0x5A,0x00,0xFF,0x56,0x00,0xFF,0x52,0x00,0xFF,0x4E,0x00,0xFF,0x4A,0x00,0xFF,0x47,0x00,0xFF,0x43,0x00,0xFF,0x3F,0x00,0xFF,0x3B,0x00,0xFF,0x38,0x00,0xFF,0x34,0x00,0xFF,0x31,0x00,0xFF,0x2D,0x00,0xFF,0x2A,0x00,0xFF,0x27,0x00,0xFF,0x24,0x00,0xFF,0x21,0x00,0xFF,0x1E,0x00,0xFF,0x1B,0x00,0xFF,0x19,0x00,0xFF,0x17,0x01,0xFF,0x14,0x02,0xFF,0x13,0x04,0xFF,0x11,0x06,0xFF,0x0F,0x07,0xFF,0x0E,0x0A,0xFF,0x0C,0x0C,0xFF,0x0B,0x0E,0xFF,0x0A,0x10,0xFF,0x09,0x13,0xFF,0x08,0x16,0xFF,0x07,0x18,0xFF,0x06,0x1B,0xFF,0x06,0x1E,0xFF,0x05,0x21,0xFF,0x04,0x24,0xFF,0x04,0x27,0xFF,0x04,0x2A,0xFF,0x03,0x2D,0xFF,0x03,0x30,0xFF,0x03,0x34,0xFF,0x02,0x37,0xFF,0x02,0x3A,0xFF,0x02,0x3D,0xFF,0x02,0x41,0xFF,0x02,0x44,0xFF,0x01,0x47,0xFF,0x01,0x4A,0xFF,0x01,0x4E,0xFF,0x01,0x51,0xFF,0x00,0x54,0xFF,0x00,0x56,0xFF,0x00,0x58,0xFF,0x00,0x5A,0xFF,0x00,0x5C,0xFF,0x00,0x5E,0xFF,0x00,0x60,0xFF,0x00,0x62,0xFF,0x00,0x64,0xFF,0x00,0x66,0xFF,0x00,0x68,0xFF,0x00,0x6A,0xFF,0x00,0x6D,0xFF,0x00,0x6F,0xFF,0x00,0x71,0xFF,0x00,0x73,0xFF,0x00,0x75,0xFF,0x00,0x77,0xFF,0x00,0x7A,0xFF,0x00,0x7C,0xFF,0x00,0x7E,0xFF,0x00,0x80,0xFF,0x00,0x83,0xFF,0x00,0x85,0xFF,0x00,0x87,0xFF,0x00,0x89,0xFF,0x00,0x8B,0xFF,0x00,0x8E,0xFF,0x00,0x90,0xFF,0x00,0x92,0xFF,0x00,0x94,0xFF,0x00,0x97,0xFF,0x00,0x99,0xFF,0x00,0x9B,0xFF,0x00,0x9D,0xFF,0x00,0x9F,0xFF,0x00,0xA1,0xFF,0x00,0xA3,0xFF,0x00,0xA6,0xFF,0x00,0xA8,0xFF,0x00,0xAA,0xFF,0x00,0xAC,0xFF,0x00,0xAE,0xFF,0x00,0xB0,0xFF,0x00,0xB2,0xFF,0x00,0xB3,0xFF,0x00,0xB5,0xFF,0x00,0xB7,0xFF,0x00,0xB9,0xFF,0x00,0xBB,0xFF,0x00,0xBD,0xFF,0x00,0xBE,0xFF,0x00,0xC0,0xFF,0x00,0xC1,0xFF,0x00,0xC2,0xFE,0x00,0xC3,0xFE,0x00,0xC4,0xFE,0x00,0xC6,0xFD,0x00,0xC7,0xFD,0x00,0xC8,0xFD,0x00,0xC9,0xFC,0x00,0xCA,0xFC,0x00,0xCB,0xFC,0x00,0xCC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00,0xFF,0x83,0x00,0xFF,0x82,0x00,0xFF,0x81,0x00,0xFF,0x80,0x00,0xFF,0x7F,0x00,0xFF,0x7E,0x00,0xFF,0x7D,0x00,0xFF,0x7C,0x00,0xFF,0x7B,0x00,0xFF,0x7A,0x00,0xFF,0x79,0x00,0xFF,0x78,0x00,0xFF,0x77,0x00,0xFF,0x76,0x00,0xFF,0x75,0x00,0xFF,0x74,0x00,0xFF,0x73,0x00,0xFF,0x72,0x00,0xFF,0x71,0x00,0xFF,0x70,0x00,0xFF,0x6F,0x00,0xFF,0x6E,0x00,0xFF,0x6D,0x00,0xFF,0x6C,0x00,0xFF,0x6B,0x00,0xFF,0x6A,0x00,0xFF,0x6A,0x00,0xFF,0x69,0x00,0xFF,0x68,0x00,0xFF,0x68,0x00,0xFF,0x67,0x00,0xFF,0x66,0x00,0xFF,0x66,0x00,0xFF,0x65,0x00,0xFF,0x65,0x00,0xFF,0x64,0x00,0xFF,0x63,0x00,0xFF,0x63,0x00,0xFF,0x62,0x00,0xFF,0x61,0x00,0xFF,0x61,0x00,0xFF,0x60,0x00,0xFF,0x5F,0x00,0xFF,0x5F,0x00,0xFF,0x5E,0x00,0xFF,0x5D,0x00,0xFF,0x5D,0x00,0xFF,0x5C,0x00,0xFF,0x5B,0x00,0xFF,0x5B,0x00,0xFF,0x5A,0x00,0xFF,0x59,0x00,0xFF,0x59,0x00,0xFF,0x58,0x00,0xFF,0x57,0x00,0xFF,0x57,0x00,0xFF,0x56,0x00,0xFF,0x55,0x00,0xFF,0x54,0x00,0xFF,0x54,0x00,0xFF,0x53,0x00,0xFF,0x52,0x00,0xFF,0x52,0x00,0xFF,0x51,0x00,0xFF,0x50,0x00,0xFF,0x50,0x00,0xFF,0x4F,0x00,0xFF,0x4E,0x00,0xFF,0x4E,0x00,0xFF,0x4D,0x00,0xFF,0x4C,0x00,0xFF,0x4B,0x00,0xFF,0x4B,0x00,0xFF,0x4A,0x00,0xFF,0x49,0x00,0xFF,0x49,0x00,0xFF,0x48,0x00,0xFF,0x47,0x00,0xFF,0x46,0x00,0xFF,0x46,0x00,0xFF,0x45,0x00,0xFF,0x44,0x00,0xFF,0x44,0x00,0xFF,0x43,0x00,0xFF,0x42,0x00,0xFF,0x41,0x00,0xFF,0x41,0x00,0xFF,0x40,0x00,0xFF,0x3F,0x00,0xFF,0x3F,0x00,0xFF,0x3E,0x00,0xFF,0x3D,0x00,0xFF,0x3C,0x00,0xFF,0x3C,0x00,0xFF,0x3B,0x00,0xFF,0x3A,0x00,0xFF,0x3A,0x00,0xFF,0x39,0x00,0xFF,0x38,0x00,0xFF,0x38,0x00,0xFF,0x37,0x00,0xFF,0x36,0x00,0xFF,0x35,0x00,0xFF,0x35,0x00,0xFF,0x34,0x00,0xFF,0x33,0x00,0xFF,0x33,0x00,0xFF,0x32,0x00,0xFF,0x31,0x00,0xFF,0x31,0x00,0xFF,0x30,0x00,0xFF,0x2F,0x00,0xFF,0x2E,0x00,0xFF,0x2E,0x00,0xFF,0x2D,0x00,0xFF,0x2C,0x00,0xFF,0x2C,0x00,0xFF,0x2B,0x00,0xFF,0x2A,0x00,0xFF,0x2A,0x00,0xFF,0x29,0x00,0xFF,0x28,0x00,0xFF,0x28,0x00,0xFF,0x27,0x00,0xFF,0x26,0x00,0xFF,0x26,0x00,0xFF,0x25,0x00,0xFF,0x24,0x00,0xFF,0x24,0x00,0xFF,0x23,0x00,0xFF,0x22,0x00,0xFF,0x22,0x00,0xFF,0x21,0x00,0xFF,0x21,0x00,0xFF,0x20,0x00,0xFF,0x1F,0x00,0xFF,0x1F,0x00,0xFF,0x1E,0x00,0xFF,0x1D,0x00,0xFF,0x1D,0x00,0xFF,0x1C,0x00,0xFF,0x1C,0x00,0xFF,0x1B,0x00,0xFF,0x1A,0x00,0xFF,0x1A,0x00,0xFF,0x19,0x00,0xFF,0x19,0x00,0xFF,0x18,0x00,0xFF,0x17,0x00,0xFF,0x17,0x00,0xFF,0x16,0x00,0xFF,0x16,0x00,0xFF,0x15,0x00,0xFF,0x14,0x00,0xFF,0x14,0x00,0xFF,0x13,0x00,0xFF,0x13,0x00,0xFF,0x12,0x00,0xFF,0x12,0x00,0xFF,0x11,0x00,0xFF,0x11,0x00,0xFF,0x10,0x00,0xFF,0x10,0x00,0xFF,0x0F,0x00,0xFF,0x0F,0x00,0xFF,0x0E,0x00,0xFF,0x0E,0x00,0xFF,0x0D,0x00,0xFF,0x0D,0x00,0xFF,0x0C,0x00,0xFF,0x0C,0x00,0xFF,0x0B,0x00,0xFF,0x0B,0x00,0xFF,0x0A,0x00,0xFF,0x0A,0x00,0xFF,0x09,0x00,0xFF,0x09,0x00,0xFF,0x08,0x00,0xFF,0x08,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x06,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x05,0x00,0xFF,0x05,0x00,0xFF,0x04,0x00,0xFF,0x04,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x02,0x00,0xFF,0x02,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x00,0x00}; +static char plasma_data[] = {0x00,0x00,0x00,0x03,0x00,0x00,0x05,0x00,0x00,0x09,0x00,0x00,0x0E,0x00,0x00,0x12,0x00,0x00,0x17,0x00,0x00,0x1C,0x00,0x00,0x22,0x00,0x00,0x27,0x00,0x00,0x2C,0x00,0x00,0x32,0x00,0x00,0x37,0x00,0x00,0x3C,0x00,0x00,0x41,0x00,0x00,0x45,0x00,0x00,0x4A,0x00,0x00,0x4D,0x00,0x00,0x51,0x00,0x00,0x53,0x00,0x00,0x55,0x00,0x00,0x55,0x00,0x02,0x55,0x02,0x03,0x55,0x03,0x06,0x55,0x03,0x07,0x55,0x05,0x09,0x55,0x06,0x0C,0x55,0x06,0x0F,0x55,0x07,0x10,0x55,0x09,0x13,0x55,0x0A,0x16,0x55,0x0C,0x1A,0x55,0x0C,0x1D,0x54,0x0E,0x20,0x53,0x10,0x23,0x54,0x11,0x26,0x53,0x13,0x2A,0x52,0x14,0x2E,0x51,0x15,0x31,0x50,0x17,0x35,0x50,0x19,0x38,0x4E,0x1A,0x3D,0x4D,0x1C,0x40,0x4D,0x1D,0x44,0x4C,0x1F,0x47,0x4B,0x21,0x4C,0x4A,0x23,0x4F,0x49,0x24,0x54,0x48,0x25,0x57,0x47,0x28,0x5B,0x46,0x29,0x5F,0x45,0x2B,0x62,0x44,0x2D,0x66,0x44,0x2E,0x6A,0x43,0x30,0x6E,0x42,0x32,0x72,0x41,0x33,0x76,0x40,0x35,0x79,0x3F,0x38,0x7C,0x3F,0x39,0x7F,0x3E,0x3B,0x83,0x3D,0x3D,0x86,0x3C,0x3F,0x8A,0x3B,0x40,0x8C,0x3B,0x43,0x8F,0x3B,0x44,0x92,0x3A,0x46,0x95,0x39,0x48,0x98,0x39,0x4A,0x9B,0x39,0x4C,0x9C,0x39,0x4E,0x9F,0x3A,0x4F,0xA1,0x39,0x51,0xA3,0x39,0x52,0xA4,0x39,0x54,0xA6,0x39,0x56,0xA7,0x39,0x57,0xA8,0x39,0x58,0xA8,0x3A,0x5A,0xA9,0x3A,0x5C,0xA8,0x3A,0x5D,0xA8,0x3B,0x5F,0xA8,0x3C,0x61,0xA8,0x3D,0x62,0xA8,0x3D,0x64,0xA9,0x3E,0x66,0xA8,0x3E,0x67,0xA9,0x3F,0x68,0xA8,0x40,0x6A,0xA8,0x41,0x6C,0xA8,0x42,0x6E,0xA8,0x42,0x70,0xA8,0x43,0x71,0xA8,0x44,0x73,0xA8,0x45,0x74,0xA9,0x46,0x76,0xA8,0x48,0x79,0xA8,0x49,0x7A,0xA7,0x4A,0x7C,0xA6,0x4A,0x7D,0xA5,0x4C,0x7F,0xA4,0x4D,0x81,0xA3,0x4E,0x83,0xA2,0x4E,0x85,0xA1,0x50,0x86,0xA0,0x51,0x88,0x9F,0x52,0x8A,0x9D,0x53,0x8B,0x9D,0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,0xB4,0xC4,0xB3,0xB5,0xC5,0xB4,0xB6,0xC4,0xB6,0xB7,0xC4,0xB7,0xB8,0xC4,0xB7,0xBA,0xC4,0xB9,0xBA,0xC4,0xBA,0xBC,0xC4,0xBB,0xBC,0xC4,0xBC,0xBE,0xC4,0xBD,0xBF,0xC4,0xBE,0xBF,0xC4,0xBF,0xC0,0xC4,0xC0,0xC1,0xC4,0xC1,0xC2,0xC4,0xC2,0xC2,0xC4,0xC3,0xC4,0xC4,0xC3,0xC4,0xC4,0xC4}; +static char hflm_data[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x04, 0x02, 0x01, 0x04, 0x02, 0x03, 0x05, 0x03, 0x03, 0x07, 0x04, 0x04, 0x08, 0x04, 0x03, 0x09, 0x04, 0x04, 0x0B, 0x05, 0x04, 0x0C, 0x05, 0x05, 0x0D, 0x06, 0x05, 0x0E, 0x07, 0x06, 0x10, 0x07, 0x07, 0x11, 0x08, 0x07, 0x12, 0x09, 0x08, 0x14, 0x09, 0x08, 0x15, 0x0A, 0x09, 0x17, 0x0A, 0x09, 0x19, 0x0B, 0x0A, 0x1A, 0x0C, 0x0A, 0x1C, 0x0D, 0x0B, 0x1D, 0x0D, 0x0B, 0x1F, 0x0D, 0x0C, 0x22, 0x0F, 0x0D, 0x23, 0x0F, 0x0E, 0x25, 0x10, 0x0E, 0x26, 0x11, 0x0F, 0x28, 0x12, 0x10, 0x2A, 0x13, 0x10, 0x2C, 0x13, 0x11, 0x2E, 0x14, 0x12, 0x2F, 0x15, 0x12, 0x31, 0x15, 0x13, 0x33, 0x16, 0x14, 0x35, 0x17, 0x15, 0x36, 0x18, 0x15, 0x39, 0x19, 0x16, 0x3B, 0x19, 0x17, 0x3D, 0x1B, 0x17, 0x3E, 0x1B, 0x18, 0x40, 0x1C, 0x19, 0x42, 0x1D, 0x1A, 0x43, 0x1D, 0x1B, 0x45, 0x1E, 0x1C, 0x47, 0x1F, 0x1C, 0x49, 0x20, 0x1D, 0x4B, 0x21, 0x1F, 0x4C, 0x21, 0x1F, 0x4E, 0x22, 0x20, 0x50, 0x23, 0x21, 0x52, 0x23, 0x22, 0x53, 0x24, 0x23, 0x55, 0x25, 0x23, 0x56, 0x26, 0x24, 0x59, 0x26, 0x25, 0x5A, 0x27, 0x26, 0x5B, 0x28, 0x27, 0x5D, 0x28, 0x28, 0x5E, 0x29, 0x29, 0x60, 0x29, 0x2A, 0x62, 0x2A, 0x2B, 0x63, 0x2B, 0x2C, 0x64, 0x2C, 0x2E, 0x65, 0x2C, 0x2E, 0x66, 0x2C, 0x2F, 0x68, 0x2D, 0x31, 0x69, 0x2E, 0x32, 0x6A, 0x2F, 0x32, 0x6B, 0x2F, 0x34, 0x6C, 0x30, 0x34, 0x6D, 0x30, 0x35, 0x6F, 0x31, 0x37, 0x70, 0x31, 0x38, 0x71, 0x32, 0x39, 0x72, 0x33, 0x3B, 0x73, 0x33, 0x3C, 0x74, 0x34, 0x3D, 0x75, 0x35, 0x3E, 0x76, 0x35, 0x3F, 0x78, 0x36, 0x41, 0x78, 0x36, 0x42, 0x79, 0x36, 0x43, 0x7A, 0x37, 0x44, 0x7B, 0x37, 0x46, 0x7C, 0x38, 0x48, 0x7D, 0x39, 0x48, 0x7E, 0x3A, 0x49, 0x7F, 0x39, 0x4B, 0x80, 0x3A, 0x4C, 0x81, 0x3B, 0x4E, 0x82, 0x3C, 0x4F, 0x83, 0x3C, 0x51, 0x84, 0x3C, 0x52, 0x84, 0x3D, 0x54, 0x86, 0x3E, 0x55, 0x87, 0x3E, 0x56, 0x88, 0x3F, 0x57, 0x89, 0x40, 0x59, 0x8A, 0x40, 0x5A, 0x8A, 0x41, 0x5C, 0x8B, 0x41, 0x5D, 0x8C, 0x42, 0x5F, 0x8D, 0x41, 0x60, 0x8E, 0x42, 0x62, 0x8E, 0x42, 0x62, 0x8F, 0x44, 0x65, 0x90, 0x43, 0x65, 0x91, 0x45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EB,0x95,0x9C,0xF3,0x95,0xA3,0xED,0x9A,0xAB,0xF0,0x92,0xB3,0xF1,0x85,0xBD,0xF5,0x89,0xC9,0xF3,0x81,0xC7,0xF6,0x81,0xC2,0xEF,0x87,0xC7,0xF3,0x8A,0xC2,0xF5,0x85,0xC3,0xE4,0x86,0xC5,0xE1,0x87,0xBE,0xD6,0x92,0xBC,0xD5,0x9D,0xB7,0xCE,0x9F,0xB7,0xCC,0xA0,0xAD,0xCD,0x9C,0x9B,0xCF,0x9D,0x93}; +#endif \ No newline at end of file diff --git a/includes/http.h b/includes/http.h new file mode 100755 index 0000000..2ad7ccc --- /dev/null +++ b/includes/http.h @@ -0,0 +1,43 @@ +/** + * Powder Toy - HTTP Library (Header) + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +#ifndef HTTP_H +#define HTTP_H + +void http_init(char *proxy); +void http_done(void); + +char *http_simple_get(char *uri, int *ret, int *len); +char *http_auth_get(char *uri, char *user, char *pass, int *ret, int *len); +char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len); + +void http_auth_headers(void *ctx, char *user, char *pass); + +void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep); +void http_async_add_header(void *ctx, char *name, char *data); +int http_async_req_status(void *ctx); +void http_async_get_length(void *ctx, int *total, int *done); +char *http_async_req_stop(void *ctx, int *ret, int *len); +void http_async_req_close(void *ctx); + +char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, int *ret, int *len); + +char *http_ret_text(int ret); + +#endif diff --git a/includes/icon.h b/includes/icon.h new file mode 100755 index 0000000..89b2c7f --- /dev/null +++ b/includes/icon.h @@ -0,0 +1,22 @@ +/** + * Powder Toy - Main source + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +static unsigned char app_icon[] = { 0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0xD3,0xD9,0xE0,0xFF,0x68,0x79,0x91,0xFF,0xD3,0xD9,0xE0,0xFF,0x68,0x79,0x91,0xFF,0xD3,0xD9,0xE0,0xFF,0x68,0x79,0x91,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x05,0x06,0x06,0xFF,0x09,0x09,0x0A,0xFF,0x2F,0x08,0x08,0xFF,0x56,0x06,0x07,0xFF,0x23,0x06,0x06,0xFF,0x85,0x02,0x06,0xFF,0xE5,0x02,0x07,0xFF,0xF2,0x1E,0x08,0xFF,0xED,0x0A,0x08,0xFF,0x60,0x07,0x08,0xFF,0x5F,0x08,0x08,0xFF,0x68,0x08,0x08,0xFF,0x18,0x07,0x08,0xFF,0x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x00,0xFF,0x00,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x00,0x00,0x00,0xFF,0x47,0x14,0x14,0xFF,0x47,0x14,0x14,0xFF,0x00,0x00,0x00,0xFF,0x1F,0x30,0xD5,0xFF,0x1F,0x30,0xD5,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x79,0x79,0x79,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF }; +static unsigned char app_icon_w32[] = { 0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x44,0x47,0x49,0x00,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x44,0x46,0x48,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x86,0x88,0x8A,0xFF,0xD8,0xDE,0xE6,0xFF,0xD1,0xD7,0xDF,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x81,0x84,0x88,0xFF,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x83,0x85,0x89,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1E,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x14,0x00,0x00,0xFF,0xE1,0x01,0x00,0xFF,0xF4,0x03,0x00,0xFF,0x24,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x86,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x0F,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x36,0x01,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x00,0x00,0xFF,0xE7,0x0A,0x01,0xFF,0xFF,0x07,0x01,0xFF,0x41,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x00,0x00,0xFF,0x16,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x0B,0x00,0x00,0xFF,0x55,0x02,0x00,0xFF,0x04,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x39,0x00,0x00,0xFF,0xF8,0x1B,0x02,0xFF,0xFF,0x2F,0x03,0xFF,0x52,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1C,0x00,0x00,0xFF,0x5C,0x01,0x00,0xFF,0x09,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x36,0x01,0x00,0xFF,0xAE,0x04,0x01,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x50,0x00,0x00,0xFF,0xFE,0x44,0x02,0xFF,0xFF,0x5C,0x03,0xFF,0x60,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x12,0x00,0x00,0xFF,0x9F,0x02,0x00,0xFF,0x49,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x73,0x04,0x00,0xFF,0xEC,0x09,0x01,0xFF,0x2B,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x13,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x04,0x00,0x00,0xFF,0x04,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x4E,0x06,0x00,0xFF,0xFF,0xC1,0x08,0xFF,0xFD,0x9A,0x07,0xFF,0x49,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8B,0x01,0x00,0xFF,0xD5,0x03,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0xB7,0x0D,0x01,0xFF,0xFF,0x0F,0x02,0xFF,0xDE,0x00,0x00,0xFF,0xAB,0x00,0x00,0xFF,0xA5,0x01,0x00,0xFF,0x3D,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8B,0x35,0x03,0xFF,0xFF,0xF0,0x0E,0xFF,0xDF,0x4B,0x01,0xFF,0x14,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x55,0x00,0x00,0xFF,0xFF,0x05,0x01,0xFF,0x73,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1B,0x00,0x00,0xFF,0xE5,0x0F,0x01,0xFF,0xFF,0x0D,0x02,0xFF,0xFF,0x04,0x01,0xFF,0xFF,0x03,0x00,0xFF,0xFF,0x01,0x00,0xFF,0x8F,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1B,0x00,0x00,0xFF,0xD9,0x47,0x03,0xFF,0xFF,0x92,0x06,0xFF,0xAF,0x12,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x20,0x00,0x00,0xFF,0xE5,0x08,0x01,0xFF,0xD1,0x04,0x01,0xFF,0x0E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x30,0x01,0x00,0xFF,0xF6,0x47,0x04,0xFF,0xFF,0x1F,0x02,0xFF,0xFF,0x03,0x01,0xFF,0xFF,0x06,0x01,0xFF,0xFF,0x03,0x00,0xFF,0xC7,0x01,0x00,0xFF,0x1F,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x06,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x38,0x02,0x00,0xFF,0xFB,0x72,0x07,0xFF,0xFF,0x5A,0x03,0xFF,0x73,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xA1,0x02,0x00,0xFF,0xFF,0x0C,0x03,0xFF,0x7B,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3B,0x06,0x00,0xFF,0xFF,0xBB,0x0C,0xFF,0xFF,0x56,0x04,0xFF,0xFF,0x00,0x01,0xFF,0xFF,0x10,0x03,0xFF,0xFF,0x02,0x01,0xFF,0xDE,0x01,0x00,0xFF,0x34,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x05,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3B,0x03,0x00,0xFF,0xFC,0x83,0x06,0xFF,0xFF,0x71,0x03,0xFF,0x83,0x05,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFB,0x18,0x03,0xFF,0xFF,0x0E,0x02,0xFF,0xB9,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x21,0x01,0x00,0xFF,0xE8,0xB9,0x0F,0xFF,0xFF,0x8F,0x0C,0xFF,0xFF,0x02,0x00,0xFF,0xFF,0x3C,0x04,0xFF,0xFF,0x16,0x02,0xFF,0xFD,0x00,0x00,0xFF,0x63,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x40,0x0B,0x00,0xFF,0xFE,0xAD,0x06,0xFF,0xFF,0xC9,0x06,0xFF,0xCC,0x45,0x02,0xFF,0x08,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x49,0x03,0xFF,0xFF,0x7E,0x03,0xFF,0xFF,0x45,0x01,0xFF,0x67,0x05,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x09,0x00,0x00,0xFF,0xCC,0xA0,0x08,0xFF,0xFB,0xAA,0x0A,0xFF,0xC9,0x00,0x00,0xFF,0xFE,0x6B,0x03,0xFF,0xFF,0x79,0x02,0xFF,0xF9,0x0A,0x00,0xFF,0x4C,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x08,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3F,0x14,0x00,0xFF,0xFC,0xDF,0x10,0xFF,0xFF,0xFF,0x10,0xFF,0xFA,0xCD,0x14,0xFF,0x46,0x0C,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x7F,0x03,0xFF,0xFF,0xFF,0x06,0xFF,0xFF,0xE7,0x03,0xFF,0xD5,0x39,0x01,0xFF,0x0E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x06,0x00,0xFF,0xEA,0xCF,0x17,0xFF,0xE2,0xA6,0x10,0xFF,0x32,0x00,0x00,0xFF,0xCB,0x80,0x06,0xFF,0xFF,0xF4,0x09,0xFF,0xD8,0x44,0x00,0xFF,0x10,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x44,0x21,0x00,0xFF,0xFD,0xE9,0x1C,0xFF,0xFF,0xD6,0x09,0xFF,0xFF,0xFF,0x28,0xFF,0xB4,0x75,0x04,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x8D,0x03,0xFF,0xFF,0xFF,0x41,0xFF,0xFF,0xFF,0x3F,0xFF,0xFF,0x7E,0x01,0xFF,0x4C,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x49,0x30,0x04,0xFF,0xFF,0xFC,0x5A,0xFF,0xB0,0x7E,0x14,0xFF,0x00,0x00,0x00,0xFF,0x89,0x66,0x0F,0xFF,0xFF,0xFF,0x6B,0xFF,0xE6,0xA7,0x1E,0xFF,0x1E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x6F,0x5A,0x18,0xFF,0xFF,0xFE,0x70,0xFF,0xCD,0x6C,0x04,0xFF,0xE8,0xB5,0x27,0xFF,0xFE,0xF3,0x60,0xFF,0x6E,0x3D,0x08,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xDB,0x8A,0x26,0xFF,0xFF,0xFF,0xD5,0xFF,0xFF,0xFF,0xD8,0xFF,0xFF,0xCF,0x3A,0xFF,0x94,0x12,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x15,0x0A,0x01,0xFF,0xBF,0xAC,0x7E,0xFF,0xFF,0xFF,0xDE,0xFF,0x82,0x5F,0x20,0xFF,0x00,0x00,0x00,0xFF,0x67,0x5B,0x28,0xFF,0xFF,0xFF,0xF3,0xFF,0xFF,0xF1,0xAA,0xFF,0x5D,0x2E,0x07,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x18,0x0D,0x02,0xFF,0xD0,0xC0,0x90,0xFF,0xFF,0xFF,0xF4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0x4E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xB4,0xA5,0x73,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0xB5,0x9B,0x6F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x8B,0x78,0x4E,0xFF,0x00,0x00,0x00,0xFF,0xCC,0xAE,0x7E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x8F,0x74,0x38,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x24,0x14,0x03,0xFF,0x8C,0x7E,0x44,0xFF,0xA2,0x8E,0x5D,0xFF,0x5B,0x37,0x17,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x71,0x46,0x1E,0xFF,0xCB,0xA4,0x71,0xFF,0xAC,0x93,0x66,0xFF,0x17,0x0E,0x04,0xFF,0x00,0x00,0x00,0xFF,0x30,0x23,0x0A,0xFF,0xBF,0xA4,0x60,0xFF,0xC4,0xAC,0x78,0xFF,0x43,0x34,0x1A,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x5C,0x3D,0x18,0xFF,0xC9,0xA9,0x6F,0xFF,0xB8,0x94,0x63,0xFF,0x2A,0x19,0x07,0xFF,0x00,0x00,0x00,0xFF,0x53,0x3B,0x16,0xFF,0xC7,0xB6,0x70,0xFF,0xBD,0xA2,0x66,0xFF,0x2C,0x1C,0x09,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x47,0x14,0x14,0xFF,0x47,0x14,0x14,0xFF,0x00,0x00,0x00,0xFF,0x1F,0x30,0xD6,0xFF,0x1F,0x30,0xD6,0xFF,0x00,0x00,0x00,0xFF,0xF7,0x0F,0x00,0xFF,0xF7,0x0F,0x00,0xFF,0x00,0x00,0x00,0xFF,0xC8,0x47,0x0E,0xFF,0xC8,0x47,0x0E,0xFF,0x00,0x00,0x00,0xFF,0x20,0xE6,0x0F,0xFF,0x20,0xE6,0x0F,0xFF,0x00,0x00,0x00,0xFF,0xEB,0xF5,0x22,0xFF,0xEB,0xF5,0x22,0xFF,0x00,0x00,0x00,0xFF,0x40,0x40,0x40,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0x79,0x79,0x79,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x44,0x46,0x48,0x00,0x7A,0x7D,0x81,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x83,0x86,0x8A,0xFF,0x86,0x89,0x8C,0xFF,0x89,0x8C,0x8F,0xFF,0x87,0x8A,0x8F,0xFF,0x85,0x87,0x8B,0xFF,0x82,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x44,0x46,0x48,0x00,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00 }; \ No newline at end of file diff --git a/includes/interface.h b/includes/interface.h new file mode 100644 index 0000000..7f13064 --- /dev/null +++ b/includes/interface.h @@ -0,0 +1,183 @@ +#ifndef INTERFACE_H +#define INTERFACE_H +#include +#include "graphics.h" + +struct menu_section +{ + char *icon; + const char *name; + int itemcount; +}; +typedef struct menu_section menu_section; + +struct menu_wall +{ + pixel colour; + const char *descs; +}; +typedef struct menu_wall menu_wall; + +static menu_wall mwalls[] = +{ + {PIXPACK(0xC0C0C0), "Wall. Indestructible. Blocks everything. Conductive."}, + {PIXPACK(0x808080), "E-Wall. Becomes transparent when electricity is connected."}, + {PIXPACK(0xFF8080), "Detector. Generates electricity when a particle is inside."}, + {PIXPACK(0x808080), "Streamline. Set start point of a streamline."}, + {PIXPACK(0x808080), "Sign. Click on a sign to edit it or anywhere else to place a new one."}, + {PIXPACK(0x8080FF), "Fan. Accelerates air. Use line tool to set direction and strength."}, + {PIXPACK(0xC0C0C0), "Wall. Blocks most particles but lets liquids through. Conductive."}, + {PIXPACK(0x808080), "Wall. Absorbs particles but lets air currents through."}, + {PIXPACK(0x808080), "Erases walls."}, + {PIXPACK(0x808080), "Wall. Indestructible. Blocks everything."}, + {PIXPACK(0x3C3C3C), "Wall. Indestructible. Blocks particles, allows air"}, + {PIXPACK(0x575757), "Wall. Indestructible. Blocks liquids and gasses, allows solids"}, + {PIXPACK(0xFFFF22), "Conductor, allows particles, conducts electricity"}, + {PIXPACK(0x242424), "E-Hole, absorbs particles, release them when powered"}, + {PIXPACK(0xFFFFFF), "Air, creates airflow and pressure"}, + {PIXPACK(0xFFBB00), "Heats the targetted element."}, + {PIXPACK(0x00BBFF), "Cools the targetted element."}, + {PIXPACK(0x303030), "Vacuum, reduces air pressure."}, + {PIXPACK(0x579777), "Wall. Indestructible. Blocks liquids and solids, allows gasses"}, +}; + +#define SC_WALL 0 +#define SC_SPECIAL 8 +#define SC_POWDERS 5 +#define SC_SOLIDS 6 +#define SC_ELEC 1 +#define SC_EXPLOSIVE 2 +#define SC_GAS 3 +#define SC_LIQUID 4 +#define SC_NUCLEAR 7 +#define SC_TOTAL 9 + +static menu_section msections[] = +{ + {"\xC1", "Walls", 0}, + {"\xC2", "Electronics", 0}, + {"\xC3", "Explosives", 0}, + {"\xC5", "Gasses", 0}, + {"\xC4", "Liquids", 0}, + {"\xD0", "Powders", 0}, + {"\xD1", "Solids", 0}, + {"\xC6", "Radioactive", 0}, + {"\xCC", "Special", 0}, +}; + +struct ui_edit +{ + int x, y, w, nx; + char str[256],*def; + int focus, cursor, hide; +}; +typedef struct ui_edit ui_edit; + +struct ui_checkbox +{ + int x, y; + int focus, checked; +}; +typedef struct ui_checkbox ui_checkbox; + +extern SDLMod sdl_mod; +extern int sdl_key, sdl_wheel, sdl_caps, sdl_ascii, sdl_zoom_trig; +extern char *shift_0; +extern char *shift_1; +extern int svf_login; +extern int svf_admin; +extern int svf_mod; +extern char svf_user[64]; +extern char svf_pass[64]; + +extern int svf_open; +extern int svf_own; +extern int svf_myvote; +extern int svf_publish; +extern char svf_id[16]; +extern char svf_name[64]; +extern char svf_tags[256]; +extern void *svf_last; +extern int svf_lsize; + +extern char *search_ids[GRID_X*GRID_Y]; +extern char *search_dates[GRID_X*GRID_Y]; +extern int search_votes[GRID_X*GRID_Y]; +extern int search_publish[GRID_X*GRID_Y]; +extern int search_scoredown[GRID_X*GRID_Y]; +extern int search_scoreup[GRID_X*GRID_Y]; +extern char *search_names[GRID_X*GRID_Y]; +extern char *search_owners[GRID_X*GRID_Y]; +extern void *search_thumbs[GRID_X*GRID_Y]; +extern int search_thsizes[GRID_X*GRID_Y]; + +extern int search_own; +extern int search_date; +extern int search_page; +extern char search_expr[256]; + +extern char *tag_names[TAG_MAX]; +extern int tag_votes[TAG_MAX]; + +extern int Z_keysym; + +extern int zoom_en; +extern int zoom_x, zoom_y; +extern int zoom_wx, zoom_wy; + +void menu_count(void); + +void get_sign_pos(int i, int *x0, int *y0, int *w, int *h); + +void add_sign_ui(pixel *vid_buf, int mx, int my); + +void ui_edit_draw(pixel *vid_buf, ui_edit *ed); + +void ui_edit_process(int mx, int my, int mb, ui_edit *ed); + +void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed); + +void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed); + +void draw_svf_ui(pixel *vid_buf); + +void error_ui(pixel *vid_buf, int err, char *txt); + +void info_ui(pixel *vid_buf, char *top, char *txt); + +void info_box(pixel *vid_buf, char *msg); + +int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn); + +void login_ui(pixel *vid_buf); + +int stamp_ui(pixel *vid_buf); + +void tag_list_ui(pixel *vid_buf); + +int save_name_ui(pixel *vid_buf); + +void menu_ui(pixel *vid_buf, int i, int *sl, int *sr); + +void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my); + +int sdl_poll(void); + +void set_cmode(int cm); + +char *download_ui(pixel *vid_buf, char *uri, int *len); + +int search_ui(pixel *vid_buf); + +int search_results(char *str, int votes); + +int execute_tagop(pixel *vid_buf, char *op, char *tag); + +void execute_save(pixel *vid_buf); + +void execute_delete(pixel *vid_buf, char *id); + +int execute_vote(pixel *vid_buf, char *id, char *action); + +#endif + diff --git a/includes/md5.h b/includes/md5.h new file mode 100644 index 0000000..2ae3ae8 --- /dev/null +++ b/includes/md5.h @@ -0,0 +1,18 @@ +#ifndef MD5_H +#define MD5_H + +struct md5_context +{ + unsigned buf[4]; + unsigned bits[2]; + unsigned char in[64]; +}; + +void md5_init(struct md5_context *context); +void md5_update(struct md5_context *context, unsigned char const *buf, unsigned len); +void md5_final(unsigned char digest[16], struct md5_context *context); +void md5_transform(unsigned buf[4], const unsigned char in[64]); + +void md5_ascii(char *result, unsigned char const *buf, unsigned len); + +#endif diff --git a/includes/misc.h b/includes/misc.h new file mode 100644 index 0000000..1394687 --- /dev/null +++ b/includes/misc.h @@ -0,0 +1,72 @@ +#ifndef UTILS_H +#define UTILS_H +#include +#include + +#ifdef WIN32 +#define x86_cpuid(func,af,bf,cf,df) \ + do {\ + __asm mov eax, func\ + __asm cpuid\ + __asm mov af, eax\ + __asm mov bf, ebx\ + __asm mov cf, ecx\ + __asm mov df, edx\ + } while(0) +#else +#define x86_cpuid(func,af,bf,cf,df) \ +__asm__ __volatile ("cpuid":\ + "=a" (af), "=b" (bf), "=c" (cf), "=d" (df) : "a" (func)); +#endif + +static char hex[] = "0123456789ABCDEF"; +//Signum function +#ifdef WIN32 +extern _inline int isign(float i); +#else +extern inline int isign(float i); +#endif + +#ifdef WIN32 +extern _inline unsigned clamp_flt(float f, float min, float max); +#else +extern inline unsigned clamp_flt(float f, float min, float max); +#endif + +#ifdef WIN32 +extern _inline float restrict_flt(float f, float min, float max); +#else +extern inline float restrict_flt(float f, float min, float max); +#endif + +char *mystrdup(char *s); + +struct strlist +{ + char *str; + struct strlist *next; +}; + +void strlist_add(struct strlist **list, char *str); + +int strlist_find(struct strlist **list, char *str); + +void strlist_free(struct strlist **list); + +void save_presets(int do_update); + +void load_presets(void); + +void save_string(FILE *f, char *str); + +int load_string(FILE *f, char *str, int max); + +void strcaturl(char *dst, char *src); + +void strappend(char *dst, char *src); + +void *file_load(char *fn, int *size); + +int cpu_check(void); + +#endif \ No newline at end of file diff --git a/includes/powder.h b/includes/powder.h new file mode 100644 index 0000000..eda30d2 --- /dev/null +++ b/includes/powder.h @@ -0,0 +1,512 @@ +#ifndef POWDER_H +#define POWDER_H + +#include "graphics.h" +#include "defines.h" +#include "interface.h" + +#define CM_COUNT 7 +#define CM_FANCY 6 +#define CM_HEAT 5 +#define CM_BLOB 4 +#define CM_FIRE 3 +#define CM_PERS 2 +#define CM_PRESS 1 +#define CM_VEL 0 + +#define UI_WALLSTART 37 +#define UI_WALLCOUNT 19 + +#define SPC_AIR 136 +#define SPC_HEAT 137 +#define SPC_COOL 138 +#define SPC_VACUUM 139 + +#define WL_WALLELEC 22 +#define WL_EWALL 23 +#define WL_DETECT 24 +#define WL_STREAM 25 +#define WL_SIGN 26 +#define WL_FAN 27 +#define WL_ALLOWLIQUID 28 +#define WL_DESTROYALL 29 +#define WL_ERASE 30 +#define WL_WALL 31 +#define WL_ALLOWAIR 32 +#define WL_ALLOWSOLID 33 +#define WL_ALLOWALLELEC 34 +#define WL_EHOLE 35 +#define WL_ALLOWGAS 40 + +#define PT_NONE 0 +#define PT_DUST 1 +#define PT_WATR 2 +#define PT_OIL 3 +#define PT_FIRE 4 +#define PT_STNE 5 +#define PT_LAVA 6 +#define PT_GUNP 7 +#define PT_NITR 8 +#define PT_CLNE 9 +#define PT_GAS 10 +#define PT_PLEX 11 +#define PT_GOO 12 +#define PT_ICEI 13 +#define PT_METL 14 +#define PT_SPRK 15 +#define PT_SNOW 16 +#define PT_WOOD 17 +#define PT_NEUT 18 +#define PT_PLUT 19 +#define PT_PLNT 20 +#define PT_ACID 21 +#define PT_VOID 22 +#define PT_WTRV 23 +#define PT_CNCT 24 +#define PT_DSTW 25 +#define PT_SALT 26 +#define PT_SLTW 27 +#define PT_DMND 28 +#define PT_BMTL 29 +#define PT_BRMT 30 +#define PT_PHOT 31 +#define PT_URAN 32 +#define PT_WAX 33 +#define PT_MWAX 34 +#define PT_PSCN 35 +#define PT_NSCN 36 +#define PT_LNTG 37 +#define PT_INSL 38 +#define PT_BHOL 39 +#define PT_WHOL 40 +#define PT_RBDM 41 +#define PT_LRBD 42 +#define PT_NTCT 43 +#define PT_SAND 44 +#define PT_GLAS 45 +#define PT_PTCT 46 +#define PT_BGLA 47 +#define PT_THDR 48 +#define PT_PLSM 49 +#define PT_ETRD 50 +#define PT_NICE 51 +#define PT_NBLE 52 +#define PT_BTRY 53 +#define PT_LCRY 54 +#define PT_STKM 55 +#define PT_SWCH 56 +#define PT_SMKE 57 +#define PT_DESL 58 +#define PT_COAL 59 +#define PT_LO2 60 +#define PT_O2 61 +#define PT_INWR 62 +#define PT_YEST 63 +#define PT_DYST 64 +#define PT_THRM 65 +#define PT_GLOW 66 +#define PT_BRCK 67 +#define PT_HFLM 68 +#define PT_FIRW 69 +#define PT_FUSE 70 +#define PT_FSEP 71 +#define PT_AMTR 72 +#define PT_PCLN 73 +#define PT_HSWC 74 +#define PT_NUM 75 + +#define R_TEMP 22 +#define MAX_TEMP 9999 +#define MIN_TEMP 0 +#define O_MAX_TEMP 3500 +#define O_MIN_TEMP -273 + +#define ST_NONE 0 +#define ST_SOLID 1 +#define ST_LIQUID 2 +#define ST_GAS 3 +/* + We should start to implement these. +*/ +static const unsigned short TYPE_PART = 0x01; //1 +static const unsigned short TYPE_LIQUID = 0x02; //2 +static const unsigned short TYPE_SOLID = 0x04; //4 +static const unsigned short TYPE_GAS = 0x08; //8 +static const unsigned short PROP_CONDUCTS = 0x10; //16 +static const unsigned short PROP_DEADLY = 0x12; //18 Is deadly for stickman. +#define FLAG_STAGNANT 1 + +struct particle +{ + int type; + int life, ctype; + float x, y, vx, vy; + float temp; + float pavg[2]; + int flags; + int tmp; +}; +typedef struct particle particle; + +struct part_type +{ + const char *name; + pixel pcolors; + float advection; + float airdrag; + float airloss; + float loss; + float collision; + float gravity; + float diffusion; + float hotair; + int falldown; + int flammable; + int explosive; + int meltable; + int hardness; + int menu; + int menusection; + float heat; + unsigned char hconduct; + const char *descs; + const unsigned short properties; +}; +typedef struct part_type part_type; + +struct part_state +{ + char state; + int solid; + float stemp; + int liquid; + float ltemp; + int gas; + float gtemp; + int burn; + float btemp; +}; +typedef struct part_state part_state; +//Should probably be const. +static const part_type ptypes[PT_NUM] = +{ + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f+273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f+273.15f, 88, "Ignites flammable materials. Heats air."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f+273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, + {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+-50.0f+273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, + {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, + {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP+-30.0f+273.15f, 46, "Light particles."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, + {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, + {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f+273.15f, 23, "Distilled water, does not conduct electricity."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, + {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f+273.15f, 251, "Photons. Travel in straight lines."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure."}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax."}, + {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, + {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, + {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up."}, + {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f+273.15f, 255, "White hole, pushes other particles away."}, + {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f+273.15f, 170, "Liquid Rubidium."}, + {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, + {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, + {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!"}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke"}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure"}, + {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, + {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, + {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, + {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description +}; + +static part_state pstates[PT_NUM] = +{ + // Name Solid Frzp Liquid Mpnt Gas Bpoint + /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f}, + /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f}, + /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LAVA */ {ST_LIQUID, PT_STNE, 973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, + /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, + /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, + /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, + /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f}, + /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f}, + /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, + /* LRBD */ {ST_LIQUID, PT_RBDM, 311.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, + /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, + /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, + /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f}, + /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, + /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, + /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, +}; + +static unsigned char can_move[PT_NUM][PT_NUM] = +{ + /* A B */ + /* A 0 1 | B ligher than A */ + /* B 1 0 | A heavier than B */ + + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A P H */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C S */ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T L W */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R N C */ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0}, /* Dust */ + /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, /* Watr */ + /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* FUSE */ + /* FSEP */ {0,1,1,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0}, /* FSEP */ + /* AMTR */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* AMTR */ + /* PCLN */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* PCLN */ + /* HSWC */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* HSWC */ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A P H */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C S */ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T L W */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R N C */ +}; + +extern int isplayer; +extern float player[27]; + +extern particle *parts; +extern particle *cb_parts; + +extern unsigned char bmap[YRES/CELL][XRES/CELL]; +extern unsigned char emap[YRES/CELL][XRES/CELL]; + +extern unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +extern unsigned char cb_emap[YRES/CELL][XRES/CELL]; + +extern int pfree; + +extern unsigned pmap[YRES][XRES]; +unsigned cb_pmap[YRES][XRES]; + +int try_move(int i, int x, int y, int nx, int ny); + +void kill_part(int i); + +#ifdef WIN32 +extern _inline int create_part(int p, int x, int y, int t); +#else +extern inline int create_part(int p, int x, int y, int t); +#endif + +#ifdef WIN32 +extern _inline void delete_part(int x, int y); +#else +extern inline void delete_part(int x, int y); +#endif + +#ifdef WIN32 +extern _inline int is_wire(int x, int y); +#else +extern inline int is_wire(int x, int y); +#endif + +#ifdef WIN32 +extern _inline int is_wire_off(int x, int y); +#else +extern inline int is_wire_off(int x, int y); +#endif + +void set_emap(int x, int y); + +#ifdef WIN32 +_inline int parts_avg(int ci, int ni); +#else +inline int parts_avg(int ci, int ni); +#endif + +int nearest_part(int ci, int t); + +void update_particles_i(pixel *vid, int start, int inc); + +void update_particles(pixel *vid); + +void clear_area(int area_x, int area_y, int area_w, int area_h); + +void create_box(int x1, int y1, int x2, int y2, int c); + +int flood_parts(int x, int y, int c, int cm, int bm); + +int create_parts(int x, int y, int r, int c); + +void create_line(int x1, int y1, int x2, int y2, int r, int c); + +#endif diff --git a/includes/update.h b/includes/update.h new file mode 100755 index 0000000..6398d4d --- /dev/null +++ b/includes/update.h @@ -0,0 +1,27 @@ +/** + * Powder Toy - Main source + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +#ifndef UPDATE_H +#define UPDATE_H + +int update_start(char *data, int len); +int update_finish(void); +void update_cleanup(void); + +#endif diff --git a/includes/version.h b/includes/version.h new file mode 100755 index 0000000..41e9672 --- /dev/null +++ b/includes/version.h @@ -0,0 +1,25 @@ +/** + * Powder Toy - Version (Header) + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ +#ifndef VERSION_H +#define VERSION_H + + + +#endif diff --git a/src/Resources/Font-Data b/src/Resources/Font-Data new file mode 100644 index 0000000..a384152 Binary files /dev/null and b/src/Resources/Font-Data differ diff --git a/src/Resources/Font-Pointers b/src/Resources/Font-Pointers new file mode 100644 index 0000000..621258b Binary files /dev/null and b/src/Resources/Font-Pointers differ diff --git a/src/Resources/Icon-16.png b/src/Resources/Icon-16.png new file mode 100755 index 0000000..5e1e1fb Binary files /dev/null and b/src/Resources/Icon-16.png differ diff --git a/src/Resources/Icon-32.png b/src/Resources/Icon-32.png new file mode 100755 index 0000000..1f056bd Binary files /dev/null and b/src/Resources/Icon-32.png differ diff --git a/src/Resources/powder-res.rc b/src/Resources/powder-res.rc new file mode 100644 index 0000000..569b629 --- /dev/null +++ b/src/Resources/powder-res.rc @@ -0,0 +1,2 @@ +#define IDI_ICON1 101 +IDI_ICON1 ICON DISCARDABLE "powder.ico" diff --git a/src/Resources/powder.icns b/src/Resources/powder.icns new file mode 100755 index 0000000..56df7eb Binary files /dev/null and b/src/Resources/powder.icns differ diff --git a/src/Resources/powder.ico b/src/Resources/powder.ico new file mode 100755 index 0000000..cd3f6e0 Binary files /dev/null and b/src/Resources/powder.ico differ diff --git a/src/air.c b/src/air.c new file mode 100644 index 0000000..dd98a12 --- /dev/null +++ b/src/air.c @@ -0,0 +1,141 @@ +#include +#include +#include +#include +float kernel[9]; + +float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; +float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; +float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; + +float cb_vx[YRES/CELL][XRES/CELL], cb_ovx[YRES/CELL][XRES/CELL]; +float cb_vy[YRES/CELL][XRES/CELL], cb_ovy[YRES/CELL][XRES/CELL]; +float cb_pv[YRES/CELL][XRES/CELL], cb_opv[YRES/CELL][XRES/CELL]; + +float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; + +void make_kernel(void) +{ + int i, j; + float s = 0.0f; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + { + kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); + s += kernel[(i+1)+3*(j+1)]; + } + s = 1.0f / s; + for(j=-1; j<2; j++) + for(i=-1; i<2; i++) + kernel[(i+1)+3*(j+1)] *= s; +} +void update_air(void) +{ + int x, y, i, j; + float dp, dx, dy, f, tx, ty; + + for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; + if(dp < -256.0f) dp = -256.0f; + if(dx > 256.0f) dx = 256.0f; + if(dx < -256.0f) dx = -256.0f; + if(dy > 256.0f) dy = 256.0f; + if(dy < -256.0f) dy = -256.0f; + + ovx[y][x] = dx; + ovy[y][x] = dy; + opv[y][x] = dp; + } + memcpy(vx, ovx, sizeof(vx)); + memcpy(vy, ovy, sizeof(vy)); + memcpy(pv, opv, sizeof(pv)); +} diff --git a/src/graphics.c b/src/graphics.c new file mode 100644 index 0000000..7ac641e --- /dev/null +++ b/src/graphics.c @@ -0,0 +1,2567 @@ +#include +#include +#include + +#ifdef OpenGL +#ifdef MACOSX +#include +#include +#else +#include +#include +#endif +#endif + +#include +#include +#include +#include +#include +#include + + +unsigned cmode = 3; +SDL_Surface *sdl_scrn; +int sdl_scale = 1; + +unsigned char fire_r[YRES/CELL][XRES/CELL]; +unsigned char fire_g[YRES/CELL][XRES/CELL]; +unsigned char fire_b[YRES/CELL][XRES/CELL]; + +unsigned int fire_alpha[CELL*3][CELL*3]; +pixel *fire_bg; + +pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f) +{ + int i,j,x,y,w,h,r,g,b,c; + pixel p, *q; + w = (sw+f-1)/f; + h = (sh+f-1)/f; + q = malloc(w*h*PIXELSIZE); + for(y=0; y1) + { + r = (r+c/2)/c; + g = (g+c/2)/c; + b = (b+c/2)/c; + } + q[y*w+x] = PIXRGB(r, g, b); + } + *qw = w; + *qh = h; + return q; +} + +void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0; jpitch/PIXELSIZE; + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} + +void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) +{ + pixel *dst; + int j; + int i,k; + if(SDL_MUSTLOCK(sdl_scrn)) + if(SDL_LockSurface(sdl_scrn)<0) + return; + dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; + for(j=0; jpitch/PIXELSIZE; + } + src+=pitch; + } + if(SDL_MUSTLOCK(sdl_scrn)) + SDL_UnlockSurface(sdl_scrn); + SDL_UpdateRect(sdl_scrn,0,0,0,0); +} + +void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) +{ +#ifdef OpenGL + RenderScene(); +#else + if(sdl_scale == 2) + sdl_blit_2(x, y, w, h, src, pitch); + else + sdl_blit_1(x, y, w, h, src, pitch); +#endif +} + +void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) +{ + blendpixel(vid, x+1, y, cr, cg, cb, 112); + blendpixel(vid, x-1, y, cr, cg, cb, 112); + blendpixel(vid, x, y+1, cr, cg, cb, 112); + blendpixel(vid, x, y-1, cr, cg, cb, 112); + + blendpixel(vid, x+1, y-1, cr, cg, cb, 64); + blendpixel(vid, x-1, y-1, cr, cg, cb, 64); + blendpixel(vid, x+1, y+1, cr, cg, cb, 64); + blendpixel(vid, x-1, y+1, cr, cg, cb, 64); +} + +void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) +{ + int x, y, i, j, c; + int bo = b; + if(iswall==1) + { + b = b-100; + x = (2+32*((b-22)/1)); + y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + x = 2+32*(b/2); + y = YRES+2+20*(b%2); + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + if(bo==sl || bo==sr) + { + c = 0; + if(bo==sl) + c |= PIXPACK(0xFF0000); + if(bo==sr) + c |= PIXPACK(0x0000FF); + for(i=0; i<30; i++) + { + vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; + } + for(j=0; j<18; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; + vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; + } + } +} + +int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) +{ + int i, j, c; + if(b>=121) + { + b = b-100; + //x = (2+32*((b-22)/1)); + //y = YRES+2+40; + switch(b) + { + case WL_WALLELEC: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + else + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); + } + } + } + break; + case 23: + for(j=1; j<15; j++) + { + for(i=1; i<6+j; i++) + { + if(!(i&j&1)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(; i<27; i++) + { + if(i&j&1) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 24: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 25: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); + } + } + for(i=9; i<27; i++) + { + drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); + } + break; + case 26: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); + } + } + drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); + break; + case 27: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 28: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 29: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 30: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<13; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + for(j=1; j<15; j++) + { + for(i=14; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 32: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 33: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + case 34: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + if(!(i%2) && !(j%2)) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + break; + case 36: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); + break; + case 37: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); + break; + case 38: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); + break; + case 39: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); + break; + case 40: + for(j=1; j<15; j+=2) + { + for(i=1+(1&(j>>1)); i<27; i+=2) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + break; + default: + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } + } + if(b==30) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + } + else + { + //x = 2+32*(b/2); + //y = YRES+2+20*(b%2); +#ifdef OpenGL + fillrect(vid_buf, x, y, 28, 16, PIXR(pc), PIXG(pc), PIXB(pc), 255); +#else + for(j=1; j<15; j++) + { + for(i=1; i<27; i++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; + } + } +#endif + if(b==0) + { + for(j=4; j<12; j++) + { + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); + vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); + } + } + c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); + if(c<544) + { + c = 255; + } + else + { + c = 0; + } + drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); + } + return 26; +} + +void draw_menu(pixel *vid_buf, int i, int hover) +{ + drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + if(hover==i) + { + fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + } +} + +#ifdef WIN32 +_inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#else +inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#endif +{ + pixel t; + if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +#ifdef WIN32 +_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +#else +inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) +#endif +{ + int i, j, w, bn = 0, ba = 0; + char *rp = font_data + font_ptrs[c]; + w = *(rp++); + for(j=0; j>= 2; + bn -= 2; + } + return x + w; +} + +int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a) +{ +#ifdef OpenGL +#else + int sx = x; + for(; *s; s++) + { + if(*s == '\n') + { + x = sx; + y += FONT_H+2; + } + else if(*s == '\b') + { + switch(s[1]) + { + case 'w': + r = g = b = 255; + break; + case 'g': + r = g = b = 192; + break; + case 'o': + r = 255; + g = 216; + b = 32; + break; + case 'r': + r = 255; + g = b = 0; + break; + case 'b': + r = g = 0; + b = 255; + break; + } + s++; + } + else + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } +#endif + return x; +} + +void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) +{ +#ifdef OpenGL + glBegin(GL_LINE_LOOP); + glColor4ub(r, g, b, a); + glVertex2i(x, y); + glVertex2i(x+w, y); + glVertex2i(x+w, y+h); + glVertex2i(x, y+h); + glEnd(); +#else + int i; + for(i=0; i<=w; i++) + { + drawpixel(vid, x+i, y, r, g, b, a); + drawpixel(vid, x+i, y+h, r, g, b, a); + } + for(i=1; i=w && x+textwidth(s)>=w+5) + break; + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + if(*s) + for(i=0; i<3; i++) + x = drawchar(vid, x, y, '.', r, g, b, a); + return x; +} + +int textnwidth(char *s, int n) +{ + int x = 0; + for(; *s; s++) + { + if(!n) + break; + x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + n--; + } + return x-1; +} + +int textwidthx(char *s, int w) +{ + int x=0,n=0,cw; + for(; *s; s++) + { + cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + if(x+(cw/2) >= w) + break; + x += cw; + n++; + } + return n; +} + +#ifdef WIN32 +_inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#else +inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +#endif +{ +#ifdef OpenGL + if(x<0 || y<0 || x>=XRES || r>=YRES) + return; + if(a!=255) + { + glBegin (GL_QUADS); + glColor4ub(r,g,b,a); + glVertex2i(x, y); + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +#else + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + if(a!=255) + { + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + (255-a)*PIXR(t)) >> 8; + g = (a*g + (255-a)*PIXG(t)) >> 8; + b = (a*b + (255-a)*PIXB(t)) >> 8; + } + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +#endif //OpenGL +} + +void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) +{ + char t[2]; + t[0] = ch; + t[1] = 0; + if(flag) + { + fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); + } + else + { + drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); + drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); + } +} + +void draw_air(pixel *vid) +{ + int x, y, i, j; + pixel c; + + if(cmode == 2) + return; + + for(y=0; y 0.0f) + c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); + else + c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); + } + else + c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), + clamp_flt(pv[y][x], 0.0f, 8.0f), + clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); + for(j=0; jdx) + { + dx = dx+dy; + dy = dx-dy; + dx = dx-dy; + check = 1; + } + + e = (dy<<2)-dx; + for (i=0; i<=dx; i++) + { + vid[x+y*a] =PIXRGB(r, g, b); + if (e>=0) + { + if (check==1) + x = x+sx; + else + y = y+sy; + e = e-(dx<<2); + } + if (check==1) + y = y+sy; + else + x = x+sx; + e = e+(dy<<2); + } +} + +void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) +{ + pixel t; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + t = vid[y*(XRES+BARSIZE)+x]; + r = (a*r + 255*PIXR(t)) >> 8; + g = (a*g + 255*PIXG(t)) >> 8; + b = (a*b + 255*PIXB(t)) >> 8; + if(r>255) + r = 255; + if(g>255) + g = 255; + if(b>255) + b = 255; + vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); +} + +void xor_pixel(int x, int y, pixel *vid) +{ + int c; + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + c = vid[y*(XRES+BARSIZE)+x]; + c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); + if(c<512) + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); + else + vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); +} + +void xor_line(int x1, int y1, int x2, int y2, pixel *vid) +{ + int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + e -= 1.0f; + } + } +} + +void xor_rect(pixel *vid, int x, int y, int w, int h) +{ + int i; + for(i=0; i(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; + vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; + vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; + vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; + } + draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); + draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); + draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); + draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); + + isplayer = 1; //It's a secret. Tssss... + } + if(t==PT_MWAX&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,224,224,170,255); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,224,224,170,20); + else + blendpixel(vid,x+nx,y+ny,224,224,170,40); + } + } + + } + else if(t==PT_ACID) + { + if(parts[i].life>255) parts[i].life = 255; + if(parts[i].life<47) parts[i].life = 48; + s = (255/((parts[i].life-46)*28)); + if(s==0) s = 1; + cr = PIXR(ptypes[t].pcolors)/s; + cg = PIXG(ptypes[t].pcolors)/s; + cb = PIXB(ptypes[t].pcolors)/s; + if(cmode==6) { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); + } + } + } else { + blendpixel(vid, nx, ny, cr, cg, cb, 255); + } + + if(cmode==4) + { + blendpixel(vid, nx+1, ny, cr, cg, cb, 223); + blendpixel(vid, nx-1, ny, cr, cg, cb, 223); + blendpixel(vid, nx, ny+1, cr, cg, cb, 223); + blendpixel(vid, nx, ny-1, cr, cg, cb, 223); + + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); + } + } + else if(t==PT_OIL&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,64,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,64,16,40); + } + } + } + else if(t==PT_NEUT) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 8; + cb = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = 0x20; + cg = 0xE0; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_PLUT&&cmode == 6) + { + int tempx; + int tempy; + cr = 0x40; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(tempx = 2; tempx < 10; tempx++) { + for(tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_URAN&&cmode == 6) + { + int tempx; + int tempy; + cr = 0x70; + cg = 0x70; + cb = 0x20; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(tempx = 2; tempx < 10; tempx++) { + for(tempy = 2; tempy < 10; tempy++) { + blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } else if(t==PT_SLTW&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,64,80,240,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,64,80,240,50); + } + } + } + else if(t==PT_PHOT) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 12; + cb = 12; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xFF; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_SWCH && parts[i].life == 10) + { + x = nx; + y = ny; + blendpixel(vid,x,y,17,217,24,255); + } + else if(t==PT_LNTG&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,128,160,223,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,128,160,223,50); + } + } + } + else if(t==PT_SMKE) + { + if(cmode == 3||cmode==4 || cmode==6) + { + x = nx/CELL; + y = ny/CELL; + cg = 10; + cb = 10; + cr = 10; + cg += fire_g[y][x]; + if(cg > 50) cg = 50; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 50) cb = 50; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 50) cr = 50; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny,100,100,100,30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny,100,100,100,10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny,100,100,100,20); + } + } + } + } + else if(t==PT_WATR&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + + } else if(t==PT_DSTW&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,48,208,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,48,208,50); + } + } + } + else if(t==PT_NITR&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,32,224,16,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,32,224,16,50); + } + } + + } + else if(t==PT_LRBD&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,170,170,170,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,170,170,170,50); + } + } + + } + + else if(t==PT_NBLE&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,235,73,23,100); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,235,73,23,30); + else + blendpixel(vid,x+nx,y+ny,235,73,23,50); + } + } + + } + else if(t==PT_GAS&&cmode == 6) + { + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,255,255,0,180); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,255,255,0,50); + else + blendpixel(vid,x+nx,y+ny,255,255,0,80); + } + } + + } + else if(t==PT_WTRV) + { + if(cmode == 3||cmode==4 || cmode==6) + { + x = nx/CELL; + y = ny/CELL; + cg = PIXG(ptypes[t].pcolors)/3; + cb = PIXB(ptypes[t].pcolors)/3; + cr = PIXR(ptypes[t].pcolors)/3; + cg += fire_g[y][x]; + if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; + fire_r[y][x] = cr; + } + else + { + for(x=-3; x<4; x++) + { + for(y=-3; y<4; y++) + { + if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); + if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); + if (abs(x)+abs(y) == 2) + blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); + } + } + } + } + else if(t==PT_THDR) + { + if(cmode == 3||cmode==4 || cmode==6) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + cg = 16; + cb = 20; + cr = 12; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = 0xFF; + cg = 0xFF; + cb = 0xA0; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_GLOW) + { + fg = 0; + fb = 0; + fr = 0; + if(pv[ny/CELL][nx/CELL]>0) { + fg = 6 * pv[ny/CELL][nx/CELL]; + fb = 4 * pv[ny/CELL][nx/CELL]; + fr = 2 * pv[ny/CELL][nx/CELL]; + } + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255)); + if(cmode == 3||cmode==4 || cmode==6) + { + x = nx/CELL; + y = ny/CELL; + fg += fire_g[y][x]; + if(fg > 255) fg = 255; + fire_g[y][x] = fg; + fb += fire_b[y][x]; + if(fb > 255) fb = 255; + fire_b[y][x] = fb; + fr += fire_r[y][x]; + if(fr > 255) fr = 255; + fire_r[y][x] = fr; + } + if(cmode == 4) { + uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255); + uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255); + uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255); + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + } + else if(t==PT_LCRY) + { + uint8 GR = 0x50+(parts[i].life*10); + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, GR); + if(cmode == 4) { + blendpixel(vid, nx+1, ny, GR, GR, GR, 223); + blendpixel(vid, nx-1, ny, GR, GR, GR, 223); + blendpixel(vid, nx, ny+1, GR, GR, GR, 223); + blendpixel(vid, nx, ny-1, GR, GR, GR, 223); + + blendpixel(vid, nx+1, ny-1, GR, GR, GR, 112); + blendpixel(vid, nx-1, ny-1, GR, GR, GR, 112); + blendpixel(vid, nx+1, ny+1, GR, GR, GR, 112); + blendpixel(vid, nx-1, ny+1, GR, GR, GR, 112); + } + } + else if(t==PT_PCLN) + { + uint8 GR = 0x3B+(parts[i].life*19); + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, 10); + if(cmode == 4) { + blendpixel(vid, nx+1, ny, GR, GR, 10, 223); + blendpixel(vid, nx-1, ny, GR, GR, 10, 223); + blendpixel(vid, nx, ny+1, GR, GR, 10, 223); + blendpixel(vid, nx, ny-1, GR, GR, 10, 223); + + blendpixel(vid, nx+1, ny-1, GR, GR, 10, 112); + blendpixel(vid, nx-1, ny-1, GR, GR, 10, 112); + blendpixel(vid, nx+1, ny+1, GR, GR, 10, 112); + blendpixel(vid, nx-1, ny+1, GR, GR, 10, 112); + } + } + else if(t==PT_HSWC) + { + uint8 GR = 0x3B+(parts[i].life*19); + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, 10, 10); + if(cmode == 4) { + blendpixel(vid, nx+1, ny, GR, 10, 10, 223); + blendpixel(vid, nx-1, ny, GR, 10, 10, 223); + blendpixel(vid, nx, ny+1, GR, 10, 10, 223); + blendpixel(vid, nx, ny-1, GR, 10, 10, 223); + + blendpixel(vid, nx+1, ny-1, GR, 10, 10, 112); + blendpixel(vid, nx-1, ny-1, GR, 10, 10, 112); + blendpixel(vid, nx+1, ny+1, GR, 10, 10, 112); + blendpixel(vid, nx-1, ny+1, GR, 10, 10, 112); + } + } + else if(t==PT_PLSM) + { + float ttemp = (float)parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = plasma_data[caddress]; + uint8 G = plasma_data[caddress+1]; + uint8 B = plasma_data[caddress+2]; + if(cmode == 3||cmode==4 || cmode==6) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_HFLM) + { + float ttemp = (float)parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = hflm_data[caddress]; + uint8 G = hflm_data[caddress+1]; + uint8 B = hflm_data[caddress+2]; + if(cmode == 3||cmode==4 || cmode==6) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } else if(t==PT_FIRW&&parts[i].tmp==3) + { + float ttemp = (float)parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = firw_data[caddress]; + uint8 G = firw_data[caddress+1]; + uint8 B = firw_data[caddress+2]; + if(cmode == 3||cmode==4 || cmode==6) + { + cr = R/2; + cg = G/2; + cb = B/2; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_FIRE && parts[i].life) + { + if(cmode == 3||cmode==4 || cmode==6) + { + cr = parts[i].life / 4; + cg = parts[i].life / 16; + cb = parts[i].life / 32; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + else + { + cr = parts[i].life * 8; + cg = parts[i].life * 2; + cb = parts[i].life; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + } + else if(t==PT_LAVA && parts[i].life) + { + cr = parts[i].life * 2 + 0xE0; + cg = parts[i].life * 1 + 0x50; + cb = parts[i].life/2 + 0x10; + if(cr>255) cr = 255; + if(cg>192) cg = 192; + if(cb>128) cb = 128; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 64); + blendpixel(vid, nx-1, ny, cr, cg, cb, 64); + blendpixel(vid, nx, ny+1, cr, cg, cb, 64); + blendpixel(vid, nx, ny-1, cr, cg, cb, 64); + if(cmode == 3||cmode==4 || cmode==6) + { + cr /= 32; + cg /= 32; + cb /= 32; + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else if(t==PT_LAVA || t==PT_SPRK) + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + if(cmode == 3 || cmode==4 || cmode==6) + { + if(t == PT_LAVA) + { + cr = 3; + cg = i%2; + cb = 0; + } + else + { + cr = 8; + cg = 12; + cb = 16; + } + x = nx/CELL; + y = ny/CELL; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + else + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + } + else + { + float ttemp = parts[i].temp+(-MIN_TEMP); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); + uint8 R = color_data[caddress]; + uint8 G = color_data[caddress+1]; + uint8 B = color_data[caddress+2]; + + if(t==PT_STKM) //Stick man should be visible in heat mode + { + char buff[10]; //Buffer for HP + + if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head + { + sprintf(buff, "%3d", parts[i].life); //Show HP + drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); + } + + for(r=-2; r<=1; r++) + { + s = XRES+BARSIZE; + vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); + vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); + vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); + vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); + } + draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); + draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); + draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); + draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); + + isplayer = 1; //It's a secret. Tssss... + } + else + { + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); + //blendpixel(vid, nx+1, ny, R, G, B, 255); + } + } + if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_HFLM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH&&t!=PT_SMKE&&t!=PT_WTRV&&!(t==PT_FIRW&&parts[i].tmp==3)) + { + uint8 R = PIXR(ptypes[t].pcolors); + uint8 G = PIXG(ptypes[t].pcolors); + uint8 B = PIXB(ptypes[t].pcolors); + + //if(vid[(ny-1)*YRES+(nx-1)]!=0){ + // blendpixel(vid, nx, ny-1, R, G, B, 46); + //} + + blendpixel(vid, nx+1, ny, R, G, B, 223); + blendpixel(vid, nx-1, ny, R, G, B, 223); + blendpixel(vid, nx, ny+1, R, G, B, 223); + blendpixel(vid, nx, ny-1, R, G, B, 223); + + blendpixel(vid, nx+1, ny-1, R, G, B, 112); + blendpixel(vid, nx-1, ny-1, R, G, B, 112); + blendpixel(vid, nx+1, ny+1, R, G, B, 112); + blendpixel(vid, nx-1, ny+1, R, G, B, 112); + } + } +#endif + } +#ifdef OpenGL + glFlush (); +#endif + +} + +void render_signs(pixel *vid_buf) +{ + int i, j, x, y, w, h, dx, dy; + char buff[30]; //Buffer + for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp-273.15); //...tempirature + else + sprintf(buff, "Temp: 0.00"); //...tempirature + drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); + } + + //Usual text + if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) + drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); + x = signs[i].x; + y = signs[i].y; + dx = 1 - signs[i].ju; + dy = (signs[i].y > 18) ? -1 : 1; + for(j=0; j<4; j++) + { + drawpixel(vid_buf, x, y, 192, 192, 192, 255); + x+=dx; + y+=dy; + } + } +} + +void render_fire(pixel *dst) +{ + int i,j,x,y,r,g,b; + for(j=0; j=0 && j+y>=0 && i+x4 ? r-4 : 0; + fire_g[j][i] = g>4 ? g-4 : 0; + fire_b[j][i] = b>4 ? b-4 : 0; + } +} + +void prepare_alpha(void) +{ + int x,y,i,j; + float temp[CELL*3][CELL*3]; + memset(temp, 0, sizeof(temp)); + for(x=0; x0) + r--; + if(g>0) + g--; + if(b>0) + b--; + dst[i] = PIXRGB(r,g,b); + } +} + +void render_zoom(pixel *img) +{ + int x, y, i, j; + pixel pix; + drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); + drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); + clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); + for(j=0; jSAVE_VERSION) + return NULL; + + bw = c[6]; + bh = c[7]; + w = bw*CELL; + h = bh*CELL; + + if(c[5]!=CELL) + return NULL; + + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return NULL; + fb = calloc(w*h, PIXELSIZE); + if(!fb) + { + free(d); + return NULL; + } + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + goto corrupt; + size = i; + + if(size < bw*bh) + goto corrupt; + + k = 0; + for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) + goto corrupt; + + for(y=0; y= size) + goto corrupt; + j=d[p++]; + if(j0) + { + if(j==PT_STKM) //Stickman should be drawed another way + { + //Stickman drawing + for(k=-2; k<=1; k++) + { + fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); + fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); + fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); + fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); + } + draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); + draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); + draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); + draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); + } + else + fb[y*w+x] = ptypes[j].pcolors; + } + } + + free(d); + *width = w; + *height = h; + return fb; + +corrupt: + free(d); + free(fb); + return NULL; +} + +int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl) +{ + unsigned char *d,*c=thumb; + int i,j,x,y,a,t,r,g,b,sx,sy; + + if(bzip2) + { + if(size<16) + return 1; + if(c[3]!=0x74 || c[2]!=0x49 || c[1]!=0x68 || c[0]!=0x53) + return 1; + if(c[4]>PT_NUM) + return 2; + if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) + return 3; + i = XRES*YRES; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) + return 1; + size = i; + } + else + d = c; + + if(size < XRES*YRES) + { + if(bzip2) + free(d); + return 1; + } + + sy = 0; + for(y=0; y+scl<=YRES; y+=scl) + { + sx = 0; + for(x=0; x+scl<=XRES; x+=scl) + { + a = 0; + r = g = b = 0; + for(j=0; j=PT_NUM) + goto corrupt; + r += PIXR(ptypes[t].pcolors); + g += PIXG(ptypes[t].pcolors); + b += PIXB(ptypes[t].pcolors); + a ++; + } + } + if(a) + { + a = 256/a; + r = (r*a)>>8; + g = (g*a)>>8; + b = (b*a)>>8; + } + + drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); + sx++; + } + sy++; + } + + if(bzip2) + free(d); + return 0; + +corrupt: + if(bzip2) + free(d); + return 1; +} + +void render_cursor(pixel *vid, int x, int y, int t, int r) +{ + int i,j,c; + if(tr*r || i*i+(j+1)*(j+1)>r*r)) + { + xor_pixel(x+i, y+j, vid); + if(j) xor_pixel(x+i, y-j, vid); + if(i) xor_pixel(x-i, y+j, vid); + if(i&&j) xor_pixel(x-i, y-j, vid); + } + } + else + { + int tc; + c = (r/CELL) * CELL; + x = (x/CELL) * CELL; + y = (y/CELL) * CELL; + + tc = !((c%(CELL*2))==0); + + x -= c/2; + y -= c/2; + + x += tc*(CELL/2); + y += tc*(CELL/2); + + for(i=0; i +#include +#include +#ifndef MACOSX +#include +#endif +#include +#ifdef WIN32 +#define _WIN32_WINNT 0x0501 +//#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#endif + +#include +#include +#include + +#ifdef WIN32 +#define PERROR SOCKET_ERROR +#define PERRNO WSAGetLastError() +#define PEAGAIN WSAEWOULDBLOCK +#define PEINTR WSAEINTR +#define PEINPROGRESS WSAEINPROGRESS +#define PEALREADY WSAEALREADY +#define PCLOSE closesocket +#else +#define PERROR -1 +#define PERRNO errno +#define PEAGAIN EAGAIN +#define PEINTR EINTR +#define PEINPROGRESS EINPROGRESS +#define PEALREADY EALREADY +#define PCLOSE close +#endif + +static int http_up = 0; +static long http_timeout = 15; +static int http_use_proxy = 0; +static struct sockaddr_in http_proxy; + +static char *mystrdup(char *s) +{ + char *x; + if(s) + { + x = malloc(strlen(s)+1); + strcpy(x, s); + return x; + } + return s; +} + +static int splituri(char *uri, char **host, char **path) +{ + char *p=uri,*q,*x,*y; + if(!strncmp(p, "http://", 7)) + p += 7; + q = strchr(p, '/'); + if(!q) + q = p + strlen(p); + x = malloc(q-p+1); + if(*q) + y = mystrdup(q); + else + y = mystrdup("/"); + strncpy(x, p, q-p); + x[q-p] = 0; + if(q==p || x[q-p-1]==':') + { + free(x); + free(y); + return 1; + } + *host = x; + *path = y; + return 0; +} + +static char *getserv(char *host) +{ + char *q, *x = mystrdup(host); + q = strchr(x, ':'); + if(q) + *q = 0; + return x; +} + +static char *getport(char *host) +{ + char *p, *q; + q = strchr(host, ':'); + if(q) + p = mystrdup(q+1); + else + p = mystrdup("80"); + return p; +} + +static int resolve(char *dns, char *srv, struct sockaddr_in *addr) +{ + struct addrinfo hnt, *res = 0; + if(http_use_proxy) + { + memcpy(addr, &http_proxy, sizeof(struct sockaddr_in)); + return 0; + } + memset(&hnt, 0, sizeof(hnt)); + hnt.ai_family = AF_INET; + hnt.ai_socktype = SOCK_STREAM; + if(getaddrinfo(dns, srv, &hnt, &res)) + return 1; + if(res) + { + if(res->ai_family != AF_INET) + { + freeaddrinfo(res); + return 1; + } + memcpy(addr, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); + return 0; + } + return 1; +} + +void http_init(char *proxy) +{ + char *host, *port; +#ifdef WIN32 + WSADATA wsadata; + if(!WSAStartup(MAKEWORD(2,2), &wsadata)) + http_up = 1; +#else + signal(SIGPIPE, SIG_IGN); + http_up = 1; +#endif + if(proxy) + { + host = getserv(proxy); + port = getport(proxy); + if(resolve(host, port, &http_proxy)) + http_up = 0; + else + http_use_proxy = 1; + free(host); + free(port); + } +} + +void http_done(void) +{ +#ifdef WIN32 + WSACleanup(); +#endif + http_up = 0; +} + +#define CHUNK 4096 + +#define HTS_STRT 0 +#define HTS_RSLV 1 +#define HTS_CONN 2 +#define HTS_IDLE 3 +#define HTS_XMIT 4 +#define HTS_RECV 5 +#define HTS_DONE 6 +struct http_ctx +{ + int state; + time_t last; + int keep; + int ret; + char *host, *path; + char *thdr; + int thlen; + char *txd; + int txdl; + struct sockaddr_in addr; + char *tbuf; + int tlen, tptr; + char *hbuf; + int hlen, hptr; + char *rbuf; + int rlen, rptr; + int chunked, chunkhdr, rxtogo, contlen, cclose; + int fd; + char *fdhost; +}; +void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep) +{ + struct http_ctx *cx = ctx; + if(!ctx) + { + ctx = calloc(1, sizeof(struct http_ctx)); + cx = ctx; + cx->fd = PERROR; + } + + if(!cx->hbuf) + { + cx->hbuf = malloc(256); + cx->hlen = 256; + } + + if(!http_up) + { + cx->ret = 604; + cx->state = HTS_DONE; + return ctx; + } + + if(cx->state!=HTS_STRT && cx->state!=HTS_IDLE) + { + fprintf(stderr, "HTTP: unclean request restart state.\n"); + exit(1); + } + + cx->keep = keep; + cx->ret = 600; + if(splituri(uri, &cx->host, &cx->path)) + { + cx->ret = 601; + cx->state = HTS_DONE; + return ctx; + } + if(http_use_proxy) + { + free(cx->path); + cx->path = mystrdup(uri); + } + if(cx->fdhost && strcmp(cx->host, cx->fdhost)) + { + free(cx->fdhost); + cx->fdhost = NULL; + PCLOSE(cx->fd); + cx->fd = PERROR; + cx->state = HTS_STRT; + } + if(data) + { + if(!dlen) + dlen = strlen(data); + cx->txd = malloc(dlen); + memcpy(cx->txd, data, dlen); + cx->txdl = dlen; + } + else + cx->txdl = 0; + + cx->contlen = 0; + cx->chunked = 0; + cx->chunkhdr = 0; + cx->rxtogo = 0; + cx->cclose = 0; + + cx->tptr = 0; + cx->tlen = 0; + + cx->last = time(NULL); + + return ctx; +} + +void http_async_add_header(void *ctx, char *name, char *data) +{ + struct http_ctx *cx = ctx; + cx->thdr = realloc(cx->thdr, cx->thlen + strlen(name) + strlen(data) + 4); + cx->thlen += sprintf(cx->thdr+cx->thlen, "%s: %s\n", name, data); +} + +static void process_header(struct http_ctx *cx, char *str) +{ + char *p; + if(cx->chunkhdr) + { + p = strchr(str, ';'); + if(p) + *p = 0; + cx->rxtogo = strtoul(str, NULL, 16); + cx->chunkhdr = 0; + if(!cx->rxtogo) + cx->chunked = 0; + } + if(!str[0]) + { + cx->rxtogo = cx->contlen; + cx->chunkhdr = cx->chunked; + if(!cx->contlen && !cx->chunked && cx->ret!=100) + cx->state = HTS_DONE; + return; + } + if(!strncmp(str, "HTTP/", 5)) + { + p = strchr(str, ' '); + if(!p) + { + cx->ret = 603; + cx->state = HTS_DONE; + return; + } + p++; + cx->ret = atoi(p); + return; + } + if(!strncmp(str, "Content-Length: ", 16)) + { + cx->contlen = atoi(str+16); + return; + } + if(!strcmp(str, "Transfer-Encoding: chunked")) + { + cx->chunked = 1; + return; + } + if(!strcmp(str, "Connection: close")) + { + cx->cclose = 1; + return; + } +} + +static void process_byte(struct http_ctx *cx, char ch) +{ + if(cx->rxtogo) + { + cx->rxtogo--; + + if(!cx->rbuf) + { + cx->rbuf = malloc(256); + cx->rlen = 256; + } + if(cx->rptr >= cx->rlen-1) + { + cx->rlen *= 2; + cx->rbuf = realloc(cx->rbuf, cx->rlen); + } + cx->rbuf[cx->rptr++] = ch; + + if(!cx->rxtogo && !cx->chunked) + cx->state = HTS_DONE; + } + else + { + if(ch == '\n') + { + cx->hbuf[cx->hptr] = 0; + process_header(cx, cx->hbuf); + cx->hptr = 0; + } + else if(ch != '\r') + { + if(cx->hptr >= cx->hlen-1) + { + cx->hlen *= 2; + cx->hbuf = realloc(cx->hbuf, cx->hlen); + } + cx->hbuf[cx->hptr++] = ch; + } + } +} + +int http_async_req_status(void *ctx) +{ + struct http_ctx *cx = ctx; + char *dns,*srv,buf[CHUNK]; + int tmp, i; + time_t now = time(NULL); +#ifdef WIN32 + unsigned long tmp2; +#endif + + switch(cx->state) + { + case HTS_STRT: + dns = getserv(cx->host); + srv = getport(cx->host); + if(resolve(dns, srv, &cx->addr)) + { + free(dns); + free(srv); + cx->state = HTS_DONE; + cx->ret = 602; + return 1; + } + free(dns); + free(srv); + cx->state = HTS_RSLV; + return 0; + case HTS_RSLV: + cx->state = HTS_CONN; + cx->last = now; + return 0; + case HTS_CONN: + if(cx->fd == PERROR) + { + cx->fd = socket(AF_INET, SOCK_STREAM, 0); + if(cx->fd == PERROR) + goto fail; + cx->fdhost = mystrdup(cx->host); +#ifdef WIN32 + tmp2 = 1; + if(ioctlsocket(cx->fd, FIONBIO, &tmp2) == SOCKET_ERROR) + goto fail; +#else + tmp = fcntl(cx->fd, F_GETFL); + if(tmp < 0) + goto fail; + if(fcntl(cx->fd, F_SETFL, tmp|O_NONBLOCK) < 0) + goto fail; +#endif + } + if(!connect(cx->fd, (struct sockaddr *)&cx->addr, sizeof(cx->addr))) + cx->state = HTS_IDLE; +#ifdef WIN32 + else if(PERRNO==WSAEISCONN) + cx->state = HTS_IDLE; +#endif +#ifdef MACOSX + else if(PERRNO==EISCONN) + cx->state = HTS_IDLE; +#endif + else if(PERRNO!=PEINPROGRESS && PERRNO!=PEALREADY +#ifdef WIN32 + && PERRNO!=PEAGAIN && PERRNO!=WSAEINVAL +#endif + ) + goto fail; + if(now-cx->last>http_timeout) + goto timeout; + return 0; + case HTS_IDLE: + if(cx->txdl) + { + // generate POST + cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 121 + cx->txdl + cx->thlen); + cx->tptr = 0; + cx->tlen = 0; + cx->tlen += sprintf(cx->tbuf+cx->tlen, "POST %s HTTP/1.1\n", cx->path); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host); + if(!cx->keep) + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n"); + if(cx->thdr) + { + memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen); + cx->tlen += cx->thlen; + free(cx->thdr); + cx->thdr = NULL; + cx->thlen = 0; + } + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Content-Length: %d\n", cx->txdl); +#ifdef BETA + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); +#else + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dS%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); +#endif + cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n"); + memcpy(cx->tbuf+cx->tlen, cx->txd, cx->txdl); + cx->tlen += cx->txdl; + free(cx->txd); + cx->txd = NULL; + cx->txdl = 0; + } + else + { + // generate GET + cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 89 + cx->thlen); + cx->tptr = 0; + cx->tlen = 0; + cx->tlen += sprintf(cx->tbuf+cx->tlen, "GET %s HTTP/1.1\n", cx->path); + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host); + if(cx->thdr) + { + memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen); + cx->tlen += cx->thlen; + free(cx->thdr); + cx->thdr = NULL; + cx->thlen = 0; + } + if(!cx->keep) + cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n"); +#ifdef BETA + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); +#else + cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dS%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); +#endif + cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n"); + } + cx->state = HTS_XMIT; + cx->last = now; + return 0; + case HTS_XMIT: + tmp = send(cx->fd, cx->tbuf+cx->tptr, cx->tlen-cx->tptr, 0); + if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR) + goto fail; + if(tmp!=PERROR) + { + cx->tptr += tmp; + if(cx->tptr == cx->tlen) + { + cx->tptr = 0; + cx->tlen = 0; + if(cx->tbuf) + free(cx->tbuf); + cx->state = HTS_RECV; + } + cx->last = now; + } + if(now-cx->last>http_timeout) + goto timeout; + return 0; + case HTS_RECV: + tmp = recv(cx->fd, buf, CHUNK, 0); + if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR) + goto fail; + if(tmp!=PERROR) + { + for(i=0; istate == HTS_DONE) + return 1; + } + cx->last = now; + } + if(now-cx->last>http_timeout) + goto timeout; + return 0; + case HTS_DONE: + return 1; + } + return 0; + +fail: + cx->ret = 600; + cx->state = HTS_DONE; + return 1; + +timeout: + cx->ret = 605; + cx->state = HTS_DONE; + return 1; +} + +char *http_async_req_stop(void *ctx, int *ret, int *len) +{ + struct http_ctx *cx = ctx; + char *rxd; + + if(cx->state != HTS_DONE) + while(!http_async_req_status(ctx)) ; + + if(cx->host) + { + free(cx->host); + cx->host = NULL; + } + if(cx->path) + { + free(cx->path); + cx->path = NULL; + } + if(cx->txd) + { + free(cx->txd); + cx->txd = NULL; + cx->txdl = 0; + } + if(cx->hbuf) + { + free(cx->hbuf); + cx->hbuf = NULL; + } + if(cx->thdr) + { + free(cx->thdr); + cx->thdr = NULL; + cx->thlen = 0; + } + + if(ret) + *ret = cx->ret; + if(len) + *len = cx->rptr; + if(cx->rbuf) + cx->rbuf[cx->rptr] = 0; + rxd = cx->rbuf; + cx->rbuf = NULL; + cx->rlen = 0; + cx->rptr = 0; + cx->contlen = 0; + + if(!cx->keep) + http_async_req_close(ctx); + else if(cx->cclose) + { + PCLOSE(cx->fd); + cx->fd = PERROR; + if(cx->fdhost) + { + free(cx->fdhost); + cx->fdhost = NULL; + } + cx->state = HTS_STRT; + } + else + cx->state = HTS_IDLE; + + return rxd; +} + +void http_async_get_length(void *ctx, int *total, int *done) +{ + struct http_ctx *cx = ctx; + if(done) + *done = cx->rptr; + if(total) + *total = cx->contlen; +} + +void http_async_req_close(void *ctx) +{ + struct http_ctx *cx = ctx; + void *tmp; + if(cx->host) + { + cx->keep = 1; + tmp = http_async_req_stop(ctx, NULL, NULL); + if(tmp) + free(tmp); + } + if(cx->fdhost) + free(cx->fdhost); + PCLOSE(cx->fd); + free(ctx); +} + +char *http_simple_get(char *uri, int *ret, int *len) +{ + void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0); + if(!ctx) + { + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; + } + return http_async_req_stop(ctx, ret, len); +} +static char hex[] = "0123456789abcdef"; +void http_auth_headers(void *ctx, char *user, char *pass) +{ + char *tmp; + int i; + unsigned char hash[16]; + unsigned int m; + struct md5_context md5; + + if(user) + { + http_async_add_header(ctx, "X-Auth-User", user); + if(pass) + { + md5_init(&md5); + md5_update(&md5, (unsigned char *)user, strlen(user)); + md5_update(&md5, (unsigned char *)"-", 1); + m = 0; + + md5_update(&md5, (unsigned char *)pass, strlen(pass)); + md5_final(hash, &md5); + tmp = malloc(33); + for(i=0; i<16; i++) + { + tmp[i*2] = hex[hash[i]>>4]; + tmp[i*2+1] = hex[hash[i]&15]; + } + tmp[32] = 0; + http_async_add_header(ctx, "X-Auth-Hash", tmp); + free(tmp); + } + } +} +char *http_auth_get(char *uri, char *user, char *pass, int *ret, int *len) +{ + void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0); + + if(!ctx) + { + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; + } + return http_async_req_stop(ctx, ret, len); +} + +char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len) +{ + void *ctx = http_async_req_start(NULL, uri, data, dlen, 0); + if(!ctx) + { + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; + } + return http_async_req_stop(ctx, ret, len); +} + +char *http_ret_text(int ret) +{ + switch(ret) + { + case 100: + return "Continue"; + case 101: + return "Switching Protocols"; + case 102: + return "Processing"; + + case 200: + return "OK"; + case 201: + return "Created"; + case 202: + return "Accepted"; + case 203: + return "Non-Authoritative Information"; + case 204: + return "No Content"; + case 205: + return "Reset Content"; + case 206: + return "Partial Content"; + case 207: + return "Multi-Status"; + + case 300: + return "Multiple Choices"; + case 301: + return "Moved Permanently"; + case 302: + return "Found"; + case 303: + return "See Other"; + case 304: + return "Not Modified"; + case 305: + return "Use Proxy"; + case 306: + return "Switch Proxy"; + case 307: + return "Temporary Redirect"; + + case 400: + return "Bad Request"; + case 401: + return "Unauthorized"; + case 402: + return "Payment Required"; + case 403: + return "Forbidden"; + case 404: + return "Not Found"; + case 405: + return "Method Not Allowed"; + case 406: + return "Not Acceptable"; + case 407: + return "Proxy Authentication Required"; + case 408: + return "Request Timeout"; + case 409: + return "Conflict"; + case 410: + return "Gone"; + case 411: + return "Length Required"; + case 412: + return "Precondition Failed"; + case 413: + return "Request Entity Too Large"; + case 414: + return "Request URI Too Long"; + case 415: + return "Unsupported Media Type"; + case 416: + return "Requested Range Not Satisfiable"; + case 417: + return "Expectation Failed"; + case 422: + return "Unprocessable Entity"; + case 423: + return "Locked"; + case 424: + return "Failed Dependency"; + case 425: + return "Unordered Collection"; + case 426: + return "Upgrade Required"; + + case 500: + return "Internal Server Error"; + case 501: + return "Not Implemented"; + case 502: + return "Bad Gateway"; + case 503: + return "Service Unavailable"; + case 504: + return "Gateway Timeout"; + case 505: + return "HTTP Version Not Supported"; + case 506: + return "Variant Also Negotiates"; + case 507: + return "Insufficient Storage"; + case 509: + return "Bandwidth Limit Exceeded"; + case 510: + return "Not Extended"; + + case 600: + return "Internal Client Error"; + case 601: + return "Unsupported Protocol"; + case 602: + return "Server Not Found"; + case 603: + return "Malformed Response"; + case 604: + return "Network Not Available"; + case 605: + return "Request Timed Out"; + default: + return "Unknown Status Code"; + } +} +char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, int *ret, int *len) +{ + void *ctx; + char *data = NULL, *tmp, *p; + int dlen = 0, i, j; + unsigned char hash[16]; + unsigned char boundary[32], ch; + int blen = 0; + unsigned int map[62], m; + struct md5_context md5; + //struct md5_context md52; + int own_plen = 0; + + if(names) + { + if(!plens) + { + own_plen = 1; + for(i=0; names[i]; i++) ; + plens = calloc(i, sizeof(int)); + for(i=0; names[i]; i++) + plens[i] = strlen(parts[i]); + } + +retry: + if(blen >= 31) + goto fail; + memset(map, 0, 62*sizeof(int)); + for(i=0; names[i]; i++) + { + for(j=0; j='0' && ch<='9') + map[ch-'0']++; + else if(ch>='A' && ch<='Z') + map[ch-'A'+10]++; + else if(ch>='a' && ch<='z') + map[ch-'a'+36]++; + } + } + m = ~0; + j = 61; + for(i=0; i<62; i++) + if(map[i]>4]; + tmp[i*2+1] = hex[hash[i]&15]; + } + tmp[32] = 0; + http_async_add_header(ctx, "X-Auth-Hash", tmp); + free(tmp); + } + } + + if(data) + { + tmp = malloc(32+strlen((char *)boundary)); + sprintf(tmp, "multipart/form-data, boundary=%s", boundary); + http_async_add_header(ctx, "Content-type", tmp); + free(tmp); + free(data); + } + + if(own_plen) + free(plens); + return http_async_req_stop(ctx, ret, len); + +fail: + if(data) + free(data); + if(own_plen) + free(plens); + if(ret) + *ret = 600; + if(len) + *len = 0; + return NULL; +} diff --git a/src/interface.c b/src/interface.c new file mode 100644 index 0000000..bdec111 --- /dev/null +++ b/src/interface.c @@ -0,0 +1,2961 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +SDLMod sdl_mod; +int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; + +char *shift_0="`1234567890-=[]\\;',./"; +char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; + +int svf_login = 0; +int svf_admin = 0; +int svf_mod = 0; +char svf_user[64] = ""; +char svf_pass[64] = ""; + +int svf_open = 0; +int svf_own = 0; +int svf_myvote = 0; +int svf_publish = 0; +char svf_id[16] = ""; +char svf_name[64] = ""; +char svf_tags[256] = ""; +void *svf_last = NULL; +int svf_lsize; + +char *search_ids[GRID_X*GRID_Y]; +char *search_dates[GRID_X*GRID_Y]; +int search_votes[GRID_X*GRID_Y]; +int search_publish[GRID_X*GRID_Y]; +int search_scoredown[GRID_X*GRID_Y]; +int search_scoreup[GRID_X*GRID_Y]; +char *search_names[GRID_X*GRID_Y]; +char *search_owners[GRID_X*GRID_Y]; +void *search_thumbs[GRID_X*GRID_Y]; +int search_thsizes[GRID_X*GRID_Y]; + +int search_own = 0; +int search_date = 0; +int search_page = 0; +char search_expr[256] = ""; + +char *tag_names[TAG_MAX]; +int tag_votes[TAG_MAX]; + +int Z_keysym = 'z'; + +int zoom_en = 0; +int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; +int zoom_wx=0, zoom_wy=0; +unsigned char ZFACTOR = 256/ZSIZE_D; +unsigned char ZSIZE = ZSIZE_D; + +void menu_count(void) +{ + int i=0; + msections[SC_WALL].itemcount = UI_WALLCOUNT-4; + msections[SC_SPECIAL].itemcount = 4; + for(i=0; i 18) ? signs[i].y - 18 : signs[i].y + 4; +} + +void add_sign_ui(pixel *vid_buf, int mx, int my) +{ + int i, w, h, x, y, nm=0, ju; + int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; + ui_edit ed; + + // check if it is an existing sign + for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) + break; + } + // else look for empty spot + if(i >= MAXSIGNS) + { + nm = 1; + for(i=0; i= MAXSIGNS) + return; + + if(nm) + { + signs[i].x = mx; + signs[i].y = my; + signs[i].ju = 1; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = x0+25; + ed.y = y0+25; + ed.w = 158; + ed.nx = 1; + ed.def = "[message]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(signs[i].text); + strcpy(ed.str, signs[i].text); + ju = signs[i].ju; + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed); + drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); + draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); + draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); + draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); + + if(!nm) + { + drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); + drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); + drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); + } + + drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) + ju = 0; + if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) + ju = 1; + if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) + ju = 2; + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) + { + signs[i].text[0] = 0; + return; + } + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + { + if(!ed.focus) + return; + ed.focus = 0; + } + } + + strcpy(signs[i].text, ed.str); + signs[i].ju = ju; +} + +void ui_edit_draw(pixel *vid_buf, ui_edit *ed) +{ + int cx, i; + char echo[256], *str; + + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(ed->str[0]) + { + drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } + else if(!ed->focus) + drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); + if(ed->focus) + { + cx = textnwidth(str, ed->cursor); + for(i=-3; i<9; i++) + drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); + } +} + +void ui_edit_process(int mx, int my, int mb, ui_edit *ed) +{ + char ch, ts[2], echo[256], *str; + int l, i; +#ifdef RAWINPUT + char *p; +#endif + + if(mb) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } + else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } + else + ed->focus = 0; + } + if(ed->focus && sdl_key) + { + if(ed->hide) + { + for(i=0; ed->str[i]; i++) + echo[i] = 0x8D; + echo[i] = 0; + str = echo; + } + else + str = ed->str; + + l = strlen(ed->str); + switch(sdl_key) + { + case SDLK_HOME: + ed->cursor = 0; + break; + case SDLK_END: + ed->cursor = l; + break; + case SDLK_LEFT: + if(ed->cursor > 0) + ed->cursor --; + break; + case SDLK_RIGHT: + if(ed->cursor < l) + ed->cursor ++; + break; + case SDLK_DELETE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + ed->str[ed->cursor] = 0; + else if(ed->cursor < l) + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + break; + case SDLK_BACKSPACE: + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + { + if(ed->cursor > 0) + memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); + ed->cursor = 0; + } + else if(ed->cursor > 0) + { + ed->cursor--; + memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); + } + break; + default: +#ifdef RAWINPUT + if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) + { + ch = sdl_key; + if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) + { + if(ch>='a' && ch<='z') + ch &= ~0x20; + p = strchr(shift_0, ch); + if(p) + ch = shift_1[p-shift_0]; + } + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#else + if(sdl_ascii>=' ' && sdl_ascii<127) + { + ch = sdl_ascii; + ts[0]=ed->hide?0x8D:ch; + ts[1]=0; + if(textwidth(str)+textwidth(ts) > ed->w-14) + break; + memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); + ed->str[ed->cursor] = ch; + ed->cursor++; + } +#endif + break; + } + } +} + +void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) +{ + int w = 12; + if(ed->checked) + { + drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); + } + if(ed->focus) + { + drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); + } + else + { + drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); + } +} + +void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) +{ + int w = 12; + + if(mb && !mbq) + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->checked = (ed->checked)?0:1; + } + } + else + { + if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) + { + ed->focus = 1; + } + else + { + ed->focus = 0; + } + } +} + +void draw_svf_ui(pixel *vid_buf) +{ + int c; + + drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); + drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + c = svf_open ? 255 : 128; + drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); + drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); + + c = svf_login ? 255 : 128; + drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); + if(svf_open) + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); + else + drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); + drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); + if(svf_open && svf_own) + drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); + + c = (svf_login && svf_open) ? 255 : 128; + + drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); + + if(svf_myvote==1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); + } + else if(svf_myvote==-1 && (svf_login && svf_open)) + { + fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); + } + + drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); + drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); + + drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); + if(svf_tags[0]) + drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); + else + drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); + + drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); + + drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); + drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); + + drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); + if(svf_login) + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); + else + drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); + drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); + + if(sys_pause) + { + fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); + drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + if(!legacy_enable) + { + fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); + } + else + { + drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + } + + switch(cmode) + { + case 0: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); + break; + case 1: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); + break; + case 2: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); + break; + case 3: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); + break; + case 4: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); + break; + case 5: + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); + drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); + break; + case 6: + drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255); + break; + } + drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); + + if(svf_admin) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); + } + else if(svf_mod) + { + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); + drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); + }//else if(amd) + // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? +} + +void error_ui(pixel *vid_buf, int err, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + char *msg; + + msg = malloc(strlen(txt)+16); + if(err) + sprintf(msg, "%03d %s", err, txt); + else + sprintf(msg, "%s", txt); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + if(err) + drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); + else + drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + free(msg); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_ui(pixel *vid_buf, char *top, char *txt) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); + drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + break; + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } +} + +void info_box(pixel *vid_buf, char *msg) +{ + int w = textwidth(msg)+16; + int x0=(XRES-w)/2,y0=(YRES-24)/2; + + clearrect(vid_buf, x0-2, y0-2, w+4, 28); + drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); +} + +int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) +{ + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; + int ret = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); + drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); + drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); + drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); + drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) + { + ret = 1; + break; + } + if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) + break; + + if(sdl_key==SDLK_RETURN) + { + ret = 1; + break; + } + if(sdl_key==SDLK_ESCAPE) + break; + } + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + return ret; +} + +void login_ui(pixel *vid_buf) +{ + int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq,mx,my,err; + ui_edit ed1,ed2; + char *res; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed1.x = x0+25; + ed1.y = y0+25; + ed1.w = 158; + ed1.nx = 1; + ed1.def = "[user name]"; + ed1.focus = 1; + ed1.hide = 0; + ed1.cursor = strlen(svf_user); + strcpy(ed1.str, svf_user); + ed2.x = x0+25; + ed2.y = y0+45; + ed2.w = 158; + ed2.nx = 1; + ed2.def = "[password]"; + ed2.focus = 0; + ed2.hide = 1; + ed2.cursor = 0; + strcpy(ed2.str, ""); + + fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 192, 80); + drawtext(vid_buf, x0+8, y0+8, "Server login:", 255, 255, 255, 255); + drawtext(vid_buf, x0+12, y0+23, "\x8B", 32, 64, 128, 255); + drawtext(vid_buf, x0+12, y0+23, "\x8A", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + drawtext(vid_buf, x0+11, y0+44, "\x8C", 160, 144, 32, 255); + drawtext(vid_buf, x0+11, y0+44, "\x84", 255, 255, 255, 255); + drawrect(vid_buf, x0+8, y0+40, 176, 16, 192, 192, 192, 255); + ui_edit_draw(vid_buf, &ed1); + ui_edit_draw(vid_buf, &ed2); + drawtext(vid_buf, x0+5, y0+69, "Sign in", 255, 255, 255, 255); + drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed1); + ui_edit_process(mx, my, b, &ed2); + + if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) + break; + + if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) + { + if(!ed1.focus) + break; + ed1.focus = 0; + ed2.focus = 1; + } + if(sdl_key==SDLK_ESCAPE) + { + if(!ed1.focus && !ed2.focus) + return; + ed1.focus = 0; + ed2.focus = 0; + } + } + + strcpy(svf_user, ed1.str); + md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); + + res = http_multipart_post( + "http://" SERVER "/Login.api", + NULL, NULL, NULL, + svf_user, svf_pass, + &err, NULL); + if(err != 200) + { + error_ui(vid_buf, err, http_ret_text(err)); + if(res) + free(res); + goto fail; + } + if(res && !strncmp(res, "OK", 2)) + { + if(!strcmp(res, "OK ADMIN")) + { + svf_admin = 1; + svf_mod = 0; + } + else if(!strcmp(res, "OK MOD")) + { + svf_admin = 0; + svf_mod = 1; + } + else + { + svf_admin = 0; + svf_mod = 0; + } + free(res); + svf_login = 1; + return; + } + if(!res) + res = mystrdup("Unspecified Error"); + error_ui(vid_buf, 0, res); + free(res); + +fail: + strcpy(svf_user, ""); + strcpy(svf_pass, ""); + svf_login = 0; + svf_own = 0; + svf_admin = 0; + svf_mod = 0; +} + +int stamp_ui(pixel *vid_buf) +{ + int b=1,bq,mx,my,d=-1,i,j,k,x,gx,gy,y,w,h,r=-1,stamp_page=0,per_page=STAMP_X*STAMP_Y,page_count; + char page_info[64]; + page_count = ceil((float)stamp_count/(float)per_page); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); + k = stamp_page*per_page;//0; + r = -1; + d = -1; + for(j=0; j=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) + { + if(stamp_page) + { + stamp_page --; + } + sdl_wheel = 0; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=60) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else if(i==SC_SPECIAL) + { + for(n = 122; n<122+UI_WALLCOUNT; n++) + { + if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) + { + if(x-26<=20) + { + x = XRES-BARSIZE-26; + y += 19; + } + x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; + if(!bq && mx>=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + else + { + for(n = 0; n=x+32 && mx=y && my< y+15) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + h = n; + } + else if(n==*sl) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); + } + else if(n==*sr) + { + drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); + } + } + } + } + + if(h==-1) + { + drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); + } + else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) + { + drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); + } + else + { + drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); + } + + if(b==1&&h!=-1) + { + *sl = h; + } + if(b==4&&h!=-1) + { + *sr = h; + } +} + +int sdl_poll(void) +{ + SDL_Event event; + sdl_key=sdl_wheel=sdl_ascii=0; + while(SDL_PollEvent(&event)) + { + switch (event.type) + { + case SDL_KEYDOWN: + sdl_key=event.key.keysym.sym; + sdl_ascii=event.key.keysym.unicode; + if(event.key.keysym.sym == SDLK_CAPSLOCK) + sdl_caps = 1; + if(event.key.keysym.unicode=='z' || event.key.keysym.unicode=='Z') + { + sdl_zoom_trig = 1; + Z_keysym = event.key.keysym.sym; + } + if( event.key.keysym.sym == SDLK_PLUS) + { + sdl_wheel++; + } + if( event.key.keysym.sym == SDLK_MINUS) + { + sdl_wheel--; + } + // 4 + //1 8 2 + if(event.key.keysym.sym == SDLK_RIGHT) + { + player[0] = (int)(player[0])|0x02; //Go right command + } + if(event.key.keysym.sym == SDLK_LEFT) + { + player[0] = (int)(player[0])|0x01; //Go left command + } + if(event.key.keysym.sym == SDLK_DOWN && ((int)(player[0])&0x08)!=0x08) + { + player[0] = (int)(player[0])|0x08; //Go left command + } + if(event.key.keysym.sym == SDLK_UP && ((int)(player[0])&0x04)!=0x04) + { + player[0] = (int)(player[0])|0x04; //Jump command + } + break; + + case SDL_KEYUP: + if(event.key.keysym.sym == SDLK_CAPSLOCK) + sdl_caps = 0; + if(event.key.keysym.sym == Z_keysym) + sdl_zoom_trig = 0; + if(event.key.keysym.sym == SDLK_RIGHT || event.key.keysym.sym == SDLK_LEFT) + { + player[1] = player[0]; //Saving last movement + player[0] = (int)(player[0])&12; //Stop command + } + if(event.key.keysym.sym == SDLK_UP) + { + player[0] = (int)(player[0])&11; + } + if(event.key.keysym.sym == SDLK_DOWN) + { + player[0] = (int)(player[0])&7; + } + break; + case SDL_MOUSEBUTTONDOWN: + if(event.button.button == SDL_BUTTON_WHEELUP) + sdl_wheel++; + if(event.button.button == SDL_BUTTON_WHEELDOWN) + sdl_wheel--; + break; + case SDL_QUIT: + return 1; + } + } + sdl_mod = SDL_GetModState(); + return 0; +} + +void set_cmode(int cm) +{ + cmode = cm; + itc = 51; + if(cmode==4) + { + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + strcpy(itc_msg, "Blob Display"); + } + else if(cmode==5) + { + strcpy(itc_msg, "Heat Display"); + } + else if(cmode==6) + { + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + strcpy(itc_msg, "Fancy Display"); + } + else if(cmode==3) + { + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + strcpy(itc_msg, "Fire Display"); + } + else if(cmode==2) + { + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + strcpy(itc_msg, "Persistent Display"); + } + else if(cmode==1) + strcpy(itc_msg, "Pressure Display"); + else + strcpy(itc_msg, "Velocity Display"); +} + +char *download_ui(pixel *vid_buf, char *uri, int *len) +{ + int dstate = 0; + void *http = http_async_req_start(NULL, uri, NULL, 0, 0); + int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2; + int done, total, i, ret, zlen, ulen; + char str[16], *tmp, *res; + + while(!http_async_req_status(http)) + { + sdl_poll(); + + http_async_get_length(http, &total, &done); + + clearrect(vid_buf, x0-2, y0-2, 244, 64); + drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); + drawtext(vid_buf, x0+8, y0+8, "Please wait", 255, 216, 32, 255); + drawtext(vid_buf, x0+8, y0+26, "Downloading update...", 255, 255, 255, 255); + + if(total) + { + i = (236*done)/total; + fillrect(vid_buf, x0+1, y0+45, i+1, 14, 255, 216, 32, 255); + i = (100*done)/total; + sprintf(str, "%d%%", i); + if(i<50) + drawtext(vid_buf, x0+120-textwidth(str)/2, y0+48, str, 192, 192, 192, 255); + else + drawtext(vid_buf, x0+120-textwidth(str)/2, y0+48, str, 0, 0, 0, 255); + } + else + drawtext(vid_buf, x0+120-textwidth("Waiting...")/2, y0+48, "Waiting...", 255, 216, 32, 255); + + drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + } + + tmp = http_async_req_stop(http, &ret, &zlen); + if(ret!=200) + { + error_ui(vid_buf, ret, http_ret_text(ret)); + if(tmp) + free(tmp); + return NULL; + } + if(!tmp) + { + error_ui(vid_buf, 0, "Server did not return data"); + return NULL; + } + + if(zlen<16) + { + printf("ZLen is not 16!\n"); + goto corrupt; + } + if(tmp[0]!=0x42 || tmp[1]!=0x75 || tmp[2]!=0x54 || tmp[3]!=0x54) + { + printf("Tmperr %d, %d, %d, %d\n", tmp[0], tmp[1], tmp[2], tmp[3]); + goto corrupt; + } + + ulen = (unsigned char)tmp[4]; + ulen |= ((unsigned char)tmp[5])<<8; + ulen |= ((unsigned char)tmp[6])<<16; + ulen |= ((unsigned char)tmp[7])<<24; + + res = (char *)malloc(ulen); + if(!res) + { + printf("No res!\n"); + goto corrupt; + } + dstate = BZ2_bzBuffToBuffDecompress((char *)res, (unsigned *)&ulen, (char *)(tmp+8), zlen-8, 0, 0); + if(dstate) + { + printf("Decompression failure: %d!\n", dstate); + free(res); + goto corrupt; + } + + free(tmp); + if(len) + *len = ulen; + return res; + +corrupt: + error_ui(vid_buf, 0, "Downloaded update is corrupted"); + free(tmp); + return NULL; +} + +int search_ui(pixel *vid_buf) +{ + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,dap,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; + int thumb_drawn[GRID_X*GRID_Y]; + pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + float ry; + time_t http_last_use=HTTP_TIMEOUT; + ui_edit ed; + + + void *http = NULL; + int active = 0; + char *last = NULL; + int search = 0; + int lasttime = TIMEOUT; + char *uri; + int status; + char *results; + char *tmp, ts[64]; + + void *img_http[IMGCONNS]; + char *img_id[IMGCONNS]; + void *thumb, *data; + int thlen, dlen; + + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + + memset(img_http, 0, sizeof(img_http)); + memset(img_id, 0, sizeof(img_id)); + + memset(search_ids, 0, sizeof(search_ids)); + memset(search_dates, 0, sizeof(search_dates)); + memset(search_names, 0, sizeof(search_names)); + memset(search_scoreup, 0, sizeof(search_scoreup)); + memset(search_scoredown, 0, sizeof(search_scoredown)); + memset(search_publish, 0, sizeof(search_publish)); + memset(search_owners, 0, sizeof(search_owners)); + memset(search_thumbs, 0, sizeof(search_thumbs)); + memset(search_thsizes, 0, sizeof(search_thsizes)); + + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + + do_open = 0; + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + ed.x = 65; + ed.y = 13; + ed.w = XRES-200; + ed.nx = 1; + ed.def = "[search terms]"; + ed.focus = 1; + ed.hide = 0; + ed.cursor = strlen(search_expr); + strcpy(ed.str, search_expr); + + sdl_wheel = 0; + + while(!sdl_poll()) + { + uih = 0; + bq = b; + mxq = mx; + myq = my; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + if(mx!=mxq || my!=myq || sdl_wheel || b) + mmt = 0; + else if(mmt 9) + { + drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); + drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); + } + + ui_edit_draw(vid_buf, &ed); + + if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) + { + if(search_page) + { + search_page --; + lasttime = TIMEOUT; + } + sdl_wheel = 0; + uih = 1; + } + if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) + { + lasttime = TIMEOUT; + search_page ++; + page_count = exp_res; + } + sdl_wheel = 0; + uih = 1; + } + + tp = -1; + if(is_p1) + { + drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); + for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) + for(gi=0; giTAG_MAX || !tag_names[pos]) + break; + if(tag_votes[0]) + i = 127+(128*tag_votes[pos])/tag_votes[0]; + else + i = 192; + w = textwidth(tag_names[pos]); + if(w>XRES/GRID_X-5) + w = XRES/GRID_X-5; + gx = (XRES/GRID_X)*gi; + gy = gj*14 + 46; + if(mx>=gx && mx=gy && my XRES/GRID_X-10) + { + tmp = malloc(strlen(search_names[pos])+4); + strcpy(tmp, search_names[pos]); + j = textwidthx(tmp, XRES/GRID_X-15); + strcpy(tmp+j, "..."); + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); + free(tmp); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); + j = textwidth(search_owners[pos]); + if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && + my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) + { + st = 1; + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); + } + else + drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); + if(search_thumbs[pos]&&thumb_drawn[pos]==0) + { + render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); + thumb_drawn[pos] = 1; + } + own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); + if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) + mp = pos; + if(own) + { + if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) + { + mp = -1; + dp = pos; + } + if(!search_dates[pos] && mx>=gx-6 && mx<=gx+4 && my>=gy+YRES/GRID_S-4 && my<=gy+YRES/GRID_S+6) + { + mp = -1; + dap = pos; + } + } + drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, YRES/GRID_S+3, 128, 128, 128, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, 1+(YRES/GRID_S+3)/2, 0, 107, 10, 255); + fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 6, 1+(YRES/GRID_S+3)/2, 107, 10, 0, 255); + + if(mp==pos && !st) + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); + else + drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); + if(own) + { + if(dp == pos) + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); + else + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); + drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); + } + if(!search_publish[pos]) + { + drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); + drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } + if(!search_dates[pos] && own) + { + fillrect(vid_buf, gx-5, gy+YRES/GRID_S-3, 7, 8, 255, 255, 255, 255); + if(dap == pos) { + drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 200, 100, 80, 255); + } else { + drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 160, 70, 50, 255); + } + //drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); + } + if(view_own || svf_admin || svf_mod) + { + sprintf(ts+1, "%d", search_votes[pos]); + ts[0] = 0xBB; + for(j=1; ts[j]; j++) + ts[j] = 0xBC; + ts[j-1] = 0xB9; + ts[j] = 0xBA; + ts[j+1] = 0; + w = gx+XRES/GRID_S-2-textwidth(ts); + h = gy+YRES/GRID_S-11; + drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); + for(j=0; ts[j]; j++) + ts[j] -= 14; + drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); + sprintf(ts, "%d", search_votes[pos]); + for(j=0; ts[j]; j++) + ts[j] += 127; + drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); + } + if(search_scoreup[pos]>0||search_scoredown[pos]>0) + { + lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); + + if(((YRES/GRID_S+3)/2)>lv) + { + ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); + if(lv<8) + { + ry = ry/(8-lv); + } + nyu = search_scoreup[pos]*ry; + nyd = search_scoredown[pos]*ry; + } + else + { + ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); + nyu = search_scoreup[pos]/ry; + nyd = search_scoredown[pos]/ry; + } + + + fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-1+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 57, 187, 57, 255); + fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 4, nyd, 187, 57, 57, 255); + //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); + //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); + } + } + + if(mp!=-1 && mmt>=TIMEOUT/5 && !st) + { + gi = mp % GRID_X; + gj = mp / GRID_X; + if(is_p1) + gj += GRID_Y-GRID_P; + gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; + gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; + i = w = textwidth(search_names[mp]); + h = YRES/GRID_Z+30; + if(w=XRES-2) gx=XRES-3-w; + if(gy<32) gy=32; + if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; + clearrect(vid_buf, gx-2, gy-3, w+4, h); + drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); + if(search_thumbs[mp]) + render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); + drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); + drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); + } + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + + ui_edit_process(mx, my, b, &ed); + + if(sdl_key==SDLK_RETURN) + { + if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) + lasttime = TIMEOUT; + else if(search_ids[0] && !search_ids[1]) + { + bq = 0; + b = 1; + mp = 0; + } + } + if(sdl_key==SDLK_ESCAPE) + goto finish; + + if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) + { + search_own = !search_own; + lasttime = TIMEOUT; + } + if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) + { + search_date = !search_date; + lasttime = TIMEOUT; + } + + if(b && !bq && dp!=-1) + if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) + { + execute_delete(vid_buf, search_ids[dp]); + lasttime = TIMEOUT; + if(last) + { + free(last); + last = NULL; + } + } + if(b && !bq && dap!=-1) + { + sprintf(ed.str, "history:%s", search_ids[dap]); + lasttime = TIMEOUT; + } + + if(b && !bq && tp!=-1) + { + strncpy(ed.str, tag_names[tp], 255); + lasttime = TIMEOUT; + } + + if(b && !bq && mp!=-1 && st) + { + sprintf(ed.str, "user:%s", search_owners[mp]); + lasttime = TIMEOUT; + } + + if(do_open==1) + { + mp = 0; + } + + if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) + { + fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); + info_box(vid_buf, "Loading..."); + + if(search_dates[mp]) { + uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + strappend(uri, "&Date="); + strcaturl(uri, search_dates[mp]); + } else { + uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, search_ids[mp]); + } + data = http_simple_get(uri, &status, &dlen); + free(uri); + + if(status == 200) + { + status = parse_save(data, dlen, 1, 0, 0); + switch(status) + { + case 1: + error_ui(vid_buf, 0, "Simulation corrupted"); + break; + case 2: + error_ui(vid_buf, 0, "Simulation from a newer version"); + break; + case 3: + error_ui(vid_buf, 0, "Simulation on a too large grid"); + break; + } + if(!status) + { + char *tnames[] = {"ID", NULL}; + char *tparts[1]; + int tplens[1]; + if(svf_last) + free(svf_last); + svf_last = data; + svf_lsize = dlen; + + tparts[0] = search_ids[mp]; + tplens[0] = strlen(search_ids[mp]); + data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); + + svf_open = 1; + svf_own = svf_login && !strcmp(search_owners[mp], svf_user); + svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); + + strcpy(svf_id, search_ids[mp]); + strcpy(svf_name, search_names[mp]); + if(status == 200) + { + if(data) + { + strncpy(svf_tags, data, 255); + svf_tags[255] = 0; + } + else + svf_tags[0] = 0; + } + else + { + svf_tags[0] = 0; + } + + if(svf_login) + { + char *names[] = {"ID", NULL}; + char *parts[1]; + parts[0] = search_ids[mp]; + data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); + if(status == 200) + { + if(data) + { + if(!strcmp(data, "Up")) + { + svf_myvote = 1; + } + else if(!strcmp(data, "Down")) + { + svf_myvote = -1; + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + else + { + svf_myvote = 0; + } + } + } + else + { + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + } + } + else + error_ui(vid_buf, status, http_ret_text(status)); + + if(data) + free(data); + goto finish; + } + + if(!last) + { + search = 1; + } + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) + { + search = 1; + if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) + { + search_page = 0; + page_count = 0; + } + free(last); + last = NULL; + } + else + search = 0; + + if(search && lasttime>=TIMEOUT) + { + lasttime = 0; + last = mystrdup(ed.str); + last_own = search_own; + last_date = search_date; + last_page = search_page; + active = 1; + uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); + if(search_own || svf_admin || svf_mod) + tmp = "&ShowVotes=true"; + else + tmp = ""; + if(!search_own && !search_date && !*last) + { + if(search_page) + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); + } + else + { + exp_res = GRID_X*GRID_P; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); + } + } + else + { + exp_res = GRID_X*GRID_Y; + sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); + } + strcaturl(uri, last); + if(search_own) + { + strcaturl(uri, " user:"); + strcaturl(uri, svf_user); + } + if(search_date) + strcaturl(uri, " sort:date"); + + http = http_async_req_start(http, uri, NULL, 0, 1); + if(svf_login) + { + http_auth_headers(http, svf_user, svf_pass); + } + http_last_use = time(NULL); + free(uri); + } + + if(active && http_async_req_status(http)) + { + http_last_use = time(NULL); + results = http_async_req_stop(http, &status, NULL); + view_own = last_own; + if(status == 200) + { + page_count = search_results(results, last_own||svf_admin||svf_mod); + memset(thumb_drawn, 0, sizeof(thumb_drawn)); + memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); + } + is_p1 = (exp_res < GRID_X*GRID_Y); + free(results); + active = 0; + } + + if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) + { + http_async_req_close(http); + http = NULL; + } + + for(i=0; i=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str+5, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+5); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str+5, search_thumbs+i, search_thsizes+i); + i++; + } + else if(!strncmp(str, "HISTORY ", 8)) + { + if(i>=GRID_X*GRID_Y) + break; + if(votes) + { + sd = strchr(str+8, ' '); + if(!sd) + return i; + *(sd++) = 0; + pu = strchr(sd, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + sd = strchr(str+8, ' '); + if(!sd) + return i; + *(sd++) = 0; + pu = strchr(sd, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str+8); + + search_dates[i] = mystrdup(sd); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str+8, search_thumbs+i, search_thsizes+i); + i++; + } + else if(!strncmp(str, "TAG ", 4)) + { + if(j >= TAG_MAX) + { + str = p; + continue; + } + q = strchr(str+4, ' '); + if(!q) + { + str = p; + continue; + } + *(q++) = 0; + tag_names[j] = mystrdup(str+4); + tag_votes[j] = atoi(q); + j++; + } + else + { + if(i>=GRID_X*GRID_Y) + break; + if(votes) + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + s = strchr(pu, ' '); + if(!s) + return i; + *(s++) = 0; + vu = strchr(s, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + else + { + pu = strchr(str, ' '); + if(!pu) + return i; + *(pu++) = 0; + vu = strchr(pu, ' '); + if(!vu) + return i; + *(vu++) = 0; + vd = strchr(vu, ' '); + if(!vd) + return i; + *(vd++) = 0; + q = strchr(vd, ' '); + } + if(!q) + return i; + *(q++) = 0; + r = strchr(q, ' '); + if(!r) + return i; + *(r++) = 0; + search_ids[i] = mystrdup(str); + + search_publish[i] = atoi(pu); + search_scoreup[i] = atoi(vu); + search_scoredown[i] = atoi(vd); + + search_owners[i] = mystrdup(q); + search_names[i] = mystrdup(r); + + if(s) + search_votes[i] = atoi(s); + thumb_cache_find(str, search_thumbs+i, search_thsizes+i); + i++; + } + str = p; + } + if(*str) + i++; + return i; +} + +int execute_tagop(pixel *vid_buf, char *op, char *tag) +{ + int status; + char *result; + + char *names[] = {"ID", "Tag", NULL}; + char *parts[2]; + + char *uri = malloc(strlen(SERVER)+strlen(op)+36); + sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); + + parts[0] = svf_id; + parts[1] = tag; + + result = http_multipart_post( + uri, + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + free(uri); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 1; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 1; + } + + if(result[2]) + { + strncpy(svf_tags, result+3, 255); + svf_id[15] = 0; + } + + if(result) + free(result); + + return 0; +} + +void execute_save(pixel *vid_buf) +{ + int status; + char *result; + + char *names[] = {"Name", "Data:save.bin", "Thumb:thumb.bin", "Publish", "ID", NULL}; + char *parts[5]; + int plens[5]; + + parts[0] = svf_name; + plens[0] = strlen(svf_name); + parts[1] = build_save(plens+1, 0, 0, XRES, YRES); + parts[2] = build_thumb(plens+2, 1); + parts[3] = (svf_publish==1)?"Public":"Private"; + plens[3] = strlen((svf_publish==1)?"Public":"Private"); + + if(svf_id[0]) + { + parts[4] = svf_id; + plens[4] = strlen(svf_id); + } + else + names[4] = NULL; + + result = http_multipart_post( + "http://" SERVER "/Save.api", + names, parts, plens, + svf_user, svf_pass, + &status, NULL); + + if(svf_last) + free(svf_last); + svf_last = parts[1]; + svf_lsize = plens[1]; + + free(parts[2]); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result[2]) + { + strncpy(svf_id, result+3, 15); + svf_id[15] = 0; + } + + if(!svf_id[0]) + { + error_ui(vid_buf, 0, "No ID supplied by server"); + free(result); + return; + } + + thumb_cache_inval(svf_id); + + svf_own = 1; + if(result) + free(result); +} + +void execute_delete(pixel *vid_buf, char *id) +{ + int status; + char *result; + + char *names[] = {"ID", NULL}; + char *parts[1]; + + parts[0] = id; + + result = http_multipart_post( + "http://" SERVER "/Delete.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result) + free(result); +} + +int execute_vote(pixel *vid_buf, char *id, char *action) +{ + int status; + char *result; + + char *names[] = {"ID", "Action", NULL}; + char *parts[2]; + + parts[0] = id; + parts[1] = action; + + result = http_multipart_post( + "http://" SERVER "/Vote.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return 0; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 0; + } + + if(result) + free(result); + return 1; +} diff --git a/src/main.c b/src/main.c new file mode 100755 index 0000000..8c7035b --- /dev/null +++ b/src/main.c @@ -0,0 +1,2096 @@ +/** + * Powder Toy - Main source + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw + * Copyright (c) 2010 Skresanov Savely + * Copyright (c) 2010 Bryan Hoyle + * Copyright (c) 2010 Nathan Cousins + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#else +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char *it_msg = + "\brThe Powder Toy\n" + "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" + "\n" + "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" + "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" + "\bgPick your material from the menu using mouse left/right buttons.\n" + "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" + "Shift+drag will create straight lines of particles.\n" + "Ctrl+drag will result in filled rectangles.\n" + "Ctrl+Shift+click will flood-fill a closed area.\n" + "Ctrl+Z will act as Undo.\n" + "Middle click or Alt+Click to \"sample\" the particles.\n" + "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" + "Use 'S' to save parts of the window as 'stamps'.\n" + "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" + "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 7 will do the same\n" + "Use the mouse scroll wheel to change the tool size for particles.\n" + "'Q' will quit the application.\n" + "The spacebar can be used to pause physics.\n" + "'P' will take a screenshot and save it into the current directory.\n" + "\n" + "\brhttp://powdertoy.co.uk/\n" + "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" + "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" + "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" + "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" + "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" + "\n" + "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" + "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" + ; + +typedef struct +{ + int start, inc; + pixel *vid; +} upstruc; + +#ifdef BETA +static const char *old_ver_msg_beta = "A new beta is available - click here!"; +#endif +static const char *old_ver_msg = "A new version is available - click here!"; +float mheat = 0.0f; + +int do_open = 0; +int sys_pause = 0; +int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. +int death = 0, framerender = 0; +int amd = 1; +int FPSB = 0; + +sign signs[MAXSIGNS]; + +int numCores = 4; + +int core_count() +{ + int numCPU = 1; +#ifdef MT +#ifdef WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + numCPU = sysinfo.dwNumberOfProcessors; +#else +#ifdef MACOSX + numCPU = 4; +#else + numCPU = sysconf( _SC_NPROCESSORS_ONLN ); +#endif +#endif + + printf("Cpus: %d\n", numCPU); + if(numCPU>1) + printf("Multithreading enabled\n"); + else + printf("Multithreading disabled\n"); +#endif + return numCPU; +} + +int mousex = 0, mousey = 0; //They contain mouse position + +void sdl_seticon(void) +{ +#ifdef WIN32 + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else +#ifdef MACOSX + //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#else + SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); +#endif +#endif +} + +int frame_idx=0; +void dump_frame(pixel *src, int w, int h, int pitch) +{ + char frame_name[32]; + int j,i; + unsigned char c[3]; + FILE *f; + sprintf(frame_name,"frame%04d.ppm",frame_idx); + f=fopen(frame_name,"wb"); + fprintf(f,"P6\n%d %d\n255\n",w,h); + for(j=0; j=0 && x=0 && y255) i=255; + d[p++] = i; + } + for(y=by0; y255) i=255; + d[p++] = i; + } + + // save the particle map + for(i=0; i=x0 && x=y0 && y255) x=255; + if(y<0) y=0; + if(y>255) y=255; + d[p++] = x; + d[p++] = y; + } + } + for(j=0; j>8); + d[p++] = (tttemp&0x00FF); + } + } + for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; + d[p++] = (signs[i].y-y0); + d[p++] = (signs[i].y-y0)>>8; + d[p++] = signs[i].ju; + x = strlen(signs[i].text); + d[p++] = x; + memcpy(d+p, signs[i].text, x); + p+=x; + } + + i = (p*101+99)/100 + 612; + c = malloc(i); + + //New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures + //This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error + + c[0] = 0x50; //0x66; + c[1] = 0x53; //0x75; + c[2] = 0x76; //0x43; + c[3] = legacy_enable; + c[4] = SAVE_VERSION; + c[5] = CELL; + c[6] = bw; + c[7] = bh; + c[8] = p; + c[9] = p >> 8; + c[10] = p >> 16; + c[11] = p >> 24; + + i -= 12; + + if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) + { + free(d); + free(c); + return NULL; + } + free(d); + + *size = i+12; + return c; +} + +int parse_save(void *save, int size, int replace, int x0, int y0) +{ + unsigned char *d,*c=save; + int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; + int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; + int fp[NPART], nf=0, new_format = 0, ttv = 0; + + //New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures + //This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error + + if(size<16) + return 1; + if(!(c[2]==0x43 && c[1]==0x75 && c[0]==0x66) && !(c[2]==0x76 && c[1]==0x53 && c[0]==0x50)) + return 1; + if(c[2]==0x76 && c[1]==0x53 && c[0]==0x50) { + new_format = 1; + } + if(c[4]>SAVE_VERSION) + return 2; + ver = c[4]; + + if(ver<34) + { + legacy_enable = 1; + } + else + { + if(c[3]==1||c[3]==0) + legacy_enable = c[3]; + else + legacy_beta = 1; + } + + bw = c[6]; + bh = c[7]; + if(bx0+bw > XRES/CELL) + bx0 = XRES/CELL - bw; + if(by0+bh > YRES/CELL) + by0 = YRES/CELL - bh; + if(bx0 < 0) + bx0 = 0; + if(by0 < 0) + by0 = 0; + + if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) + return 3; + i = (unsigned)c[8]; + i |= ((unsigned)c[9])<<8; + i |= ((unsigned)c[10])<<16; + i |= ((unsigned)c[11])<<24; + d = malloc(i); + if(!d) + return 1; + + if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) + return 1; + size = i; + + if(size < bw*bh) + return 1; + + // normalize coordinates + x0 = bx0*CELL; + y0 = by0*CELL; + w = bw *CELL; + h = bh *CELL; + + if(replace) + { + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(signs, 0, sizeof(signs)); + memset(parts, 0, sizeof(particle)*NPART); + memset(pmap, 0, sizeof(pmap)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(pv, 0, sizeof(pv)); + } + + // make a catalog of free parts + memset(pmap, 0, sizeof(pmap)); + for(i=0; i= size) + goto corrupt; + fvx[y][x] = (d[p++]-127.0f)/64.0f; + } + for(y=by0; y= size) + goto corrupt; + fvy[y][x] = (d[p++]-127.0f)/64.0f; + } + + // load the particle map + i = 0; + pty = p; + for(y=y0; y= size) + goto corrupt; + j=d[p++]; + if(j >= PT_NUM) + goto corrupt; + if(j)// && !(isplayer == 1 && j==PT_STKM)) + { + if(pmap[y][x]) + { + k = pmap[y][x]>>8; + parts[k].type = j; + parts[k].x = (float)x; + parts[k].y = (float)y; + m[(x-x0)+(y-y0)*w] = k+1; + } + else if(i < nf) + { + parts[fp[i]].type = j; + parts[fp[i]].x = (float)x; + parts[fp[i]].y = (float)y; + m[(x-x0)+(y-y0)*w] = fp[i]+1; + i++; + } + else + m[(x-x0)+(y-y0)*w] = NPART+1; + } + } + + // load particle properties + for(j=0; j= size) + goto corrupt; + if(i < NPART) + { + parts[i].vx = (d[p++]-127.0f)/16.0f; + parts[i].vy = (d[p++]-127.0f)/16.0f; + if(parts[i].type == PT_STKM) + { + //player[2] = PT_DUST; + + player[3] = parts[i].x-1; //Setting legs positions + player[4] = parts[i].y+6; + player[5] = parts[i].x-1; + player[6] = parts[i].y+6; + + player[7] = parts[i].x-3; + player[8] = parts[i].y+12; + player[9] = parts[i].x-3; + player[10] = parts[i].y+12; + + player[11] = parts[i].x+1; + player[12] = parts[i].y+6; + player[13] = parts[i].x+1; + player[14] = parts[i].y+6; + + player[15] = parts[i].x+3; + player[16] = parts[i].y+12; + player[17] = parts[i].x+3; + player[18] = parts[i].y+12; + + } + } + else + p += 2; + } + } + for(j=0; j= size) + goto corrupt; + if(i <= NPART) + parts[i-1].life = d[p++]*4; + else + p++; + } + } + for(j=0; j=34&&legacy_beta==0) + { + if(p >= size) + { + goto corrupt; + } + if(i <= NPART) + { + if(ver>=42) { + if(new_format) { + ttv = (d[p++])<<8; + ttv |= (d[p++]); + parts[i-1].temp = ttv; + } else { + parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; + } + } else { + parts[i-1].temp = ((d[p++]*((O_MAX_TEMP+(-O_MIN_TEMP))/255))+O_MIN_TEMP)+273; + } + } + else + { + p++; + if(new_format) { + p++; + } + } + } + else + { + parts[i-1].temp = ptypes[parts[i-1].type].heat; + } + } + } + for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) + { + if(p >= size) + goto corrupt; + if(i <= NPART) + parts[i-1].ctype = d[p++]; + else + p++; + } + } + + if(p >= size) + goto version1; + j = d[p++]; + for(i=0; i size) + goto corrupt; + for(k=0; k size) + goto corrupt; + if(kXRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) + { + factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); + factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); + if(factor_y > factor_x) + factor_x = factor_y; + tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); + free(stamps[i].thumb); + stamps[i].thumb = tmp; + } + } + + free(data); +} + +int clipboard_ready = 0; +void *clipboard_data = 0; +int clipboard_length = 0; + +void stamp_save(int x, int y, int w, int h) +{ + FILE *f; + int n; + char fn[64], sn[16]; + void *s=build_save(&n, x, y, w, h); + +#ifdef WIN32 + _mkdir("stamps"); +#else + mkdir("stamps", 0755); +#endif + + stamp_gen_name(sn); + sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); + + f = fopen(fn, "wb"); + if(!f) + return; + fwrite(s, n, 1, f); + fclose(f); + + free(s); + + if(stamps[STAMP_MAX-1].thumb) + free(stamps[STAMP_MAX-1].thumb); + memmove(stamps+1, stamps, sizeof(struct stamp)*(STAMP_MAX-1)); + memset(stamps, 0, sizeof(struct stamp)); + if(stamp_count0) + { + memcpy(&tmp, stamps+i, sizeof(struct stamp)); + memmove(stamps+1, stamps, sizeof(struct stamp)*i); + memcpy(stamps, &tmp, sizeof(struct stamp)); + + stamp_update(); + } + + return data; +} + +void stamp_init(void) +{ + int i; + FILE *f; + + memset(stamps, 0, sizeof(stamps)); + + f=fopen("stamps" PATH_SEP "stamps.def", "rb"); + if(!f) + return; + for(i=0; i= THUMB_CACHE_SIZE) + return; + free(thumb_cache_id[i]); + free(thumb_cache_data[i]); + thumb_cache_id[i] = NULL; + for(j=0; j thumb_cache_lru[i]) + thumb_cache_lru[j]--; +} +void thumb_cache_add(char *id, void *thumb, int size) +{ + int i,m=-1,j=-1; + thumb_cache_inval(id); + for(i=0; i m) + { + m = thumb_cache_lru[i]; + j = i; + } + } + if(i >= THUMB_CACHE_SIZE) + { + thumb_cache_inval(thumb_cache_id[j]); + i = j; + } + for(j=0; j= THUMB_CACHE_SIZE) + return 0; + for(j=0; jSAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) + old_version = 1; +#else + if(sscanf(ver_data, "%d.%d", &major, &minor)==2) + if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) + old_version = 1; +#endif + free(ver_data); + } + http_ver_check = NULL; + } + do_check = (do_check+1) & 15; + } + + if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) + { + if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) + { + break; + } + } + if(sdl_key=='d' && isplayer) + { + death = 1; + //death = !(death); + } + if(sdl_key=='f') + { + framerender = 1; + } + if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) + { + if(load_mode) + { + free(load_img); + free(load_data); + load_mode = 0; + load_data = NULL; + load_img = NULL; + } + if(it > 50) + it = 50; + if(sdl_key=='k' && stamps[1].name[0]) + { + j = stamp_ui(vid_buf); + if(j>=0) + load_data = stamp_load(j, &load_size); + else + load_data = NULL; + } + else + load_data = stamp_load(0, &load_size); + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + if(sdl_key=='s') + { + if(it > 50) + it = 50; + save_mode = 1; + } + if(sdl_key=='1') + { + set_cmode(0); + } + if(sdl_key=='2') + { + set_cmode(1); + } + if(sdl_key=='3') + { + set_cmode(2); + } + if(sdl_key=='4') + { + set_cmode(3); + } + if(sdl_key=='5') + { + set_cmode(4); + } + if(sdl_key=='6') + { + set_cmode(5); + } + if(sdl_key=='7') + { + set_cmode(6); + } + if(sdl_key==SDLK_LEFTBRACKET) { + if(sdl_zoom_trig==1) + { + ZSIZE -= 1; + if(ZSIZE>32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + } + else + { + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + bs -= 1; + else + bs -= ceil((bs/5)+0.5f); + if(bs>1224) + bs = 1224; + if(bs<0) + bs = 0; + } + } + if(sdl_key==SDLK_RIGHTBRACKET) { + if(sdl_zoom_trig==1) + { + ZSIZE += 1; + if(ZSIZE>32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + } + else + { + if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) + bs += 1; + else + bs += ceil((bs/5)+0.5f); + if(bs>1224) + bs = 1224; + if(bs<0) + bs = 0; + } + } + if(sdl_key==SDLK_SPACE) + sys_pause = !sys_pause; + if(sdl_key=='h') + hud_enable = !hud_enable; + if(sdl_key=='p') + dump_frame(vid_buf, XRES, YRES, XRES); + if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + if(clipboard_ready==1) + { + load_data = malloc(clipboard_length); + memcpy(load_data, clipboard_data, clipboard_length); + load_size = clipboard_length; + if(load_data) + { + load_img = prerender_save(load_data, load_size, &load_w, &load_h); + if(load_img) + load_mode = 1; + else + free(load_data); + } + } + } + if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 2; + } + if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + save_mode = 1; + copy_mode = 1; + } + else if(sdl_key=='c') + { + set_cmode((cmode+1) % 7); + if(it > 50) + it = 50; + } + if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo + { + int cbx, cby, cbi; + + for(cbi=0; cbi32) + ZSIZE = 32; + if(ZSIZE<2) + ZSIZE = 2; + ZFACTOR = 256/ZSIZE; + sdl_wheel = 0; + } + else + { + bs += sdl_wheel; + if(bs>1224) + bs = 1224; + if(bs<0) + bs = 0; + sdl_wheel = 0; + /*if(su >= PT_NUM) { + if(sl < PT_NUM) + su = sl; + if(sr < PT_NUM) + su = sr; + }*/ + } + } + + bq = b; + b = SDL_GetMouseState(&x, &y); + + for(i=0; i=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy + && x0 && y0 && x>8)>=NPART || !cr)) + { +#ifdef BETA + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); +#else + sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f); +#endif + } + else + { + sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + } + } + mx = x; + my = y; + if(update_flag) + { + info_box(vid_buf, "Finalizing update..."); + if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) + { + update_cleanup(); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + { + if(update_finish()) + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + else + info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); + } + update_flag = 0; + } + + if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && + x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) + { + tmp = malloc(64); +#ifdef BETA + if(is_beta) + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); + } + else + { + sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); + } +#else + sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); +#endif + if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) + { + free(tmp); + tmp = download_ui(vid_buf, my_uri, &i); + if(tmp) + { + save_presets(1); + if(update_start(tmp, i)) + { + update_cleanup(); + save_presets(0); + error_ui(vid_buf, 0, "Update failed - try downloading a new version."); + } + else + return 0; + } + } + else + free(tmp); + } + if(y>=sdl_scale*(YRES+(MENUSIZE-20))) + { + if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) + { + db = svf_own ? 275 : 272; + if(da < 51) + da ++; + } + else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) + { + db = (svf_myvote==1) ? 273 : 274; + if(da < 51) + da ++; + } + else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) + { + db = svf_own ? 257 : 256; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) + { + db = 270; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) + { + db = 266; + if(da < 51) + da ++; + } + else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) + { + db = 259; + if(svf_open && svf_own && x<=55*sdl_scale) + db = 258; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) + { + db = svf_login ? 261 : 260; + if(svf_admin) + { + db = 268; + } + else if(svf_mod) + { + db = 271; + } + if(da < 51) + da ++; + } + else if(x>=sdl_scale && x<=17*sdl_scale) + { + db = 262; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) + { + db = sys_pause ? 264 : 263; + if(da < 51) + da ++; + } + else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) + { + db = 267; + if(da < 51) + da ++; + } + else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) + { + db = 265; + if(da < 51) + da ++; + } + else if(da > 0) + da --; + } + else if(da > 0) + da --; + + if(!sdl_zoom_trig && zoom_en==1) + zoom_en = 0; + + if(sdl_key==Z_keysym && zoom_en==2) + zoom_en = 1; + + if(load_mode) + { + load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); + load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); + if(load_x+load_w>XRES) load_x=XRES-load_w; + if(load_y+load_h>YRES) load_y=YRES-load_h; + if(load_x<0) load_x=0; + if(load_y<0) load_y=0; + if(bq==1 && !b) + { + parse_save(load_data, load_size, 0, load_x, load_y); + free(load_data); + free(load_img); + load_mode = 0; + } + else if(bq==4 && !b) + { + free(load_data); + free(load_img); + load_mode = 0; + } + } + else if(save_mode==1) + { + save_x = (mx/sdl_scale)/CELL; + save_y = (my/sdl_scale)/CELL; + if(save_x >= XRES/CELL) save_x = XRES/CELL-1; + if(save_y >= YRES/CELL) save_y = YRES/CELL-1; + save_w = 1; + save_h = 1; + if(b==1) + { + save_mode = 2; + } + else if(b==4) + { + save_mode = 0; + copy_mode = 0; + } + } + else if(save_mode==2) + { + save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; + save_h = (my/sdl_scale+CELL/2)/CELL - save_y; + if(save_w>XRES/CELL) save_w = XRES/CELL; + if(save_h>YRES/CELL) save_h = YRES/CELL; + if(save_w<1) save_w = 1; + if(save_h<1) save_h = 1; + if(!b) + { + if(copy_mode==1) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + } + else if(copy_mode==2) + { + clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + clipboard_ready = 1; + save_mode = 0; + copy_mode = 0; + clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + } + else + { + stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + save_mode = 0; + } + } + } + else if(sdl_zoom_trig && zoom_en<2) + { + x /= sdl_scale; + y /= sdl_scale; + x -= ZSIZE/2; + y -= ZSIZE/2; + if(x<0) x=0; + if(y<0) y=0; + if(x>XRES-ZSIZE) x=XRES-ZSIZE; + if(y>YRES-ZSIZE) y=YRES-ZSIZE; + zoom_x = x; + zoom_y = y; + zoom_wx = (x 50) + it = 50; + x /= sdl_scale; + y /= sdl_scale; + if(y>=YRES+(MENUSIZE-20)) + { + if(!lb) + { + if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Up")) + { + svf_myvote = 1; + } + } + if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) + { + if(execute_vote(vid_buf, svf_id, "Down")) + { + svf_myvote = -1; + } + } + if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) + tag_list_ui(vid_buf); + if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) + { + legacy_enable = !legacy_enable; + } + if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) + { + memset(signs, 0, sizeof(signs)); + memset(pv, 0, sizeof(pv)); + memset(vx, 0, sizeof(vx)); + memset(vy, 0, sizeof(vy)); + memset(fvx, 0, sizeof(fvx)); + memset(fvy, 0, sizeof(fvy)); + memset(bmap, 0, sizeof(bmap)); + memset(emap, 0, sizeof(emap)); + memset(parts, 0, sizeof(particle)*NPART); + for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) + { + login_ui(vid_buf); + if(svf_login) + save_presets(0); + } + if(x>=37 && x<=187 && svf_login) + { + if(!svf_open || !svf_own || x>51) + { + if(save_name_ui(vid_buf)) + execute_save(vid_buf); + } + else + execute_save(vid_buf); + while(!sdl_poll()) + if(!SDL_GetMouseState(&x, &y)) + break; + b = bq = 0; + } + if(x>=1 && x<=17) + { + search_ui(vid_buf); + memset(fire_bg, 0, XRES*YRES*PIXELSIZE); + memset(fire_r, 0, sizeof(fire_r)); + memset(fire_g, 0, sizeof(fire_g)); + memset(fire_b, 0, sizeof(fire_b)); + } + if(x>=19 && x<=35 && svf_last && svf_open && !bq) + parse_save(svf_last, svf_lsize, 1, 0, 0); + if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) + { + if(b & SDL_BUTTON_LMASK) + set_cmode((cmode+1) % 7); + if(b & SDL_BUTTON_RMASK) + set_cmode((cmode+6) % 7); + save_presets(0); + } + if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) + sys_pause = !sys_pause; + lb = 0; + } + } + else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) + { + c = sl = cr&0xFF; + } + else + { + //Something + } + } + lx = x; + ly = y; + lb = 0; + lm = 0; + } + else + { + //Copy state before drawing any particles (for undo)7 + int cbx, cby, cbi; + + for(cbi=0; cbi=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) + create_line(lx, ly, x, y, bs, c); + } + else + create_box(lx, ly, x, y, c); + lm = 0; + } + lb = 0; + } + + if(load_mode) + { + draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); + xor_rect(vid_buf, load_x, load_y, load_w, load_h); + } + + if(save_mode) + { + xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); + da = 51; + db = 269; + } + + if(zoom_en!=1 && !load_mode && !save_mode) + { + render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); + mousex = mx/sdl_scale; + mousey = my/sdl_scale; + } + + if(zoom_en) + render_zoom(vid_buf); + + if(da) + switch(db) + { + case 256: + drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); + break; + case 257: + drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); + break; + case 258: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); + break; + case 259: + drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); + break; + case 260: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); + break; + case 261: + drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); + break; + case 262: + drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); + break; + case 263: + drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); + break; + case 264: + drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); + break; + case 265: + drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); + break; + case 266: + drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); + break; + case 267: + drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); + break; + case 268: + drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); + break; + case 269: + drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); + break; + case 270: + drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); + break; + case 271: + drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); + break; + case 272: + drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); + break; + case 273: + drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); + break; + case 274: + drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); + break; + case 275: + drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); + break; + default: + drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); + } + if(itc) + { + itc--; + drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); + } + if(it) + { + it--; + drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); + } + + if(old_version) + { + clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); +#ifdef BETA + if(is_beta) + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); + } + else + { + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); + } +#else + drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); +#endif + drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); + } + + if(hud_enable) + { + currentTime = SDL_GetTicks(); + if(currentTime-past>=16) + { + past = SDL_GetTicks(); + FPS++; + } + if(currentTime-pastFPS>=1000) + { +#ifdef BETA + sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); + //printf("%s\n", uitext); +#else + sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); +#endif + FPSB = FPS; + FPS = 0; + pastFPS = currentTime; + } + if(sdl_zoom_trig||zoom_en) + { + if(zoom_x0 || sr == PT_NEUT || sr == PT_PHOT) + player[2] = sr; + else + player[2] = PT_DUST; + } + + } + + http_done(); + return 0; +} + diff --git a/src/md5.c b/src/md5.c new file mode 100644 index 0000000..a51f4fe --- /dev/null +++ b/src/md5.c @@ -0,0 +1,231 @@ +// based on public-domain code from Colin Plumb (1993) +#include +#include + +static unsigned getu32(const unsigned char *addr) +{ + return (((((unsigned long)addr[3] << 8) | addr[2]) << 8) | addr[1]) << 8 | addr[0]; +} + +static void putu32(unsigned data, unsigned char *addr) +{ + addr[0] = (unsigned char)data; + addr[1] = (unsigned char)(data >> 8); + addr[2] = (unsigned char)(data >> 16); + addr[3] = (unsigned char)(data >> 24); +} + +void md5_init(struct md5_context *ctx) +{ + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bits[0] = 0; + ctx->bits[1] = 0; +} + +void md5_update(struct md5_context *ctx, unsigned char const *buf, unsigned len) +{ + unsigned t; + + // update bit count + t = ctx->bits[0]; + if((ctx->bits[0] = (t + ((unsigned)len << 3)) & 0xffffffff) < t) + ctx->bits[1]++; // carry + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; + + // use leading data to top up the buffer + + if(t) + { + unsigned char *p = ctx->in + t; + + t = 64-t; + if (len < t) + { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + md5_transform(ctx->buf, ctx->in); + buf += t; + len -= t; + } + + // following 64-byte chunks + + while(len >= 64) + { + memcpy(ctx->in, buf, 64); + md5_transform(ctx->buf, ctx->in); + buf += 64; + len -= 64; + } + + // save rest of bytes for later + + memcpy(ctx->in, buf, len); +} + +void md5_final(unsigned char digest[16], struct md5_context *ctx) +{ + unsigned count; + unsigned char *p; + + // #bytes mod64 + count = (ctx->bits[0] >> 3) & 0x3F; + + // first char of padding = 0x80 + p = ctx->in + count; + *p++ = 0x80; + + // calculate # of bytes to pad + count = 64 - 1 - count; + + // Pad out to 56 mod 64 + if(count < 8) + { + // we need to finish a whole block before padding + memset(p, 0, count); + md5_transform(ctx->buf, ctx->in); + memset(ctx->in, 0, 56); + } + else + { + // just pad to 56 bytes + memset(p, 0, count-8); + } + + // append length & final transform + putu32(ctx->bits[0], ctx->in + 56); + putu32(ctx->bits[1], ctx->in + 60); + + md5_transform(ctx->buf, ctx->in); + putu32(ctx->buf[0], digest); + putu32(ctx->buf[1], digest + 4); + putu32(ctx->buf[2], digest + 8); + putu32(ctx->buf[3], digest + 12); + memset(ctx, 0, sizeof(ctx)); +} + +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w &= 0xffffffff, w = w<>(32-s), w += x ) + +void md5_transform(unsigned buf[4], const unsigned char inraw[64]) +{ + unsigned a, b, c, d; + unsigned in[16]; + int i; + + for (i = 0; i < 16; ++i) + in[i] = getu32 (inraw + 4 * i); + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} + +static char hex[] = "0123456789abcdef"; +void md5_ascii(char *result, unsigned char const *buf, unsigned len) +{ + struct md5_context md5; + unsigned char hash[16]; + int i; + + if(len==0) + len = strlen((char *)buf); + + md5_init(&md5); + md5_update(&md5, buf, len); + md5_final(hash, &md5); + + for(i=0; i<16; i++) + { + result[i*2] = hex[(hash[i]>>4)&0xF]; + result[i*2+1] = hex[hash[i]&0x0F]; + } + result[32] = 0; +} diff --git a/src/misc.c b/src/misc.c new file mode 100644 index 0000000..7c551e2 --- /dev/null +++ b/src/misc.c @@ -0,0 +1,283 @@ +#include +#include +#include +#include "misc.h" +#include "defines.h" +#include "interface.h" +#include "graphics.h" + +//Signum function +#ifdef WIN32 +_inline int isign(float i) +#else +inline int isign(float i) +#endif +{ + if (i<0) + return -1; + if (i>0) + return 1; + return 0; +} + +#ifdef WIN32 +_inline unsigned clamp_flt(float f, float min, float max) +#else +inline unsigned clamp_flt(float f, float min, float max) +#endif +{ + if(fmax) + return 255; + return (int)(255.0f*(f-min)/(max-min)); +} + +#ifdef WIN32 +_inline float restrict_flt(float f, float min, float max) +#else +inline float restrict_flt(float f, float min, float max) +#endif +{ + if(fmax) + return max; + return f; +} + +char *mystrdup(char *s) +{ + char *x; + if(s) + { + x = (char*)malloc(strlen(s)+1); + strcpy(x, s); + return x; + } + return s; +} + +void strlist_add(struct strlist **list, char *str) +{ + struct strlist *item = malloc(sizeof(struct strlist)); + item->str = mystrdup(str); + item->next = *list; + *list = item; +} + +int strlist_find(struct strlist **list, char *str) +{ + struct strlist *item; + for(item=*list; item; item=item->next) + if(!strcmp(item->str, str)) + return 1; + return 0; +} + +void strlist_free(struct strlist **list) +{ + struct strlist *item; + while(*list) + { + item = *list; + *list = (*list)->next; + free(item); + } +} + +void save_presets(int do_update) +{ + FILE *f=fopen("powder.def", "wb"); + unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; + unsigned char tmp = sdl_scale; + if(!f) + return; + fwrite(sig, 1, 4, f); + save_string(f, svf_user); + save_string(f, svf_pass); + fwrite(&tmp, 1, 1, f); + tmp = cmode; + fwrite(&tmp, 1, 1, f); + tmp = svf_admin; + fwrite(&tmp, 1, 1, f); + tmp = svf_mod; + fwrite(&tmp, 1, 1, f); + save_string(f, http_proxy_string); + tmp = SAVE_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = MINOR_VERSION; + fwrite(&tmp, 1, 1, f); + tmp = do_update; + fwrite(&tmp, 1, 1, f); + fclose(f); +} + +void load_presets(void) +{ + FILE *f=fopen("powder.def", "rb"); + unsigned char sig[4], tmp; + if(!f) + return; + fread(sig, 1, 4, f); + if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) + { + if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) + { + if(fseek(f, -3, SEEK_END)) + { + remove("powder.def"); + return; + } + if(fread(sig, 1, 3, f) != 3) + { + remove("powder.def"); + goto fail; + } + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; + } + fclose(f); + remove("powder.def"); + return; + } + if(load_string(f, svf_user, 63)) + goto fail; + if(load_string(f, svf_pass, 63)) + goto fail; + svf_login = !!svf_user[0]; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + sdl_scale = (tmp == 2) ? 2 : 1; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + cmode = tmp%7; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_admin = tmp; + if(fread(&tmp, 1, 1, f) != 1) + goto fail; + svf_mod = tmp; + if(load_string(f, http_proxy_string, 255)) + goto fail; + if(fread(sig, 1, 3, f) != 3) + goto fail; + last_major = sig[0]; + last_minor = sig[1]; + update_flag = sig[2]; +fail: + fclose(f); +} + +void save_string(FILE *f, char *str) +{ + int li = strlen(str); + unsigned char lb[2]; + lb[0] = li; + lb[1] = li >> 8; + fwrite(lb, 2, 1, f); + fwrite(str, li, 1, f); +} + +int load_string(FILE *f, char *str, int max) +{ + int li; + unsigned char lb[2]; + fread(lb, 2, 1, f); + li = lb[0] | (lb[1] << 8); + if(li > max) + { + str[0] = 0; + return 1; + } + fread(str, li, 1, f); + str[li] = 0; + return 0; +} + +void strcaturl(char *dst, char *src) +{ + char *d; + unsigned char *s; + + for(d=dst; *d; d++) ; + + for(s=(unsigned char *)src; *s; s++) + { + if((*s>='0' && *s<='9') || + (*s>='a' && *s<='z') || + (*s>='A' && *s<='Z')) + *(d++) = *s; + else + { + *(d++) = '%'; + *(d++) = hex[*s>>4]; + *(d++) = hex[*s&15]; + } + } + *d = 0; +} + +void strappend(char *dst, char *src) +{ + char *d; + unsigned char *s; + + for(d=dst; *d; d++) ; + + for(s=(unsigned char *)src; *s; s++) + { + *(d++) = *s; + } + *d = 0; +} + +void *file_load(char *fn, int *size) +{ + FILE *f = fopen(fn, "rb"); + void *s; + + if(!f) + return NULL; + fseek(f, 0, SEEK_END); + *size = ftell(f); + fseek(f, 0, SEEK_SET); + s = malloc(*size); + if(!s) + { + fclose(f); + return NULL; + } + fread(s, *size, 1, f); + fclose(f); + return s; +} + +int cpu_check(void) +{ +#ifdef MACOSX + return 0; +#else +#ifdef X86 + unsigned af,bf,cf,df; + x86_cpuid(0, af, bf, cf, df); + if(bf==0x68747541 && cf==0x444D4163 && df==0x69746E65) + amd = 1; + x86_cpuid(1, af, bf, cf, df); +#ifdef X86_SSE + if(!(df&(1<<25))) + return 1; +#endif +#ifdef X86_SSE2 + if(!(df&(1<<26))) + return 1; +#endif +#ifdef X86_SSE3 + if(!(cf&1)) + return 1; +#endif +#endif +#endif + return 0; +} \ No newline at end of file diff --git a/src/powder.c b/src/powder.c new file mode 100644 index 0000000..5880554 --- /dev/null +++ b/src/powder.c @@ -0,0 +1,3199 @@ +#include +#include +#include +#include +#include +#include + +int isplayer = 0; +float player[27]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index, [19]-[26] are accelerations + +particle *parts; +particle *cb_parts; + +unsigned char bmap[YRES/CELL][XRES/CELL]; +unsigned char emap[YRES/CELL][XRES/CELL]; + +unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +unsigned char cb_emap[YRES/CELL][XRES/CELL]; + +int pfree; + +unsigned pmap[YRES][XRES]; +unsigned cb_pmap[YRES][XRES]; + +int try_move(int i, int x, int y, int nx, int ny) +{ + unsigned r; + + + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) + return 0; + if(x==nx && y==ny) + return 1; + r = pmap[ny][nx]; + if(r && (r>>8)>8].type; + + if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) + { + return 1; + } + + if((r&0xFF)==PT_VOID) + { + parts[i].type=PT_NONE; + return 0; + } + if((r&0xFF)==PT_BHOL) + { + parts[i].type=PT_NONE; + if(!legacy_enable) + { + parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; + } + return 0; + } + + if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide + { + return 1; + } + + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) + { + return 1; + } + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) + { + return 0; + } + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) + { + return 0; + } + + if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; + if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + return 0; + if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) + return 0; + + if(parts[i].type==PT_CNCT && y>8)>= 8; + parts[r].x += x-nx; + parts[r].y += y-ny; + } + + return 1; +} + +void kill_part(int i) +{ + int x, y; + parts[i].type = PT_NONE; + + x = (int)(parts[i].x+0.5f); + y = (int)(parts[i].y+0.5f); + + if(x>=0 && y>=0 && x=XRES || y>=YRES) + return -1; + + if(t==SPC_HEAT||t==SPC_COOL) + { + if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); + } + if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) + { + parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); + } + return pmap[y][x]>>8; + } + else + { + return -1; + } + } + if(t==SPC_AIR) + { + pv[y/CELL][x/CELL] += 0.03f; + if(y+CELL>8].type = PT_SPRK; + parts[pmap[y][x]>>8].life = 4; + parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; + pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; + return pmap[y][x]>>8; + } + + if(p==-1) + { + if(pmap[y][x]) + return -1; + if(pfree == -1) + return -1; + i = pfree; + pfree = parts[i].life; + } + else + i = p; + + if(t==PT_GLAS) + { + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + } + if(t!=PT_STKM) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = t; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 0; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + parts[i].tmp = 0; + } + if(t==PT_ACID) + { + parts[i].life = 75; + } + /*Testing + if(t==PT_WOOD){ + parts[i].life = 150; + } + End Testing*/ + if(t==PT_FUSE) { + parts[i].life = 50; + parts[i].tmp = 50; + } + if(t==PT_FSEP) + parts[i].life = 50; + if(t==PT_COAL) + parts[i].life = 110; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_PLSM) + parts[i].life = rand()%150+50; + if(t==PT_HFLM) + parts[i].life = rand()%150+50; + if(t==PT_LAVA) + parts[i].life = rand()%120+240; + if(t==PT_NBLE) + parts[i].life = 0; + if(t==PT_ICEI) + parts[i].ctype = PT_WATR; + if(t==PT_NEUT) + { + float r = (rand()%128+128)/127.0f; + float a = (rand()%360)*3.14159f/180.0f; + parts[i].life = rand()%480+480; + parts[i].vx = r*cosf(a); + parts[i].vy = r*sinf(a); + } + if(t==PT_PHOT) + { + float r = (rand()%3-1)*3; + float a = (rand()%3-1)*3; + parts[i].life = 680; + if(a==0.0f&&r==0.0f) + { + parts[i].life = 0; + parts[i].type = PT_NONE; + return -1; + } + else + { + parts[i].vx = a; + parts[i].vy = r; + } + //} else { + // parts[i].life = 0; + // parts[i].type = PT_NONE; + //}/ + } + + if(t!=PT_STKM) + pmap[y][x] = t|(i<<8); + else + { + if(isplayer==0) + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + + + + player[3] = x-1; //Setting legs positions + player[4] = y+6; + player[5] = x-1; + player[6] = y+6; + + player[7] = x-3; + player[8] = y+12; + player[9] = x-3; + player[10] = y+12; + + player[11] = x+1; + player[12] = y+6; + player[13] = x+1; + player[14] = y+6; + + player[15] = x+3; + player[16] = y+12; + player[17] = x+3; + player[18] = y+12; + + isplayer = 1; + } + } + + return i; +} + +#ifdef WIN32 +_inline void delete_part(int x, int y) +#else +inline void delete_part(int x, int y) +#endif +{ + unsigned i; + + if(x<0 || y<0 || x>=XRES || y>=YRES) + return; + i = pmap[y][x]; + if(!i || (i>>8)>=NPART) + return; + + kill_part(i>>8); + pmap[y][x] = 0; // just in case +} + +#ifdef WIN32 +_inline int is_wire(int x, int y) +#else +inline int is_wire(int x, int y) +#endif +{ + return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; +} + +#ifdef WIN32 +_inline int is_wire_off(int x, int y) +#else +inline int is_wire_off(int x, int y) +#endif +{ + return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; +} + +void set_emap(int x, int y) +{ + int x1, x2; + + if(!is_wire_off(x, y)) + return; + + // go left as far as possible + x1 = x2 = x; + while(x1>0) + { + if(!is_wire_off(x1-1, y)) + break; + x1--; + } + while(x21 && x1==x2 && + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + set_emap(x1, y-2); + else if(y>0) + for(x=x1; x<=x2; x++) + if(is_wire_off(x, y-1)) + { + if(x==x1 || x==x2 || y>=YRES/CELL-1 || + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + set_emap(x, y-1); + } + + if(y>8) < NPART && (pmr>>8) >= 1) + { + return parts[pmr>>8].type; + } + else + { + return PT_NONE; + } +} + +int nearest_part(int ci, int t) +{ + int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); + int ndistance = 0; + int id = -1; + int i = 0; + int cx = (int)parts[ci].x; + int cy = (int)parts[ci].y; + for(i=0; i=XRES || y>=YRES || + ((bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) + { + kill_part(i); + continue; + } + + vx[y/CELL][x/CELL] *= ptypes[t].airloss; + vy[y/CELL][x/CELL] *= ptypes[t].airloss; + vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + if(t==PT_GAS||t==PT_NBLE) + { + if(pv[y/CELL][x/CELL]<3.5f) + pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); + if(y+CELL2.5f) + { + parts[i].life = rand()%80+180; + rt = parts[i].type = PT_FIRE; + parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + pv[y/CELL][x/CELL] += 0.25f * CFDS; + t = PT_FIRE; + } + + parts[i].vx *= ptypes[t].loss; + parts[i].vy *= ptypes[t].loss; + + if(t==PT_GOO && !parts[i].life) + { + if(pv[y/CELL][x/CELL]>1.0f) + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; + parts[i].life = rand()%80+300; + } + } + else + { + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; + } + + if(ptypes[t].diffusion) + { + parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); + } + + // interpolator +#ifdef WIN32 + mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#else + mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); +#endif + if(mv < ISTP) + { + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + } + else + { + dx = parts[i].vx*ISTP/mv; + dy = parts[i].vy*ISTP/mv; + ix = parts[i].x; + iy = parts[i].y; + while(1) + { + mv -= ISTP; + if(mv <= 0.0f) + { + // nothing found + parts[i].x += parts[i].vx; + parts[i].y += parts[i].vy; + ix = parts[i].x; + iy = parts[i].y; + break; + } + ix += dx; + iy += dy; + nx = (int)(ix+0.5f); + ny = (int)(iy+0.5f); + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) + { + parts[i].x = ix; + parts[i].y = iy; + break; + } + } + } + + a = nt = 0; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx4.0f) + t = parts[i].type = PT_DSTW; + if(t==PT_OIL && pv[y/CELL][x/CELL]<-6.0f) + t = parts[i].type = PT_GAS; + if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) + t = parts[i].type = PT_OIL; + if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) + t = parts[i].type = PT_FIRE; + } + if(t==PT_GAS && pv[y/CELL][x/CELL]<-6.0f) + t = parts[i].type = PT_OIL; + if(t==PT_DESL && pv[y/CELL][x/CELL]>5.0f) // Only way I know to make it + t = parts[i].type = PT_FIRE; // combust under pressure. + if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) + t = parts[i].type = PT_OIL; + if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) + t = parts[i].type = PT_BRMT; + if(t==PT_BRCK && pv[y/CELL][x/CELL]>2.8f) + t = parts[i].type = PT_STNE; + //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) + // t = parts[i].type = PT_BGLA; + if(t==PT_GLAS) + { + parts[i].pavg[0] = parts[i].pavg[1]; + parts[i].pavg[1] = pv[y/CELL][x/CELL]; + if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) + { + parts[i].type = PT_BGLA; + } + } + if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) + t = parts[i].type = PT_SNOW; + if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) + { + t = PT_NEUT; + create_part(i, x, y, t); + } + + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) + { + nearp = nearest_part(i, PT_ETRD); + if(nearp!=-1) + { + create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[nearp].type = PT_SPRK; + parts[nearp].life = 9; + parts[nearp].ctype = PT_ETRD; + } + } + + if(!legacy_enable) + { + int ctemp = pv[y/CELL][x/CELL]*2; + c_heat = 0.0f; + h_count = 0; + if(t==PT_ICEI && !parts[i].ctype) + parts[i].ctype = PT_WATR; + if(ptypes[t].hconduct>(rand()%250)&&!(parts[i].type==PT_HSWC&&parts[i].life!=10)) + { + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)) + { + h_count++; + c_heat += parts[r>>8].temp; + } + } + } + } + pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); + for(nx=-1; nx<2; nx++) + { + for(ny=-1; ny<2; ny++) + { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)) + { + parts[r>>8].temp = parts[i].temp; + } + } + } + } + if(pt>=pstates[t].btemp&&pstates[t].burn) + { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE||t==PT_PLSM) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) + { + if(t==PT_LAVA&&parts[i].ctype) + { + parts[i].life = 0; + if(parts[i].ctype==PT_THRM) + { + parts[i].tmp = 0; + parts[i].ctype = PT_BMTL; + } + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) + { + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } + else + { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } + else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) + { + if(pstates[t].liquid==PT_LAVA) + { + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } + else if(t==PT_ICEI&&parts[i].ctype) + { + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else + { + t = parts[i].type = pstates[t].liquid; + } + } + else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) + { + t = parts[i].type = pstates[t].liquid; + } + else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) + { + if(t==PT_SLTW&&1>rand()%6) + { + t = parts[i].type = PT_SALT; + } + else + { + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_HFLM) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) + { + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA) + { + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + if(parts[i].ctype==PT_THRM&&parts[i].tmp>0) + { + parts[i].tmp--; + parts[i].temp = 3500; + } + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } + } + if(t==PT_PTCT&&parts[i].temp>295.0f) + { + pt = parts[i].temp -= 2.5f; + } + if(t==PT_NTCT&&parts[i].temp>295.0f) + { + pt = parts[i].temp -= 2.5f; + } + + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_NTCT || t==PT_PTCT || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) + { + nx = x % CELL; + if(nx == 0) + nx = x/CELL - 1; + else if(nx == CELL-1) + nx = x/CELL + 1; + else + nx = x/CELL; + ny = y % CELL; + if(ny == 0) + ny = y/CELL - 1; + else if(ny == CELL-1) + ny = y/CELL + 1; + else + ny = y/CELL; + if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) + { + t = parts[i].type = PT_NONE; + parts[r>>8].ctype = parts[r>>8].type; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + } + else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) + { + pv[y/CELL][x/CELL] += 100.0f; + if(legacy_enable&&1>(rand()%200)) + { + parts[i].life = rand()%50+120; + t = parts[i].type = PT_FIRE; + } + else + { + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_ICEI || t==PT_SNOW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if(legacy_enable) + { + if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) + { + t = parts[i].type = PT_ICEI; + parts[r>>8].type = PT_ICEI; + } + if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) + t = parts[i].type = PT_WATR; + } + } + } + else if(t==PT_COAL) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + create_part(-1, x, y, PT_FIRE); + goto killed; + } else if(parts[i].life < 100) { + parts[i].life--; + create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); + } + + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) + { + if(parts[i].life>100) { + parts[i].life = 99; + } + } + } + } + else if(t==PT_FUSE) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%100)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + if(pv[y/CELL][x/CELL] > 0.8f) + parts[i].tmp--; + else if(parts[i].tmp<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_FSEP); + goto killed; + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) + { + if(parts[i].life>40) { + parts[i].life = 39; + } + } + } + } + else if(t==PT_FSEP) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%10)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) + { + if(parts[i].life>40) { + parts[i].life = 39; + } + } + } + } + else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL && parts_avg(i, r>>8)!=PT_INSL) + { + parts[i].temp = 473.0f; + } + } + } + else if(t==PT_PLNT) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR && 1>(rand()%250)) + { + t = parts[i].type = PT_PLNT; + parts[r>>8].type = PT_PLNT; + } + else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_THRM) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA)) + { + if(1>(rand()%500)) { + t = parts[i].type = PT_LAVA; + parts[i].ctype = PT_BMTL; + pt = parts[i].temp = 3500.0f; + pv[y/CELL][x/CELL] += 50.0f; + } else { + t = parts[i].type = PT_LAVA; + parts[i].life = 400; + parts[i].ctype = PT_THRM; + pt = parts[i].temp = 3500.0f; + parts[i].tmp = 20; + } + } + //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) + //t = parts[i].type = PT_WATR; + } + } + else if(t==PT_WATR||t==PT_DSTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%250)) + { + t = parts[i].type = PT_SLTW; + parts[r>>8].type = PT_SLTW; + } + if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_WATR; + } + if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) + { + t = parts[i].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_SLTW) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) + { + t = parts[i].type = PT_SALT; + parts[r>>8].type = PT_WTRV; + } + else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) + { + parts[r>>8].type = PT_SLTW; + } + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + } + } + else if(t==PT_WTRV) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + parts[r>>8].type = PT_WATR; + } + + if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) + { + parts[i].life = 4; + t = parts[i].type = PT_FIRE; + + } + if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) + { + t = parts[i].type = PT_WATR; + if(1>(rand()%1000)) + parts[r>>8].type = PT_WATR; + } + } + } + else if(t==PT_YEST) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_DYST && 1>(rand()%30) && !legacy_enable) + { + t = parts[i].type = PT_DYST; + } + } + } + else if(t==PT_ACID) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)!=PT_ACID) + { + if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) + { + t = parts[i].type = PT_FIRE; + parts[i].life = 4; + parts[r>>8].type = PT_FIRE; + parts[r>>8].life = 4; + } + else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) + { + parts[i].life--; + parts[r>>8].type = PT_NONE; + } + else if (parts[i].life==50) + { + parts[i].life = 0; + t = parts[i].type = PT_NONE; + } + } + } + } + else if(t==PT_NEUT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) + { + if(33>rand()%100) + { + create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); + } + else + { + create_part(r>>8, x+nx, y+ny, PT_NEUT); + parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; + parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; + } + pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough + fe ++; + } + if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) + parts[r>>8].type = PT_DUST; + if((r&0xFF)==PT_DYST && 15>(rand()%1000)) + parts[r>>8].type = PT_YEST; + if((r&0xFF)==PT_YEST) { + if(15>(rand()%100000)&&isplayer==0) + parts[r>>8].type = PT_STKM; + else + parts[r>>8].type = PT_DYST; + } + + if((r&0xFF)==PT_WATR && 15>(rand()%100)) + parts[r>>8].type = PT_DSTW; + if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) + parts[r>>8].type = PT_GOO; + if((r&0xFF)==PT_NITR && 15>(rand()%1000)) + parts[r>>8].type = PT_DESL; + if((r&0xFF)==PT_PLNT && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + if((r&0xFF)==PT_DESL && 15>(rand()%1000)) + parts[r>>8].type = PT_GAS; + if((r&0xFF)==PT_COAL && 5>(rand()%100)) + parts[r>>8].type = PT_WOOD; + /*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && + (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| + ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| + ptypes[parts[r>>8].type-1].menusection==SC_GAS|| + ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000)) + parts[r>>8].type--;*/ + } + } + else if(t==PT_PHOT) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=0; nx<1; nx++) + for(ny=0; ny<1; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) + { + parts[i].vx *= 0.995; + parts[i].vy *= 0.995; + } + } + } + else if(t==PT_LCRY) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_LCRY) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_PCLN) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_PCLN) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_HSWC) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_SPRK) + { + if(parts[r>>8].ctype==PT_PSCN) + { + parts[i].life = 10; + } + else if(parts[r>>8].ctype==PT_NSCN) + { + parts[i].life = 9; + } + } + if(rt==PT_HSWC) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + else if(t==PT_AMTR) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL) + { + t = parts[i].life++; + if(parts[i].life==3) + { + parts[i].type = PT_NONE; + kill_part(i); + } + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + kill_part(r>>8); + if(2>(rand()/(RAND_MAX/100))) + create_part(r>>8, x+nx, y+ny, PT_PHOT); + pv[y/CELL][x/CELL] -= 5.0f; + continue; + } + } + } + else if(t==PT_FIRW) { + if(parts[i].tmp==0) { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(rt==PT_FIRE||rt==PT_PLSM||rt==PT_THDR) + { + parts[i].tmp = 1; + parts[i].life = rand()%50+120; + } + } + } + else if(parts[i].tmp==1) { + if(parts[i].life==0) { + parts[i].tmp=2; + } else { + float newVel = parts[i].life/50; + parts[i].flags = parts[i].flags&0xFFFFFFFE; + if((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE) { + parts[i].vy = -newVel; + ly-=newVel; + iy-=newVel; + } + } + } + else if(parts[i].tmp==2) { + for(nx=-2; nx<3; nx++) { + for(ny=-2; ny<3; ny++) { + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type==PT_FIRW) { + parts[r>>8].vx = (rand()%3-1)*tmul; + parts[r>>8].vy = (rand()%3-1)*tmul; + parts[r>>8].tmp = 3; + parts[r>>8].life = rand()%100+100; + parts[r>>8].temp = 6000.0f; + } + } + } + } + pv[y/CELL][x/CELL] += 20; + kill_part(i); + } else if(parts[i].tmp==3) { + if(parts[i].life<=0) { + kill_part(i); + } + } + } + else if(t==PT_BTRY) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts_avg(i,r>>8) != PT_INSL) + { + if((rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) + { + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + parts[r>>8].type = PT_SPRK; + } + } + } + } else if(t==PT_SWCH) + { + rt = 3 + (int)pv[y/CELL][x/CELL]; + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + rt = parts[r>>8].type; + if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8)!=PT_INSL) + { + if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) + { + parts[i].life = 9; + } + else if(parts[i].life==0&&parts[r>>8].life==10) + { + parts[i].life = 10; + } + } + } + } + if(t==PT_SWCH) + if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) + { + parts[i].life--; + } + if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) + { + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) + continue; + rt = parts[r>>8].type; + if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) + { + parts[r>>8].type = PT_FIRE; + parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); + parts[r>>8].life = rand()%80+180; + if(ptypes[rt].explosive) + pv[y/CELL][x/CELL] += 0.25f * CFDS; + continue; + } + lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; + if(lpv < 1) lpv = 1; + if(legacy_enable) + { + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && + ptypes[rt].meltable*lpv>(rand()%1000)) + { + if(t!=PT_LAVA || parts[i].life>0) + { + parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; + parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; + parts[r>>8].type = PT_LAVA; + parts[r>>8].life = rand()%120+240; + } + else + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; + parts[i].ctype = PT_NONE;//rt; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) + { + parts[r>>8].type = PT_WATR; + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = PT_STNE; + goto killed; + } + } + if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) + { + kill_part(r>>8); + if(t==PT_FIRE) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + goto killed; + } + if(t==PT_LAVA) + { + parts[i].life = 0; + t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; + parts[i].ctype = PT_NONE; + goto killed; + } + } + } + pavg = parts_avg(i, r>>8); + if(rt==PT_SWCH && t==PT_SPRK) + { + pavg = parts_avg(r>>8, i); + if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) + parts[r>>8].life = 10; + if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) + parts[r>>8].life = 9; + if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].ctype = PT_SWCH; + parts[r>>8].life = 4; + } + } + pavg = parts_avg(i, r>>8); + if(pavg != PT_INSL) + { + if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + if(parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) + parts[r>>8].temp = parts[r>>8].temp+10.0f; + } + } + if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp>373.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].temp<373.0f))&&pavg != PT_INSL) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 && + (parts[i].life<3 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 6; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && + (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; + parts[r>>8].life = 5; + parts[r>>8].ctype = rt; + } + if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) + { + if(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) + { + t = parts[i].type = PT_ETRD; + parts[i].ctype = PT_NONE; + parts[i].life = 20; + parts[r>>8].type = PT_SPRK; + parts[r>>8].life = 4; + parts[r>>8].ctype = rt; + } + } + + if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) + { + parts[i].life = rand()%150+50; + parts[i].type = PT_PLSM; + parts[i].ctype = PT_NBLE; + parts[i].temp = 3500; + pv[y/CELL][x/CELL] += 1; + } + if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) + { + parts[i].type = PT_SWCH; + parts[i].life = 11; + } + } + } +killed: + if(parts[i].type == PT_NONE) + continue; + } + if(t==PT_STKM) + { + float dt = 0.9;///(FPSB*FPSB); //Delta time in square + //Tempirature handling + if(parts[i].temp<243) + parts[i].life -= 1; + if((parts[i].temp<309.6f) && (parts[i].temp>=243)) + parts[i].temp += 1; + + //Death + if(parts[i].life<1 || death == 1 || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... + { + death = 0; + for(r=-2; r<=1; r++) + { + create_part(-1, x+r, y-2, player[2]); + create_part(-1, x+r+1, y+2, player[2]); + create_part(-1, x-2, y+r+1, player[2]); + create_part(-1, x+2, y+r, player[2]); + } + kill_part(i); //Kill him + goto killed; + } + + parts[i].vy += -0.7*dt; //Head up! + + //Verlet integration + pp = 2*player[3]-player[5]+player[19]*dt*dt;; + player[5] = player[3]; + player[3] = pp; + pp = 2*player[4]-player[6]+player[20]*dt*dt;; + player[6] = player[4]; + player[4] = pp; + + pp = 2*player[7]-player[9]+player[21]*dt*dt;; + player[9] = player[7]; + player[7] = pp; + pp = 2*player[8]-player[10]+(player[22]+1)*dt*dt;; + player[10] = player[8]; + player[8] = pp; + + pp = 2*player[11]-player[13]+player[23]*dt*dt;; + player[13] = player[11]; + player[11] = pp; + pp = 2*player[12]-player[14]+player[24]*dt*dt;; + player[14] = player[12]; + player[12] = pp; + + pp = 2*player[15]-player[17]+player[25]*dt*dt;; + player[17] = player[15]; + player[15] = pp; + pp = 2*player[16]-player[18]+(player[26]+1)*dt*dt;; + player[18] = player[16]; + player[16] = pp; + + //Setting acceleration to 0 + player[19] = 0; + player[20] = 0; + + player[21] = 0; + player[22] = 0; + + player[23] = 0; + player[24] = 0; + + player[25] = 0; + player[26] = 0; + + //Go left + if (((int)(player[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[21] = -3; + player[22] = -2; + player[19] = -2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[25] = -3; + player[26] = -2; + player[23] = -2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids + { + player[21] = -1; + player[22] = -1; + player[19] = -1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[25] = -1; + player[26] = -1; + player[23] = -1; + } + } + } + + //Go right + if (((int)(player[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) + { + if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[21] = 3; + player[22] = -2; + player[19] = 2; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[25] = 3; + player[26] = -2; + player[23] = 2; + } + } + else + { + if (pmap[(int)(player[8]-1)][(int)(player[7])]) + { + player[21] = 1; + player[22] = -1; + player[19] = 1; + } + + if (pmap[(int)(player[16]-1)][(int)(player[15])]) + { + player[25] = 1; + player[26] = -1; + player[23] = 1; + } + + } + } + + //Jump + if (((int)(player[0])&0x04) == 0x04 && (pstates[pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF].state != ST_GAS || pstates[pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF].state != ST_GAS)) + { + if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) + { + parts[i].vy = -5; + player[22] -= 1; + player[26] -= 1; + } + } + + //Charge detector wall if foot inside + if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) + set_emap((int)player[7]/CELL, (int)player[8]/CELL); + if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) + set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); + + //Searching for particles near head + for(nx = -2; nx <= 2; nx++) + for(ny = 0; ny>=-2; ny--) + { + if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) + continue; + if(ptypes[pmap[ny+y][nx+x]&0xFF].falldown!=0 || (pmap[ny+y][nx+x]&0xFF) == PT_NEUT || (pmap[ny+y][nx+x]&0xFF) == PT_PHOT) + { + player[2] = pmap[ny+y][nx+x]&0xFF; //Current element + } + if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP + { + if(parts[i].life<=95) + parts[i].life += 5; + else + parts[i].life = 100; + kill_part(pmap[ny+y][nx+x]>>8); + } + + if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) + { + parts[i].life -= (102-parts[i].life)/2; + kill_part(pmap[ny+y][nx+x]>>8); + } + if(bmap[(ny+y)/CELL][(nx+x)/CELL]==4) + player[2] = SPC_AIR; + } + + //Head position + nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); + ny = y - 3*(player[1] == 0); + + //Spawn + if(((int)(player[0])&0x08) == 0x08) + { + ny -= 2*(rand()%2)+1; + r = pmap[ny][nx]; + if(!((r>>8)>=NPART)) + { + if(pstates[r&0xFF].state == ST_SOLID) + { + create_part(-1, nx, ny, PT_SPRK); + } + else + { + if(player[2] == SPC_AIR) + create_parts(nx + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01), ny, 4, SPC_AIR); + else + create_part(-1, nx, ny, player[2]); + + r = pmap[ny][nx]; + if( ((r>>8) < NPART) && (r>>8)>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR) + parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); + if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) + { + int random = abs(rand()%3-1)*3; + if (random==0) + { + parts[r>>8].life = 0; + parts[r>>8].type = PT_NONE; + } + else + { + parts[r>>8].vy = 0; + parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; + } + } + + } + } + } + + //Simulation of joints + d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance + player[7] -= (player[3]-player[7])*d; + player[8] -= (player[4]-player[8])*d; + player[3] += (player[3]-player[7])*d; + player[4] += (player[4]-player[8])*d; + + d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; + player[15] -= (player[11]-player[15])*d; + player[16] -= (player[12]-player[16])*d; + player[11] += (player[11]-player[15])*d; + player[12] += (player[12]-player[16])*d; + + d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[3]-parts[i].x)*d; + parts[i].vy -= (player[4]-parts[i].y)*d; + player[3] += (player[3]-parts[i].x)*d; + player[4] += (player[4]-parts[i].y)*d; + + d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; + parts[i].vx -= (player[11]-parts[i].x)*d; + parts[i].vy -= (player[12]-parts[i].y)*d; + player[11] += (player[11]-parts[i].x)*d; + player[12] += (player[12]-parts[i].y)*d; + + //Side collisions checking + for(nx = -3; nx <= 3; nx++) + { + r = pmap[(int)(player[16]-2)][(int)(player[15]+nx)]; + if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID) + player[15] -= nx; + + r = pmap[(int)(player[8]-2)][(int)(player[7]+nx)]; + if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID) + player[7] -= nx; + } + + //Collision checks + for(ny = -2-(int)parts[i].vy; ny<=0; ny++) + { + r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) + + //For left leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks //Liquid checks + { + if(parts[i].y<(player[8]-10)) + parts[i].vy = 1*dt; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5*dt; + } + else + { + if(pstates[r&0xFF].state != ST_GAS) + { + player[8] += ny-1; + parts[i].vy -= 0.5*parts[i].vy*dt; + } + } + player[9] = player[7]; + } + + r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; + + //For right leg + if (r && (r&0xFF)!=PT_STKM) + { + if(pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) + { + if(parts[i].y<(player[16]-10)) + parts[i].vy = 1*dt; + else + parts[i].vy = 0; + if(abs(parts[i].vx)>1) + parts[i].vx *= 0.5*dt; + } + else + { + if(pstates[r&0xFF].state != ST_GAS) + { + player[16] += ny-1; + parts[i].vy -= 0.5*parts[i].vy*dt; + } + } + player[17] = player[15]; + } + + //If it falls too fast + if (parts[i].vy>=30) + { + parts[i].y -= (10+ny)*dt; + parts[i].vy = -10*dt; + } + + } + + //Keeping legs distance + if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) + { + player[21] -= 0.2; + player[25] += 0.2; + } + + if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) + { + player[19] -= 0.2; + player[23] += 0.2; + } + + //If legs touch something + r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=323 || parts[r>>8].temp<=243) + { + parts[i].life -= 2; + player[26] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; + if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=323 || parts[r>>8].temp<=243) + { + parts[i].life -= 2; + player[22] -= 1; + } + } + + if ((r&0xFF)==PT_ACID) //If on acid + parts[i].life -= 5; + + if ((r&0xFF)==PT_PLUT) //If on plut + parts[i].life -= 1; + + isplayer = 1; + } + if(t==PT_CLNE) + { + if(!parts[i].ctype) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx=0 && y+ny>0 && + x+nx303&&parts[i].temp<317) { + create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST); + } + } + if(t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1) + { + parts[i].type = PT_NBLE; + parts[i].life = 0; + } + if (t==PT_FIRE && parts[i].life <=1 && parts[i].temp<625) + { + t = parts[i].type = PT_SMKE; + parts[i].life = rand()%20+250; + } + + nx = (int)(parts[i].x+0.5f); + ny = (int)(parts[i].y+0.5f); + + if(nx=XRES-CELL || + ny=YRES-CELL) + { + parts[i].x = lx; + parts[i].y = ly; + kill_part(i); + continue; + } + + rt = parts[i].flags & FLAG_STAGNANT; + parts[i].flags &= ~FLAG_STAGNANT; + if(!try_move(i, x, y, nx, ny)) + { + parts[i].x = lx; + parts[i].y = ly; + if(ptypes[t].falldown) + { + if(nx!=x && try_move(i, x, y, nx, y)) + { + parts[i].x = ix; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x, ny)) + { + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else + { + r = (rand()%2)*2-1; + if(ny!=y && try_move(i, x, y, x+r, ny)) + { + parts[i].x += r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ny!=y && try_move(i, x, y, x-r, ny)) + { + parts[i].x -= r; + parts[i].y = iy; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y+r)) + { + parts[i].x = ix; + parts[i].y += r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(nx!=x && try_move(i, x, y, nx, y-r)) + { + parts[i].x = ix; + parts[i].y -= r; + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) + { + s = 0; + if(!rt || nt) + rt = 50; + else + rt = 10; + for(j=x+r; j>=0 && j>=x-rt && j0) + r = 1; + else + r = -1; + if(s) + for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny(rand()%1000)) + { + kill_part(i); + continue; + } + else if(try_move(i, x, y, 2*x-nx, ny)) + { + parts[i].x = (float)(2*x-nx); + parts[i].y = (float)iy; + parts[i].vx *= ptypes[t].collision; + } + else if(try_move(i, x, y, nx, 2*y-ny)) + { + parts[i].x = (float)ix; + parts[i].y = (float)(2*y-ny); + parts[i].vy *= ptypes[t].collision; + } + else + { + parts[i].vx *= ptypes[t].collision; + parts[i].vy *= ptypes[t].collision; + } + } + } + if(nx=XRES-CELL || ny=YRES-CELL) + { + kill_part(i); + continue; + } + } + if(framerender) { + framerender = 0; + sys_pause = 1; + } +} + +void update_particles(pixel *vid) +{ + int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; + float lx, ly; +#ifdef MT + int pt = 0, pc = 0; + pthread_t *InterThreads; +#endif + + isplayer = 0; //Needed for player spawning + memset(pmap, 0, sizeof(pmap)); + r = rand()%2; + for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==13) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && (!sys_pause||framerender)) + emap[y][x] --; + } + } + } + else + { + for(y=0; y>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==4) + for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==7) + { + if(emap[y][x]) + { + cr = cg = cb = 128; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==11) + { + for(j=0; j 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(bmap[y][x]==9) + { + for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; + fire_r[y][x] = cr; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + } + } + if(emap[y][x] && (!sys_pause||framerender)) + emap[y][x] --; + } + } + } + + update_particles_i(vid, 0, 1); + + for(y=0; y=XRES || ny<0 || ny>=YRES) + break; + addpixel(vid, nx, ny, 255, 255, 255, 64); + i = nx/CELL; + j = ny/CELL; + lx += vx[j][i]*0.125f; + ly += vy[j][i]*0.125f; + if(bmap[j][i]==5 && i!=x && j!=y) + break; + } + drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); + } + +} + +void clear_area(int area_x, int area_y, int area_w, int area_h) +{ + int cx = 0; + int cy = 0; + for(cy=0; cyx2) + { + i = x2; + x2 = x1; + x1 = i; + } + if(y1>y2) + { + j = y2; + y2 = y1; + y1 = j; + } + for(j=y1; j<=y2; j++) + for(i=x1; i<=x2; i++) + create_parts(i, j, 1, c); +} + +int flood_parts(int x, int y, int c, int cm, int bm) +{ + int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) + { + c = c-100; + } + if(cm==-1) + { + if(c==0) + { + cm = pmap[y][x]&0xFF; + if(!cm) + return 0; + } + else + cm = 0; + } + if(bm==-1) + { + if(c==30) + { + bm = bmap[y/CELL][x/CELL]; + if(!bm) + return 0; + if(bm==1) + cm = 0xFF; + } + else + bm = 0; + } + + if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) + return 1; + + // go left as far as possible + x1 = x2 = x; + while(x1>=CELL) + { + if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) + break; + x1--; + } + while(x2=CELL+dy) + for(x=x1; x<=x2; x++) + if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) + if(!flood_parts(x, y-dy, co, cm, bm)) + return 0; + if(y=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; + float e, de; + if(cp) + { + y = x1; + x1 = y1; + y1 = y; + y = x2; + x2 = y2; + y2 = y; + } + if(x1 > x2) + { + y = x1; + x1 = x2; + x2 = y; + y = y1; + y1 = y2; + y2 = y; + } + dx = x2 - x1; + dy = abs(y2 - y1); + e = 0.0f; + if(dx) + de = dy/(float)dx; + else + de = 0.0f; + y = y1; + sy = (y1= 0.5f) + { + y += sy; + if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) + { + if(cp) + create_parts(y, x, r, c); + else + create_parts(x, y, r, c); + } + e -= 1.0f; + } + } +} diff --git a/src/update.c b/src/update.c new file mode 100644 index 0000000..99b9d1b --- /dev/null +++ b/src/update.c @@ -0,0 +1,201 @@ +/** + * Powder Toy - Update Helper + * + * Copyright (c) 2008 - 2010 Stanislaw Skowronek. + * Copyright (c) 2010 Simon Robertshaw + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + */ + +#include +#ifndef MACOSX +#include +#endif +#include + +#ifdef WIN32 +#include +#else +#include +#include +#endif +#ifdef MACOSX +#include +#include +#include +#endif + +#include + +static char *exe_name(void) +{ +#if defined WIN32 + char *name= (char *)malloc(64), max=64, res; + while((res = (char)GetModuleFileName(NULL, name, max)) >= max) + { +#elif defined MACOSX + char *fn=malloc(64),*name=malloc(PATH_MAX), max=64, res; + if(_NSGetExecutablePath(fn, &max) != 0) + { + fn = realloc(fn, max); + _NSGetExecutablePath(fn, &max); + } + if(realpath(fn, name) == NULL) + { + free(fn); + free(name); + return NULL; + } + res = 1; +#else + char fn[64], *name=malloc(64), max=64, res; + sprintf(fn, "/proc/self/exe"); + memset(name, 0, max); + while((res = readlink(fn, name, max)) >= max-1) + { +#endif +#ifndef MACOSX + max *= 2; + name = realloc(name, max); + memset(name, 0, max); + } +#endif + if(res <= 0) + { + free(name); + return NULL; + } + return name; +} + +int update_start(char *data, int len) +{ + char *self=exe_name(), *temp; +#ifdef WIN32 + char *p; +#endif + FILE *f; + int res = 1; + + if(!self) + return 1; + +#ifdef WIN32 + temp = malloc(strlen(self)+12); + strcpy(temp, self); + p = temp + strlen(temp) - 4; + if(_stricmp(p, ".exe")) + p += 4; + strcpy(p, "_update.exe"); + + if(!MoveFile(self, temp)) + goto fail; + + f = fopen(self, "wb"); + if(!f) + goto fail; + if(fwrite(data, 1, len, f) != len) + { + fclose(f); + DeleteFile(self); + goto fail; + } + fclose(f); + + if((int)ShellExecute(NULL, "open", self, NULL, NULL, SW_SHOWNORMAL) <= 32) + { + DeleteFile(self); + goto fail; + } + + return 0; +#else + temp = malloc(strlen(self)+8); + strcpy(temp, self); + strcat(temp, "-update"); + + f = fopen(temp, "w"); + if(!f) + goto fail; + if(fwrite(data, 1, len, f) != len) + { + fclose(f); + unlink(temp); + goto fail; + } + fclose(f); + + if(chmod(temp, 0755)) + { + unlink(temp); + goto fail; + } + + if(rename(temp, self)) + { + unlink(temp); + goto fail; + } + + execl(self, "powder-update", NULL); +#endif + +fail: + free(temp); + free(self); + return res; +} + +int update_finish(void) +{ +#ifdef WIN32 + char *temp, *self=exe_name(), *p; + int timeout = 60, err; + + temp = malloc(strlen(self)+12); + strcpy(temp, self); + p = temp + strlen(temp) - 4; + if(_stricmp(p, ".exe")) + p += 4; + strcpy(p, "_update.exe"); + + while(!DeleteFile(temp)) + { + err = GetLastError(); + if(err == ERROR_FILE_NOT_FOUND) + { + // just as well, then + free(temp); + return 0; + } + Sleep(500); + timeout--; + if(timeout <= 0) + { + free(temp); + return 1; + } + } + free(temp); +#endif + return 0; +} + +void update_cleanup(void) +{ +#ifdef WIN32 + update_finish(); +#endif +} -- cgit v0.9.2-21-gd62e From 99e2782ebc8445b9ff5e63c641ab4752896962d5 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 27 Sep 2010 12:54:56 +0200 Subject: Try to automerge with this, haha diff --git a/air.c b/air.c deleted file mode 100644 index 55108d6..0000000 --- a/air.c +++ /dev/null @@ -1,141 +0,0 @@ -#include -#include "air.h" -#include "powder.h" -#include "defines.h" -float kernel[9]; - -float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; - -float cb_vx[YRES/CELL][XRES/CELL], cb_ovx[YRES/CELL][XRES/CELL]; -float cb_vy[YRES/CELL][XRES/CELL], cb_ovy[YRES/CELL][XRES/CELL]; -float cb_pv[YRES/CELL][XRES/CELL], cb_opv[YRES/CELL][XRES/CELL]; - -float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; - -void make_kernel(void) -{ - int i, j; - float s = 0.0f; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - { - kernel[(i+1)+3*(j+1)] = expf(-2.0f*(i*i+j*j)); - s += kernel[(i+1)+3*(j+1)]; - } - s = 1.0f / s; - for(j=-1; j<2; j++) - for(i=-1; i<2; i++) - kernel[(i+1)+3*(j+1)] *= s; -} -void update_air(void) -{ - int x, y, i, j; - float dp, dx, dy, f, tx, ty; - - for(y=1; y0 && y+j0 && x+i=2 && i=2 && j 256.0f) dp = 256.0f; - if(dp < -256.0f) dp = -256.0f; - if(dx > 256.0f) dx = 256.0f; - if(dx < -256.0f) dx = -256.0f; - if(dy > 256.0f) dy = 256.0f; - if(dy < -256.0f) dy = -256.0f; - - ovx[y][x] = dx; - ovy[y][x] = dy; - opv[y][x] = dp; - } - memcpy(vx, ovx, sizeof(vx)); - memcpy(vy, ovy, sizeof(vy)); - memcpy(pv, opv, sizeof(pv)); -} \ No newline at end of file diff --git a/air.h b/air.h deleted file mode 100644 index d9e04f6..0000000 --- a/air.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef AIR_H -#define AIR_H -#include "defines.h" - -extern float vx[YRES/CELL][XRES/CELL], ovx[YRES/CELL][XRES/CELL]; -extern float vy[YRES/CELL][XRES/CELL], ovy[YRES/CELL][XRES/CELL]; -extern float pv[YRES/CELL][XRES/CELL], opv[YRES/CELL][XRES/CELL]; - -extern float cb_vx[YRES/CELL][XRES/CELL], cb_ovx[YRES/CELL][XRES/CELL]; -extern float cb_vy[YRES/CELL][XRES/CELL], cb_ovy[YRES/CELL][XRES/CELL]; -extern float cb_pv[YRES/CELL][XRES/CELL], cb_opv[YRES/CELL][XRES/CELL]; - -extern float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL]; - -extern float kernel[9]; - -void make_kernel(void); - -void update_air(void); - -#endif \ No newline at end of file diff --git a/defines.h b/defines.h deleted file mode 100644 index a324e9f..0000000 --- a/defines.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef DEFINE_H -#define DEFINE_H - -#ifdef WIN32 -#define PATH_SEP "\\" -#else -#define PATH_SEP "/" -#endif - -#define SAVE_VERSION 43 -#define MINOR_VERSION 0 -#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. -#define BETA - -#define SERVER "powdertoy.co.uk" - -#undef PLOSS - -#define THUMB_CACHE_SIZE 256 - -#define IMGCONNS 3 -#define TIMEOUT 100 -#define HTTP_TIMEOUT 10 - -#define MENUSIZE 40 -#define BARSIZE 14 -#define XRES 612 -#define YRES 384 -#define NPART XRES*YRES - -#define MAXSIGNS 16 -#define TAG_MAX 256 - -#define ZSIZE_D 16 -#define ZFACTOR_D 8 -extern unsigned char ZFACTOR; -extern unsigned char ZSIZE; - -#define CELL 4 -#define ISTP (CELL/2) -#define CFDS (4.0f/CELL) - -#define TSTEPP 0.3f -#define TSTEPV 0.4f -#define VADV 0.3f -#define VLOSS 0.999f -#define PLOSS 0.9999f - -#define GRID_X 5 -#define GRID_Y 4 -#define GRID_P 3 -#define GRID_S 6 -#define GRID_Z 3 - -#define STAMP_X 4 -#define STAMP_Y 4 -#define STAMP_MAX 120 - -#ifdef PIX16 -typedef unsigned short pixel; -#else -typedef unsigned int pixel; -#endif - -typedef unsigned char uint8; - -extern int amd; - -extern int FPSB; - -extern int legacy_enable; - -extern int sys_pause; -extern int framerender; - -extern int mousex, mousey; -extern int death; - -struct sign -{ - int x,y,ju; - char text[256]; -}; -typedef struct sign sign; - -struct stamp -{ - char name[11]; - pixel *thumb; - int thumb_w, thumb_h, dodelete; -}; -typedef struct stamp stamp; - -extern sign signs[MAXSIGNS]; -extern stamp stamps[STAMP_MAX]; -extern int stamp_count; -extern int itc; -extern char itc_msg[64]; - -extern int do_open; -extern int sys_pause; -extern int legacy_enable; //Used to disable new features such as heat, will be set by commandline or save. -extern int death, framerender; - -extern unsigned char last_major, last_minor, update_flag; - -extern char http_proxy_string[256]; - -//Functions in main.c -void thumb_cache_inval(char *id); -void thumb_cache_add(char *id, void *thumb, int size); -int thumb_cache_find(char *id, void **thumb, int *size); -void *build_thumb(int *size, int bzip2); -void *build_save(int *size, int x0, int y0, int w, int h); -int parse_save(void *save, int size, int replace, int x0, int y0); -void del_stamp(int d); -void sdl_seticon(void); -#endif \ No newline at end of file diff --git a/font.h b/font.h deleted file mode 100644 index f8f9a58..0000000 --- a/font.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Powder Toy - Font Data - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * Copyright (c) 2010 Simon Robertshaw. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef FONT_H_CHECK -#define FONT_H_CHECK -#define FONT_H 10 -static char font_data[] = -{ - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc7, 0x31, 0x0c, 0x02, 0x70, 0x04, 0x00, 0x00, 0x05, 0xcc, 0x74, 0x23, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x19, 0xcc, 0xe0, 0x3f, 0xcc, 0xf0, 0x2f, 0xcc, 0x90, 0x09, 0x00, 0x00, 0x00, 0x06, 0x30, 0xd0, 0x3f, 0x33, 0xe1, 0x07, 0xf4, 0x12, 0x33, 0xff, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x2d, 0xce, 0xcc, 0xe1, 0x1d, 0xc0, 0x03, 0x74, 0x4b, 0x33, 0xb3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7d, 0x30, 0x0c, 0x13, 0xd0, 0x32, 0xb3, 0x33, 0x1c, 0x7d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x4c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x34, 0x1d, 0x07, 0x03, 0x07, 0x1d, 0x34, 0x00, 0x00, 0x00, 0x04, 0x07, 0x1d, 0x34, 0x30, 0x34, 0x1d, 0x07, 0x00, 0x00, 0x00, 0x06, 0x44, 0xd0, 0x1c, 0x64, 0xf0, 0x3f, 0x64, 0xd0, 0x1c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x02, 0x30, 0xe0, 0x2f, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x06, 0x80, 0x02, 0x0c, 0xa0, 0x00, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, 0xe0, 0x39, 0x07, 0x33, 0x32, 0x03, 0xb3, 0x38, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x30, 0xf0, 0x60, 0x03, 0x0c, 0x30, 0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x41, 0x03, 0x0a, 0x2c, 0x70, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0x71, 0x34, 0x01, 0x03, 0x1e, 0x00, 0x33, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xc0, 0x03, 0x37, 0x1c, 0x73, 0x34, 0xbf, 0x03, 0x30, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x00, 0x57, 0xe0, 0x2f, 0x00, 0x13, 0x30, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd3, 0x00, 0x07, 0xf0, 0x1f, 0x03, 0x33, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x07, 0x34, 0x80, 0x03, 0x0e, 0x38, 0xd0, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xd3, 0x1f, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xc3, 0x3f, 0x40, 0x23, 0x30, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x70, 0x04, 0x40, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc0, 0xc3, 0x0b, 0x1b, 0xc0, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x0f, 0x90, 0x83, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfd, 0x71, 0x30, 0x81, 0x03, 0x0e, 0x34, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0x0f, 0x1d, 0x30, 0xe7, 0x37, 0x73, 0x1c, 0xe3, 0x2f, 0x07, 0x00, 0xfd, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x74, 0xd0, 0x1d, 0x47, 0x33, 0x30, 0xff, 0x33, 0x30, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xbf, 0x30, 0x38, 0x43, 0xf3, 0x1f, 0x43, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x31, 0x00, 0x03, 0x70, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x33, 0x30, 0x03, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x32, 0x00, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x10, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x10, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x30, 0x3e, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x47, 0x33, 0x30, 0x03, 0xf3, 0x3f, 0x03, 0x33, 0x30, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x06, 0xd0, 0x01, 0x0c, 0xc0, 0x00, 0x0c, 0xc0, 0x10, 0x0d, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0xc3, 0x34, 0x70, 0x03, 0xbc, 0x00, 0xb3, 0xc0, 0xb0, 0x70, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x30, 0x10, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x1f, 0x3d, 0x7b, 0x3b, 0xe3, 0x32, 0x83, 0x30, 0x03, 0x30, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0xcd, 0x03, 0x73, 0xc3, 0x8c, 0x32, 0xc3, 0xcd, 0xc0, 0x33, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xc7, 0x71, 0xd0, 0x0c, 0x30, 0x03, 0xcd, 0xd1, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x73, 0x34, 0xff, 0x31, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xd3, 0x71, 0xd0, 0x0c, 0x30, 0xc3, 0xcd, 0xd1, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x31, 0x34, 0x03, 0xf3, 0x0f, 0xd7, 0x30, 0x34, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x31, 0x07, 0xd0, 0x0f, 0x90, 0x23, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x13, 0x13, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xcc, 0x00, 0x33, 0xc0, 0x0c, 0x30, 0x03, 0xcd, 0xd2, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x33, 0x30, 0x03, 0xb3, 0x38, 0xcd, 0xc1, 0x0d, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x43, 0x30, 0xc7, 0x34, 0xcd, 0x1c, 0xed, 0x1e, 0x2c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0x4c, 0xc3, 0x81, 0x3b, 0xd0, 0x03, 0xdc, 0x42, 0xc3, 0x31, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0xb3, 0x38, 0xdc, 0x40, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xd0, 0x02, 0x2c, 0xc0, 0x02, 0x2d, 0xc0, 0x06, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x2f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x30, 0x80, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x37, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x47, 0x30, 0xfc, 0x0c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x07, 0x0c, 0xf0, 0xc7, 0x35, 0xc3, 0x0c, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc3, 0x25, 0x03, 0x4c, 0xd2, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd0, 0x00, 0x83, 0x8f, 0x33, 0xc3, 0x1c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xbf, 0x0c, 0xd0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3d, 0x07, 0x03, 0x2f, 0x03, 0x03, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xcb, 0x32, 0xc3, 0xf4, 0x03, 0x4c, 0x30, 0x7e, 0x00, 0x00, 0x05, 0x03, 0x0c, 0xf0, 0xc7, 0x39, 0xc3, 0x0c, 0x73, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x1c, 0x00, 0x0d, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x30, 0x00, 0x34, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x05, 0x03, 0x0c, 0x31, 0xce, 0x0e, 0x1f, 0xcc, 0x31, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x47, 0x3d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x9b, 0x71, 0x37, 0x33, 0x33, 0x32, 0x43, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x0c, 0x33, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x31, 0xc3, 0x4c, 0xd3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x4c, 0xf3, 0xc7, 0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xdf, 0x31, 0xc3, 0x4c, 0xd3, 0x0f, 0x30, 0xc0, 0x00, 0x05, 0x03, 0x00, 0x30, 0x7f, 0xc7, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xc7, 0x10, 0x3c, 0x04, 0xf3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x1c, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x70, 0xdc, 0x30, 0xc3, 0x4c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xd3, 0xdc, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x33, 0x32, 0x33, 0x73, 0x37, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcd, 0x32, 0x7d, 0x8c, 0x73, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xc7, 0x74, 0x43, 0x07, 0x0c, 0x1f, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x4f, 0x2c, 0x2c, 0x2c, 0xf1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x04, 0x38, 0x0c, 0x0c, 0x03, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x02, 0x32, 0x33, 0x33, 0x13, 0x00, 0x04, 0x0b, 0x0c, 0x0c, 0x30, 0x0c, 0x0c, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x72, 0x37, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, 0x07, 0xff, 0x1f, 0xff, 0x7f, 0xff, 0x1b, 0xbf, 0x01, 0x1b, 0x00, 0x0c, 0x00, 0x40, 0xff, 0x00, 0x00, 0xf8, 0xf0, 0x3f, 0xee, 0x2c, 0x30, 0xcb, 0x0b, 0x30, 0x42, 0xc3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xf3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xff, 0x3f, 0x00, 0x0c, 0xc2, 0x00, 0x00, 0xcb, 0x00, 0x00, 0xee, 0xc0, 0xff,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0x2c, 0x0d, 0x0f, 0x37, 0xf0, 0xc0, 0xf3, 0xff, 0x3c, 0xff, 0xcf, 0x03, 0x0f, 0xdc, 0xf0, 0x70, 0x38, 0xc0, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x1f, 0x00, 0xad, 0x07, 0xb0, 0xc5, 0x00, 0x17, 0x0c, 0x70, 0xd0, 0x00, 0x0c, 0x03, 0xbc, 0xef, 0xb3, 0x11, 0xe0, 0x07, 0x05, 0x3c, 0x52, 0xc8, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xc0, 0x3f, 0x00, 0xfc, 0x03, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0xc0, 0x30, 0xc0, 0xff, 0x3f, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0xff, 0x0f, 0xfc, 0xff, 0x3f, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb8, 0xe0, 0x2f, 0xff, 0xe3, 0x2f, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0xff, 0x2f, 0xfd, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0xf8, 0xff, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x01, 0x00, 0x02, 0x00, 0xc8, 0x07, 0x10, 0xc3, 0x00, 0x31, 0x0d, 0x00, 0xfd, 0x01, 0x00, 0x74, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x0a, 0x40, 0x05, 0x80, 0xff, 0x8b, 0x1e, 0xd0, 0x2e, 0x00, 0xf0, 0x00, 0xe0, 0xff, 0x0b, 0x00, 0x0f, 0x00, 0xb8, 0x03, 0xb0, 0xe2, 0xff, 0x02, 0x50, 0x01, 0x08, 0xff, 0x07, 0x03, 0x1e, 0x03, 0x73, 0x03, 0xef, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x2f, 0xe0, 0x1b, 0x0c, 0x1d, 0x00, 0xff, 0x03, 0xbe, 0xf0, 0xc1, 0x01, 0xad, 0x34, 0xc0, 0x36, 0x0b, 0x30, 0xdc, 0xe4, 0x07, 0xfd, 0x1b, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0xa0, 0xaa, 0x00, 0xa8, 0xc2, 0x0f, 0x2a, 0xff, 0x03, 0xca, 0x3f, 0x80, 0xfc, 0x0f, 0x20, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x07, 0xaa, 0xea, 0x1f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xaa, 0xea, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x03, 0x00, 0xd0, 0x03, 0x00, 0xf4, 0xab, 0xaa, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xf4, 0xab, 0xaa, 0xd0, 0x03, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x09, 0xfe, 0xff, 0xe3, 0xff, 0x0f, 0xaa, 0x3e, 0x0a, 0xf8, 0x2e, 0xe0, 0xbf, 0x80, 0xff, 0xaa, 0xfe, 0xff, 0xe2, 0xff, 0x02, 0x02, 0x00, 0x00, 0x09, 0x00, 0x80, 0x04, 0xd0, 0xe2, 0xff, 0x02, 0x00, 0x00, 0xff, 0x6f, 0x00, 0x40, 0xe6, 0xaf, 0x50, 0x00, 0x09, 0x00, 0x20, 0x00, 0x64, 0x00, 0x09, 0xe0, 0x3f, 0x70, 0x60, 0x63, 0xc0, 0xe4, 0x80, 0xc2, 0x03, 0x07, 0x0f, 0x1e, 0x6c, 0xff, 0x27, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x09, 0x44, 0x44, 0x00, 0x12, 0x41, 0x88, 0x04, 0x21, 0x21, 0x84, 0x48, 0x20, 0x23, 0xc2, 0xcc, 0x08, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x1d, 0x00, 0x78, 0x00, 0xb4, 0x07, 0xf0, 0x2f, 0xc0, 0xfb, 0x00, 0xbe, 0x02, 0xf4, 0x07, 0xfd, 0xff, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0x00, 0x19, 0x00, 0xa8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf0, 0xdc, 0xcb, 0x03, 0x00, 0xff, 0xff, 0x4f, 0x07, 0x40, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0xff, 0x3f, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0x07, 0x00, 0xbd, 0x02, 0xe8, 0xb3, 0xe0, 0x3c, 0xac, 0xc3, 0x03, 0x0f, 0x3c, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x0b, 0xc0, 0xc8, 0xc0, 0x91, 0x1b, 0xcd, 0x36, 0xe7, 0x00, 0x47, 0x03, 0xa7, 0x80, 0x36, 0xfd, 0xff, 0xc1, 0x9b, 0xf9, 0xb8, 0xb8, 0xb8, 0xb7, 0x99, 0xf7, 0xff, 0xff, 0x0f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x03, 0x00, 0xfc, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0xff, 0x3f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0xcf, 0xff, 0xff, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1f, 0xcb, 0x30, 0xc3, 0x3f, 0xc7, 0x00, 0x7e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0xc3, 0xfc, 0x33, 0x0c, 0x24, 0xc3, 0xc0, 0x31, 0x0c, 0x06, 0xc3, 0x30, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0xff, 0x3f, 0x30, 0x00, 0x03, 0xc3, 0x30, 0x30, 0x3f, 0xff, 0xff, 0x3f, 0x3c, 0x00, 0xff, 0xff, 0xff, 0x0c, 0x0c, 0xc3, 0xc0, 0x00, 0x0c, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x3c, 0x00, 0xc0, 0x03, 0xf0, 0x3f, 0x00, 0xff, 0x03, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xb8, 0xec, 0x9b, 0xf9, 0xbf, 0xf8, 0xbf, 0x99, 0xef, 0xb8, 0x2c, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x87, 0x87, 0xc3, 0x30, 0x0c, 0xe3, 0xde, 0x01, 0x03, 0x74, 0xbb, 0x0c, 0xc3, 0x30, 0x2c, 0x2d, 0x0d, 0x05, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x34, 0xc3, 0x0c, 0x73, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x39, 0xc0, 0x00, 0x43, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0x60, 0x60, 0x60, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0xb8, 0x00, 0x23, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x36, 0xc6, 0xfc, 0x03, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xcb, 0x00, 0x7f, 0x40, 0x13, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xcb, 0x10, 0x2f, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x0f, 0x30, 0x60, 0x60, 0xc0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0x7d, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xc6, 0xe0, 0x03, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x03, 0xc0, 0xf0, 0x3c, 0xcf, 0xf3, 0x3c, 0x03, 0x00, 0x03, 0x00, 0xcc, 0xf3, 0x3c, 0xcf, 0xf3, 0x30, 0x00, 0x05, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x30, 0xc0, 0x0f, 0x30, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0xd0, 0x7f, 0x40, 0xff, 0x1f, 0xfc, 0xff, 0x43, 0xff, 0x1f, 0x40, 0x15, 0x00, 0x00, 0x00, 0x0a, 0xe4, 0x06, 0x90, 0x91, 0x01, 0x06, 0x24, 0x30, 0x90, 0x1b, 0x46, 0x6e, 0x96, 0xb9, 0x91, 0xe4, 0x06, 0x0c, 0x18, 0x90, 0x40, 0x46, 0x06, 0x90, 0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x02, 0xc2, 0xab, 0xaa, 0x3e, 0x20, 0xe0, 0xab, 0xaa, 0x3e, 0x02, 0xc2, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x02, 0xc0, 0x30, 0x00, 0x0c, 0x03, 0xf0, 0xff, 0x00, 0xfe, 0x0b, 0xd0, 0x7f, 0x00, 0xa4, 0x01, 0x00, 0x0a, 0x00, 0xa0, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x81, 0x24, 0x10, 0x85, 0x00, 0x20, 0x66, 0x40, 0x15, 0x45, 0x62, 0x90, 0x4d, 0xd0, 0xf1, 0x23, 0x01, 0xfd, 0x41, 0x41, 0x07, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x00, 0xf8, 0x02, 0xd0, 0x7f, 0x00, 0xfe, 0x0b, 0xf0, 0xff, 0x00, 0xff, 0x0f, 0xd0, 0x7f, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0xd4, 0x01, 0xd0, 0x06, 0x40, 0x7f, 0x00, 0xfd, 0x01, 0xf4, 0x07, 0xd0, 0x1f, 0x00, 0x7f, 0x00, 0xd0, 0x01, 0x00, 0x0a, 0x40, 0x15, 0x00, 0xfe, 0x0b, 0x88, 0x2f, 0x52, 0xf0, 0x50, 0x01, 0x0a, 0xd4, 0xaf, 0x7f, 0xfd, 0xf5, 0xc7, 0x0b, 0x3e, 0x70, 0xd0, 0x00, 0xa4, 0x01, 0x0a, 0x80, 0x2f, 0x80, 0x5f, 0x2f, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x01, 0x34, 0x34, 0xc0, 0x01, 0x07, 0x0d, 0xd0, 0x75, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xf4, 0x01, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xe0, 0xef, 0x00, 0xbb, 0x0b, 0xa0, 0xaa, 0x00, 0xaa, 0x0a, 0x80, 0x19, 0x00, 0x64, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x2d, 0x80, 0xe7, 0x0b, 0xbe, 0xf8, 0xfa, 0x02, 0xfe, 0x0b, 0x80, 0x2f, 0x00, 0x50, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xaf, 0x2f, 0xbe, 0xe0, 0xdb, 0x02, 0x78, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x50, 0xfe, 0x5b, 0xfd, 0xff, 0x47, 0xff, 0x1f, 0xe0, 0xbf, 0x00, 0xfe, 0x0b, 0xf0, 0xf5, 0x40, 0x01, 0x14, 0x0a, 0x40, 0x1a, 0x00, 0x09, 0x06, 0x20, 0x80, 0x00, 0x02, 0x08, 0xfc, 0xff, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x0a, 0xf0, 0xff, 0x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xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, -}; -static short font_ptrs[] = -{ - 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2, 0x01c0, 0x01ce, 0x01d7, 0x01e5, 0x01f5, 0x0205, 0x0218, 0x0228, 0x0231, 0x023c, 0x0247, 0x0257, 0x0267, 0x0272, 0x0280, 0x0289, 0x0299, 0x02a9, 0x02b7, 0x02c7, 0x02d7, 0x02e7, 0x02f7, 0x0307, 0x0317, 0x0327, 0x0337, 0x0340, 0x034b, 0x035b, 0x036b, 0x037b, 0x038b, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x042b, 0x043b, 0x044e, 0x045e, 0x0473, 0x0486, 0x0499, 0x04a9, 0x04bc, 0x04cc, 0x04dc, 0x04ec, 0x04ff, 0x050f, 0x0524, 0x0537, 0x0547, 0x055a, 0x0565, 0x0573, 0x057e, 0x0589, 0x0599, 0x05a2, 0x05b0, 0x05be, 0x05cc, 0x05da, 0x05e8, 0x05f3, 0x0601, 0x060f, 0x061a, 0x0625, 0x0633, 0x063e, 0x064e, 0x065c, 0x066a, 0x0678, 0x0686, 0x068f, 0x069d, 0x06a8, 0x06b6, 0x06c4, 0x06d4, 0x06e2, 0x06f0, 0x06fe, 0x0709, 0x070f, 0x071a, 0x072a, 0x0735, 0x074a, 0x0769, 0x0788, 0x07a2, 0x07c1, 0x07db, 0x07f5, 0x080f, 0x0829, 0x0843, 0x085d, 0x0877, 0x0896, 0x08a6, 0x08c0, 0x08da, 0x08f4, 0x090e, 0x0923, 0x0940, 0x095d, 0x097c, 0x099b, 0x09b3, 0x09cb, 0x09e3, 0x09fb, 0x0a13, 0x0a2b, 0x0a43, 0x0a5b, 0x0a73, 0x0a8b, 0x0aa3, 0x0abd, 0x0ada, 0x0af7, 0x0b0c, 0x0b26, 0x0b40, 0x0b5a, 0x0b74, 0x0b8c, 0x0b97, 0x0ba0, 0x0ba9, 0x0bb7, 0x0bc5, 0x0bd3, 0x0be1, 0x0bef, 0x0bfd, 0x0c0b, 0x0c19, 0x0c27, 0x0c35, 0x0c43, 0x0c4e, 0x0c57, 0x0c60, 0x0c6e, 0x0c7e, 0x0c8e, 0x0ca8, 0x0cc2, 0x0cdc, 0x0cf6, 0x0d10, 0x0d2a, 0x0d44, 0x0d5e, 0x0d78, 0x0d92, 0x0dac, 0x0dc6, 0x0de0, 0x0dfa, 0x0e14, 0x0e2e, 0x0e46, 0x0e60, 0x0e7a, 0x0e8a, 0x0e9a, 0x0eaa, 0x0eba, 0x0eca, 0x0eda, 0x0eea, 0x0efa, 0x0f0a, 0x0f1a, 0x0f2a, 0x0f3a, 0x0f4a, 0x0f5a, 0x0f6a, 0x0f7a, 0x0f8a, 0x0f9a, 0x0faa, 0x0fba, 0x0fca, 0x0fda, 0x0fea, 0x0ffa, 0x100a, 0x101a, 0x102a, 0x103a, 0x104a, 0x105a, 0x106a, 0x107a, 0x108a, 0x109a, 0x10aa, 0x10ba, 0x10ca, 0x10da, 0x10ea, 0x10fa, 0x110a, 0x111a, 0x112a, 0x113a, 0x114a, -}; -#endif \ No newline at end of file diff --git a/graphics.c b/graphics.c deleted file mode 100644 index aafe897..0000000 --- a/graphics.c +++ /dev/null @@ -1,2567 +0,0 @@ -#include -#include -#include - -#ifdef OpenGL -#ifdef MACOSX -#include -#include -#else -#include -#include -#endif -#endif - -#include "defines.h" -#include "air.h" -#include "powder.h" -#include "graphics.h" -#include "font.h" -#include "misc.h" - - -unsigned cmode = 3; -SDL_Surface *sdl_scrn; -int sdl_scale = 1; - -unsigned char fire_r[YRES/CELL][XRES/CELL]; -unsigned char fire_g[YRES/CELL][XRES/CELL]; -unsigned char fire_b[YRES/CELL][XRES/CELL]; - -unsigned int fire_alpha[CELL*3][CELL*3]; -pixel *fire_bg; - -pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f) -{ - int i,j,x,y,w,h,r,g,b,c; - pixel p, *q; - w = (sw+f-1)/f; - h = (sh+f-1)/f; - q = malloc(w*h*PIXELSIZE); - for(y=0; y1) - { - r = (r+c/2)/c; - g = (g+c/2)/c; - b = (b+c/2)/c; - } - q[y*w+x] = PIXRGB(r, g, b); - } - *qw = w; - *qh = h; - return q; -} - -void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0; jpitch/PIXELSIZE; - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} - -void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch) -{ - pixel *dst; - int j; - int i,k; - if(SDL_MUSTLOCK(sdl_scrn)) - if(SDL_LockSurface(sdl_scrn)<0) - return; - dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; - for(j=0; jpitch/PIXELSIZE; - } - src+=pitch; - } - if(SDL_MUSTLOCK(sdl_scrn)) - SDL_UnlockSurface(sdl_scrn); - SDL_UpdateRect(sdl_scrn,0,0,0,0); -} - -void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch) -{ -#ifdef OpenGL - RenderScene(); -#else - if(sdl_scale == 2) - sdl_blit_2(x, y, w, h, src, pitch); - else - sdl_blit_1(x, y, w, h, src, pitch); -#endif -} - -void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb) -{ - blendpixel(vid, x+1, y, cr, cg, cb, 112); - blendpixel(vid, x-1, y, cr, cg, cb, 112); - blendpixel(vid, x, y+1, cr, cg, cb, 112); - blendpixel(vid, x, y-1, cr, cg, cb, 112); - - blendpixel(vid, x+1, y-1, cr, cg, cb, 64); - blendpixel(vid, x-1, y-1, cr, cg, cb, 64); - blendpixel(vid, x+1, y+1, cr, cg, cb, 64); - blendpixel(vid, x-1, y+1, cr, cg, cb, 64); -} - -void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall) -{ - int x, y, i, j, c; - int bo = b; - if(iswall==1) - { - b = b-100; - x = (2+32*((b-22)/1)); - y = YRES+2+40; - switch(b) - { - case WL_WALLELEC: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - else - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) - { - for(i=1; i<6+j; i++) - { - if(!(i&j&1)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) - { - if(i&j&1) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) - { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<13; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) - { - for(i=14; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - default: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } - else - { - x = 2+32*(b/2); - y = YRES+2+20*(b%2); - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - if(b==0) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - if(bo==sl || bo==sr) - { - c = 0; - if(bo==sl) - c |= PIXPACK(0xFF0000); - if(bo==sr) - c |= PIXPACK(0x0000FF); - for(i=0; i<30; i++) - { - vid_buf[(XRES+BARSIZE)*(y-1)+(x+i-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+16)+(x+i-1)] = c; - } - for(j=0; j<18; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x-1)] = c; - vid_buf[(XRES+BARSIZE)*(y+j-1)+(x+28)] = c; - } - } -} - -int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) -{ - int i, j, c; - if(b>=121) - { - b = b-100; - //x = (2+32*((b-22)/1)); - //y = YRES+2+40; - switch(b) - { - case WL_WALLELEC: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - else - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXPACK(0x808080); - } - } - } - break; - case 23: - for(j=1; j<15; j++) - { - for(i=1; i<6+j; i++) - { - if(!(i&j&1)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(; i<27; i++) - { - if(i&j&1) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 24: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 25: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - drawtext(vid_buf, x+4, y+3, "\x8D", 255, 255, 255, 255); - } - } - for(i=9; i<27; i++) - { - drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255); - } - break; - case 26: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = i==1||i==26||j==1||j==14 ? PIXPACK(0xA0A0A0) : PIXPACK(0x000000); - } - } - drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255); - break; - case 27: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 28: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 29: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 30: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<13; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - for(j=1; j<15; j++) - { - for(i=14; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 32: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 33: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - case 34: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - if(!(i%2) && !(j%2)) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - break; - case 36: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255); - break; - case 37: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255); - break; - case 38: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255); - break; - case 39: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - c = PIXR(pc) + 3*PIXG(pc) + 2*PIXB(pc); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255); - break; - case 40: - for(j=1; j<15; j+=2) - { - for(i=1+(1&(j>>1)); i<27; i+=2) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - break; - default: - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } - } - if(b==30) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - } - else - { - //x = 2+32*(b/2); - //y = YRES+2+20*(b%2); -#ifdef OpenGL - fillrect(vid_buf, x, y, 28, 16, PIXR(pc), PIXG(pc), PIXB(pc), 255); -#else - for(j=1; j<15; j++) - { - for(i=1; i<27; i++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = pc; - } - } -#endif - if(b==0) - { - for(j=4; j<12; j++) - { - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+6)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x+j+7)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+21)] = PIXPACK(0xFF0000); - vid_buf[(XRES+BARSIZE)*(y+j)+(x-j+22)] = PIXPACK(0xFF0000); - } - } - c = PIXB(ptypes[b].pcolors) + 3*PIXG(ptypes[b].pcolors) + 2*PIXR(ptypes[b].pcolors); - if(c<544) - { - c = 255; - } - else - { - c = 0; - } - drawtext(vid_buf, x+14-textwidth((char *)ptypes[b].name)/2, y+4, (char *)ptypes[b].name, c, c, c, 255); - } - return 26; -} - -void draw_menu(pixel *vid_buf, int i, int hover) -{ - drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - if(hover==i) - { - fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); - } -} - -#ifdef WIN32 -_inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#else -inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#endif -{ - pixel t; - if(x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) - return; - if(a!=255) - { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -#ifdef WIN32 -_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) -#else -inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a) -#endif -{ - int i, j, w, bn = 0, ba = 0; - char *rp = font_data + font_ptrs[c]; - w = *(rp++); - for(j=0; j>= 2; - bn -= 2; - } - return x + w; -} - -int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a) -{ -#ifdef OpenGL -#else - int sx = x; - for(; *s; s++) - { - if(*s == '\n') - { - x = sx; - y += FONT_H+2; - } - else if(*s == '\b') - { - switch(s[1]) - { - case 'w': - r = g = b = 255; - break; - case 'g': - r = g = b = 192; - break; - case 'o': - r = 255; - g = 216; - b = 32; - break; - case 'r': - r = 255; - g = b = 0; - break; - case 'b': - r = g = 0; - b = 255; - break; - } - s++; - } - else - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } -#endif - return x; -} - -void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) -{ -#ifdef OpenGL - glBegin(GL_LINE_LOOP); - glColor4ub(r, g, b, a); - glVertex2i(x, y); - glVertex2i(x+w, y); - glVertex2i(x+w, y+h); - glVertex2i(x, y+h); - glEnd(); -#else - int i; - for(i=0; i<=w; i++) - { - drawpixel(vid, x+i, y, r, g, b, a); - drawpixel(vid, x+i, y+h, r, g, b, a); - } - for(i=1; i=w && x+textwidth(s)>=w+5) - break; - x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } - if(*s) - for(i=0; i<3; i++) - x = drawchar(vid, x, y, '.', r, g, b, a); - return x; -} - -int textnwidth(char *s, int n) -{ - int x = 0; - for(; *s; s++) - { - if(!n) - break; - x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - n--; - } - return x-1; -} - -int textwidthx(char *s, int w) -{ - int x=0,n=0,cw; - for(; *s; s++) - { - cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; - if(x+(cw/2) >= w) - break; - x += cw; - n++; - } - return n; -} - -#ifdef WIN32 -_inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#else -inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -#endif -{ -#ifdef OpenGL - if(x<0 || y<0 || x>=XRES || r>=YRES) - return; - if(a!=255) - { - glBegin (GL_QUADS); - glColor4ub(r,g,b,a); - glVertex2i(x, y); - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -#else - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - if(a!=255) - { - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + (255-a)*PIXR(t)) >> 8; - g = (a*g + (255-a)*PIXG(t)) >> 8; - b = (a*b + (255-a)*PIXB(t)) >> 8; - } - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -#endif //OpenGL -} - -void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag) -{ - char t[2]; - t[0] = ch; - t[1] = 0; - if(flag) - { - fillrect(vid_buf, x-1, y-1, 17, 17, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 0, 0, 0, 255); - } - else - { - drawrect(vid_buf, x, y, 15, 15, 255, 255, 255, 255); - drawtext(vid_buf, x+3, y+2, t, 255, 255, 255, 255); - } -} - -void draw_air(pixel *vid) -{ - int x, y, i, j; - pixel c; - - if(cmode == 2) - return; - - for(y=0; y 0.0f) - c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0); - else - c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f)); - } - else - c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f), - clamp_flt(pv[y][x], 0.0f, 8.0f), - clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f)); - for(j=0; jdx) - { - dx = dx+dy; - dy = dx-dy; - dx = dx-dy; - check = 1; - } - - e = (dy<<2)-dx; - for (i=0; i<=dx; i++) - { - vid[x+y*a] =PIXRGB(r, g, b); - if (e>=0) - { - if (check==1) - x = x+sx; - else - y = y+sy; - e = e-(dx<<2); - } - if (check==1) - y = y+sy; - else - x = x+sx; - e = e+(dy<<2); - } -} - -void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a) -{ - pixel t; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - t = vid[y*(XRES+BARSIZE)+x]; - r = (a*r + 255*PIXR(t)) >> 8; - g = (a*g + 255*PIXG(t)) >> 8; - b = (a*b + 255*PIXB(t)) >> 8; - if(r>255) - r = 255; - if(g>255) - g = 255; - if(b>255) - b = 255; - vid[y*(XRES+BARSIZE)+x] = PIXRGB(r,g,b); -} - -void xor_pixel(int x, int y, pixel *vid) -{ - int c; - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - c = vid[y*(XRES+BARSIZE)+x]; - c = PIXB(c) + 3*PIXG(c) + 2*PIXR(c); - if(c<512) - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0xC0C0C0); - else - vid[y*(XRES+BARSIZE)+x] = PIXPACK(0x404040); -} - -void xor_line(int x1, int y1, int x2, int y2, pixel *vid) -{ - int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - e -= 1.0f; - } - } -} - -void xor_rect(pixel *vid, int x, int y, int w, int h) -{ - int i; - for(i=0; i(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) //Here I use r variable not as I should, but I think you will excuse me :-p - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = ptypes[(int)player[2]].pcolors; - vid[(ny+2)*s+nx+r+1] = ptypes[(int)player[2]].pcolors; - vid[(ny+r+1)*s+nx-2] = ptypes[(int)player[2]].pcolors; - vid[(ny+r)*s+nx+2] = ptypes[(int)player[2]].pcolors; - } - draw_line(vid , nx, ny+3, player[3], player[4], 255, 255, 255, s); - draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s); - draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s); - draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s); - - isplayer = 1; //It's a secret. Tssss... - } - if(t==PT_MWAX&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,224,170,255); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,224,224,170,20); - else - blendpixel(vid,x+nx,y+ny,224,224,170,40); - } - } - - } - else if(t==PT_ACID) - { - if(parts[i].life>255) parts[i].life = 255; - if(parts[i].life<47) parts[i].life = 48; - s = (255/((parts[i].life-46)*28)); - if(s==0) s = 1; - cr = PIXR(ptypes[t].pcolors)/s; - cg = PIXG(ptypes[t].pcolors)/s; - cb = PIXB(ptypes[t].pcolors)/s; - if(cmode==6) { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); - } - } - } else { - blendpixel(vid, nx, ny, cr, cg, cb, 255); - } - - if(cmode==4) - { - blendpixel(vid, nx+1, ny, cr, cg, cb, 223); - blendpixel(vid, nx-1, ny, cr, cg, cb, 223); - blendpixel(vid, nx, ny+1, cr, cg, cb, 223); - blendpixel(vid, nx, ny-1, cr, cg, cb, 223); - - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); - } - } - else if(t==PT_OIL&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,64,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,64,16,40); - } - } - } - else if(t==PT_NEUT) - { - if(cmode == 3||cmode==4 || cmode==6) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 8; - cb = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = 0x20; - cg = 0xE0; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_PLUT&&cmode == 6) - { - int tempx; - int tempy; - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(tempx = 2; tempx < 10; tempx++) { - for(tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_URAN&&cmode == 6) - { - int tempx; - int tempy; - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(tempx = 2; tempx < 10; tempx++) { - for(tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_SLTW&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,80,240,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,80,240,50); - } - } - } - else if(t==PT_PHOT) - { - if(cmode == 3||cmode==4 || cmode==6) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 12; - cb = 12; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xFF; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_SWCH && parts[i].life == 10) - { - x = nx; - y = ny; - blendpixel(vid,x,y,17,217,24,255); - } - else if(t==PT_LNTG&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,128,160,223,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,128,160,223,50); - } - } - } - else if(t==PT_SMKE) - { - if(cmode == 3||cmode==4 || cmode==6) - { - x = nx/CELL; - y = ny/CELL; - cg = 10; - cb = 10; - cr = 10; - cg += fire_g[y][x]; - if(cg > 50) cg = 50; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 50) cb = 50; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 50) cr = 50; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny,100,100,100,30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny,100,100,100,10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny,100,100,100,20); - } - } - } - } - else if(t==PT_WATR&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - - } else if(t==PT_DSTW&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - } - else if(t==PT_NITR&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,224,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,224,16,50); - } - } - - } - else if(t==PT_LRBD&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,170,170,170,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,170,170,170,50); - } - } - - } - - else if(t==PT_NBLE&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,235,73,23,100); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,235,73,23,30); - else - blendpixel(vid,x+nx,y+ny,235,73,23,50); - } - } - - } - else if(t==PT_GAS&&cmode == 6) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,255,255,0,180); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,255,255,0,50); - else - blendpixel(vid,x+nx,y+ny,255,255,0,80); - } - } - - } - else if(t==PT_WTRV) - { - if(cmode == 3||cmode==4 || cmode==6) - { - x = nx/CELL; - y = ny/CELL; - cg = PIXG(ptypes[t].pcolors)/3; - cb = PIXB(ptypes[t].pcolors)/3; - cr = PIXR(ptypes[t].pcolors)/3; - cg += fire_g[y][x]; - if(cg > PIXG(ptypes[t].pcolors)/2) cg = PIXG(ptypes[t].pcolors)/2; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > PIXB(ptypes[t].pcolors)/2) cb = PIXB(ptypes[t].pcolors)/2; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > PIXR(ptypes[t].pcolors)/2) cr = PIXR(ptypes[t].pcolors)/2; - fire_r[y][x] = cr; - } - else - { - for(x=-3; x<4; x++) - { - for(y=-3; y<4; y++) - { - if (abs(x)+abs(y) <2 && !(abs(x)==2||abs(y)==2)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 30); - if(abs(x)+abs(y) <=3 && abs(x)+abs(y)) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 10); - if (abs(x)+abs(y) == 2) - blendpixel(vid,x+nx,y+ny, PIXR(ptypes[t].pcolors)/1.6, PIXG(ptypes[t].pcolors)/1.6, PIXB(ptypes[t].pcolors)/1.6, 20); - } - } - } - } - else if(t==PT_THDR) - { - if(cmode == 3||cmode==4 || cmode==6) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 16; - cb = 20; - cr = 12; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = 0xFF; - cg = 0xFF; - cb = 0xA0; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_GLOW) - { - fg = 0; - fb = 0; - fr = 0; - if(pv[ny/CELL][nx/CELL]>0) { - fg = 6 * pv[ny/CELL][nx/CELL]; - fb = 4 * pv[ny/CELL][nx/CELL]; - fr = 2 * pv[ny/CELL][nx/CELL]; - } - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255)); - if(cmode == 3||cmode==4 || cmode==6) - { - x = nx/CELL; - y = ny/CELL; - fg += fire_g[y][x]; - if(fg > 255) fg = 255; - fire_g[y][x] = fg; - fb += fire_b[y][x]; - if(fb > 255) fb = 255; - fire_b[y][x] = fb; - fr += fire_r[y][x]; - if(fr > 255) fr = 255; - fire_r[y][x] = fr; - } - if(cmode == 4) { - uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255); - uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255); - uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255); - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); - } - } - else if(t==PT_LCRY) - { - uint8 GR = 0x50+(parts[i].life*10); - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, GR); - if(cmode == 4) { - blendpixel(vid, nx+1, ny, GR, GR, GR, 223); - blendpixel(vid, nx-1, ny, GR, GR, GR, 223); - blendpixel(vid, nx, ny+1, GR, GR, GR, 223); - blendpixel(vid, nx, ny-1, GR, GR, GR, 223); - - blendpixel(vid, nx+1, ny-1, GR, GR, GR, 112); - blendpixel(vid, nx-1, ny-1, GR, GR, GR, 112); - blendpixel(vid, nx+1, ny+1, GR, GR, GR, 112); - blendpixel(vid, nx-1, ny+1, GR, GR, GR, 112); - } - } - else if(t==PT_PCLN) - { - uint8 GR = 0x3B+(parts[i].life*19); - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, 10); - if(cmode == 4) { - blendpixel(vid, nx+1, ny, GR, GR, 10, 223); - blendpixel(vid, nx-1, ny, GR, GR, 10, 223); - blendpixel(vid, nx, ny+1, GR, GR, 10, 223); - blendpixel(vid, nx, ny-1, GR, GR, 10, 223); - - blendpixel(vid, nx+1, ny-1, GR, GR, 10, 112); - blendpixel(vid, nx-1, ny-1, GR, GR, 10, 112); - blendpixel(vid, nx+1, ny+1, GR, GR, 10, 112); - blendpixel(vid, nx-1, ny+1, GR, GR, 10, 112); - } - } - else if(t==PT_HSWC) - { - uint8 GR = 0x3B+(parts[i].life*19); - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, 10, 10); - if(cmode == 4) { - blendpixel(vid, nx+1, ny, GR, 10, 10, 223); - blendpixel(vid, nx-1, ny, GR, 10, 10, 223); - blendpixel(vid, nx, ny+1, GR, 10, 10, 223); - blendpixel(vid, nx, ny-1, GR, 10, 10, 223); - - blendpixel(vid, nx+1, ny-1, GR, 10, 10, 112); - blendpixel(vid, nx-1, ny-1, GR, 10, 10, 112); - blendpixel(vid, nx+1, ny+1, GR, 10, 10, 112); - blendpixel(vid, nx-1, ny+1, GR, 10, 10, 112); - } - } - else if(t==PT_PLSM) - { - float ttemp = (float)parts[i].life; - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = plasma_data[caddress]; - uint8 G = plasma_data[caddress+1]; - uint8 B = plasma_data[caddress+2]; - if(cmode == 3||cmode==4 || cmode==6) - { - cr = R/8; - cg = G/8; - cb = B/8; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_HFLM) - { - float ttemp = (float)parts[i].life; - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = hflm_data[caddress]; - uint8 G = hflm_data[caddress+1]; - uint8 B = hflm_data[caddress+2]; - if(cmode == 3||cmode==4 || cmode==6) - { - cr = R/8; - cg = G/8; - cb = B/8; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } else if(t==PT_FIRW&&parts[i].tmp==3) - { - float ttemp = (float)parts[i].life; - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = firw_data[caddress]; - uint8 G = firw_data[caddress+1]; - uint8 B = firw_data[caddress+2]; - if(cmode == 3||cmode==4 || cmode==6) - { - cr = R/2; - cg = G/2; - cb = B/2; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_FIRE && parts[i].life) - { - if(cmode == 3||cmode==4 || cmode==6) - { - cr = parts[i].life / 4; - cg = parts[i].life / 16; - cb = parts[i].life / 32; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - else - { - cr = parts[i].life * 8; - cg = parts[i].life * 2; - cb = parts[i].life; - if(cr>255) cr = 255; - if(cg>192) cg = 212; - if(cb>128) cb = 192; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - } - else if(t==PT_LAVA && parts[i].life) - { - cr = parts[i].life * 2 + 0xE0; - cg = parts[i].life * 1 + 0x50; - cb = parts[i].life/2 + 0x10; - if(cr>255) cr = 255; - if(cg>192) cg = 192; - if(cb>128) cb = 128; - blendpixel(vid, nx, ny, cr, cg, cb, 255); - blendpixel(vid, nx+1, ny, cr, cg, cb, 64); - blendpixel(vid, nx-1, ny, cr, cg, cb, 64); - blendpixel(vid, nx, ny+1, cr, cg, cb, 64); - blendpixel(vid, nx, ny-1, cr, cg, cb, 64); - if(cmode == 3||cmode==4 || cmode==6) - { - cr /= 32; - cg /= 32; - cb /= 32; - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else if(t==PT_LAVA || t==PT_SPRK) - { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - if(cmode == 3 || cmode==4 || cmode==6) - { - if(t == PT_LAVA) - { - cr = 3; - cg = i%2; - cb = 0; - } - else - { - cr = 8; - cg = 12; - cb = 16; - } - x = nx/CELL; - y = ny/CELL; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - else - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - } - else - { - float ttemp = parts[i].temp+(-MIN_TEMP); - int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); - uint8 R = color_data[caddress]; - uint8 G = color_data[caddress+1]; - uint8 B = color_data[caddress+2]; - - if(t==PT_STKM) //Stick man should be visible in heat mode - { - char buff[10]; //Buffer for HP - - if(mousex>(nx-3) && mousex<(nx+3) && mousey<(ny+3) && mousey>(ny-3)) //If mous is in the head - { - sprintf(buff, "%3d", parts[i].life); //Show HP - drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255); - } - - for(r=-2; r<=1; r++) - { - s = XRES+BARSIZE; - vid[(ny-2)*s+nx+r] = PIXRGB (R, G, B); - vid[(ny+2)*s+nx+r+1] = PIXRGB (R, G, B); - vid[(ny+r+1)*s+nx-2] = PIXRGB (R, G, B); - vid[(ny+r)*s+nx+2] = PIXRGB (R, G, B); - } - draw_line(vid , nx, ny+3, player[3], player[4], R, G, B, s); - draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s); - draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s); - draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s); - - isplayer = 1; //It's a secret. Tssss... - } - else - { - vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(R, G, B); - //blendpixel(vid, nx+1, ny, R, G, B, 255); - } - } - if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_HFLM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH&&t!=PT_SMKE&&t!=PT_WTRV&&!(t==PT_FIRW&&parts[i].tmp==3)) - { - uint8 R = PIXR(ptypes[t].pcolors); - uint8 G = PIXG(ptypes[t].pcolors); - uint8 B = PIXB(ptypes[t].pcolors); - - //if(vid[(ny-1)*YRES+(nx-1)]!=0){ - // blendpixel(vid, nx, ny-1, R, G, B, 46); - //} - - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); - - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); - } - } -#endif - } -#ifdef OpenGL - glFlush (); -#endif - -} - -void render_signs(pixel *vid_buf) -{ - int i, j, x, y, w, h, dx, dy; - char buff[30]; //Buffer - for(i=0; i>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)>8].temp-273.15); //...tempirature - else - sprintf(buff, "Temp: 0.00"); //...tempirature - drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255); - } - - //Usual text - if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}")) - drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255); - x = signs[i].x; - y = signs[i].y; - dx = 1 - signs[i].ju; - dy = (signs[i].y > 18) ? -1 : 1; - for(j=0; j<4; j++) - { - drawpixel(vid_buf, x, y, 192, 192, 192, 255); - x+=dx; - y+=dy; - } - } -} - -void render_fire(pixel *dst) -{ - int i,j,x,y,r,g,b; - for(j=0; j=0 && j+y>=0 && i+x4 ? r-4 : 0; - fire_g[j][i] = g>4 ? g-4 : 0; - fire_b[j][i] = b>4 ? b-4 : 0; - } -} - -void prepare_alpha(void) -{ - int x,y,i,j; - float temp[CELL*3][CELL*3]; - memset(temp, 0, sizeof(temp)); - for(x=0; x0) - r--; - if(g>0) - g--; - if(b>0) - b--; - dst[i] = PIXRGB(r,g,b); - } -} - -void render_zoom(pixel *img) -{ - int x, y, i, j; - pixel pix; - drawrect(img, zoom_wx-2, zoom_wy-2, ZSIZE*ZFACTOR+2, ZSIZE*ZFACTOR+2, 192, 192, 192, 255); - drawrect(img, zoom_wx-1, zoom_wy-1, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR, 0, 0, 0, 255); - clearrect(img, zoom_wx, zoom_wy, ZSIZE*ZFACTOR, ZSIZE*ZFACTOR); - for(j=0; jSAVE_VERSION) - return NULL; - - bw = c[6]; - bh = c[7]; - w = bw*CELL; - h = bh*CELL; - - if(c[5]!=CELL) - return NULL; - - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return NULL; - fb = calloc(w*h, PIXELSIZE); - if(!fb) - { - free(d); - return NULL; - } - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - goto corrupt; - size = i; - - if(size < bw*bh) - goto corrupt; - - k = 0; - for(y=0; y>1)&1; i>1)&1; i>1)&1; i=size) - goto corrupt; - - for(y=0; y= size) - goto corrupt; - j=d[p++]; - if(j0) - { - if(j==PT_STKM) //Stickman should be drawed another way - { - //Stickman drawing - for(k=-2; k<=1; k++) - { - fb[(y-2)*w+x+k] = PIXRGB(255, 224, 178); - fb[(y+2)*w+x+k+1] = PIXRGB(255, 224, 178); - fb[(y+k+1)*w+x-2] = PIXRGB(255, 224, 178); - fb[(y+k)*w+x+2] = PIXRGB(255, 224, 178); - } - draw_line(fb , x, y+3, x-1, y+6, 255, 255, 255, w); - draw_line(fb , x-1, y+6, x-3, y+12, 255, 255, 255, w); - draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w); - draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w); - } - else - fb[y*w+x] = ptypes[j].pcolors; - } - } - - free(d); - *width = w; - *height = h; - return fb; - -corrupt: - free(d); - free(fb); - return NULL; -} - -int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl) -{ - unsigned char *d,*c=thumb; - int i,j,x,y,a,t,r,g,b,sx,sy; - - if(bzip2) - { - if(size<16) - return 1; - if(c[3]!=0x74 || c[2]!=0x49 || c[1]!=0x68 || c[0]!=0x53) - return 1; - if(c[4]>PT_NUM) - return 2; - if(c[5]!=CELL || c[6]!=XRES/CELL || c[7]!=YRES/CELL) - return 3; - i = XRES*YRES; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+8), size-8, 0, 0)) - return 1; - size = i; - } - else - d = c; - - if(size < XRES*YRES) - { - if(bzip2) - free(d); - return 1; - } - - sy = 0; - for(y=0; y+scl<=YRES; y+=scl) - { - sx = 0; - for(x=0; x+scl<=XRES; x+=scl) - { - a = 0; - r = g = b = 0; - for(j=0; j=PT_NUM) - goto corrupt; - r += PIXR(ptypes[t].pcolors); - g += PIXG(ptypes[t].pcolors); - b += PIXB(ptypes[t].pcolors); - a ++; - } - } - if(a) - { - a = 256/a; - r = (r*a)>>8; - g = (g*a)>>8; - b = (b*a)>>8; - } - - drawpixel(vid_buf, px+sx, py+sy, r, g, b, 255); - sx++; - } - sy++; - } - - if(bzip2) - free(d); - return 0; - -corrupt: - if(bzip2) - free(d); - return 1; -} - -void render_cursor(pixel *vid, int x, int y, int t, int r) -{ - int i,j,c; - if(tr*r || i*i+(j+1)*(j+1)>r*r)) - { - xor_pixel(x+i, y+j, vid); - if(j) xor_pixel(x+i, y-j, vid); - if(i) xor_pixel(x-i, y+j, vid); - if(i&&j) xor_pixel(x-i, y-j, vid); - } - } - else - { - int tc; - c = (r/CELL) * CELL; - x = (x/CELL) * CELL; - y = (y/CELL) * CELL; - - tc = !((c%(CELL*2))==0); - - x -= c/2; - y -= c/2; - - x += tc*(CELL/2); - y += tc*(CELL/2); - - for(i=0; i -#include "defines.h" -#include "hmap.h" - -#ifdef PIX16 -#define PIXELSIZE 2 -#define PIXPACK(x) ((((x)>>8)&0xF800)|(((x)>>5)&0x07E0)|(((x)>>3)&0x001F)) -#define PIXRGB(r,g,b) ((((r)<<8)&0xF800)|(((g)<<3)&0x07E0)|(((b)>>3)&0x001F)) -#define PIXR(x) (((x)>>8)&0xF8) -#define PIXG(x) (((x)>>3)&0xFC) -#define PIXB(x) (((x)<<3)&0xF8) -#else -#define PIXELSIZE 4 -#ifdef PIX32BGR -#define PIXPACK(x) ((((x)>>16)&0x0000FF)|((x)&0x00FF00)|(((x)<<16)&0xFF0000)) -#define PIXRGB(r,g,b) (((b)<<16)|((g)<<8)|((r)))// (((b)<<16)|((g)<<8)|(r)) -#define PIXR(x) ((x)&0xFF) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)>>16) -#else -#ifdef PIX32BGRA -#define PIXPACK(x) ((((x)>>8)&0x0000FF00)|(((x)<<8)&0x00FF0000)|(((x)<<24)&0xFF000000)) -#define PIXRGB(r,g,b) (((b)<<24)|((g)<<16)|((r)<<8)) -#define PIXR(x) (((x)>>8)&0xFF) -#define PIXG(x) (((x)>>16)&0xFF) -#define PIXB(x) (((x)>>24)) -#else -#define PIXPACK(x) (x) -#define PIXRGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) -#define PIXR(x) ((x)>>16) -#define PIXG(x) (((x)>>8)&0xFF) -#define PIXB(x) ((x)&0xFF) -#endif -#endif -#endif - -extern unsigned cmode; -extern SDL_Surface *sdl_scrn; -extern int sdl_scale; - -extern unsigned char fire_r[YRES/CELL][XRES/CELL]; -extern unsigned char fire_g[YRES/CELL][XRES/CELL]; -extern unsigned char fire_b[YRES/CELL][XRES/CELL]; - -extern unsigned int fire_alpha[CELL*3][CELL*3]; -extern pixel *fire_bg; - -pixel *rescale_img(pixel *src, int sw, int sh, int *qw, int *qh, int f); - -void sdl_blit_1(int x, int y, int w, int h, pixel *src, int pitch); - -void sdl_blit_2(int x, int y, int w, int h, pixel *src, int pitch); - -void sdl_blit(int x, int y, int w, int h, pixel *src, int pitch); - -void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb); - -void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswall); - -int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc); - -void draw_menu(pixel *vid_buf, int i, int hover); - -#ifdef WIN32 -_inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); -#else -extern inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); -#endif - -#ifdef WIN32 -_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); -#else -extern inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); -#endif - -int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a); - -void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); - -void fillrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); - -void clearrect(pixel *vid, int x, int y, int w, int h); - -void drawdots(pixel *vid, int x, int y, int h, int r, int g, int b, int a); - -int textwidth(char *s); - -int drawtextmax(pixel *vid, int x, int y, int w, char *s, int r, int g, int b, int a); - -int textnwidth(char *s, int n); - -int textwidthx(char *s, int w); - -#ifdef WIN32 -_inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); -#else -inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); -#endif - -void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag); - -void draw_air(pixel *vid); - -void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a); - -void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a); - -void xor_pixel(int x, int y, pixel *vid); - -void xor_line(int x1, int y1, int x2, int y2, pixel *vid); - -void xor_rect(pixel *vid, int x, int y, int w, int h); - -void draw_parts(pixel *vid); - -void render_signs(pixel *vid_buf); - -void render_fire(pixel *dst); - -void prepare_alpha(void); - -void draw_image(pixel *vid, pixel *img, int x, int y, int w, int h, int a); - -void dim_copy(pixel *dst, pixel *src); - -void render_zoom(pixel *img); - -pixel *prerender_save(void *save, int size, int *width, int *height); - -int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl); - -void render_cursor(pixel *vid, int x, int y, int t, int r); - -void sdl_open(void); - -#ifdef OpenGL -void Enable2D (); -void RenderScene (); -void ClearScreen(); -#endif - -#endif diff --git a/hmap.h b/hmap.h deleted file mode 100755 index 1af8013..0000000 --- a/hmap.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Powder Toy - Heatmap Data - * - * Copyright (c) 2010 Simon Robertshaw - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef HMAP_H -#define HMAP_H -//Original Heat Scale -//static char color_data[] = {0xD9,0xFF,0xFE,0xD4,0xFB,0xFC,0xCF,0xF6,0xF9,0xC9,0xF1,0xF6,0xC2,0xEB,0xF4,0xBB,0xE5,0xF0,0xB3,0xDE,0xED,0xAA,0xD6,0xE9,0xA1,0xCF,0xE5,0x98,0xC7,0xE2,0x8E,0xBF,0xDD,0x85,0xB6,0xD9,0x7B,0xAD,0xD5,0x71,0xA5,0xD0,0x67,0x9C,0xCC,0x5D,0x93,0xC7,0x53,0x8A,0xC3,0x4A,0x82,0xBE,0x41,0x79,0xB9,0x38,0x71,0xB5,0x30,0x69,0xB0,0x28,0x61,0xAC,0x21,0x5A,0xA8,0x1B,0x53,0xA3,0x16,0x4D,0x9F,0x12,0x47,0x9B,0x0F,0x42,0x98,0x0F,0x3D,0x94,0x0F,0x39,0x90,0x0F,0x34,0x8C,0x0F,0x30,0x89,0x0F,0x2C,0x85,0x0F,0x28,0x81,0x0F,0x24,0x7D,0x0F,0x20,0x7A,0x0F,0x1D,0x76,0x0F,0x1A,0x72,0x0F,0x16,0x6F,0x0F,0x13,0x6B,0x0F,0x11,0x67,0x10,0x0E,0x64,0x12,0x0C,0x60,0x15,0x0A,0x5D,0x18,0x08,0x59,0x1B,0x06,0x56,0x1D,0x04,0x53,0x20,0x03,0x4F,0x23,0x02,0x4C,0x26,0x01,0x49,0x29,0x01,0x46,0x2C,0x00,0x43,0x2F,0x00,0x40,0x30,0x00,0x3F,0x31,0x00,0x3F,0x31,0x00,0x3E,0x32,0x00,0x3E,0x32,0x00,0x3D,0x33,0x00,0x3D,0x33,0x00,0x3C,0x34,0x00,0x3C,0x34,0x00,0x3B,0x35,0x01,0x3B,0x36,0x01,0x3B,0x36,0x01,0x3A,0x37,0x01,0x3A,0x37,0x01,0x39,0x38,0x01,0x39,0x39,0x01,0x38,0x39,0x02,0x38,0x3A,0x02,0x37,0x3B,0x02,0x37,0x3B,0x02,0x36,0x3C,0x02,0x36,0x3C,0x03,0x35,0x3D,0x03,0x35,0x3E,0x03,0x34,0x3F,0x03,0x34,0x3F,0x04,0x34,0x40,0x04,0x33,0x41,0x04,0x33,0x41,0x04,0x32,0x42,0x05,0x32,0x43,0x05,0x31,0x43,0x05,0x31,0x44,0x06,0x30,0x45,0x06,0x30,0x46,0x06,0x30,0x46,0x07,0x2F,0x47,0x07,0x2F,0x48,0x08,0x2E,0x49,0x08,0x2E,0x49,0x08,0x2E,0x4A,0x09,0x2D,0x4B,0x09,0x2D,0x4C,0x09,0x2C,0x4C,0x0A,0x2C,0x4D,0x0A,0x2B,0x4E,0x0B,0x2B,0x4F,0x0B,0x2B,0x4F,0x0C,0x2A,0x50,0x0C,0x2A,0x51,0x0D,0x29,0x52,0x0D,0x29,0x53,0x0D,0x29,0x53,0x0E,0x28,0x54,0x0E,0x28,0x55,0x0F,0x27,0x56,0x0F,0x27,0x57,0x10,0x27,0x58,0x10,0x26,0x58,0x11,0x26,0x59,0x11,0x26,0x5A,0x12,0x25,0x5B,0x13,0x25,0x5C,0x13,0x24,0x5D,0x14,0x24,0x5D,0x14,0x24,0x5E,0x15,0x23,0x5F,0x15,0x23,0x60,0x16,0x23,0x61,0x16,0x22,0x62,0x17,0x22,0x62,0x18,0x22,0x63,0x18,0x21,0x64,0x19,0x21,0x65,0x19,0x21,0x66,0x1A,0x20,0x67,0x1B,0x20,0x67,0x1B,0x20,0x68,0x1C,0x1F,0x69,0x1C,0x1F,0x6A,0x1D,0x1F,0x6B,0x1E,0x1E,0x6C,0x1E,0x1E,0x6D,0x1F,0x1E,0x6D,0x1F,0x1D,0x6E,0x20,0x1D,0x6F,0x21,0x1D,0x70,0x21,0x1C,0x71,0x22,0x1C,0x72,0x23,0x1C,0x73,0x23,0x1B,0x73,0x24,0x1B,0x74,0x25,0x1B,0x75,0x25,0x1A,0x76,0x26,0x1A,0x77,0x27,0x1A,0x78,0x27,0x1A,0x78,0x28,0x19,0x79,0x29,0x19,0x7A,0x29,0x19,0x7B,0x2A,0x18,0x7C,0x2B,0x18,0x7D,0x2B,0x18,0x7E,0x2C,0x18,0x7E,0x2D,0x17,0x7F,0x2D,0x17,0x80,0x2E,0x17,0x81,0x2F,0x16,0x82,0x2F,0x16,0x82,0x30,0x16,0x83,0x31,0x16,0x84,0x31,0x15,0x85,0x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,0x0E,0x00,0x0D,0x11,0x00,0x10,0x14,0x00,0x13,0x17,0x00,0x16,0x1B,0x00,0x19,0x1E,0x00,0x1C,0x22,0x00,0x1F,0x26,0x00,0x22,0x29,0x00,0x26,0x2D,0x00,0x29,0x32,0x00,0x2D,0x36,0x00,0x30,0x3A,0x00,0x34,0x3E,0x00,0x38,0x43,0x00,0x3C,0x47,0x00,0x40,0x4C,0x00,0x44,0x51,0x00,0x48,0x55,0x00,0x4C,0x5A,0x00,0x50,0x5F,0x00,0x54,0x64,0x00,0x59,0x69,0x00,0x5D,0x6E,0x00,0x61,0x73,0x00,0x66,0x77,0x00,0x6A,0x7C,0x00,0x6E,0x81,0x00,0x73,0x86,0x00,0x77,0x8B,0x00,0x7C,0x90,0x00,0x80,0x95,0x00,0x85,0x9A,0x00,0x89,0x9F,0x00,0x8D,0xA3,0x00,0x92,0xA8,0x00,0x96,0xAD,0x00,0x9B,0xB1,0x00,0x9F,0xB6,0x00,0xA3,0xBA,0x00,0xA8,0xBF,0x00,0xAC,0xC3,0x00,0xB0,0xC7,0x00,0xB4,0xCB,0x00,0xB8,0xCF,0x00,0xBD,0xD3,0x00,0xC1,0xD7,0x00,0xC4,0xDB,0x00,0xC8,0xDE,0x00,0xCC,0xE1,0x00,0xD0,0xE5,0x00,0xD4,0xE8,0x00,0xD7,0xEA,0x00,0xDB,0xED,0x00,0xDE,0xF0,0x00,0xE1,0xF2,0x00,0xE4,0xF4,0x00,0xE8,0xF6,0x00,0xEB,0xF8,0x00,0xED,0xFA,0x00,0xF0,0xFB,0x00,0xF3,0xFC,0x00,0xF5,0xFD,0x00,0xF8,0xFE,0x00,0xFA,0xFF,0x00,0xFC,0xFF,0x00,0xFE,0xFF,0x00,0xFF,0xFF,0x00,0xFF,0xFE,0x00,0xFF,0xFE,0x00,0xFF,0xFD,0x00,0xFF,0xFC,0x00,0xFF,0xFB,0x00,0xFF,0xF9,0x00,0xFF,0xF8,0x00,0xFF,0xF6,0x00,0xFF,0xF4,0x00,0xFF,0xF2,0x00,0xFF,0xF0,0x00,0xFF,0xEE,0x00,0xFF,0xEB,0x00,0xFF,0xE9,0x00,0xFF,0xE6,0x00,0xFF,0xE3,0x00,0xFF,0xE0,0x00,0xFF,0xDD,0x00,0xFF,0xD9,0x00,0xFF,0xD6,0x00,0xFF,0xD3,0x00,0xFF,0xCF,0x00,0xFF,0xCB,0x00,0xFF,0xC7,0x00,0xFF,0xC4,0x00,0xFF,0xC0,0x00,0xFF,0xBC,0x00,0xFF,0xB7,0x00,0xFF,0xB3,0x00,0xFF,0xAF,0x00,0xFF,0xAB,0x00,0xFF,0xA6,0x00,0xFF,0xA2,0x00,0xFF,0x9E,0x00,0xFF,0x99,0x00,0xFF,0x95,0x00,0xFF,0x90,0x00,0xFF,0x8B,0x00,0xFF,0x87,0x00,0xFF,0x82,0x00,0xFF,0x7E,0x00,0xFF,0x79,0x00,0xFF,0x74,0x00,0xFF,0x70,0x00,0xFF,0x6B,0x00,0xFF,0x67,0x00,0xFF,0x62,0x00,0xFF,0x5E,0x00,0xFF,0x59,0x00,0xFF,0x55,0x00,0xFF,0x50,0x00,0xFF,0x4C,0x00,0xFF,0x48,0x00,0xFF,0x43,0x00,0xFF,0x3F,0x00,0xFF,0x3B,0x00,0xFF,0x37,0x00,0xFF,0x33,0x00,0xFF,0x2F,0x00,0xFF,0x2B,0x00,0xFF,0x28,0x00,0xFF,0x24,0x00,0xFF,0x21,0x00,0xFF,0x1D,0x00,0xFF,0x1A,0x00,0xFF,0x17,0x00,0xFF,0x14,0x00,0xFF,0x11,0x00,0xFF,0x0E,0x00,0xFF,0x0C,0x00,0xFF,0x09,0x00,0xFF,0x07,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x01,0x00,0xFF,0x00,0x01,0xFF,0x00,0x03,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x09,0xFF,0x00,0x0C,0xFF,0x00,0x0F,0xFF,0x00,0x11,0xFF,0x00,0x14,0xFF,0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xE1,0x00,0xFF,0xDD,0x00,0xFF,0xDA,0x00,0xFF,0xD6,0x00,0xFF,0xD3,0x00,0xFF,0xCF,0x00,0xFF,0xCB,0x00,0xFF,0xC8,0x00,0xFF,0xC4,0x00,0xFF,0xC0,0x00,0xFF,0xBC,0x00,0xFF,0xB8,0x00,0xFF,0xB4,0x00,0xFF,0xAF,0x00,0xFF,0xAB,0x00,0xFF,0xA7,0x00,0xFF,0xA3,0x00,0xFF,0x9E,0x00,0xFF,0x9A,0x00,0xFF,0x96,0x00,0xFF,0x91,0x00,0xFF,0x8D,0x00,0xFF,0x88,0x00,0xFF,0x84,0x00,0xFF,0x80,0x00,0xFF,0x7B,0x00,0xFF,0x77,0x00,0xFF,0x72,0x00,0xFF,0x6E,0x00,0xFF,0x69,0x00,0xFF,0x65,0x00,0xFF,0x61,0x00,0xFF,0x5C,0x00,0xFF,0x58,0x00,0xFF,0x54,0x00,0xFF,0x50,0x00,0xFF,0x4B,0x00,0xFF,0x47,0x00,0xFF,0x43,0x00,0xFF,0x3F,0x00,0xFF,0x3B,0x00,0xFF,0x37,0x00,0xFF,0x34,0x00,0xFF,0x30,0x00,0xFF,0x2C,0x00,0xFF,0x29,0x00,0xFF,0x25,0x00,0xFF,0x22,0x00,0xFF,0x1E,0x00,0xFF,0x1B,0x00,0xFF,0x18,0x00,0xFF,0x15,0x00,0xFF,0x12,0x00,0xFF,0x10,0x00,0xFF,0x0D,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x04,0x00,0xFF,0x02,0x00,0xFF,0x00,0x02,0xFD,0x00,0x04,0xFB,0x00,0x06,0xF9,0x00,0x09,0xF6,0x00,0x0B,0xF3,0x00,0x0E,0xF1,0x00,0x10,0xEE,0x00,0x13,0xEB,0x00,0x16,0xE7,0x00,0x19,0xE4,0x00,0x1C,0xE0,0x00,0x1F,0xDD,0x00,0x23,0xD9,0x00,0x26,0xD5,0x00,0x29,0xD1,0x00,0x2D,0xCD,0x00,0x31,0xC9,0x00,0x35,0xC4,0x00,0x38,0xC0,0x00,0x3C,0xBC,0x00,0x40,0xB7,0x00,0x44,0xB2,0x00,0x48,0xAE,0x00,0x4C,0xA9,0x00,0x51,0xA4,0x00,0x55,0x9F,0x00,0x59,0x9B,0x00,0x5D,0x96,0x00,0x62,0x91,0x00,0x66,0x8C,0x00,0x6A,0x87,0x00,0x6F,0x82,0x00,0x73,0x7D,0x00,0x78,0x78,0x00,0x7C,0x73,0x00,0x81,0x6E,0x00,0x85,0x69,0x00,0x8A,0x65,0x00,0x8E,0x60,0x00,0x92,0x5B,0x00,0x97,0x56,0x00,0x9B,0x52,0x00,0xA0,0x4D,0x00,0xA4,0x49,0x00,0xA8,0x44,0x00,0xAC,0x40,0x00,0xB1,0x3B,0x00,0xB5,0x37,0x00,0xB9,0x33,0x00,0xBD,0x2F,0x00,0xC1,0x2B,0x00,0xC5,0x28,0x00,0xC9,0x24,0x00,0xCD,0x21,0x00,0xD0,0x1D,0x00,0xD4,0x1A,0x00,0xD8,0x17,0x00,0xDB,0x14,0x00,0xDE,0x11,0x00,0xE2,0x0F,0x00,0xE5,0x0D,0x00,0xE8,0x0A,0x00,0xEB,0x08,0x00,0xEE,0x07,0x00,0xF0,0x05,0x00,0xF3,0x04,0x00,0xF6,0x02,0x00,0xF8,0x01,0x00,0xFA,0x01,0x00,0xFC,0x00,0x00,0xFE,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x02,0x00,0xFF,0x03,0x00,0xFF,0x04,0x00,0xFF,0x06,0x00,0xFF,0x07,0x00,0xFF,0x09,0x00,0xFF,0x0B,0x00,0xFF,0x0D,0x00,0xFF,0x0F,0x00,0xFF,0x12,0x00,0xFF,0x14,0x00,0xFF,0x17,0x00,0xFF,0x1A,0x00,0xFF,0x1C,0x00,0xFF,0x1F,0x00,0xFF,0x23,0x00,0xFF,0x26,0x00,0xFF,0x29,0x00,0xFF,0x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00,0xFF,0xDC,0x00,0xFF,0xD9,0x00,0xFF,0xD6,0x00,0xFF,0xD4,0x00,0xFF,0xD1,0x00,0xFF,0xCE,0x00,0xFF,0xCC,0x00,0xFF,0xC9,0x00,0xFF,0xC6,0x00,0xFF,0xC3,0x00,0xFF,0xC1,0x00,0xFF,0xBE,0x00,0xFF,0xBB,0x00,0xFF,0xB8,0x00,0xFF,0xB5,0x00,0xFF,0xB2,0x00,0xFF,0xAF,0x00,0xFF,0xAC,0x00,0xFF,0xA9,0x00,0xFF,0xA7,0x00,0xFF,0xA4,0x00,0xFF,0xA1,0x00,0xFF,0x9E,0x00,0xFF,0x9B,0x00,0xFF,0x98,0x00,0xFF,0x95,0x00,0xFF,0x93,0x00,0xFF,0x90,0x00,0xFF,0x8D,0x00,0xFF,0x8A,0x00,0xFF,0x88,0x00,0xFF,0x85,0x00,0xFF,0x83,0x00,0xFF,0x80,0x00,0xFF,0x7E,0x00,0xFF,0x7B,0x00,0xFF,0x78,0x00,0xFF,0x76,0x00,0xFF,0x73,0x00,0xFF,0x70,0x00,0xFF,0x6E,0x00,0xFF,0x6B,0x00,0xFF,0x68,0x00,0xFF,0x65,0x00,0xFF,0x63,0x00,0xFF,0x60,0x00,0xFF,0x5D,0x00,0xFF,0x5A,0x00,0xFF,0x57,0x00,0xFF,0x54,0x00,0xFF,0x51,0x00,0xFF,0x4E,0x00,0xFF,0x4B,0x00,0xFF,0x49,0x00,0xFF,0x46,0x00,0xFF,0x43,0x00,0xFF,0x40,0x00,0xFF,0x3D,0x00,0xFF,0x3A,0x00,0xFF,0x37,0x00,0xFF,0x35,0x00,0xFF,0x32,0x00,0xFF,0x2F,0x00,0xFF,0x2C,0x00,0xFF,0x2A,0x00,0xFF,0x27,0x00,0xFF,0x25,0x00,0xFF,0x22,0x00,0xFF,0x20,0x00,0xFF,0x1D,0x00,0xFF,0x1B,0x00,0xFF,0x18,0x00,0xFF,0x16,0x00,0xFF,0x14,0x00,0xFF,0x12,0x00,0xFF,0x10,0x00,0xFF,0x0E,0x00,0xFF,0x0C,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x00,0x00,0xFF,0x00,0x01,0xFF,0x00,0x02,0xFF,0x00,0x04,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x08,0xFF,0x00,0x0A,0xFF,0x00,0x0C,0xFF,0x00,0x0E,0xFF,0x00,0x10,0xFF,0x00,0x12,0xFF,0x00,0x14,0xFF,0x00,0x16,0xFF,0x00,0x19,0xFF,0x00,0x1B,0xFF,0x00,0x1D,0xFF,0x00,0x20,0xFF,0x00,0x22,0xFF,0x00,0x25,0xFF,0x00,0x28,0xFF,0x00,0x2A,0xFF,0x00,0x2D,0xFF,0x00,0x30,0xFF,0x00,0x32,0xFF,0x00,0x35,0xFF,0x00,0x38,0xFF,0x00,0x3B,0xFF,0x00,0x3D,0xFF,0x00,0x40,0xFF,0x00,0x43,0xFF,0x00,0x46,0xFF,0x00,0x49,0xFF,0x00,0x4C,0xFF,0x00,0x4F,0xFF,0x00,0x52,0xFF,0x00,0x55,0xFF,0x00,0x57,0xFF,0x00,0x5A,0xFF,0x00,0x5D,0xFF,0x00,0x60,0xFF,0x00,0x63,0xFF,0x00,0x66,0xFF,0x00,0x69,0xFF,0x00,0x6B,0xFF,0x00,0x6E,0xFF,0x00,0x71,0xFF,0x00,0x74,0xFF,0x00,0x76,0xFF,0x00,0x79,0xFF,0x00,0x7B,0xFF,0x00,0x7E,0xFF,0x00,0x80,0xFF,0x00,0x83,0xFF,0x00,0x86,0xFF,0x00,0x88,0xFF,0x00,0x8B,0xFF,0x00,0x8E,0xFF,0x00,0x90,0xFF,0x00,0x93,0xFF,0x00,0x96,0xFF,0x00,0x99,0xFF,0x00,0x9B,0xFF,0x00,0x9E,0xFF,0x00,0xA1,0xFF,0x00,0xA4,0xFF,0x00,0xA7,0xFF,0x00,0xAA,0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6,0x00,0xFF,0xA3,0x00,0xFF,0xA0,0x00,0xFF,0x9D,0x00,0xFF,0x9A,0x00,0xFF,0x98,0x00,0xFF,0x95,0x00,0xFF,0x92,0x00,0xFF,0x8F,0x00,0xFF,0x8C,0x00,0xFF,0x8A,0x00,0xFF,0x87,0x00,0xFF,0x85,0x00,0xFF,0x82,0x00,0xFF,0x80,0x00,0xFF,0x7D,0x00,0xFF,0x7A,0x00,0xFF,0x78,0x00,0xFF,0x75,0x00,0xFF,0x73,0x00,0xFF,0x70,0x00,0xFF,0x6D,0x00,0xFF,0x6A,0x00,0xFF,0x67,0x00,0xFF,0x65,0x00,0xFF,0x62,0x00,0xFF,0x5F,0x00,0xFF,0x5C,0x00,0xFF,0x59,0x00,0xFF,0x56,0x00,0xFF,0x53,0x00,0xFF,0x51,0x00,0xFF,0x4E,0x00,0xFF,0x4B,0x00,0xFF,0x48,0x00,0xFF,0x45,0x00,0xFF,0x42,0x00,0xFF,0x3F,0x00,0xFF,0x3C,0x00,0xFF,0x3A,0x00,0xFF,0x37,0x00,0xFF,0x34,0x00,0xFF,0x31,0x00,0xFF,0x2E,0x00,0xFF,0x2C,0x00,0xFF,0x29,0x00,0xFF,0x27,0x00,0xFF,0x24,0x00,0xFF,0x21,0x00,0xFF,0x1F,0x00,0xFF,0x1D,0x00,0xFF,0x1A,0x00,0xFF,0x18,0x00,0xFF,0x16,0x00,0xFF,0x13,0x00,0xFF,0x11,0x00,0xFF,0x0F,0x00,0xFF,0x0D,0x00,0xFF,0x0B,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x00,0x01,0xFF,0x00,0x02,0xFF,0x00,0x04,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x09,0xFF,0x00,0x0A,0xFF,0x00,0x0C,0xFF,0x00,0x0E,0xFF,0x00,0x10,0xFF,0x00,0x12,0xFF,0x00,0x15,0xFF,0x00,0x17,0xFF,0x00,0x19,0xFF,0x00,0x1B,0xFF,0x00,0x1E,0xFF,0x00,0x20,0xFF,0x00,0x23,0xFF,0x00,0x25,0xFF,0x00,0x28,0xFF,0x00,0x2A,0xFF,0x00,0x2D,0xFF,0x00,0x30,0xFF,0x00,0x33,0xFF,0x00,0x35,0xFF,0x00,0x38,0xFF,0x00,0x3B,0xFF,0x00,0x3E,0xFF,0x00,0x41,0xFF,0x00,0x44,0xFF,0x00,0x46,0xFF,0x00,0x49,0xFF,0x00,0x4C,0xFF,0x00,0x4F,0xFF,0x00,0x52,0xFF,0x00,0x55,0xFF,0x00,0x58,0xFF,0x00,0x5B,0xFF,0x00,0x5E,0xFF,0x00,0x61,0xFF,0x00,0x63,0xFF,0x00,0x66,0xFF,0x00,0x69,0xFF,0x00,0x6C,0xFF,0x00,0x6F,0xFF,0x00,0x71,0xFF,0x00,0x74,0xFF,0x00,0x77,0xFF,0x00,0x79,0xFF,0x00,0x7C,0xFF,0x00,0x7F,0xFF,0x00,0x81,0xFF,0x00,0x84,0xFF,0x00,0x86,0xFF,0x00,0x89,0xFF,0x00,0x8B,0xFF,0x00,0x8E,0xFF,0x00,0x91,0xFF,0x00,0x94,0xFF,0x00,0x96,0xFF,0x00,0x99,0xFF,0x00,0x9C,0xFF,0x00,0x9F,0xFF,0x00,0xA2,0xFF,0x00,0xA5,0xFF,0x00,0xA8,0xFF,0x00,0xAA,0xFF,0x00,0xAD,0xFF,0x00,0xB0,0xFF,0x00,0xB3,0xFF,0x00,0xB6,0xFF,0x00,0xB9,0xFF,0x00,0xBC,0xFF,0x00,0xBF,0xFF,0x00,0xC2,0xFF,0x00,0xC4,0xFF,0x00,0xC7,0xFF,0x00,0xCA,0xFF,0x00,0xCD,0xFF,0x00,0xCF,0xFF,0x00,0xD2,0xFF,0x00,0xD5,0xFF,0x00,0xD7,0xFF,0x00,0xDA,0xFF,0x00,0xDD,0xFF,0x00,0xDF,0xFF,0x00,0xE2,0xFF,0x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00,0xFF,0x6A,0x00,0xFF,0x67,0x00,0xFF,0x64,0x00,0xFF,0x61,0x00,0xFF,0x5E,0x00,0xFF,0x5B,0x00,0xFF,0x58,0x00,0xFF,0x56,0x00,0xFF,0x53,0x00,0xFF,0x50,0x00,0xFF,0x4D,0x00,0xFF,0x4A,0x00,0xFF,0x47,0x00,0xFF,0x44,0x00,0xFF,0x41,0x00,0xFF,0x3E,0x00,0xFF,0x3C,0x00,0xFF,0x39,0x00,0xFF,0x36,0x00,0xFF,0x33,0x00,0xFF,0x31,0x00,0xFF,0x2E,0x00,0xFF,0x2B,0x00,0xFF,0x29,0x00,0xFF,0x26,0x00,0xFF,0x23,0x00,0xFF,0x21,0x00,0xFF,0x1E,0x00,0xFF,0x1C,0x00,0xFF,0x1A,0x00,0xFF,0x17,0x00,0xFF,0x15,0x00,0xFF,0x13,0x00,0xFF,0x11,0x00,0xFF,0x0F,0x00,0xFF,0x0D,0x00,0xFF,0x0B,0x00,0xFF,0x09,0x00,0xFF,0x07,0x00,0xFF,0x06,0x00,0xFF,0x04,0x00,0xFF,0x03,0x00,0xFF,0x01,0x00}; -//Scaled Hue Scale -static char color_data[] = {0xFF,0x00,0xFF,0xF1,0x00,0xFF,0xDE,0x00,0xFF,0xC7,0x00,0xFF,0xAF,0x00,0xFF,0x97,0x00,0xFF,0x82,0x00,0xFF,0x6C,0x00,0xFF,0x56,0x00,0xFF,0x41,0x00,0xFF,0x2E,0x00,0xFF,0x21,0x05,0xFF,0x16,0x0F,0xFF,0x0E,0x1B,0xFF,0x07,0x29,0xFF,0x02,0x39,0xFF,0x00,0x4B,0xFF,0x00,0x5E,0xFF,0x00,0x74,0xFF,0x00,0x8A,0xFF,0x00,0xA0,0xFF,0x00,0xAF,0xFF,0x00,0xB8,0xFE,0x00,0xC2,0xFD,0x00,0xCC,0xFD,0x00,0xD5,0xFC,0x00,0xDF,0xFA,0x00,0xE7,0xF9,0x00,0xEF,0xF6,0x00,0xF6,0xF3,0x00,0xFC,0xEE,0x00,0xFF,0xE8,0x00,0xFF,0xE1,0x00,0xFF,0xD8,0x00,0xFF,0xCE,0x00,0xFF,0xC4,0x00,0xFF,0xB9,0x00,0xFF,0xAD,0x00,0xFF,0xA1,0x00,0xFF,0x96,0x00,0xFF,0x8A,0x00,0xFF,0x80,0x00,0xFF,0x7C,0x00,0xFF,0x78,0x00,0xFF,0x75,0x00,0xFF,0x71,0x00,0xFF,0x6D,0x00,0xFF,0x69,0x00,0xFF,0x66,0x00,0xFF,0x62,0x00,0xFF,0x5E,0x00,0xFF,0x5A,0x00,0xFF,0x56,0x00,0xFF,0x52,0x00,0xFF,0x4E,0x00,0xFF,0x4A,0x00,0xFF,0x47,0x00,0xFF,0x43,0x00,0xFF,0x3F,0x00,0xFF,0x3B,0x00,0xFF,0x38,0x00,0xFF,0x34,0x00,0xFF,0x31,0x00,0xFF,0x2D,0x00,0xFF,0x2A,0x00,0xFF,0x27,0x00,0xFF,0x24,0x00,0xFF,0x21,0x00,0xFF,0x1E,0x00,0xFF,0x1B,0x00,0xFF,0x19,0x00,0xFF,0x17,0x01,0xFF,0x14,0x02,0xFF,0x13,0x04,0xFF,0x11,0x06,0xFF,0x0F,0x07,0xFF,0x0E,0x0A,0xFF,0x0C,0x0C,0xFF,0x0B,0x0E,0xFF,0x0A,0x10,0xFF,0x09,0x13,0xFF,0x08,0x16,0xFF,0x07,0x18,0xFF,0x06,0x1B,0xFF,0x06,0x1E,0xFF,0x05,0x21,0xFF,0x04,0x24,0xFF,0x04,0x27,0xFF,0x04,0x2A,0xFF,0x03,0x2D,0xFF,0x03,0x30,0xFF,0x03,0x34,0xFF,0x02,0x37,0xFF,0x02,0x3A,0xFF,0x02,0x3D,0xFF,0x02,0x41,0xFF,0x02,0x44,0xFF,0x01,0x47,0xFF,0x01,0x4A,0xFF,0x01,0x4E,0xFF,0x01,0x51,0xFF,0x00,0x54,0xFF,0x00,0x56,0xFF,0x00,0x58,0xFF,0x00,0x5A,0xFF,0x00,0x5C,0xFF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x73,0x00,0xFF,0x72,0x00,0xFF,0x71,0x00,0xFF,0x70,0x00,0xFF,0x6F,0x00,0xFF,0x6E,0x00,0xFF,0x6D,0x00,0xFF,0x6C,0x00,0xFF,0x6B,0x00,0xFF,0x6A,0x00,0xFF,0x6A,0x00,0xFF,0x69,0x00,0xFF,0x68,0x00,0xFF,0x68,0x00,0xFF,0x67,0x00,0xFF,0x66,0x00,0xFF,0x66,0x00,0xFF,0x65,0x00,0xFF,0x65,0x00,0xFF,0x64,0x00,0xFF,0x63,0x00,0xFF,0x63,0x00,0xFF,0x62,0x00,0xFF,0x61,0x00,0xFF,0x61,0x00,0xFF,0x60,0x00,0xFF,0x5F,0x00,0xFF,0x5F,0x00,0xFF,0x5E,0x00,0xFF,0x5D,0x00,0xFF,0x5D,0x00,0xFF,0x5C,0x00,0xFF,0x5B,0x00,0xFF,0x5B,0x00,0xFF,0x5A,0x00,0xFF,0x59,0x00,0xFF,0x59,0x00,0xFF,0x58,0x00,0xFF,0x57,0x00,0xFF,0x57,0x00,0xFF,0x56,0x00,0xFF,0x55,0x00,0xFF,0x54,0x00,0xFF,0x54,0x00,0xFF,0x53,0x00,0xFF,0x52,0x00,0xFF,0x52,0x00,0xFF,0x51,0x00,0xFF,0x50,0x00,0xFF,0x50,0x00,0xFF,0x4F,0x00,0xFF,0x4E,0x00,0xFF,0x4E,0x00,0xFF,0x4D,0x00,0xFF,0x4C,0x00,0xFF,0x4B,0x00,0xFF,0x4B,0x00,0xFF,0x4A,0x00,0xFF,0x49,0x00,0xFF,0x49,0x00,0xFF,0x48,0x00,0xFF,0x47,0x00,0xFF,0x46,0x00,0xFF,0x46,0x00,0xFF,0x45,0x00,0xFF,0x44,0x00,0xFF,0x44,0x00,0xFF,0x43,0x00,0xFF,0x42,0x00,0xFF,0x41,0x00,0xFF,0x41,0x00,0xFF,0x40,0x00,0xFF,0x3F,0x00,0xFF,0x3F,0x00,0xFF,0x3E,0x00,0xFF,0x3D,0x00,0xFF,0x3C,0x00,0xFF,0x3C,0x00,0xFF,0x3B,0x00,0xFF,0x3A,0x00,0xFF,0x3A,0x00,0xFF,0x39,0x00,0xFF,0x38,0x00,0xFF,0x38,0x00,0xFF,0x37,0x00,0xFF,0x36,0x00,0xFF,0x35,0x00,0xFF,0x35,0x00,0xFF,0x34,0x00,0xFF,0x33,0x00,0xFF,0x33,0x00,0xFF,0x32,0x00,0xFF,0x31,0x00,0xFF,0x31,0x00,0xFF,0x30,0x00,0xFF,0x2F,0x00,0xFF,0x2E,0x00,0xFF,0x2E,0x00,0xFF,0x2D,0x00,0xFF,0x2C,0x00,0xFF,0x2C,0x00,0xFF,0x2B,0x00,0xFF,0x2A,0x00,0xFF,0x2A,0x00,0xFF,0x29,0x00,0xFF,0x28,0x00,0xFF,0x28,0x00,0xFF,0x27,0x00,0xFF,0x26,0x00,0xFF,0x26,0x00,0xFF,0x25,0x00,0xFF,0x24,0x00,0xFF,0x24,0x00,0xFF,0x23,0x00,0xFF,0x22,0x00,0xFF,0x22,0x00,0xFF,0x21,0x00,0xFF,0x21,0x00,0xFF,0x20,0x00,0xFF,0x1F,0x00,0xFF,0x1F,0x00,0xFF,0x1E,0x00,0xFF,0x1D,0x00,0xFF,0x1D,0x00,0xFF,0x1C,0x00,0xFF,0x1C,0x00,0xFF,0x1B,0x00,0xFF,0x1A,0x00,0xFF,0x1A,0x00,0xFF,0x19,0x00,0xFF,0x19,0x00,0xFF,0x18,0x00,0xFF,0x17,0x00,0xFF,0x17,0x00,0xFF,0x16,0x00,0xFF,0x16,0x00,0xFF,0x15,0x00,0xFF,0x14,0x00,0xFF,0x14,0x00,0xFF,0x13,0x00,0xFF,0x13,0x00,0xFF,0x12,0x00,0xFF,0x12,0x00,0xFF,0x11,0x00,0xFF,0x11,0x00,0xFF,0x10,0x00,0xFF,0x10,0x00,0xFF,0x0F,0x00,0xFF,0x0F,0x00,0xFF,0x0E,0x00,0xFF,0x0E,0x00,0xFF,0x0D,0x00,0xFF,0x0D,0x00,0xFF,0x0C,0x00,0xFF,0x0C,0x00,0xFF,0x0B,0x00,0xFF,0x0B,0x00,0xFF,0x0A,0x00,0xFF,0x0A,0x00,0xFF,0x09,0x00,0xFF,0x09,0x00,0xFF,0x08,0x00,0xFF,0x08,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x06,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x05,0x00,0xFF,0x05,0x00,0xFF,0x04,0x00,0xFF,0x04,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x02,0x00,0xFF,0x02,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x00,0x00}; -static char plasma_data[] = {0x00,0x00,0x00,0x03,0x00,0x00,0x05,0x00,0x00,0x09,0x00,0x00,0x0E,0x00,0x00,0x12,0x00,0x00,0x17,0x00,0x00,0x1C,0x00,0x00,0x22,0x00,0x00,0x27,0x00,0x00,0x2C,0x00,0x00,0x32,0x00,0x00,0x37,0x00,0x00,0x3C,0x00,0x00,0x41,0x00,0x00,0x45,0x00,0x00,0x4A,0x00,0x00,0x4D,0x00,0x00,0x51,0x00,0x00,0x53,0x00,0x00,0x55,0x00,0x00,0x55,0x00,0x02,0x55,0x02,0x03,0x55,0x03,0x06,0x55,0x03,0x07,0x55,0x05,0x09,0x55,0x06,0x0C,0x55,0x06,0x0F,0x55,0x07,0x10,0x55,0x09,0x13,0x55,0x0A,0x16,0x55,0x0C,0x1A,0x55,0x0C,0x1D,0x54,0x0E,0x20,0x53,0x10,0x23,0x54,0x11,0x26,0x53,0x13,0x2A,0x52,0x14,0x2E,0x51,0x15,0x31,0x50,0x17,0x35,0x50,0x19,0x38,0x4E,0x1A,0x3D,0x4D,0x1C,0x40,0x4D,0x1D,0x44,0x4C,0x1F,0x47,0x4B,0x21,0x4C,0x4A,0x23,0x4F,0x49,0x24,0x54,0x48,0x25,0x57,0x47,0x28,0x5B,0x46,0x29,0x5F,0x45,0x2B,0x62,0x44,0x2D,0x66,0x44,0x2E,0x6A,0x43,0x30,0x6E,0x42,0x32,0x72,0x41,0x33,0x76,0x40,0x35,0x79,0x3F,0x38,0x7C,0x3F,0x39,0x7F,0x3E,0x3B,0x83,0x3D,0x3D,0x86,0x3C,0x3F,0x8A,0x3B,0x40,0x8C,0x3B,0x43,0x8F,0x3B,0x44,0x92,0x3A,0x46,0x95,0x39,0x48,0x98,0x39,0x4A,0x9B,0x39,0x4C,0x9C,0x39,0x4E,0x9F,0x3A,0x4F,0xA1,0x39,0x51,0xA3,0x39,0x52,0xA4,0x39,0x54,0xA6,0x39,0x56,0xA7,0x39,0x57,0xA8,0x39,0x58,0xA8,0x3A,0x5A,0xA9,0x3A,0x5C,0xA8,0x3A,0x5D,0xA8,0x3B,0x5F,0xA8,0x3C,0x61,0xA8,0x3D,0x62,0xA8,0x3D,0x64,0xA9,0x3E,0x66,0xA8,0x3E,0x67,0xA9,0x3F,0x68,0xA8,0x40,0x6A,0xA8,0x41,0x6C,0xA8,0x42,0x6E,0xA8,0x42,0x70,0xA8,0x43,0x71,0xA8,0x44,0x73,0xA8,0x45,0x74,0xA9,0x46,0x76,0xA8,0x48,0x79,0xA8,0x49,0x7A,0xA7,0x4A,0x7C,0xA6,0x4A,0x7D,0xA5,0x4C,0x7F,0xA4,0x4D,0x81,0xA3,0x4E,0x83,0xA2,0x4E,0x85,0xA1,0x50,0x86,0xA0,0x51,0x88,0x9F,0x52,0x8A,0x9D,0x53,0x8B,0x9D,0x55,0x8D,0x9B,0x56,0x8F,0x9A,0x57,0x91,0x98,0x58,0x92,0x98,0x5A,0x94,0x97,0x5B,0x96,0x95,0x5C,0x97,0x94,0x5E,0x99,0x93,0x5F,0x9A,0x91,0x60,0x9C,0x90,0x61,0x9D,0x90,0x62,0x9F,0x8E,0x64,0xA1,0x8D,0x65,0xA2,0x8C,0x67,0xA3,0x8B,0x68,0xA5,0x8A,0x6A,0xA6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xC2,0xC2,0xC4,0xC3,0xC4,0xC4,0xC3,0xC4,0xC4,0xC4}; -static char hflm_data[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x04, 0x02, 0x01, 0x04, 0x02, 0x03, 0x05, 0x03, 0x03, 0x07, 0x04, 0x04, 0x08, 0x04, 0x03, 0x09, 0x04, 0x04, 0x0B, 0x05, 0x04, 0x0C, 0x05, 0x05, 0x0D, 0x06, 0x05, 0x0E, 0x07, 0x06, 0x10, 0x07, 0x07, 0x11, 0x08, 0x07, 0x12, 0x09, 0x08, 0x14, 0x09, 0x08, 0x15, 0x0A, 0x09, 0x17, 0x0A, 0x09, 0x19, 0x0B, 0x0A, 0x1A, 0x0C, 0x0A, 0x1C, 0x0D, 0x0B, 0x1D, 0x0D, 0x0B, 0x1F, 0x0D, 0x0C, 0x22, 0x0F, 0x0D, 0x23, 0x0F, 0x0E, 0x25, 0x10, 0x0E, 0x26, 0x11, 0x0F, 0x28, 0x12, 0x10, 0x2A, 0x13, 0x10, 0x2C, 0x13, 0x11, 0x2E, 0x14, 0x12, 0x2F, 0x15, 0x12, 0x31, 0x15, 0x13, 0x33, 0x16, 0x14, 0x35, 0x17, 0x15, 0x36, 0x18, 0x15, 0x39, 0x19, 0x16, 0x3B, 0x19, 0x17, 0x3D, 0x1B, 0x17, 0x3E, 0x1B, 0x18, 0x40, 0x1C, 0x19, 0x42, 0x1D, 0x1A, 0x43, 0x1D, 0x1B, 0x45, 0x1E, 0x1C, 0x47, 0x1F, 0x1C, 0x49, 0x20, 0x1D, 0x4B, 0x21, 0x1F, 0x4C, 0x21, 0x1F, 0x4E, 0x22, 0x20, 0x50, 0x23, 0x21, 0x52, 0x23, 0x22, 0x53, 0x24, 0x23, 0x55, 0x25, 0x23, 0x56, 0x26, 0x24, 0x59, 0x26, 0x25, 0x5A, 0x27, 0x26, 0x5B, 0x28, 0x27, 0x5D, 0x28, 0x28, 0x5E, 0x29, 0x29, 0x60, 0x29, 0x2A, 0x62, 0x2A, 0x2B, 0x63, 0x2B, 0x2C, 0x64, 0x2C, 0x2E, 0x65, 0x2C, 0x2E, 0x66, 0x2C, 0x2F, 0x68, 0x2D, 0x31, 0x69, 0x2E, 0x32, 0x6A, 0x2F, 0x32, 0x6B, 0x2F, 0x34, 0x6C, 0x30, 0x34, 0x6D, 0x30, 0x35, 0x6F, 0x31, 0x37, 0x70, 0x31, 0x38, 0x71, 0x32, 0x39, 0x72, 0x33, 0x3B, 0x73, 0x33, 0x3C, 0x74, 0x34, 0x3D, 0x75, 0x35, 0x3E, 0x76, 0x35, 0x3F, 0x78, 0x36, 0x41, 0x78, 0x36, 0x42, 0x79, 0x36, 0x43, 0x7A, 0x37, 0x44, 0x7B, 0x37, 0x46, 0x7C, 0x38, 0x48, 0x7D, 0x39, 0x48, 0x7E, 0x3A, 0x49, 0x7F, 0x39, 0x4B, 0x80, 0x3A, 0x4C, 0x81, 0x3B, 0x4E, 0x82, 0x3C, 0x4F, 0x83, 0x3C, 0x51, 0x84, 0x3C, 0x52, 0x84, 0x3D, 0x54, 0x86, 0x3E, 0x55, 0x87, 0x3E, 0x56, 0x88, 0x3F, 0x57, 0x89, 0x40, 0x59, 0x8A, 0x40, 0x5A, 0x8A, 0x41, 0x5C, 0x8B, 0x41, 0x5D, 0x8C, 0x42, 0x5F, 0x8D, 0x41, 0x60, 0x8E, 0x42, 0x62, 0x8E, 0x42, 0x62, 0x8F, 0x44, 0x65, 0x90, 0x43, 0x65, 0x91, 0x45, 0x67, 0x91, 0x44, 0x69, 0x92, 0x45, 0x6A, 0x93, 0x46, 0x6B, 0x94, 0x46, 0x6C, 0x94, 0x46, 0x6E, 0x96, 0x47, 0x70, 0x96, 0x48, 0x70, 0x97, 0x48, 0x72, 0x98, 0x48, 0x73, 0x99, 0x49, 0x74, 0x99, 0x49, 0x76, 0x9A, 0x4A, 0x77, 0x9A, 0x4B, 0x78, 0x9B, 0x4B, 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B7,0xCC,0xA0,0xAD,0xCD,0x9C,0x9B,0xCF,0x9D,0x93}; -#endif \ No newline at end of file diff --git a/http.h b/http.h deleted file mode 100755 index 2ad7ccc..0000000 --- a/http.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Powder Toy - HTTP Library (Header) - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef HTTP_H -#define HTTP_H - -void http_init(char *proxy); -void http_done(void); - -char *http_simple_get(char *uri, int *ret, int *len); -char *http_auth_get(char *uri, char *user, char *pass, int *ret, int *len); -char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len); - -void http_auth_headers(void *ctx, char *user, char *pass); - -void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep); -void http_async_add_header(void *ctx, char *name, char *data); -int http_async_req_status(void *ctx); -void http_async_get_length(void *ctx, int *total, int *done); -char *http_async_req_stop(void *ctx, int *ret, int *len); -void http_async_req_close(void *ctx); - -char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, int *ret, int *len); - -char *http_ret_text(int ret); - -#endif diff --git a/icon.h b/icon.h deleted file mode 100755 index 89b2c7f..0000000 --- a/icon.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Powder Toy - Main source - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * Copyright (c) 2010 Simon Robertshaw - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -static unsigned char app_icon[] = { 0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF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,0x00,0x00,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF,0x8F,0x92,0x97,0xFF }; -static unsigned char app_icon_w32[] = { 0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x44,0x47,0x49,0x00,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x44,0x46,0x48,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x86,0x88,0x8A,0xFF,0xD8,0xDE,0xE6,0xFF,0xD1,0xD7,0xDF,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x68,0x79,0x91,0xFF,0xD1,0xD7,0xDE,0xFF,0x81,0x84,0x88,0xFF,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x83,0x85,0x89,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1E,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x14,0x00,0x00,0xFF,0xE1,0x01,0x00,0xFF,0xF4,0x03,0x00,0xFF,0x24,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x86,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x0F,0x00,0x00,0xFF,0x05,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x36,0x01,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x00,0x00,0xFF,0xE7,0x0A,0x01,0xFF,0xFF,0x07,0x01,0xFF,0x41,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x00,0x00,0xFF,0x16,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x0B,0x00,0x00,0xFF,0x55,0x02,0x00,0xFF,0x04,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x39,0x00,0x00,0xFF,0xF8,0x1B,0x02,0xFF,0xFF,0x2F,0x03,0xFF,0x52,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1C,0x00,0x00,0xFF,0x5C,0x01,0x00,0xFF,0x09,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x36,0x01,0x00,0xFF,0xAE,0x04,0x01,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x50,0x00,0x00,0xFF,0xFE,0x44,0x02,0xFF,0xFF,0x5C,0x03,0xFF,0x60,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x12,0x00,0x00,0xFF,0x9F,0x02,0x00,0xFF,0x49,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x73,0x04,0x00,0xFF,0xEC,0x09,0x01,0xFF,0x2B,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x13,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x04,0x00,0x00,0xFF,0x04,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x4E,0x06,0x00,0xFF,0xFF,0xC1,0x08,0xFF,0xFD,0x9A,0x07,0xFF,0x49,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x7F,0x81,0x85,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8B,0x01,0x00,0xFF,0xD5,0x03,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0xB7,0x0D,0x01,0xFF,0xFF,0x0F,0x02,0xFF,0xDE,0x00,0x00,0xFF,0xAB,0x00,0x00,0xFF,0xA5,0x01,0x00,0xFF,0x3D,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x8B,0x35,0x03,0xFF,0xFF,0xF0,0x0E,0xFF,0xDF,0x4B,0x01,0xFF,0x14,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x55,0x00,0x00,0xFF,0xFF,0x05,0x01,0xFF,0x73,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1B,0x00,0x00,0xFF,0xE5,0x0F,0x01,0xFF,0xFF,0x0D,0x02,0xFF,0xFF,0x04,0x01,0xFF,0xFF,0x03,0x00,0xFF,0xFF,0x01,0x00,0xFF,0x8F,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1B,0x00,0x00,0xFF,0xD9,0x47,0x03,0xFF,0xFF,0x92,0x06,0xFF,0xAF,0x12,0x00,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x20,0x00,0x00,0xFF,0xE5,0x08,0x01,0xFF,0xD1,0x04,0x01,0xFF,0x0E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x30,0x01,0x00,0xFF,0xF6,0x47,0x04,0xFF,0xFF,0x1F,0x02,0xFF,0xFF,0x03,0x01,0xFF,0xFF,0x06,0x01,0xFF,0xFF,0x03,0x00,0xFF,0xC7,0x01,0x00,0xFF,0x1F,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x06,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x38,0x02,0x00,0xFF,0xFB,0x72,0x07,0xFF,0xFF,0x5A,0x03,0xFF,0x73,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xA1,0x02,0x00,0xFF,0xFF,0x0C,0x03,0xFF,0x7B,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3B,0x06,0x00,0xFF,0xFF,0xBB,0x0C,0xFF,0xFF,0x56,0x04,0xFF,0xFF,0x00,0x01,0xFF,0xFF,0x10,0x03,0xFF,0xFF,0x02,0x01,0xFF,0xDE,0x01,0x00,0xFF,0x34,0x00,0x00,0xFF,0x03,0x00,0x00,0xFF,0x05,0x01,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3B,0x03,0x00,0xFF,0xFC,0x83,0x06,0xFF,0xFF,0x71,0x03,0xFF,0x83,0x05,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFB,0x18,0x03,0xFF,0xFF,0x0E,0x02,0xFF,0xB9,0x00,0x00,0xFF,0x06,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x21,0x01,0x00,0xFF,0xE8,0xB9,0x0F,0xFF,0xFF,0x8F,0x0C,0xFF,0xFF,0x02,0x00,0xFF,0xFF,0x3C,0x04,0xFF,0xFF,0x16,0x02,0xFF,0xFD,0x00,0x00,0xFF,0x63,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x40,0x0B,0x00,0xFF,0xFE,0xAD,0x06,0xFF,0xFF,0xC9,0x06,0xFF,0xCC,0x45,0x02,0xFF,0x08,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x49,0x03,0xFF,0xFF,0x7E,0x03,0xFF,0xFF,0x45,0x01,0xFF,0x67,0x05,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x09,0x00,0x00,0xFF,0xCC,0xA0,0x08,0xFF,0xFB,0xAA,0x0A,0xFF,0xC9,0x00,0x00,0xFF,0xFE,0x6B,0x03,0xFF,0xFF,0x79,0x02,0xFF,0xF9,0x0A,0x00,0xFF,0x4C,0x00,0x00,0xFF,0x02,0x00,0x00,0xFF,0x08,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x3F,0x14,0x00,0xFF,0xFC,0xDF,0x10,0xFF,0xFF,0xFF,0x10,0xFF,0xFA,0xCD,0x14,0xFF,0x46,0x0C,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x7F,0x03,0xFF,0xFF,0xFF,0x06,0xFF,0xFF,0xE7,0x03,0xFF,0xD5,0x39,0x01,0xFF,0x0E,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x1A,0x06,0x00,0xFF,0xEA,0xCF,0x17,0xFF,0xE2,0xA6,0x10,0xFF,0x32,0x00,0x00,0xFF,0xCB,0x80,0x06,0xFF,0xFF,0xF4,0x09,0xFF,0xD8,0x44,0x00,0xFF,0x10,0x00,0x00,0xFF,0x01,0x00,0x00,0xFF,0x07,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x44,0x21,0x00,0xFF,0xFD,0xE9,0x1C,0xFF,0xFF,0xD6,0x09,0xFF,0xFF,0xFF,0x28,0xFF,0xB4,0x75,0x04,0xFF,0x01,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0xFF,0x8D,0x03,0xFF,0xFF,0xFF,0x41,0xFF,0xFF,0xFF,0x3F,0xFF,0xFF,0x7E,0x01,0xFF,0x4C,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x49,0x30,0x04,0xFF,0xFF,0xFC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0xFF,0xFF,0xFF,0xFF,0xFF,0x8F,0x74,0x38,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x24,0x14,0x03,0xFF,0x8C,0x7E,0x44,0xFF,0xA2,0x8E,0x5D,0xFF,0x5B,0x37,0x17,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x71,0x46,0x1E,0xFF,0xCB,0xA4,0x71,0xFF,0xAC,0x93,0x66,0xFF,0x17,0x0E,0x04,0xFF,0x00,0x00,0x00,0xFF,0x30,0x23,0x0A,0xFF,0xBF,0xA4,0x60,0xFF,0xC4,0xAC,0x78,0xFF,0x43,0x34,0x1A,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x5C,0x3D,0x18,0xFF,0xC9,0xA9,0x6F,0xFF,0xB8,0x94,0x63,0xFF,0x2A,0x19,0x07,0xFF,0x00,0x00,0x00,0xFF,0x53,0x3B,0x16,0xFF,0xC7,0xB6,0x70,0xFF,0xBD,0xA2,0x66,0xFF,0x2C,0x1C,0x09,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x47,0x14,0x14,0xFF,0x47,0x14,0x14,0xFF,0x00,0x00,0x00,0xFF,0x1F,0x30,0xD6,0xFF,0x1F,0x30,0xD6,0xFF,0x00,0x00,0x00,0xFF,0xF7,0x0F,0x00,0xFF,0xF7,0x0F,0x00,0xFF,0x00,0x00,0x00,0xFF,0xC8,0x47,0x0E,0xFF,0xC8,0x47,0x0E,0xFF,0x00,0x00,0x00,0xFF,0x20,0xE6,0x0F,0xFF,0x20,0xE6,0x0F,0xFF,0x00,0x00,0x00,0xFF,0xEB,0xF5,0x22,0xFF,0xEB,0xF5,0x22,0xFF,0x00,0x00,0x00,0xFF,0x40,0x40,0x40,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0x79,0x79,0x79,0xFF,0x79,0x79,0x79,0xFF,0x00,0x00,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0xD7,0xF1,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x81,0x84,0x88,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0xFF,0x81,0x84,0x88,0xFF,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x44,0x46,0x48,0x00,0x7A,0x7D,0x81,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x83,0x86,0x8A,0xFF,0x86,0x89,0x8C,0xFF,0x89,0x8C,0x8F,0xFF,0x87,0x8A,0x8F,0xFF,0x85,0x87,0x8B,0xFF,0x82,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x81,0x84,0x88,0xFF,0x44,0x46,0x48,0x00,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x04,0x03,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00,0x03,0x05,0x04,0x00 }; \ No newline at end of file diff --git a/interface.c b/interface.c deleted file mode 100644 index 27232c9..0000000 --- a/interface.c +++ /dev/null @@ -1,2961 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "http.h" -#include "md5.h" -#include "font.h" -#include "defines.h" -#include "powder.h" -#include "interface.h" -#include "misc.h" - -SDLMod sdl_mod; -int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0; - -char *shift_0="`1234567890-=[]\\;',./"; -char *shift_1="~!@#$%^&*()_+{}|:\"<>?"; - -int svf_login = 0; -int svf_admin = 0; -int svf_mod = 0; -char svf_user[64] = ""; -char svf_pass[64] = ""; - -int svf_open = 0; -int svf_own = 0; -int svf_myvote = 0; -int svf_publish = 0; -char svf_id[16] = ""; -char svf_name[64] = ""; -char svf_tags[256] = ""; -void *svf_last = NULL; -int svf_lsize; - -char *search_ids[GRID_X*GRID_Y]; -char *search_dates[GRID_X*GRID_Y]; -int search_votes[GRID_X*GRID_Y]; -int search_publish[GRID_X*GRID_Y]; -int search_scoredown[GRID_X*GRID_Y]; -int search_scoreup[GRID_X*GRID_Y]; -char *search_names[GRID_X*GRID_Y]; -char *search_owners[GRID_X*GRID_Y]; -void *search_thumbs[GRID_X*GRID_Y]; -int search_thsizes[GRID_X*GRID_Y]; - -int search_own = 0; -int search_date = 0; -int search_page = 0; -char search_expr[256] = ""; - -char *tag_names[TAG_MAX]; -int tag_votes[TAG_MAX]; - -int Z_keysym = 'z'; - -int zoom_en = 0; -int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; -int zoom_wx=0, zoom_wy=0; -unsigned char ZFACTOR = 256/ZSIZE_D; -unsigned char ZSIZE = ZSIZE_D; - -void menu_count(void) -{ - int i=0; - msections[SC_WALL].itemcount = UI_WALLCOUNT-4; - msections[SC_SPECIAL].itemcount = 4; - for(i=0; i 18) ? signs[i].y - 18 : signs[i].y + 4; -} - -void add_sign_ui(pixel *vid_buf, int mx, int my) -{ - int i, w, h, x, y, nm=0, ju; - int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq; - ui_edit ed; - - // check if it is an existing sign - for(i=0; i=x && mx<=x+w && my>=y && my<=y+h) - break; - } - // else look for empty spot - if(i >= MAXSIGNS) - { - nm = 1; - for(i=0; i= MAXSIGNS) - return; - - if(nm) - { - signs[i].x = mx; - signs[i].y = my; - signs[i].ju = 1; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = x0+25; - ed.y = y0+25; - ed.w = 158; - ed.nx = 1; - ed.def = "[message]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(signs[i].text); - strcpy(ed.str, signs[i].text); - ju = signs[i].ju; - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 80); - drawtext(vid_buf, x0+8, y0+8, nm ? "New sign:" : "Edit sign:", 255, 255, 255, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA1", 32, 64, 128, 255); - drawtext(vid_buf, x0+12, y0+23, "\xA0", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); - ui_edit_draw(vid_buf, &ed); - drawtext(vid_buf, x0+8, y0+46, "Justify:", 255, 255, 255, 255); - draw_icon(vid_buf, x0+50, y0+42, 0x9D, ju == 0); - draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1); - draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2); - - if(!nm) - { - drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255); - drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255); - drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255); - } - - drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(b && !bq && mx>=x0+50 && mx<=x0+67 && my>=y0+42 && my<=y0+59) - ju = 0; - if(b && !bq && mx>=x0+68 && mx<=x0+85 && my>=y0+42 && my<=y0+59) - ju = 1; - if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59) - ju = 2; - - if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(!nm && b && !bq && mx>=x0+134 && my>=y0+42 && mx<=x0+184 && my<=y0+59) - { - signs[i].text[0] = 0; - return; - } - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - { - if(!ed.focus) - return; - ed.focus = 0; - } - } - - strcpy(signs[i].text, ed.str); - signs[i].ju = ju; -} - -void ui_edit_draw(pixel *vid_buf, ui_edit *ed) -{ - int cx, i; - char echo[256], *str; - - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(ed->str[0]) - { - drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); - drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); - } - else if(!ed->focus) - drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); - if(ed->focus) - { - cx = textnwidth(str, ed->cursor); - for(i=-3; i<9; i++) - drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); - } -} - -void ui_edit_process(int mx, int my, int mb, ui_edit *ed) -{ - char ch, ts[2], echo[256], *str; - int l, i; -#ifdef RAWINPUT - char *p; -#endif - - if(mb) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = 0; - ed->str[0] = 0; - } - else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = textwidthx(str, mx-ed->x); - } - else - ed->focus = 0; - } - if(ed->focus && sdl_key) - { - if(ed->hide) - { - for(i=0; ed->str[i]; i++) - echo[i] = 0x8D; - echo[i] = 0; - str = echo; - } - else - str = ed->str; - - l = strlen(ed->str); - switch(sdl_key) - { - case SDLK_HOME: - ed->cursor = 0; - break; - case SDLK_END: - ed->cursor = l; - break; - case SDLK_LEFT: - if(ed->cursor > 0) - ed->cursor --; - break; - case SDLK_RIGHT: - if(ed->cursor < l) - ed->cursor ++; - break; - case SDLK_DELETE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - ed->str[ed->cursor] = 0; - else if(ed->cursor < l) - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - break; - case SDLK_BACKSPACE: - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - { - if(ed->cursor > 0) - memmove(ed->str, ed->str+ed->cursor, l-ed->cursor+1); - ed->cursor = 0; - } - else if(ed->cursor > 0) - { - ed->cursor--; - memmove(ed->str+ed->cursor, ed->str+ed->cursor+1, l-ed->cursor); - } - break; - default: -#ifdef RAWINPUT - if(sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255) - { - ch = sdl_key; - if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT|KMOD_CAPS))) - { - if(ch>='a' && ch<='z') - ch &= ~0x20; - p = strchr(shift_0, ch); - if(p) - ch = shift_1[p-shift_0]; - } - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#else - if(sdl_ascii>=' ' && sdl_ascii<127) - { - ch = sdl_ascii; - ts[0]=ed->hide?0x8D:ch; - ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) - break; - memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); - ed->str[ed->cursor] = ch; - ed->cursor++; - } -#endif - break; - } - } -} - -void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed) -{ - int w = 12; - if(ed->checked) - { - drawtext(vid_buf, ed->x+2, ed->y+2, "\xCF", 128, 128, 128, 255); - } - if(ed->focus) - { - drawrect(vid_buf, ed->x, ed->y, w, w, 255, 255, 255, 255); - } - else - { - drawrect(vid_buf, ed->x, ed->y, w, w, 128, 128, 128, 255); - } -} - -void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed) -{ - int w = 12; - - if(mb && !mbq) - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->checked = (ed->checked)?0:1; - } - } - else - { - if(mx>=ed->x && mx<=ed->x+w && my>=ed->y && my<=ed->y+w) - { - ed->focus = 1; - } - else - { - ed->focus = 0; - } - } -} - -void draw_svf_ui(pixel *vid_buf) -{ - int c; - - drawtext(vid_buf, 4, YRES+(MENUSIZE-14), "\x81", 255, 255, 255, 255); - drawrect(vid_buf, 1, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - c = svf_open ? 255 : 128; - drawtext(vid_buf, 23, YRES+(MENUSIZE-14), "\x91", c, c, c, 255); - drawrect(vid_buf, 19, YRES+(MENUSIZE-16), 16, 14, c, c, c, 255); - - c = svf_login ? 255 : 128; - drawtext(vid_buf, 40, YRES+(MENUSIZE-14), "\x82", c, c, c, 255); - if(svf_open) - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), svf_name, c, c, c, 255); - else - drawtext(vid_buf, 58, YRES+(MENUSIZE-12), "[untitled simulation]", c, c, c, 255); - drawrect(vid_buf, 37, YRES+(MENUSIZE-16), 150, 14, c, c, c, 255); - if(svf_open && svf_own) - drawdots(vid_buf, 55, YRES+(MENUSIZE-15), 12, c, c, c, 255); - - c = (svf_login && svf_open) ? 255 : 128; - - drawrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - drawrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, c, c, c, 255); - - if(svf_myvote==1 && (svf_login && svf_open)) - { - fillrect(vid_buf, 189, YRES+(MENUSIZE-16), 14, 14, 0, 108, 10, 255); - } - else if(svf_myvote==-1 && (svf_login && svf_open)) - { - fillrect(vid_buf, 203, YRES+(MENUSIZE-16), 14, 14, 108, 10, 0, 255); - } - - drawtext(vid_buf, 192, YRES+(MENUSIZE-12), "\xCB", 0, 187, 18, c); - drawtext(vid_buf, 205, YRES+(MENUSIZE-14), "\xCA", 187, 40, 0, c); - - drawtext(vid_buf, 222, YRES+(MENUSIZE-15), "\x83", c, c, c, 255); - if(svf_tags[0]) - drawtextmax(vid_buf, 240, YRES+(MENUSIZE-12), 154, svf_tags, c, c, c, 255); - else - drawtext(vid_buf, 240, YRES+(MENUSIZE-12), "[no tags set]", c, c, c, 255); - - drawrect(vid_buf, 219, YRES+(MENUSIZE-16), XRES+BARSIZE-380, 14, c, c, c, 255); - - drawtext(vid_buf, XRES-139+BARSIZE/*371*/, YRES+(MENUSIZE-14), "\x92", 255, 255, 255, 255); - drawrect(vid_buf, XRES-143+BARSIZE/*367*/, YRES+(MENUSIZE-16), 16, 14, 255, 255, 255, 255); - - drawtext(vid_buf, XRES-122+BARSIZE/*388*/, YRES+(MENUSIZE-13), "\x84", 255, 255, 255, 255); - if(svf_login) - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), svf_user, 255, 255, 255, 255); - else - drawtext(vid_buf, XRES-104+BARSIZE/*406*/, YRES+(MENUSIZE-12), "[sign in]", 255, 255, 255, 255); - drawrect(vid_buf, XRES-125+BARSIZE/*385*/, YRES+(MENUSIZE-16), 91, 14, 255, 255, 255, 255); - - if(sys_pause) - { - fillrect(vid_buf, XRES-17+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES-14+BARSIZE/*496*/, YRES+(MENUSIZE-14), "\x90", 255, 255, 255, 255); - drawrect(vid_buf, XRES-16+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - if(!legacy_enable) - { - fillrect(vid_buf, XRES-160+BARSIZE/*493*/, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255); - } - else - { - drawtext(vid_buf, XRES-154+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - } - - switch(cmode) - { - case 0: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255); - break; - case 1: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255); - break; - case 2: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255); - break; - case 3: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255); - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255); - break; - case 4: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255); - break; - case 5: - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255); - drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255); - break; - case 6: - drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255); - break; - } - drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255); - - if(svf_admin) - { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 232, 127, 35, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC8", 255, 255, 255, 255); - } - else if(svf_mod) - { - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC9", 35, 127, 232, 255); - drawtext(vid_buf, XRES-45+BARSIZE/*463*/, YRES+(MENUSIZE-14), "\xC7", 255, 255, 255, 255); - }//else if(amd) - // drawtext(vid_buf, XRES-45/*465*/, YRES+(MENUSIZE-15), "\x97", 0, 230, 153, 255); Why is this here? -} - -void error_ui(pixel *vid_buf, int err, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - char *msg; - - msg = malloc(strlen(txt)+16); - if(err) - sprintf(msg, "%03d %s", err, txt); - else - sprintf(msg, "%s", txt); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - if(err) - drawtext(vid_buf, x0+8, y0+8, "HTTP error:", 255, 64, 32, 255); - else - drawtext(vid_buf, x0+8, y0+8, "Error:", 255, 64, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Dismiss", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - free(msg); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_ui(pixel *vid_buf, char *top, char *txt) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 160, 160, 255, 255); - drawtext(vid_buf, x0+8, y0+26, txt, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "OK", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - break; - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } -} - -void info_box(pixel *vid_buf, char *msg) -{ - int w = textwidth(msg)+16; - int x0=(XRES-w)/2,y0=(YRES-24)/2; - - clearrect(vid_buf, x0-2, y0-2, w+4, 28); - drawrect(vid_buf, x0, y0, w, 24, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, msg, 192, 192, 240, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); -} - -int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn) -{ - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2,b=1,bq,mx,my; - int ret = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, top, 255, 216, 32, 255); - drawtext(vid_buf, x0+8, y0+26, msg, 255, 255, 255, 255); - drawtext(vid_buf, x0+5, y0+49, "Cancel", 255, 255, 255, 255); - drawtext(vid_buf, x0+165, y0+49, btn, 255, 216, 32, 255); - drawrect(vid_buf, x0, y0+44, 160, 16, 192, 192, 192, 255); - drawrect(vid_buf, x0+160, y0+44, 80, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - if(b && !bq && mx>=x0+160 && mx=y0+44 && my<=y0+60) - { - ret = 1; - break; - } - if(b && !bq && mx>=x0 && mx=y0+44 && my<=y0+60) - break; - - if(sdl_key==SDLK_RETURN) - { - ret = 1; - break; - } - if(sdl_key==SDLK_ESCAPE) - break; - } - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - return ret; -} - -void login_ui(pixel *vid_buf) -{ - int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq,mx,my,err; - ui_edit ed1,ed2; - char *res; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed1.x = x0+25; - ed1.y = y0+25; - ed1.w = 158; - ed1.nx = 1; - ed1.def = "[user name]"; - ed1.focus = 1; - ed1.hide = 0; - ed1.cursor = strlen(svf_user); - strcpy(ed1.str, svf_user); - ed2.x = x0+25; - ed2.y = y0+45; - ed2.w = 158; - ed2.nx = 1; - ed2.def = "[password]"; - ed2.focus = 0; - ed2.hide = 1; - ed2.cursor = 0; - strcpy(ed2.str, ""); - - fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192); - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 80); - drawtext(vid_buf, x0+8, y0+8, "Server login:", 255, 255, 255, 255); - drawtext(vid_buf, x0+12, y0+23, "\x8B", 32, 64, 128, 255); - drawtext(vid_buf, x0+12, y0+23, "\x8A", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); - drawtext(vid_buf, x0+11, y0+44, "\x8C", 160, 144, 32, 255); - drawtext(vid_buf, x0+11, y0+44, "\x84", 255, 255, 255, 255); - drawrect(vid_buf, x0+8, y0+40, 176, 16, 192, 192, 192, 255); - ui_edit_draw(vid_buf, &ed1); - ui_edit_draw(vid_buf, &ed2); - drawtext(vid_buf, x0+5, y0+69, "Sign in", 255, 255, 255, 255); - drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed1); - ui_edit_process(mx, my, b, &ed2); - - if(b && !bq && mx>=x0+9 && mx=y0+22 && my=x0+9 && mx=y0+42 && my=x0 && mx=y0+64 && my<=y0+80) - break; - - if(sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB) - { - if(!ed1.focus) - break; - ed1.focus = 0; - ed2.focus = 1; - } - if(sdl_key==SDLK_ESCAPE) - { - if(!ed1.focus && !ed2.focus) - return; - ed1.focus = 0; - ed2.focus = 0; - } - } - - strcpy(svf_user, ed1.str); - md5_ascii(svf_pass, (unsigned char *)ed2.str, 0); - - res = http_multipart_post( - "http://" SERVER "/Login.api", - NULL, NULL, NULL, - svf_user, svf_pass, - &err, NULL); - if(err != 200) - { - error_ui(vid_buf, err, http_ret_text(err)); - if(res) - free(res); - goto fail; - } - if(res && !strncmp(res, "OK", 2)) - { - if(!strcmp(res, "OK ADMIN")) - { - svf_admin = 1; - svf_mod = 0; - } - else if(!strcmp(res, "OK MOD")) - { - svf_admin = 0; - svf_mod = 1; - } - else - { - svf_admin = 0; - svf_mod = 0; - } - free(res); - svf_login = 1; - return; - } - if(!res) - res = mystrdup("Unspecified Error"); - error_ui(vid_buf, 0, res); - free(res); - -fail: - strcpy(svf_user, ""); - strcpy(svf_pass, ""); - svf_login = 0; - svf_own = 0; - svf_admin = 0; - svf_mod = 0; -} - -int stamp_ui(pixel *vid_buf) -{ - int b=1,bq,mx,my,d=-1,i,j,k,x,gx,gy,y,w,h,r=-1,stamp_page=0,per_page=STAMP_X*STAMP_Y,page_count; - char page_info[64]; - page_count = ceil((float)stamp_count/(float)per_page); - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - while(!sdl_poll()) - { - bq = b; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - clearrect(vid_buf, -1, -1, XRES+1, YRES+MENUSIZE+1); - k = stamp_page*per_page;//0; - r = -1; - d = -1; - for(j=0; j=gx+XRES/GRID_S-4 && mx<(gx+XRES/GRID_S)+6 && my>=gy-6 && my=gx && mx=gy && my=1 && mx<=17 && my>=YRES+MENUSIZE-18 && my0) - { - if(stamp_page) - { - stamp_page --; - } - sdl_wheel = 0; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-18 && my=x0+18 && mx=y-2 && my=x0+d+18 && mx=y-2 && my=x0+d+32 && mx=y-2 && my=x0 && mx<=x0+192 && my>=y0+240 && my=x0+9 && mx=y0+218 && my=x0+9 && mx=y0+22 && my=x0 && mx=y0+74+YRES/4 && my=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=60) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy+height+10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy+height+10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy+height+10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - if(!(mx>=(XRES-BARSIZE-width)-7 && my>=sy-10 && my=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else if(i==SC_SPECIAL) - { - for(n = 122; n<122+UI_WALLCOUNT; n++) - { - if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM) - { - if(x-26<=20) - { - x = XRES-BARSIZE-26; - y += 19; - } - x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5; - if(!bq && mx>=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - else - { - for(n = 0; n=x+32 && mx=y && my< y+15) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - h = n; - } - else if(n==*sl) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255); - } - else if(n==*sr) - { - drawrect(vid_buf, x+30, y-1, 29, 17, 0, 0, 255, 255); - } - } - } - } - - if(h==-1) - { - drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255); - } - else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122)) - { - drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255); - } - else - { - drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255); - } - - if(b==1&&h!=-1) - { - *sl = h; - } - if(b==4&&h!=-1) - { - *sr = h; - } -} - -int sdl_poll(void) -{ - SDL_Event event; - sdl_key=sdl_wheel=sdl_ascii=0; - while(SDL_PollEvent(&event)) - { - switch (event.type) - { - case SDL_KEYDOWN: - sdl_key=event.key.keysym.sym; - sdl_ascii=event.key.keysym.unicode; - if(event.key.keysym.sym == SDLK_CAPSLOCK) - sdl_caps = 1; - if(event.key.keysym.unicode=='z' || event.key.keysym.unicode=='Z') - { - sdl_zoom_trig = 1; - Z_keysym = event.key.keysym.sym; - } - if( event.key.keysym.sym == SDLK_PLUS) - { - sdl_wheel++; - } - if( event.key.keysym.sym == SDLK_MINUS) - { - sdl_wheel--; - } - // 4 - //1 8 2 - if(event.key.keysym.sym == SDLK_RIGHT) - { - player[0] = (int)(player[0])|0x02; //Go right command - } - if(event.key.keysym.sym == SDLK_LEFT) - { - player[0] = (int)(player[0])|0x01; //Go left command - } - if(event.key.keysym.sym == SDLK_DOWN && ((int)(player[0])&0x08)!=0x08) - { - player[0] = (int)(player[0])|0x08; //Go left command - } - if(event.key.keysym.sym == SDLK_UP && ((int)(player[0])&0x04)!=0x04) - { - player[0] = (int)(player[0])|0x04; //Jump command - } - break; - - case SDL_KEYUP: - if(event.key.keysym.sym == SDLK_CAPSLOCK) - sdl_caps = 0; - if(event.key.keysym.sym == Z_keysym) - sdl_zoom_trig = 0; - if(event.key.keysym.sym == SDLK_RIGHT || event.key.keysym.sym == SDLK_LEFT) - { - player[1] = player[0]; //Saving last movement - player[0] = (int)(player[0])&12; //Stop command - } - if(event.key.keysym.sym == SDLK_UP) - { - player[0] = (int)(player[0])&11; - } - if(event.key.keysym.sym == SDLK_DOWN) - { - player[0] = (int)(player[0])&7; - } - break; - case SDL_MOUSEBUTTONDOWN: - if(event.button.button == SDL_BUTTON_WHEELUP) - sdl_wheel++; - if(event.button.button == SDL_BUTTON_WHEELDOWN) - sdl_wheel--; - break; - case SDL_QUIT: - return 1; - } - } - sdl_mod = SDL_GetModState(); - return 0; -} - -void set_cmode(int cm) -{ - cmode = cm; - itc = 51; - if(cmode==4) - { - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - strcpy(itc_msg, "Blob Display"); - } - else if(cmode==5) - { - strcpy(itc_msg, "Heat Display"); - } - else if(cmode==6) - { - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - strcpy(itc_msg, "Fancy Display"); - } - else if(cmode==3) - { - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - strcpy(itc_msg, "Fire Display"); - } - else if(cmode==2) - { - memset(fire_bg, 0, XRES*YRES*PIXELSIZE); - strcpy(itc_msg, "Persistent Display"); - } - else if(cmode==1) - strcpy(itc_msg, "Pressure Display"); - else - strcpy(itc_msg, "Velocity Display"); -} - -char *download_ui(pixel *vid_buf, char *uri, int *len) -{ - int dstate = 0; - void *http = http_async_req_start(NULL, uri, NULL, 0, 0); - int x0=(XRES-240)/2,y0=(YRES-MENUSIZE)/2; - int done, total, i, ret, zlen, ulen; - char str[16], *tmp, *res; - - while(!http_async_req_status(http)) - { - sdl_poll(); - - http_async_get_length(http, &total, &done); - - clearrect(vid_buf, x0-2, y0-2, 244, 64); - drawrect(vid_buf, x0, y0, 240, 60, 192, 192, 192, 255); - drawtext(vid_buf, x0+8, y0+8, "Please wait", 255, 216, 32, 255); - drawtext(vid_buf, x0+8, y0+26, "Downloading update...", 255, 255, 255, 255); - - if(total) - { - i = (236*done)/total; - fillrect(vid_buf, x0+1, y0+45, i+1, 14, 255, 216, 32, 255); - i = (100*done)/total; - sprintf(str, "%d%%", i); - if(i<50) - drawtext(vid_buf, x0+120-textwidth(str)/2, y0+48, str, 192, 192, 192, 255); - else - drawtext(vid_buf, x0+120-textwidth(str)/2, y0+48, str, 0, 0, 0, 255); - } - else - drawtext(vid_buf, x0+120-textwidth("Waiting...")/2, y0+48, "Waiting...", 255, 216, 32, 255); - - drawrect(vid_buf, x0, y0+44, 240, 16, 192, 192, 192, 255); - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - } - - tmp = http_async_req_stop(http, &ret, &zlen); - if(ret!=200) - { - error_ui(vid_buf, ret, http_ret_text(ret)); - if(tmp) - free(tmp); - return NULL; - } - if(!tmp) - { - error_ui(vid_buf, 0, "Server did not return data"); - return NULL; - } - - if(zlen<16) - { - printf("ZLen is not 16!\n"); - goto corrupt; - } - if(tmp[0]!=0x42 || tmp[1]!=0x75 || tmp[2]!=0x54 || tmp[3]!=0x54) - { - printf("Tmperr %d, %d, %d, %d\n", tmp[0], tmp[1], tmp[2], tmp[3]); - goto corrupt; - } - - ulen = (unsigned char)tmp[4]; - ulen |= ((unsigned char)tmp[5])<<8; - ulen |= ((unsigned char)tmp[6])<<16; - ulen |= ((unsigned char)tmp[7])<<24; - - res = (char *)malloc(ulen); - if(!res) - { - printf("No res!\n"); - goto corrupt; - } - dstate = BZ2_bzBuffToBuffDecompress((char *)res, (unsigned *)&ulen, (char *)(tmp+8), zlen-8, 0, 0); - if(dstate) - { - printf("Decompression failure: %d!\n", dstate); - free(res); - goto corrupt; - } - - free(tmp); - if(len) - *len = ulen; - return res; - -corrupt: - error_ui(vid_buf, 0, "Downloaded update is corrupted"); - free(tmp); - return NULL; -} - -int search_ui(pixel *vid_buf) -{ - int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,dap,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; - int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; - int thumb_drawn[GRID_X*GRID_Y]; - pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - float ry; - time_t http_last_use=HTTP_TIMEOUT; - ui_edit ed; - - - void *http = NULL; - int active = 0; - char *last = NULL; - int search = 0; - int lasttime = TIMEOUT; - char *uri; - int status; - char *results; - char *tmp, ts[64]; - - void *img_http[IMGCONNS]; - char *img_id[IMGCONNS]; - void *thumb, *data; - int thlen, dlen; - - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - - memset(img_http, 0, sizeof(img_http)); - memset(img_id, 0, sizeof(img_id)); - - memset(search_ids, 0, sizeof(search_ids)); - memset(search_dates, 0, sizeof(search_dates)); - memset(search_names, 0, sizeof(search_names)); - memset(search_scoreup, 0, sizeof(search_scoreup)); - memset(search_scoredown, 0, sizeof(search_scoredown)); - memset(search_publish, 0, sizeof(search_publish)); - memset(search_owners, 0, sizeof(search_owners)); - memset(search_thumbs, 0, sizeof(search_thumbs)); - memset(search_thsizes, 0, sizeof(search_thsizes)); - - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - - do_open = 0; - - while(!sdl_poll()) - { - b = SDL_GetMouseState(&mx, &my); - if(!b) - break; - } - - ed.x = 65; - ed.y = 13; - ed.w = XRES-200; - ed.nx = 1; - ed.def = "[search terms]"; - ed.focus = 1; - ed.hide = 0; - ed.cursor = strlen(search_expr); - strcpy(ed.str, search_expr); - - sdl_wheel = 0; - - while(!sdl_poll()) - { - uih = 0; - bq = b; - mxq = mx; - myq = my; - b = SDL_GetMouseState(&mx, &my); - mx /= sdl_scale; - my /= sdl_scale; - - if(mx!=mxq || my!=myq || sdl_wheel || b) - mmt = 0; - else if(mmt 9) - { - drawtext(vid_buf, XRES-15, YRES+MENUSIZE-16, "\x95", 255, 255, 255, 255); - drawrect(vid_buf, XRES-18, YRES+MENUSIZE-20, 16, 16, 255, 255, 255, 255); - } - - ui_edit_draw(vid_buf, &ed); - - if((b && !bq && mx>=1 && mx<=17 && my>=YRES+MENUSIZE-20 && my0) - { - if(search_page) - { - search_page --; - lasttime = TIMEOUT; - } - sdl_wheel = 0; - uih = 1; - } - if((b && !bq && mx>=XRES-18 && mx<=XRES-1 && my>=YRES+MENUSIZE-20 && myexp_res) - { - lasttime = TIMEOUT; - search_page ++; - page_count = exp_res; - } - sdl_wheel = 0; - uih = 1; - } - - tp = -1; - if(is_p1) - { - drawtext(vid_buf, (XRES-textwidth("Popular tags:"))/2, 31, "Popular tags:", 255, 192, 64, 255); - for(gj=0; gj<((GRID_Y-GRID_P)*YRES)/(GRID_Y*14); gj++) - for(gi=0; giTAG_MAX || !tag_names[pos]) - break; - if(tag_votes[0]) - i = 127+(128*tag_votes[pos])/tag_votes[0]; - else - i = 192; - w = textwidth(tag_names[pos]); - if(w>XRES/GRID_X-5) - w = XRES/GRID_X-5; - gx = (XRES/GRID_X)*gi; - gy = gj*14 + 46; - if(mx>=gx && mx=gy && my XRES/GRID_X-10) - { - tmp = malloc(strlen(search_names[pos])+4); - strcpy(tmp, search_names[pos]); - j = textwidthx(tmp, XRES/GRID_X-15); - strcpy(tmp+j, "..."); - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(tmp)/2, gy+YRES/GRID_S+7, tmp, 192, 192, 192, 255); - free(tmp); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-textwidth(search_names[pos])/2, gy+YRES/GRID_S+7, search_names[pos], 192, 192, 192, 255); - j = textwidth(search_owners[pos]); - if(mx>=gx+XRES/(GRID_S*2)-j/2 && mx<=gx+XRES/(GRID_S*2)+j/2 && - my>=gy+YRES/GRID_S+18 && my<=gy+YRES/GRID_S+31) - { - st = 1; - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 160, 255); - } - else - drawtext(vid_buf, gx+XRES/(GRID_S*2)-j/2, gy+YRES/GRID_S+20, search_owners[pos], 128, 128, 128, 255); - if(search_thumbs[pos]&&thumb_drawn[pos]==0) - { - render_thumb(search_thumbs[pos], search_thsizes[pos], 1, v_buf, gx, gy, GRID_S); - thumb_drawn[pos] = 1; - } - own = svf_login && (!strcmp(svf_user, search_owners[pos]) || svf_admin || svf_mod); - if(mx>=gx-2 && mx<=gx+XRES/GRID_S+3 && my>=gy-2 && my<=gy+YRES/GRID_S+30) - mp = pos; - if(own) - { - if(mx>=gx+XRES/GRID_S-4 && mx<=gx+XRES/GRID_S+6 && my>=gy-6 && my<=gy+4) - { - mp = -1; - dp = pos; - } - if(!search_dates[pos] && mx>=gx-6 && mx<=gx+4 && my>=gy+YRES/GRID_S-4 && my<=gy+YRES/GRID_S+6) - { - mp = -1; - dap = pos; - } - } - drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, YRES/GRID_S+3, 128, 128, 128, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2, 6, 1+(YRES/GRID_S+3)/2, 0, 107, 10, 255); - fillrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 6, 1+(YRES/GRID_S+3)/2, 107, 10, 0, 255); - - if(mp==pos && !st) - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255); - else - drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255); - if(own) - { - if(dp == pos) - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255); - else - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 160, 48, 32, 255); - drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x85", 255, 255, 255, 255); - } - if(!search_publish[pos]) - { - drawtext(vid_buf, gx-6, gy-6, "\xCD", 255, 255, 255, 255); - drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); - } - if(!search_dates[pos] && own) - { - fillrect(vid_buf, gx-5, gy+YRES/GRID_S-3, 7, 8, 255, 255, 255, 255); - if(dap == pos) { - drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 200, 100, 80, 255); - } else { - drawtext(vid_buf, gx-6, gy+YRES/GRID_S-4, "\xA6", 160, 70, 50, 255); - } - //drawtext(vid_buf, gx-6, gy-6, "\xCE", 212, 151, 81, 255); - } - if(view_own || svf_admin || svf_mod) - { - sprintf(ts+1, "%d", search_votes[pos]); - ts[0] = 0xBB; - for(j=1; ts[j]; j++) - ts[j] = 0xBC; - ts[j-1] = 0xB9; - ts[j] = 0xBA; - ts[j+1] = 0; - w = gx+XRES/GRID_S-2-textwidth(ts); - h = gy+YRES/GRID_S-11; - drawtext(vid_buf, w, h, ts, 16, 72, 16, 255); - for(j=0; ts[j]; j++) - ts[j] -= 14; - drawtext(vid_buf, w, h, ts, 192, 192, 192, 255); - sprintf(ts, "%d", search_votes[pos]); - for(j=0; ts[j]; j++) - ts[j] += 127; - drawtext(vid_buf, w+3, h, ts, 255, 255, 255, 255); - } - if(search_scoreup[pos]>0||search_scoredown[pos]>0) - { - lv = (search_scoreup[pos]>search_scoredown[pos]?search_scoreup[pos]:search_scoredown[pos]); - - if(((YRES/GRID_S+3)/2)>lv) - { - ry = ((float)((YRES/GRID_S+3)/2)/(float)lv); - if(lv<8) - { - ry = ry/(8-lv); - } - nyu = search_scoreup[pos]*ry; - nyd = search_scoredown[pos]*ry; - } - else - { - ry = ((float)lv/(float)((YRES/GRID_S+3)/2)); - nyu = search_scoreup[pos]/ry; - nyd = search_scoredown[pos]/ry; - } - - - fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-1+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 57, 187, 57, 255); - fillrect(vid_buf, gx-1+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2), 4, nyd, 187, 57, 57, 255); - //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)-nyu, 4, nyu, 0, 107, 10, 255); - //drawrect(vid_buf, gx-2+(XRES/GRID_S)+5, gy-2+((YRES/GRID_S+3)/2)+1, 4, nyd, 107, 10, 0, 255); - } - } - - if(mp!=-1 && mmt>=TIMEOUT/5 && !st) - { - gi = mp % GRID_X; - gj = mp / GRID_X; - if(is_p1) - gj += GRID_Y-GRID_P; - gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; - gy = (((YRES+15)/GRID_Y)*gj) + (YRES/GRID_Y-YRES/GRID_S+10)/2 + 18; - i = w = textwidth(search_names[mp]); - h = YRES/GRID_Z+30; - if(w=XRES-2) gx=XRES-3-w; - if(gy<32) gy=32; - if(gy+h>=YRES+(MENUSIZE-2)) gy=YRES+(MENUSIZE-3)-h; - clearrect(vid_buf, gx-2, gy-3, w+4, h); - drawrect(vid_buf, gx-2, gy-3, w+4, h, 160, 160, 192, 255); - if(search_thumbs[mp]) - render_thumb(search_thumbs[mp], search_thsizes[mp], 1, vid_buf, gx+(w-(XRES/GRID_Z))/2, gy, GRID_Z); - drawtext(vid_buf, gx+(w-i)/2, gy+YRES/GRID_Z+4, search_names[mp], 192, 192, 192, 255); - drawtext(vid_buf, gx+(w-textwidth(search_owners[mp]))/2, gy+YRES/GRID_Z+16, search_owners[mp], 128, 128, 128, 255); - } - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); - - ui_edit_process(mx, my, b, &ed); - - if(sdl_key==SDLK_RETURN) - { - if(!last || (!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page))) - lasttime = TIMEOUT; - else if(search_ids[0] && !search_ids[1]) - { - bq = 0; - b = 1; - mp = 0; - } - } - if(sdl_key==SDLK_ESCAPE) - goto finish; - - if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) - { - search_own = !search_own; - lasttime = TIMEOUT; - } - if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) - { - search_date = !search_date; - lasttime = TIMEOUT; - } - - if(b && !bq && dp!=-1) - if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) - { - execute_delete(vid_buf, search_ids[dp]); - lasttime = TIMEOUT; - if(last) - { - free(last); - last = NULL; - } - } - if(b && !bq && dap!=-1) - { - sprintf(ed.str, "history:%s", search_ids[dap]); - lasttime = TIMEOUT; - } - - if(b && !bq && tp!=-1) - { - strncpy(ed.str, tag_names[tp], 255); - lasttime = TIMEOUT; - } - - if(b && !bq && mp!=-1 && st) - { - sprintf(ed.str, "user:%s", search_owners[mp]); - lasttime = TIMEOUT; - } - - if(do_open==1) - { - mp = 0; - } - - if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) - { - fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); - info_box(vid_buf, "Loading..."); - - if(search_dates[mp]) { - uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - strappend(uri, "&Date="); - strcaturl(uri, search_dates[mp]); - } else { - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - } - data = http_simple_get(uri, &status, &dlen); - free(uri); - - if(status == 200) - { - status = parse_save(data, dlen, 1, 0, 0); - switch(status) - { - case 1: - error_ui(vid_buf, 0, "Simulation corrupted"); - break; - case 2: - error_ui(vid_buf, 0, "Simulation from a newer version"); - break; - case 3: - error_ui(vid_buf, 0, "Simulation on a too large grid"); - break; - } - if(!status) - { - char *tnames[] = {"ID", NULL}; - char *tparts[1]; - int tplens[1]; - if(svf_last) - free(svf_last); - svf_last = data; - svf_lsize = dlen; - - tparts[0] = search_ids[mp]; - tplens[0] = strlen(search_ids[mp]); - data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); - - svf_open = 1; - svf_own = svf_login && !strcmp(search_owners[mp], svf_user); - svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); - - strcpy(svf_id, search_ids[mp]); - strcpy(svf_name, search_names[mp]); - if(status == 200) - { - if(data) - { - strncpy(svf_tags, data, 255); - svf_tags[255] = 0; - } - else - svf_tags[0] = 0; - } - else - { - svf_tags[0] = 0; - } - - if(svf_login) - { - char *names[] = {"ID", NULL}; - char *parts[1]; - parts[0] = search_ids[mp]; - data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); - if(status == 200) - { - if(data) - { - if(!strcmp(data, "Up")) - { - svf_myvote = 1; - } - else if(!strcmp(data, "Down")) - { - svf_myvote = -1; - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - } - else - { - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - } - } - else - error_ui(vid_buf, status, http_ret_text(status)); - - if(data) - free(data); - goto finish; - } - - if(!last) - { - search = 1; - } - else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) - { - search = 1; - if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) - { - search_page = 0; - page_count = 0; - } - free(last); - last = NULL; - } - else - search = 0; - - if(search && lasttime>=TIMEOUT) - { - lasttime = 0; - last = mystrdup(ed.str); - last_own = search_own; - last_date = search_date; - last_page = search_page; - active = 1; - uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); - if(search_own || svf_admin || svf_mod) - tmp = "&ShowVotes=true"; - else - tmp = ""; - if(!search_own && !search_date && !*last) - { - if(search_page) - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", (search_page-1)*GRID_X*GRID_Y+GRID_X*GRID_P, exp_res+1, tmp); - } - else - { - exp_res = GRID_X*GRID_P; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d&t=%d%s&Query=", 0, exp_res+1, ((GRID_Y-GRID_P)*YRES)/(GRID_Y*14)*GRID_X, tmp); - } - } - else - { - exp_res = GRID_X*GRID_Y; - sprintf(uri, "http://" SERVER "/Search.api?Start=%d&Count=%d%s&Query=", search_page*GRID_X*GRID_Y, exp_res+1, tmp); - } - strcaturl(uri, last); - if(search_own) - { - strcaturl(uri, " user:"); - strcaturl(uri, svf_user); - } - if(search_date) - strcaturl(uri, " sort:date"); - - http = http_async_req_start(http, uri, NULL, 0, 1); - if(svf_login) - { - http_auth_headers(http, svf_user, svf_pass); - } - http_last_use = time(NULL); - free(uri); - } - - if(active && http_async_req_status(http)) - { - http_last_use = time(NULL); - results = http_async_req_stop(http, &status, NULL); - view_own = last_own; - if(status == 200) - { - page_count = search_results(results, last_own||svf_admin||svf_mod); - memset(thumb_drawn, 0, sizeof(thumb_drawn)); - memset(v_buf, 0, ((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); - } - is_p1 = (exp_res < GRID_X*GRID_Y); - free(results); - active = 0; - } - - if(http && !active && (time(NULL)>http_last_use+HTTP_TIMEOUT)) - { - http_async_req_close(http); - http = NULL; - } - - for(i=0; i=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str+5, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str+5); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str+5, search_thumbs+i, search_thsizes+i); - i++; - } - else if(!strncmp(str, "HISTORY ", 8)) - { - if(i>=GRID_X*GRID_Y) - break; - if(votes) - { - sd = strchr(str+8, ' '); - if(!sd) - return i; - *(sd++) = 0; - pu = strchr(sd, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - sd = strchr(str+8, ' '); - if(!sd) - return i; - *(sd++) = 0; - pu = strchr(sd, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str+8); - - search_dates[i] = mystrdup(sd); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str+8, search_thumbs+i, search_thsizes+i); - i++; - } - else if(!strncmp(str, "TAG ", 4)) - { - if(j >= TAG_MAX) - { - str = p; - continue; - } - q = strchr(str+4, ' '); - if(!q) - { - str = p; - continue; - } - *(q++) = 0; - tag_names[j] = mystrdup(str+4); - tag_votes[j] = atoi(q); - j++; - } - else - { - if(i>=GRID_X*GRID_Y) - break; - if(votes) - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - s = strchr(pu, ' '); - if(!s) - return i; - *(s++) = 0; - vu = strchr(s, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - else - { - pu = strchr(str, ' '); - if(!pu) - return i; - *(pu++) = 0; - vu = strchr(pu, ' '); - if(!vu) - return i; - *(vu++) = 0; - vd = strchr(vu, ' '); - if(!vd) - return i; - *(vd++) = 0; - q = strchr(vd, ' '); - } - if(!q) - return i; - *(q++) = 0; - r = strchr(q, ' '); - if(!r) - return i; - *(r++) = 0; - search_ids[i] = mystrdup(str); - - search_publish[i] = atoi(pu); - search_scoreup[i] = atoi(vu); - search_scoredown[i] = atoi(vd); - - search_owners[i] = mystrdup(q); - search_names[i] = mystrdup(r); - - if(s) - search_votes[i] = atoi(s); - thumb_cache_find(str, search_thumbs+i, search_thsizes+i); - i++; - } - str = p; - } - if(*str) - i++; - return i; -} - -int execute_tagop(pixel *vid_buf, char *op, char *tag) -{ - int status; - char *result; - - char *names[] = {"ID", "Tag", NULL}; - char *parts[2]; - - char *uri = malloc(strlen(SERVER)+strlen(op)+36); - sprintf(uri, "http://" SERVER "/Tag.api?Op=%s", op); - - parts[0] = svf_id; - parts[1] = tag; - - result = http_multipart_post( - uri, - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - free(uri); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 1; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 1; - } - - if(result[2]) - { - strncpy(svf_tags, result+3, 255); - svf_id[15] = 0; - } - - if(result) - free(result); - - return 0; -} - -void execute_save(pixel *vid_buf) -{ - int status; - char *result; - - char *names[] = {"Name", "Data:save.bin", "Thumb:thumb.bin", "Publish", "ID", NULL}; - char *parts[5]; - int plens[5]; - - parts[0] = svf_name; - plens[0] = strlen(svf_name); - parts[1] = build_save(plens+1, 0, 0, XRES, YRES); - parts[2] = build_thumb(plens+2, 1); - parts[3] = (svf_publish==1)?"Public":"Private"; - plens[3] = strlen((svf_publish==1)?"Public":"Private"); - - if(svf_id[0]) - { - parts[4] = svf_id; - plens[4] = strlen(svf_id); - } - else - names[4] = NULL; - - result = http_multipart_post( - "http://" SERVER "/Save.api", - names, parts, plens, - svf_user, svf_pass, - &status, NULL); - - if(svf_last) - free(svf_last); - svf_last = parts[1]; - svf_lsize = plens[1]; - - free(parts[2]); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return; - } - - if(result[2]) - { - strncpy(svf_id, result+3, 15); - svf_id[15] = 0; - } - - if(!svf_id[0]) - { - error_ui(vid_buf, 0, "No ID supplied by server"); - free(result); - return; - } - - thumb_cache_inval(svf_id); - - svf_own = 1; - if(result) - free(result); -} - -void execute_delete(pixel *vid_buf, char *id) -{ - int status; - char *result; - - char *names[] = {"ID", NULL}; - char *parts[1]; - - parts[0] = id; - - result = http_multipart_post( - "http://" SERVER "/Delete.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return; - } - - if(result) - free(result); -} - -int execute_vote(pixel *vid_buf, char *id, char *action) -{ - int status; - char *result; - - char *names[] = {"ID", "Action", NULL}; - char *parts[2]; - - parts[0] = id; - parts[1] = action; - - result = http_multipart_post( - "http://" SERVER "/Vote.api", - names, parts, NULL, - svf_user, svf_pass, - &status, NULL); - - if(status!=200) - { - error_ui(vid_buf, status, http_ret_text(status)); - if(result) - free(result); - return 0; - } - if(result && strncmp(result, "OK", 2)) - { - error_ui(vid_buf, 0, result); - free(result); - return 0; - } - - if(result) - free(result); - return 1; -} \ No newline at end of file diff --git a/interface.h b/interface.h deleted file mode 100644 index 7f13064..0000000 --- a/interface.h +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef INTERFACE_H -#define INTERFACE_H -#include -#include "graphics.h" - -struct menu_section -{ - char *icon; - const char *name; - int itemcount; -}; -typedef struct menu_section menu_section; - -struct menu_wall -{ - pixel colour; - const char *descs; -}; -typedef struct menu_wall menu_wall; - -static menu_wall mwalls[] = -{ - {PIXPACK(0xC0C0C0), "Wall. Indestructible. Blocks everything. Conductive."}, - {PIXPACK(0x808080), "E-Wall. Becomes transparent when electricity is connected."}, - {PIXPACK(0xFF8080), "Detector. Generates electricity when a particle is inside."}, - {PIXPACK(0x808080), "Streamline. Set start point of a streamline."}, - {PIXPACK(0x808080), "Sign. Click on a sign to edit it or anywhere else to place a new one."}, - {PIXPACK(0x8080FF), "Fan. Accelerates air. Use line tool to set direction and strength."}, - {PIXPACK(0xC0C0C0), "Wall. Blocks most particles but lets liquids through. Conductive."}, - {PIXPACK(0x808080), "Wall. Absorbs particles but lets air currents through."}, - {PIXPACK(0x808080), "Erases walls."}, - {PIXPACK(0x808080), "Wall. Indestructible. Blocks everything."}, - {PIXPACK(0x3C3C3C), "Wall. Indestructible. Blocks particles, allows air"}, - {PIXPACK(0x575757), "Wall. Indestructible. Blocks liquids and gasses, allows solids"}, - {PIXPACK(0xFFFF22), "Conductor, allows particles, conducts electricity"}, - {PIXPACK(0x242424), "E-Hole, absorbs particles, release them when powered"}, - {PIXPACK(0xFFFFFF), "Air, creates airflow and pressure"}, - {PIXPACK(0xFFBB00), "Heats the targetted element."}, - {PIXPACK(0x00BBFF), "Cools the targetted element."}, - {PIXPACK(0x303030), "Vacuum, reduces air pressure."}, - {PIXPACK(0x579777), "Wall. Indestructible. Blocks liquids and solids, allows gasses"}, -}; - -#define SC_WALL 0 -#define SC_SPECIAL 8 -#define SC_POWDERS 5 -#define SC_SOLIDS 6 -#define SC_ELEC 1 -#define SC_EXPLOSIVE 2 -#define SC_GAS 3 -#define SC_LIQUID 4 -#define SC_NUCLEAR 7 -#define SC_TOTAL 9 - -static menu_section msections[] = -{ - {"\xC1", "Walls", 0}, - {"\xC2", "Electronics", 0}, - {"\xC3", "Explosives", 0}, - {"\xC5", "Gasses", 0}, - {"\xC4", "Liquids", 0}, - {"\xD0", "Powders", 0}, - {"\xD1", "Solids", 0}, - {"\xC6", "Radioactive", 0}, - {"\xCC", "Special", 0}, -}; - -struct ui_edit -{ - int x, y, w, nx; - char str[256],*def; - int focus, cursor, hide; -}; -typedef struct ui_edit ui_edit; - -struct ui_checkbox -{ - int x, y; - int focus, checked; -}; -typedef struct ui_checkbox ui_checkbox; - -extern SDLMod sdl_mod; -extern int sdl_key, sdl_wheel, sdl_caps, sdl_ascii, sdl_zoom_trig; -extern char *shift_0; -extern char *shift_1; -extern int svf_login; -extern int svf_admin; -extern int svf_mod; -extern char svf_user[64]; -extern char svf_pass[64]; - -extern int svf_open; -extern int svf_own; -extern int svf_myvote; -extern int svf_publish; -extern char svf_id[16]; -extern char svf_name[64]; -extern char svf_tags[256]; -extern void *svf_last; -extern int svf_lsize; - -extern char *search_ids[GRID_X*GRID_Y]; -extern char *search_dates[GRID_X*GRID_Y]; -extern int search_votes[GRID_X*GRID_Y]; -extern int search_publish[GRID_X*GRID_Y]; -extern int search_scoredown[GRID_X*GRID_Y]; -extern int search_scoreup[GRID_X*GRID_Y]; -extern char *search_names[GRID_X*GRID_Y]; -extern char *search_owners[GRID_X*GRID_Y]; -extern void *search_thumbs[GRID_X*GRID_Y]; -extern int search_thsizes[GRID_X*GRID_Y]; - -extern int search_own; -extern int search_date; -extern int search_page; -extern char search_expr[256]; - -extern char *tag_names[TAG_MAX]; -extern int tag_votes[TAG_MAX]; - -extern int Z_keysym; - -extern int zoom_en; -extern int zoom_x, zoom_y; -extern int zoom_wx, zoom_wy; - -void menu_count(void); - -void get_sign_pos(int i, int *x0, int *y0, int *w, int *h); - -void add_sign_ui(pixel *vid_buf, int mx, int my); - -void ui_edit_draw(pixel *vid_buf, ui_edit *ed); - -void ui_edit_process(int mx, int my, int mb, ui_edit *ed); - -void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed); - -void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed); - -void draw_svf_ui(pixel *vid_buf); - -void error_ui(pixel *vid_buf, int err, char *txt); - -void info_ui(pixel *vid_buf, char *top, char *txt); - -void info_box(pixel *vid_buf, char *msg); - -int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn); - -void login_ui(pixel *vid_buf); - -int stamp_ui(pixel *vid_buf); - -void tag_list_ui(pixel *vid_buf); - -int save_name_ui(pixel *vid_buf); - -void menu_ui(pixel *vid_buf, int i, int *sl, int *sr); - -void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my); - -int sdl_poll(void); - -void set_cmode(int cm); - -char *download_ui(pixel *vid_buf, char *uri, int *len); - -int search_ui(pixel *vid_buf); - -int search_results(char *str, int votes); - -int execute_tagop(pixel *vid_buf, char *op, char *tag); - -void execute_save(pixel *vid_buf); - -void execute_delete(pixel *vid_buf, char *id); - -int execute_vote(pixel *vid_buf, char *id, char *action); - -#endif - diff --git a/main.c b/main.c deleted file mode 100755 index e0c5d62..0000000 --- a/main.c +++ /dev/null @@ -1,2096 +0,0 @@ -/** - * Powder Toy - Main source - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * Copyright (c) 2010 Simon Robertshaw - * Copyright (c) 2010 Skresanov Savely - * Copyright (c) 2010 Bryan Hoyle - * Copyright (c) 2010 Nathan Cousins - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#else -#include -#include -#endif - -#include "misc.h" -#include "font.h" -#include "defines.h" -#include "powder.h" -#include "graphics.h" -#include "version.h" -#include "http.h" -#include "md5.h" -#include "update.h" -#include "hmap.h" -#include "air.h" -#include "icon.h" - -static const char *it_msg = - "\brThe Powder Toy\n" - "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" - "\n" - "\bgControl+C/V/X are Copy, Paste and cut respectively.\n" - "\bgTo choose a material, hover over once of the icons on the right, it will show a selection of elements in that group.\n" - "\bgPick your material from the menu using mouse left/right buttons.\n" - "Draw freeform lines by dragging your mouse left/right button across the drawing area.\n" - "Shift+drag will create straight lines of particles.\n" - "Ctrl+drag will result in filled rectangles.\n" - "Ctrl+Shift+click will flood-fill a closed area.\n" - "Ctrl+Z will act as Undo.\n" - "Middle click or Alt+Click to \"sample\" the particles.\n" - "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" - "Use 'S' to save parts of the window as 'stamps'.\n" - "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" - "'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 7 will do the same\n" - "Use the mouse scroll wheel to change the tool size for particles.\n" - "'Q' will quit the application.\n" - "The spacebar can be used to pause physics.\n" - "'P' will take a screenshot and save it into the current directory.\n" - "\n" - "\brhttp://powdertoy.co.uk/\n" - "\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n" - "\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n" - "\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n" - "\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n" - "\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n" - "\n" - "\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n" - "\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html" - ; - -typedef struct -{ - int start, inc; - pixel *vid; -} upstruc; - -#ifdef BETA -static const char *old_ver_msg_beta = "A new beta is available - click here!"; -#endif -static const char *old_ver_msg = "A new version is available - click here!"; -float mheat = 0.0f; - -int do_open = 0; -int sys_pause = 0; -int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save. -int death = 0, framerender = 0; -int amd = 1; -int FPSB = 0; - -sign signs[MAXSIGNS]; - -int numCores = 4; - -int core_count() -{ - int numCPU = 1; -#ifdef MT -#ifdef WIN32 - SYSTEM_INFO sysinfo; - GetSystemInfo( &sysinfo ); - numCPU = sysinfo.dwNumberOfProcessors; -#else -#ifdef MACOSX - numCPU = 4; -#else - numCPU = sysconf( _SC_NPROCESSORS_ONLN ); -#endif -#endif - - printf("Cpus: %d\n", numCPU); - if(numCPU>1) - printf("Multithreading enabled\n"); - else - printf("Multithreading disabled\n"); -#endif - return numCPU; -} - -int mousex = 0, mousey = 0; //They contain mouse position - -void sdl_seticon(void) -{ -#ifdef WIN32 - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else -#ifdef MACOSX - //SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon_w32, 32, 32, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - //SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#else - SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(app_icon, 16, 16, 32, 128, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); - SDL_WM_SetIcon(icon, NULL/*app_icon_mask*/); -#endif -#endif -} - -int frame_idx=0; -void dump_frame(pixel *src, int w, int h, int pitch) -{ - char frame_name[32]; - int j,i; - unsigned char c[3]; - FILE *f; - sprintf(frame_name,"frame%04d.ppm",frame_idx); - f=fopen(frame_name,"wb"); - fprintf(f,"P6\n%d %d\n255\n",w,h); - for(j=0; j=0 && x=0 && y255) i=255; - d[p++] = i; - } - for(y=by0; y255) i=255; - d[p++] = i; - } - - // save the particle map - for(i=0; i=x0 && x=y0 && y255) x=255; - if(y<0) y=0; - if(y>255) y=255; - d[p++] = x; - d[p++] = y; - } - } - for(j=0; j>8); - d[p++] = (tttemp&0x00FF); - } - } - for(j=0; j=x0 && signs[i].x=y0 && signs[i].y=x0 && signs[i].x=y0 && signs[i].y>8; - d[p++] = (signs[i].y-y0); - d[p++] = (signs[i].y-y0)>>8; - d[p++] = signs[i].ju; - x = strlen(signs[i].text); - d[p++] = x; - memcpy(d+p, signs[i].text, x); - p+=x; - } - - i = (p*101+99)/100 + 612; - c = malloc(i); - - //New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures - //This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error - - c[0] = 0x50; //0x66; - c[1] = 0x53; //0x75; - c[2] = 0x76; //0x43; - c[3] = legacy_enable; - c[4] = SAVE_VERSION; - c[5] = CELL; - c[6] = bw; - c[7] = bh; - c[8] = p; - c[9] = p >> 8; - c[10] = p >> 16; - c[11] = p >> 24; - - i -= 12; - - if(BZ2_bzBuffToBuffCompress((char *)(c+12), (unsigned *)&i, (char *)d, p, 9, 0, 0) != BZ_OK) - { - free(d); - free(c); - return NULL; - } - free(d); - - *size = i+12; - return c; -} - -int parse_save(void *save, int size, int replace, int x0, int y0) -{ - unsigned char *d,*c=save; - int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0; - int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h; - int fp[NPART], nf=0, new_format = 0, ttv = 0; - - //New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures - //This creates a problem for old clients, that display and "corrupt" error instead of a "newer version" error - - if(size<16) - return 1; - if(!(c[2]==0x43 && c[1]==0x75 && c[0]==0x66) && !(c[2]==0x76 && c[1]==0x53 && c[0]==0x50)) - return 1; - if(c[2]==0x76 && c[1]==0x53 && c[0]==0x50) { - new_format = 1; - } - if(c[4]>SAVE_VERSION) - return 2; - ver = c[4]; - - if(ver<34) - { - legacy_enable = 1; - } - else - { - if(c[3]==1||c[3]==0) - legacy_enable = c[3]; - else - legacy_beta = 1; - } - - bw = c[6]; - bh = c[7]; - if(bx0+bw > XRES/CELL) - bx0 = XRES/CELL - bw; - if(by0+bh > YRES/CELL) - by0 = YRES/CELL - bh; - if(bx0 < 0) - bx0 = 0; - if(by0 < 0) - by0 = 0; - - if(c[5]!=CELL || bx0+bw>XRES/CELL || by0+bh>YRES/CELL) - return 3; - i = (unsigned)c[8]; - i |= ((unsigned)c[9])<<8; - i |= ((unsigned)c[10])<<16; - i |= ((unsigned)c[11])<<24; - d = malloc(i); - if(!d) - return 1; - - if(BZ2_bzBuffToBuffDecompress((char *)d, (unsigned *)&i, (char *)(c+12), size-12, 0, 0)) - return 1; - size = i; - - if(size < bw*bh) - return 1; - - // normalize coordinates - x0 = bx0*CELL; - y0 = by0*CELL; - w = bw *CELL; - h = bh *CELL; - - if(replace) - { - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(signs, 0, sizeof(signs)); - memset(parts, 0, sizeof(particle)*NPART); - memset(pmap, 0, sizeof(pmap)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(pv, 0, sizeof(pv)); - } - - // make a catalog of free parts - memset(pmap, 0, sizeof(pmap)); - for(i=0; i= size) - goto corrupt; - fvx[y][x] = (d[p++]-127.0f)/64.0f; - } - for(y=by0; y= size) - goto corrupt; - fvy[y][x] = (d[p++]-127.0f)/64.0f; - } - - // load the particle map - i = 0; - pty = p; - for(y=y0; y= size) - goto corrupt; - j=d[p++]; - if(j >= PT_NUM) - goto corrupt; - if(j)// && !(isplayer == 1 && j==PT_STKM)) - { - if(pmap[y][x]) - { - k = pmap[y][x]>>8; - parts[k].type = j; - parts[k].x = (float)x; - parts[k].y = (float)y; - m[(x-x0)+(y-y0)*w] = k+1; - } - else if(i < nf) - { - parts[fp[i]].type = j; - parts[fp[i]].x = (float)x; - parts[fp[i]].y = (float)y; - m[(x-x0)+(y-y0)*w] = fp[i]+1; - i++; - } - else - m[(x-x0)+(y-y0)*w] = NPART+1; - } - } - - // load particle properties - for(j=0; j= size) - goto corrupt; - if(i < NPART) - { - parts[i].vx = (d[p++]-127.0f)/16.0f; - parts[i].vy = (d[p++]-127.0f)/16.0f; - if(parts[i].type == PT_STKM) - { - //player[2] = PT_DUST; - - player[3] = parts[i].x-1; //Setting legs positions - player[4] = parts[i].y+6; - player[5] = parts[i].x-1; - player[6] = parts[i].y+6; - - player[7] = parts[i].x-3; - player[8] = parts[i].y+12; - player[9] = parts[i].x-3; - player[10] = parts[i].y+12; - - player[11] = parts[i].x+1; - player[12] = parts[i].y+6; - player[13] = parts[i].x+1; - player[14] = parts[i].y+6; - - player[15] = parts[i].x+3; - player[16] = parts[i].y+12; - player[17] = parts[i].x+3; - player[18] = parts[i].y+12; - - } - } - else - p += 2; - } - } - for(j=0; j= size) - goto corrupt; - if(i <= NPART) - parts[i-1].life = d[p++]*4; - else - p++; - } - } - for(j=0; j=34&&legacy_beta==0) - { - if(p >= size) - { - goto corrupt; - } - if(i <= NPART) - { - if(ver>=42) { - if(new_format) { - ttv = (d[p++])<<8; - ttv |= (d[p++]); - parts[i-1].temp = ttv; - } else { - parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP; - } - } else { - parts[i-1].temp = ((d[p++]*((O_MAX_TEMP+(-O_MIN_TEMP))/255))+O_MIN_TEMP)+273; - } - } - else - { - p++; - if(new_format) { - p++; - } - } - } - else - { - parts[i-1].temp = ptypes[parts[i-1].type].heat; - } - } - } - for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) - { - if(p >= size) - goto corrupt; - if(i <= NPART) - parts[i-1].ctype = d[p++]; - else - p++; - } - } - - if(p >= size) - goto version1; - j = d[p++]; - for(i=0; i size) - goto corrupt; - for(k=0; k size) - goto corrupt; - if(kXRES/GRID_S || stamps[i].thumb_h>YRES/GRID_S)) - { - factor_x = ceil((float)stamps[i].thumb_w/(float)(XRES/GRID_S)); - factor_y = ceil((float)stamps[i].thumb_h/(float)(YRES/GRID_S)); - if(factor_y > factor_x) - factor_x = factor_y; - tmp = rescale_img(stamps[i].thumb, stamps[i].thumb_w, stamps[i].thumb_h, &(stamps[i].thumb_w), &(stamps[i].thumb_h), factor_x); - free(stamps[i].thumb); - stamps[i].thumb = tmp; - } - } - - free(data); -} - -int clipboard_ready = 0; -void *clipboard_data = 0; -int clipboard_length = 0; - -void stamp_save(int x, int y, int w, int h) -{ - FILE *f; - int n; - char fn[64], sn[16]; - void *s=build_save(&n, x, y, w, h); - -#ifdef WIN32 - _mkdir("stamps"); -#else - mkdir("stamps", 0755); -#endif - - stamp_gen_name(sn); - sprintf(fn, "stamps" PATH_SEP "%s.stm", sn); - - f = fopen(fn, "wb"); - if(!f) - return; - fwrite(s, n, 1, f); - fclose(f); - - free(s); - - if(stamps[STAMP_MAX-1].thumb) - free(stamps[STAMP_MAX-1].thumb); - memmove(stamps+1, stamps, sizeof(struct stamp)*(STAMP_MAX-1)); - memset(stamps, 0, sizeof(struct stamp)); - if(stamp_count0) - { - memcpy(&tmp, stamps+i, sizeof(struct stamp)); - memmove(stamps+1, stamps, sizeof(struct stamp)*i); - memcpy(stamps, &tmp, sizeof(struct stamp)); - - stamp_update(); - } - - return data; -} - -void stamp_init(void) -{ - int i; - FILE *f; - - memset(stamps, 0, sizeof(stamps)); - - f=fopen("stamps" PATH_SEP "stamps.def", "rb"); - if(!f) - return; - for(i=0; i= THUMB_CACHE_SIZE) - return; - free(thumb_cache_id[i]); - free(thumb_cache_data[i]); - thumb_cache_id[i] = NULL; - for(j=0; j thumb_cache_lru[i]) - thumb_cache_lru[j]--; -} -void thumb_cache_add(char *id, void *thumb, int size) -{ - int i,m=-1,j=-1; - thumb_cache_inval(id); - for(i=0; i m) - { - m = thumb_cache_lru[i]; - j = i; - } - } - if(i >= THUMB_CACHE_SIZE) - { - thumb_cache_inval(thumb_cache_id[j]); - i = j; - } - for(j=0; j= THUMB_CACHE_SIZE) - return 0; - for(j=0; jSAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION) || (major==SAVE_VERSION && is_beta == 0)) - old_version = 1; -#else - if(sscanf(ver_data, "%d.%d", &major, &minor)==2) - if(major>SAVE_VERSION || (major==SAVE_VERSION && minor>MINOR_VERSION)) - old_version = 1; -#endif - free(ver_data); - } - http_ver_check = NULL; - } - do_check = (do_check+1) & 15; - } - - if(sdl_key=='q' || sdl_key==SDLK_ESCAPE) - { - if(confirm_ui(vid_buf, "You are about to quit", "Are you sure you want to quit?", "Quit")) - { - break; - } - } - if(sdl_key=='d' && isplayer) - { - death = 1; - //death = !(death); - } - if(sdl_key=='f') - { - framerender = 1; - } - if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0]) - { - if(load_mode) - { - free(load_img); - free(load_data); - load_mode = 0; - load_data = NULL; - load_img = NULL; - } - if(it > 50) - it = 50; - if(sdl_key=='k' && stamps[1].name[0]) - { - j = stamp_ui(vid_buf); - if(j>=0) - load_data = stamp_load(j, &load_size); - else - load_data = NULL; - } - else - load_data = stamp_load(0, &load_size); - if(load_data) - { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - if(sdl_key=='s') - { - if(it > 50) - it = 50; - save_mode = 1; - } - if(sdl_key=='1') - { - set_cmode(0); - } - if(sdl_key=='2') - { - set_cmode(1); - } - if(sdl_key=='3') - { - set_cmode(2); - } - if(sdl_key=='4') - { - set_cmode(3); - } - if(sdl_key=='5') - { - set_cmode(4); - } - if(sdl_key=='6') - { - set_cmode(5); - } - if(sdl_key=='7') - { - set_cmode(6); - } - if(sdl_key==SDLK_LEFTBRACKET) { - if(sdl_zoom_trig==1) - { - ZSIZE -= 1; - if(ZSIZE>32) - ZSIZE = 32; - if(ZSIZE<2) - ZSIZE = 2; - ZFACTOR = 256/ZSIZE; - } - else - { - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - bs -= 1; - else - bs -= ceil((bs/5)+0.5f); - if(bs>1224) - bs = 1224; - if(bs<0) - bs = 0; - } - } - if(sdl_key==SDLK_RIGHTBRACKET) { - if(sdl_zoom_trig==1) - { - ZSIZE += 1; - if(ZSIZE>32) - ZSIZE = 32; - if(ZSIZE<2) - ZSIZE = 2; - ZFACTOR = 256/ZSIZE; - } - else - { - if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) - bs += 1; - else - bs += ceil((bs/5)+0.5f); - if(bs>1224) - bs = 1224; - if(bs<0) - bs = 0; - } - } - if(sdl_key==SDLK_SPACE) - sys_pause = !sys_pause; - if(sdl_key=='h') - hud_enable = !hud_enable; - if(sdl_key=='p') - dump_frame(vid_buf, XRES, YRES, XRES); - if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - if(clipboard_ready==1) - { - load_data = malloc(clipboard_length); - memcpy(load_data, clipboard_data, clipboard_length); - load_size = clipboard_length; - if(load_data) - { - load_img = prerender_save(load_data, load_size, &load_w, &load_h); - if(load_img) - load_mode = 1; - else - free(load_data); - } - } - } - if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 2; - } - if(sdl_key=='c'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - save_mode = 1; - copy_mode = 1; - } - else if(sdl_key=='c') - { - set_cmode((cmode+1) % 7); - if(it > 50) - it = 50; - } - if(sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo - { - int cbx, cby, cbi; - - for(cbi=0; cbi32) - ZSIZE = 32; - if(ZSIZE<2) - ZSIZE = 2; - ZFACTOR = 256/ZSIZE; - sdl_wheel = 0; - } - else - { - bs += sdl_wheel; - if(bs>1224) - bs = 1224; - if(bs<0) - bs = 0; - sdl_wheel = 0; - /*if(su >= PT_NUM) { - if(sl < PT_NUM) - su = sl; - if(sr < PT_NUM) - su = sr; - }*/ - } - } - - bq = b; - b = SDL_GetMouseState(&x, &y); - - for(i=0; i=sdl_scale*(XRES-2) && x= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && y=sdl_scale*zoom_wx && y>=sdl_scale*zoom_wy - && x0 && y0 && x>8)>=NPART || !cr)) - { -#ifdef BETA - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); -#else - sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f); -#endif - } - else - { - sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); - } - } - mx = x; - my = y; - if(update_flag) - { - info_box(vid_buf, "Finalizing update..."); - if(last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION)) - { - update_cleanup(); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } - else - { - if(update_finish()) - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - else - info_ui(vid_buf, "Update success", "You have successfully updated the Powder Toy!"); - } - update_flag = 0; - } - - if(b && !bq && x>=(XRES-19-old_ver_len)*sdl_scale && - x<=(XRES-14)*sdl_scale && y>=(YRES-22)*sdl_scale && y<=(YRES-9)*sdl_scale && old_version) - { - tmp = malloc(64); -#ifdef BETA - if(is_beta) - { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d (Beta %d).", SAVE_VERSION, MINOR_VERSION, major, minor); - } - else - { - sprintf(tmp, "Your version: %d (Beta %d), new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); - } -#else - sprintf(tmp, "Your version: %d.%d, new version: %d.%d.", SAVE_VERSION, MINOR_VERSION, major, minor); -#endif - if(confirm_ui(vid_buf, "Do you want to update The Powder Toy?", tmp, "Update")) - { - free(tmp); - tmp = download_ui(vid_buf, my_uri, &i); - if(tmp) - { - save_presets(1); - if(update_start(tmp, i)) - { - update_cleanup(); - save_presets(0); - error_ui(vid_buf, 0, "Update failed - try downloading a new version."); - } - else - return 0; - } - } - else - free(tmp); - } - if(y>=sdl_scale*(YRES+(MENUSIZE-20))) - { - if(x>=189*sdl_scale && x<=202*sdl_scale && svf_login && svf_open && svf_myvote==0) - { - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } - else if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0) - { - db = svf_own ? 275 : 272; - if(da < 51) - da ++; - } - else if(x>=189 && x<=217 && svf_login && svf_open && svf_myvote!=0) - { - db = (svf_myvote==1) ? 273 : 274; - if(da < 51) - da ++; - } - else if(x>=219*sdl_scale && x<=((XRES+BARSIZE-(510-349))*sdl_scale) && svf_login && svf_open) - { - db = svf_own ? 257 : 256; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-351))*sdl_scale) && x<((XRES+BARSIZE-(510-366))*sdl_scale)) - { - db = 270; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-367))*sdl_scale) && x<((XRES+BARSIZE-(510-383))*sdl_scale)) - { - db = 266; - if(da < 51) - da ++; - } - else if(x>=37*sdl_scale && x<=187*sdl_scale && svf_login) - { - db = 259; - if(svf_open && svf_own && x<=55*sdl_scale) - db = 258; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-385))*sdl_scale) && x<=((XRES+BARSIZE-(510-476))*sdl_scale)) - { - db = svf_login ? 261 : 260; - if(svf_admin) - { - db = 268; - } - else if(svf_mod) - { - db = 271; - } - if(da < 51) - da ++; - } - else if(x>=sdl_scale && x<=17*sdl_scale) - { - db = 262; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-494))*sdl_scale) && x<=((XRES+BARSIZE-(510-509))*sdl_scale)) - { - db = sys_pause ? 264 : 263; - if(da < 51) - da ++; - } - else if(x>=((XRES+BARSIZE-(510-476))*sdl_scale) && x<=((XRES+BARSIZE-(510-491))*sdl_scale)) - { - db = 267; - if(da < 51) - da ++; - } - else if(x>=19*sdl_scale && x<=35*sdl_scale && svf_open) - { - db = 265; - if(da < 51) - da ++; - } - else if(da > 0) - da --; - } - else if(da > 0) - da --; - - if(!sdl_zoom_trig && zoom_en==1) - zoom_en = 0; - - if(sdl_key==Z_keysym && zoom_en==2) - zoom_en = 1; - - if(load_mode) - { - load_x = CELL*((mx/sdl_scale-load_w/2+CELL/2)/CELL); - load_y = CELL*((my/sdl_scale-load_h/2+CELL/2)/CELL); - if(load_x+load_w>XRES) load_x=XRES-load_w; - if(load_y+load_h>YRES) load_y=YRES-load_h; - if(load_x<0) load_x=0; - if(load_y<0) load_y=0; - if(bq==1 && !b) - { - parse_save(load_data, load_size, 0, load_x, load_y); - free(load_data); - free(load_img); - load_mode = 0; - } - else if(bq==4 && !b) - { - free(load_data); - free(load_img); - load_mode = 0; - } - } - else if(save_mode==1) - { - save_x = (mx/sdl_scale)/CELL; - save_y = (my/sdl_scale)/CELL; - if(save_x >= XRES/CELL) save_x = XRES/CELL-1; - if(save_y >= YRES/CELL) save_y = YRES/CELL-1; - save_w = 1; - save_h = 1; - if(b==1) - { - save_mode = 2; - } - else if(b==4) - { - save_mode = 0; - copy_mode = 0; - } - } - else if(save_mode==2) - { - save_w = (mx/sdl_scale+CELL/2)/CELL - save_x; - save_h = (my/sdl_scale+CELL/2)/CELL - save_y; - if(save_w>XRES/CELL) save_w = XRES/CELL; - if(save_h>YRES/CELL) save_h = YRES/CELL; - if(save_w<1) save_w = 1; - if(save_h<1) save_h = 1; - if(!b) - { - if(copy_mode==1) - { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - } - else if(copy_mode==2) - { - clipboard_data=build_save(&clipboard_length, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - clipboard_ready = 1; - save_mode = 0; - copy_mode = 0; - clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - } - else - { - stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - save_mode = 0; - } - } - } - else if(sdl_zoom_trig && zoom_en<2) - { - x /= sdl_scale; - y /= sdl_scale; - x -= ZSIZE/2; - y -= ZSIZE/2; - if(x<0) x=0; - if(y<0) y=0; - if(x>XRES-ZSIZE) x=XRES-ZSIZE; - if(y>YRES-ZSIZE) y=YRES-ZSIZE; - zoom_x = x; - zoom_y = y; - zoom_wx = (x 50) - it = 50; - x /= sdl_scale; - y /= sdl_scale; - if(y>=YRES+(MENUSIZE-20)) - { - if(!lb) - { - if(x>=189 && x<=202 && svf_login && svf_open && svf_myvote==0 && svf_own==0) - { - if(execute_vote(vid_buf, svf_id, "Up")) - { - svf_myvote = 1; - } - } - if(x>=204 && x<=217 && svf_login && svf_open && svf_myvote==0 && svf_own==0) - { - if(execute_vote(vid_buf, svf_id, "Down")) - { - svf_myvote = -1; - } - } - if(x>=219 && x<=(XRES+BARSIZE-(510-349)) && svf_login && svf_open) - tag_list_ui(vid_buf); - if(x>=(XRES+BARSIZE-(510-351)) && x<(XRES+BARSIZE-(510-366)) && !bq) - { - legacy_enable = !legacy_enable; - } - if(x>=(XRES+BARSIZE-(510-367)) && x<=(XRES+BARSIZE-(510-383)) && !bq) - { - memset(signs, 0, sizeof(signs)); - memset(pv, 0, sizeof(pv)); - memset(vx, 0, sizeof(vx)); - memset(vy, 0, sizeof(vy)); - memset(fvx, 0, sizeof(fvx)); - memset(fvy, 0, sizeof(fvy)); - memset(bmap, 0, sizeof(bmap)); - memset(emap, 0, sizeof(emap)); - memset(parts, 0, sizeof(particle)*NPART); - for(i=0; i=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) - { - login_ui(vid_buf); - if(svf_login) - save_presets(0); - } - if(x>=37 && x<=187 && svf_login) - { - if(!svf_open || !svf_own || x>51) - { - if(save_name_ui(vid_buf)) - execute_save(vid_buf); - } - else - execute_save(vid_buf); - while(!sdl_poll()) - if(!SDL_GetMouseState(&x, &y)) - break; - b = bq = 0; - } - if(x>=1 && x<=17) - { - search_ui(vid_buf); - memset(fire_bg, 0, XRES*YRES*PIXELSIZE); - memset(fire_r, 0, sizeof(fire_r)); - memset(fire_g, 0, sizeof(fire_g)); - memset(fire_b, 0, sizeof(fire_b)); - } - if(x>=19 && x<=35 && svf_last && svf_open && !bq) - parse_save(svf_last, svf_lsize, 1, 0, 0); - if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) - { - if(b & SDL_BUTTON_LMASK) - set_cmode((cmode+1) % 7); - if(b & SDL_BUTTON_RMASK) - set_cmode((cmode+6) % 7); - save_presets(0); - } - if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) - sys_pause = !sys_pause; - lb = 0; - } - } - else if(y=0 && ly>=0 && lx0 && y0 && x>8)>=NPART || !cr)) - { - c = sl = cr&0xFF; - } - else - { - //Something - } - } - lx = x; - ly = y; - lb = 0; - lm = 0; - } - else - { - //Copy state before drawing any particles (for undo)7 - int cbx, cby, cbi; - - for(cbi=0; cbi=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4) - create_line(lx, ly, x, y, bs, c); - } - else - create_box(lx, ly, x, y, c); - lm = 0; - } - lb = 0; - } - - if(load_mode) - { - draw_image(vid_buf, load_img, load_x, load_y, load_w, load_h, 128); - xor_rect(vid_buf, load_x, load_y, load_w, load_h); - } - - if(save_mode) - { - xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL); - da = 51; - db = 269; - } - - if(zoom_en!=1 && !load_mode && !save_mode) - { - render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs); - mousex = mx/sdl_scale; - mousey = my/sdl_scale; - } - - if(zoom_en) - render_zoom(vid_buf); - - if(da) - switch(db) - { - case 256: - drawtext(vid_buf, 16, YRES-24, "Add simulation tags.", 255, 255, 255, da*5); - break; - case 257: - drawtext(vid_buf, 16, YRES-24, "Add and remove simulation tags.", 255, 255, 255, da*5); - break; - case 258: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under the current name.", 255, 255, 255, da*5); - break; - case 259: - drawtext(vid_buf, 16, YRES-24, "Save the simulation under a new name.", 255, 255, 255, da*5); - break; - case 260: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server.", 255, 255, 255, da*5); - break; - case 261: - drawtext(vid_buf, 16, YRES-24, "Sign into the Simulation Server under a new name.", 255, 255, 255, da*5); - break; - case 262: - drawtext(vid_buf, 16, YRES-24, "Find & open a simulation", 255, 255, 255, da*5); - break; - case 263: - drawtext(vid_buf, 16, YRES-24, "Pause the simulation", 255, 255, 255, da*5); - break; - case 264: - drawtext(vid_buf, 16, YRES-24, "Resume the simulation", 255, 255, 255, da*5); - break; - case 265: - drawtext(vid_buf, 16, YRES-24, "Reload the simulation", 255, 255, 255, da*5); - break; - case 266: - drawtext(vid_buf, 16, YRES-24, "Erase all particles and walls", 255, 255, 255, da*5); - break; - case 267: - drawtext(vid_buf, 16, YRES-24, "Change display mode", 255, 255, 255, da*5); - break; - case 268: - drawtext(vid_buf, 16, YRES-24, "Annuit C\245ptis", 255, 255, 255, da*5); - break; - case 269: - drawtext(vid_buf, 16, YRES-24, "Click-and-drag to specify a rectangle to copy (right click = cancel).", 255, 216, 32, da*5); - break; - case 270: - drawtext(vid_buf, 16, YRES-24, "Enable or disable compatability mode (disables heat simulation).", 255, 255, 255, da*5); - break; - case 271: - drawtext(vid_buf, 16, YRES-24, "You're a moderator", 255, 255, 255, da*5); - break; - case 272: - drawtext(vid_buf, 16, YRES-24, "Like/Dislike this save.", 255, 255, 255, da*5); - break; - case 273: - drawtext(vid_buf, 16, YRES-24, "You like this.", 255, 255, 255, da*5); - break; - case 274: - drawtext(vid_buf, 16, YRES-24, "You dislike this.", 255, 255, 255, da*5); - break; - case 275: - drawtext(vid_buf, 16, YRES-24, "You cannot vote on your own save.", 255, 255, 255, da*5); - break; - default: - drawtext(vid_buf, 16, YRES-24, (char *)ptypes[db].descs, 255, 255, 255, da*5); - } - if(itc) - { - itc--; - drawtext(vid_buf, (XRES-textwidth(itc_msg))/2, ((YRES/2)-10), itc_msg, 255, 255, 255, itc>51?255:itc*5); - } - if(it) - { - it--; - drawtext(vid_buf, 16, 20, it_msg, 255, 255, 255, it>51?255:it*5); - } - - if(old_version) - { - clearrect(vid_buf, XRES-21-old_ver_len, YRES-24, old_ver_len+9, 17); -#ifdef BETA - if(is_beta) - { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg_beta, 255, 216, 32, 255); - } - else - { - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); - } -#else - drawtext(vid_buf, XRES-16-old_ver_len, YRES-19, old_ver_msg, 255, 216, 32, 255); -#endif - drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255); - } - - if(hud_enable) - { - currentTime = SDL_GetTicks(); - if(currentTime-past>=16) - { - past = SDL_GetTicks(); - FPS++; - } - if(currentTime-pastFPS>=1000) - { -#ifdef BETA - sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); - //printf("%s\n", uitext); -#else - sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS); -#endif - FPSB = FPS; - FPS = 0; - pastFPS = currentTime; - } - if(sdl_zoom_trig||zoom_en) - { - if(zoom_x0 || sr == PT_NEUT || sr == PT_PHOT) - player[2] = sr; - else - player[2] = PT_DUST; - } - - } - - http_done(); - return 0; -} - diff --git a/md5.c b/md5.c deleted file mode 100644 index 2e348e6..0000000 --- a/md5.c +++ /dev/null @@ -1,231 +0,0 @@ -// based on public-domain code from Colin Plumb (1993) -#include -#include "md5.h" - -static unsigned getu32(const unsigned char *addr) -{ - return (((((unsigned long)addr[3] << 8) | addr[2]) << 8) | addr[1]) << 8 | addr[0]; -} - -static void putu32(unsigned data, unsigned char *addr) -{ - addr[0] = (unsigned char)data; - addr[1] = (unsigned char)(data >> 8); - addr[2] = (unsigned char)(data >> 16); - addr[3] = (unsigned char)(data >> 24); -} - -void md5_init(struct md5_context *ctx) -{ - ctx->buf[0] = 0x67452301; - ctx->buf[1] = 0xefcdab89; - ctx->buf[2] = 0x98badcfe; - ctx->buf[3] = 0x10325476; - - ctx->bits[0] = 0; - ctx->bits[1] = 0; -} - -void md5_update(struct md5_context *ctx, unsigned char const *buf, unsigned len) -{ - unsigned t; - - // update bit count - t = ctx->bits[0]; - if((ctx->bits[0] = (t + ((unsigned)len << 3)) & 0xffffffff) < t) - ctx->bits[1]++; // carry - ctx->bits[1] += len >> 29; - - t = (t >> 3) & 0x3f; - - // use leading data to top up the buffer - - if(t) - { - unsigned char *p = ctx->in + t; - - t = 64-t; - if (len < t) - { - memcpy(p, buf, len); - return; - } - memcpy(p, buf, t); - md5_transform(ctx->buf, ctx->in); - buf += t; - len -= t; - } - - // following 64-byte chunks - - while(len >= 64) - { - memcpy(ctx->in, buf, 64); - md5_transform(ctx->buf, ctx->in); - buf += 64; - len -= 64; - } - - // save rest of bytes for later - - memcpy(ctx->in, buf, len); -} - -void md5_final(unsigned char digest[16], struct md5_context *ctx) -{ - unsigned count; - unsigned char *p; - - // #bytes mod64 - count = (ctx->bits[0] >> 3) & 0x3F; - - // first char of padding = 0x80 - p = ctx->in + count; - *p++ = 0x80; - - // calculate # of bytes to pad - count = 64 - 1 - count; - - // Pad out to 56 mod 64 - if(count < 8) - { - // we need to finish a whole block before padding - memset(p, 0, count); - md5_transform(ctx->buf, ctx->in); - memset(ctx->in, 0, 56); - } - else - { - // just pad to 56 bytes - memset(p, 0, count-8); - } - - // append length & final transform - putu32(ctx->bits[0], ctx->in + 56); - putu32(ctx->bits[1], ctx->in + 60); - - md5_transform(ctx->buf, ctx->in); - putu32(ctx->buf[0], digest); - putu32(ctx->buf[1], digest + 4); - putu32(ctx->buf[2], digest + 8); - putu32(ctx->buf[3], digest + 12); - memset(ctx, 0, sizeof(ctx)); -} - -#define F1(x, y, z) (z ^ (x & (y ^ z))) -#define F2(x, y, z) F1(z, x, y) -#define F3(x, y, z) (x ^ y ^ z) -#define F4(x, y, z) (y ^ (x | ~z)) - -#define MD5STEP(f, w, x, y, z, data, s) \ - ( w += f(x, y, z) + data, w &= 0xffffffff, w = w<>(32-s), w += x ) - -void md5_transform(unsigned buf[4], const unsigned char inraw[64]) -{ - unsigned a, b, c, d; - unsigned in[16]; - int i; - - for (i = 0; i < 16; ++i) - in[i] = getu32 (inraw + 4 * i); - - a = buf[0]; - b = buf[1]; - c = buf[2]; - d = buf[3]; - - MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22); - - MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20); - - MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23); - - MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21); - - buf[0] += a; - buf[1] += b; - buf[2] += c; - buf[3] += d; -} - -static char hex[] = "0123456789abcdef"; -void md5_ascii(char *result, unsigned char const *buf, unsigned len) -{ - struct md5_context md5; - unsigned char hash[16]; - int i; - - if(len==0) - len = strlen((char *)buf); - - md5_init(&md5); - md5_update(&md5, buf, len); - md5_final(hash, &md5); - - for(i=0; i<16; i++) - { - result[i*2] = hex[(hash[i]>>4)&0xF]; - result[i*2+1] = hex[hash[i]&0x0F]; - } - result[32] = 0; -} diff --git a/md5.h b/md5.h deleted file mode 100644 index 2ae3ae8..0000000 --- a/md5.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef MD5_H -#define MD5_H - -struct md5_context -{ - unsigned buf[4]; - unsigned bits[2]; - unsigned char in[64]; -}; - -void md5_init(struct md5_context *context); -void md5_update(struct md5_context *context, unsigned char const *buf, unsigned len); -void md5_final(unsigned char digest[16], struct md5_context *context); -void md5_transform(unsigned buf[4], const unsigned char in[64]); - -void md5_ascii(char *result, unsigned char const *buf, unsigned len); - -#endif diff --git a/misc.c b/misc.c deleted file mode 100644 index 7c551e2..0000000 --- a/misc.c +++ /dev/null @@ -1,283 +0,0 @@ -#include -#include -#include -#include "misc.h" -#include "defines.h" -#include "interface.h" -#include "graphics.h" - -//Signum function -#ifdef WIN32 -_inline int isign(float i) -#else -inline int isign(float i) -#endif -{ - if (i<0) - return -1; - if (i>0) - return 1; - return 0; -} - -#ifdef WIN32 -_inline unsigned clamp_flt(float f, float min, float max) -#else -inline unsigned clamp_flt(float f, float min, float max) -#endif -{ - if(fmax) - return 255; - return (int)(255.0f*(f-min)/(max-min)); -} - -#ifdef WIN32 -_inline float restrict_flt(float f, float min, float max) -#else -inline float restrict_flt(float f, float min, float max) -#endif -{ - if(fmax) - return max; - return f; -} - -char *mystrdup(char *s) -{ - char *x; - if(s) - { - x = (char*)malloc(strlen(s)+1); - strcpy(x, s); - return x; - } - return s; -} - -void strlist_add(struct strlist **list, char *str) -{ - struct strlist *item = malloc(sizeof(struct strlist)); - item->str = mystrdup(str); - item->next = *list; - *list = item; -} - -int strlist_find(struct strlist **list, char *str) -{ - struct strlist *item; - for(item=*list; item; item=item->next) - if(!strcmp(item->str, str)) - return 1; - return 0; -} - -void strlist_free(struct strlist **list) -{ - struct strlist *item; - while(*list) - { - item = *list; - *list = (*list)->next; - free(item); - } -} - -void save_presets(int do_update) -{ - FILE *f=fopen("powder.def", "wb"); - unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66}; - unsigned char tmp = sdl_scale; - if(!f) - return; - fwrite(sig, 1, 4, f); - save_string(f, svf_user); - save_string(f, svf_pass); - fwrite(&tmp, 1, 1, f); - tmp = cmode; - fwrite(&tmp, 1, 1, f); - tmp = svf_admin; - fwrite(&tmp, 1, 1, f); - tmp = svf_mod; - fwrite(&tmp, 1, 1, f); - save_string(f, http_proxy_string); - tmp = SAVE_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = MINOR_VERSION; - fwrite(&tmp, 1, 1, f); - tmp = do_update; - fwrite(&tmp, 1, 1, f); - fclose(f); -} - -void load_presets(void) -{ - FILE *f=fopen("powder.def", "rb"); - unsigned char sig[4], tmp; - if(!f) - return; - fread(sig, 1, 4, f); - if(sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66) - { - if(sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F) - { - if(fseek(f, -3, SEEK_END)) - { - remove("powder.def"); - return; - } - if(fread(sig, 1, 3, f) != 3) - { - remove("powder.def"); - goto fail; - } - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; - } - fclose(f); - remove("powder.def"); - return; - } - if(load_string(f, svf_user, 63)) - goto fail; - if(load_string(f, svf_pass, 63)) - goto fail; - svf_login = !!svf_user[0]; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - sdl_scale = (tmp == 2) ? 2 : 1; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - cmode = tmp%7; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_admin = tmp; - if(fread(&tmp, 1, 1, f) != 1) - goto fail; - svf_mod = tmp; - if(load_string(f, http_proxy_string, 255)) - goto fail; - if(fread(sig, 1, 3, f) != 3) - goto fail; - last_major = sig[0]; - last_minor = sig[1]; - update_flag = sig[2]; -fail: - fclose(f); -} - -void save_string(FILE *f, char *str) -{ - int li = strlen(str); - unsigned char lb[2]; - lb[0] = li; - lb[1] = li >> 8; - fwrite(lb, 2, 1, f); - fwrite(str, li, 1, f); -} - -int load_string(FILE *f, char *str, int max) -{ - int li; - unsigned char lb[2]; - fread(lb, 2, 1, f); - li = lb[0] | (lb[1] << 8); - if(li > max) - { - str[0] = 0; - return 1; - } - fread(str, li, 1, f); - str[li] = 0; - return 0; -} - -void strcaturl(char *dst, char *src) -{ - char *d; - unsigned char *s; - - for(d=dst; *d; d++) ; - - for(s=(unsigned char *)src; *s; s++) - { - if((*s>='0' && *s<='9') || - (*s>='a' && *s<='z') || - (*s>='A' && *s<='Z')) - *(d++) = *s; - else - { - *(d++) = '%'; - *(d++) = hex[*s>>4]; - *(d++) = hex[*s&15]; - } - } - *d = 0; -} - -void strappend(char *dst, char *src) -{ - char *d; - unsigned char *s; - - for(d=dst; *d; d++) ; - - for(s=(unsigned char *)src; *s; s++) - { - *(d++) = *s; - } - *d = 0; -} - -void *file_load(char *fn, int *size) -{ - FILE *f = fopen(fn, "rb"); - void *s; - - if(!f) - return NULL; - fseek(f, 0, SEEK_END); - *size = ftell(f); - fseek(f, 0, SEEK_SET); - s = malloc(*size); - if(!s) - { - fclose(f); - return NULL; - } - fread(s, *size, 1, f); - fclose(f); - return s; -} - -int cpu_check(void) -{ -#ifdef MACOSX - return 0; -#else -#ifdef X86 - unsigned af,bf,cf,df; - x86_cpuid(0, af, bf, cf, df); - if(bf==0x68747541 && cf==0x444D4163 && df==0x69746E65) - amd = 1; - x86_cpuid(1, af, bf, cf, df); -#ifdef X86_SSE - if(!(df&(1<<25))) - return 1; -#endif -#ifdef X86_SSE2 - if(!(df&(1<<26))) - return 1; -#endif -#ifdef X86_SSE3 - if(!(cf&1)) - return 1; -#endif -#endif -#endif - return 0; -} \ No newline at end of file diff --git a/misc.h b/misc.h deleted file mode 100644 index 1394687..0000000 --- a/misc.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef UTILS_H -#define UTILS_H -#include -#include - -#ifdef WIN32 -#define x86_cpuid(func,af,bf,cf,df) \ - do {\ - __asm mov eax, func\ - __asm cpuid\ - __asm mov af, eax\ - __asm mov bf, ebx\ - __asm mov cf, ecx\ - __asm mov df, edx\ - } while(0) -#else -#define x86_cpuid(func,af,bf,cf,df) \ -__asm__ __volatile ("cpuid":\ - "=a" (af), "=b" (bf), "=c" (cf), "=d" (df) : "a" (func)); -#endif - -static char hex[] = "0123456789ABCDEF"; -//Signum function -#ifdef WIN32 -extern _inline int isign(float i); -#else -extern inline int isign(float i); -#endif - -#ifdef WIN32 -extern _inline unsigned clamp_flt(float f, float min, float max); -#else -extern inline unsigned clamp_flt(float f, float min, float max); -#endif - -#ifdef WIN32 -extern _inline float restrict_flt(float f, float min, float max); -#else -extern inline float restrict_flt(float f, float min, float max); -#endif - -char *mystrdup(char *s); - -struct strlist -{ - char *str; - struct strlist *next; -}; - -void strlist_add(struct strlist **list, char *str); - -int strlist_find(struct strlist **list, char *str); - -void strlist_free(struct strlist **list); - -void save_presets(int do_update); - -void load_presets(void); - -void save_string(FILE *f, char *str); - -int load_string(FILE *f, char *str, int max); - -void strcaturl(char *dst, char *src); - -void strappend(char *dst, char *src); - -void *file_load(char *fn, int *size); - -int cpu_check(void); - -#endif \ No newline at end of file diff --git a/powder.c b/powder.c deleted file mode 100644 index b62a68a..0000000 --- a/powder.c +++ /dev/null @@ -1,3199 +0,0 @@ -#include -#include -#include "defines.h" -#include "powder.h" -#include "air.h" -#include "misc.h" - -int isplayer = 0; -float player[27]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index, [19]-[26] are accelerations - -particle *parts; -particle *cb_parts; - -unsigned char bmap[YRES/CELL][XRES/CELL]; -unsigned char emap[YRES/CELL][XRES/CELL]; - -unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -unsigned char cb_emap[YRES/CELL][XRES/CELL]; - -int pfree; - -unsigned pmap[YRES][XRES]; -unsigned cb_pmap[YRES][XRES]; - -int try_move(int i, int x, int y, int nx, int ny) -{ - unsigned r; - - - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) - return 0; - if(x==nx && y==ny) - return 1; - r = pmap[ny][nx]; - if(r && (r>>8)>8].type; - - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) - { - return 1; - } - - if((r&0xFF)==PT_VOID) - { - parts[i].type=PT_NONE; - return 0; - } - if((r&0xFF)==PT_BHOL) - { - parts[i].type=PT_NONE; - if(!legacy_enable) - { - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; - } - return 0; - } - - if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide - { - return 1; - } - - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) - { - return 1; - } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) - { - return 0; - } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) - { - return 0; - } - - if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; - if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) - return 0; - if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) - return 0; - - if(parts[i].type==PT_CNCT && y>8)>= 8; - parts[r].x += x-nx; - parts[r].y += y-ny; - } - - return 1; -} - -void kill_part(int i) -{ - int x, y; - parts[i].type = PT_NONE; - - x = (int)(parts[i].x+0.5f); - y = (int)(parts[i].y+0.5f); - - if(x>=0 && y>=0 && x=XRES || y>=YRES) - return -1; - - if(t==SPC_HEAT||t==SPC_COOL) - { - if((pmap[y][x]&0xFF)!=PT_NONE&&(pmap[y][x]&0xFF)>8].temp>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp + 4.0f, MIN_TEMP, MAX_TEMP); - } - if(t==SPC_COOL&&parts[pmap[y][x]>>8].temp>MIN_TEMP) - { - parts[pmap[y][x]>>8].temp = restrict_flt(parts[pmap[y][x]>>8].temp - 4.0f, MIN_TEMP, MAX_TEMP); - } - return pmap[y][x]>>8; - } - else - { - return -1; - } - } - if(t==SPC_AIR) - { - pv[y/CELL][x/CELL] += 0.03f; - if(y+CELL>8].type = PT_SPRK; - parts[pmap[y][x]>>8].life = 4; - parts[pmap[y][x]>>8].ctype = pmap[y][x]&0xFF; - pmap[y][x] = (pmap[y][x]&~0xFF) | PT_SPRK; - return pmap[y][x]>>8; - } - - if(p==-1) - { - if(pmap[y][x]) - return -1; - if(pfree == -1) - return -1; - i = pfree; - pfree = parts[i].life; - } - else - i = p; - - if(t==PT_GLAS) - { - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - } - if(t!=PT_STKM) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = t; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 0; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - parts[i].tmp = 0; - } - if(t==PT_ACID) - { - parts[i].life = 75; - } - /*Testing - if(t==PT_WOOD){ - parts[i].life = 150; - } - End Testing*/ - if(t==PT_FUSE) { - parts[i].life = 50; - parts[i].tmp = 50; - } - if(t==PT_FSEP) - parts[i].life = 50; - if(t==PT_COAL) - parts[i].life = 110; - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_PLSM) - parts[i].life = rand()%150+50; - if(t==PT_HFLM) - parts[i].life = rand()%150+50; - if(t==PT_LAVA) - parts[i].life = rand()%120+240; - if(t==PT_NBLE) - parts[i].life = 0; - if(t==PT_ICEI) - parts[i].ctype = PT_WATR; - if(t==PT_NEUT) - { - float r = (rand()%128+128)/127.0f; - float a = (rand()%360)*3.14159f/180.0f; - parts[i].life = rand()%480+480; - parts[i].vx = r*cosf(a); - parts[i].vy = r*sinf(a); - } - if(t==PT_PHOT) - { - float r = (rand()%3-1)*3; - float a = (rand()%3-1)*3; - parts[i].life = 680; - if(a==0.0f&&r==0.0f) - { - parts[i].life = 0; - parts[i].type = PT_NONE; - return -1; - } - else - { - parts[i].vx = a; - parts[i].vy = r; - } - //} else { - // parts[i].life = 0; - // parts[i].type = PT_NONE; - //}/ - } - - if(t!=PT_STKM) - pmap[y][x] = t|(i<<8); - else - { - if(isplayer==0) - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - - - - player[3] = x-1; //Setting legs positions - player[4] = y+6; - player[5] = x-1; - player[6] = y+6; - - player[7] = x-3; - player[8] = y+12; - player[9] = x-3; - player[10] = y+12; - - player[11] = x+1; - player[12] = y+6; - player[13] = x+1; - player[14] = y+6; - - player[15] = x+3; - player[16] = y+12; - player[17] = x+3; - player[18] = y+12; - - isplayer = 1; - } - } - - return i; -} - -#ifdef WIN32 -_inline void delete_part(int x, int y) -#else -inline void delete_part(int x, int y) -#endif -{ - unsigned i; - - if(x<0 || y<0 || x>=XRES || y>=YRES) - return; - i = pmap[y][x]; - if(!i || (i>>8)>=NPART) - return; - - kill_part(i>>8); - pmap[y][x] = 0; // just in case -} - -#ifdef WIN32 -_inline int is_wire(int x, int y) -#else -inline int is_wire(int x, int y) -#endif -{ - return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; -} - -#ifdef WIN32 -_inline int is_wire_off(int x, int y) -#else -inline int is_wire_off(int x, int y) -#endif -{ - return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; -} - -void set_emap(int x, int y) -{ - int x1, x2; - - if(!is_wire_off(x, y)) - return; - - // go left as far as possible - x1 = x2 = x; - while(x1>0) - { - if(!is_wire_off(x1-1, y)) - break; - x1--; - } - while(x21 && x1==x2 && - is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && - !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) - set_emap(x1, y-2); - else if(y>0) - for(x=x1; x<=x2; x++) - if(is_wire_off(x, y-1)) - { - if(x==x1 || x==x2 || y>=YRES/CELL-1 || - is_wire(x-1, y-1) || is_wire(x+1, y-1) || - is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) - set_emap(x, y-1); - } - - if(y>8) < NPART && (pmr>>8) >= 1) - { - return parts[pmr>>8].type; - } - else - { - return PT_NONE; - } -} - -int nearest_part(int ci, int t) -{ - int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); - int ndistance = 0; - int id = -1; - int i = 0; - int cx = (int)parts[ci].x; - int cy = (int)parts[ci].y; - for(i=0; i=XRES || y>=YRES || - ((bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) - { - kill_part(i); - continue; - } - - vx[y/CELL][x/CELL] *= ptypes[t].airloss; - vy[y/CELL][x/CELL] *= ptypes[t].airloss; - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; - if(t==PT_GAS||t==PT_NBLE) - { - if(pv[y/CELL][x/CELL]<3.5f) - pv[y/CELL][x/CELL] += ptypes[t].hotair*(3.5f-pv[y/CELL][x/CELL]); - if(y+CELL2.5f) - { - parts[i].life = rand()%80+180; - rt = parts[i].type = PT_FIRE; - parts[i].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - pv[y/CELL][x/CELL] += 0.25f * CFDS; - t = PT_FIRE; - } - - parts[i].vx *= ptypes[t].loss; - parts[i].vy *= ptypes[t].loss; - - if(t==PT_GOO && !parts[i].life) - { - if(pv[y/CELL][x/CELL]>1.0f) - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL]; - parts[i].life = rand()%80+300; - } - } - else - { - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - - if(ptypes[t].diffusion) - { - parts[i].vx += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - parts[i].vy += ptypes[t].diffusion*(rand()/(0.5f*RAND_MAX)-1.0f); - } - - // interpolator -#ifdef WIN32 - mv = max(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#else - mv = fmaxf(fabsf(parts[i].vx), fabsf(parts[i].vy)); -#endif - if(mv < ISTP) - { - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - } - else - { - dx = parts[i].vx*ISTP/mv; - dy = parts[i].vy*ISTP/mv; - ix = parts[i].x; - iy = parts[i].y; - while(1) - { - mv -= ISTP; - if(mv <= 0.0f) - { - // nothing found - parts[i].x += parts[i].vx; - parts[i].y += parts[i].vy; - ix = parts[i].x; - iy = parts[i].y; - break; - } - ix += dx; - iy += dy; - nx = (int)(ix+0.5f); - ny = (int)(iy+0.5f); - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES || pmap[ny][nx] || (bmap[ny/CELL][nx/CELL] && bmap[ny/CELL][nx/CELL]!=5)) - { - parts[i].x = ix; - parts[i].y = iy; - break; - } - } - } - - a = nt = 0; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx4.0f) - t = parts[i].type = PT_DSTW; - if(t==PT_OIL && pv[y/CELL][x/CELL]<-6.0f) - t = parts[i].type = PT_GAS; - if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) - t = parts[i].type = PT_OIL; - if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f) - t = parts[i].type = PT_FIRE; - } - if(t==PT_GAS && pv[y/CELL][x/CELL]<-6.0f) - t = parts[i].type = PT_OIL; - if(t==PT_DESL && pv[y/CELL][x/CELL]>5.0f) // Only way I know to make it - t = parts[i].type = PT_FIRE; // combust under pressure. - if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) - t = parts[i].type = PT_OIL; - if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) - t = parts[i].type = PT_BRMT; - if(t==PT_BRCK && pv[y/CELL][x/CELL]>2.8f) - t = parts[i].type = PT_STNE; - //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) - // t = parts[i].type = PT_BGLA; - if(t==PT_GLAS) - { - parts[i].pavg[0] = parts[i].pavg[1]; - parts[i].pavg[1] = pv[y/CELL][x/CELL]; - if(parts[i].pavg[1]-parts[i].pavg[0] > 0.05f || parts[i].pavg[1]-parts[i].pavg[0] < -0.05f) - { - parts[i].type = PT_BGLA; - } - } - if(t==PT_ICEI && pv[y/CELL][x/CELL]>0.8f) - t = parts[i].type = PT_SNOW; - if(t==PT_PLUT && 1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) - { - t = PT_NEUT; - create_part(i, x, y, t); - } - - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) - { - nearp = nearest_part(i, PT_ETRD); - if(nearp!=-1) - { - create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[nearp].type = PT_SPRK; - parts[nearp].life = 9; - parts[nearp].ctype = PT_ETRD; - } - } - - if(!legacy_enable) - { - int ctemp = pv[y/CELL][x/CELL]*2; - c_heat = 0.0f; - h_count = 0; - if(t==PT_ICEI && !parts[i].ctype) - parts[i].ctype = PT_WATR; - if(ptypes[t].hconduct>(rand()%250)&&!(parts[i].type==PT_HSWC&&parts[i].life!=10)) - { - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)) - { - h_count++; - c_heat += parts[r>>8].temp; - } - } - } - } - pt = parts[i].temp = (c_heat+parts[i].temp)/(h_count+1); - for(nx=-1; nx<2; nx++) - { - for(ny=-1; ny<2; ny++) - { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)) - { - parts[r>>8].temp = parts[i].temp; - } - } - } - } - if(pt>=pstates[t].btemp&&pstates[t].burn) - { - t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE||t==PT_PLSM) - parts[i].life = rand()%50+120; - } - else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) - { - if(t==PT_LAVA&&parts[i].ctype) - { - parts[i].life = 0; - if(parts[i].ctype==PT_THRM) - { - parts[i].tmp = 0; - parts[i].ctype = PT_BMTL; - } - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) - { - parts[i].ctype = parts[i].type; - t = parts[i].type = PT_ICEI; - } - else - { - parts[i].life = 0; - t = parts[i].type = pstates[t].solid; - } - } - else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) - { - if(pstates[t].liquid==PT_LAVA) - { - parts[i].life = rand()%120+240; - parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; - parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; - t = parts[i].type = pstates[t].liquid; - } - else if(t==PT_ICEI&&parts[i].ctype) - { - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else - { - t = parts[i].type = pstates[t].liquid; - } - } - else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) - { - t = parts[i].type = pstates[t].liquid; - } - else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) - { - if(t==PT_SLTW&&1>rand()%6) - { - t = parts[i].type = PT_SALT; - } - else - { - t = parts[i].type = pstates[t].gas; - pv[y/CELL][x/CELL] += 0.50f; - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_HFLM) - parts[i].life = rand()%50+120; - } - } - if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) - { - float atemp = parts[i].temp + (-MIN_TEMP); - pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; - } - if(t==PT_LAVA) - { - parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - if(parts[i].ctype==PT_THRM&&parts[i].tmp>0) - { - parts[i].tmp--; - parts[i].temp = 3500; - } - } - pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - } - } - if(t==PT_PTCT&&parts[i].temp>295.0f) - { - pt = parts[i].temp -= 2.5f; - } - if(t==PT_NTCT&&parts[i].temp>295.0f) - { - pt = parts[i].temp -= 2.5f; - } - - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_NTCT || t==PT_PTCT || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) - { - nx = x % CELL; - if(nx == 0) - nx = x/CELL - 1; - else if(nx == CELL-1) - nx = x/CELL + 1; - else - nx = x/CELL; - ny = y % CELL; - if(ny == 0) - ny = y/CELL - 1; - else if(ny == CELL-1) - ny = y/CELL + 1; - else - ny = y/CELL; - if(nx>=0 && ny>=0 && nx=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) - { - t = parts[i].type = PT_NONE; - parts[r>>8].ctype = parts[r>>8].type; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - } - else if((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF)) - { - pv[y/CELL][x/CELL] += 100.0f; - if(legacy_enable&&1>(rand()%200)) - { - parts[i].life = rand()%50+120; - t = parts[i].type = PT_FIRE; - } - else - { - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_ICEI || t==PT_SNOW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if(legacy_enable) - { - if(((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%1000)) - { - t = parts[i].type = PT_ICEI; - parts[r>>8].type = PT_ICEI; - } - if(t==PT_SNOW && ((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 15>(rand()%1000)) - t = parts[i].type = PT_WATR; - } - } - } - else if(t==PT_COAL) - { - if(parts[i].life<=0) { - t = PT_NONE; - kill_part(i); - create_part(-1, x, y, PT_FIRE); - goto killed; - } else if(parts[i].life < 100) { - parts[i].life--; - create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); - } - - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) - { - if(parts[i].life>100) { - parts[i].life = 99; - } - } - } - } - else if(t==PT_FUSE) - { - if(parts[i].life<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; - } else if (parts[i].life < 40) { - parts[i].life--; - if((rand()%100)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; - } - } - if(pv[y/CELL][x/CELL] > 0.8f) - parts[i].tmp--; - else if(parts[i].tmp<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_FSEP); - goto killed; - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)) - { - if(parts[i].life>40) { - parts[i].life = 39; - } - } - } - } - else if(t==PT_FSEP) - { - if(parts[i].life<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; - } else if (parts[i].life < 40) { - parts[i].life--; - if((rand()%10)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; - } - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) - { - if(parts[i].life>40) { - parts[i].life = 39; - } - } - } - } - else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL && parts_avg(i, r>>8)!=PT_INSL) - { - parts[i].temp = 473.0f; - } - } - } - else if(t==PT_PLNT) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR && 1>(rand()%250)) - { - t = parts[i].type = PT_PLNT; - parts[r>>8].type = PT_PLNT; - } - else if((r&0xFF)==PT_LAVA && 1>(rand()%250)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_THRM) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA)) - { - if(1>(rand()%500)) { - t = parts[i].type = PT_LAVA; - parts[i].ctype = PT_BMTL; - pt = parts[i].temp = 3500.0f; - pv[y/CELL][x/CELL] += 50.0f; - } else { - t = parts[i].type = PT_LAVA; - parts[i].life = 400; - parts[i].ctype = PT_THRM; - pt = parts[i].temp = 3500.0f; - parts[i].tmp = 20; - } - } - //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000)) - //t = parts[i].type = PT_WATR; - } - } - else if(t==PT_WATR||t==PT_DSTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%250)) - { - t = parts[i].type = PT_SLTW; - parts[r>>8].type = PT_SLTW; - } - if((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_WATR; - } - if(((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500)) - { - t = parts[i].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_SLTW) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable) - { - t = parts[i].type = PT_SALT; - parts[r>>8].type = PT_WTRV; - } - else if((r&0xFF)==PT_SALT && 1>(rand()%10000)) - { - parts[r>>8].type = PT_SLTW; - } - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - } - } - else if(t==PT_WTRV) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - parts[r>>8].type = PT_WATR; - } - - if(((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500)) - { - parts[i].life = 4; - t = parts[i].type = PT_FIRE; - - } - if(((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable) - { - t = parts[i].type = PT_WATR; - if(1>(rand()%1000)) - parts[r>>8].type = PT_WATR; - } - } - } - else if(t==PT_YEST) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_DYST && 1>(rand()%30) && !legacy_enable) - { - t = parts[i].type = PT_DYST; - } - } - } - else if(t==PT_ACID) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)!=PT_ACID) - { - if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD) - { - t = parts[i].type = PT_FIRE; - parts[i].life = 4; - parts[r>>8].type = PT_FIRE; - parts[r>>8].life = 4; - } - else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) - { - parts[i].life--; - parts[r>>8].type = PT_NONE; - } - else if (parts[i].life==50) - { - parts[i].life = 0; - t = parts[i].type = PT_NONE; - } - } - } - } - else if(t==PT_NEUT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - if((r&0xFF)==PT_PLUT && rt>(rand()%1000)) - { - if(33>rand()%100) - { - create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); - } - else - { - create_part(r>>8, x+nx, y+ny, PT_NEUT); - parts[r>>8].vx = 0.25f*parts[r>>8].vx + parts[i].vx; - parts[r>>8].vy = 0.25f*parts[r>>8].vy + parts[i].vy; - } - pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough - fe ++; - } - if((r&0xFF)==PT_GUNP && 15>(rand()%1000)) - parts[r>>8].type = PT_DUST; - if((r&0xFF)==PT_DYST && 15>(rand()%1000)) - parts[r>>8].type = PT_YEST; - if((r&0xFF)==PT_YEST) { - if(15>(rand()%100000)&&isplayer==0) - parts[r>>8].type = PT_STKM; - else - parts[r>>8].type = PT_DYST; - } - - if((r&0xFF)==PT_WATR && 15>(rand()%100)) - parts[r>>8].type = PT_DSTW; - if((r&0xFF)==PT_PLEX && 15>(rand()%1000)) - parts[r>>8].type = PT_GOO; - if((r&0xFF)==PT_NITR && 15>(rand()%1000)) - parts[r>>8].type = PT_DESL; - if((r&0xFF)==PT_PLNT && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - if((r&0xFF)==PT_DESL && 15>(rand()%1000)) - parts[r>>8].type = PT_GAS; - if((r&0xFF)==PT_COAL && 5>(rand()%100)) - parts[r>>8].type = PT_WOOD; - /*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && - (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| - ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| - ptypes[parts[r>>8].type-1].menusection==SC_GAS|| - ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000)) - parts[r>>8].type--;*/ - } - } - else if(t==PT_PHOT) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=0; nx<1; nx++) - for(ny=0; ny<1; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_WATR || (r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) - { - parts[i].vx *= 0.995; - parts[i].vy *= 0.995; - } - } - } - else if(t==PT_LCRY) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK) - { - if(parts[r>>8].ctype==PT_PSCN) - { - parts[i].life = 10; - } - else if(parts[r>>8].ctype==PT_NSCN) - { - parts[i].life = 9; - } - } - if(rt==PT_LCRY) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - else if(t==PT_PCLN) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK) - { - if(parts[r>>8].ctype==PT_PSCN) - { - parts[i].life = 10; - } - else if(parts[r>>8].ctype==PT_NSCN) - { - parts[i].life = 9; - } - } - if(rt==PT_PCLN) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - else if(t==PT_HSWC) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_SPRK) - { - if(parts[r>>8].ctype==PT_PSCN) - { - parts[i].life = 10; - } - else if(parts[r>>8].ctype==PT_NSCN) - { - parts[i].life = 9; - } - } - if(rt==PT_HSWC) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - else if(t==PT_AMTR) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL) - { - t = parts[i].life++; - if(parts[i].life==3) - { - parts[i].type = PT_NONE; - kill_part(i); - } - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; - kill_part(r>>8); - if(2>(rand()/(RAND_MAX/100))) - create_part(r>>8, x+nx, y+ny, PT_PHOT); - pv[y/CELL][x/CELL] -= 5.0f; - continue; - } - } - } - else if(t==PT_FIRW) { - if(parts[i].tmp==0) { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(rt==PT_FIRE||rt==PT_PLSM||rt==PT_THDR) - { - parts[i].tmp = 1; - parts[i].life = rand()%50+120; - } - } - } - else if(parts[i].tmp==1) { - if(parts[i].life==0) { - parts[i].tmp=2; - } else { - float newVel = parts[i].life/50; - parts[i].flags = parts[i].flags&0xFFFFFFFE; - if((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE) { - parts[i].vy = -newVel; - ly-=newVel; - iy-=newVel; - } - } - } - else if(parts[i].tmp==2) { - for(nx=-2; nx<3; nx++) { - for(ny=-2; ny<3; ny++) { - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(parts[r>>8].type==PT_FIRW) { - parts[r>>8].vx = (rand()%3-1)*tmul; - parts[r>>8].vy = (rand()%3-1)*tmul; - parts[r>>8].tmp = 3; - parts[r>>8].life = rand()%100+100; - parts[r>>8].temp = 6000.0f; - } - } - } - } - pv[y/CELL][x/CELL] += 20; - kill_part(i); - } else if(parts[i].tmp==3) { - if(parts[i].life<=0) { - kill_part(i); - } - } - } - else if(t==PT_BTRY) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(parts_avg(i,r>>8) != PT_INSL) - { - if((rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) - { - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - parts[r>>8].type = PT_SPRK; - } - } - } - } else if(t==PT_SWCH) - { - rt = 3 + (int)pv[y/CELL][x/CELL]; - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - rt = parts[r>>8].type; - if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8)!=PT_INSL) - { - if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) - { - parts[i].life = 9; - } - else if(parts[i].life==0&&parts[r>>8].life==10) - { - parts[i].life = 10; - } - } - } - } - if(t==PT_SWCH) - if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11) - { - parts[i].life--; - } - if(t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10))) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if(bmap[(y+ny)/CELL][(x+nx)/CELL] && bmap[(y+ny)/CELL][(x+nx)/CELL]!=5) - continue; - rt = parts[r>>8].type; - if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && - ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) - { - parts[r>>8].type = PT_FIRE; - parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); - parts[r>>8].life = rand()%80+180; - if(ptypes[rt].explosive) - pv[y/CELL][x/CELL] += 0.25f * CFDS; - continue; - } - lpv = (int)pv[(y+ny)/CELL][(x+nx)/CELL]; - if(lpv < 1) lpv = 1; - if(legacy_enable) - { - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && - ptypes[rt].meltable*lpv>(rand()%1000)) - { - if(t!=PT_LAVA || parts[i].life>0) - { - parts[r>>8].ctype = (parts[r>>8].type==PT_BRMT)?PT_BMTL:parts[r>>8].type; - parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; - parts[r>>8].type = PT_LAVA; - parts[r>>8].life = rand()%120+240; - } - else - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; - parts[i].ctype = PT_NONE;//rt; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) - { - parts[r>>8].type = PT_WATR; - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = PT_STNE; - goto killed; - } - } - if(t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) - { - kill_part(r>>8); - if(t==PT_FIRE) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - goto killed; - } - if(t==PT_LAVA) - { - parts[i].life = 0; - t = parts[i].type = (parts[i].ctype)?parts[i].ctype:PT_STNE; - parts[i].ctype = PT_NONE; - goto killed; - } - } - } - pavg = parts_avg(i, r>>8); - if(rt==PT_SWCH && t==PT_SPRK) - { - pavg = parts_avg(r>>8, i); - if(parts[i].ctype == PT_PSCN&&pavg != PT_INSL) - parts[r>>8].life = 10; - if(parts[i].ctype == PT_NSCN&&pavg != PT_INSL) - parts[r>>8].life = 9; - if(!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].ctype = PT_SWCH; - parts[r>>8].life = 4; - } - } - pavg = parts_avg(i, r>>8); - if(pavg != PT_INSL) - { - if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - if(parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) - parts[r>>8].temp = parts[r>>8].temp+10.0f; - } - } - if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp>373.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].temp<373.0f))&&pavg != PT_INSL) - { - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - if(t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 6; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8].type = PT_SPRK; - parts[r>>8].life = 5; - parts[r>>8].ctype = rt; - } - if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5) - { - if(rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN) - { - t = parts[i].type = PT_ETRD; - parts[i].ctype = PT_NONE; - parts[i].life = 20; - parts[r>>8].type = PT_SPRK; - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - } - } - - if(t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1) - { - parts[i].life = rand()%150+50; - parts[i].type = PT_PLSM; - parts[i].ctype = PT_NBLE; - parts[i].temp = 3500; - pv[y/CELL][x/CELL] += 1; - } - if(t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=1) - { - parts[i].type = PT_SWCH; - parts[i].life = 11; - } - } - } -killed: - if(parts[i].type == PT_NONE) - continue; - } - if(t==PT_STKM) - { - float dt = 0.9;///(FPSB*FPSB); //Delta time in square - //Tempirature handling - if(parts[i].temp<243) - parts[i].life -= 1; - if((parts[i].temp<309.6f) && (parts[i].temp>=243)) - parts[i].temp += 1; - - //Death - if(parts[i].life<1 || death == 1 || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... - { - death = 0; - for(r=-2; r<=1; r++) - { - create_part(-1, x+r, y-2, player[2]); - create_part(-1, x+r+1, y+2, player[2]); - create_part(-1, x-2, y+r+1, player[2]); - create_part(-1, x+2, y+r, player[2]); - } - kill_part(i); //Kill him - goto killed; - } - - parts[i].vy += -0.7*dt; //Head up! - - //Verlet integration - pp = 2*player[3]-player[5]+player[19]*dt*dt;; - player[5] = player[3]; - player[3] = pp; - pp = 2*player[4]-player[6]+player[20]*dt*dt;; - player[6] = player[4]; - player[4] = pp; - - pp = 2*player[7]-player[9]+player[21]*dt*dt;; - player[9] = player[7]; - player[7] = pp; - pp = 2*player[8]-player[10]+(player[22]+1)*dt*dt;; - player[10] = player[8]; - player[8] = pp; - - pp = 2*player[11]-player[13]+player[23]*dt*dt;; - player[13] = player[11]; - player[11] = pp; - pp = 2*player[12]-player[14]+player[24]*dt*dt;; - player[14] = player[12]; - player[12] = pp; - - pp = 2*player[15]-player[17]+player[25]*dt*dt;; - player[17] = player[15]; - player[15] = pp; - pp = 2*player[16]-player[18]+(player[26]+1)*dt*dt;; - player[18] = player[16]; - player[16] = pp; - - //Setting acceleration to 0 - player[19] = 0; - player[20] = 0; - - player[21] = 0; - player[22] = 0; - - player[23] = 0; - player[24] = 0; - - player[25] = 0; - player[26] = 0; - - //Go left - if (((int)(player[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[21] = -3; - player[22] = -2; - player[19] = -2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[25] = -3; - player[26] = -2; - player[23] = -2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids - { - player[21] = -1; - player[22] = -1; - player[19] = -1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[25] = -1; - player[26] = -1; - player[23] = -1; - } - } - } - - //Go right - if (((int)(player[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) - { - if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[21] = 3; - player[22] = -2; - player[19] = 2; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[25] = 3; - player[26] = -2; - player[23] = 2; - } - } - else - { - if (pmap[(int)(player[8]-1)][(int)(player[7])]) - { - player[21] = 1; - player[22] = -1; - player[19] = 1; - } - - if (pmap[(int)(player[16]-1)][(int)(player[15])]) - { - player[25] = 1; - player[26] = -1; - player[23] = 1; - } - - } - } - - //Jump - if (((int)(player[0])&0x04) == 0x04 && (pstates[pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF].state != ST_GAS || pstates[pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF].state != ST_GAS)) - { - if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])]) - { - parts[i].vy = -5; - player[22] -= 1; - player[26] -= 1; - } - } - - //Charge detector wall if foot inside - if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6) - set_emap((int)player[7]/CELL, (int)player[8]/CELL); - if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6) - set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL); - - //Searching for particles near head - for(nx = -2; nx <= 2; nx++) - for(ny = 0; ny>=-2; ny--) - { - if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART) - continue; - if(ptypes[pmap[ny+y][nx+x]&0xFF].falldown!=0 || (pmap[ny+y][nx+x]&0xFF) == PT_NEUT || (pmap[ny+y][nx+x]&0xFF) == PT_PHOT) - { - player[2] = pmap[ny+y][nx+x]&0xFF; //Current element - } - if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP - { - if(parts[i].life<=95) - parts[i].life += 5; - else - parts[i].life = 100; - kill_part(pmap[ny+y][nx+x]>>8); - } - - if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT) - { - parts[i].life -= (102-parts[i].life)/2; - kill_part(pmap[ny+y][nx+x]>>8); - } - if(bmap[(ny+y)/CELL][(nx+x)/CELL]==4) - player[2] = SPC_AIR; - } - - //Head position - nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01); - ny = y - 3*(player[1] == 0); - - //Spawn - if(((int)(player[0])&0x08) == 0x08) - { - ny -= 2*(rand()%2)+1; - r = pmap[ny][nx]; - if(!((r>>8)>=NPART)) - { - if(pstates[r&0xFF].state == ST_SOLID) - { - create_part(-1, nx, ny, PT_SPRK); - } - else - { - if(player[2] == SPC_AIR) - create_parts(nx + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01), ny, 4, SPC_AIR); - else - create_part(-1, nx, ny, player[2]); - - r = pmap[ny][nx]; - if( ((r>>8) < NPART) && (r>>8)>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR) - parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01); - if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT) - { - int random = abs(rand()%3-1)*3; - if (random==0) - { - parts[r>>8].life = 0; - parts[r>>8].type = PT_NONE; - } - else - { - parts[r>>8].vy = 0; - parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random; - } - } - - } - } - } - - //Simulation of joints - d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance - player[7] -= (player[3]-player[7])*d; - player[8] -= (player[4]-player[8])*d; - player[3] += (player[3]-player[7])*d; - player[4] += (player[4]-player[8])*d; - - d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5; - player[15] -= (player[11]-player[15])*d; - player[16] -= (player[12]-player[16])*d; - player[11] += (player[11]-player[15])*d; - player[12] += (player[12]-player[16])*d; - - d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[3]-parts[i].x)*d; - parts[i].vy -= (player[4]-parts[i].y)*d; - player[3] += (player[3]-parts[i].x)*d; - player[4] += (player[4]-parts[i].y)*d; - - d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5; - parts[i].vx -= (player[11]-parts[i].x)*d; - parts[i].vy -= (player[12]-parts[i].y)*d; - player[11] += (player[11]-parts[i].x)*d; - player[12] += (player[12]-parts[i].y)*d; - - //Side collisions checking - for(nx = -3; nx <= 3; nx++) - { - r = pmap[(int)(player[16]-2)][(int)(player[15]+nx)]; - if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID) - player[15] -= nx; - - r = pmap[(int)(player[8]-2)][(int)(player[7]+nx)]; - if(r && pstates[r&0xFF].state != ST_GAS && pstates[r&0xFF].state != ST_LIQUID) - player[7] -= nx; - } - - //Collision checks - for(ny = -2-(int)parts[i].vy; ny<=0; ny++) - { - r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-) - - //For left leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) //Liquid checks //Liquid checks - { - if(parts[i].y<(player[8]-10)) - parts[i].vy = 1*dt; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5*dt; - } - else - { - if(pstates[r&0xFF].state != ST_GAS) - { - player[8] += ny-1; - parts[i].vy -= 0.5*parts[i].vy*dt; - } - } - player[9] = player[7]; - } - - r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)]; - - //For right leg - if (r && (r&0xFF)!=PT_STKM) - { - if(pstates[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG) - { - if(parts[i].y<(player[16]-10)) - parts[i].vy = 1*dt; - else - parts[i].vy = 0; - if(abs(parts[i].vx)>1) - parts[i].vx *= 0.5*dt; - } - else - { - if(pstates[r&0xFF].state != ST_GAS) - { - player[16] += ny-1; - parts[i].vy -= 0.5*parts[i].vy*dt; - } - } - player[17] = player[15]; - } - - //If it falls too fast - if (parts[i].vy>=30) - { - parts[i].y -= (10+ny)*dt; - parts[i].vy = -10*dt; - } - - } - - //Keeping legs distance - if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1) - { - player[21] -= 0.2; - player[25] += 0.2; - } - - if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1) - { - player[19] -= 0.2; - player[23] += 0.2; - } - - //If legs touch something - r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=323 || parts[r>>8].temp<=243) - { - parts[i].life -= 2; - player[26] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)]; - if((r&0xFF)==PT_SPRK && r && (r>>8)0 && (r>>8)>8].temp>=323 || parts[r>>8].temp<=243) - { - parts[i].life -= 2; - player[22] -= 1; - } - } - - if ((r&0xFF)==PT_ACID) //If on acid - parts[i].life -= 5; - - if ((r&0xFF)==PT_PLUT) //If on plut - parts[i].life -= 1; - - isplayer = 1; - } - if(t==PT_CLNE) - { - if(!parts[i].ctype) - { - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx=0 && y+ny>0 && - x+nx303&&parts[i].temp<317) { - create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST); - } - } - if(t==PT_PLSM&&parts[i].ctype == PT_NBLE&&parts[i].life <=1) - { - parts[i].type = PT_NBLE; - parts[i].life = 0; - } - if (t==PT_FIRE && parts[i].life <=1 && parts[i].temp<625) - { - t = parts[i].type = PT_SMKE; - parts[i].life = rand()%20+250; - } - - nx = (int)(parts[i].x+0.5f); - ny = (int)(parts[i].y+0.5f); - - if(nx=XRES-CELL || - ny=YRES-CELL) - { - parts[i].x = lx; - parts[i].y = ly; - kill_part(i); - continue; - } - - rt = parts[i].flags & FLAG_STAGNANT; - parts[i].flags &= ~FLAG_STAGNANT; - if(!try_move(i, x, y, nx, ny)) - { - parts[i].x = lx; - parts[i].y = ly; - if(ptypes[t].falldown) - { - if(nx!=x && try_move(i, x, y, nx, y)) - { - parts[i].x = ix; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x, ny)) - { - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else - { - r = (rand()%2)*2-1; - if(ny!=y && try_move(i, x, y, x+r, ny)) - { - parts[i].x += r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ny!=y && try_move(i, x, y, x-r, ny)) - { - parts[i].x -= r; - parts[i].y = iy; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y+r)) - { - parts[i].x = ix; - parts[i].y += r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(nx!=x && try_move(i, x, y, nx, y-r)) - { - parts[i].x = ix; - parts[i].y -= r; - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) - { - s = 0; - if(!rt || nt) - rt = 50; - else - rt = 10; - for(j=x+r; j>=0 && j>=x-rt && j0) - r = 1; - else - r = -1; - if(s) - for(j=y+r; j>=0 && j=y-rt && jx+ISTP) nx=x+ISTP; - if(nxy+ISTP) ny=y+ISTP; - if(ny(rand()%1000)) - { - kill_part(i); - continue; - } - else if(try_move(i, x, y, 2*x-nx, ny)) - { - parts[i].x = (float)(2*x-nx); - parts[i].y = (float)iy; - parts[i].vx *= ptypes[t].collision; - } - else if(try_move(i, x, y, nx, 2*y-ny)) - { - parts[i].x = (float)ix; - parts[i].y = (float)(2*y-ny); - parts[i].vy *= ptypes[t].collision; - } - else - { - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - } - } - if(nx=XRES-CELL || ny=YRES-CELL) - { - kill_part(i); - continue; - } - } - if(framerender) { - framerender = 0; - sys_pause = 1; - } -} - -void update_particles(pixel *vid) -{ - int i, j, x, y, t, nx, ny, r, cr,cg,cb, l = -1; - float lx, ly; -#ifdef MT - int pt = 0, pc = 0; - pthread_t *InterThreads; -#endif - - isplayer = 0; //Needed for player spawning - memset(pmap, 0, sizeof(pmap)); - r = rand()%2; - for(j=0; j=0 && y>=0 && x>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==13) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && (!sys_pause||framerender)) - emap[y][x] --; - } - } - } - else - { - for(y=0; y>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==4) - for(j=0; j>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==7) - { - if(emap[y][x]) - { - cr = cg = cb = 128; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==11) - { - for(j=0; j 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(bmap[y][x]==9) - { - for(j=0; j>1)&1; i>1)&1; i>1)&1; i 255) cr = 255; - fire_r[y][x] = cr; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - } - } - if(emap[y][x] && (!sys_pause||framerender)) - emap[y][x] --; - } - } - } - - update_particles_i(vid, 0, 1); - - for(y=0; y=XRES || ny<0 || ny>=YRES) - break; - addpixel(vid, nx, ny, 255, 255, 255, 64); - i = nx/CELL; - j = ny/CELL; - lx += vx[j][i]*0.125f; - ly += vy[j][i]*0.125f; - if(bmap[j][i]==5 && i!=x && j!=y) - break; - } - drawtext(vid, x*CELL, y*CELL-2, "\x8D", 255, 255, 255, 128); - } - -} - -void clear_area(int area_x, int area_y, int area_w, int area_h) -{ - int cx = 0; - int cy = 0; - for(cy=0; cyx2) - { - i = x2; - x2 = x1; - x1 = i; - } - if(y1>y2) - { - j = y2; - y2 = y1; - y1 = j; - } - for(j=y1; j<=y2; j++) - for(i=x1; i<=x2; i++) - create_parts(i, j, 1, c); -} - -int flood_parts(int x, int y, int c, int cm, int bm) -{ - int x1, x2, dy = (c=122&&c<=122+UI_WALLCOUNT) - { - c = c-100; - } - if(cm==-1) - { - if(c==0) - { - cm = pmap[y][x]&0xFF; - if(!cm) - return 0; - } - else - cm = 0; - } - if(bm==-1) - { - if(c==30) - { - bm = bmap[y/CELL][x/CELL]; - if(!bm) - return 0; - if(bm==1) - cm = 0xFF; - } - else - bm = 0; - } - - if((pmap[y][x]&0xFF)!=cm || bmap[y/CELL][x/CELL]!=bm) - return 1; - - // go left as far as possible - x1 = x2 = x; - while(x1>=CELL) - { - if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) - break; - x1--; - } - while(x2=CELL+dy) - for(x=x1; x<=x2; x++) - if((pmap[y-dy][x]&0xFF)==cm && bmap[(y-dy)/CELL][x/CELL]==bm) - if(!flood_parts(x, y-dy, co, cm, bm)) - return 0; - if(y=0 && i+u=0 && j+v=0&&ox=0&&oyabs(x2-x1), x, y, dx, dy, sy; - float e, de; - if(cp) - { - y = x1; - x1 = y1; - y1 = y; - y = x2; - x2 = y2; - y2 = y; - } - if(x1 > x2) - { - y = x1; - x1 = x2; - x2 = y; - y = y1; - y1 = y2; - y2 = y; - } - dx = x2 - x1; - dy = abs(y2 - y1); - e = 0.0f; - if(dx) - de = dy/(float)dx; - else - de = 0.0f; - y = y1; - sy = (y1= 0.5f) - { - y += sy; - if(c==135 || c==140 || c==134 || c==133 || c==132 || c==131 || c==129 || c==128 || c==127 || c==125 || c==124 || c==123 || c==122 || !r) - { - if(cp) - create_parts(y, x, r, c); - else - create_parts(x, y, r, c); - } - e -= 1.0f; - } - } -} diff --git a/powder.h b/powder.h deleted file mode 100644 index eda30d2..0000000 --- a/powder.h +++ /dev/null @@ -1,512 +0,0 @@ -#ifndef POWDER_H -#define POWDER_H - -#include "graphics.h" -#include "defines.h" -#include "interface.h" - -#define CM_COUNT 7 -#define CM_FANCY 6 -#define CM_HEAT 5 -#define CM_BLOB 4 -#define CM_FIRE 3 -#define CM_PERS 2 -#define CM_PRESS 1 -#define CM_VEL 0 - -#define UI_WALLSTART 37 -#define UI_WALLCOUNT 19 - -#define SPC_AIR 136 -#define SPC_HEAT 137 -#define SPC_COOL 138 -#define SPC_VACUUM 139 - -#define WL_WALLELEC 22 -#define WL_EWALL 23 -#define WL_DETECT 24 -#define WL_STREAM 25 -#define WL_SIGN 26 -#define WL_FAN 27 -#define WL_ALLOWLIQUID 28 -#define WL_DESTROYALL 29 -#define WL_ERASE 30 -#define WL_WALL 31 -#define WL_ALLOWAIR 32 -#define WL_ALLOWSOLID 33 -#define WL_ALLOWALLELEC 34 -#define WL_EHOLE 35 -#define WL_ALLOWGAS 40 - -#define PT_NONE 0 -#define PT_DUST 1 -#define PT_WATR 2 -#define PT_OIL 3 -#define PT_FIRE 4 -#define PT_STNE 5 -#define PT_LAVA 6 -#define PT_GUNP 7 -#define PT_NITR 8 -#define PT_CLNE 9 -#define PT_GAS 10 -#define PT_PLEX 11 -#define PT_GOO 12 -#define PT_ICEI 13 -#define PT_METL 14 -#define PT_SPRK 15 -#define PT_SNOW 16 -#define PT_WOOD 17 -#define PT_NEUT 18 -#define PT_PLUT 19 -#define PT_PLNT 20 -#define PT_ACID 21 -#define PT_VOID 22 -#define PT_WTRV 23 -#define PT_CNCT 24 -#define PT_DSTW 25 -#define PT_SALT 26 -#define PT_SLTW 27 -#define PT_DMND 28 -#define PT_BMTL 29 -#define PT_BRMT 30 -#define PT_PHOT 31 -#define PT_URAN 32 -#define PT_WAX 33 -#define PT_MWAX 34 -#define PT_PSCN 35 -#define PT_NSCN 36 -#define PT_LNTG 37 -#define PT_INSL 38 -#define PT_BHOL 39 -#define PT_WHOL 40 -#define PT_RBDM 41 -#define PT_LRBD 42 -#define PT_NTCT 43 -#define PT_SAND 44 -#define PT_GLAS 45 -#define PT_PTCT 46 -#define PT_BGLA 47 -#define PT_THDR 48 -#define PT_PLSM 49 -#define PT_ETRD 50 -#define PT_NICE 51 -#define PT_NBLE 52 -#define PT_BTRY 53 -#define PT_LCRY 54 -#define PT_STKM 55 -#define PT_SWCH 56 -#define PT_SMKE 57 -#define PT_DESL 58 -#define PT_COAL 59 -#define PT_LO2 60 -#define PT_O2 61 -#define PT_INWR 62 -#define PT_YEST 63 -#define PT_DYST 64 -#define PT_THRM 65 -#define PT_GLOW 66 -#define PT_BRCK 67 -#define PT_HFLM 68 -#define PT_FIRW 69 -#define PT_FUSE 70 -#define PT_FSEP 71 -#define PT_AMTR 72 -#define PT_PCLN 73 -#define PT_HSWC 74 -#define PT_NUM 75 - -#define R_TEMP 22 -#define MAX_TEMP 9999 -#define MIN_TEMP 0 -#define O_MAX_TEMP 3500 -#define O_MIN_TEMP -273 - -#define ST_NONE 0 -#define ST_SOLID 1 -#define ST_LIQUID 2 -#define ST_GAS 3 -/* - We should start to implement these. -*/ -static const unsigned short TYPE_PART = 0x01; //1 -static const unsigned short TYPE_LIQUID = 0x02; //2 -static const unsigned short TYPE_SOLID = 0x04; //4 -static const unsigned short TYPE_GAS = 0x08; //8 -static const unsigned short PROP_CONDUCTS = 0x10; //16 -static const unsigned short PROP_DEADLY = 0x12; //18 Is deadly for stickman. -#define FLAG_STAGNANT 1 - -struct particle -{ - int type; - int life, ctype; - float x, y, vx, vy; - float temp; - float pavg[2]; - int flags; - int tmp; -}; -typedef struct particle particle; - -struct part_type -{ - const char *name; - pixel pcolors; - float advection; - float airdrag; - float airloss; - float loss; - float collision; - float gravity; - float diffusion; - float hotair; - int falldown; - int flammable; - int explosive; - int meltable; - int hardness; - int menu; - int menusection; - float heat; - unsigned char hconduct; - const char *descs; - const unsigned short properties; -}; -typedef struct part_type part_type; - -struct part_state -{ - char state; - int solid; - float stemp; - int liquid; - float ltemp; - int gas; - float gtemp; - int burn; - float btemp; -}; -typedef struct part_state part_state; -//Should probably be const. -static const part_type ptypes[PT_NUM] = -{ - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description - {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, - {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f+273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, - {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f+273.15f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, - {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f+273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, - {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, - {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, - {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, - {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, - {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+-50.0f+273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, - {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, - {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP+-30.0f+273.15f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, - {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, - {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, - {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, - {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, - {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f+273.15f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, - {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, - {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. - {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, - {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f+273.15f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure."}, - {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, - {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax."}, - {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, - {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, - {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up."}, - {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f+273.15f, 255, "White hole, pushes other particles away."}, - {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, - {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f+273.15f, 170, "Liquid Rubidium."}, - {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, - {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, - {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, - {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, - {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!"}, - {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke"}, - {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, - {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, - {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, - {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure"}, - {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, - {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, - {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, - {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, - {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, - {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description -}; - -static part_state pstates[PT_NUM] = -{ - // Name Solid Frzp Liquid Mpnt Gas Bpoint - /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, - /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f}, - /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f}, - /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LAVA */ {ST_LIQUID, PT_STNE, 973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, - /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, - /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, - /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, - /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, - /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f}, - /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f}, - /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, - /* LRBD */ {ST_LIQUID, PT_RBDM, 311.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, - /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, - /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, - /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f}, - /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, - /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, - /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, -}; - -static unsigned char can_move[PT_NUM][PT_NUM] = -{ - /* A B */ - /* A 0 1 | B ligher than A */ - /* B 1 0 | A heavier than B */ - - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A P H */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C S */ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T L W */ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R N C */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* HSWC */ - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A P H */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C S */ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T L W */ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R N C */ -}; - -extern int isplayer; -extern float player[27]; - -extern particle *parts; -extern particle *cb_parts; - -extern unsigned char bmap[YRES/CELL][XRES/CELL]; -extern unsigned char emap[YRES/CELL][XRES/CELL]; - -extern unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -extern unsigned char cb_emap[YRES/CELL][XRES/CELL]; - -extern int pfree; - -extern unsigned pmap[YRES][XRES]; -unsigned cb_pmap[YRES][XRES]; - -int try_move(int i, int x, int y, int nx, int ny); - -void kill_part(int i); - -#ifdef WIN32 -extern _inline int create_part(int p, int x, int y, int t); -#else -extern inline int create_part(int p, int x, int y, int t); -#endif - -#ifdef WIN32 -extern _inline void delete_part(int x, int y); -#else -extern inline void delete_part(int x, int y); -#endif - -#ifdef WIN32 -extern _inline int is_wire(int x, int y); -#else -extern inline int is_wire(int x, int y); -#endif - -#ifdef WIN32 -extern _inline int is_wire_off(int x, int y); -#else -extern inline int is_wire_off(int x, int y); -#endif - -void set_emap(int x, int y); - -#ifdef WIN32 -_inline int parts_avg(int ci, int ni); -#else -inline int parts_avg(int ci, int ni); -#endif - -int nearest_part(int ci, int t); - -void update_particles_i(pixel *vid, int start, int inc); - -void update_particles(pixel *vid); - -void clear_area(int area_x, int area_y, int area_w, int area_h); - -void create_box(int x1, int y1, int x2, int y2, int c); - -int flood_parts(int x, int y, int c, int cm, int bm); - -int create_parts(int x, int y, int r, int c); - -void create_line(int x1, int y1, int x2, int y2, int r, int c); - -#endif diff --git a/update.c b/update.c deleted file mode 100644 index ba32b54..0000000 --- a/update.c +++ /dev/null @@ -1,201 +0,0 @@ -/** - * Powder Toy - Update Helper - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * Copyright (c) 2010 Simon Robertshaw - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#ifndef MACOSX -#include -#endif -#include - -#ifdef WIN32 -#include -#else -#include -#include -#endif -#ifdef MACOSX -#include -#include -#include -#endif - -#include "update.h" - -static char *exe_name(void) -{ -#if defined WIN32 - char *name= (char *)malloc(64), max=64, res; - while((res = (char)GetModuleFileName(NULL, name, max)) >= max) - { -#elif defined MACOSX - char *fn=malloc(64),*name=malloc(PATH_MAX), max=64, res; - if(_NSGetExecutablePath(fn, &max) != 0) - { - fn = realloc(fn, max); - _NSGetExecutablePath(fn, &max); - } - if(realpath(fn, name) == NULL) - { - free(fn); - free(name); - return NULL; - } - res = 1; -#else - char fn[64], *name=malloc(64), max=64, res; - sprintf(fn, "/proc/self/exe"); - memset(name, 0, max); - while((res = readlink(fn, name, max)) >= max-1) - { -#endif -#ifndef MACOSX - max *= 2; - name = realloc(name, max); - memset(name, 0, max); - } -#endif - if(res <= 0) - { - free(name); - return NULL; - } - return name; -} - -int update_start(char *data, int len) -{ - char *self=exe_name(), *temp; -#ifdef WIN32 - char *p; -#endif - FILE *f; - int res = 1; - - if(!self) - return 1; - -#ifdef WIN32 - temp = malloc(strlen(self)+12); - strcpy(temp, self); - p = temp + strlen(temp) - 4; - if(_stricmp(p, ".exe")) - p += 4; - strcpy(p, "_update.exe"); - - if(!MoveFile(self, temp)) - goto fail; - - f = fopen(self, "wb"); - if(!f) - goto fail; - if(fwrite(data, 1, len, f) != len) - { - fclose(f); - DeleteFile(self); - goto fail; - } - fclose(f); - - if((int)ShellExecute(NULL, "open", self, NULL, NULL, SW_SHOWNORMAL) <= 32) - { - DeleteFile(self); - goto fail; - } - - return 0; -#else - temp = malloc(strlen(self)+8); - strcpy(temp, self); - strcat(temp, "-update"); - - f = fopen(temp, "w"); - if(!f) - goto fail; - if(fwrite(data, 1, len, f) != len) - { - fclose(f); - unlink(temp); - goto fail; - } - fclose(f); - - if(chmod(temp, 0755)) - { - unlink(temp); - goto fail; - } - - if(rename(temp, self)) - { - unlink(temp); - goto fail; - } - - execl(self, "powder-update", NULL); -#endif - -fail: - free(temp); - free(self); - return res; -} - -int update_finish(void) -{ -#ifdef WIN32 - char *temp, *self=exe_name(), *p; - int timeout = 60, err; - - temp = malloc(strlen(self)+12); - strcpy(temp, self); - p = temp + strlen(temp) - 4; - if(_stricmp(p, ".exe")) - p += 4; - strcpy(p, "_update.exe"); - - while(!DeleteFile(temp)) - { - err = GetLastError(); - if(err == ERROR_FILE_NOT_FOUND) - { - // just as well, then - free(temp); - return 0; - } - Sleep(500); - timeout--; - if(timeout <= 0) - { - free(temp); - return 1; - } - } - free(temp); -#endif - return 0; -} - -void update_cleanup(void) -{ -#ifdef WIN32 - update_finish(); -#endif -} diff --git a/update.h b/update.h deleted file mode 100755 index 6398d4d..0000000 --- a/update.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Powder Toy - Main source - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef UPDATE_H -#define UPDATE_H - -int update_start(char *data, int len); -int update_finish(void); -void update_cleanup(void); - -#endif diff --git a/version.h b/version.h deleted file mode 100755 index 41e9672..0000000 --- a/version.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Powder Toy - Version (Header) - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef VERSION_H -#define VERSION_H - - - -#endif -- cgit v0.9.2-21-gd62e From 07283c6f5507816bb76b1752b306c3806d7280da Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 27 Sep 2010 12:55:39 +0200 Subject: Try to automerge with this, haha diff --git a/Resources/Font-Data b/Resources/Font-Data deleted file mode 100644 index a384152..0000000 Binary files a/Resources/Font-Data and /dev/null differ diff --git a/Resources/Font-Pointers b/Resources/Font-Pointers deleted file mode 100644 index 621258b..0000000 Binary files a/Resources/Font-Pointers and /dev/null differ diff --git a/Resources/Icon-16.png b/Resources/Icon-16.png deleted file mode 100755 index 5e1e1fb..0000000 Binary files a/Resources/Icon-16.png and /dev/null differ diff --git a/Resources/Icon-32.png b/Resources/Icon-32.png deleted file mode 100755 index 1f056bd..0000000 Binary files a/Resources/Icon-32.png and /dev/null differ diff --git a/Resources/powder-res.rc b/Resources/powder-res.rc deleted file mode 100644 index 569b629..0000000 --- a/Resources/powder-res.rc +++ /dev/null @@ -1,2 +0,0 @@ -#define IDI_ICON1 101 -IDI_ICON1 ICON DISCARDABLE "powder.ico" diff --git a/Resources/powder.icns b/Resources/powder.icns deleted file mode 100755 index 56df7eb..0000000 Binary files a/Resources/powder.icns and /dev/null differ diff --git a/Resources/powder.ico b/Resources/powder.ico deleted file mode 100755 index cd3f6e0..0000000 Binary files a/Resources/powder.ico and /dev/null differ -- cgit v0.9.2-21-gd62e From 307e329dd7d82d76bf25840c0eec28aaaa52e876 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 27 Sep 2010 12:56:56 +0200 Subject: forgot one file diff --git a/http.c b/http.c deleted file mode 100644 index 4713b37..0000000 --- a/http.c +++ /dev/null @@ -1,1051 +0,0 @@ -/** - * Powder Toy - HTTP Library - * - * Copyright (c) 2008 - 2010 Stanislaw Skowronek. - * Copyright (c) 2010 Simon Robertshaw - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include -#include -#include -#ifndef MACOSX -#include -#endif -#include -#ifdef WIN32 -#define _WIN32_WINNT 0x0501 -//#include -#include -#include -#else -#include -#include -#include -#include -#include -#include -#include -#endif - -#include "defines.h" -#include "http.h" -#include "md5.h" - -#ifdef WIN32 -#define PERROR SOCKET_ERROR -#define PERRNO WSAGetLastError() -#define PEAGAIN WSAEWOULDBLOCK -#define PEINTR WSAEINTR -#define PEINPROGRESS WSAEINPROGRESS -#define PEALREADY WSAEALREADY -#define PCLOSE closesocket -#else -#define PERROR -1 -#define PERRNO errno -#define PEAGAIN EAGAIN -#define PEINTR EINTR -#define PEINPROGRESS EINPROGRESS -#define PEALREADY EALREADY -#define PCLOSE close -#endif - -static int http_up = 0; -static long http_timeout = 15; -static int http_use_proxy = 0; -static struct sockaddr_in http_proxy; - -static char *mystrdup(char *s) -{ - char *x; - if(s) - { - x = malloc(strlen(s)+1); - strcpy(x, s); - return x; - } - return s; -} - -static int splituri(char *uri, char **host, char **path) -{ - char *p=uri,*q,*x,*y; - if(!strncmp(p, "http://", 7)) - p += 7; - q = strchr(p, '/'); - if(!q) - q = p + strlen(p); - x = malloc(q-p+1); - if(*q) - y = mystrdup(q); - else - y = mystrdup("/"); - strncpy(x, p, q-p); - x[q-p] = 0; - if(q==p || x[q-p-1]==':') - { - free(x); - free(y); - return 1; - } - *host = x; - *path = y; - return 0; -} - -static char *getserv(char *host) -{ - char *q, *x = mystrdup(host); - q = strchr(x, ':'); - if(q) - *q = 0; - return x; -} - -static char *getport(char *host) -{ - char *p, *q; - q = strchr(host, ':'); - if(q) - p = mystrdup(q+1); - else - p = mystrdup("80"); - return p; -} - -static int resolve(char *dns, char *srv, struct sockaddr_in *addr) -{ - struct addrinfo hnt, *res = 0; - if(http_use_proxy) - { - memcpy(addr, &http_proxy, sizeof(struct sockaddr_in)); - return 0; - } - memset(&hnt, 0, sizeof(hnt)); - hnt.ai_family = AF_INET; - hnt.ai_socktype = SOCK_STREAM; - if(getaddrinfo(dns, srv, &hnt, &res)) - return 1; - if(res) - { - if(res->ai_family != AF_INET) - { - freeaddrinfo(res); - return 1; - } - memcpy(addr, res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); - return 0; - } - return 1; -} - -void http_init(char *proxy) -{ - char *host, *port; -#ifdef WIN32 - WSADATA wsadata; - if(!WSAStartup(MAKEWORD(2,2), &wsadata)) - http_up = 1; -#else - signal(SIGPIPE, SIG_IGN); - http_up = 1; -#endif - if(proxy) - { - host = getserv(proxy); - port = getport(proxy); - if(resolve(host, port, &http_proxy)) - http_up = 0; - else - http_use_proxy = 1; - free(host); - free(port); - } -} - -void http_done(void) -{ -#ifdef WIN32 - WSACleanup(); -#endif - http_up = 0; -} - -#define CHUNK 4096 - -#define HTS_STRT 0 -#define HTS_RSLV 1 -#define HTS_CONN 2 -#define HTS_IDLE 3 -#define HTS_XMIT 4 -#define HTS_RECV 5 -#define HTS_DONE 6 -struct http_ctx -{ - int state; - time_t last; - int keep; - int ret; - char *host, *path; - char *thdr; - int thlen; - char *txd; - int txdl; - struct sockaddr_in addr; - char *tbuf; - int tlen, tptr; - char *hbuf; - int hlen, hptr; - char *rbuf; - int rlen, rptr; - int chunked, chunkhdr, rxtogo, contlen, cclose; - int fd; - char *fdhost; -}; -void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep) -{ - struct http_ctx *cx = ctx; - if(!ctx) - { - ctx = calloc(1, sizeof(struct http_ctx)); - cx = ctx; - cx->fd = PERROR; - } - - if(!cx->hbuf) - { - cx->hbuf = malloc(256); - cx->hlen = 256; - } - - if(!http_up) - { - cx->ret = 604; - cx->state = HTS_DONE; - return ctx; - } - - if(cx->state!=HTS_STRT && cx->state!=HTS_IDLE) - { - fprintf(stderr, "HTTP: unclean request restart state.\n"); - exit(1); - } - - cx->keep = keep; - cx->ret = 600; - if(splituri(uri, &cx->host, &cx->path)) - { - cx->ret = 601; - cx->state = HTS_DONE; - return ctx; - } - if(http_use_proxy) - { - free(cx->path); - cx->path = mystrdup(uri); - } - if(cx->fdhost && strcmp(cx->host, cx->fdhost)) - { - free(cx->fdhost); - cx->fdhost = NULL; - PCLOSE(cx->fd); - cx->fd = PERROR; - cx->state = HTS_STRT; - } - if(data) - { - if(!dlen) - dlen = strlen(data); - cx->txd = malloc(dlen); - memcpy(cx->txd, data, dlen); - cx->txdl = dlen; - } - else - cx->txdl = 0; - - cx->contlen = 0; - cx->chunked = 0; - cx->chunkhdr = 0; - cx->rxtogo = 0; - cx->cclose = 0; - - cx->tptr = 0; - cx->tlen = 0; - - cx->last = time(NULL); - - return ctx; -} - -void http_async_add_header(void *ctx, char *name, char *data) -{ - struct http_ctx *cx = ctx; - cx->thdr = realloc(cx->thdr, cx->thlen + strlen(name) + strlen(data) + 4); - cx->thlen += sprintf(cx->thdr+cx->thlen, "%s: %s\n", name, data); -} - -static void process_header(struct http_ctx *cx, char *str) -{ - char *p; - if(cx->chunkhdr) - { - p = strchr(str, ';'); - if(p) - *p = 0; - cx->rxtogo = strtoul(str, NULL, 16); - cx->chunkhdr = 0; - if(!cx->rxtogo) - cx->chunked = 0; - } - if(!str[0]) - { - cx->rxtogo = cx->contlen; - cx->chunkhdr = cx->chunked; - if(!cx->contlen && !cx->chunked && cx->ret!=100) - cx->state = HTS_DONE; - return; - } - if(!strncmp(str, "HTTP/", 5)) - { - p = strchr(str, ' '); - if(!p) - { - cx->ret = 603; - cx->state = HTS_DONE; - return; - } - p++; - cx->ret = atoi(p); - return; - } - if(!strncmp(str, "Content-Length: ", 16)) - { - cx->contlen = atoi(str+16); - return; - } - if(!strcmp(str, "Transfer-Encoding: chunked")) - { - cx->chunked = 1; - return; - } - if(!strcmp(str, "Connection: close")) - { - cx->cclose = 1; - return; - } -} - -static void process_byte(struct http_ctx *cx, char ch) -{ - if(cx->rxtogo) - { - cx->rxtogo--; - - if(!cx->rbuf) - { - cx->rbuf = malloc(256); - cx->rlen = 256; - } - if(cx->rptr >= cx->rlen-1) - { - cx->rlen *= 2; - cx->rbuf = realloc(cx->rbuf, cx->rlen); - } - cx->rbuf[cx->rptr++] = ch; - - if(!cx->rxtogo && !cx->chunked) - cx->state = HTS_DONE; - } - else - { - if(ch == '\n') - { - cx->hbuf[cx->hptr] = 0; - process_header(cx, cx->hbuf); - cx->hptr = 0; - } - else if(ch != '\r') - { - if(cx->hptr >= cx->hlen-1) - { - cx->hlen *= 2; - cx->hbuf = realloc(cx->hbuf, cx->hlen); - } - cx->hbuf[cx->hptr++] = ch; - } - } -} - -int http_async_req_status(void *ctx) -{ - struct http_ctx *cx = ctx; - char *dns,*srv,buf[CHUNK]; - int tmp, i; - time_t now = time(NULL); -#ifdef WIN32 - unsigned long tmp2; -#endif - - switch(cx->state) - { - case HTS_STRT: - dns = getserv(cx->host); - srv = getport(cx->host); - if(resolve(dns, srv, &cx->addr)) - { - free(dns); - free(srv); - cx->state = HTS_DONE; - cx->ret = 602; - return 1; - } - free(dns); - free(srv); - cx->state = HTS_RSLV; - return 0; - case HTS_RSLV: - cx->state = HTS_CONN; - cx->last = now; - return 0; - case HTS_CONN: - if(cx->fd == PERROR) - { - cx->fd = socket(AF_INET, SOCK_STREAM, 0); - if(cx->fd == PERROR) - goto fail; - cx->fdhost = mystrdup(cx->host); -#ifdef WIN32 - tmp2 = 1; - if(ioctlsocket(cx->fd, FIONBIO, &tmp2) == SOCKET_ERROR) - goto fail; -#else - tmp = fcntl(cx->fd, F_GETFL); - if(tmp < 0) - goto fail; - if(fcntl(cx->fd, F_SETFL, tmp|O_NONBLOCK) < 0) - goto fail; -#endif - } - if(!connect(cx->fd, (struct sockaddr *)&cx->addr, sizeof(cx->addr))) - cx->state = HTS_IDLE; -#ifdef WIN32 - else if(PERRNO==WSAEISCONN) - cx->state = HTS_IDLE; -#endif -#ifdef MACOSX - else if(PERRNO==EISCONN) - cx->state = HTS_IDLE; -#endif - else if(PERRNO!=PEINPROGRESS && PERRNO!=PEALREADY -#ifdef WIN32 - && PERRNO!=PEAGAIN && PERRNO!=WSAEINVAL -#endif - ) - goto fail; - if(now-cx->last>http_timeout) - goto timeout; - return 0; - case HTS_IDLE: - if(cx->txdl) - { - // generate POST - cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 121 + cx->txdl + cx->thlen); - cx->tptr = 0; - cx->tlen = 0; - cx->tlen += sprintf(cx->tbuf+cx->tlen, "POST %s HTTP/1.1\n", cx->path); - cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host); - if(!cx->keep) - cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n"); - if(cx->thdr) - { - memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen); - cx->tlen += cx->thlen; - free(cx->thdr); - cx->thdr = NULL; - cx->thlen = 0; - } - cx->tlen += sprintf(cx->tbuf+cx->tlen, "Content-Length: %d\n", cx->txdl); -#ifdef BETA - cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); -#else - cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dS%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); -#endif - cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n"); - memcpy(cx->tbuf+cx->tlen, cx->txd, cx->txdl); - cx->tlen += cx->txdl; - free(cx->txd); - cx->txd = NULL; - cx->txdl = 0; - } - else - { - // generate GET - cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 89 + cx->thlen); - cx->tptr = 0; - cx->tlen = 0; - cx->tlen += sprintf(cx->tbuf+cx->tlen, "GET %s HTTP/1.1\n", cx->path); - cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host); - if(cx->thdr) - { - memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen); - cx->tlen += cx->thlen; - free(cx->thdr); - cx->thdr = NULL; - cx->thlen = 0; - } - if(!cx->keep) - cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n"); -#ifdef BETA - cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dB%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); -#else - cx->tlen += sprintf(cx->tbuf+cx->tlen, "X-Powder-Version: %s%dS%d\n", IDENT_VERSION, SAVE_VERSION, MINOR_VERSION); -#endif - cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n"); - } - cx->state = HTS_XMIT; - cx->last = now; - return 0; - case HTS_XMIT: - tmp = send(cx->fd, cx->tbuf+cx->tptr, cx->tlen-cx->tptr, 0); - if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR) - goto fail; - if(tmp!=PERROR) - { - cx->tptr += tmp; - if(cx->tptr == cx->tlen) - { - cx->tptr = 0; - cx->tlen = 0; - if(cx->tbuf) - free(cx->tbuf); - cx->state = HTS_RECV; - } - cx->last = now; - } - if(now-cx->last>http_timeout) - goto timeout; - return 0; - case HTS_RECV: - tmp = recv(cx->fd, buf, CHUNK, 0); - if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR) - goto fail; - if(tmp!=PERROR) - { - for(i=0; istate == HTS_DONE) - return 1; - } - cx->last = now; - } - if(now-cx->last>http_timeout) - goto timeout; - return 0; - case HTS_DONE: - return 1; - } - return 0; - -fail: - cx->ret = 600; - cx->state = HTS_DONE; - return 1; - -timeout: - cx->ret = 605; - cx->state = HTS_DONE; - return 1; -} - -char *http_async_req_stop(void *ctx, int *ret, int *len) -{ - struct http_ctx *cx = ctx; - char *rxd; - - if(cx->state != HTS_DONE) - while(!http_async_req_status(ctx)) ; - - if(cx->host) - { - free(cx->host); - cx->host = NULL; - } - if(cx->path) - { - free(cx->path); - cx->path = NULL; - } - if(cx->txd) - { - free(cx->txd); - cx->txd = NULL; - cx->txdl = 0; - } - if(cx->hbuf) - { - free(cx->hbuf); - cx->hbuf = NULL; - } - if(cx->thdr) - { - free(cx->thdr); - cx->thdr = NULL; - cx->thlen = 0; - } - - if(ret) - *ret = cx->ret; - if(len) - *len = cx->rptr; - if(cx->rbuf) - cx->rbuf[cx->rptr] = 0; - rxd = cx->rbuf; - cx->rbuf = NULL; - cx->rlen = 0; - cx->rptr = 0; - cx->contlen = 0; - - if(!cx->keep) - http_async_req_close(ctx); - else if(cx->cclose) - { - PCLOSE(cx->fd); - cx->fd = PERROR; - if(cx->fdhost) - { - free(cx->fdhost); - cx->fdhost = NULL; - } - cx->state = HTS_STRT; - } - else - cx->state = HTS_IDLE; - - return rxd; -} - -void http_async_get_length(void *ctx, int *total, int *done) -{ - struct http_ctx *cx = ctx; - if(done) - *done = cx->rptr; - if(total) - *total = cx->contlen; -} - -void http_async_req_close(void *ctx) -{ - struct http_ctx *cx = ctx; - void *tmp; - if(cx->host) - { - cx->keep = 1; - tmp = http_async_req_stop(ctx, NULL, NULL); - if(tmp) - free(tmp); - } - if(cx->fdhost) - free(cx->fdhost); - PCLOSE(cx->fd); - free(ctx); -} - -char *http_simple_get(char *uri, int *ret, int *len) -{ - void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0); - if(!ctx) - { - if(ret) - *ret = 600; - if(len) - *len = 0; - return NULL; - } - return http_async_req_stop(ctx, ret, len); -} -static char hex[] = "0123456789abcdef"; -void http_auth_headers(void *ctx, char *user, char *pass) -{ - char *tmp; - int i; - unsigned char hash[16]; - unsigned int m; - struct md5_context md5; - - if(user) - { - http_async_add_header(ctx, "X-Auth-User", user); - if(pass) - { - md5_init(&md5); - md5_update(&md5, (unsigned char *)user, strlen(user)); - md5_update(&md5, (unsigned char *)"-", 1); - m = 0; - - md5_update(&md5, (unsigned char *)pass, strlen(pass)); - md5_final(hash, &md5); - tmp = malloc(33); - for(i=0; i<16; i++) - { - tmp[i*2] = hex[hash[i]>>4]; - tmp[i*2+1] = hex[hash[i]&15]; - } - tmp[32] = 0; - http_async_add_header(ctx, "X-Auth-Hash", tmp); - free(tmp); - } - } -} -char *http_auth_get(char *uri, char *user, char *pass, int *ret, int *len) -{ - void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0); - - if(!ctx) - { - if(ret) - *ret = 600; - if(len) - *len = 0; - return NULL; - } - return http_async_req_stop(ctx, ret, len); -} - -char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len) -{ - void *ctx = http_async_req_start(NULL, uri, data, dlen, 0); - if(!ctx) - { - if(ret) - *ret = 600; - if(len) - *len = 0; - return NULL; - } - return http_async_req_stop(ctx, ret, len); -} - -char *http_ret_text(int ret) -{ - switch(ret) - { - case 100: - return "Continue"; - case 101: - return "Switching Protocols"; - case 102: - return "Processing"; - - case 200: - return "OK"; - case 201: - return "Created"; - case 202: - return "Accepted"; - case 203: - return "Non-Authoritative Information"; - case 204: - return "No Content"; - case 205: - return "Reset Content"; - case 206: - return "Partial Content"; - case 207: - return "Multi-Status"; - - case 300: - return "Multiple Choices"; - case 301: - return "Moved Permanently"; - case 302: - return "Found"; - case 303: - return "See Other"; - case 304: - return "Not Modified"; - case 305: - return "Use Proxy"; - case 306: - return "Switch Proxy"; - case 307: - return "Temporary Redirect"; - - case 400: - return "Bad Request"; - case 401: - return "Unauthorized"; - case 402: - return "Payment Required"; - case 403: - return "Forbidden"; - case 404: - return "Not Found"; - case 405: - return "Method Not Allowed"; - case 406: - return "Not Acceptable"; - case 407: - return "Proxy Authentication Required"; - case 408: - return "Request Timeout"; - case 409: - return "Conflict"; - case 410: - return "Gone"; - case 411: - return "Length Required"; - case 412: - return "Precondition Failed"; - case 413: - return "Request Entity Too Large"; - case 414: - return "Request URI Too Long"; - case 415: - return "Unsupported Media Type"; - case 416: - return "Requested Range Not Satisfiable"; - case 417: - return "Expectation Failed"; - case 422: - return "Unprocessable Entity"; - case 423: - return "Locked"; - case 424: - return "Failed Dependency"; - case 425: - return "Unordered Collection"; - case 426: - return "Upgrade Required"; - - case 500: - return "Internal Server Error"; - case 501: - return "Not Implemented"; - case 502: - return "Bad Gateway"; - case 503: - return "Service Unavailable"; - case 504: - return "Gateway Timeout"; - case 505: - return "HTTP Version Not Supported"; - case 506: - return "Variant Also Negotiates"; - case 507: - return "Insufficient Storage"; - case 509: - return "Bandwidth Limit Exceeded"; - case 510: - return "Not Extended"; - - case 600: - return "Internal Client Error"; - case 601: - return "Unsupported Protocol"; - case 602: - return "Server Not Found"; - case 603: - return "Malformed Response"; - case 604: - return "Network Not Available"; - case 605: - return "Request Timed Out"; - default: - return "Unknown Status Code"; - } -} -char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, int *ret, int *len) -{ - void *ctx; - char *data = NULL, *tmp, *p; - int dlen = 0, i, j; - unsigned char hash[16]; - unsigned char boundary[32], ch; - int blen = 0; - unsigned int map[62], m; - struct md5_context md5; - //struct md5_context md52; - int own_plen = 0; - - if(names) - { - if(!plens) - { - own_plen = 1; - for(i=0; names[i]; i++) ; - plens = calloc(i, sizeof(int)); - for(i=0; names[i]; i++) - plens[i] = strlen(parts[i]); - } - -retry: - if(blen >= 31) - goto fail; - memset(map, 0, 62*sizeof(int)); - for(i=0; names[i]; i++) - { - for(j=0; j='0' && ch<='9') - map[ch-'0']++; - else if(ch>='A' && ch<='Z') - map[ch-'A'+10]++; - else if(ch>='a' && ch<='z') - map[ch-'a'+36]++; - } - } - m = ~0; - j = 61; - for(i=0; i<62; i++) - if(map[i]>4]; - tmp[i*2+1] = hex[hash[i]&15]; - } - tmp[32] = 0; - http_async_add_header(ctx, "X-Auth-Hash", tmp); - free(tmp); - } - } - - if(data) - { - tmp = malloc(32+strlen((char *)boundary)); - sprintf(tmp, "multipart/form-data, boundary=%s", boundary); - http_async_add_header(ctx, "Content-type", tmp); - free(tmp); - free(data); - } - - if(own_plen) - free(plens); - return http_async_req_stop(ctx, ret, len); - -fail: - if(data) - free(data); - if(own_plen) - free(plens); - if(ret) - *ret = 600; - if(len) - *len = 0; - return NULL; -} -- cgit v0.9.2-21-gd62e From e3bbf00333a85c323bb7da97cb75e7e9788ee697 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 27 Sep 2010 13:07:57 +0200 Subject: fixed gitignore diff --git a/.gitignore b/.gitignore index a6b7508..2cbf1f6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ powder.def powder-debug gmon.out *.*.orig -build/ +build/* -- cgit v0.9.2-21-gd62e From 0a9d6adca47eae3b2c06c958a69352adeda4daca Mon Sep 17 00:00:00 2001 From: FacialTurd Date: Mon, 27 Sep 2010 12:34:04 -0700 Subject: Makes insulator block electrodes diff --git a/src/powder.c b/src/powder.c index 5400b7b..15a2afe 100644 --- a/src/powder.c +++ b/src/powder.c @@ -447,6 +447,7 @@ _inline int parts_avg(int ci, int ni) } } + int nearest_part(int ci, int t) { int distance = sqrt(pow(XRES, 2)+pow(YRES, 2)); @@ -705,7 +706,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) { nearp = nearest_part(i, PT_ETRD); - if(nearp!=-1) + if(nearp!=-1&&parts_avg(i, nearp)!=PT_INSL) { create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, PT_PLSM); t = parts[i].type = PT_ETRD; -- cgit v0.9.2-21-gd62e From 6e81c2a88cc9a2bda3189b01b4edd5da1a0bd0a8 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 2 Oct 2010 17:59:24 +0200 Subject: Added reflection, thanks to Skylark diff --git a/includes/font.h b/includes/font.h index f8f9a58..38448d1 100644 --- a/includes/font.h +++ b/includes/font.h @@ -21,6 +21,7 @@ #ifndef FONT_H_CHECK #define FONT_H_CHECK #define FONT_H 10 +#ifdef INCLUDE_FONTDATA static char font_data[] = { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc7, 0x31, 0x0c, 0x02, 0x70, 0x04, 0x00, 0x00, 0x05, 0xcc, 0x74, 0x23, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x80, 0x19, 0xcc, 0xe0, 0x3f, 0xcc, 0xf0, 0x2f, 0xcc, 0x90, 0x09, 0x00, 0x00, 0x00, 0x06, 0x30, 0xd0, 0x3f, 0x33, 0xe1, 0x07, 0xf4, 0x12, 0x33, 0xff, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x2d, 0xce, 0xcc, 0xe1, 0x1d, 0xc0, 0x03, 0x74, 0x4b, 0x33, 0xb3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7d, 0x30, 0x0c, 0x13, 0xd0, 0x32, 0xb3, 0x33, 0x1c, 0x7d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x4c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x34, 0x1d, 0x07, 0x03, 0x07, 0x1d, 0x34, 0x00, 0x00, 0x00, 0x04, 0x07, 0x1d, 0x34, 0x30, 0x34, 0x1d, 0x07, 0x00, 0x00, 0x00, 0x06, 0x44, 0xd0, 0x1c, 0x64, 0xf0, 0x3f, 0x64, 0xd0, 0x1c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x02, 0x30, 0xe0, 0x2f, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x06, 0x80, 0x02, 0x0c, 0xa0, 0x00, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, 0xe0, 0x39, 0x07, 0x33, 0x32, 0x03, 0xb3, 0x38, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x30, 0xf0, 0x60, 0x03, 0x0c, 0x30, 0xc0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x41, 0x03, 0x0a, 0x2c, 0x70, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0x71, 0x34, 0x01, 0x03, 0x1e, 0x00, 0x33, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xc0, 0x03, 0x37, 0x1c, 0x73, 0x34, 0xbf, 0x03, 0x30, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x00, 0x57, 0xe0, 0x2f, 0x00, 0x13, 0x30, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd3, 0x00, 0x07, 0xf0, 0x1f, 0x03, 0x33, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x07, 0x34, 0x80, 0x03, 0x0e, 0x38, 0xd0, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xd3, 0x1f, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x34, 0x03, 0xc3, 0x3f, 0x40, 0x23, 0x30, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x70, 0x04, 0x40, 0x70, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x0c, 0x0d, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc0, 0xc3, 0x0b, 0x1b, 0xc0, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x0f, 0x90, 0x83, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfd, 0x71, 0x30, 0x81, 0x03, 0x0e, 0x34, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0x0f, 0x1d, 0x30, 0xe7, 0x37, 0x73, 0x1c, 0xe3, 0x2f, 0x07, 0x00, 0xfd, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x74, 0xd0, 0x1d, 0x47, 0x33, 0x30, 0xff, 0x33, 0x30, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xbf, 0x30, 0x38, 0x43, 0xf3, 0x1f, 0x43, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x31, 0x00, 0x03, 0x70, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x33, 0x30, 0x03, 0x33, 0x34, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x32, 0x00, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x10, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x33, 0x10, 0x03, 0xf0, 0x0b, 0x03, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf4, 0xd1, 0x34, 0x03, 0x30, 0x3e, 0x03, 0x73, 0x34, 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x47, 0x33, 0x30, 0x03, 0xf3, 0x3f, 0x03, 0x33, 0x30, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x06, 0xd0, 0x01, 0x0c, 0xc0, 0x00, 0x0c, 0xc0, 0x10, 0x0d, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0xc3, 0x34, 0x70, 0x03, 0xbc, 0x00, 0xb3, 0xc0, 0xb0, 0x70, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x30, 0x10, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x1f, 0x3d, 0x7b, 0x3b, 0xe3, 0x32, 0x83, 0x30, 0x03, 0x30, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0xcd, 0x03, 0x73, 0xc3, 0x8c, 0x32, 0xc3, 0xcd, 0xc0, 0x33, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xc7, 0x71, 0xd0, 0x0c, 0x30, 0x03, 0xcd, 0xd1, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f, 0x30, 0x1d, 0x43, 0x73, 0x34, 0xff, 0x31, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xf4, 0x41, 0xd3, 0x71, 0xd0, 0x0c, 0x30, 0xc3, 0xcd, 0xd1, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x31, 0x34, 0x03, 0xf3, 0x0f, 0xd7, 0x30, 0x34, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfc, 0xb1, 0x31, 0x07, 0xd0, 0x0f, 0x90, 0x23, 0x34, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x13, 0x13, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xcc, 0x00, 0x33, 0xc0, 0x0c, 0x30, 0x03, 0xcd, 0xd2, 0xd1, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x33, 0x30, 0x03, 0xb3, 0x38, 0xcd, 0xc1, 0x0d, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x30, 0x43, 0x30, 0xc7, 0x34, 0xcd, 0x1c, 0xed, 0x1e, 0x2c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0x4c, 0xc3, 0x81, 0x3b, 0xd0, 0x03, 0xdc, 0x42, 0xc3, 0x31, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0xb3, 0x38, 0xdc, 0x40, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xd0, 0x02, 0x2c, 0xc0, 0x02, 0x2d, 0xc0, 0x06, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x2f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x03, 0x28, 0xc0, 0x00, 0x0a, 0x30, 0x80, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x04, 0x1d, 0x37, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x47, 0x30, 0xfc, 0x0c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x07, 0x0c, 0xf0, 0xc7, 0x35, 0xc3, 0x0c, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc3, 0x25, 0x03, 0x4c, 0xd2, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0xd0, 0x00, 0x83, 0x8f, 0x33, 0xc3, 0x1c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xbf, 0x0c, 0xd0, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x04, 0x3d, 0x07, 0x03, 0x2f, 0x03, 0x03, 0x07, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xcb, 0x32, 0xc3, 0xf4, 0x03, 0x4c, 0x30, 0x7e, 0x00, 0x00, 0x05, 0x03, 0x0c, 0xf0, 0xc7, 0x39, 0xc3, 0x0c, 0x73, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x1c, 0x00, 0x0d, 0x0c, 0x0c, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x30, 0x00, 0x34, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x05, 0x03, 0x0c, 0x31, 0xce, 0x0e, 0x1f, 0xcc, 0x31, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x47, 0x3d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x9b, 0x71, 0x37, 0x33, 0x33, 0x32, 0x43, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x0c, 0x33, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x31, 0xc3, 0x4c, 0xd3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xc7, 0x31, 0xc3, 0x4c, 0xf3, 0xc7, 0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xdf, 0x31, 0xc3, 0x4c, 0xd3, 0x0f, 0x30, 0xc0, 0x00, 0x05, 0x03, 0x00, 0x30, 0x7f, 0xc7, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xc0, 0xc7, 0x10, 0x3c, 0x04, 0xf3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c, 0x1c, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x70, 0xdc, 0x30, 0xc3, 0x4c, 0xd3, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xd3, 0xdc, 0xc2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x33, 0x32, 0x33, 0x73, 0x37, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcd, 0x32, 0x7d, 0x8c, 0x73, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x30, 0xcc, 0x30, 0xc7, 0x74, 0x43, 0x07, 0x0c, 0x1f, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x4f, 0x2c, 0x2c, 0x2c, 0xf1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x04, 0x38, 0x0c, 0x0c, 0x03, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x02, 0x32, 0x33, 0x33, 0x13, 0x00, 0x04, 0x0b, 0x0c, 0x0c, 0x30, 0x0c, 0x0c, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x72, 0x37, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, 0x07, 0xff, 0x1f, 0xff, 0x7f, 0xff, 0x1b, 0xbf, 0x01, 0x1b, 0x00, 0x0c, 0x00, 0x40, 0xff, 0x00, 0x00, 0xf8, 0xf0, 0x3f, 0xee, 0x2c, 0x30, 0xcb, 0x0b, 0x30, 0x42, 0xc3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xf3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xff, 0x3f, 0x00, 0x0c, 0xc2, 0x00, 0x00, 0xcb, 0x00, 0x00, 0xee, 0xc0, 0xff, 0xf8, 0xb0, 0xc0, 0xff, 0x2c, 0xc0, 0x00, 0x0c, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xcc, 0xcf, 0x00, 0x0c, 0xc0, 0x00, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0x0d, 0x00, 0x70, 0x00, 0x00, 0xf3, 0xff, 0xd3, 0x03, 0xe0, 0x3c, 0x3f, 0x38, 0x03, 0xd0, 0x33, 0xff, 0x38, 0x03, 0xe0, 0xf0, 0xff, 0x03, 0x0c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x8b, 0xf7, 0x0c, 0x13, 0x9f, 0x3b, 0x37, 0x00, 0xc0, 0x23, 0xff, 0xff, 0x8b, 0x03, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd0, 0x7f, 0x80, 0x03, 0x2c, 0x0d, 0x00, 0x37, 0x00, 0xc0, 0xf3, 0xff, 0x3c, 0xff, 0xcf, 0x03, 0x00, 0xdc, 0x00, 0x70, 0x38, 0xc0, 0x02, 0xfd, 0x07, 0x0a, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xf0, 0xff, 0xc0, 0xff, 0x3f, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0xfc, 0xff, 0x03, 0xff, 0x0f, 0xc0, 0x3f, 0x00, 0x00, 0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xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0xf8, 0xff, 0x02, 0xfd, 0x07, 0x0a, 0x40, 0x01, 0x00, 0x02, 0x00, 0xc8, 0x07, 0x10, 0xc3, 0x00, 0x31, 0x0d, 0x00, 0xfd, 0x01, 0x00, 0x74, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x0f, 0x0f, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x0a, 0x40, 0x05, 0x80, 0xff, 0x8b, 0x1e, 0xd0, 0x2e, 0x00, 0xf0, 0x00, 0xe0, 0xff, 0x0b, 0x00, 0x0f, 0x00, 0xb8, 0x03, 0xb0, 0xe2, 0xff, 0x02, 0x50, 0x01, 0x08, 0xff, 0x07, 0x03, 0x1e, 0x03, 0x73, 0x03, 0xef, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x2f, 0xe0, 0x1b, 0x0c, 0x1d, 0x00, 0xff, 0x03, 0xbe, 0xf0, 0xc1, 0x01, 0xad, 0x34, 0xc0, 0x36, 0x0b, 0x30, 0xdc, 0xe4, 0x07, 0xfd, 0x1b, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0xa0, 0xaa, 0x00, 0xa8, 0xc2, 0x0f, 0x2a, 0xff, 0x03, 0xca, 0x3f, 0x80, 0xfc, 0x0f, 0x20, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x07, 0xaa, 0xea, 0x1f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xaa, 0xea, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x03, 0x00, 0xd0, 0x03, 0x00, 0xf4, 0xab, 0xaa, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xf4, 0xab, 0xaa, 0xd0, 0x03, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x09, 0xfe, 0xff, 0xe3, 0xff, 0x0f, 0xaa, 0x3e, 0x0a, 0xf8, 0x2e, 0xe0, 0xbf, 0x80, 0xff, 0xaa, 0xfe, 0xff, 0xe2, 0xff, 0x02, 0x02, 0x00, 0x00, 0x09, 0x00, 0x80, 0x04, 0xd0, 0xe2, 0xff, 0x02, 0x00, 0x00, 0xff, 0x6f, 0x00, 0x40, 0xe6, 0xaf, 0x50, 0x00, 0x09, 0x00, 0x20, 0x00, 0x64, 0x00, 0x09, 0xe0, 0x3f, 0x70, 0x60, 0x63, 0xc0, 0xe4, 0x80, 0xc2, 0x03, 0x07, 0x0f, 0x1e, 0x6c, 0xff, 0x27, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x09, 0x44, 0x44, 0x00, 0x12, 0x41, 0x88, 0x04, 0x21, 0x21, 0x84, 0x48, 0x20, 0x23, 0xc2, 0xcc, 0x08, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x1d, 0x00, 0x78, 0x00, 0xb4, 0x07, 0xf0, 0x2f, 0xc0, 0xfb, 0x00, 0xbe, 0x02, 0xf4, 0x07, 0xfd, 0xff, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0x00, 0x19, 0x00, 0xa8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf0, 0xdc, 0xcb, 0x03, 0x00, 0xff, 0xff, 0x4f, 0x07, 0x40, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0f, 0xff, 0x3f, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0x07, 0x00, 0xbd, 0x02, 0xe8, 0xb3, 0xe0, 0x3c, 0xac, 0xc3, 0x03, 0x0f, 0x3c, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x0b, 0xc0, 0xc8, 0xc0, 0x91, 0x1b, 0xcd, 0x36, 0xe7, 0x00, 0x47, 0x03, 0xa7, 0x80, 0x36, 0xfd, 0xff, 0xc1, 0x9b, 0xf9, 0xb8, 0xb8, 0xb8, 0xb7, 0x99, 0xf7, 0xff, 0xff, 0x0f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xf0, 0x03, 0x00, 0xfc, 0x00, 0xc0, 0xff, 0x00, 0xf0, 0x3f, 0x00, 0xff, 0x3f, 0xf0, 0xff, 0x3f, 0xfc, 0xff, 0xcf, 0xff, 0xff, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1f, 0xcb, 0x30, 0xc3, 0x3f, 0xc7, 0x00, 0x7e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xfc, 0xff, 0xc3, 0xff, 0x3f, 0x0c, 0x00, 0xc3, 0xfc, 0x33, 0x0c, 0x24, 0xc3, 0xc0, 0x31, 0x0c, 0x06, 0xc3, 0x30, 0x30, 0x0c, 0x00, 0xc3, 0xff, 0x3f, 0x0a, 0xff, 0x3f, 0x30, 0x00, 0x03, 0xc3, 0x30, 0x30, 0x3f, 0xff, 0xff, 0x3f, 0x3c, 0x00, 0xff, 0xff, 0xff, 0x0c, 0x0c, 0xc3, 0xc0, 0x00, 0x0c, 0xfc, 0xff, 0x0a, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0xfc, 0x0f, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x3c, 0x00, 0xc0, 0x03, 0xf0, 0x3f, 0x00, 0xff, 0x03, 0x00, 0x00, 0x09, 0xe0, 0x2f, 0xf0, 0xff, 0xe3, 0xb8, 0xec, 0x9b, 0xf9, 0xbf, 0xf8, 0xbf, 0x99, 0xef, 0xb8, 0x2c, 0xff, 0x3f, 0xe0, 0x2f, 0x00, 0x00, 0x00, 0x04, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x87, 0x87, 0xc3, 0x30, 0x0c, 0xe3, 0xde, 0x01, 0x03, 0x74, 0xbb, 0x0c, 0xc3, 0x30, 0x2c, 0x2d, 0x0d, 0x05, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x34, 0xc3, 0x0c, 0x73, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x39, 0xc0, 0x00, 0x43, 0x2f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0x60, 0x60, 0x60, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0x87, 0x30, 0xb8, 0x00, 0x23, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0e, 0x36, 0xc6, 0xfc, 0x03, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0xcb, 0x00, 0x7f, 0x40, 0x13, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xcb, 0x10, 0x2f, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf0, 0x0f, 0x30, 0x60, 0x60, 0xc0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0x7d, 0x4c, 0x33, 0x4c, 0x1f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xd0, 0xc7, 0x30, 0xc6, 0xe0, 0x03, 0x8c, 0x1f, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x03, 0xc0, 0xf0, 0x3c, 0xcf, 0xf3, 0x3c, 0x03, 0x00, 0x03, 0x00, 0xcc, 0xf3, 0x3c, 0xcf, 0xf3, 0x30, 0x00, 0x05, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x30, 0xc0, 0x0f, 0x30, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0xd0, 0x7f, 0x40, 0xff, 0x1f, 0xfc, 0xff, 0x43, 0xff, 0x1f, 0x40, 0x15, 0x00, 0x00, 0x00, 0x0a, 0xe4, 0x06, 0x90, 0x91, 0x01, 0x06, 0x24, 0x30, 0x90, 0x1b, 0x46, 0x6e, 0x96, 0xb9, 0x91, 0xe4, 0x06, 0x0c, 0x18, 0x90, 0x40, 0x46, 0x06, 0x90, 0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x02, 0xc2, 0xab, 0xaa, 0x3e, 0x20, 0xe0, 0xab, 0xaa, 0x3e, 0x02, 0xc2, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x02, 0xc0, 0x30, 0x00, 0x0c, 0x03, 0xf0, 0xff, 0x00, 0xfe, 0x0b, 0xd0, 0x7f, 0x00, 0xa4, 0x01, 0x00, 0x0a, 0x00, 0xa0, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x81, 0x24, 0x10, 0x85, 0x00, 0x20, 0x66, 0x40, 0x15, 0x45, 0x62, 0x90, 0x4d, 0xd0, 0xf1, 0x23, 0x01, 0xfd, 0x41, 0x41, 0x07, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x00, 0xf8, 0x02, 0xd0, 0x7f, 0x00, 0xfe, 0x0b, 0xf0, 0xff, 0x00, 0xff, 0x0f, 0xd0, 0x7f, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0xd4, 0x01, 0xd0, 0x06, 0x40, 0x7f, 0x00, 0xfd, 0x01, 0xf4, 0x07, 0xd0, 0x1f, 0x00, 0x7f, 0x00, 0xd0, 0x01, 0x00, 0x0a, 0x40, 0x15, 0x00, 0xfe, 0x0b, 0x88, 0x2f, 0x52, 0xf0, 0x50, 0x01, 0x0a, 0xd4, 0xaf, 0x7f, 0xfd, 0xf5, 0xc7, 0x0b, 0x3e, 0x70, 0xd0, 0x00, 0xa4, 0x01, 0x0a, 0x80, 0x2f, 0x80, 0x5f, 0x2f, 0x0c, 0x00, 0xc3, 0x00, 0x30, 0x0c, 0x00, 0xc3, 0x01, 0x34, 0x34, 0xc0, 0x01, 0x07, 0x0d, 0xd0, 0x75, 0x00, 0xf4, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xf4, 0x01, 0xc0, 0x3f, 0x00, 0xf0, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xe0, 0xef, 0x00, 0xbb, 0x0b, 0xa0, 0xaa, 0x00, 0xaa, 0x0a, 0x80, 0x19, 0x00, 0x64, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x2d, 0x80, 0xe7, 0x0b, 0xbe, 0xf8, 0xfa, 0x02, 0xfe, 0x0b, 0x80, 0x2f, 0x00, 0x50, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xf8, 0x02, 0xe0, 0xbf, 0x80, 0xaf, 0x2f, 0xbe, 0xe0, 0xdb, 0x02, 0x78, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x00, 0xa0, 0x00, 0x40, 0x1f, 0x50, 0xfe, 0x5b,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 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, 0x06, 0x74, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0xdc, 0xc0, 0x0c, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07, @@ -29,4 +30,5 @@ static short font_ptrs[] = { 0x0000, 0x000e, 0x001c, 0x002a, 0x0038, 0x0046, 0x0054, 0x0062, 0x0070, 0x007e, 0x008c, 0x009a, 0x00a8, 0x00b6, 0x00c4, 0x00d2, 0x00e0, 0x00ee, 0x00fc, 0x010a, 0x0118, 0x0126, 0x0134, 0x0142, 0x0150, 0x015e, 0x016c, 0x017a, 0x0188, 0x0196, 0x01a4, 0x01b2, 0x01c0, 0x01ce, 0x01d7, 0x01e5, 0x01f5, 0x0205, 0x0218, 0x0228, 0x0231, 0x023c, 0x0247, 0x0257, 0x0267, 0x0272, 0x0280, 0x0289, 0x0299, 0x02a9, 0x02b7, 0x02c7, 0x02d7, 0x02e7, 0x02f7, 0x0307, 0x0317, 0x0327, 0x0337, 0x0340, 0x034b, 0x035b, 0x036b, 0x037b, 0x038b, 0x03a0, 0x03b0, 0x03c0, 0x03d0, 0x03e0, 0x03f0, 0x0400, 0x0410, 0x0420, 0x042b, 0x043b, 0x044e, 0x045e, 0x0473, 0x0486, 0x0499, 0x04a9, 0x04bc, 0x04cc, 0x04dc, 0x04ec, 0x04ff, 0x050f, 0x0524, 0x0537, 0x0547, 0x055a, 0x0565, 0x0573, 0x057e, 0x0589, 0x0599, 0x05a2, 0x05b0, 0x05be, 0x05cc, 0x05da, 0x05e8, 0x05f3, 0x0601, 0x060f, 0x061a, 0x0625, 0x0633, 0x063e, 0x064e, 0x065c, 0x066a, 0x0678, 0x0686, 0x068f, 0x069d, 0x06a8, 0x06b6, 0x06c4, 0x06d4, 0x06e2, 0x06f0, 0x06fe, 0x0709, 0x070f, 0x071a, 0x072a, 0x0735, 0x074a, 0x0769, 0x0788, 0x07a2, 0x07c1, 0x07db, 0x07f5, 0x080f, 0x0829, 0x0843, 0x085d, 0x0877, 0x0896, 0x08a6, 0x08c0, 0x08da, 0x08f4, 0x090e, 0x0923, 0x0940, 0x095d, 0x097c, 0x099b, 0x09b3, 0x09cb, 0x09e3, 0x09fb, 0x0a13, 0x0a2b, 0x0a43, 0x0a5b, 0x0a73, 0x0a8b, 0x0aa3, 0x0abd, 0x0ada, 0x0af7, 0x0b0c, 0x0b26, 0x0b40, 0x0b5a, 0x0b74, 0x0b8c, 0x0b97, 0x0ba0, 0x0ba9, 0x0bb7, 0x0bc5, 0x0bd3, 0x0be1, 0x0bef, 0x0bfd, 0x0c0b, 0x0c19, 0x0c27, 0x0c35, 0x0c43, 0x0c4e, 0x0c57, 0x0c60, 0x0c6e, 0x0c7e, 0x0c8e, 0x0ca8, 0x0cc2, 0x0cdc, 0x0cf6, 0x0d10, 0x0d2a, 0x0d44, 0x0d5e, 0x0d78, 0x0d92, 0x0dac, 0x0dc6, 0x0de0, 0x0dfa, 0x0e14, 0x0e2e, 0x0e46, 0x0e60, 0x0e7a, 0x0e8a, 0x0e9a, 0x0eaa, 0x0eba, 0x0eca, 0x0eda, 0x0eea, 0x0efa, 0x0f0a, 0x0f1a, 0x0f2a, 0x0f3a, 0x0f4a, 0x0f5a, 0x0f6a, 0x0f7a, 0x0f8a, 0x0f9a, 0x0faa, 0x0fba, 0x0fca, 0x0fda, 0x0fea, 0x0ffa, 0x100a, 0x101a, 0x102a, 0x103a, 0x104a, 0x105a, 0x106a, 0x107a, 0x108a, 0x109a, 0x10aa, 0x10ba, 0x10ca, 0x10da, 0x10ea, 0x10fa, 0x110a, 0x111a, 0x112a, 0x113a, 0x114a, }; -#endif \ No newline at end of file +#endif +#endif diff --git a/src/graphics.c b/src/graphics.c index 7ac641e..08798dc 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -16,6 +16,7 @@ #include #include #include +#define INCLUDE_FONTDATA #include #include diff --git a/src/main.c b/src/main.c index 8c7035b..d88b972 100755 --- a/src/main.c +++ b/src/main.c @@ -1302,7 +1302,7 @@ int main(int argc, char *argv[]) if(sdl_key=='h') hud_enable = !hud_enable; if(sdl_key=='p') - dump_frame(vid_buf, XRES, YRES, XRES); + dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE); if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) { if(clipboard_ready==1) @@ -1361,7 +1361,7 @@ int main(int argc, char *argv[]) if(sdl_key=='v') vs = !vs; if(vs) - dump_frame(vid_buf, XRES, YRES, XRES); + dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE); #endif if(sdl_wheel) diff --git a/src/powder-reflection.diff b/src/powder-reflection.diff new file mode 100644 index 0000000..1adcbf7 --- /dev/null +++ b/src/powder-reflection.diff @@ -0,0 +1,510 @@ +diff -urN powder-42.3/air.c powder-42.4/air.c +--- powder-42.3/air.c 2010-09-03 10:20:00.000000000 -0400 ++++ powder-42.4/air.c 2010-10-02 08:05:31.000000000 -0400 +@@ -138,4 +138,4 @@ + memcpy(vx, ovx, sizeof(vx)); + memcpy(vy, ovy, sizeof(vy)); + memcpy(pv, opv, sizeof(pv)); +-} +\ No newline at end of file ++} +diff -urN powder-42.3/air.h powder-42.4/air.h +--- powder-42.3/air.h 2010-09-03 10:20:00.000000000 -0400 ++++ powder-42.4/air.h 2010-10-02 08:05:26.000000000 -0400 +@@ -18,4 +18,4 @@ + + void update_air(void); + +-#endif +\ No newline at end of file ++#endif +diff -urN powder-42.3/defines.h powder-42.4/defines.h +--- powder-42.3/defines.h 2010-09-22 15:07:00.000000000 -0400 ++++ powder-42.4/defines.h 2010-10-02 10:18:19.000000000 -0400 +@@ -8,8 +8,8 @@ + #endif + + #define SAVE_VERSION 42 +-#define MINOR_VERSION 3 +-#define IDENT_VERSION "S" //Change this if you're not Simon! It should be a single letter. ++#define MINOR_VERSION 4 ++#define IDENT_VERSION "$" //Change this if you're not Simon! It should be a single letter. + //#define BETA + + #define SERVER "powdertoy.co.uk" +@@ -115,4 +115,4 @@ + int parse_save(void *save, int size, int replace, int x0, int y0); + void del_stamp(int d); + void sdl_seticon(void); +-#endif +\ No newline at end of file ++#endif +diff -urN powder-42.3/font.h powder-42.4/font.h +--- powder-42.3/font.h 2010-09-03 10:20:00.000000000 -0400 ++++ powder-42.4/font.h 2010-10-02 08:10:42.000000000 -0400 +@@ -21,5 +21,6 @@ + #ifndef FONT_H_CHECK + #define FONT_H_CHECK + #define FONT_H 10 ++#ifdef INCLUDE_FONTDATA + static char font_data[] = + { +@@ -31,2 +32,3 @@ + { +-#endif +\ No newline at end of file ++#endif ++#endif +diff -urN powder-42.3/graphics.c powder-42.4/graphics.c +--- powder-42.3/graphics.c 2010-09-22 14:05:00.000000000 -0400 ++++ powder-42.4/graphics.c 2010-10-02 08:10:38.000000000 -0400 +@@ -16,6 +16,7 @@ + #include "air.h" + #include "powder.h" + #include "graphics.h" ++#define INCLUDE_FONTDATA + #include "font.h" + #include "misc.h" + +diff -urN powder-42.3/interface.c powder-42.4/interface.c +--- powder-42.3/interface.c 2010-09-22 14:05:00.000000000 -0400 ++++ powder-42.4/interface.c 2010-10-02 08:10:56.000000000 -0400 +@@ -6,10 +6,10 @@ + #include + #include "http.h" + #include "md5.h" +-#include "font.h" + #include "defines.h" + #include "powder.h" + #include "interface.h" ++#include "font.h" + #include "misc.h" + + SDLMod sdl_mod; +@@ -2958,4 +2958,4 @@ + if(result) + free(result); + return 1; +-} +\ No newline at end of file ++} +diff -urN powder-42.3/main.c powder-42.4/main.c +--- powder-42.3/main.c 2010-09-22 15:04:00.000000000 -0400 ++++ powder-42.4/main.c 2010-10-02 10:14:46.000000000 -0400 +@@ -38,7 +38,6 @@ + #endif + + #include "misc.h" +-#include "font.h" + #include "defines.h" + #include "powder.h" + #include "graphics.h" +@@ -1302,7 +1301,7 @@ + if(sdl_key=='h') + hud_enable = !hud_enable; + if(sdl_key=='p') +- dump_frame(vid_buf, XRES, YRES, XRES); ++ dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE); + if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + if(clipboard_ready==1) +@@ -1361,7 +1360,7 @@ + if(sdl_key=='v') + vs = !vs; + if(vs) +- dump_frame(vid_buf, XRES, YRES, XRES); ++ dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE); + #endif + + if(sdl_wheel) +diff -urN powder-42.3/misc.c powder-42.4/misc.c +--- powder-42.3/misc.c 2010-09-22 14:05:00.000000000 -0400 ++++ powder-42.4/misc.c 2010-10-02 08:05:12.000000000 -0400 +@@ -280,4 +280,4 @@ + #endif + #endif + return 0; +-} +\ No newline at end of file ++} +diff -urN powder-42.3/misc.h powder-42.4/misc.h +--- powder-42.3/misc.h 2010-09-22 14:05:00.000000000 -0400 ++++ powder-42.4/misc.h 2010-10-02 08:05:47.000000000 -0400 +@@ -69,4 +69,4 @@ + + int cpu_check(void); + +-#endif +\ No newline at end of file ++#endif +diff -urN powder-42.3/powder.c powder-42.4/powder.c +--- powder-42.3/powder.c 2010-09-22 14:05:00.000000000 -0400 ++++ powder-42.4/powder.c 2010-10-02 10:07:00.000000000 -0400 +@@ -21,80 +21,96 @@ + unsigned pmap[YRES][XRES]; + unsigned cb_pmap[YRES][XRES]; + +-int try_move(int i, int x, int y, int nx, int ny) ++static int eval_move(int pt, int nx, int ny, unsigned *rr) + { + unsigned r; + +- + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) + return 0; +- if(x==nx && y==ny) +- return 1; ++ + r = pmap[ny][nx]; + if(r && (r>>8)>8].type; ++ if(rr) ++ *rr = r; ++ ++ if(pt==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) ++ return 2; + +- if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) ++ if(pt==PT_STKM) //Stick man's head shouldn't collide + { +- return 1; ++ return 2; + } + +- if((r&0xFF)==PT_VOID) ++ if(bmap[ny/CELL][nx/CELL]==13 && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) + { +- parts[i].type=PT_NONE; + return 0; + } +- if((r&0xFF)==PT_BHOL) +- { +- parts[i].type=PT_NONE; +- if(!legacy_enable) +- { +- parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; +- } ++ ++ if(ptypes[pt].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; +- } + +- if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide +- { ++ if((pt==PT_NEUT ||pt==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) ++ return 0; ++ ++ if(bmap[ny/CELL][nx/CELL]==9) ++ return 0; ++ ++ if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) ++ return 0; ++ ++ if (r && ((r&0xFF) >= PT_NUM || !can_move[pt][(r&0xFF)])) ++ return 0; ++ ++ return 1; ++} ++ ++int try_move(int i, int x, int y, int nx, int ny) ++{ ++ unsigned r, e; ++ ++ if(x==nx && y==ny) + return 1; +- } ++ ++ e = eval_move(parts[i].type, nx, ny, &r); ++ if(!e) ++ return 0; ++ if(e == 2) ++ return 1; + + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) + { + return 1; + } +- if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) +- { +- return 0; +- } + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) + { + return 0; + } +- +- if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) +- return 0; +- if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) +- return 0; + if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) ++ if((r&0xFF)==PT_BHOL) ++ { ++ parts[i].type=PT_NONE; ++ if(!legacy_enable) ++ { ++ parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; ++ } + return 0; ++ } + + if(parts[i].type==PT_CNCT && y>8)>= 8; +@@ -456,10 +472,147 @@ + return id; + } + ++#define SURF_RANGE 10 ++#define NORMAL_MIN_EST 3 ++#define NORMAL_INTERP 20 ++#define NORMAL_FRAC 16 ++ ++static unsigned direction_to_map(float dx, float dy) ++{ ++ return (dx >= 0) | ++ (((dx + dy) >= 0) << 1) | /* 567 */ ++ ((dy >= 0) << 2) | /* 4+0 */ ++ (((dy - dx) >= 0) << 3) | /* 321 */ ++ ((dx <= 0) << 4) | ++ (((dx + dy) <= 0) << 5) | ++ ((dy <= 0) << 6) | ++ (((dy - dx) <= 0) << 7); ++} ++ ++static int is_blocking(int t, int x, int y) ++{ ++ return eval_move(t, x, y, NULL); ++} ++ ++static int is_boundary(int pt, int x, int y) ++{ ++ if(!is_blocking(pt,x,y)) ++ return 0; ++ if(is_blocking(pt,x,y-1) && is_blocking(pt,x,y+1) && is_blocking(pt,x-1,y) && is_blocking(pt,x+1,y)) ++ return 0; ++ return 1; ++} ++ ++static int find_next_boundary(int pt, int *x, int *y, int dm, int *em) ++{ ++ static int dx[8] = {1,1,0,-1,-1,-1,0,1}; ++ static int dy[8] = {0,1,1,1,0,-1,-1,-1}; ++ static int de[8] = {0x83,0x07,0x0E,0x1C,0x38,0x70,0xE0,0xC1}; ++ int i, ii, i0; ++ ++ if(*x <= 0 || *x >= XRES-1 || *y <= 0 || *y >= YRES-1) ++ return 0; ++ ++ if(*em != -1) { ++ i0 = *em; ++ dm &= de[i0]; ++ } else ++ i0 = 0; ++ ++ for(ii=0; ii<8; ii++) { ++ i = (ii + i0) & 7; ++ if((dm & (1 << i)) && is_boundary(pt, *x+dx[i], *y+dy[i])) { ++ *x += dx[i]; ++ *y += dy[i]; ++ *em = i; ++ return 1; ++ } ++ } ++ ++ return 0; ++} ++ ++static int vec_colinear(float nx, float ny, float vx, float vy) ++{ ++ float d = 1.0f/hypot(vx, vy); ++ d *= nx*vx + ny*vy; ++ return (d >= 0.99) || (d <= -0.99); ++} ++ ++int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny) ++{ ++ int ldm, rdm, lm, rm; ++ int lx, ly, lv, rx, ry, rv; ++ int i, j; ++ float r, ex, ey; ++ ++ if(!dx && !dy) ++ return 0; ++ ++ if(!is_boundary(pt, x, y)) ++ return 0; ++ ++ ldm = direction_to_map(-dy, dx); ++ rdm = direction_to_map(dy, -dx); ++ lx = rx = x; ++ ly = ry = y; ++ lv = rv = 1; ++ lm = rm = -1; ++ ++ j = 0; ++ for(i=0; i= NORMAL_INTERP) ++ return 0; ++ ++ return get_normal(pt, x, y, dx, dy, nx, ny); ++} ++ + void update_particles_i(pixel *vid, int start, int inc) + { + int i, j, x, y, t, nx, ny, r, a, s, rt, fe, nt, lpv, nearp, pavg; +- float mv, dx, dy, ix, iy, lx, ly, d, pp; ++ float mv, dx, dy, ix, iy, lx, ly, d, pp, nrx, nry, dp; + float pt = R_TEMP; + float c_heat = 0.0f; + int h_count = 0; +@@ -886,7 +1039,7 @@ + r = pmap[y+ny][x+nx]; + if((r>>8)>=NPART || !r) + continue; +- if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) ++ if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK) + { + t = parts[i].type = PT_NONE; + parts[r>>8].ctype = parts[r>>8].type; +@@ -2075,32 +2228,55 @@ + else + { + parts[i].flags |= FLAG_STAGNANT; +- if(nx>x+ISTP) nx=x+ISTP; +- if(nxy+ISTP) ny=y+ISTP; +- if(ny(rand()%1000)) + { + kill_part(i); + continue; + } +- else if(try_move(i, x, y, 2*x-nx, ny)) +- { +- parts[i].x = (float)(2*x-nx); +- parts[i].y = (float)iy; +- parts[i].vx *= ptypes[t].collision; +- } +- else if(try_move(i, x, y, nx, 2*y-ny)) +- { +- parts[i].x = (float)ix; +- parts[i].y = (float)(2*y-ny); +- parts[i].vy *= ptypes[t].collision; +- } +- else +- { +- parts[i].vx *= ptypes[t].collision; +- parts[i].vy *= ptypes[t].collision; +- } ++ else if(t==PT_NEUT || t==PT_PHOT) ++ { ++ if(get_normal_interp(t, lx, ly, parts[i].vx, parts[i].vy, &nrx, &nry)) { ++ dp = nrx*parts[i].vx + nry*parts[i].vy; ++ parts[i].vx -= 2.0f*dp*nrx; ++ parts[i].vy -= 2.0f*dp*nry; ++ nx = (int)(parts[i].x + parts[i].vx + 0.5f); ++ ny = (int)(parts[i].y + parts[i].vy + 0.5f); ++ if(try_move(i, x, y, nx, ny)) { ++ parts[i].x = (float)nx; ++ parts[i].y = (float)ny; ++ } else { ++ kill_part(i); ++ continue; ++ } ++ } else { ++ kill_part(i); ++ continue; ++ } ++ } ++ else ++ { ++ if(nx>x+ISTP) nx=x+ISTP; ++ if(nxy+ISTP) ny=y+ISTP; ++ if(ny=XRES-CELL || ny=YRES-CELL) +Binary files powder-42.3/powder.def and powder-42.4/powder.def differ diff --git a/src/powder.c b/src/powder.c index 15a2afe..f5da09c 100644 --- a/src/powder.c +++ b/src/powder.c @@ -22,80 +22,86 @@ int pfree; unsigned pmap[YRES][XRES]; unsigned cb_pmap[YRES][XRES]; -int try_move(int i, int x, int y, int nx, int ny) +static int eval_move(int pt, int nx, int ny, unsigned *rr) { unsigned r; if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) return 0; - if(x==nx && y==ny) - return 1; - r = pmap[ny][nx]; + + r = pmap[ny][nx]; if(r && (r>>8)>8].type; + if(rr) + *rr = r; - if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) - { - return 1; - } - - if((r&0xFF)==PT_VOID) - { - parts[i].type=PT_NONE; - return 0; - } - if((r&0xFF)==PT_BHOL) - { - parts[i].type=PT_NONE; - if(!legacy_enable) - { - parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; - } - return 0; - } + if(pt==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY||((r&0xFF)==PT_PCLN&&parts[r>>8].life > 5)))) + return 2; - if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide - { - return 1; - } + if(pt==PT_STKM) //Stick man's head shouldn't collide + { + return 2; + } - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) - { - return 1; - } - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) - { + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) return 0; - } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) - { + if(ptypes[pt].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; + if((pt==PT_NEUT ||pt==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) return 0; - } - if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; - if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + if(bmap[ny/CELL][nx/CELL]==9) return 0; - if(r && (r>>8)= PT_NUM || !can_move[pt][(r&0xFF)])) return 0; - if(ptypes[parts[i].type].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) + return 1; +} +int try_move(int i, int x, int y, int nx, int ny) +{ + unsigned r, e; + + if(x==nx && y==ny) + return 1; + e = eval_move(parts[i].type, nx, ny, &r); + if(!e) + return 0; + if(e == 2) + return 1; + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) + return 1; + if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) return 0; - if (r && ((r&0xFF) >= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) + if(r && (r>>8)>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; + } + + return 0; + } + if(parts[i].type==PT_CNCT && y>8)>= 8; @@ -105,6 +111,142 @@ int try_move(int i, int x, int y, int nx, int ny) return 1; } +#define SURF_RANGE 10 +#define NORMAL_MIN_EST 3 +#define NORMAL_INTERP 20 +#define NORMAL_FRAC 16 + +static unsigned direction_to_map(float dx, float dy) +{ + return (dx >= 0) | + (((dx + dy) >= 0) << 1) | /* 567 */ + ((dy >= 0) << 2) | /* 4+0 */ + (((dy - dx) >= 0) << 3) | /* 321 */ + ((dx <= 0) << 4) | + (((dx + dy) <= 0) << 5) | + ((dy <= 0) << 6) | + (((dy - dx) <= 0) << 7); +} + +static int is_blocking(int t, int x, int y) +{ + return eval_move(t, x, y, NULL); +} + +static int is_boundary(int pt, int x, int y) +{ + if(!is_blocking(pt,x,y)) + return 0; + if(is_blocking(pt,x,y-1) && is_blocking(pt,x,y+1) && is_blocking(pt,x-1,y) && is_blocking(pt,x+1,y)) + return 0; + return 1; +} + +static int find_next_boundary(int pt, int *x, int *y, int dm, int *em) +{ + static int dx[8] = {1,1,0,-1,-1,-1,0,1}; + static int dy[8] = {0,1,1,1,0,-1,-1,-1}; + static int de[8] = {0x83,0x07,0x0E,0x1C,0x38,0x70,0xE0,0xC1}; + int i, ii, i0; + + if(*x <= 0 || *x >= XRES-1 || *y <= 0 || *y >= YRES-1) + return 0; + + if(*em != -1) { + i0 = *em; + dm &= de[i0]; + } else + i0 = 0; + + for(ii=0; ii<8; ii++) { + i = (ii + i0) & 7; + if((dm & (1 << i)) && is_boundary(pt, *x+dx[i], *y+dy[i])) { + *x += dx[i]; + *y += dy[i]; + *em = i; + return 1; + } + } + + return 0; +} + +static int vec_colinear(float nx, float ny, float vx, float vy) +{ + float d = 1.0f/hypot(vx, vy); + d *= nx*vx + ny*vy; + return (d >= 0.99) || (d <= -0.99); +} + +int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny) +{ + int ldm, rdm, lm, rm; + int lx, ly, lv, rx, ry, rv; + int i, j; + float r, ex, ey; + + if(!dx && !dy) + return 0; + + if(!is_boundary(pt, x, y)) + return 0; + + ldm = direction_to_map(-dy, dx); + rdm = direction_to_map(dy, -dx); + lx = rx = x; + ly = ry = y; + lv = rv = 1; + lm = rm = -1; + + j = 0; + for(i=0; i= NORMAL_INTERP) + return 0; + + return get_normal(pt, x, y, dx, dy, nx, ny); +} void kill_part(int i) { @@ -477,7 +619,7 @@ void update_particles_i(pixel *vid, int start, int inc) uint16_t tempu1, tempu2; int16_t temps1, temps2; float tempf1, tempf2; - float mv, dx, dy, ix, iy, lx, ly, d, pp; + float mv, dx, dy, ix, iy, lx, ly, d, pp, nrx, nry, dp; float pt = R_TEMP; float c_heat = 0.0f; int h_count = 0; @@ -906,7 +1048,8 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) + if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK) + { t = parts[i].type = PT_NONE; parts[r>>8].ctype = parts[r>>8].type; @@ -2381,33 +2524,57 @@ void update_particles_i(pixel *vid, int start, int inc) else { parts[i].flags |= FLAG_STAGNANT; - if(nx>x+ISTP) nx=x+ISTP; - if(nxy+ISTP) ny=y+ISTP; - if(ny(rand()%1000)) { kill_part(i); continue; } - else if(try_move(i, x, y, 2*x-nx, ny)) - { - parts[i].x = (float)(2*x-nx); - parts[i].y = (float)iy; - parts[i].vx *= ptypes[t].collision; - } - else if(try_move(i, x, y, nx, 2*y-ny)) - { - parts[i].x = (float)ix; - parts[i].y = (float)(2*y-ny); - parts[i].vy *= ptypes[t].collision; - } - else - { - parts[i].vx *= ptypes[t].collision; - parts[i].vy *= ptypes[t].collision; - } - } + else if(t==PT_NEUT || t==PT_PHOT) + { + if(get_normal_interp(t, lx, ly, parts[i].vx, parts[i].vy, &nrx, &nry)) { + dp = nrx*parts[i].vx + nry*parts[i].vy; + parts[i].vx -= 2.0f*dp*nrx; + parts[i].vy -= 2.0f*dp*nry; + nx = (int)(parts[i].x + parts[i].vx + 0.5f); + ny = (int)(parts[i].y + parts[i].vy + 0.5f); + if(try_move(i, x, y, nx, ny)) { + parts[i].x = (float)nx; + parts[i].y = (float)ny; + } else { + kill_part(i); + continue; + } + } else { + kill_part(i); + continue; + } + } + + else + { + if(nx>x+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny=XRES-CELL || ny=YRES-CELL) { -- cgit v0.9.2-21-gd62e From 52098f806bdc31959cefa0604420a14409f4bdc9 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 2 Oct 2010 17:59:42 +0200 Subject: removed diff file diff --git a/src/powder-reflection.diff b/src/powder-reflection.diff deleted file mode 100644 index 1adcbf7..0000000 --- a/src/powder-reflection.diff +++ /dev/null @@ -1,510 +0,0 @@ -diff -urN powder-42.3/air.c powder-42.4/air.c ---- powder-42.3/air.c 2010-09-03 10:20:00.000000000 -0400 -+++ powder-42.4/air.c 2010-10-02 08:05:31.000000000 -0400 -@@ -138,4 +138,4 @@ - memcpy(vx, ovx, sizeof(vx)); - memcpy(vy, ovy, sizeof(vy)); - memcpy(pv, opv, sizeof(pv)); --} -\ No newline at end of file -+} -diff -urN powder-42.3/air.h powder-42.4/air.h ---- powder-42.3/air.h 2010-09-03 10:20:00.000000000 -0400 -+++ powder-42.4/air.h 2010-10-02 08:05:26.000000000 -0400 -@@ -18,4 +18,4 @@ - - void update_air(void); - --#endif -\ No newline at end of file -+#endif -diff -urN powder-42.3/defines.h powder-42.4/defines.h ---- powder-42.3/defines.h 2010-09-22 15:07:00.000000000 -0400 -+++ powder-42.4/defines.h 2010-10-02 10:18:19.000000000 -0400 -@@ -8,8 +8,8 @@ - #endif - - #define SAVE_VERSION 42 --#define MINOR_VERSION 3 --#define IDENT_VERSION "S" //Change this if you're not Simon! It should be a single letter. -+#define MINOR_VERSION 4 -+#define IDENT_VERSION "$" //Change this if you're not Simon! It should be a single letter. - //#define BETA - - #define SERVER "powdertoy.co.uk" -@@ -115,4 +115,4 @@ - int parse_save(void *save, int size, int replace, int x0, int y0); - void del_stamp(int d); - void sdl_seticon(void); --#endif -\ No newline at end of file -+#endif -diff -urN powder-42.3/font.h powder-42.4/font.h ---- powder-42.3/font.h 2010-09-03 10:20:00.000000000 -0400 -+++ powder-42.4/font.h 2010-10-02 08:10:42.000000000 -0400 -@@ -21,5 +21,6 @@ - #ifndef FONT_H_CHECK - #define FONT_H_CHECK - #define FONT_H 10 -+#ifdef INCLUDE_FONTDATA - static char font_data[] = - { -@@ -31,2 +32,3 @@ - { --#endif -\ No newline at end of file -+#endif -+#endif -diff -urN powder-42.3/graphics.c powder-42.4/graphics.c ---- powder-42.3/graphics.c 2010-09-22 14:05:00.000000000 -0400 -+++ powder-42.4/graphics.c 2010-10-02 08:10:38.000000000 -0400 -@@ -16,6 +16,7 @@ - #include "air.h" - #include "powder.h" - #include "graphics.h" -+#define INCLUDE_FONTDATA - #include "font.h" - #include "misc.h" - -diff -urN powder-42.3/interface.c powder-42.4/interface.c ---- powder-42.3/interface.c 2010-09-22 14:05:00.000000000 -0400 -+++ powder-42.4/interface.c 2010-10-02 08:10:56.000000000 -0400 -@@ -6,10 +6,10 @@ - #include - #include "http.h" - #include "md5.h" --#include "font.h" - #include "defines.h" - #include "powder.h" - #include "interface.h" -+#include "font.h" - #include "misc.h" - - SDLMod sdl_mod; -@@ -2958,4 +2958,4 @@ - if(result) - free(result); - return 1; --} -\ No newline at end of file -+} -diff -urN powder-42.3/main.c powder-42.4/main.c ---- powder-42.3/main.c 2010-09-22 15:04:00.000000000 -0400 -+++ powder-42.4/main.c 2010-10-02 10:14:46.000000000 -0400 -@@ -38,7 +38,6 @@ - #endif - - #include "misc.h" --#include "font.h" - #include "defines.h" - #include "powder.h" - #include "graphics.h" -@@ -1302,7 +1301,7 @@ - if(sdl_key=='h') - hud_enable = !hud_enable; - if(sdl_key=='p') -- dump_frame(vid_buf, XRES, YRES, XRES); -+ dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE); - if(sdl_key=='v'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) - { - if(clipboard_ready==1) -@@ -1361,7 +1360,7 @@ - if(sdl_key=='v') - vs = !vs; - if(vs) -- dump_frame(vid_buf, XRES, YRES, XRES); -+ dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE); - #endif - - if(sdl_wheel) -diff -urN powder-42.3/misc.c powder-42.4/misc.c ---- powder-42.3/misc.c 2010-09-22 14:05:00.000000000 -0400 -+++ powder-42.4/misc.c 2010-10-02 08:05:12.000000000 -0400 -@@ -280,4 +280,4 @@ - #endif - #endif - return 0; --} -\ No newline at end of file -+} -diff -urN powder-42.3/misc.h powder-42.4/misc.h ---- powder-42.3/misc.h 2010-09-22 14:05:00.000000000 -0400 -+++ powder-42.4/misc.h 2010-10-02 08:05:47.000000000 -0400 -@@ -69,4 +69,4 @@ - - int cpu_check(void); - --#endif -\ No newline at end of file -+#endif -diff -urN powder-42.3/powder.c powder-42.4/powder.c ---- powder-42.3/powder.c 2010-09-22 14:05:00.000000000 -0400 -+++ powder-42.4/powder.c 2010-10-02 10:07:00.000000000 -0400 -@@ -21,80 +21,96 @@ - unsigned pmap[YRES][XRES]; - unsigned cb_pmap[YRES][XRES]; - --int try_move(int i, int x, int y, int nx, int ny) -+static int eval_move(int pt, int nx, int ny, unsigned *rr) - { - unsigned r; - -- - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) - return 0; -- if(x==nx && y==ny) -- return 1; -+ - r = pmap[ny][nx]; - if(r && (r>>8)>8].type; -+ if(rr) -+ *rr = r; -+ -+ if(pt==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) -+ return 2; - -- if(parts[i].type==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) -+ if(pt==PT_STKM) //Stick man's head shouldn't collide - { -- return 1; -+ return 2; - } - -- if((r&0xFF)==PT_VOID) -+ if(bmap[ny/CELL][nx/CELL]==13 && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) - { -- parts[i].type=PT_NONE; - return 0; - } -- if((r&0xFF)==PT_BHOL) -- { -- parts[i].type=PT_NONE; -- if(!legacy_enable) -- { -- parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; -- } -+ -+ if(ptypes[pt].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; -- } - -- if(parts[i].type==PT_STKM) //Stick man's head shouldn't collide -- { -+ if((pt==PT_NEUT ||pt==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) -+ return 0; -+ -+ if(bmap[ny/CELL][nx/CELL]==9) -+ return 0; -+ -+ if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) -+ return 0; -+ -+ if (r && ((r&0xFF) >= PT_NUM || !can_move[pt][(r&0xFF)])) -+ return 0; -+ -+ return 1; -+} -+ -+int try_move(int i, int x, int y, int nx, int ny) -+{ -+ unsigned r, e; -+ -+ if(x==nx && y==ny) - return 1; -- } -+ -+ e = eval_move(parts[i].type, nx, ny, &r); -+ if(!e) -+ return 0; -+ if(e == 2) -+ return 1; - - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) - { - return 1; - } -- if(bmap[ny/CELL][nx/CELL]==13 && ptypes[parts[i].type].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) -- { -- return 0; -- } - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) - { - return 0; - } -- -- if(ptypes[parts[i].type].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) -- return 0; -- if((parts[i].type==PT_NEUT ||parts[i].type==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) -- return 0; - if(r && (r>>8)= PT_NUM || !can_move[parts[i].type][(r&0xFF)])) -+ if((r&0xFF)==PT_BHOL) -+ { -+ parts[i].type=PT_NONE; -+ if(!legacy_enable) -+ { -+ parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);//3.0f; -+ } - return 0; -+ } - - if(parts[i].type==PT_CNCT && y>8)>= 8; -@@ -456,10 +472,147 @@ - return id; - } - -+#define SURF_RANGE 10 -+#define NORMAL_MIN_EST 3 -+#define NORMAL_INTERP 20 -+#define NORMAL_FRAC 16 -+ -+static unsigned direction_to_map(float dx, float dy) -+{ -+ return (dx >= 0) | -+ (((dx + dy) >= 0) << 1) | /* 567 */ -+ ((dy >= 0) << 2) | /* 4+0 */ -+ (((dy - dx) >= 0) << 3) | /* 321 */ -+ ((dx <= 0) << 4) | -+ (((dx + dy) <= 0) << 5) | -+ ((dy <= 0) << 6) | -+ (((dy - dx) <= 0) << 7); -+} -+ -+static int is_blocking(int t, int x, int y) -+{ -+ return eval_move(t, x, y, NULL); -+} -+ -+static int is_boundary(int pt, int x, int y) -+{ -+ if(!is_blocking(pt,x,y)) -+ return 0; -+ if(is_blocking(pt,x,y-1) && is_blocking(pt,x,y+1) && is_blocking(pt,x-1,y) && is_blocking(pt,x+1,y)) -+ return 0; -+ return 1; -+} -+ -+static int find_next_boundary(int pt, int *x, int *y, int dm, int *em) -+{ -+ static int dx[8] = {1,1,0,-1,-1,-1,0,1}; -+ static int dy[8] = {0,1,1,1,0,-1,-1,-1}; -+ static int de[8] = {0x83,0x07,0x0E,0x1C,0x38,0x70,0xE0,0xC1}; -+ int i, ii, i0; -+ -+ if(*x <= 0 || *x >= XRES-1 || *y <= 0 || *y >= YRES-1) -+ return 0; -+ -+ if(*em != -1) { -+ i0 = *em; -+ dm &= de[i0]; -+ } else -+ i0 = 0; -+ -+ for(ii=0; ii<8; ii++) { -+ i = (ii + i0) & 7; -+ if((dm & (1 << i)) && is_boundary(pt, *x+dx[i], *y+dy[i])) { -+ *x += dx[i]; -+ *y += dy[i]; -+ *em = i; -+ return 1; -+ } -+ } -+ -+ return 0; -+} -+ -+static int vec_colinear(float nx, float ny, float vx, float vy) -+{ -+ float d = 1.0f/hypot(vx, vy); -+ d *= nx*vx + ny*vy; -+ return (d >= 0.99) || (d <= -0.99); -+} -+ -+int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny) -+{ -+ int ldm, rdm, lm, rm; -+ int lx, ly, lv, rx, ry, rv; -+ int i, j; -+ float r, ex, ey; -+ -+ if(!dx && !dy) -+ return 0; -+ -+ if(!is_boundary(pt, x, y)) -+ return 0; -+ -+ ldm = direction_to_map(-dy, dx); -+ rdm = direction_to_map(dy, -dx); -+ lx = rx = x; -+ ly = ry = y; -+ lv = rv = 1; -+ lm = rm = -1; -+ -+ j = 0; -+ for(i=0; i= NORMAL_INTERP) -+ return 0; -+ -+ return get_normal(pt, x, y, dx, dy, nx, ny); -+} -+ - void update_particles_i(pixel *vid, int start, int inc) - { - int i, j, x, y, t, nx, ny, r, a, s, rt, fe, nt, lpv, nearp, pavg; -- float mv, dx, dy, ix, iy, lx, ly, d, pp; -+ float mv, dx, dy, ix, iy, lx, ly, d, pp, nrx, nry, dp; - float pt = R_TEMP; - float c_heat = 0.0f; - int h_count = 0; -@@ -886,7 +1039,7 @@ - r = pmap[y+ny][x+nx]; - if((r>>8)>=NPART || !r) - continue; -- if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK ) -+ if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK) - { - t = parts[i].type = PT_NONE; - parts[r>>8].ctype = parts[r>>8].type; -@@ -2075,32 +2228,55 @@ - else - { - parts[i].flags |= FLAG_STAGNANT; -- if(nx>x+ISTP) nx=x+ISTP; -- if(nxy+ISTP) ny=y+ISTP; -- if(ny(rand()%1000)) - { - kill_part(i); - continue; - } -- else if(try_move(i, x, y, 2*x-nx, ny)) -- { -- parts[i].x = (float)(2*x-nx); -- parts[i].y = (float)iy; -- parts[i].vx *= ptypes[t].collision; -- } -- else if(try_move(i, x, y, nx, 2*y-ny)) -- { -- parts[i].x = (float)ix; -- parts[i].y = (float)(2*y-ny); -- parts[i].vy *= ptypes[t].collision; -- } -- else -- { -- parts[i].vx *= ptypes[t].collision; -- parts[i].vy *= ptypes[t].collision; -- } -+ else if(t==PT_NEUT || t==PT_PHOT) -+ { -+ if(get_normal_interp(t, lx, ly, parts[i].vx, parts[i].vy, &nrx, &nry)) { -+ dp = nrx*parts[i].vx + nry*parts[i].vy; -+ parts[i].vx -= 2.0f*dp*nrx; -+ parts[i].vy -= 2.0f*dp*nry; -+ nx = (int)(parts[i].x + parts[i].vx + 0.5f); -+ ny = (int)(parts[i].y + parts[i].vy + 0.5f); -+ if(try_move(i, x, y, nx, ny)) { -+ parts[i].x = (float)nx; -+ parts[i].y = (float)ny; -+ } else { -+ kill_part(i); -+ continue; -+ } -+ } else { -+ kill_part(i); -+ continue; -+ } -+ } -+ else -+ { -+ if(nx>x+ISTP) nx=x+ISTP; -+ if(nxy+ISTP) ny=y+ISTP; -+ if(ny=XRES-CELL || ny=YRES-CELL) -Binary files powder-42.3/powder.def and powder-42.4/powder.def differ -- cgit v0.9.2-21-gd62e From ad3fa82329e8a43b8908d64b2638b8a7e3ab9473 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 2 Oct 2010 18:43:42 +0200 Subject: added refraction, thanks to Skylark diff --git a/src/powder.c b/src/powder.c index f5da09c..4b474b8 100644 --- a/src/powder.c +++ b/src/powder.c @@ -39,10 +39,8 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(pt==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY||((r&0xFF)==PT_PCLN&&parts[r>>8].life > 5)))) return 2; - if(pt==PT_STKM) //Stick man's head shouldn't collide - { - return 2; - } + if(pt==PT_STKM) //Stick man's head shouldn't collide + return 2; if(bmap[ny/CELL][nx/CELL]==13 && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) return 0; @@ -60,6 +58,8 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if (r && ((r&0xFF) >= PT_NUM || !can_move[pt][(r&0xFF)])) return 0; + if(pt == PT_PHOT) + return 2; return 1; } int try_move(int i, int x, int y, int nx, int ny) @@ -68,11 +68,13 @@ int try_move(int i, int x, int y, int nx, int ny) if(x==nx && y==ny) return 1; - e = eval_move(parts[i].type, nx, ny, &r); + + e = eval_move(parts[i].type, nx, ny, &r); if(!e) return 0; if(e == 2) return 1; + if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) return 1; if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) @@ -116,6 +118,8 @@ int try_move(int i, int x, int y, int nx, int ny) #define NORMAL_INTERP 20 #define NORMAL_FRAC 16 +#define REFRACT 0x80000000 + static unsigned direction_to_map(float dx, float dy) { return (dx >= 0) | @@ -130,6 +134,14 @@ static unsigned direction_to_map(float dx, float dy) static int is_blocking(int t, int x, int y) { + if(t & REFRACT) { + if(x<0 || y<0 || x>=XRES || y>=YRES) + return 0; + if((pmap[y][x] & 0xFF) == PT_GLAS) + return 1; + return 0; + } + return eval_move(t, x, y, NULL); } @@ -435,9 +447,9 @@ _inline int create_part(int p, int x, int y, int t) //}/ } - if(t!=PT_STKM) + if(t!=PT_STKM && t!=PT_PHOT) pmap[y][x] = t|(i<<8); - else + else if(t==PT_STKM) { if(isplayer==0) { @@ -615,11 +627,12 @@ int nearest_part(int ci, int t) void update_particles_i(pixel *vid, int start, int inc) { - int i, j, x, y, t, nx, ny, r, a, s, rt, fe, nt, lpv, nearp, pavg; + int i, j, x, y, t, nx, ny, r, a, s, lt, rt, fe, nt, lpv, nearp, pavg; uint16_t tempu1, tempu2; int16_t temps1, temps2; float tempf1, tempf2; float mv, dx, dy, ix, iy, lx, ly, d, pp, nrx, nry, dp; + float nn, ct1, ct2; float pt = R_TEMP; float c_heat = 0.0f; int h_count = 0; @@ -2411,6 +2424,42 @@ void update_particles_i(pixel *vid, int start, int inc) continue; } + if(parts[i].type == PT_PHOT) { + rt = pmap[ny][nx] & 0xFF; + + if(rt==PT_CLNE) { + lt = pmap[ny][nx] >> 8; + if(!parts[lt].ctype) + parts[lt].ctype = PT_PHOT; + } + + lt = pmap[y][x] & 0xFF; + + if((rt==PT_GLAS && lt!=PT_GLAS) || (rt!=PT_GLAS && lt==PT_GLAS)) { + if(!get_normal_interp(REFRACT|parts[i].type, x, y, parts[i].vx, parts[i].vy, &nrx, &nry)) { + kill_part(i); + continue; + } + nrx = -nrx; + nry = -nry; + if(rt!=PT_GLAS && lt==PT_GLAS) + nn = 2.0; + else + nn = 0.5; + ct1 = parts[i].vx*nrx + parts[i].vy*nry; + ct2 = 1.0f - (nn*nn)*(1.0f-(ct1*ct1)); + if(ct2 < 0.0f) { + parts[i].vx -= 2.0f*ct1*nrx; + parts[i].vy -= 2.0f*ct1*nry; + } else { + ct2 = sqrtf(ct2); + ct2 = ct2 - nn*ct1; + parts[i].vx = nn*parts[i].vx + ct2*nrx; + parts[i].vy = nn*parts[i].vy + ct2*nry; + } + } + } + rt = parts[i].flags & FLAG_STAGNANT; parts[i].flags &= ~FLAG_STAGNANT; if(!try_move(i, x, y, nx, ny)) @@ -2608,7 +2657,7 @@ void update_particles(pixel *vid) t = parts[i].type; x = (int)(parts[i].x+0.5f); y = (int)(parts[i].y+0.5f); - if(x>=0 && y>=0 && x=0 && y>=0 && x Date: Sat, 2 Oct 2010 19:45:55 +0200 Subject: fixed indention diff --git a/includes/powder.h b/includes/powder.h index 0ae548d..3b5e2f0 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -362,15 +362,15 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S */ /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W */ /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0}, /* Dust */ - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, /* Watr */ - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, /* Sltw */ /* DMND */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Dmnd */ diff --git a/src/powder.c b/src/powder.c index 4b474b8..1943615 100644 --- a/src/powder.c +++ b/src/powder.c @@ -29,23 +29,23 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) return 0; - - r = pmap[ny][nx]; + + r = pmap[ny][nx]; if(r && (r>>8)>8].type; if(rr) - *rr = r; + *rr = r; if(pt==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY||((r&0xFF)==PT_PCLN&&parts[r>>8].life > 5)))) return 2; if(pt==PT_STKM) //Stick man's head shouldn't collide - return 2; + return 2; - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) + return 0; + if(ptypes[pt].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) return 0; - if(ptypes[pt].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; if((pt==PT_NEUT ||pt==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) return 0; @@ -59,7 +59,7 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) return 0; if(pt == PT_PHOT) - return 2; + return 2; return 1; } int try_move(int i, int x, int y, int nx, int ny) @@ -67,23 +67,28 @@ int try_move(int i, int x, int y, int nx, int ny) unsigned r, e; if(x==nx && y==ny) - return 1; + return 1; e = eval_move(parts[i].type, nx, ny, &r); - if(!e) - return 0; + if(!e) { + if(!legacy_enable) { + if((r >> 8) < PT_NUM) + | parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);; + } + return 0; + } if(e == 2) - return 1; + return 1; if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) return 1; if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) return 0; - if(r && (r>>8)>8)=XRES || y>=YRES) - return 0; - if((pmap[y][x] & 0xFF) == PT_GLAS) - return 1; - return 0; + return 0; + if((pmap[y][x] & 0xFF) == PT_GLAS) + return 1; + return 0; } return eval_move(t, x, y, NULL); @@ -148,9 +153,9 @@ static int is_blocking(int t, int x, int y) static int is_boundary(int pt, int x, int y) { if(!is_blocking(pt,x,y)) - return 0; + return 0; if(is_blocking(pt,x,y-1) && is_blocking(pt,x,y+1) && is_blocking(pt,x-1,y) && is_blocking(pt,x+1,y)) - return 0; + return 0; return 1; } @@ -162,22 +167,22 @@ static int find_next_boundary(int pt, int *x, int *y, int dm, int *em) int i, ii, i0; if(*x <= 0 || *x >= XRES-1 || *y <= 0 || *y >= YRES-1) - return 0; + return 0; if(*em != -1) { - i0 = *em; - dm &= de[i0]; + i0 = *em; + dm &= de[i0]; } else - i0 = 0; + i0 = 0; for(ii=0; ii<8; ii++) { - i = (ii + i0) & 7; - if((dm & (1 << i)) && is_boundary(pt, *x+dx[i], *y+dy[i])) { - *x += dx[i]; - *y += dy[i]; - *em = i; - return 1; - } + i = (ii + i0) & 7; + if((dm & (1 << i)) && is_boundary(pt, *x+dx[i], *y+dy[i])) { + *x += dx[i]; + *y += dy[i]; + *em = i; + return 1; + } } return 0; @@ -198,10 +203,10 @@ int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny) float r, ex, ey; if(!dx && !dy) - return 0; + return 0; if(!is_boundary(pt, x, y)) - return 0; + return 0; ldm = direction_to_map(-dy, dx); rdm = direction_to_map(dy, -dx); @@ -212,20 +217,20 @@ int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny) j = 0; for(i=0; i= NORMAL_INTERP) - return 0; + return 0; return get_normal(pt, x, y, dx, dy, nx, ny); } @@ -278,7 +283,7 @@ void kill_part(int i) #ifdef WIN32 _inline int create_part(int p, int x, int y, int t) #else - inline int create_part(int p, int x, int y, int t) +inline int create_part(int p, int x, int y, int t) #endif { int i; @@ -335,19 +340,19 @@ _inline int create_part(int p, int x, int y, int t) if(t==PT_SPRK) { if((pmap[y][x]&0xFF)!=PT_METL && - (pmap[y][x]&0xFF)!=PT_PSCN && - (pmap[y][x]&0xFF)!=PT_NSCN && - (pmap[y][x]&0xFF)!=PT_NTCT && - (pmap[y][x]&0xFF)!=PT_PTCT && - (pmap[y][x]&0xFF)!=PT_WATR && - (pmap[y][x]&0xFF)!=PT_SLTW && - (pmap[y][x]&0xFF)!=PT_BMTL && - (pmap[y][x]&0xFF)!=PT_RBDM && - (pmap[y][x]&0xFF)!=PT_LRBD && - (pmap[y][x]&0xFF)!=PT_ETRD && - (pmap[y][x]&0xFF)!=PT_BRMT && - (pmap[y][x]&0xFF)!=PT_NBLE && - (pmap[y][x]&0xFF)!=PT_INWR) + (pmap[y][x]&0xFF)!=PT_PSCN && + (pmap[y][x]&0xFF)!=PT_NSCN && + (pmap[y][x]&0xFF)!=PT_NTCT && + (pmap[y][x]&0xFF)!=PT_PTCT && + (pmap[y][x]&0xFF)!=PT_WATR && + (pmap[y][x]&0xFF)!=PT_SLTW && + (pmap[y][x]&0xFF)!=PT_BMTL && + (pmap[y][x]&0xFF)!=PT_RBDM && + (pmap[y][x]&0xFF)!=PT_LRBD && + (pmap[y][x]&0xFF)!=PT_ETRD && + (pmap[y][x]&0xFF)!=PT_BRMT && + (pmap[y][x]&0xFF)!=PT_NBLE && + (pmap[y][x]&0xFF)!=PT_INWR) return -1; parts[pmap[y][x]>>8].type = PT_SPRK; parts[pmap[y][x]>>8].life = 4; @@ -401,10 +406,10 @@ _inline int create_part(int p, int x, int y, int t) parts[i].life = 50; if(t==PT_COAL) { parts[i].life = 110; - parts[i].tmp = 50; - } - if(t==PT_BCOL) - parts[i].life = 110; + parts[i].tmp = 50; + } + if(t==PT_BCOL) + parts[i].life = 110; if(t==PT_FIRE) parts[i].life = rand()%50+120; if(t==PT_PLSM) @@ -494,7 +499,7 @@ _inline int create_part(int p, int x, int y, int t) #ifdef WIN32 _inline void delete_part(int x, int y) #else - inline void delete_part(int x, int y) +inline void delete_part(int x, int y) #endif { unsigned i; @@ -512,7 +517,7 @@ _inline void delete_part(int x, int y) #ifdef WIN32 _inline int is_wire(int x, int y) #else - inline int is_wire(int x, int y) +inline int is_wire(int x, int y) #endif { return bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12; @@ -521,7 +526,7 @@ _inline int is_wire(int x, int y) #ifdef WIN32 _inline int is_wire_off(int x, int y) #else - inline int is_wire_off(int x, int y) +inline int is_wire_off(int x, int y) #endif { return (bmap[y][x]==6 || bmap[y][x]==7 || bmap[y][x]==3 || bmap[y][x]==8 || bmap[y][x]==11 || bmap[y][x]==12) && emap[y][x]<8; @@ -556,30 +561,30 @@ void set_emap(int x, int y) // fill children if(y>1 && x1==x2 && - is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && - !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) + is_wire(x1-1, y-1) && is_wire(x1, y-1) && is_wire(x1+1, y-1) && + !is_wire(x1-1, y-2) && is_wire(x1, y-2) && !is_wire(x1+1, y-2)) set_emap(x1, y-2); else if(y>0) for(x=x1; x<=x2; x++) if(is_wire_off(x, y-1)) { if(x==x1 || x==x2 || y>=YRES/CELL-1 || - is_wire(x-1, y-1) || is_wire(x+1, y-1) || - is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) + is_wire(x-1, y-1) || is_wire(x+1, y-1) || + is_wire(x-1, y+1) || !is_wire(x, y+1) || is_wire(x+1, y+1)) set_emap(x, y-1); } if(y=XRES || y>=YRES || - ((bmap[y/CELL][x/CELL]==1 || - bmap[y/CELL][x/CELL]==8 || - bmap[y/CELL][x/CELL]==9 || - (bmap[y/CELL][x/CELL]==2) || - (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || - (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || - (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || - (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || - (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) + ((bmap[y/CELL][x/CELL]==1 || + bmap[y/CELL][x/CELL]==8 || + bmap[y/CELL][x/CELL]==9 || + (bmap[y/CELL][x/CELL]==2) || + (bmap[y/CELL][x/CELL]==3 && ptypes[t].falldown!=2) || + (bmap[y/CELL][x/CELL]==10 && ptypes[t].falldown!=1) || + (bmap[y/CELL][x/CELL]==13 && ptypes[t].falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE) || + (bmap[y/CELL][x/CELL]==6 && (t==PT_METL || t==PT_SPRK)) || + (bmap[y/CELL][x/CELL]==7 && !emap[y/CELL][x/CELL])) && (t!=PT_STKM))) { kill_part(i); continue; @@ -810,8 +815,8 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx=0 && y+ny>0 && - x+nx>8)>=NPART || !r) continue; - if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK) + if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK) { t = parts[i].type = PT_NONE; @@ -1089,7 +1094,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1122,20 +1127,20 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].life--; create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE); } - if((pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40) - parts[i].tmp=39; - else if(parts[i].tmp<40&&parts[i].tmp>0) - parts[i].tmp--; - else if(parts[i].tmp<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_BCOL); - goto killed; - } + if((pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40) + parts[i].tmp=39; + else if(parts[i].tmp<40&&parts[i].tmp>0) + parts[i].tmp--; + else if(parts[i].tmp<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_BCOL); + goto killed; + } for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1143,12 +1148,12 @@ void update_particles_i(pixel *vid, int start, int inc) if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) { if(parts[i].life>100) { - parts[i].life = 99; + parts[i].life = 99; } } } } - else if(t==PT_BCOL) + else if(t==PT_BCOL) { if(parts[i].life<=0) { t = PT_NONE; @@ -1163,7 +1168,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1171,90 +1176,90 @@ void update_particles_i(pixel *vid, int start, int inc) if(((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500)) { if(parts[i].life>100) { - parts[i].life = 99; + parts[i].life = 99; + } + } + } + } + else if(t==PT_FUSE) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%100)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + if((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40) + parts[i].tmp=39; + else if(parts[i].tmp<40&&parts[i].tmp>0) + parts[i].tmp--; + else if(parts[i].tmp<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_FSEP); + goto killed; + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20))) + { + if(parts[i].life>40) { + parts[i].life = 39; + } + } + } + } + else if(t==PT_FSEP) + { + if(parts[i].life<=0) { + t = PT_NONE; + kill_part(i); + r = create_part(-1, x, y, PT_PLSM); + parts[r].life = 50; + goto killed; + } else if (parts[i].life < 40) { + parts[i].life--; + if((rand()%10)==0) { + r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); + parts[r].life = 50; + } + } + for(nx=-2; nx<3; nx++) + for(ny=-2; ny<3; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) + { + if(parts[i].life>40) { + parts[i].life = 39; } } } } - else if(t==PT_FUSE) - { - if(parts[i].life<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; - } else if (parts[i].life < 40) { - parts[i].life--; - if((rand()%100)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; - } - } - if((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40) - parts[i].tmp=39; - else if(parts[i].tmp<40&&parts[i].tmp>0) - parts[i].tmp--; - else if(parts[i].tmp<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_FSEP); - goto killed; - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20))) - { - if(parts[i].life>40) { - parts[i].life = 39; - } - } - } - } - else if(t==PT_FSEP) - { - if(parts[i].life<=0) { - t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; - } else if (parts[i].life < 40) { - parts[i].life--; - if((rand()%10)==0) { - r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; - } - } - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) - continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) - { - if(parts[i].life>40) { - parts[i].life = 39; - } - } - } - } - else if(t==PT_NTCT||t==PT_PTCT||t==PT_INWR) - { - for(nx=-2; nx<3; nx++) - for(ny=-2; ny<3; ny++) - if(x+nx>=0 && y+ny>0 && - x+nx=0 && y+ny>0 && + x+nx>8)>=NPART || !r) continue; @@ -1262,14 +1267,14 @@ void update_particles_i(pixel *vid, int start, int inc) { parts[i].temp = 473.0f; } - } - } - else if(t==PT_PLNT) - { + } + } + else if(t==PT_PLNT) + { for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1321,7 +1326,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1356,7 +1361,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1383,7 +1388,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1413,7 +1418,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1461,7 +1466,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1510,11 +1515,11 @@ void update_particles_i(pixel *vid, int start, int inc) if((r&0xFF)==PT_COAL && 5>(rand()%100)) parts[r>>8].type = PT_WOOD; /*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM && - (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| - ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| - ptypes[parts[r>>8].type-1].menusection==SC_GAS|| - ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000)) - parts[r>>8].type--;*/ + (ptypes[parts[r>>8].type-1].menusection==SC_LIQUID|| + ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE|| + ptypes[parts[r>>8].type-1].menusection==SC_GAS|| + ptypes[parts[r>>8].type-1].menusection==SC_POWDERS) && 15>(rand()%1000)) + parts[r>>8].type--;*/ } } else if(t==PT_PHOT) @@ -1523,7 +1528,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=0; nx<1; nx++) for(ny=0; ny<1; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1734,7 +1739,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1756,7 +1761,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1785,7 +1790,7 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) if(x+nx>=0 && y+ny>0 && - x+nx>8)>=NPART || !r) @@ -1794,8 +1799,8 @@ void update_particles_i(pixel *vid, int start, int inc) continue; rt = parts[r>>8].type; if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && - ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && + ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { parts[r>>8].type = PT_FIRE; parts[r>>8].temp = ptypes[PT_FIRE].heat + (ptypes[rt].flammable/2); @@ -1809,7 +1814,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(legacy_enable) { if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && - ptypes[rt].meltable*lpv>(rand()%1000)) + ptypes[rt].meltable*lpv>(rand()%1000)) { if(t!=PT_LAVA || parts[i].life>0) { @@ -1881,7 +1886,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(pavg != PT_INSL) { if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8)=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) { @@ -1893,7 +1898,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } if(t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8)>8].temp>373.0f))&&pavg != PT_INSL) { @@ -1903,7 +1908,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } if(t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8)>8].temp<373.0f))&&pavg != PT_INSL) { @@ -1913,7 +1918,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } if(t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 && - (parts[i].life<3 || ((r>>8)>8)>8].life==0 && - (parts[i].life<2 || ((r>>8)>8)>8].type = PT_SPRK; parts[r>>8].life = 6; parts[r>>8].ctype = rt; } if(t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 && - (parts[i].life<2 || ((r>>8)>8)>8].type = PT_SPRK; parts[r>>8].life = 5; @@ -1964,7 +1969,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - killed: +killed: if(parts[i].type == PT_NONE) continue; } @@ -2040,7 +2045,7 @@ void update_particles_i(pixel *vid, int start, int inc) if (((int)(player[0])&0x01) == 0x01 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) { if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { @@ -2078,7 +2083,7 @@ void update_particles_i(pixel *vid, int start, int inc) if (((int)(player[0])&0x02) == 0x02 && pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_GAS) { if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID - && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) + && (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG) { if (pmap[(int)(player[8]-1)][(int)(player[7])]) { @@ -2366,11 +2371,11 @@ void update_particles_i(pixel *vid, int start, int inc) for(nx=-1; nx<2; nx++) for(ny=-1; ny<2; ny++) if(x+nx>=0 && y+ny>0 && - x+nx=XRES-CELL || - ny=YRES-CELL) + ny=YRES-CELL) { parts[i].x = lx; parts[i].y = ly; @@ -2424,41 +2429,41 @@ void update_particles_i(pixel *vid, int start, int inc) continue; } - if(parts[i].type == PT_PHOT) { - rt = pmap[ny][nx] & 0xFF; - - if(rt==PT_CLNE) { - lt = pmap[ny][nx] >> 8; - if(!parts[lt].ctype) - parts[lt].ctype = PT_PHOT; - } - - lt = pmap[y][x] & 0xFF; - - if((rt==PT_GLAS && lt!=PT_GLAS) || (rt!=PT_GLAS && lt==PT_GLAS)) { - if(!get_normal_interp(REFRACT|parts[i].type, x, y, parts[i].vx, parts[i].vy, &nrx, &nry)) { - kill_part(i); - continue; - } - nrx = -nrx; - nry = -nry; - if(rt!=PT_GLAS && lt==PT_GLAS) - nn = 2.0; - else - nn = 0.5; - ct1 = parts[i].vx*nrx + parts[i].vy*nry; - ct2 = 1.0f - (nn*nn)*(1.0f-(ct1*ct1)); - if(ct2 < 0.0f) { - parts[i].vx -= 2.0f*ct1*nrx; - parts[i].vy -= 2.0f*ct1*nry; - } else { - ct2 = sqrtf(ct2); - ct2 = ct2 - nn*ct1; - parts[i].vx = nn*parts[i].vx + ct2*nrx; - parts[i].vy = nn*parts[i].vy + ct2*nry; - } - } - } + if(parts[i].type == PT_PHOT) { + rt = pmap[ny][nx] & 0xFF; + + if(rt==PT_CLNE) { + lt = pmap[ny][nx] >> 8; + if(!parts[lt].ctype) + parts[lt].ctype = PT_PHOT; + } + + lt = pmap[y][x] & 0xFF; + + if((rt==PT_GLAS && lt!=PT_GLAS) || (rt!=PT_GLAS && lt==PT_GLAS)) { + if(!get_normal_interp(REFRACT|parts[i].type, x, y, parts[i].vx, parts[i].vy, &nrx, &nry)) { + kill_part(i); + continue; + } + nrx = -nrx; + nry = -nry; + if(rt!=PT_GLAS && lt==PT_GLAS) + nn = 2.0; + else + nn = 0.5; + ct1 = parts[i].vx*nrx + parts[i].vy*nry; + ct2 = 1.0f - (nn*nn)*(1.0f-(ct1*ct1)); + if(ct2 < 0.0f) { + parts[i].vx -= 2.0f*ct1*nrx; + parts[i].vy -= 2.0f*ct1*nry; + } else { + ct2 = sqrtf(ct2); + ct2 = ct2 - nn*ct1; + parts[i].vx = nn*parts[i].vx + ct2*nrx; + parts[i].vy = nn*parts[i].vy + ct2*nry; + } + } + } rt = parts[i].flags & FLAG_STAGNANT; parts[i].flags &= ~FLAG_STAGNANT; @@ -2578,52 +2583,52 @@ void update_particles_i(pixel *vid, int start, int inc) kill_part(i); continue; } - else if(t==PT_NEUT || t==PT_PHOT) - { - if(get_normal_interp(t, lx, ly, parts[i].vx, parts[i].vy, &nrx, &nry)) { - dp = nrx*parts[i].vx + nry*parts[i].vy; - parts[i].vx -= 2.0f*dp*nrx; - parts[i].vy -= 2.0f*dp*nry; - nx = (int)(parts[i].x + parts[i].vx + 0.5f); - ny = (int)(parts[i].y + parts[i].vy + 0.5f); - if(try_move(i, x, y, nx, ny)) { - parts[i].x = (float)nx; - parts[i].y = (float)ny; - } else { - kill_part(i); - continue; - } - } else { - kill_part(i); - continue; - } - } - - else - { - if(nx>x+ISTP) nx=x+ISTP; - if(nxy+ISTP) ny=y+ISTP; - if(nyx+ISTP) nx=x+ISTP; + if(nxy+ISTP) ny=y+ISTP; + if(ny=XRES-CELL || ny=YRES-CELL) { @@ -3282,8 +3287,8 @@ int create_parts(int x, int y, int r, int c) for(v=-1; v<2; v++) for(u=-1; u<2; u++) if(i+u>=0 && i+u=0 && j+v=0 && j+v Date: Sat, 2 Oct 2010 19:47:43 +0200 Subject: supposed fix for photon heat diff --git a/src/powder.c b/src/powder.c index 1943615..79c1bd4 100644 --- a/src/powder.c +++ b/src/powder.c @@ -73,7 +73,7 @@ int try_move(int i, int x, int y, int nx, int ny) if(!e) { if(!legacy_enable) { if((r >> 8) < PT_NUM) - | parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP);; + parts[i].temp = parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP); } return 0; } -- cgit v0.9.2-21-gd62e From 769dbfeedddc774b177e2089eaa5abe870205e6b Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 2 Oct 2010 20:03:00 +0200 Subject: fixes to photons, thanks to skylark diff --git a/src/powder.c b/src/powder.c index 79c1bd4..3ca1056 100644 --- a/src/powder.c +++ b/src/powder.c @@ -35,8 +35,11 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) r = (r&~0xFF) | parts[r>>8].type; if(rr) *rr = r; - - if(pt==PT_PHOT&&((r&0xFF)==PT_GLAS||(r&0xFF)==PT_PHOT||(r&0xFF)==PT_CLNE||((r&0xFF)==PT_LCRY||((r&0xFF)==PT_PCLN&&parts[r>>8].life > 5)))) + if(pt==PT_PHOT&&( + (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT || + (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || + (r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW || + ((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) return 2; if(pt==PT_STKM) //Stick man's head shouldn't collide @@ -73,7 +76,7 @@ int try_move(int i, int x, int y, int nx, int ny) if(!e) { if(!legacy_enable) { if((r >> 8) < PT_NUM) - parts[i].temp = parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP); + parts[i].temp = parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP); } return 0; } -- cgit v0.9.2-21-gd62e From 7692ee51fc38428e0fa894310b065752472ae8f1 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 2 Oct 2010 20:19:43 +0200 Subject: fixes, thanks to Mr. Stanislaw diff --git a/src/powder.c b/src/powder.c index 3ca1056..c84d71c 100644 --- a/src/powder.c +++ b/src/powder.c @@ -74,11 +74,13 @@ int try_move(int i, int x, int y, int nx, int ny) e = eval_move(parts[i].type, nx, ny, &r); if(!e) { - if(!legacy_enable) { + if(!legacy_enable && parts[i].type==PT_PHOT) { if((r >> 8) < PT_NUM) - parts[i].temp = parts[r>>8].temp = restrict_flt(parts[r>>8].temp+parts[i].temp/2, MIN_TEMP, MAX_TEMP); + parts[i].temp = parts[r>>8].temp = + restrict_flt((parts[r>>8].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP); } return 0; + return 0; } if(e == 2) return 1; -- cgit v0.9.2-21-gd62e From d80f3e346b493c46855442609f1c3962af13be3a Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 2 Oct 2010 20:46:17 +0200 Subject: fixed temperature transfers, Skylark diff --git a/src/powder.c b/src/powder.c index c84d71c..cdad9b0 100644 --- a/src/powder.c +++ b/src/powder.c @@ -75,12 +75,11 @@ int try_move(int i, int x, int y, int nx, int ny) e = eval_move(parts[i].type, nx, ny, &r); if(!e) { if(!legacy_enable && parts[i].type==PT_PHOT) { - if((r >> 8) < PT_NUM) + if((r & 0xFF ) < PT_NUM) parts[i].temp = parts[r>>8].temp = restrict_flt((parts[r>>8].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP); } return 0; - return 0; } if(e == 2) return 1; -- cgit v0.9.2-21-gd62e From 5591a7346cd11b2d45cb80e37526714741be5842 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 3 Oct 2010 14:56:30 +0100 Subject: Firework improvements and Fire changes diff --git a/includes/hmap.h b/includes/hmap.h index 1af8013..de18061 100755 --- a/includes/hmap.h +++ b/includes/hmap.h @@ -26,8 +26,9 @@ //Hue Scale //static char color_data[] = {0xFF,0x00,0xFF,0xFE,0x00,0xFF,0xFC,0x00,0xFF,0xFB,0x00,0xFF,0xF9,0x00,0xFF,0xF8,0x00,0xFF,0xF6,0x00,0xFF,0xF4,0x00,0xFF,0xF2,0x00,0xFF,0xF0,0x00,0xFF,0xEE,0x00,0xFF,0xEC,0x00,0xFF,0xEA,0x00,0xFF,0xE8,0x00,0xFF,0xE5,0x00,0xFF,0xE3,0x00,0xFF,0xE1,0x00,0xFF,0xDE,0x00,0xFF,0xDC,0x00,0xFF,0xD9,0x00,0xFF,0xD6,0x00,0xFF,0xD4,0x00,0xFF,0xD1,0x00,0xFF,0xCE,0x00,0xFF,0xCC,0x00,0xFF,0xC9,0x00,0xFF,0xC6,0x00,0xFF,0xC3,0x00,0xFF,0xC1,0x00,0xFF,0xBE,0x00,0xFF,0xBB,0x00,0xFF,0xB8,0x00,0xFF,0xB5,0x00,0xFF,0xB2,0x00,0xFF,0xAF,0x00,0xFF,0xAC,0x00,0xFF,0xA9,0x00,0xFF,0xA7,0x00,0xFF,0xA4,0x00,0xFF,0xA1,0x00,0xFF,0x9E,0x00,0xFF,0x9B,0x00,0xFF,0x98,0x00,0xFF,0x95,0x00,0xFF,0x93,0x00,0xFF,0x90,0x00,0xFF,0x8D,0x00,0xFF,0x8A,0x00,0xFF,0x88,0x00,0xFF,0x85,0x00,0xFF,0x83,0x00,0xFF,0x80,0x00,0xFF,0x7E,0x00,0xFF,0x7B,0x00,0xFF,0x78,0x00,0xFF,0x76,0x00,0xFF,0x73,0x00,0xFF,0x70,0x00,0xFF,0x6E,0x00,0xFF,0x6B,0x00,0xFF,0x68,0x00,0xFF,0x65,0x00,0xFF,0x63,0x00,0xFF,0x60,0x00,0xFF,0x5D,0x00,0xFF,0x5A,0x00,0xFF,0x57,0x00,0xFF,0x54,0x00,0xFF,0x51,0x00,0xFF,0x4E,0x00,0xFF,0x4B,0x00,0xFF,0x49,0x00,0xFF,0x46,0x00,0xFF,0x43,0x00,0xFF,0x40,0x00,0xFF,0x3D,0x00,0xFF,0x3A,0x00,0xFF,0x37,0x00,0xFF,0x35,0x00,0xFF,0x32,0x00,0xFF,0x2F,0x00,0xFF,0x2C,0x00,0xFF,0x2A,0x00,0xFF,0x27,0x00,0xFF,0x25,0x00,0xFF,0x22,0x00,0xFF,0x20,0x00,0xFF,0x1D,0x00,0xFF,0x1B,0x00,0xFF,0x18,0x00,0xFF,0x16,0x00,0xFF,0x14,0x00,0xFF,0x12,0x00,0xFF,0x10,0x00,0xFF,0x0E,0x00,0xFF,0x0C,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x00,0x00,0xFF,0x00,0x01,0xFF,0x00,0x02,0xFF,0x00,0x04,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x08,0xFF,0x00,0x0A,0xFF,0x00,0x0C,0xFF,0x00,0x0E,0xFF,0x00,0x10,0xFF,0x00,0x12,0xFF,0x00,0x14,0xFF,0x00,0x16,0xFF,0x00,0x19,0xFF,0x00,0x1B,0xFF,0x00,0x1D,0xFF,0x00,0x20,0xFF,0x00,0x22,0xFF,0x00,0x25,0xFF,0x00,0x28,0xFF,0x00,0x2A,0xFF,0x00,0x2D,0xFF,0x00,0x30,0xFF,0x00,0x32,0xFF,0x00,0x35,0xFF,0x00,0x38,0xFF,0x00,0x3B,0xFF,0x00,0x3D,0xFF,0x00,0x40,0xFF,0x00,0x43,0xFF,0x00,0x46,0xFF,0x00,0x49,0xFF,0x00,0x4C,0xFF,0x00,0x4F,0xFF,0x00,0x52,0xFF,0x00,0x55,0xFF,0x00,0x57,0xFF,0x00,0x5A,0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x00,0xFF,0x21,0x00,0xFF,0x1F,0x00,0xFF,0x1D,0x00,0xFF,0x1A,0x00,0xFF,0x18,0x00,0xFF,0x16,0x00,0xFF,0x13,0x00,0xFF,0x11,0x00,0xFF,0x0F,0x00,0xFF,0x0D,0x00,0xFF,0x0B,0x00,0xFF,0x0A,0x00,0xFF,0x08,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x00,0x01,0xFF,0x00,0x02,0xFF,0x00,0x04,0xFF,0x00,0x05,0xFF,0x00,0x07,0xFF,0x00,0x09,0xFF,0x00,0x0A,0xFF,0x00,0x0C,0xFF,0x00,0x0E,0xFF,0x00,0x10,0xFF,0x00,0x12,0xFF,0x00,0x15,0xFF,0x00,0x17,0xFF,0x00,0x19,0xFF,0x00,0x1B,0xFF,0x00,0x1E,0xFF,0x00,0x20,0xFF,0x00,0x23,0xFF,0x00,0x25,0xFF,0x00,0x28,0xFF,0x00,0x2A,0xFF,0x00,0x2D,0xFF,0x00,0x30,0xFF,0x00,0x33,0xFF,0x00,0x35,0xFF,0x00,0x38,0xFF,0x00,0x3B,0xFF,0x00,0x3E,0xFF,0x00,0x41,0xFF,0x00,0x44,0xFF,0x00,0x46,0xFF,0x00,0x49,0xFF,0x00,0x4C,0xFF,0x00,0x4F,0xFF,0x00,0x52,0xFF,0x00,0x55,0xFF,0x00,0x58,0xFF,0x00,0x5B,0xFF,0x00,0x5E,0xFF,0x00,0x61,0xFF,0x00,0x63,0xFF,0x00,0x66,0xFF,0x00,0x69,0xFF,0x00,0x6C,0xFF,0x00,0x6F,0xFF,0x00,0x71,0xFF,0x00,0x74,0xFF,0x00,0x77,0xFF,0x00,0x79,0xFF,0x00,0x7C,0xFF,0x00,0x7F,0xFF,0x00,0x81,0xFF,0x00,0x84,0xFF,0x00,0x86,0xFF,0x00,0x89,0xFF,0x00,0x8B,0xFF,0x00,0x8E,0xFF,0x00,0x91,0xFF,0x00,0x94,0xFF,0x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,0xBA,0x00,0xFF,0xB7,0x00,0xFF,0xB4,0x00,0xFF,0xB1,0x00,0xFF,0xAE,0x00,0xFF,0xAB,0x00,0xFF,0xA8,0x00,0xFF,0xA5,0x00,0xFF,0xA2,0x00,0xFF,0x9F,0x00,0xFF,0x9D,0x00,0xFF,0x9A,0x00,0xFF,0x97,0x00,0xFF,0x94,0x00,0xFF,0x91,0x00,0xFF,0x8F,0x00,0xFF,0x8C,0x00,0xFF,0x89,0x00,0xFF,0x87,0x00,0xFF,0x84,0x00,0xFF,0x81,0x00,0xFF,0x7F,0x00,0xFF,0x7C,0x00,0xFF,0x7A,0x00,0xFF,0x77,0x00,0xFF,0x75,0x00,0xFF,0x72,0x00,0xFF,0x6F,0x00,0xFF,0x6C,0x00,0xFF,0x6A,0x00,0xFF,0x67,0x00,0xFF,0x64,0x00,0xFF,0x61,0x00,0xFF,0x5E,0x00,0xFF,0x5B,0x00,0xFF,0x58,0x00,0xFF,0x56,0x00,0xFF,0x53,0x00,0xFF,0x50,0x00,0xFF,0x4D,0x00,0xFF,0x4A,0x00,0xFF,0x47,0x00,0xFF,0x44,0x00,0xFF,0x41,0x00,0xFF,0x3E,0x00,0xFF,0x3C,0x00,0xFF,0x39,0x00,0xFF,0x36,0x00,0xFF,0x33,0x00,0xFF,0x31,0x00,0xFF,0x2E,0x00,0xFF,0x2B,0x00,0xFF,0x29,0x00,0xFF,0x26,0x00,0xFF,0x23,0x00,0xFF,0x21,0x00,0xFF,0x1E,0x00,0xFF,0x1C,0x00,0xFF,0x1A,0x00,0xFF,0x17,0x00,0xFF,0x15,0x00,0xFF,0x13,0x00,0xFF,0x11,0x00,0xFF,0x0F,0x00,0xFF,0x0D,0x00,0xFF,0x0B,0x00,0xFF,0x09,0x00,0xFF,0x07,0x00,0xFF,0x06,0x00,0xFF,0x04,0x00,0xFF,0x03,0x00,0xFF,0x01,0x00}; //Scaled Hue Scale -static char color_data[] = {0xFF,0x00,0xFF,0xF1,0x00,0xFF,0xDE,0x00,0xFF,0xC7,0x00,0xFF,0xAF,0x00,0xFF,0x97,0x00,0xFF,0x82,0x00,0xFF,0x6C,0x00,0xFF,0x56,0x00,0xFF,0x41,0x00,0xFF,0x2E,0x00,0xFF,0x21,0x05,0xFF,0x16,0x0F,0xFF,0x0E,0x1B,0xFF,0x07,0x29,0xFF,0x02,0x39,0xFF,0x00,0x4B,0xFF,0x00,0x5E,0xFF,0x00,0x74,0xFF,0x00,0x8A,0xFF,0x00,0xA0,0xFF,0x00,0xAF,0xFF,0x00,0xB8,0xFE,0x00,0xC2,0xFD,0x00,0xCC,0xFD,0x00,0xD5,0xFC,0x00,0xDF,0xFA,0x00,0xE7,0xF9,0x00,0xEF,0xF6,0x00,0xF6,0xF3,0x00,0xFC,0xEE,0x00,0xFF,0xE8,0x00,0xFF,0xE1,0x00,0xFF,0xD8,0x00,0xFF,0xCE,0x00,0xFF,0xC4,0x00,0xFF,0xB9,0x00,0xFF,0xAD,0x00,0xFF,0xA1,0x00,0xFF,0x96,0x00,0xFF,0x8A,0x00,0xFF,0x80,0x00,0xFF,0x7C,0x00,0xFF,0x78,0x00,0xFF,0x75,0x00,0xFF,0x71,0x00,0xFF,0x6D,0x00,0xFF,0x69,0x00,0xFF,0x66,0x00,0xFF,0x62,0x00,0xFF,0x5E,0x00,0xFF,0x5A,0x00,0xFF,0x56,0x00,0xFF,0x52,0x00,0xFF,0x4E,0x00,0xFF,0x4A,0x00,0xFF,0x47,0x00,0xFF,0x43,0x00,0xFF,0x3F,0x00,0xFF,0x3B,0x00,0xFF,0x38,0x00,0xFF,0x34,0x00,0xFF,0x31,0x00,0xFF,0x2D,0x00,0xFF,0x2A,0x00,0xFF,0x27,0x00,0xFF,0x24,0x00,0xFF,0x21,0x00,0xFF,0x1E,0x00,0xFF,0x1B,0x00,0xFF,0x19,0x00,0xFF,0x17,0x01,0xFF,0x14,0x02,0xFF,0x13,0x04,0xFF,0x11,0x06,0xFF,0x0F,0x07,0xFF,0x0E,0x0A,0xFF,0x0C,0x0C,0xFF,0x0B,0x0E,0xFF,0x0A,0x10,0xFF,0x09,0x13,0xFF,0x08,0x16,0xFF,0x07,0x18,0xFF,0x06,0x1B,0xFF,0x06,0x1E,0xFF,0x05,0x21,0xFF,0x04,0x24,0xFF,0x04,0x27,0xFF,0x04,0x2A,0xFF,0x03,0x2D,0xFF,0x03,0x30,0xFF,0x03,0x34,0xFF,0x02,0x37,0xFF,0x02,0x3A,0xFF,0x02,0x3D,0xFF,0x02,0x41,0xFF,0x02,0x44,0xFF,0x01,0x47,0xFF,0x01,0x4A,0xFF,0x01,0x4E,0xFF,0x01,0x51,0xFF,0x00,0x54,0xFF,0x00,0x56,0xFF,0x00,0x58,0xFF,0x00,0x5A,0xFF,0x00,0x5C,0xFF,0x00,0x5E,0xFF,0x00,0x60,0xFF,0x00,0x62,0xFF,0x00,0x64,0xFF,0x00,0x66,0xFF,0x00,0x68,0xFF,0x00,0x6A,0xFF,0x00,0x6D,0xFF,0x00,0x6F,0xFF,0x00,0x71,0xFF,0x00,0x73,0xFF,0x00,0x75,0xFF,0x00,0x77,0xFF,0x00,0x7A,0xFF,0x00,0x7C,0xFF,0x00,0x7E,0xFF,0x00,0x80,0xFF,0x00,0x83,0xFF,0x00,0x85,0xFF,0x00,0x87,0xFF,0x00,0x89,0xFF,0x00,0x8B,0xFF,0x00,0x8E,0xFF,0x00,0x90,0xFF,0x00,0x92,0xFF,0x00,0x94,0xFF,0x00,0x97,0xFF,0x00,0x99,0xFF,0x00,0x9B,0xFF,0x00,0x9D,0xFF,0x00,0x9F,0xFF,0x00,0xA1,0xFF,0x00,0xA3,0xFF,0x00,0xA6,0xFF,0x00,0xA8,0xFF,0x00,0xAA,0xFF,0x00,0xAC,0xFF,0x00,0xAE,0xFF,0x00,0xB0,0xFF,0x00,0xB2,0xFF,0x00,0xB3,0xFF,0x00,0xB5,0xFF,0x00,0xB7,0xFF,0x00,0xB9,0xFF,0x00,0xBB,0xFF,0x00,0xBD,0xFF,0x00,0xBE,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x90,0x00,0xFF,0x8F,0x00,0xFF,0x8E,0x00,0xFF,0x8D,0x00,0xFF,0x8C,0x00,0xFF,0x8B,0x00,0xFF,0x8A,0x00,0xFF,0x89,0x00,0xFF,0x88,0x00,0xFF,0x87,0x00,0xFF,0x86,0x00,0xFF,0x85,0x00,0xFF,0x84,0x00,0xFF,0x83,0x00,0xFF,0x82,0x00,0xFF,0x81,0x00,0xFF,0x80,0x00,0xFF,0x7F,0x00,0xFF,0x7E,0x00,0xFF,0x7D,0x00,0xFF,0x7C,0x00,0xFF,0x7B,0x00,0xFF,0x7A,0x00,0xFF,0x79,0x00,0xFF,0x78,0x00,0xFF,0x77,0x00,0xFF,0x76,0x00,0xFF,0x75,0x00,0xFF,0x74,0x00,0xFF,0x73,0x00,0xFF,0x72,0x00,0xFF,0x71,0x00,0xFF,0x70,0x00,0xFF,0x6F,0x00,0xFF,0x6E,0x00,0xFF,0x6D,0x00,0xFF,0x6C,0x00,0xFF,0x6B,0x00,0xFF,0x6A,0x00,0xFF,0x6A,0x00,0xFF,0x69,0x00,0xFF,0x68,0x00,0xFF,0x68,0x00,0xFF,0x67,0x00,0xFF,0x66,0x00,0xFF,0x66,0x00,0xFF,0x65,0x00,0xFF,0x65,0x00,0xFF,0x64,0x00,0xFF,0x63,0x00,0xFF,0x63,0x00,0xFF,0x62,0x00,0xFF,0x61,0x00,0xFF,0x61,0x00,0xFF,0x60,0x00,0xFF,0x5F,0x00,0xFF,0x5F,0x00,0xFF,0x5E,0x00,0xFF,0x5D,0x00,0xFF,0x5D,0x00,0xFF,0x5C,0x00,0xFF,0x5B,0x00,0xFF,0x5B,0x00,0xFF,0x5A,0x00,0xFF,0x59,0x00,0xFF,0x59,0x00,0xFF,0x58,0x00,0xFF,0x57,0x00,0xFF,0x57,0x00,0xFF,0x56,0x00,0xFF,0x55,0x00,0xFF,0x54,0x00,0xFF,0x54,0x00,0xFF,0x53,0x00,0xFF,0x52,0x00,0xFF,0x52,0x00,0xFF,0x51,0x00,0xFF,0x50,0x00,0xFF,0x50,0x00,0xFF,0x4F,0x00,0xFF,0x4E,0x00,0xFF,0x4E,0x00,0xFF,0x4D,0x00,0xFF,0x4C,0x00,0xFF,0x4B,0x00,0xFF,0x4B,0x00,0xFF,0x4A,0x00,0xFF,0x49,0x00,0xFF,0x49,0x00,0xFF,0x48,0x00,0xFF,0x47,0x00,0xFF,0x46,0x00,0xFF,0x46,0x00,0xFF,0x45,0x00,0xFF,0x44,0x00,0xFF,0x44,0x00,0xFF,0x43,0x00,0xFF,0x42,0x00,0xFF,0x41,0x00,0xFF,0x41,0x00,0xFF,0x40,0x00,0xFF,0x3F,0x00,0xFF,0x3F,0x00,0xFF,0x3E,0x00,0xFF,0x3D,0x00,0xFF,0x3C,0x00,0xFF,0x3C,0x00,0xFF,0x3B,0x00,0xFF,0x3A,0x00,0xFF,0x3A,0x00,0xFF,0x39,0x00,0xFF,0x38,0x00,0xFF,0x38,0x00,0xFF,0x37,0x00,0xFF,0x36,0x00,0xFF,0x35,0x00,0xFF,0x35,0x00,0xFF,0x34,0x00,0xFF,0x33,0x00,0xFF,0x33,0x00,0xFF,0x32,0x00,0xFF,0x31,0x00,0xFF,0x31,0x00,0xFF,0x30,0x00,0xFF,0x2F,0x00,0xFF,0x2E,0x00,0xFF,0x2E,0x00,0xFF,0x2D,0x00,0xFF,0x2C,0x00,0xFF,0x2C,0x00,0xFF,0x2B,0x00,0xFF,0x2A,0x00,0xFF,0x2A,0x00,0xFF,0x29,0x00,0xFF,0x28,0x00,0xFF,0x28,0x00,0xFF,0x27,0x00,0xFF,0x26,0x00,0xFF,0x26,0x00,0xFF,0x25,0x00,0xFF,0x24,0x00,0xFF,0x24,0x00,0xFF,0x23,0x00,0xFF,0x22,0x00,0xFF,0x22,0x00,0xFF,0x21,0x00,0xFF,0x21,0x00,0xFF,0x20,0x00,0xFF,0x1F,0x00,0xFF,0x1F,0x00,0xFF,0x1E,0x00,0xFF,0x1D,0x00,0xFF,0x1D,0x00,0xFF,0x1C,0x00,0xFF,0x1C,0x00,0xFF,0x1B,0x00,0xFF,0x1A,0x00,0xFF,0x1A,0x00,0xFF,0x19,0x00,0xFF,0x19,0x00,0xFF,0x18,0x00,0xFF,0x17,0x00,0xFF,0x17,0x00,0xFF,0x16,0x00,0xFF,0x16,0x00,0xFF,0x15,0x00,0xFF,0x14,0x00,0xFF,0x14,0x00,0xFF,0x13,0x00,0xFF,0x13,0x00,0xFF,0x12,0x00,0xFF,0x12,0x00,0xFF,0x11,0x00,0xFF,0x11,0x00,0xFF,0x10,0x00,0xFF,0x10,0x00,0xFF,0x0F,0x00,0xFF,0x0F,0x00,0xFF,0x0E,0x00,0xFF,0x0E,0x00,0xFF,0x0D,0x00,0xFF,0x0D,0x00,0xFF,0x0C,0x00,0xFF,0x0C,0x00,0xFF,0x0B,0x00,0xFF,0x0B,0x00,0xFF,0x0A,0x00,0xFF,0x0A,0x00,0xFF,0x09,0x00,0xFF,0x09,0x00,0xFF,0x08,0x00,0xFF,0x08,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x06,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x05,0x00,0xFF,0x05,0x00,0xFF,0x04,0x00,0xFF,0x04,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x02,0x00,0xFF,0x02,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x00,0x00}; -static char plasma_data[] = {0x00,0x00,0x00,0x03,0x00,0x00,0x05,0x00,0x00,0x09,0x00,0x00,0x0E,0x00,0x00,0x12,0x00,0x00,0x17,0x00,0x00,0x1C,0x00,0x00,0x22,0x00,0x00,0x27,0x00,0x00,0x2C,0x00,0x00,0x32,0x00,0x00,0x37,0x00,0x00,0x3C,0x00,0x00,0x41,0x00,0x00,0x45,0x00,0x00,0x4A,0x00,0x00,0x4D,0x00,0x00,0x51,0x00,0x00,0x53,0x00,0x00,0x55,0x00,0x00,0x55,0x00,0x02,0x55,0x02,0x03,0x55,0x03,0x06,0x55,0x03,0x07,0x55,0x05,0x09,0x55,0x06,0x0C,0x55,0x06,0x0F,0x55,0x07,0x10,0x55,0x09,0x13,0x55,0x0A,0x16,0x55,0x0C,0x1A,0x55,0x0C,0x1D,0x54,0x0E,0x20,0x53,0x10,0x23,0x54,0x11,0x26,0x53,0x13,0x2A,0x52,0x14,0x2E,0x51,0x15,0x31,0x50,0x17,0x35,0x50,0x19,0x38,0x4E,0x1A,0x3D,0x4D,0x1C,0x40,0x4D,0x1D,0x44,0x4C,0x1F,0x47,0x4B,0x21,0x4C,0x4A,0x23,0x4F,0x49,0x24,0x54,0x48,0x25,0x57,0x47,0x28,0x5B,0x46,0x29,0x5F,0x45,0x2B,0x62,0x44,0x2D,0x66,0x44,0x2E,0x6A,0x43,0x30,0x6E,0x42,0x32,0x72,0x41,0x33,0x76,0x40,0x35,0x79,0x3F,0x38,0x7C,0x3F,0x39,0x7F,0x3E,0x3B,0x83,0x3D,0x3D,0x86,0x3C,0x3F,0x8A,0x3B,0x40,0x8C,0x3B,0x43,0x8F,0x3B,0x44,0x92,0x3A,0x46,0x95,0x39,0x48,0x98,0x39,0x4A,0x9B,0x39,0x4C,0x9C,0x39,0x4E,0x9F,0x3A,0x4F,0xA1,0x39,0x51,0xA3,0x39,0x52,0xA4,0x39,0x54,0xA6,0x39,0x56,0xA7,0x39,0x57,0xA8,0x39,0x58,0xA8,0x3A,0x5A,0xA9,0x3A,0x5C,0xA8,0x3A,0x5D,0xA8,0x3B,0x5F,0xA8,0x3C,0x61,0xA8,0x3D,0x62,0xA8,0x3D,0x64,0xA9,0x3E,0x66,0xA8,0x3E,0x67,0xA9,0x3F,0x68,0xA8,0x40,0x6A,0xA8,0x41,0x6C,0xA8,0x42,0x6E,0xA8,0x42,0x70,0xA8,0x43,0x71,0xA8,0x44,0x73,0xA8,0x45,0x74,0xA9,0x46,0x76,0xA8,0x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, 0x14, 0x35, 0x17, 0x15, 0x36, 0x18, 0x15, 0x39, 0x19, 0x16, 0x3B, 0x19, 0x17, 0x3D, 0x1B, 0x17, 0x3E, 0x1B, 0x18, 0x40, 0x1C, 0x19, 0x42, 0x1D, 0x1A, 0x43, 0x1D, 0x1B, 0x45, 0x1E, 0x1C, 0x47, 0x1F, 0x1C, 0x49, 0x20, 0x1D, 0x4B, 0x21, 0x1F, 0x4C, 0x21, 0x1F, 0x4E, 0x22, 0x20, 0x50, 0x23, 0x21, 0x52, 0x23, 0x22, 0x53, 0x24, 0x23, 0x55, 0x25, 0x23, 0x56, 0x26, 0x24, 0x59, 0x26, 0x25, 0x5A, 0x27, 0x26, 0x5B, 0x28, 0x27, 0x5D, 0x28, 0x28, 0x5E, 0x29, 0x29, 0x60, 0x29, 0x2A, 0x62, 0x2A, 0x2B, 0x63, 0x2B, 0x2C, 0x64, 0x2C, 0x2E, 0x65, 0x2C, 0x2E, 0x66, 0x2C, 0x2F, 0x68, 0x2D, 0x31, 0x69, 0x2E, 0x32, 0x6A, 0x2F, 0x32, 0x6B, 0x2F, 0x34, 0x6C, 0x30, 0x34, 0x6D, 0x30, 0x35, 0x6F, 0x31, 0x37, 0x70, 0x31, 0x38, 0x71, 0x32, 0x39, 0x72, 0x33, 0x3B, 0x73, 0x33, 0x3C, 0x74, 0x34, 0x3D, 0x75, 0x35, 0x3E, 0x76, 0x35, 0x3F, 0x78, 0x36, 0x41, 0x78, 0x36, 0x42, 0x79, 0x36, 0x43, 0x7A, 0x37, 0x44, 0x7B, 0x37, 0x46, 0x7C, 0x38, 0x48, 0x7D, 0x39, 0x48, 0x7E, 0x3A, 0x49, 0x7F, 0x39, 0x4B, 0x80, 0x3A, 0x4C, 0x81, 0x3B, 0x4E, 0x82, 0x3C, 0x4F, 0x83, 0x3C, 0x51, 0x84, 0x3C, 0x52, 0x84, 0x3D, 0x54, 0x86, 0x3E, 0x55, 0x87, 0x3E, 0x56, 0x88, 0x3F, 0x57, 0x89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A,0x00,0xFF,0xA8,0x00,0xFF,0xA5,0x00,0xFF,0xA3,0x00,0xFF,0xA1,0x00,0xFF,0x9F,0x00,0xFF,0x9C,0x00,0xFF,0x99,0x00,0xFF,0x97,0x00,0xFF,0x95,0x00,0xFF,0x93,0x00,0xFF,0x90,0x00,0xFF,0x8F,0x00,0xFF,0x8C,0x00,0xFF,0x8A,0x00,0xFF,0x88,0x00,0xFF,0x86,0x00,0xFF,0x83,0x00,0xFF,0x81,0x00,0xFF,0x7F,0x00,0xFF,0x7D,0x00,0xFF,0x7C,0x00,0xFF,0x7A,0x00,0xFF,0x78,0x00,0xFF,0x76,0x00,0xFF,0x74,0x00,0xFF,0x72,0x00,0xFF,0x71,0x00,0xFF,0x6F,0x00,0xFF,0x6D,0x00,0xFF,0x6A,0x00,0xFF,0x69,0x00,0xFF,0x67,0x00,0xFF,0x65,0x00,0xFF,0x64,0x00,0xFF,0x61,0x00,0xFF,0x5F,0x00,0xFF,0x5D,0x00,0xFF,0x5B,0x00,0xFF,0x5A,0x00,0xFF,0x57,0x00,0xFF,0x56,0x00,0xFF,0x54,0x00,0xFF,0x51,0x00,0xFF,0x4F,0x00,0xFF,0x4E,0x00,0xFF,0x4C,0x00,0xFF,0x4A,0x00,0xFF,0x48,0x00,0xFF,0x46,0x00,0xFF,0x45,0x00,0xFF,0x43,0x00,0xFF,0x40,0x00,0xFF,0x3F,0x00,0xFF,0x3C,0x00,0xFF,0x3B,0x00,0xFF,0x39,0x00,0xFF,0x37,0x00,0xFF,0x35,0x00,0xFF,0x33,0x00,0xFF,0x32,0x00,0xFF,0x30,0x00,0xFF,0x2F,0x00,0xFF,0x2D,0x00,0xFF,0x2B,0x00,0xFF,0x2A,0x00,0xFF,0x28,0x00,0xFF,0x27,0x00,0xFF,0x25,0x00,0xFF,0x23,0x00,0xFF,0x22,0x00,0xFF,0x21,0x00,0xFF,0x1F,0x00,0xFF,0x1E,0x00,0xFF,0x1C,0x00,0xFF,0x1B,0x00,0xFF,0x1A,0x00,0xFF,0x19,0x00,0xFF,0x18,0x00,0xFF,0x16,0x00,0xFF,0x16,0x01,0xFF,0x15,0x02,0xFF,0x14,0x02,0xFF,0x12,0x02,0xFF,0x12,0x03,0xFF,0x12,0x04,0xFF,0x10,0x05,0xFF,0x10,0x06,0xFF,0x0F,0x06,0xFF,0x0F,0x07,0xFF,0x0D,0x08,0xFF,0x0D,0x09,0xFF,0x0C,0x0A,0xFF,0x0C,0x0B,0xFF,0x0C,0x0C,0xFF,0x0B,0x0C,0xFF,0x0B,0x0E,0xFF,0x0A,0x0F,0xFF,0x09,0x10,0xFF,0x09,0x11,0xFF,0x08,0x12,0xFF,0x08,0x13,0xFF,0x08,0x14,0xFF,0x07,0x15,0xFF,0x07,0x16,0xFF,0x06,0x18,0xFF,0x06,0x19,0xFF,0x06,0x1A,0xFF,0x06,0x1C,0xFF,0x06,0x1D,0xFF,0x06,0x1E,0xFF,0x05,0x1F,0xFF,0x05,0x20,0xFF,0x05,0x21,0xFF,0x05,0x23,0xFF,0x04,0x24,0xFF,0x04,0x25,0xFF,0x04,0x26,0xFF,0x04,0x28,0xFF,0x03,0x29,0xFF,0x03,0x2B,0xFF,0x03,0x2B,0xFF,0x03,0x2D,0xFF,0x03,0x2E,0xFF,0x03,0x30,0xFF,0x03,0x31,0xFF,0x02,0x32,0xFF,0x03,0x34,0xFF,0x03,0x35,0xFF,0x02,0x37,0xFF,0x03,0x39,0xFF,0x02,0x3A,0xFF,0x02,0x3B,0xFF,0x01,0x3C,0xFF,0x01,0x3E,0xFF,0x01,0x3F,0xFF,0x01,0x40,0xFF,0x02,0x42,0xFF,0x02,0x44,0xFF,0x01,0x45,0xFF,0x01,0x46,0xFF,0x01,0x48,0xFF,0x01,0x49,0xFF,0x01,0x4A,0xFF,0x01,0x4C,0xFF,0x00,0x4E,0xFF,0x01,0x4E,0xFF,0x00,0x50,0xFF,0x01,0x52,0xFF,0x01,0x52,0xFF,0x00,0x54,0xFF,0x00,0x55,0xFF,0x00,0x56,0xFF,0x00,0x58,0xFF,0x00,0x58,0xFF,0x00,0x59,0xFF,0x00,0x5A,0xFF,0x00,0x5B,0xFF,0x00,0x5C,0xFF,0x00,0x5D,0xFF,0x00,0x5E,0xFF,0x00,0x5F,0xFF,0x00,0x60,0xFF,0x00,0x61,0xFF,0x00,0x62,0xFF,0x00,0x63,0xFF,0x00,0x64,0xFF,0x00,0x65,0xFF,0x00,0x66,0xFF,0x00,0x67,0xFF,0x00,0x69,0xFF,0x00,0x6A,0xFF,0x00,0x6A,0xFF,0x00,0x6B,0xFF,0x00,0x6C,0xFF,0x00,0x6E,0xFF,0x00,0x6F,0xFF,0x00,0x70,0xFF,0x00,0x71,0xFF,0x00,0x72,0xFF,0x00,0x73,0xFF,0x00,0x74,0xFF,0x00,0x75,0xFF,0x00,0x76,0xFF,0x00,0x77,0xFF,0x00,0x79,0xFF,0x00,0x7A,0xFF,0x00,0x7B,0xFF,0x00,0x7B,0xFF,0x00,0x7D,0xFF,0x00,0x7E,0xFF,0x00,0x7F,0xFF,0x00,0x80,0xFF,0x00,0x82,0xFF,0x00,0x83,0xFF,0x00,0x83,0xFF,0x00,0x84,0xFF,0x00,0x86,0xFF,0x00,0x87,0xFF,0x00,0x88,0xFF,0x00,0x89,0xFF,0x00,0x8A,0xFF,0x00,0x8C,0xFF,0x00,0x8D,0xFF,0x00,0x8E,0xFF,0x00,0x8F,0xFF,0x00,0x90,0xFF,0x00,0x92,0xFF,0x00,0x93,0xFF,0x00,0x93,0xFF,0x00,0x94,0xFF,0x00,0x96,0xFF,0x00,0x97,0xFF,0x00,0x98,0xFF,0x00,0x99,0xFF,0x00,0x9A,0xFF,0x00,0x9B,0xFF,0x00,0x9C,0xFF,0x00,0x9E,0xFF,0x00,0x9E,0xFF,0x00,0x9F,0xFF,0x00,0xA0,0xFF,0x00,0xA1,0xFF,0x00,0xA3,0xFF,0x00,0xA4,0xFF,0x00,0xA4,0xFF,0x00,0xA6,0xFF,0x00,0xA7,0xFF,0x00,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0xFF,0x84,0x00,0xFF,0x84,0x00,0xFF,0x82,0x00,0xFF,0x82,0x00,0xFF,0x81,0x00,0xFF,0x80,0x00,0xFF,0x7F,0x00,0xFF,0x7E,0x00,0xFF,0x7D,0x00,0xFF,0x7C,0x00,0xFF,0x7B,0x00,0xFF,0x7B,0x00,0xFF,0x7A,0x00,0xFF,0x78,0x00,0xFF,0x78,0x00,0xFF,0x77,0x00,0xFF,0x76,0x00,0xFF,0x74,0x00,0xFF,0x74,0x00,0xFF,0x73,0x00,0xFF,0x72,0x00,0xFF,0x71,0x00,0xFF,0x70,0x00,0xFF,0x70,0x00,0xFF,0x6E,0x00,0xFF,0x6D,0x00,0xFF,0x6C,0x00,0xFF,0x6C,0x00,0xFF,0x6B,0x00,0xFF,0x6A,0x00,0xFF,0x6A,0x00,0xFF,0x68,0x00,0xFF,0x67,0x00,0xFF,0x66,0x00,0xFF,0x66,0x00,0xFF,0x65,0x00,0xFF,0x64,0x00,0xFF,0x64,0x00,0xFF,0x62,0x00,0xFF,0x62,0x00,0xFF,0x61,0x00,0xFF,0x60,0x00,0xFF,0x5F,0x00,0xFF,0x5E,0x00,0xFF,0x5D,0x00,0xFF,0x5D,0x00,0xFF,0x5C,0x00,0xFF,0x5A,0x00,0xFF,0x5A,0x00,0xFF,0x59,0x00,0xFF,0x58,0x00,0xFF,0x57,0x00,0xFF,0x56,0x00,0xFF,0x55,0x00,0xFF,0x54,0x00,0xFF,0x54,0x00,0xFF,0x53,0x00,0xFF,0x52,0x00,0xFF,0x51,0x00,0xFF,0x50,0x00,0xFF,0x4F,0x00,0xFF,0x4E,0x00,0xFF,0x4D,0x00,0xFF,0x4D,0x00,0xFF,0x4C,0x00,0xFF,0x4A,0x00,0xFF,0x4A,0x00,0xFF,0x48,0x00,0xFF,0x47,0x00,0xFF,0x47,0x00,0xFF,0x45,0x00,0xFF,0x45,0x00,0xFF,0x44,0x00,0xFF,0x43,0x00,0xFF,0x43,0x00,0xFF,0x41,0x00,0xFF,0x40,0x00,0xFF,0x40,0x00,0xFF,0x3F,0x00,0xFF,0x3E,0x00,0xFF,0x3C,0x00,0xFF,0x3C,0x00,0xFF,0x3B,0x00,0xFF,0x3A,0x00,0xFF,0x38,0x00,0xFF,0x38,0x00,0xFF,0x37,0x00,0xFF,0x36,0x00,0xFF,0x35,0x00,0xFF,0x34,0x00,0xFF,0x34,0x00,0xFF,0x33,0x00,0xFF,0x31,0x00,0xFF,0x31,0x00,0xFF,0x2F,0x00,0xFF,0x2F,0x00,0xFF,0x2E,0x00,0xFF,0x2C,0x00,0xFF,0x2C,0x00,0xFF,0x2B,0x00,0xFF,0x2A,0x00,0xFF,0x29,0x00,0xFF,0x28,0x00,0xFF,0x27,0x00,0xFF,0x26,0x00,0xFF,0x26,0x00,0xFF,0x25,0x00,0xFF,0x25,0x00,0xFF,0x23,0x00,0xFF,0x23,0x00,0xFF,0x22,0x00,0xFF,0x21,0x00,0xFF,0x20,0x00,0xFF,0x1F,0x00,0xFF,0x1E,0x00,0xFF,0x1D,0x00,0xFF,0x1D,0x00,0xFF,0x1C,0x00,0xFF,0x1B,0x00,0xFF,0x1A,0x00,0xFF,0x19,0x00,0xFF,0x19,0x00,0xFF,0x18,0x00,0xFF,0x17,0x00,0xFF,0x16,0x00,0xFF,0x15,0x00,0xFF,0x15,0x00,0xFF,0x14,0x00,0xFF,0x14,0x00,0xFF,0x12,0x00,0xFF,0x12,0x00,0xFF,0x12,0x00,0xFF,0x10,0x00,0xFF,0x10,0x00,0xFF,0x0F,0x00,0xFF,0x0E,0x00,0xFF,0x0E,0x00,0xFF,0x0D,0x00,0xFF,0x0C,0x00,0xFF,0x0B,0x00,0xFF,0x0B,0x00,0xFF,0x0B,0x00,0xFF,0x0A,0x00,0xFF,0x09,0x00,0xFF,0x09,0x00,0xFF,0x08,0x00,0xFF,0x07,0x00,0xFF,0x07,0x00,0xFF,0x06,0x00,0xFF,0x06,0x00,0xFF,0x05,0x00,0xFF,0x04,0x00,0xFF,0x04,0x00,0xFF,0x04,0x00,0xFF,0x04,0x00,0xFF,0x03,0x00,0xFF,0x03,0x00,0xFF,0x02,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x01,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x01,0xFF,0x00,0x01,0xFF,0x00,0x02,0xFF,0x00,0x01,0xFF,0x00,0x02,0xFF,0x00,0x03,0xFF,0x00,0x03,0xFF,0x00,0x03,0xFF,0x00,0x04,0xFF,0x00,0x05,0xFF,0x00,0x05,0xFF,0x00,0x05,0xFF,0x00,0x06,0xFF,0x00,0x07,0xFF,0x00,0x06,0xFF,0x00,0x07,0xFF,0x00,0x08,0xFF,0x00,0x09,0xFF,0x00,0x09,0xFF,0x00,0x09,0xFF,0x00,0x0B,0xFF,0x00,0x0B,0xFF,0x00,0x0C,0xFF,0x00,0x0B,0xFF,0x00,0x0C,0xFF,0x00,0x0E,0xFF,0x00,0x0D,0xFF,0x00,0x0E,0xFF,0x00,0x0F,0xFF,0x00,0x0F,0xFF,0x00,0x10,0xFF,0x00,0x11,0xFF,0x00,0x11,0xFF,0x00,0x12,0xFF,0x00,0x13,0xFF,0x00,0x14,0xFF,0x00,0x14,0xFF,0x00,0x15,0xFF,0x00,0x16,0xFF,0x00,0x16,0xFF,0x00,0x17,0xFF,0x00,0x17,0xFF,0x00,0x18,0xFF,0x00,0x19,0xFF,0x00,0x1A,0xFF,0x00,0x1A,0xFF,0x00,0x1B,0xFF,0x00,0x1C,0xFF,0x00,0x1D,0xFF,0x00,0x1E,0xFF,0x00,0x1E,0xFF,0x00,0x1F,0xFF,0x00,0x20,0xFF,0x00,0x21,0xFF,0x00,0x22,0xFF,0x00,0x22,0xFF,0x00,0x22,0xFF,0x00,0x24,0xFF,0x00,0x25,0xFF,0x00,0x26,0xFF,0x00,0x26,0xFF,0x00,0x27,0xFF,0x00,0x27,0xFF,0x00,0x28,0xFF,0x00,0x2A,0xFF,0x00,0x2A,0xFF,0x00,0x2B,0xFF,0x00,0x2C,0xFF,0x00,0x2C,0xFF,0x00,0x2E,0xFF,0x00,0x2E,0xFF,0x00,0x2F,0xFF,0x00,0x30,0xFF,0x00,0x31,0xFF,0x00,0x31,0xFF,0x00,0x32,0xFF,0x00,0x33,0xFF,0x00,0x34,0xFF,0x00,0x35,0xFF,0x00,0x36,0xFF,0x00,0x37,0xFF,0x00,0x37,0xFF,0x00,0x39,0xFF,0x00,0x3A,0xFF,0x00,0x3A,0xFF,0x00,0x3B,0xFF,0x00,0x3C,0xFF,0x00,0x3D,0xFF,0x00,0x3E,0xFF,0x00,0x3E,0xFF,0x00,0x3F,0xFF,0x00,0x40,0xFF,0x00,0x41,0xFF,0x00,0x42,0xFF,0x00,0x43,0xFF,0x00,0x43,0xFF,0x00,0x45,0xFF,0x00,0x46,0xFF,0x00,0x46,0xFF,0x00,0x47,0xFF,0x00,0x48,0xFF,0x00,0x49,0xFF,0x00,0x4A,0xFF,0x00,0x4B,0xFF,0x00,0x4C,0xFF,0x00,0x4C,0xFF,0x00,0x4D,0xFF,0x00,0x4E,0xFF,0x00,0x4F,0xFF,0x00,0x50,0xFF,0x00,0x51,0xFF,0x00,0x51,0xFF,0x00,0x52,0xFF,0x00,0x53,0xFF,0x00,0x54,0xFF,0x00,0x54,0xFF,0x00,0x56,0xFF,0x00,0x56,0xFF,0x00,0x57,0xFF,0x00,0x59,0xFF,0x00,0x59,0xFF,0x00,0x5A,0xFF,0x00,0x5A,0xFF,0x00,0x5C,0xFF,0x00,0x5D,0xFF,0x00,0x5D,0xFF,0x00,0x5E,0xFF,0x00,0x5F,0xFF,0x00,0x60,0xFF,0x00,0x61,0xFF,0x00,0x61,0xFF,0x00,0x62,0xFF,0x00,0x63,0xFF,0x00,0x64,0xFF,0x00,0x64,0xFF,0x00,0x65,0xFF,0x00,0x66,0xFF,0x00,0x67,0xFF,0x00,0x67,0xFF,0x00,0x68,0xFF,0x00,0x69,0xFF,0x00,0x6A,0xFF,0x00,0x6B,0xFF,0x00,0x6B,0xFF,0x00,0x6C,0xFF,0x00,0x6C,0xFF,0x00,0x6D,0xFF,0x00,0x6E,0xFF,0x00,0x6F,0xFF,0x00,0x6F,0xFF,0x00,0x70,0xFF,0x00,0x71,0xFF,0x00,0x72,0xFF,0x00,0x72,0xFF,0x00,0x73,0xFF,0x00,0x74,0xFF,0x00,0x74,0xFF,0x00,0x75,0xFF,0x00,0x76,0xFF,0x00,0x77,0xFF,0x00,0x78,0xFF,0x00,0x78,0xFF,0x00,0x79,0xFF,0x00,0x7A,0xFF,0x00,0x7A,0xFF,0x00,0x7B,0xFF,0x00,0x7C,0xFF,0x00,0x7D,0xFF,0x00,0x7E,0xFF,0x00,0x7E,0xFF,0x00,0x80,0xFF,0x00,0x80,0xFF,0x00,0x81,0xFF,0x00,0x82,0xFF,0x00,0x82,0xFF,0x00,0x83,0xFF,0x00,0x84,0xFF,0x00,0x85,0xFF,0x00,0x85,0xFF,0x00,0x87,0xFF,0x00,0x87,0xFF,0x00,0x88,0xFF,0x00,0x89,0xFF,0x00,0x8A,0xFF,0x00,0x8A,0xFF,0x00,0x8B,0xFF,0x00,0x8C,0xFF,0x00,0x8D,0xFF,0x00,0x8E,0xFF,0x00,0x8F,0xFF,0x00,0x90,0xFF,0x00,0x90,0xFF,0x00,0x91,0xFF,0x00,0x92,0xFF,0x00,0x92,0xFF,0x00,0x94,0xFF,0x00,0x94,0xFF,0x00,0x95,0xFF,0x00,0x95,0xFF,0x00,0x97,0xFF,0x00,0x98,0xFF,0x00,0x98,0xFF,0x00,0x99,0xFF,0x00,0x9A,0xFF,0x00,0x9B,0xFF,0x00,0x9B,0xFF,0x00,0x9C,0xFF,0x00,0x9D,0xFF,0x00,0x9E,0xFF,0x00,0x9F,0xFF,0x00,0x9F,0xFF,0x00,0xA0,0xFF,0x00,0xA1,0xFF,0x00,0xA2,0xFF,0x00,0xA2,0xFF,0x00,0xA3,0xFF,0x00,0xA4,0xFF,0x00,0xA5,0xFF,0x00,0xA6,0xFF,0x00,0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4,0xFF,0x00,0xD3,0xFF,0x00,0xD4,0xFF,0x00,0xD4}; //1024 Pixels +static char plasma_data[] = {0x00,0x00,0x00,0x03,0x00,0x00,0x05,0x00,0x00,0x09,0x00,0x00,0x0E,0x00,0x00,0x12,0x00,0x00,0x17,0x00,0x00,0x1C,0x00,0x00,0x22,0x00,0x00,0x27,0x00,0x00,0x2C,0x00,0x00,0x32,0x00,0x00,0x37,0x00,0x00,0x3C,0x00,0x00,0x41,0x00,0x00,0x45,0x00,0x00,0x4A,0x00,0x00,0x4D,0x00,0x00,0x51,0x00,0x00,0x53,0x00,0x00,0x55,0x00,0x00,0x55,0x00,0x02,0x55,0x02,0x03,0x55,0x03,0x06,0x55,0x03,0x07,0x55,0x05,0x09,0x55,0x06,0x0C,0x55,0x06,0x0F,0x55,0x07,0x10,0x55,0x09,0x13,0x55,0x0A,0x16,0x55,0x0C,0x1A,0x55,0x0C,0x1D,0x54,0x0E,0x20,0x53,0x10,0x23,0x54,0x11,0x26,0x53,0x13,0x2A,0x52,0x14,0x2E,0x51,0x15,0x31,0x50,0x17,0x35,0x50,0x19,0x38,0x4E,0x1A,0x3D,0x4D,0x1C,0x40,0x4D,0x1D,0x44,0x4C,0x1F,0x47,0x4B,0x21,0x4C,0x4A,0x23,0x4F,0x49,0x24,0x54,0x48,0x25,0x57,0x47,0x28,0x5B,0x46,0x29,0x5F,0x45,0x2B,0x62,0x44,0x2D,0x66,0x44,0x2E,0x6A,0x43,0x30,0x6E,0x42,0x32,0x72,0x41,0x33,0x76,0x40,0x35,0x79,0x3F,0x38,0x7C,0x3F,0x39,0x7F,0x3E,0x3B,0x83,0x3D,0x3D,0x86,0x3C,0x3F,0x8A,0x3B,0x40,0x8C,0x3B,0x43,0x8F,0x3B,0x44,0x92,0x3A,0x46,0x95,0x39,0x48,0x98,0x39,0x4A,0x9B,0x39,0x4C,0x9C,0x39,0x4E,0x9F,0x3A,0x4F,0xA1,0x39,0x51,0xA3,0x39,0x52,0xA4,0x39,0x54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0x1A,0x0C,0x0A,0x1C,0x0D,0x0B,0x1D,0x0D,0x0B,0x1F,0x0D,0x0C,0x22,0x0F,0x0D,0x23,0x0F,0x0E,0x25,0x10,0x0E,0x26,0x11,0x0F,0x28,0x12,0x10,0x2A,0x13,0x10,0x2C,0x13,0x11,0x2E,0x14,0x12,0x2F,0x15,0x12,0x31,0x15,0x13,0x33,0x16,0x14,0x35,0x17,0x15,0x36,0x18,0x15,0x39,0x19,0x16,0x3B,0x19,0x17,0x3D,0x1B,0x17,0x3E,0x1B,0x18,0x40,0x1C,0x19,0x42,0x1D,0x1A,0x43,0x1D,0x1B,0x45,0x1E,0x1C,0x47,0x1F,0x1C,0x49,0x20,0x1D,0x4B,0x21,0x1F,0x4C,0x21,0x1F,0x4E,0x22,0x20,0x50,0x23,0x21,0x52,0x23,0x22,0x53,0x24,0x23,0x55,0x25,0x23,0x56,0x26,0x24,0x59,0x26,0x25,0x5A,0x27,0x26,0x5B,0x28,0x27,0x5D,0x28,0x28,0x5E,0x29,0x29,0x60,0x29,0x2A,0x62,0x2A,0x2B,0x63,0x2B,0x2C,0x64,0x2C,0x2E,0x65,0x2C,0x2E,0x66,0x2C,0x2F,0x68,0x2D,0x31,0x69,0x2E,0x32,0x6A,0x2F,0x32,0x6B,0x2F,0x34,0x6C,0x30,0x34,0x6D,0x30,0x35,0x6F,0x31,0x37,0x70,0x31,0x38,0x71,0x32,0x39,0x72,0x33,0x3B,0x73,0x33,0x3C,0x74,0x34,0x3D,0x75,0x35,0x3E,0x76,0x35,0x3F,0x78,0x36,0x41,0x78,0x36,0x42,0x79,0x36,0x43,0x7A,0x37,0x44,0x7B,0x37,0x46,0x7C,0x38,0x48,0x7D,0x39,0x48,0x7E,0x3A,0x49,0x7F,0x39,0x4B,0x80,0x3A,0x4C,0x81,0x3B,0x4E,0x82,0x3C,0x4F,0x83,0x3C,0x51,0x84,0x3C,0x52,0x84,0x3D,0x54,0x86,0x3E,0x55,0x87,0x3E,0x56,0x88,0x3F,0x57,0x89,0x40,0x59,0x8A,0x40,0x5A,0x8A,0x41,0x5C,0x8B,0x41,0x5D,0x8C,0x42,0x5F,0x8D,0x41,0x60,0x8E,0x42,0x62,0x8E,0x42,0x62,0x8F,0x44,0x65,0x90,0x43,0x65,0x91,0x45,0x67,0x91,0x44,0x69,0x92,0x45,0x6A,0x93,0x46,0x6B,0x94,0x46,0x6C,0x94,0x46,0x6E,0x96,0x47,0x70,0x96,0x48,0x70,0x97,0x48,0x72,0x98,0x48,0x73,0x99,0x49,0x74,0x99,0x49,0x76,0x9A,0x4A,0x77,0x9A,0x4B,0x78,0x9B,0x4B,0x7A,0x9C,0x4B,0x7B,0x9D,0x4B,0x7C,0x9E,0x4C,0x7D,0x9F,0x4C,0x7E,0x9F,0x4D,0x7F,0xA0,0x4E,0x80,0xA0,0x4E,0x82,0xA1,0x4E,0x83,0xA2,0x4F,0x84,0xA3,0x4F,0x85,0xA3,0x4F,0x86,0xA4,0x4F,0x88,0xA5,0x50,0x89,0xA5,0x50,0x89,0xA6,0x51,0x8B,0xA6,0x51,0x8B,0xA7,0x51,0x8D,0xA8,0x51,0x8E,0xA9,0x52,0x8F,0xAA,0x52,0x90,0xAA,0x53,0x92,0xAB,0x53,0x92,0xAB,0x53,0x93,0xAC,0x54,0x95,0xAD,0x53,0x95,0xAE,0x54,0x96,0xAE,0x55,0x98,0xAE,0x54,0x98,0xAF,0x55,0x9A,0xB0,0x56,0x9B,0xB0,0x56,0x9C,0xB1,0x56,0x9D,0xB1,0x56,0x9E,0xB2,0x56,0xA0,0xB3,0x57,0xA0,0xB3,0x57,0xA1,0xB3,0x57,0xA2,0xB4,0x58,0xA3,0xB4,0x58,0xA4,0xB5,0x57,0xA5,0xB6,0x58,0xA6,0xB6,0x58,0xA7,0xB7,0x58,0xA8,0xB7,0x59,0xA9,0xB8,0x58,0xAA,0xB9,0x5A,0xAB,0xB9,0x59,0xAC,0xBA,0x5A,0xAD,0xBA,0x5A,0xAE,0xBB,0x5A,0xAF,0xBB,0x5A,0xB0,0xBC,0x5B,0xB0,0xBC,0x5A,0xB1,0xBD,0x5B,0xB2,0xBD,0x5B,0xB3,0xBD,0x5B,0xB4,0xBE,0x5C,0xB5,0xBE,0x5B,0xB5,0xBE,0x5B,0xB7,0xBF,0x5C,0xB7,0xBF,0x5C,0xB8,0xBF,0x5C,0xB9,0xC0,0x5C,0xB9,0xC0,0x5C,0xBA,0xC0,0x5C,0xBA,0xC1,0x5D,0xBB,0xC2,0x5D,0xBC,0xC2,0x5D,0xBC,0xC2,0x5D,0xBD,0xC2,0x5E,0xBE,0xC3,0x5E,0xBE,0xC3,0x5E,0xBF,0xC3,0x5E,0xC0,0xC3,0x5E,0xC0,0xC4,0x5E,0xC1,0xC4,}; //200 Pixels +static char flm_data[] = {0x00,0x00,0x00,0x00,0x01,0x00,0x02,0x01,0x01,0x02,0x02,0x01,0x03,0x02,0x01,0x04,0x02,0x01,0x05,0x03,0x02,0x06,0x04,0x02,0x07,0x05,0x03,0x07,0x05,0x03,0x09,0x06,0x04,0x0A,0x06,0x05,0x0B,0x07,0x05,0x0C,0x08,0x06,0x0E,0x08,0x06,0x0E,0x09,0x07,0x0F,0x0A,0x07,0x11,0x0B,0x08,0x12,0x0C,0x09,0x13,0x0C,0x09,0x14,0x0D,0x09,0x16,0x0D,0x0A,0x18,0x0E,0x0B,0x19,0x10,0x0C,0x1B,0x11,0x0C,0x1C,0x11,0x0D,0x1D,0x12,0x0D,0x1F,0x13,0x0E,0x20,0x14,0x0E,0x22,0x15,0x0F,0x23,0x15,0x10,0x25,0x16,0x10,0x26,0x17,0x11,0x28,0x19,0x12,0x29,0x19,0x13,0x2B,0x1A,0x14,0x2C,0x1B,0x14,0x2E,0x1C,0x15,0x30,0x1D,0x16,0x31,0x1F,0x17,0x33,0x1F,0x17,0x35,0x21,0x18,0x36,0x22,0x19,0x38,0x22,0x19,0x39,0x24,0x1A,0x3B,0x25,0x1B,0x3D,0x26,0x1B,0x3F,0x27,0x1D,0x40,0x27,0x1D,0x42,0x29,0x1E,0x44,0x2A,0x1F,0x46,0x2C,0x1F,0x47,0x2D,0x20,0x49,0x2D,0x21,0x4B,0x2F,0x22,0x4C,0x30,0x23,0x4E,0x30,0x23,0x50,0x31,0x24,0x52,0x33,0x25,0x53,0x34,0x26,0x55,0x35,0x27,0x57,0x36,0x27,0x58,0x37,0x28,0x5A,0x38,0x29,0x5C,0x3A,0x2A,0x5D,0x3A,0x2A,0x5F,0x3C,0x2B,0x61,0x3D,0x2C,0x63,0x3E,0x2C,0x64,0x3F,0x2D,0x65,0x41,0x2F,0x67,0x41,0x2F,0x69,0x43,0x30,0x6A,0x43,0x30,0x6C,0x45,0x31,0x6E,0x46,0x32,0x6F,0x47,0x33,0x71,0x48,0x33,0x72,0x49,0x34,0x74,0x4A,0x35,0x76,0x4C,0x35,0x77,0x4D,0x36,0x79,0x4E,0x36,0x7A,0x4E,0x37,0x7B,0x50,0x39,0x7D,0x51,0x39,0x7E,0x51,0x39,0x7F,0x53,0x3A,0x80,0x54,0x3A,0x82,0x55,0x3B,0x83,0x56,0x3C,0x84,0x57,0x3C,0x85,0x58,0x3D,0x87,0x5A,0x3D,0x88,0x5B,0x3E,0x89,0x5B,0x3F,0x8A,0x5C,0x3F,0x8B,0x5E,0x3F,0x8C,0x5F,0x40,0x8D,0x5F,0x41,0x8E,0x60,0x41,0x90,0x61,0x41,0x90,0x63,0x42,0x92,0x63,0x43,0x92,0x64,0x43,0x93,0x65,0x43,0x94,0x66,0x44,0x95,0x67,0x45,0x96,0x68,0x44,0x97,0x69,0x45,0x97,0x6B,0x45,0x99,0x6B,0x46,0x99,0x6D,0x47,0x9A,0x6D,0x47,0x9B,0x6F,0x48,0x9C,0x70,0x48,0x9D,0x71,0x48,0x9D,0x72,0x48,0x9F,0x73,0x48,0x9E,0x74,0x4A,0xA0,0x76,0x49,0xA0,0x77,0x4A,0xA1,0x78,0x4A,0xA1,0x79,0x4B,0xA2,0x7A,0x4B,0xA3,0x7B,0x4B,0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,0xC4,0xC0,0x5E,0xC4,0xC1,0x5E}; //200 Pixels +static char firw_data[] = {0xFF,0x00,0xFF,0xFF,0x00,0xFF,0xFC,0x00,0xFF,0xF8,0x00,0xFF,0xF3,0x00,0xFF,0xEE,0x00,0xFF,0xE9,0x00,0xFF,0xE4,0x00,0xFF,0xDD,0x00,0xFF,0xD8,0x00,0xFF,0xD2,0x00,0xFF,0xCB,0x00,0xFF,0xC4,0x00,0xFF,0xBD,0x00,0xFF,0xB5,0x00,0xFF,0xAD,0x00,0xFF,0xA6,0x00,0xFF,0x9E,0x00,0xFF,0x96,0x00,0xFF,0x8E,0x00,0xFF,0x87,0x00,0xFF,0x7E,0x00,0xFF,0x77,0x00,0xFF,0x6E,0x00,0xFF,0x66,0x00,0xFF,0x5E,0x00,0xFF,0x56,0x00,0xFF,0x4F,0x00,0xFF,0x47,0x00,0xFF,0x40,0x00,0xFF,0x39,0x00,0xFF,0x32,0x00,0xFF,0x2B,0x00,0xFF,0x25,0x00,0xFF,0x1E,0x00,0xFF,0x19,0x00,0xFF,0x14,0x00,0xFF,0x0F,0x00,0xFF,0x0A,0x00,0xFF,0x06,0x00,0xFF,0x01,0x00,0xFF,0x00,0x01,0xFF,0x00,0x05,0xFF,0x00,0x09,0xFF,0x00,0x0E,0xFF,0x00,0x13,0xFF,0x00,0x18,0xFF,0x00,0x1E,0xFF,0x00,0x24,0xFF,0x00,0x2A,0xFF,0x00,0x30,0xFF,0x00,0x37,0xFF,0x00,0x3E,0xFF,0x00,0x45,0xFF,0x00,0x4D,0xFF,0x00,0x55,0xFF,0x00,0x5C,0xFF,0x00,0x64,0xFF,0x00,0x6C,0xFF,0x00,0x74,0xFF,0x00,0x7C,0xFF,0x00,0x84,0xFF,0x00,0x8D,0xFF,0x00,0x95,0xFF,0x00,0x9D,0xFF,0x00,0xA4,0xFF,0x00,0xAC,0xFF,0x00,0xB3,0xFF,0x00,0xBB,0xFF,0x00,0xC2,0xFF,0x00,0xC9,0xFF,0x00,0xD0,0xFF,0x00,0xD7,0xFF,0x00,0xDD,0xFF,0x00,0xE3,0xFF,0x00,0xE9,0xFF,0x00,0xED,0xFF,0x00,0xF2,0xFF,0x00,0xF6,0xFF,0x00,0xFB,0xFF,0x00,0xFE,0xFF,0x00,0xFF,0xFC,0x00,0xFF,0xF8,0x00,0xFF,0xF4,0x00,0xFF,0xF0,0x00,0xFF,0xEA,0x00,0xFF,0xE5,0x00,0xFF,0xDF,0x00,0xFF,0xD9,0x00,0xFF,0xD3,0x00,0xFF,0xCC,0x00,0xFF,0xC5,0x00,0xFF,0xBD,0x00,0xFF,0xB7,0x00,0xFF,0xAF,0x00,0xFF,0xA7,0x00,0xFF,0xA0,0x00,0xFF,0x97,0x00,0xFF,0x8F,0x00,0xFF,0x88,0x00,0xFF,0x80,0x00,0xFF,0x77,0x00,0xFF,0x6F,0x00,0xFF,0x68,0x00,0xFF,0x5F,0x00,0xFF,0x57,0x00,0xFF,0x50,0x00,0xFF,0x48,0x00,0xFF,0x41,0x00,0xFF,0x3A,0x00,0xFF,0x33,0x00,0xFF,0x2D,0x00,0xFF,0x26,0x00,0xFF,0x20,0x00,0xFF,0x1A,0x00,0xFF,0x15,0x00,0xFF,0x10,0x00,0xFF,0x0B,0x00,0xFF,0x07,0x00,0xFF,0x03,0x00,0xFF,0x00,0x04,0xFF,0x00,0x08,0xFF,0x00,0x0D,0xFF,0x00,0x11,0xFF,0x00,0x17,0xFF,0x00,0x1D,0xFF,0x00,0x23,0xFF,0x00,0x28,0xFF,0x00,0x2F,0xFF,0x00,0x36,0xFF,0x00,0x3D,0xFF,0x00,0x44,0xFF,0x00,0x4B,0xFF,0x00,0x53,0xFF,0x00,0x5A,0xFF,0x00,0x62,0xFF,0x00,0x6B,0xFF,0x00,0x72,0xFF,0x00,0x7B,0xFF,0x00,0x82,0xFF,0x00,0x8A,0xFF,0x00,0x92,0xFF,0x00,0x9A,0xFF,0x00,0xA3,0xFF,0x00,0xAA,0xFF,0x00,0xB1,0xFF,0x00,0xBA,0xFF,0x00,0xC1,0xFF,0x00,0xC8,0xFF,0x00,0xCF,0xFF,0x00,0xD5,0xFF,0x00,0xDB,0xFF,0x00,0xE1,0xFF,0x00,0xE7,0xFF,0x00,0xEC,0xFF,0x00,0xF1,0xFF,0x00,0xF6,0xFF,0x00,0xFA,0xFF,0x00,0xFE,0xFF,0x00,0xFF,0xFD,0x00,0xFF,0xF9,0x00,0xFF,0xF5,0x00,0xFF,0xF1,0x00,0xFF,0xEB,0x00,0xFF,0xE6,0x00,0xFF,0xE0,0x00,0xFF,0xDB,0x00,0xFF,0xD4,0x00,0xFF,0xCE,0x00,0xFF,0xC7,0x00,0xFF,0xBF,0x00,0xFF,0xB8,0x00,0xFF,0xB1,0x00,0xFF,0xA9,0x00,0xFF,0xA1,0x00,0xFF,0x99,0x00,0xFF,0x91,0x00,0xFF,0x89,0x00,0xFF,0x82,0x00,0xFF,0x79,0x00,0xFF,0x71,0x00,0xFF,0x6A,0x00,0xFF,0x61,0x00,0xFF,0x59,0x00,0xFF,0x52,0x00,0xFF,0x4A,0x00,0xFF,0x43,0x00,0xFF,0x3C,0x00,0xFF,0x34,0x00,0xFF,0x2E,0x00,0xFF,0x28,0x00,0xFF,0x22,0x00,0xFF,0x1B,0x00,0xFF,0x16,0x00,0xFF,0x10,0x00,0xFF,0x0C,0x00,0xFF,0x08,0x00,0xFF,0x04,0x00,0xFF,0x00,0x00,}; //200 Pixels #endif \ No newline at end of file diff --git a/includes/misc.h b/includes/misc.h index 1394687..9a92a71 100644 --- a/includes/misc.h +++ b/includes/misc.h @@ -3,7 +3,7 @@ #include #include -#ifdef WIN32 +#if defined(WIN32) && !defined(__GNUC__) #define x86_cpuid(func,af,bf,cf,df) \ do {\ __asm mov eax, func\ diff --git a/src/graphics.c b/src/graphics.c index 08798dc..2c9a686 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1417,10 +1417,23 @@ void draw_parts(pixel *vid) { if(cmode == 3||cmode==4 || cmode==6) { - vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; - cg = 12; - cb = 12; - cr = 12; + cg = 0; + cb = 0; + cr = 0; + for(x=0; x<12; x++) { + cr += (parts[i].ctype >> (x+18)) & 1; + cb += (parts[i].ctype >> x) & 1; + } + for(x=0; x<14; x++) + cg += (parts[i].ctype >> (x+9)) & 1; + x = 624/(cr+cg+cb+1); + cr *= x; + cg *= x; + cb *= x; + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr>255?255:cr,cg>255?255:cg,cb>255?255:cb); + cr >>= 4; + cg >>= 4; + cb >>= 4; x = nx/CELL; y = ny/CELL; cg += fire_g[y][x]; @@ -1828,9 +1841,9 @@ void draw_parts(pixel *vid) blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } else if(t==PT_FIRW&&parts[i].tmp==3) + } else if(t==PT_FIRW&&parts[i].tmp>=3) { - float ttemp = (float)parts[i].life; + float ttemp = (float)parts[i].tmp-4; int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); uint8 R = firw_data[caddress]; uint8 G = firw_data[caddress+1]; @@ -1870,7 +1883,45 @@ void draw_parts(pixel *vid) } else if(t==PT_FIRE && parts[i].life) { - if(cmode == 3||cmode==4 || cmode==6) + float ttemp = (float)parts[i].life; + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = flm_data[caddress]; + uint8 G = flm_data[caddress+1]; + uint8 B = flm_data[caddress+2]; + if(cmode == 3||cmode==4 || cmode==6) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { + cr = R; + cg = G; + cb = B; + blendpixel(vid, nx, ny, cr, cg, cb, 192); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + } + // Older Code + /*if(cmode == 3||cmode==4 || cmode==6) { cr = parts[i].life / 4; cg = parts[i].life / 16; @@ -1907,7 +1958,7 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } + }*/ } else if(t==PT_LAVA && parts[i].life) { @@ -1976,7 +2027,7 @@ void draw_parts(pixel *vid) else { float ttemp = parts[i].temp+(-MIN_TEMP); - int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/512) ) *3, 0.0f, (512.0f*3)-3); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/1024) ) *3, 0.0f, (1024.0f*3)-3); uint8 R = color_data[caddress]; uint8 G = color_data[caddress+1]; uint8 B = color_data[caddress+2]; diff --git a/src/powder.c b/src/powder.c index cdad9b0..0bccf8f 100644 --- a/src/powder.c +++ b/src/powder.c @@ -35,6 +35,13 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) r = (r&~0xFF) | parts[r>>8].type; if(rr) *rr = r; + + if((r&0xFF)==PT_VOID || (r&0xFF)==PT_BHOL) + return 1; + + if(pt==PT_NEUT && (r&0xFF)==PT_GLAS) + return 2; + if(pt==PT_PHOT&&( (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT || (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || @@ -65,6 +72,9 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) return 2; return 1; } + +static void create_cherenkov_photon(int pp); + int try_move(int i, int x, int y, int nx, int ny) { unsigned r, e; @@ -81,16 +91,13 @@ int try_move(int i, int x, int y, int nx, int ny) } return 0; } - if(e == 2) + if(e == 2) { + if(parts[i].type == PT_NEUT && (r&0xFF)==PT_GLAS) { + if(rand() < RAND_MAX/10) + create_cherenkov_photon(i); + } return 1; - - if(bmap[ny/CELL][nx/CELL]==12 && !emap[y/CELL][x/CELL]) - return 1; - if((bmap[y/CELL][x/CELL]==12 && !emap[y/CELL][x/CELL]) && (bmap[ny/CELL][nx/CELL]!=12 && !emap[ny/CELL][nx/CELL])) - return 0; - - if(r && (r>>8)>8) wM) + wM = i; + } + + if(wM-w0 < 5) + return (wM+w0)/2; + + i = rand() % (wM-w0-3); + i += w0; + + *wm &= 0x1F << i; + return i + 2; +} + void set_emap(int x, int y) { int x1, x2; @@ -1692,7 +1762,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(rt==PT_FIRE||rt==PT_PLSM||rt==PT_THDR) { parts[i].tmp = 1; - parts[i].life = rand()%50+120; + parts[i].life = rand()%50+60; } } } @@ -1700,7 +1770,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(parts[i].life==0) { parts[i].tmp=2; } else { - float newVel = parts[i].life/50; + float newVel = parts[i].life/25; parts[i].flags = parts[i].flags&0xFFFFFFFE; if((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE) { parts[i].vy = -newVel; @@ -1710,6 +1780,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } else if(parts[i].tmp==2) { + int col = rand()%200+4; for(nx=-2; nx<3; nx++) { for(ny=-2; ny<3; ny++) { if(x+nx>=0 && y+ny>0 && x+nx>8].type==PT_FIRW) { parts[r>>8].vx = (rand()%3-1)*tmul; parts[r>>8].vy = (rand()%3-1)*tmul; - parts[r>>8].tmp = 3; + parts[r>>8].tmp = col; parts[r>>8].life = rand()%100+100; parts[r>>8].temp = 6000.0f; } @@ -1731,7 +1802,7 @@ void update_particles_i(pixel *vid, int start, int inc) } pv[y/CELL][x/CELL] += 20; kill_part(i); - } else if(parts[i].tmp==3) { + } else if(parts[i].tmp>=3) { if(parts[i].life<=0) { kill_part(i); } @@ -2444,17 +2515,25 @@ killed: lt = pmap[y][x] & 0xFF; - if((rt==PT_GLAS && lt!=PT_GLAS) || (rt!=PT_GLAS && lt==PT_GLAS)) { + r = eval_move(PT_PHOT, nx, ny, NULL); + + if(((rt==PT_GLAS && lt!=PT_GLAS) || (rt!=PT_GLAS && lt==PT_GLAS)) && r) { if(!get_normal_interp(REFRACT|parts[i].type, x, y, parts[i].vx, parts[i].vy, &nrx, &nry)) { kill_part(i); continue; } + + r = get_wavelength_bin(&parts[i].ctype); + if(r == -1) { + kill_part(i); + continue; + } + nn = 2.3f - 0.02f*r; + nrx = -nrx; nry = -nry; - if(rt!=PT_GLAS && lt==PT_GLAS) - nn = 2.0; - else - nn = 0.5; + if(rt==PT_GLAS && lt!=PT_GLAS) + nn = 1.0f/nn; ct1 = parts[i].vx*nrx + parts[i].vy*nry; ct2 = 1.0f - (nn*nn)*(1.0f-(ct1*ct1)); if(ct2 < 0.0f) { @@ -2589,6 +2668,27 @@ killed: } else if(t==PT_NEUT || t==PT_PHOT) { + r = pmap[ny][nx]; + + /* this should be replaced with a particle type attribute ("photwl" or something) */ + if((r & 0xFF) == PT_COAL) parts[i].ctype = 0x00000000; + if((r & 0xFF) == PT_PLEX) parts[i].ctype &= 0x1F00003E; + if((r & 0xFF) == PT_NITR) parts[i].ctype &= 0x0007C000; + if((r & 0xFF) == PT_NBLE) parts[i].ctype &= 0x3FFF8000; + if((r & 0xFF) == PT_LAVA) parts[i].ctype &= 0x3FF00000; + if((r & 0xFF) == PT_ACID) parts[i].ctype &= 0x1FE001FE; + if((r & 0xFF) == PT_DUST) parts[i].ctype &= 0x3FFFFFC0; + if((r & 0xFF) == PT_SNOW) parts[i].ctype &= 0x03FFFFFF; + if((r & 0xFF) == PT_GOO) parts[i].ctype &= 0x3FFAAA00; + if((r & 0xFF) == PT_PLNT) parts[i].ctype &= 0x0007C000; + if((r & 0xFF) == PT_PLUT) parts[i].ctype &= 0x001FCE00; + if((r & 0xFF) == PT_URAN) parts[i].ctype &= 0x003FC000; + + if(!parts[i].ctype) { + kill_part(i); + continue; + } + if(get_normal_interp(t, lx, ly, parts[i].vx, parts[i].vy, &nrx, &nry)) { dp = nrx*parts[i].vx + nry*parts[i].vy; parts[i].vx -= 2.0f*dp*nrx; @@ -2666,8 +2766,10 @@ void update_particles(pixel *vid) t = parts[i].type; x = (int)(parts[i].x+0.5f); y = (int)(parts[i].y+0.5f); - if(x>=0 && y>=0 && x=0 && y>=0 && x Date: Sun, 3 Oct 2010 16:19:03 +0100 Subject: Dispersion fix, Skylark diff --git a/src/powder.c b/src/powder.c index 0bccf8f..03316c9 100644 --- a/src/powder.c +++ b/src/powder.c @@ -144,6 +144,11 @@ int try_move(int i, int x, int y, int nx, int ny) #define REFRACT 0x80000000 +/* heavy flint glass, for awesome refraction/dispersion + this way you can make roof prisms easily */ +#define GLASS_IOR 1.9 +#define GLASS_DISP 0.07 + static unsigned direction_to_map(float dx, float dy) { return (dx >= 0) | @@ -207,13 +212,6 @@ static int find_next_boundary(int pt, int *x, int *y, int dm, int *em) return 0; } -static int vec_colinear(float nx, float ny, float vx, float vy) -{ - float d = 1.0f/hypot(vx, vy); - d *= nx*vx + ny*vy; - return (d >= 0.99) || (d <= -0.99); -} - int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny) { int ldm, rdm, lm, rm; @@ -257,9 +255,6 @@ int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny) *nx = ey * r; *ny = -ex * r; - if(vec_colinear(*ny, -*nx, dx, dy)) - return 0; - return 1; } @@ -505,7 +500,7 @@ inline int create_part(int p, int x, int y, int t) static void create_cherenkov_photon(int pp) { int i, lr, nx, ny; - float r; + float r, eff_ior; if(pfree == -1) return; @@ -528,7 +523,7 @@ static void create_cherenkov_photon(int pp) parts[i].life = 680; parts[i].x = parts[pp].x; parts[i].y = parts[pp].y; - parts[i].temp = parts[pp].temp; + parts[i].temp = parts[pmap[ny][nx] >> 8].temp; parts[i].tmp = 0; if(lr) { @@ -540,7 +535,7 @@ static void create_cherenkov_photon(int pp) } /* photons have speed of light. no discussion. */ - r = 1.44f / hypotf(parts[i].vx, parts[i].vy); + r = 1.269 / hypotf(parts[i].vx, parts[i].vy); parts[i].vx *= r; parts[i].vy *= r; } @@ -2528,7 +2523,8 @@ killed: kill_part(i); continue; } - nn = 2.3f - 0.02f*r; + nn = GLASS_IOR - GLASS_DISP*(r-15)/15.0f; + nn *= nn; nrx = -nrx; nry = -nry; @@ -2539,6 +2535,10 @@ killed: if(ct2 < 0.0f) { parts[i].vx -= 2.0f*ct1*nrx; parts[i].vy -= 2.0f*ct1*nry; + parts[i].x = lx; + parts[i].y = ly; + nx = (int)(lx + 0.5f); + ny = (int)(ly + 0.5f); } else { ct2 = sqrtf(ct2); ct2 = ct2 - nn*ct1; -- cgit v0.9.2-21-gd62e From 83c752119340947992a90bd628a52ba597be5e5f Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 3 Oct 2010 18:26:20 +0100 Subject: Photoelectrics - Skylark diff --git a/src/powder.c b/src/powder.c index 03316c9..d8fa1fb 100644 --- a/src/powder.c +++ b/src/powder.c @@ -22,11 +22,38 @@ int pfree; unsigned pmap[YRES][XRES]; unsigned cb_pmap[YRES][XRES]; +static int pn_junction_sprk(int x, int y, int pt) +{ + unsigned r = pmap[y][x]; + if((r & 0xFF) != pt) + return 0; + r >>= 8; + if(parts[r].type != pt) + return 0; + + parts[r].ctype = pt; + parts[r].type = PT_SPRK; + parts[r].life = 4; + return 1; +} + +static void photoelectric_effect(int nx, int ny) +{ + unsigned r = pmap[ny][nx]; + + if((r&0xFF) == PT_PSCN) { + if((pmap[ny][nx-1] & 0xFF) == PT_NSCN || + (pmap[ny][nx+1] & 0xFF) == PT_NSCN || + (pmap[ny-1][nx] & 0xFF) == PT_NSCN || + (pmap[ny+1][nx] & 0xFF) == PT_NSCN) + pn_junction_sprk(nx, ny, PT_PSCN); + } +} + static int eval_move(int pt, int nx, int ny, unsigned *rr) { unsigned r; - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) return 0; @@ -85,7 +112,9 @@ int try_move(int i, int x, int y, int nx, int ny) e = eval_move(parts[i].type, nx, ny, &r); if(!e) { if(!legacy_enable && parts[i].type==PT_PHOT) { - if((r & 0xFF ) < PT_NUM) + if((r & 0xFF) == PT_COAL || (r & 0xFF) == PT_BCOL) + parts[r>>8].temp = parts[i].temp; + if((r & 0xFF) < PT_NUM) parts[i].temp = parts[r>>8].temp = restrict_flt((parts[r>>8].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP); } @@ -171,7 +200,7 @@ static int is_blocking(int t, int x, int y) return 0; } - return eval_move(t, x, y, NULL); + return !eval_move(t, x, y, NULL); } static int is_boundary(int pt, int x, int y) @@ -276,6 +305,9 @@ int get_normal_interp(int pt, float x0, float y0, float dx, float dy, float *nx, if(i >= NORMAL_INTERP) return 0; + if(pt == PT_PHOT) + photoelectric_effect(x, y); + return get_normal(pt, x, y, dx, dy, nx, ny); } @@ -2671,7 +2703,10 @@ killed: r = pmap[ny][nx]; /* this should be replaced with a particle type attribute ("photwl" or something) */ + if((r & 0xFF) == PT_PSCN) parts[i].ctype = 0x00000000; + if((r & 0xFF) == PT_NSCN) parts[i].ctype = 0x00000000; if((r & 0xFF) == PT_COAL) parts[i].ctype = 0x00000000; + if((r & 0xFF) == PT_BCOL) parts[i].ctype = 0x00000000; if((r & 0xFF) == PT_PLEX) parts[i].ctype &= 0x1F00003E; if((r & 0xFF) == PT_NITR) parts[i].ctype &= 0x0007C000; if((r & 0xFF) == PT_NBLE) parts[i].ctype &= 0x3FFF8000; @@ -2684,11 +2719,6 @@ killed: if((r & 0xFF) == PT_PLUT) parts[i].ctype &= 0x001FCE00; if((r & 0xFF) == PT_URAN) parts[i].ctype &= 0x003FC000; - if(!parts[i].ctype) { - kill_part(i); - continue; - } - if(get_normal_interp(t, lx, ly, parts[i].vx, parts[i].vy, &nrx, &nry)) { dp = nrx*parts[i].vx + nry*parts[i].vy; parts[i].vx -= 2.0f*dp*nrx; @@ -2706,6 +2736,11 @@ killed: kill_part(i); continue; } + + if(!parts[i].ctype) { + kill_part(i); + continue; + } } else -- cgit v0.9.2-21-gd62e From f2fbd1728fa90a4e42e1f5e4f12de4a16a52b9d1 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 4 Oct 2010 10:52:27 +0100 Subject: fixes saves for photons & makes GLOW a laser gain medium - Skylark diff --git a/src/main.c b/src/main.c index d88b972..f7ffec9 100755 --- a/src/main.c +++ b/src/main.c @@ -270,8 +270,11 @@ void *build_save(int *size, int x0, int y0, int w, int h) { x = (int)(parts[i].x+0.5f); y = (int)(parts[i].y+0.5f); - if(x>=x0 && x=y0 && y=x0 && x=y0 && y>8; parts[k].type = j; + if(j == PT_PHOT) + parts[k].ctype = 0x3fffffff; parts[k].x = (float)x; parts[k].y = (float)y; m[(x-x0)+(y-y0)*w] = k+1; @@ -519,6 +524,8 @@ int parse_save(void *save, int size, int replace, int x0, int y0) else if(i < nf) { parts[fp[i]].type = j; + if(j == PT_PHOT) + parts[fp[i]].ctype = 0x3fffffff; parts[fp[i]].x = (float)x; parts[fp[i]].y = (float)y; m[(x-x0)+(y-y0)*w] = fp[i]+1; diff --git a/src/powder.c b/src/powder.c index d8fa1fb..40150b9 100644 --- a/src/powder.c +++ b/src/powder.c @@ -72,6 +72,7 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(pt==PT_PHOT&&( (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT || (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || + (r&0xFF)==PT_GLOW || (r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW || ((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) return 2; @@ -101,6 +102,7 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) } static void create_cherenkov_photon(int pp); +static void create_gain_photon(int pp); int try_move(int i, int x, int y, int nx, int ny) { @@ -110,6 +112,13 @@ int try_move(int i, int x, int y, int nx, int ny) return 1; e = eval_move(parts[i].type, nx, ny, &r); + + /* half-silvered mirror */ + if(!e && parts[i].type==PT_PHOT && + (((r&0xFF)==PT_BMTL && rand()>8].life) + if(rand() < RAND_MAX/30) { + parts[r>>8].life = 120; + create_gain_photon(i); + } if(parts[i].type == PT_NEUT && (r&0xFF)==PT_GLAS) { if(rand() < RAND_MAX/10) create_cherenkov_photon(i); @@ -154,16 +168,22 @@ int try_move(int i, int x, int y, int nx, int ny) if(r && (r>>8)>8)> 8; + if(r && e>= 8; - parts[r].x += x-nx; - parts[r].y += y-ny; + if(parts[e].type == PT_PHOT) + return 1; + + parts[e].x += x-nx; + parts[e].y += y-ny; } + pmap[ny][nx] = (i<<8)|parts[i].type; + pmap[y][x] = r; + return 1; } #define SURF_RANGE 10 @@ -314,14 +334,16 @@ int get_normal_interp(int pt, float x0, float y0, float dx, float dy, float *nx, void kill_part(int i) { int x, y; - parts[i].type = PT_NONE; - x = (int)(parts[i].x+0.5f); - y = (int)(parts[i].y+0.5f); + if(parts[i].type != PT_PHOT) { + x = (int)(parts[i].x+0.5f); + y = (int)(parts[i].y+0.5f); - if(x>=0 && y>=0 && x=0 && y>=0 && x=XRES || ny>=YRES) + return; + + if((pmap[ny][nx] & 0xFF) != PT_GLOW) + return; + + pfree = parts[i].life; + + parts[i].type = PT_PHOT; + parts[i].life = 680; + parts[i].x = xx; + parts[i].y = yy; + parts[i].vx = parts[pp].vx; + parts[i].vy = parts[pp].vy; + parts[i].temp = parts[pmap[ny][nx] >> 8].temp; + parts[i].tmp = 0; + + temp_bin = (int)((parts[i].temp-273.0f)*0.25f); + if(temp_bin < 0) temp_bin = 0; + if(temp_bin > 25) temp_bin = 25; + parts[i].ctype = 0x1F << temp_bin; +} + static void create_cherenkov_photon(int pp) { int i, lr, nx, ny; @@ -759,7 +826,7 @@ void update_particles_i(pixel *vid, int start, int inc) { if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC))) parts[i].life--; - if(parts[i].life<=0 && t!=PT_METL && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR) + if(parts[i].life<=0 && t!=PT_METL && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR && t!=PT_GLOW) { kill_part(i); continue; @@ -2705,6 +2772,7 @@ killed: /* this should be replaced with a particle type attribute ("photwl" or something) */ if((r & 0xFF) == PT_PSCN) parts[i].ctype = 0x00000000; if((r & 0xFF) == PT_NSCN) parts[i].ctype = 0x00000000; + if((r & 0xFF) == PT_SPRK) parts[i].ctype = 0x00000000; if((r & 0xFF) == PT_COAL) parts[i].ctype = 0x00000000; if((r & 0xFF) == PT_BCOL) parts[i].ctype = 0x00000000; if((r & 0xFF) == PT_PLEX) parts[i].ctype &= 0x1F00003E; @@ -2801,8 +2869,8 @@ void update_particles(pixel *vid) t = parts[i].type; x = (int)(parts[i].x+0.5f); y = (int)(parts[i].y+0.5f); - if(x>=0 && y>=0 && x=0 && y>=0 && x Date: Tue, 5 Oct 2010 17:56:09 +0100 Subject: Some more fire improvements diff --git a/src/graphics.c b/src/graphics.c index 2c9a686..cf0e1e6 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1883,7 +1883,7 @@ void draw_parts(pixel *vid) } else if(t==PT_FIRE && parts[i].life) { - float ttemp = (float)parts[i].life; + float ttemp = (float)((int)(parts[i].life/2)); int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); uint8 R = flm_data[caddress]; uint8 G = flm_data[caddress+1]; @@ -1907,18 +1907,21 @@ void draw_parts(pixel *vid) } else { - cr = R; - cg = G; - cb = B; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); - blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); + cr = parts[i].life * 8; + cg = parts[i].life * 2; + cb = parts[i].life; + if(cr>255) cr = 255; + if(cg>192) cg = 212; + if(cb>128) cb = 192; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } // Older Code /*if(cmode == 3||cmode==4 || cmode==6) -- cgit v0.9.2-21-gd62e From 6627e418b2fd887c7125537930a4c40731d698af Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 5 Oct 2010 18:00:02 +0100 Subject: Fix Powered Clone and Photon bug diff --git a/src/powder.c b/src/powder.c index 40150b9..12dbe59 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1615,7 +1615,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_FIRE; parts[r>>8].life = 4; } - else if(((r&0xFF)!=PT_CLNE && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) + else if(((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50) { parts[i].life--; parts[r>>8].type = PT_NONE; @@ -2601,7 +2601,7 @@ killed: if(parts[i].type == PT_PHOT) { rt = pmap[ny][nx] & 0xFF; - if(rt==PT_CLNE) { + if(rt==PT_CLNE || rt==PT_PCLN) { lt = pmap[ny][nx] >> 8; if(!parts[lt].ctype) parts[lt].ctype = PT_PHOT; -- cgit v0.9.2-21-gd62e From 38742f08ba1ea0c5a4f6194bba3949a149825bb2 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 5 Oct 2010 18:48:40 +0100 Subject: Fixed Powered clone saving and suitibility as a light emitter. Fixed Photons igniting Insulator diff --git a/src/main.c b/src/main.c index f7ffec9..b91d86d 100755 --- a/src/main.c +++ b/src/main.c @@ -322,7 +322,7 @@ void *build_save(int *size, int x0, int y0, int w, int h) for(j=0; j=21) || (ty==PT_LAVA && ver>=34))) + if(i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34))) { if(p >= size) goto corrupt; diff --git a/src/powder.c b/src/powder.c index 12dbe59..8cd0f73 100644 --- a/src/powder.c +++ b/src/powder.c @@ -500,9 +500,9 @@ inline int create_part(int p, int x, int y, int t) } if(t==PT_PHOT) { - float a = (rand()%8) * 0.78540f; + float a = (rand()%8) * 0.78540f; parts[i].life = 680; - parts[i].ctype = 0x3FFFFFFF; + parts[i].ctype = 0x3FFFFFFF; parts[i].vx = 3.0f*cosf(a); parts[i].vy = 3.0f*sinf(a); } @@ -1968,6 +1968,7 @@ void update_particles_i(pixel *vid, int start, int inc) continue; rt = parts[r>>8].type; if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && + !(t==PT_PHOT && rt==PT_INSL) && (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { @@ -2547,8 +2548,10 @@ killed: (pmap[y+ny][x+nx]&0xFF)!=0xFF) parts[i].ctype = pmap[y+ny][x+nx]&0xFF; } - else - create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); + else { + create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); + } + } if(parts[i].type==PT_PCLN) { @@ -2567,7 +2570,18 @@ killed: (pmap[y+ny][x+nx]&0xFF)!=0xFF) parts[i].ctype = pmap[y+ny][x+nx]&0xFF; if(parts[i].ctype && parts[i].life==10) - create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); + if(parts[i].ctype==PT_PHOT){ + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++){ + r = create_part(-1, x+nx, y+ny, parts[i].ctype); + if(r!=-1){ + parts[r].vx = nx*3; + parts[r].vy = ny*3; + } + } + } else { + create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); + } } if(t==PT_YEST) { -- cgit v0.9.2-21-gd62e From 5040b80717cf8f86c6703d9d5c12f4e94bfbb932 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 7 Oct 2010 19:12:01 +0100 Subject: Attempt at fixing fuse crashes diff --git a/src/powder.c b/src/powder.c index 8cd0f73..9b008f7 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1352,16 +1352,18 @@ void update_particles_i(pixel *vid, int start, int inc) else if(t==PT_FUSE) { if(parts[i].life<=0) { - t = PT_NONE; + //t = parts[i].life = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; + if(r!=-1) + parts[r].life = 50; + //goto killed; } else if (parts[i].life < 40) { parts[i].life--; if((rand()%100)==0) { r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; + if(r!=-1) + parts[r].life = 50; } } if((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40) @@ -1369,10 +1371,10 @@ void update_particles_i(pixel *vid, int start, int inc) else if(parts[i].tmp<40&&parts[i].tmp>0) parts[i].tmp--; else if(parts[i].tmp<=0) { - t = PT_NONE; + //t = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_FSEP); - goto killed; + //goto killed; } for(nx=-2; nx<3; nx++) for(ny=-2; ny<3; ny++) @@ -1393,16 +1395,18 @@ void update_particles_i(pixel *vid, int start, int inc) else if(t==PT_FSEP) { if(parts[i].life<=0) { - t = PT_NONE; + //t = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_PLSM); - parts[r].life = 50; - goto killed; + if(r!=-1) + parts[r].life = 50; + //goto killed; } else if (parts[i].life < 40) { parts[i].life--; if((rand()%10)==0) { r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - parts[r].life = 50; + if(r!=-1) + parts[r].life = 50; } } for(nx=-2; nx<3; nx++) -- cgit v0.9.2-21-gd62e From 640b00c68e27fa6aed27b8652d5b42ca5974b9bf Mon Sep 17 00:00:00 2001 From: FacialTurd Date: Mon, 11 Oct 2010 10:44:09 -0700 Subject: fix the search memory corruption bug diff --git a/src/interface.c b/src/interface.c index bdec111..4592a72 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2329,7 +2329,8 @@ int search_ui(pixel *vid_buf) last_date = search_date; last_page = search_page; active = 1; - uri = malloc(strlen(last)*3+80+strlen(SERVER)+strlen(svf_user)); + // TODO: Create a better fix for this bug + uri = malloc(strlen(last)*3+180+strlen(SERVER)+strlen(svf_user)); //Increase "padding" from 80 to 180 to fix the search memory corruption bug if(search_own || svf_admin || svf_mod) tmp = "&ShowVotes=true"; else -- cgit v0.9.2-21-gd62e From 24a3b5919f2d893d0720d32dafaa03e2751f759f Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 12 Oct 2010 16:59:49 +0100 Subject: IRON diff --git a/includes/powder.h b/includes/powder.h index 3b5e2f0..d79e83c 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -114,7 +114,8 @@ #define PT_BCOL 73 #define PT_PCLN 74 #define PT_HSWC 75 -#define PT_NUM 76 +#define PT_IRON 76 +#define PT_NUM 77 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -264,10 +265,11 @@ static const part_type ptypes[PT_NUM] = {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, + {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; @@ -342,14 +344,15 @@ static part_state pstates[PT_NUM] = /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE,0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BCOL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* IRON */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static unsigned char can_move[PT_NUM][PT_NUM] = @@ -358,90 +361,91 @@ static unsigned char can_move[PT_NUM][PT_NUM] = /* Water 0 | 1 | Water displaces oil */ /* Oil 0 | 0 | Oil doesn't displace water */ - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A B P H */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S */ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W */ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0}, /* Dust */ - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}, /* Watr */ - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* HSWC */ - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A B P H */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S */ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W */ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C */ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A B P H I */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S R */ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W O */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C N */ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,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1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,1,0,1,1,0,1,1,0,1,0,1,0,0,1,0,0,0,0,0}, /* BCOL */ + /* PCLN */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* PCLN */ + /* HSWC */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* HSWC */ + /* IRON */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* IRON */ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A B P H I */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S R */ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W O */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C N */ }; extern int isplayer; diff --git a/src/powder.c b/src/powder.c index 9b008f7..1682dea 100644 --- a/src/powder.c +++ b/src/powder.c @@ -420,6 +420,7 @@ inline int create_part(int p, int x, int y, int t) (pmap[y][x]&0xFF)!=PT_ETRD && (pmap[y][x]&0xFF)!=PT_BRMT && (pmap[y][x]&0xFF)!=PT_NBLE && + (pmap[y][x]&0xFF)!=PT_IRON && (pmap[y][x]&0xFF)!=PT_INWR) return -1; parts[pmap[y][x]>>8].type = PT_SPRK; @@ -826,7 +827,7 @@ void update_particles_i(pixel *vid, int start, int inc) { if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC))) parts[i].life--; - if(parts[i].life<=0 && t!=PT_METL && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR && t!=PT_GLOW) + if(parts[i].life<=0 && t!=PT_METL && t!=PT_IRON && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR && t!=PT_GLOW) { kill_part(i); continue; @@ -834,7 +835,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(parts[i].life<=0 && t==PT_SPRK) { t = parts[i].ctype; - if(t!=PT_METL&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM&&t!=PT_BTRY&&t!=PT_NBLE) + if(t!=PT_METL&&t!=PT_IRON&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM&&t!=PT_BTRY&&t!=PT_NBLE) parts[i].temp = R_TEMP + 273.15f; if(!t) t = PT_METL; @@ -1010,6 +1011,8 @@ void update_particles_i(pixel *vid, int start, int inc) t = parts[i].type = PT_OIL; if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) t = parts[i].type = PT_BRMT; + if(t==PT_BMTL && pv[y/CELL][x/CELL]>1.0f && parts[i].tmp==1) + t = parts[i].type = PT_BRMT; if(t==PT_BRCK && pv[y/CELL][x/CELL]>2.8f) t = parts[i].type = PT_STNE; //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) @@ -1185,7 +1188,7 @@ void update_particles_i(pixel *vid, int start, int inc) pt = parts[i].temp -= 2.5f; } - if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_NTCT || t==PT_PTCT || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) + if(t==PT_WATR || t==PT_ETRD || t==PT_SLTW || t==PT_METL || t==PT_IRON || t==PT_RBDM || t==PT_LRBD || t==PT_BRMT || t==PT_PSCN || t==PT_NSCN || t==PT_NTCT || t==PT_PTCT || t==PT_BMTL || t==PT_SPRK|| t == PT_NBLE || t==PT_INWR) { nx = x % CELL; if(nx == 0) @@ -1203,7 +1206,7 @@ void update_particles_i(pixel *vid, int start, int inc) ny = y/CELL; if(nx>=0 && ny>=0 && nx>8)>=NPART || !r) continue; - if(((r&0xFF)==PT_METL || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK) + if(((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK) { t = parts[i].type = PT_NONE; @@ -1284,6 +1287,67 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_BMTL){ + if(parts[i].tmp>1){ + parts[i].tmp--; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + rt =parts[r>>8].type; + if((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100))) + { + parts[r>>8].type=PT_BMTL; + parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100; + } + } + } else if(parts[i].tmp==1 && 1>rand()%1000){ + parts[i].tmp = 0; + t = parts[i].type = PT_BRMT; + } + } + + else if(t==PT_IRON){ + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) || + ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) || + ((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) || + ((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) || + ((r&0xFF) == PT_LO2))&& + (!(parts[i].life)) + ) + { + parts[i].type=PT_BMTL; + parts[i].tmp=(rand()/(RAND_MAX/10))+20; + } + } + } + else if((t==PT_SPRK||parts[i].type==PT_SPRK) && parts[i].ctype==PT_IRON){ + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF) == PT_DSTW && 30>(rand()/(RAND_MAX/1000))) || + ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/1000))) || + ((r&0xFF) == PT_WATR && 30>(rand()/(RAND_MAX/1000)))) + { + parts[r>>8].type=PT_O2; + //parts[r>>8].tmp=(rand()/(RAND_MAX/10))+20; + } + } + } else if(t==PT_COAL) { if(parts[i].life<=0) { @@ -1920,7 +1984,7 @@ void update_particles_i(pixel *vid, int start, int inc) rt = parts[r>>8].type; if(parts_avg(i,r>>8) != PT_INSL) { - if((rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) + if((rt==PT_METL||rt==PT_IRON||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE)&&parts[r>>8].life==0 && abs(nx)+abs(ny) < 4) { parts[r>>8].life = 4; parts[r>>8].ctype = rt; @@ -1973,7 +2037,7 @@ void update_particles_i(pixel *vid, int start, int inc) rt = parts[r>>8].type; if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && !(t==PT_PHOT && rt==PT_INSL) && - (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && + (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { parts[r>>8].type = PT_FIRE; @@ -1987,7 +2051,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(lpv < 1) lpv = 1; if(legacy_enable) { - if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && + if(t!=PT_SPRK && ptypes[rt].meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) && ptypes[rt].meltable*lpv>(rand()%1000)) { if(t!=PT_LAVA || parts[i].life>0) @@ -2059,7 +2123,7 @@ void update_particles_i(pixel *vid, int start, int inc) pavg = parts_avg(i, r>>8); if(pavg != PT_INSL) { - if(t==PT_SPRK && (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && + if(t==PT_SPRK && (rt==PT_METL||rt==PT_IRON||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN||rt==PT_NBLE) && parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN)) ) -- cgit v0.9.2-21-gd62e From 5d1bc373d27747c3554fab1f048da8a2680c7532 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 12 Oct 2010 23:44:26 +0100 Subject: Some IRON stuff and photon rendering diff --git a/src/graphics.c b/src/graphics.c index cf0e1e6..8e0bc50 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1420,20 +1420,20 @@ void draw_parts(pixel *vid) cg = 0; cb = 0; cr = 0; - for(x=0; x<12; x++) { - cr += (parts[i].ctype >> (x+18)) & 1; - cb += (parts[i].ctype >> x) & 1; - } - for(x=0; x<14; x++) - cg += (parts[i].ctype >> (x+9)) & 1; - x = 624/(cr+cg+cb+1); - cr *= x; - cg *= x; - cb *= x; + for(x=0; x<12; x++) { + cr += (parts[i].ctype >> (x+18)) & 1; + cb += (parts[i].ctype >> x) & 1; + } + for(x=0; x<14; x++) + cg += (parts[i].ctype >> (x+9)) & 1; + x = 624/(cr+cg+cb+1); + cr *= x; + cg *= x; + cb *= x; vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr>255?255:cr,cg>255?255:cg,cb>255?255:cb); - cr >>= 4; - cg >>= 4; - cb >>= 4; + cr >>= 4; + cg >>= 4; + cb >>= 4; x = nx/CELL; y = ny/CELL; cg += fire_g[y][x]; @@ -1448,9 +1448,22 @@ void draw_parts(pixel *vid) } else { - cr = 0xFF; - cg = 0xFF; - cb = 0xFF; + cg = 0; + cb = 0; + cr = 0; + for(x=0; x<12; x++) { + cr += (parts[i].ctype >> (x+18)) & 1; + cb += (parts[i].ctype >> x) & 1; + } + for(x=0; x<14; x++) + cg += (parts[i].ctype >> (x+9)) & 1; + x = 624/(cr+cg+cb+1); + cr *= x; + cg *= x; + cb *= x; + cr = cr>255?255:cr; + cg = cg>255?255:cg; + cb = cb>255?255:cb; blendpixel(vid, nx, ny, cr, cg, cb, 192); blendpixel(vid, nx+1, ny, cr, cg, cb, 96); blendpixel(vid, nx-1, ny, cr, cg, cb, 96); @@ -2068,23 +2081,42 @@ void draw_parts(pixel *vid) } if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_HFLM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH&&t!=PT_SMKE&&t!=PT_WTRV&&!(t==PT_FIRW&&parts[i].tmp==3)) { - uint8 R = PIXR(ptypes[t].pcolors); - uint8 G = PIXG(ptypes[t].pcolors); - uint8 B = PIXB(ptypes[t].pcolors); + if(t==PT_PHOT){ + cg = 0; + cb = 0; + cr = 0; + for(x=0; x<12; x++) { + cr += (parts[i].ctype >> (x+18)) & 1; + cb += (parts[i].ctype >> x) & 1; + } + for(x=0; x<14; x++) + cg += (parts[i].ctype >> (x+9)) & 1; + x = 624/(cr+cg+cb+1); + cr *= x; + cg *= x; + cb *= x; + cr = cr>255?255:cr; + cg = cg>255?255:cg; + cb = cb>255?255:cb; + } else { + cr = PIXR(ptypes[t].pcolors); + cg = PIXG(ptypes[t].pcolors); + cb = PIXB(ptypes[t].pcolors); + } //if(vid[(ny-1)*YRES+(nx-1)]!=0){ // blendpixel(vid, nx, ny-1, R, G, B, 46); //} - blendpixel(vid, nx+1, ny, R, G, B, 223); - blendpixel(vid, nx-1, ny, R, G, B, 223); - blendpixel(vid, nx, ny+1, R, G, B, 223); - blendpixel(vid, nx, ny-1, R, G, B, 223); + blendpixel(vid, nx+1, ny, cr, cg, cb, 223); + blendpixel(vid, nx-1, ny, cr, cg, cb, 223); + blendpixel(vid, nx, ny+1, cr, cg, cb, 223); + blendpixel(vid, nx, ny-1, cr, cg, cb, 223); - blendpixel(vid, nx+1, ny-1, R, G, B, 112); - blendpixel(vid, nx-1, ny-1, R, G, B, 112); - blendpixel(vid, nx+1, ny+1, R, G, B, 112); - blendpixel(vid, nx-1, ny+1, R, G, B, 112); + blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112); + blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112); + blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); } } #endif -- cgit v0.9.2-21-gd62e From 2d6fa4597fefcdc6bfef8701f80817ded0a9b118 Mon Sep 17 00:00:00 2001 From: AntB Date: Wed, 13 Oct 2010 12:41:27 +0100 Subject: Formatting diff --git a/includes/powder.h b/includes/powder.h index d79e83c..f340892 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -140,312 +140,312 @@ static const unsigned short PROP_DEADLY = 0x12; //18 Is deadly for stickman. struct particle { - int type; - int life, ctype; - float x, y, vx, vy; - float temp; - float pavg[2]; - int flags; - int tmp; + int type; + int life, ctype; + float x, y, vx, vy; + float temp; + float pavg[2]; + int flags; + int tmp; }; typedef struct particle particle; struct part_type { - const char *name; - pixel pcolors; - float advection; - float airdrag; - float airloss; - float loss; - float collision; - float gravity; - float diffusion; - float hotair; - int falldown; - int flammable; - int explosive; - int meltable; - int hardness; - int menu; - int menusection; - float heat; - unsigned char hconduct; - const char *descs; - const unsigned short properties; + const char *name; + pixel pcolors; + float advection; + float airdrag; + float airloss; + float loss; + float collision; + float gravity; + float diffusion; + float hotair; + int falldown; + int flammable; + int explosive; + int meltable; + int hardness; + int menu; + int menusection; + float heat; + unsigned char hconduct; + const char *descs; + const unsigned short properties; }; typedef struct part_type part_type; struct part_state { - char state; - int solid; - float stemp; - int liquid; - float ltemp; - int gas; - float gtemp; - int burn; - float btemp; + char state; + int solid; + float stemp; + int liquid; + float ltemp; + int gas; + float gtemp; + int burn; + float btemp; }; typedef struct part_state part_state; //Should probably be const. static const part_type ptypes[PT_NUM] = { - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description - {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, - {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f+273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, - {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f+273.15f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, - {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f+273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, - {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, - {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, - {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, - {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, - {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+-50.0f+273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, - {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, - {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP+-30.0f+273.15f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, - {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, - {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, - {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, - {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, - {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+-2.0f+273.15f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, - {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, - {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. - {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, - {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f+273.15f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure."}, - {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, - {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax."}, - {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, - {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, - {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up."}, - {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f+273.15f, 255, "White hole, pushes other particles away."}, - {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, - {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f+273.15f, 170, "Liquid Rubidium."}, - {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, - {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, - {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, - {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, - {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!"}, - {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke"}, - {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, - {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, - {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, - {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure"}, - {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, - {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, - {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, - {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, - {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, - {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, - {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, - {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, + {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, + {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, + {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, + {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, + {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, + {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, + {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, + {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, + {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, + {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, + {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, + {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, + {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, + {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, + {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, + {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, + {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, + {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, + {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, + {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description }; static part_state pstates[PT_NUM] = { - // Name Solid Frzp Liquid Mpnt Gas Bpoint - /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, - /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f}, - /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f}, - /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LAVA */ {ST_LIQUID, PT_STNE, 973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, - /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, - /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, - /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, - /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, - /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f}, - /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f}, - /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, - /* LRBD */ {ST_LIQUID, PT_RBDM, 311.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, - /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, - /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, - /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f}, - /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, - /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, - /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BCOL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* IRON */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + // Name Solid Frzp Liquid Mpnt Gas Bpoint + /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f}, + /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f}, + /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LAVA */ {ST_LIQUID, PT_STNE, 973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, + /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, + /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, + /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, + /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f}, + /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f}, + /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, + /* LRBD */ {ST_LIQUID, PT_RBDM, 311.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, + /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, + /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, + /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f}, + /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, + /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, + /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BCOL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* IRON */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static unsigned char can_move[PT_NUM][PT_NUM] = { - /* Water | Oil */ - /* Water 0 | 1 | Water displaces oil */ - /* Oil 0 | 0 | Oil doesn't displace water */ - - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A B P H I */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S R */ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W O */ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C N */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* Dust */ - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,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,0,0,0,1,0,1,1,0,1,1,0,1,0,1,0,0,1,0,0,0,0,0}, /* BCOL */ - /* PCLN */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* PCLN */ - /* HSWC */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* HSWC */ - /* IRON */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* IRON */ - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A B P H I */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S R */ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W O */ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C N */ + /* Water | Oil */ + /* Water 0 | 1 | Water displaces oil */ + /* Oil 0 | 0 | Oil doesn't displace water */ + + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A B P H I */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S R */ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W O */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C N */ + /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ + /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* Dust */ + /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, /* Watr */ + /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Oill */ + /* FIRE */ {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0}, /* HSWC */ + /* IRON */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* IRON */ + /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A B P H I */ + /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S R */ + /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W O */ + /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C N */ }; extern int isplayer; -- cgit v0.9.2-21-gd62e From bb278b323b07144ea3d843e9df5fd5e655d6344a Mon Sep 17 00:00:00 2001 From: AntB Date: Wed, 13 Oct 2010 12:51:45 +0100 Subject: Solids Set diff --git a/includes/powder.h b/includes/powder.h index f340892..77880fb 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -168,6 +168,7 @@ struct part_type int meltable; int hardness; int menu; + int weight; int menusection; float heat; unsigned char hconduct; @@ -190,87 +191,94 @@ struct part_state }; typedef struct part_state part_state; //Should probably be const. +/* Weight Help + * 0-33 Gas + * 34-66 Liquid + * 67-99 Powder + * 100 Solid + * 101 Neut + Phot + */ static const part_type ptypes[PT_NUM] = { - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description - {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, - {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, - {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, - {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, - {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, - {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, - {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, - {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, - {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, - {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, - {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, - {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, - {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, - {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, - {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, - {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, - {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, - {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. - {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, - {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, - {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, - {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, - {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, - {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, - {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, - {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, - {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, - {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, - {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, - {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, - {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, - {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, - {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, - {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, - {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, - {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, - {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, - {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, - {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, - {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, - {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, - {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, - {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, - {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, - {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, - {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, + {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, + {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, + {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 101, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, + {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, + {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, + {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 101, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, + {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, + {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, + {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, + {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, + {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, + {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, + {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, + {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, + {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, + {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, + {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, + {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, + {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, + {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description }; static part_state pstates[PT_NUM] = -- cgit v0.9.2-21-gd62e From 1ef7942119b87ff96b0503b86215aea6c92860aa Mon Sep 17 00:00:00 2001 From: AntB Date: Wed, 13 Oct 2010 23:46:11 +0100 Subject: Powders Set diff --git a/includes/powder.h b/includes/powder.h index 77880fb..efd56f9 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -192,21 +192,21 @@ struct part_state typedef struct part_state part_state; //Should probably be const. /* Weight Help - * 0-33 Gas - * 34-66 Liquid - * 67-99 Powder - * 100 Solid - * 101 Neut + Phot + * 1 = Gas || + * 2 = Light || Powders 0-49 + * 98 = Heavy || Liquids 50-99 + * 100 = Solid || + * 101 = Special (Photons, Neutrons) */ static const part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 25, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 30, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, @@ -220,20 +220,20 @@ static const part_type ptypes[PT_NUM] = {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 101, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 30, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 15, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 30, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 101, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 30, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, @@ -245,10 +245,10 @@ static const part_type ptypes[PT_NUM] = {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 30, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 30, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, @@ -264,17 +264,17 @@ static const part_type ptypes[PT_NUM] = {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 20, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 20, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, - {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, + {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 15, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, - {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, + {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 30, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, -- cgit v0.9.2-21-gd62e From c9f8f2c8c9bbbf852931659b0db1fc20db9b1689 Mon Sep 17 00:00:00 2001 From: AntB Date: Thu, 14 Oct 2010 00:17:52 +0100 Subject: Adjusted Powders and set some Misc diff --git a/includes/powder.h b/includes/powder.h index efd56f9..86d1dec 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -193,8 +193,8 @@ typedef struct part_state part_state; //Should probably be const. /* Weight Help * 1 = Gas || - * 2 = Light || Powders 0-49 - * 98 = Heavy || Liquids 50-99 + * 2 = Light || Liquids 0-49 + * 98 = Heavy || Powder 50-99 * 100 = Solid || * 101 = Special (Photons, Neutrons) */ @@ -202,38 +202,38 @@ static const part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 25, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, - {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 30, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, - {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, - {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 101, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 30, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, - {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 15, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 30, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 101, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 30, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, @@ -245,36 +245,36 @@ static const part_type ptypes[PT_NUM] = {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 30, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 30, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, + {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 20, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 20, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, - {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, - {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 15, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, + {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, - {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 30, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, + {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, -- cgit v0.9.2-21-gd62e From b3739e34f8a9372dcb0663c599abe349e1f34dad Mon Sep 17 00:00:00 2001 From: AntB Date: Thu, 14 Oct 2010 00:57:27 +0100 Subject: int weight additions to powder.h complete, removed can_move array. redid a bit of formatting diff --git a/includes/powder.h b/includes/powder.h index 86d1dec..290e3fb 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -203,16 +203,16 @@ static const part_type ptypes[PT_NUM] = //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, - {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, - {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, - {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, @@ -222,34 +222,34 @@ static const part_type ptypes[PT_NUM] = {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 101, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, - {"ACID", PIXPACK(0xed55ff), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, + {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, - {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, - {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 101, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, - {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, - {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, @@ -259,18 +259,18 @@ static const part_type ptypes[PT_NUM] = {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, - {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Vaporises under low pressure, explodes under high pressure and temperatures"}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures"}, {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, - {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, @@ -283,7 +283,7 @@ static const part_type ptypes[PT_NUM] = static part_state pstates[PT_NUM] = { - // Name Solid Frzp Liquid Mpnt Gas Bpoint + // Name Solid Frzp Liquid Mpnt Gas Bpoint /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, @@ -294,7 +294,7 @@ static part_state pstates[PT_NUM] = /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, + /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -302,12 +302,12 @@ static part_state pstates[PT_NUM] = /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, - /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, + /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, @@ -315,7 +315,7 @@ static part_state pstates[PT_NUM] = /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, @@ -336,126 +336,33 @@ static part_state pstates[PT_NUM] = /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f}, - /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, - /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, - /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, + /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, + /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BCOL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BCOL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* IRON */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; -static unsigned char can_move[PT_NUM][PT_NUM] = -{ - /* Water | Oil */ - /* Water 0 | 1 | Water displaces oil */ - /* Oil 0 | 0 | Oil doesn't displace water */ - - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A B P H I */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S R */ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W O */ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C N */ - /* NONE */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* None */ - /* DUST */ {0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0}, /* Dust */ - /* WATR */ {0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}, /* Watr */ - /* OILL */ {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* HSWC */ - /* IRON */ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* IRON */ - /* N D W O F S L G N C G P D I M S S W N P P A V W C D S S D B B P U W M P N L I B W R L H S G C B T P E N N B L S S S D C L O I Y D T G B H F F F A B P H I */ - /* o u a i i t a u i l a l f c e p n o e l l c o t n s a l m m r h r a W S S N N H H b R S a l s G h l t i B t C T W M e o O 2 N E Y H L R F I U S M C C S R */ - /* n s t l r n v n t n s e r e t r o o u u n i i r c t l t n t m o a x a c c 2 S o o d b C n a c l d s r c L r r K C K s a X W S S R O C L R S E T O L W O */ - /* e t r l e e a p r e s x m i l k w d t t t d d v t w t w d l t t n x n n U l l m d N d s n a r m d e E y y M H E l l R T T M W K M W E P R L N C N */ -}; - extern int isplayer; extern float player[27]; -- cgit v0.9.2-21-gd62e From 53ed480afc337abe0182d4869f7de96d649fac1a Mon Sep 17 00:00:00 2001 From: AntB Date: Thu, 14 Oct 2010 01:53:24 +0100 Subject: First release. it is buggy but stable. diff --git a/src/powder.c b/src/powder.c index 1682dea..4e0b9f8 100644 --- a/src/powder.c +++ b/src/powder.c @@ -93,7 +93,7 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) return 0; - if (r && ((r&0xFF) >= PT_NUM || !can_move[pt][(r&0xFF)])) + if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight > ptypes[pt>>8].weight))) return 0; if(pt == PT_PHOT) -- cgit v0.9.2-21-gd62e From 01dcfe5a1a95c7811b9c0871d3e8761f855e5c2d Mon Sep 17 00:00:00 2001 From: AntB Date: Thu, 14 Oct 2010 02:42:37 +0100 Subject: As good as its gettin for now diff --git a/src/powder.c b/src/powder.c index 4e0b9f8..bd1779a 100644 --- a/src/powder.c +++ b/src/powder.c @@ -93,7 +93,7 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) return 0; - if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight > ptypes[pt>>8].weight))) + if (r && ((r&0xFF) >= PT_NUM || !(ptypes[pt].weight = ptypes[(r&0xFF)].weight))) return 0; if(pt == PT_PHOT) -- cgit v0.9.2-21-gd62e From 79767f4ceb36118d17b1b148c4454d556699ef63 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 14 Oct 2010 18:33:47 +0100 Subject: Client Side 'Favourites' UI stuff diff --git a/includes/defines.h b/includes/defines.h index a324e9f..9dbd338 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -23,7 +23,7 @@ #define HTTP_TIMEOUT 10 #define MENUSIZE 40 -#define BARSIZE 14 +#define BARSIZE 17 #define XRES 612 #define YRES 384 #define NPART XRES*YRES diff --git a/includes/interface.h b/includes/interface.h index 7f13064..00b175a 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -112,6 +112,7 @@ extern void *search_thumbs[GRID_X*GRID_Y]; extern int search_thsizes[GRID_X*GRID_Y]; extern int search_own; +extern int search_fav; extern int search_date; extern int search_page; extern char search_expr[256]; diff --git a/src/graphics.c b/src/graphics.c index 8e0bc50..c8e96bf 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -745,15 +745,15 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) void draw_menu(pixel *vid_buf, int i, int hover) { - drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); if(hover==i) { - fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); + fillrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawtext(vid_buf, (XRES+BARSIZE)-13, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); } else { - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + drawtext(vid_buf, (XRES+BARSIZE)-13, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); } } diff --git a/src/interface.c b/src/interface.c index 4592a72..decc580 100644 --- a/src/interface.c +++ b/src/interface.c @@ -46,6 +46,7 @@ void *search_thumbs[GRID_X*GRID_Y]; int search_thsizes[GRID_X*GRID_Y]; int search_own = 0; +int search_fav = 0; int search_date = 0; int search_page = 0; char search_expr[256] = ""; @@ -1759,7 +1760,7 @@ corrupt: int search_ui(pixel *vid_buf) { - int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,dap,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,dap,own,last_own=search_own,last_fav=search_fav,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; int thumb_drawn[GRID_X*GRID_Y]; pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); @@ -1851,39 +1852,50 @@ int search_ui(pixel *vid_buf) if(!svf_login) { search_own = 0; - drawrect(vid_buf, XRES-64, 8, 56, 16, 96, 96, 96, 255); - drawtext(vid_buf, XRES-61, 11, "\x94", 96, 80, 16, 255); - drawtext(vid_buf, XRES-61, 11, "\x93", 128, 128, 128, 255); - drawtext(vid_buf, XRES-46, 13, "My Own", 128, 128, 128, 255); + drawrect(vid_buf, XRES-64+16, 8, 56, 16, 96, 96, 96, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x94", 96, 80, 16, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x93", 128, 128, 128, 255); + drawtext(vid_buf, XRES-46+16, 13, "My Own", 128, 128, 128, 255); } else if(search_own) { - fillrect(vid_buf, XRES-65, 7, 58, 18, 255, 255, 255, 255); - drawtext(vid_buf, XRES-61, 11, "\x94", 192, 160, 64, 255); - drawtext(vid_buf, XRES-61, 11, "\x93", 32, 32, 32, 255); - drawtext(vid_buf, XRES-46, 13, "My Own", 0, 0, 0, 255); + fillrect(vid_buf, XRES-65+16, 7, 58, 18, 255, 255, 255, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x94", 192, 160, 64, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x93", 32, 32, 32, 255); + drawtext(vid_buf, XRES-46+16, 13, "My Own", 0, 0, 0, 255); } else { - drawrect(vid_buf, XRES-64, 8, 56, 16, 192, 192, 192, 255); - drawtext(vid_buf, XRES-61, 11, "\x94", 192, 160, 32, 255); - drawtext(vid_buf, XRES-61, 11, "\x93", 255, 255, 255, 255); - drawtext(vid_buf, XRES-46, 13, "My Own", 255, 255, 255, 255); + drawrect(vid_buf, XRES-64+16, 8, 56, 16, 192, 192, 192, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x94", 192, 160, 32, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x93", 255, 255, 255, 255); + drawtext(vid_buf, XRES-46+16, 13, "My Own", 255, 255, 255, 255); + } + + if(search_fav) + { + fillrect(vid_buf, XRES-134, 7, 18, 18, 255, 255, 255, 255); + drawtext(vid_buf, XRES-130, 11, "\xCC", 192, 160, 64, 255); + } + else + { + drawrect(vid_buf, XRES-134, 8, 16, 16, 192, 192, 192, 255); + drawtext(vid_buf, XRES-130, 11, "\xCC", 192, 160, 32, 255); } if(search_date) { - fillrect(vid_buf, XRES-130, 7, 62, 18, 255, 255, 255, 255); - drawtext(vid_buf, XRES-126, 11, "\xA6", 32, 32, 32, 255); - drawtext(vid_buf, XRES-111, 13, "By date", 0, 0, 0, 255); + fillrect(vid_buf, XRES-130+16, 7, 62, 18, 255, 255, 255, 255); + drawtext(vid_buf, XRES-126+16, 11, "\xA6", 32, 32, 32, 255); + drawtext(vid_buf, XRES-111+16, 13, "By date", 0, 0, 0, 255); } else { - drawrect(vid_buf, XRES-129, 8, 60, 16, 192, 192, 192, 255); - drawtext(vid_buf, XRES-126, 11, "\xA9", 144, 48, 32, 255); - drawtext(vid_buf, XRES-126, 11, "\xA8", 32, 144, 32, 255); - drawtext(vid_buf, XRES-126, 11, "\xA7", 255, 255, 255, 255); - drawtext(vid_buf, XRES-111, 13, "By votes", 255, 255, 255, 255); + drawrect(vid_buf, XRES-129+16, 8, 60, 16, 192, 192, 192, 255); + drawtext(vid_buf, XRES-126+16, 11, "\xA9", 144, 48, 32, 255); + drawtext(vid_buf, XRES-126+16, 11, "\xA8", 32, 144, 32, 255); + drawtext(vid_buf, XRES-126+16, 11, "\xA7", 255, 255, 255, 255); + drawtext(vid_buf, XRES-111+16, 13, "By votes", 255, 255, 255, 255); } if(search_page) @@ -2133,16 +2145,21 @@ int search_ui(pixel *vid_buf) if(sdl_key==SDLK_ESCAPE) goto finish; - if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) + if(b && !bq && mx>=XRES-64+16 && mx<=XRES-8+16 && my>=8 && my<=24 && svf_login) { search_own = !search_own; lasttime = TIMEOUT; } - if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) + if(b && !bq && mx>=XRES-129+16 && mx<=XRES-65+16 && my>=8 && my<=24) { search_date = !search_date; lasttime = TIMEOUT; } + if(b && !bq && mx>=XRES-134 && mx<=XRES-134+16 && my>=8 && my<=24) + { + search_fav = !search_fav; + lasttime = TIMEOUT; + } if(b && !bq && dp!=-1) if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) @@ -2307,10 +2324,10 @@ int search_ui(pixel *vid_buf) { search = 1; } - else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page || last_fav!=search_fav)) { search = 1; - if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) + if(strcmp(last, ed.str) || last_own!=search_own || last_fav!=search_fav || last_date!=search_date) { search_page = 0; page_count = 0; @@ -2328,9 +2345,10 @@ int search_ui(pixel *vid_buf) last_own = search_own; last_date = search_date; last_page = search_page; + last_fav = search_fav; active = 1; // TODO: Create a better fix for this bug - uri = malloc(strlen(last)*3+180+strlen(SERVER)+strlen(svf_user)); //Increase "padding" from 80 to 180 to fix the search memory corruption bug + uri = malloc(strlen(last)*3+180+strlen(SERVER)+strlen(svf_user)+20); //Increase "padding" from 80 to 180 to fix the search memory corruption bug if(search_own || svf_admin || svf_mod) tmp = "&ShowVotes=true"; else @@ -2359,6 +2377,10 @@ int search_ui(pixel *vid_buf) strcaturl(uri, " user:"); strcaturl(uri, svf_user); } + if(search_fav) + { + strcaturl(uri, " cat:favs"); + } if(search_date) strcaturl(uri, " sort:date"); diff --git a/src/main.c b/src/main.c index b91d86d..77133f9 100755 --- a/src/main.c +++ b/src/main.c @@ -507,8 +507,10 @@ int parse_save(void *save, int size, int replace, int x0, int y0) if(p >= size) goto corrupt; j=d[p++]; - if(j >= PT_NUM) - goto corrupt; + if(j >= PT_NUM){ + //TODO: Possibly some server side translation + j = PT_DUST;//goto corrupt; + } if(j)// && !(isplayer == 1 && j==PT_STKM)) { if(pmap[y][x]) -- cgit v0.9.2-21-gd62e From a49f81decb2d082a5fa794d4be4fd288bace247a Mon Sep 17 00:00:00 2001 From: AntB Date: Fri, 15 Oct 2010 00:07:02 +0100 Subject: Photon fix >.< getting the right weight helps diff --git a/includes/powder.h b/includes/powder.h index 290e3fb..e82a5ea 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -196,7 +196,7 @@ typedef struct part_state part_state; * 2 = Light || Liquids 0-49 * 98 = Heavy || Powder 50-99 * 100 = Solid || - * 101 = Special (Photons, Neutrons) + * 101 is Neutrons, -1 = Photons */ static const part_type ptypes[PT_NUM] = { @@ -232,7 +232,7 @@ static const part_type ptypes[PT_NUM] = {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, - {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 101, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, diff --git a/src/powder.c b/src/powder.c index bd1779a..2cc8c3c 100644 --- a/src/powder.c +++ b/src/powder.c @@ -93,7 +93,9 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) return 0; - if (r && ((r&0xFF) >= PT_NUM || !(ptypes[pt].weight = ptypes[(r&0xFF)].weight))) + if (r && ((r&0xFF) >= PT_NUM || + !(ptypes[pt].weight >= ptypes[(r&0xFF)].weight)) + ) return 0; if(pt == PT_PHOT) -- cgit v0.9.2-21-gd62e From a03b1f7e566839856287d07f62864a4104e4e885 Mon Sep 17 00:00:00 2001 From: AntB Date: Fri, 15 Oct 2010 13:11:27 +0100 Subject: Physics fix diff --git a/src/powder.c b/src/powder.c index 2cc8c3c..d297489 100644 --- a/src/powder.c +++ b/src/powder.c @@ -94,7 +94,7 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) return 0; if (r && ((r&0xFF) >= PT_NUM || - !(ptypes[pt].weight >= ptypes[(r&0xFF)].weight)) + (ptypes[pt].weight <= ptypes[(r&0xFF)].weight)) ) return 0; -- cgit v0.9.2-21-gd62e From 1d167e10547829067b20b56e355576891053ea5f Mon Sep 17 00:00:00 2001 From: AntB Date: Fri, 15 Oct 2010 17:36:05 +0100 Subject: Manual merge - UI changes diff --git a/includes/defines.h b/includes/defines.h index a324e9f..eabfbf5 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -23,7 +23,7 @@ #define HTTP_TIMEOUT 10 #define MENUSIZE 40 -#define BARSIZE 14 +#define BARSIZE 17 #define XRES 612 #define YRES 384 #define NPART XRES*YRES @@ -115,4 +115,4 @@ void *build_save(int *size, int x0, int y0, int w, int h); int parse_save(void *save, int size, int replace, int x0, int y0); void del_stamp(int d); void sdl_seticon(void); -#endif \ No newline at end of file +#endif diff --git a/includes/interface.h b/includes/interface.h index 7f13064..00b175a 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -112,6 +112,7 @@ extern void *search_thumbs[GRID_X*GRID_Y]; extern int search_thsizes[GRID_X*GRID_Y]; extern int search_own; +extern int search_fav; extern int search_date; extern int search_page; extern char search_expr[256]; diff --git a/src/graphics.c b/src/graphics.c index 8e0bc50..c8e96bf 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -745,15 +745,15 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc) void draw_menu(pixel *vid_buf, int i, int hover) { - drawrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); if(hover==i) { - fillrect(vid_buf, XRES-2, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); + fillrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255); + drawtext(vid_buf, (XRES+BARSIZE)-13, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 0, 0, 0, 255); } else { - drawtext(vid_buf, XRES+1, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); + drawtext(vid_buf, (XRES+BARSIZE)-13, (i*16)+YRES+MENUSIZE-14-(SC_TOTAL*16), msections[i].icon, 255, 255, 255, 255); } } diff --git a/src/interface.c b/src/interface.c index 4592a72..c904d5c 100644 --- a/src/interface.c +++ b/src/interface.c @@ -46,6 +46,7 @@ void *search_thumbs[GRID_X*GRID_Y]; int search_thsizes[GRID_X*GRID_Y]; int search_own = 0; +int search_fav = 0; int search_date = 0; int search_page = 0; char search_expr[256] = ""; @@ -1759,7 +1760,7 @@ corrupt: int search_ui(pixel *vid_buf) { - int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,dap,own,last_own=search_own,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; + int uih=0,nyu,nyd,b=1,bq,mx=0,my=0,mxq=0,myq=0,mmt=0,gi,gj,gx,gy,pos,i,mp,dp,dap,own,last_own=search_own,last_fav=search_fav,page_count=0,last_page=0,last_date=0,j,w,h,st=0,lv; int is_p1=0, exp_res=GRID_X*GRID_Y, tp, view_own=0; int thumb_drawn[GRID_X*GRID_Y]; pixel *v_buf = (pixel *)malloc(((YRES+MENUSIZE)*(XRES+BARSIZE))*PIXELSIZE); @@ -1851,39 +1852,50 @@ int search_ui(pixel *vid_buf) if(!svf_login) { search_own = 0; - drawrect(vid_buf, XRES-64, 8, 56, 16, 96, 96, 96, 255); - drawtext(vid_buf, XRES-61, 11, "\x94", 96, 80, 16, 255); - drawtext(vid_buf, XRES-61, 11, "\x93", 128, 128, 128, 255); - drawtext(vid_buf, XRES-46, 13, "My Own", 128, 128, 128, 255); + drawrect(vid_buf, XRES-64+16, 8, 56, 16, 96, 96, 96, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x94", 96, 80, 16, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x93", 128, 128, 128, 255); + drawtext(vid_buf, XRES-46+16, 13, "My Own", 128, 128, 128, 255); } else if(search_own) { - fillrect(vid_buf, XRES-65, 7, 58, 18, 255, 255, 255, 255); - drawtext(vid_buf, XRES-61, 11, "\x94", 192, 160, 64, 255); - drawtext(vid_buf, XRES-61, 11, "\x93", 32, 32, 32, 255); - drawtext(vid_buf, XRES-46, 13, "My Own", 0, 0, 0, 255); + fillrect(vid_buf, XRES-65+16, 7, 58, 18, 255, 255, 255, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x94", 192, 160, 64, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x93", 32, 32, 32, 255); + drawtext(vid_buf, XRES-46+16, 13, "My Own", 0, 0, 0, 255); } else { - drawrect(vid_buf, XRES-64, 8, 56, 16, 192, 192, 192, 255); - drawtext(vid_buf, XRES-61, 11, "\x94", 192, 160, 32, 255); - drawtext(vid_buf, XRES-61, 11, "\x93", 255, 255, 255, 255); - drawtext(vid_buf, XRES-46, 13, "My Own", 255, 255, 255, 255); + drawrect(vid_buf, XRES-64+16, 8, 56, 16, 192, 192, 192, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x94", 192, 160, 32, 255); + drawtext(vid_buf, XRES-61+16, 11, "\x93", 255, 255, 255, 255); + drawtext(vid_buf, XRES-46+16, 13, "My Own", 255, 255, 255, 255); + } + + if(search_fav) + { + fillrect(vid_buf, XRES-134, 7, 18, 18, 255, 255, 255, 255); + drawtext(vid_buf, XRES-130, 11, "\xCC", 192, 160, 64, 255); + } + else + { + drawrect(vid_buf, XRES-134, 8, 16, 16, 192, 192, 192, 255); + drawtext(vid_buf, XRES-130, 11, "\xCC", 192, 160, 32, 255); } if(search_date) { - fillrect(vid_buf, XRES-130, 7, 62, 18, 255, 255, 255, 255); - drawtext(vid_buf, XRES-126, 11, "\xA6", 32, 32, 32, 255); - drawtext(vid_buf, XRES-111, 13, "By date", 0, 0, 0, 255); + fillrect(vid_buf, XRES-130+16, 7, 62, 18, 255, 255, 255, 255); + drawtext(vid_buf, XRES-126+16, 11, "\xA6", 32, 32, 32, 255); + drawtext(vid_buf, XRES-111+16, 13, "By date", 0, 0, 0, 255); } else { - drawrect(vid_buf, XRES-129, 8, 60, 16, 192, 192, 192, 255); - drawtext(vid_buf, XRES-126, 11, "\xA9", 144, 48, 32, 255); - drawtext(vid_buf, XRES-126, 11, "\xA8", 32, 144, 32, 255); - drawtext(vid_buf, XRES-126, 11, "\xA7", 255, 255, 255, 255); - drawtext(vid_buf, XRES-111, 13, "By votes", 255, 255, 255, 255); + drawrect(vid_buf, XRES-129+16, 8, 60, 16, 192, 192, 192, 255); + drawtext(vid_buf, XRES-126+16, 11, "\xA9", 144, 48, 32, 255); + drawtext(vid_buf, XRES-126+16, 11, "\xA8", 32, 144, 32, 255); + drawtext(vid_buf, XRES-126+16, 11, "\xA7", 255, 255, 255, 255); + drawtext(vid_buf, XRES-111+16, 13, "By votes", 255, 255, 255, 255); } if(search_page) @@ -2133,16 +2145,21 @@ int search_ui(pixel *vid_buf) if(sdl_key==SDLK_ESCAPE) goto finish; - if(b && !bq && mx>=XRES-64 && mx<=XRES-8 && my>=8 && my<=24 && svf_login) + if(b && !bq && mx>=XRES-64+16 && mx<=XRES-8+16 && my>=8 && my<=24 && svf_login) { search_own = !search_own; lasttime = TIMEOUT; } - if(b && !bq && mx>=XRES-129 && mx<=XRES-65 && my>=8 && my<=24) + if(b && !bq && mx>=XRES-129+16 && mx<=XRES-65+16 && my>=8 && my<=24) { search_date = !search_date; lasttime = TIMEOUT; } + if(b && !bq && mx>=XRES-134 && mx<=XRES-134+16 && my>=8 && my<=24) + { + search_fav = !search_fav; + lasttime = TIMEOUT; + } if(b && !bq && dp!=-1) if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete")) @@ -2307,10 +2324,10 @@ int search_ui(pixel *vid_buf) { search = 1; } - else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page)) + else if(!active && (strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date || last_page!=search_page || last_fav!=search_fav)) { search = 1; - if(strcmp(last, ed.str) || last_own!=search_own || last_date!=search_date) + if(strcmp(last, ed.str) || last_own!=search_own || last_fav!=search_fav || last_date!=search_date) { search_page = 0; page_count = 0; @@ -2328,9 +2345,10 @@ int search_ui(pixel *vid_buf) last_own = search_own; last_date = search_date; last_page = search_page; + last_fav = search_fav; active = 1; // TODO: Create a better fix for this bug - uri = malloc(strlen(last)*3+180+strlen(SERVER)+strlen(svf_user)); //Increase "padding" from 80 to 180 to fix the search memory corruption bug + uri = malloc(strlen(last)*3+180+strlen(SERVER)+strlen(svf_user)+20); //Increase "padding" from 80 to 180 to fix the search memory corruption bug if(search_own || svf_admin || svf_mod) tmp = "&ShowVotes=true"; else @@ -2359,6 +2377,10 @@ int search_ui(pixel *vid_buf) strcaturl(uri, " user:"); strcaturl(uri, svf_user); } + if(search_fav) + { + strcaturl(uri, " cat:favs"); + } if(search_date) strcaturl(uri, " sort:date"); diff --git a/src/main.c b/src/main.c index b91d86d..744a43f 100755 --- a/src/main.c +++ b/src/main.c @@ -507,8 +507,10 @@ int parse_save(void *save, int size, int replace, int x0, int y0) if(p >= size) goto corrupt; j=d[p++]; - if(j >= PT_NUM) - goto corrupt; + if(j >= PT_NUM){ + //TODO: Possibly some server side translation + j = PT_DUST;//goto corrupt; + } if(j)// && !(isplayer == 1 && j==PT_STKM)) { if(pmap[y][x]) -- cgit v0.9.2-21-gd62e From edcd7db073c3372ce246fff1bb33bfea0f5aa686 Mon Sep 17 00:00:00 2001 From: AntB Date: Sat, 16 Oct 2010 14:55:01 +0100 Subject: Neutron Fix diff --git a/includes/powder.h b/includes/powder.h index e82a5ea..e7ef771 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -196,7 +196,7 @@ typedef struct part_state part_state; * 2 = Light || Liquids 0-49 * 98 = Heavy || Powder 50-99 * 100 = Solid || - * 101 is Neutrons, -1 = Photons + * -1 is Neutrons and Photons */ static const part_type ptypes[PT_NUM] = { @@ -219,7 +219,7 @@ static const part_type ptypes[PT_NUM] = {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, - {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, 101, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, -- cgit v0.9.2-21-gd62e From c4368bf8afc5ab1f1dd66f5aae0f79c841926137 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 16 Oct 2010 23:35:33 +0200 Subject: moved defines diff --git a/includes/defines.h b/includes/defines.h index eabfbf5..0f80ab6 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -62,6 +62,18 @@ typedef unsigned short pixel; typedef unsigned int pixel; #endif +#define SURF_RANGE 10 +#define NORMAL_MIN_EST 3 +#define NORMAL_INTERP 20 +#define NORMAL_FRAC 16 + +#define REFRACT 0x80000000 + +/* heavy flint glass, for awesome refraction/dispersion + this way you can make roof prisms easily */ +#define GLASS_IOR 1.9 +#define GLASS_DISP 0.07 + typedef unsigned char uint8; extern int amd; diff --git a/src/powder.c b/src/powder.c index d297489..c86409f 100644 --- a/src/powder.c +++ b/src/powder.c @@ -188,17 +188,6 @@ int try_move(int i, int x, int y, int nx, int ny) return 1; } -#define SURF_RANGE 10 -#define NORMAL_MIN_EST 3 -#define NORMAL_INTERP 20 -#define NORMAL_FRAC 16 - -#define REFRACT 0x80000000 - -/* heavy flint glass, for awesome refraction/dispersion - this way you can make roof prisms easily */ -#define GLASS_IOR 1.9 -#define GLASS_DISP 0.07 static unsigned direction_to_map(float dx, float dy) { -- cgit v0.9.2-21-gd62e From 3b4d2b9406b87094ebb4f97c61561441fc755323 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sun, 17 Oct 2010 11:46:42 +0100 Subject: Few fixes for potential problems diff --git a/src/powder.c b/src/powder.c index c86409f..dcd56df 100644 --- a/src/powder.c +++ b/src/powder.c @@ -793,9 +793,6 @@ int nearest_part(int ci, int t) void update_particles_i(pixel *vid, int start, int inc) { int i, j, x, y, t, nx, ny, r, a, s, lt, rt, fe, nt, lpv, nearp, pavg; - uint16_t tempu1, tempu2; - int16_t temps1, temps2; - float tempf1, tempf2; float mv, dx, dy, ix, iy, lx, ly, d, pp, nrx, nry, dp; float nn, ct1, ct2; float pt = R_TEMP; @@ -1228,8 +1225,7 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if(((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT||(r&0xFF)==PT_NBLE) || (r&0xFF)==PT_INWR && parts[r>>8].ctype!=PT_SPRK) - + if(((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT || (r&0xFF)==PT_NBLE || (r&0xFF)==PT_INWR) && parts[r>>8].ctype!=PT_SPRK) { t = parts[i].type = PT_NONE; parts[r>>8].ctype = parts[r>>8].type; @@ -1472,7 +1468,7 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r) continue; - if((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f)) && 1>(rand()%15)) + if(((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15)) { if(parts[i].life>40) { parts[i].life = 39; @@ -2628,9 +2624,9 @@ killed: (pmap[y+ny][x+nx]&0xFF)!=PT_STKM && (pmap[y+ny][x+nx]&0xFF)!=0xFF) parts[i].ctype = pmap[y+ny][x+nx]&0xFF; - if(parts[i].ctype && parts[i].life==10) + if(parts[i].ctype && parts[i].life==10){ if(parts[i].ctype==PT_PHOT){ - for(nx=-1; nx<2; nx++) + for(nx=-1; nx<2; nx++){ for(ny=-1; ny<2; ny++){ r = create_part(-1, x+nx, y+ny, parts[i].ctype); if(r!=-1){ @@ -2638,9 +2634,11 @@ killed: parts[r].vy = ny*3; } } + } } else { create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); } + } } if(t==PT_YEST) { -- cgit v0.9.2-21-gd62e From af09f466d21baaef2db1d0a0889ee8c5eb9dfef4 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Tue, 19 Oct 2010 21:35:22 +0200 Subject: fixed debug build a bit, probably still broken diff --git a/Makefile b/Makefile index 8a25f40..74c1a1c 100755 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ LFLAGS := -lSDL -lm -lbz2 MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE2 := -march=native-DX86 -DX86_SSE2 -msse2 MFLAGS_SSE := -march=native -DX86 -DX86_SSE -FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -O2 -march=k8 -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lbz2 +FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lbz2 COMPILER := gcc LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 WIN32_TARG := powder-sse.exe powder-sse2.exe @@ -14,7 +14,7 @@ WIN32_TARG := powder-sse.exe powder-sse2.exe powder: $(SOURCES) $(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 powder-debug: $(SOURCES) - $(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) + $(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) -Iincludes/ -DLIN64 powder-sse3: $(SOURCES) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 -- cgit v0.9.2-21-gd62e From 92b28b7879f55fdf1a496ba9a7c4001585a78cfe Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 20 Oct 2010 22:31:19 +0100 Subject: New Open UI - Half Complete diff --git a/includes/graphics.h b/includes/graphics.h index 6a1507e..260c69b 100644 --- a/includes/graphics.h +++ b/includes/graphics.h @@ -77,6 +77,8 @@ extern inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a); +int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, int b, int a); + void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); void fillrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a); diff --git a/includes/interface.h b/includes/interface.h index 00b175a..30908a9 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -73,6 +73,26 @@ struct ui_edit }; typedef struct ui_edit ui_edit; +struct save_info +{ + char *title; + char *name; + char *author; + char *date; + char *description; + int publish; + int voteup; + int votedown; + int vote; + int myvote; + int myfav; + char *tags; + int comment_count; + char *comments[6]; + char *commentauthors[6]; +}; +typedef struct save_info save_info; + struct ui_checkbox { int x, y; @@ -170,6 +190,10 @@ char *download_ui(pixel *vid_buf, char *uri, int *len); int search_ui(pixel *vid_buf); +int open_ui(pixel *vid_buf, char *save_id); + +int info_parse(void *info_data, save_info *info); + int search_results(char *str, int votes); int execute_tagop(pixel *vid_buf, char *op, char *tag); @@ -178,6 +202,10 @@ void execute_save(pixel *vid_buf); void execute_delete(pixel *vid_buf, char *id); +void execute_report(pixel *vid_buf, char *id); + +void execute_fav(pixel *vid_buf, char *id); + int execute_vote(pixel *vid_buf, char *id, char *action); #endif diff --git a/src/graphics.c b/src/graphics.c index c8e96bf..9f45526 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -844,6 +844,62 @@ int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a #endif return x; } +int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, int b, int a) +{ +#ifdef OpenGL +#else + int sx = x; + int rh = 12; + int rw = 0; + int cw = x; + for(; *s; s++) + { + if(*s == '\n') + { + x = sx; + rw = 0; + y += FONT_H+2; + } + else if(*s == '\b') + { + switch(s[1]) + { + case 'w': + r = g = b = 255; + break; + case 'g': + r = g = b = 192; + break; + case 'o': + r = 255; + g = 216; + b = 32; + break; + case 'r': + r = 255; + g = b = 0; + break; + case 'b': + r = g = 0; + b = 255; + break; + } + s++; + } + else + { + if(x-cw>=w){ + x = sx; + rw = 0; + y+=FONT_H+2; + rh+=FONT_H+2; + } + x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); + } + } +#endif + return rh; +} void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a) { diff --git a/src/interface.c b/src/interface.c index decc580..eab027a 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2197,6 +2197,10 @@ int search_ui(pixel *vid_buf) if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) { + if(open_ui(vid_buf, search_ids[mp], search_dates[mp]?search_dates[mp]:NULL)==1){ + goto finish; + } + /* fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); info_box(vid_buf, "Loading..."); @@ -2317,7 +2321,7 @@ int search_ui(pixel *vid_buf) if(data) free(data); - goto finish; + goto finish;*/ } if(!last) @@ -2518,6 +2522,361 @@ finish: return 0; } +int open_ui(pixel *vid_buf, char *save_id, char *save_date) +{ + int b=1,bq,mx,my,ca=0,thumb_w,thumb_h,active=0,active_2=0,cc=0,ccy=0,cix=0,hasdrawninfo=0,hasdrawnthumb=0,authoritah=0,queue_open=0,data_size=0,retval=0; + char *uri, *uri_2; + void *data, *info_data; + save_info *info = malloc(sizeof(save_info)); + void *http = NULL, *http_2 = NULL; + int lasttime = TIMEOUT; + int status, status_2, info_ready = 0, data_ready = 0; + time_t http_last_use = HTTP_TIMEOUT, http_last_use_2 = HTTP_TIMEOUT; + pixel *save_pic;// = malloc((XRES/2)*(YRES/2)); + + pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); + + fillrect(vid_buf, 50, 50, XRES+BARSIZE-100, YRES+MENUSIZE-100, 0, 0, 0, 255); + drawrect(vid_buf, 50, 50, XRES+BARSIZE-100, YRES+MENUSIZE-100, 255, 255, 255, 255); + drawrect(vid_buf, 50, 50, (XRES/2)+1, (YRES/2)+1, 255, 255, 255, 155); + drawrect(vid_buf, 50+(XRES/2)+1, 50, XRES+BARSIZE-100-((XRES/2)+1), YRES+MENUSIZE-100, 155, 155, 155, 255); + drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128); + + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + + while(!sdl_poll()) + { + b = SDL_GetMouseState(&mx, &my); + if(!b) + break; + } + + //Begin Async loading of data + if(save_date) { + // We're loading an historical save + uri = malloc(strlen(save_id)*3+strlen(save_date)*3+strlen(SERVER)+71); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, save_id); + strappend(uri, "&Date="); + strcaturl(uri, save_date); + + uri_2 = malloc(strlen(save_id)*3+strlen(save_date)*3+strlen(SERVER)+71); + strcpy(uri_2, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri_2, save_id); + strappend(uri_2, "&Date="); + strcaturl(uri_2, save_date); + } else { + //We're loading a normal save + uri = malloc(strlen(save_id)*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, save_id); + + uri_2 = malloc(strlen(save_id)*3+strlen(SERVER)+64); + strcpy(uri_2, "http://" SERVER "/Info.api?ID="); + strcaturl(uri_2, save_id); + } + http = http_async_req_start(http, uri, NULL, 0, 1); + http_2 = http_async_req_start(http_2, uri_2, NULL, 0, 1); + if(svf_login) + { + http_auth_headers(http, svf_user, svf_pass); + http_auth_headers(http_2, svf_user, svf_pass); + } + http_last_use = time(NULL); + http_last_use_2 = time(NULL); + free(uri); + free(uri_2); + active = 1; + active_2 = 1; + while(!sdl_poll()) + { + bq = b; + b = SDL_GetMouseState(&mx, &my); + mx /= sdl_scale; + my /= sdl_scale; + + if(active && http_async_req_status(http)) + { + int imgh, imgw, nimgh, nimgw; + http_last_use = time(NULL); + data = http_async_req_stop(http, &status, &data_size); + if(status == 200) + { + pixel *full_save = prerender_save(data, data_size, &imgw, &imgh); + save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2); + data_ready = 1; + free(full_save); + } + active = 0; + free(http); + http = NULL; + } + if(active_2 && http_async_req_status(http_2)) + { + http_last_use_2 = time(NULL); + info_data = http_async_req_stop(http_2, &status_2, NULL); + if(status_2 == 200) + { + info_ready = info_parse(info_data, info); + if(info_ready==-1){ + error_ui(vid_buf, 0, "Not found"); + break; + } + } + free(info_data); + active_2 = 0; + free(http_2); + http_2 = NULL; + } + + if(data_ready && !hasdrawnthumb){ + draw_image(vid_buf, save_pic, 51, 51, thumb_w, thumb_h, 255); + hasdrawnthumb = 1; + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + } + if(info_ready && !hasdrawninfo){ + //drawtext(vid_buf, 2, 2, info->name, 255, 255, 255, 255); + cix = drawtext(vid_buf, 60, (YRES/2)+60, info->name, 255, 255, 255, 255); + cix = drawtext(vid_buf, 60, (YRES/2)+72, "Author:", 255, 255, 255, 155); + cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->author, 255, 255, 255, 255); + cix = drawtext(vid_buf, cix+4, (YRES/2)+72, "Date:", 255, 255, 255, 155); + cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->date, 255, 255, 255, 255); + drawtextwrap(vid_buf, 62, (YRES/2)+86, (XRES/2)-24, info->description, 255, 255, 255, 200); + + ccy = 0; + for(cc=0;cccomment_count;cc++){ + drawtext(vid_buf, 60+(XRES/2)+1, ccy+60, info->commentauthors[cc], 255, 255, 255, 255); + ccy += 12; + ccy += drawtextwrap(vid_buf, 60+(XRES/2)+1, ccy+60, XRES+BARSIZE-100-((XRES/2)+1)-20, info->comments[cc], 255, 255, 255, 185); + ccy += 10; + draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE); + } + hasdrawninfo = 1; + authoritah = svf_login && (!strcmp(info->author, svf_user) || svf_admin || svf_mod); + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + } + + if(queue_open){ + if(info_ready && data_ready){ + // Do Open! + status = parse_save(data, data_size, 1, 0, 0); + if(!status){ + //if(svf_last) + //free(svf_last); + svf_last = data; + svf_lsize = data_size; + + svf_open = 1; + svf_own = svf_login && !strcmp(info->author, svf_user); + svf_publish = info->publish && svf_login && !strcmp(info->author, svf_user); + + strcpy(svf_id, save_id); + strcpy(svf_name, info->name); + if(info->tags) + { + strncpy(svf_tags, info->tags, 255); + svf_tags[255] = 0; + } else { + svf_tags[0] = 0; + } + svf_myvote = info->myvote; + retval = 1; + break; + } else { + queue_open = 0; + + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + error_ui(vid_buf, 0, "An Error Occurred"); + } + } else { + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 190); + drawtext(vid_buf, XRES+BARSIZE/2, XRES+MENUSIZE, "Loading...", 0, 0, 0, 200); + } + } + + //Open Button + if(sdl_key==SDLK_RETURN){ + queue_open = 1; + } + drawrect(vid_buf, 70, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); + drawtext(vid_buf, 93, YRES+MENUSIZE-63, "Open", 255, 255, 255, 255); + drawtext(vid_buf, 78, YRES+MENUSIZE-64, "\x81", 255, 255, 255, 255); + if(mx > 70 && mx < 70+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50){ + fillrect(vid_buf, 70, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq){ + queue_open = 1; + } + } + + //Fav Button + if(svf_login){ + drawrect(vid_buf, 140, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); + drawtext(vid_buf, 162, YRES+MENUSIZE-63, "Fav.", 255, 255, 255, 255); + drawtext(vid_buf, 147, YRES+MENUSIZE-64, "\xCC", 255, 255, 255, 255); + if(mx > 140 && mx < 140+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50){ + fillrect(vid_buf, 140, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq){ + //Button Clicked + } + } + } + + //Report Button + if(svf_login){ + drawrect(vid_buf, 210, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); + drawtext(vid_buf, 228, YRES+MENUSIZE-63, "Report", 255, 255, 255, 255); + drawtext(vid_buf, 218, YRES+MENUSIZE-63, "!", 255, 255, 255, 255); + if(mx > 210 && mx < 210+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50){ + fillrect(vid_buf, 210, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq){ + //Button Clicked + } + } + } + + //Delete Button + if(authoritah){ + drawrect(vid_buf, 280, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); + drawtext(vid_buf, 298, YRES+MENUSIZE-63, "Delete", 255, 255, 255, 255); + drawtext(vid_buf, 286, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, 255); + if(mx > 280 && mx < 280+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50){ + fillrect(vid_buf, 280, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq){ + //Button Clicked + } + } + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + + if(sdl_key==SDLK_ESCAPE) + break; + + if(lasttimetitle = mystrdup(info_data+6); + j++; + } + else if(!strncmp(info_data, "NAME ", 5)) + { + info->name = mystrdup(info_data+5); + j++; + } + else if(!strncmp(info_data, "AUTHOR ", 7)) + { + info->author = mystrdup(info_data+7); + j++; + } + else if(!strncmp(info_data, "DATE ", 5)) + { + info->date = mystrdup(info_data+5); + j++; + } + else if(!strncmp(info_data, "DESCRIPTION ", 12)) + { + info->description = mystrdup(info_data+12); + j++; + } + else if(!strncmp(info_data, "VOTEUP ", 7)) + { + info->voteup = atoi(info_data+7); + j++; + } + else if(!strncmp(info_data, "VOTEDOWN ", 9)) + { + info->votedown = atoi(info_data+9); + j++; + } + else if(!strncmp(info_data, "VOTE ", 5)) + { + info->vote = atoi(info_data+5); + j++; + } + else if(!strncmp(info_data, "MYVOTE ", 7)) + { + info->myvote = atoi(info_data+7); + j++; + } + else if(!strncmp(info_data, "MYFAV ", 6)) + { + info->myfav = atoi(info_data+6); + j++; + } + else if(!strncmp(info_data, "PUBLISH ", 8)) + { + info->publish = atoi(info_data+8); + j++; + } + else if(!strncmp(info_data, "TAGS ", 5)) + { + info->tags = mystrdup(info_data+5); + j++; + } + else if(!strncmp(info_data, "COMMENT ", 8)) + { + if(info->comment_count>=6){ + info_data = p; + continue; + } else { + q = strchr(info_data+8, ' '); + *(q++) = 0; + info->commentauthors[info->comment_count] = mystrdup(info_data+8); + info->comments[info->comment_count] = mystrdup(q); + info->comment_count++; + } + j++; + } + info_data = p; + } + if(j>=8){ + return 1; + } else { + return -1; + } +} + int search_results(char *str, int votes) { int i,j; @@ -2947,6 +3306,74 @@ void execute_delete(pixel *vid_buf, char *id) free(result); } +void execute_report(pixel *vid_buf, char *id) +{ + int status; + char *result; + + char *names[] = {"ID", NULL}; + char *parts[1]; + + parts[0] = id; + + result = http_multipart_post( + "http://" SERVER "/Report.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result) + free(result); +} + +void execute_fav(pixel *vid_buf, char *id) +{ + int status; + char *result; + + char *names[] = {"ID", NULL}; + char *parts[1]; + + parts[0] = id; + + result = http_multipart_post( + "http://" SERVER "/Favourite.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); + return; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return; + } + + if(result) + free(result); +} + int execute_vote(pixel *vid_buf, char *id, char *action) { int status; -- cgit v0.9.2-21-gd62e From e711060cb909ae308efc68ea5c2f21e470f39ceb Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 21 Oct 2010 11:48:21 +0100 Subject: Neutrons fixed somewhat diff --git a/includes/interface.h b/includes/interface.h index 30908a9..d3d9210 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -190,9 +190,9 @@ char *download_ui(pixel *vid_buf, char *uri, int *len); int search_ui(pixel *vid_buf); -int open_ui(pixel *vid_buf, char *save_id); +int open_ui(pixel *vid_buf, char *save_id, char *save_date); -int info_parse(void *info_data, save_info *info); +int info_parse(char *info_data, save_info *info); int search_results(char *str, int votes); diff --git a/includes/powder.h b/includes/powder.h index e7ef771..af020ad 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -115,7 +115,8 @@ #define PT_PCLN 74 #define PT_HSWC 75 #define PT_IRON 76 -#define PT_NUM 77 +#define PT_MORT 77 +#define PT_NUM 78 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -201,83 +202,84 @@ typedef struct part_state part_state; static const part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description - {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, - {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, - {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, - {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, - {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, - {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, - {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, - {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, - {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, - {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, - {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, - {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, - {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, - {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, - {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, - {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, - {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, - {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. - {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, - {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, - {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, - {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, - {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, - {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, - {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, - {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, - {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, - {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, - {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, - {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, - {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, - {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, - {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, - {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, - {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures"}, - {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, - {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, - {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, - {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, - {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, - {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, - {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, - {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, - {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, - {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, - {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, + {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, + {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, + {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, + {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, + {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, + {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, + {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, + {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, + {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, + {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, + {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, + {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, + {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, + {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures"}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, + {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, + {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, + {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, + {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, + {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, + {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, + {"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Steam Train."}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description }; diff --git a/src/powder.c b/src/powder.c index dcd56df..d85d498 100644 --- a/src/powder.c +++ b/src/powder.c @@ -93,13 +93,18 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) return 0; - if (r && ((r&0xFF) >= PT_NUM || - (ptypes[pt].weight <= ptypes[(r&0xFF)].weight)) - ) - return 0; - if(pt == PT_PHOT) return 2; + + if(pt == PT_NEUT) + return 1; + if((r&0xFF) == PT_NEUT) + return 0; + + if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight <= ptypes[(r&0xFF)].weight))) + return 0; + + return 1; } @@ -490,6 +495,10 @@ inline int create_part(int p, int x, int y, int t) parts[i].vx = r*cosf(a); parts[i].vy = r*sinf(a); } + if(t==PT_MORT) + { + parts[i].vx = 2; + } if(t==PT_PHOT) { float a = (rand()%8) * 0.78540f; @@ -1763,6 +1772,9 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_MORT){ + create_part(-1, x, y-1, PT_SMKE); + } else if(t==PT_LCRY) { for(nx=-1; nx<2; nx++) -- cgit v0.9.2-21-gd62e From 24d5ca7d4e28d7996d0866f5ebc081e74d28de5b Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Thu, 21 Oct 2010 17:33:14 +0200 Subject: added simple description for eval_move diff --git a/src/powder.c b/src/powder.c index d85d498..2d2e099 100644 --- a/src/powder.c +++ b/src/powder.c @@ -49,7 +49,12 @@ static void photoelectric_effect(int nx, int ny) pn_junction_sprk(nx, ny, PT_PSCN); } } - +/* + RETURN-value explenation +1 = Swap +0 = No move/Bounce +2 = Both particles occupy the same space. + */ static int eval_move(int pt, int nx, int ny, unsigned *rr) { unsigned r; -- cgit v0.9.2-21-gd62e From fdd3d240316086fdfd37840a828dc2111f5c70e2 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Thu, 21 Oct 2010 18:14:09 +0200 Subject: some 'fixes', better solution: change to what it was before the neutron fix. diff --git a/Makefile b/Makefile index 74c1a1c..9e1f41e 100755 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ powder-64-sse3-opengl: $(SOURCES) $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -lGL -lGLU -DOpenGL strip $@ powder-64-sse3: $(SOURCES) - $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 + $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -j3 strip $@ mv $@ build powder-64-sse2: $(SOURCES) diff --git a/includes/interface.h b/includes/interface.h index d3d9210..a284475 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -75,21 +75,21 @@ typedef struct ui_edit ui_edit; struct save_info { - char *title; - char *name; - char *author; - char *date; - char *description; - int publish; - int voteup; - int votedown; - int vote; - int myvote; - int myfav; - char *tags; - int comment_count; - char *comments[6]; - char *commentauthors[6]; + char *title; + char *name; + char *author; + char *date; + char *description; + int publish; + int voteup; + int votedown; + int vote; + int myvote; + int myfav; + char *tags; + int comment_count; + char *comments[6]; + char *commentauthors[6]; }; typedef struct save_info save_info; diff --git a/includes/powder.h b/includes/powder.h index af020ad..99d12ee 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -141,54 +141,54 @@ static const unsigned short PROP_DEADLY = 0x12; //18 Is deadly for stickman. struct particle { - int type; - int life, ctype; - float x, y, vx, vy; - float temp; - float pavg[2]; - int flags; - int tmp; + int type; + int life, ctype; + float x, y, vx, vy; + float temp; + float pavg[2]; + int flags; + int tmp; }; typedef struct particle particle; struct part_type { - const char *name; - pixel pcolors; - float advection; - float airdrag; - float airloss; - float loss; - float collision; - float gravity; - float diffusion; - float hotair; - int falldown; - int flammable; - int explosive; - int meltable; - int hardness; - int menu; - int weight; - int menusection; - float heat; - unsigned char hconduct; - const char *descs; - const unsigned short properties; + const char *name; + pixel pcolors; + float advection; + float airdrag; + float airloss; + float loss; + float collision; + float gravity; + float diffusion; + float hotair; + int falldown; + int flammable; + int explosive; + int meltable; + int hardness; + int menu; + int weight; + int menusection; + float heat; + unsigned char hconduct; + const char *descs; + const unsigned short properties; }; typedef struct part_type part_type; struct part_state { - char state; - int solid; - float stemp; - int liquid; - float ltemp; - int gas; - float gtemp; - int burn; - float btemp; + char state; + int solid; + float stemp; + int liquid; + float ltemp; + int gas; + float gtemp; + int burn; + float btemp; }; typedef struct part_state part_state; //Should probably be const. @@ -196,173 +196,173 @@ typedef struct part_state part_state; * 1 = Gas || * 2 = Light || Liquids 0-49 * 98 = Heavy || Powder 50-99 - * 100 = Solid || + * 100 = Solid || * -1 is Neutrons and Photons */ static const part_type ptypes[PT_NUM] = { - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description - {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, - {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, - {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, - {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, - {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, - {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, - {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, - {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, - {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, - {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, - {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, - {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, - {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, - {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, - {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, - {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, - {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, - {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. - {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, - {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, - {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, - {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, - {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, - {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, - {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, - {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, - {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, - {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, - {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, - {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, - {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, - {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, - {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, - {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, - {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures"}, - {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, - {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, - {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, - {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, - {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, - {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, - {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, - {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, - {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, - {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, - {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, - {"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Steam Train."}, - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, + {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, + {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, + {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, + {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, + {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, + {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, + {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, + {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, + {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, + {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, + {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, + {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, + {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, + {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures"}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, + {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, + {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, + {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, + {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, + {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, + {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, + {"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Steam Train."}, + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description }; static part_state pstates[PT_NUM] = { - // Name Solid Frzp Liquid Mpnt Gas Bpoint - /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, - /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f}, - /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f}, - /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LAVA */ {ST_LIQUID, PT_STNE, 973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, - /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, - /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, - /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, - /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, - /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f}, - /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f}, - /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, - /* LRBD */ {ST_LIQUID, PT_RBDM, 311.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, - /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, - /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, - /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f}, - /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, - /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, - /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BCOL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* IRON */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + // Name Solid Frzp Liquid Mpnt Gas Bpoint + /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f}, + /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f}, + /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LAVA */ {ST_LIQUID, PT_STNE, 973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, + /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, + /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, + /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, + /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f}, + /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f}, + /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, + /* LRBD */ {ST_LIQUID, PT_RBDM, 311.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, + /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, + /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, + /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f}, + /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, + /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, + /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BCOL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* IRON */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; extern int isplayer; diff --git a/src/graphics.c b/src/graphics.c index 9f45526..b63e384 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -849,15 +849,15 @@ int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, i #ifdef OpenGL #else int sx = x; - int rh = 12; - int rw = 0; - int cw = x; + int rh = 12; + int rw = 0; + int cw = x; for(; *s; s++) { if(*s == '\n') { x = sx; - rw = 0; + rw = 0; y += FONT_H+2; } else if(*s == '\b') @@ -887,15 +887,15 @@ int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, i s++; } else - { - if(x-cw>=w){ - x = sx; - rw = 0; - y+=FONT_H+2; - rh+=FONT_H+2; - } + { + if(x-cw>=w) { + x = sx; + rw = 0; + y+=FONT_H+2; + rh+=FONT_H+2; + } x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); - } + } } #endif return rh; @@ -1476,20 +1476,20 @@ void draw_parts(pixel *vid) cg = 0; cb = 0; cr = 0; - for(x=0; x<12; x++) { - cr += (parts[i].ctype >> (x+18)) & 1; - cb += (parts[i].ctype >> x) & 1; - } - for(x=0; x<14; x++) - cg += (parts[i].ctype >> (x+9)) & 1; - x = 624/(cr+cg+cb+1); - cr *= x; - cg *= x; - cb *= x; + for(x=0; x<12; x++) { + cr += (parts[i].ctype >> (x+18)) & 1; + cb += (parts[i].ctype >> x) & 1; + } + for(x=0; x<14; x++) + cg += (parts[i].ctype >> (x+9)) & 1; + x = 624/(cr+cg+cb+1); + cr *= x; + cg *= x; + cb *= x; vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(cr>255?255:cr,cg>255?255:cg,cb>255?255:cb); - cr >>= 4; - cg >>= 4; - cb >>= 4; + cr >>= 4; + cg >>= 4; + cb >>= 4; x = nx/CELL; y = ny/CELL; cg += fire_g[y][x]; @@ -1504,22 +1504,22 @@ void draw_parts(pixel *vid) } else { - cg = 0; - cb = 0; - cr = 0; - for(x=0; x<12; x++) { - cr += (parts[i].ctype >> (x+18)) & 1; - cb += (parts[i].ctype >> x) & 1; - } - for(x=0; x<14; x++) - cg += (parts[i].ctype >> (x+9)) & 1; - x = 624/(cr+cg+cb+1); - cr *= x; - cg *= x; - cb *= x; - cr = cr>255?255:cr; - cg = cg>255?255:cg; - cb = cb>255?255:cb; + cg = 0; + cb = 0; + cr = 0; + for(x=0; x<12; x++) { + cr += (parts[i].ctype >> (x+18)) & 1; + cb += (parts[i].ctype >> x) & 1; + } + for(x=0; x<14; x++) + cg += (parts[i].ctype >> (x+9)) & 1; + x = 624/(cr+cg+cb+1); + cr *= x; + cg *= x; + cb *= x; + cr = cr>255?255:cr; + cg = cg>255?255:cg; + cb = cb>255?255:cb; blendpixel(vid, nx, ny, cr, cg, cb, 192); blendpixel(vid, nx+1, ny, cr, cg, cb, 96); blendpixel(vid, nx-1, ny, cr, cg, cb, 96); @@ -1952,30 +1952,30 @@ void draw_parts(pixel *vid) } else if(t==PT_FIRE && parts[i].life) { - float ttemp = (float)((int)(parts[i].life/2)); - int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); - uint8 R = flm_data[caddress]; - uint8 G = flm_data[caddress+1]; - uint8 B = flm_data[caddress+2]; - if(cmode == 3||cmode==4 || cmode==6) - { - cr = R/8; - cg = G/8; - cb = B/8; - x = nx/CELL; - y = ny/CELL; - cg += fire_g[y][x]; - if(cg > 255) cg = 255; - fire_g[y][x] = cg; - cb += fire_b[y][x]; - if(cb > 255) cb = 255; - fire_b[y][x] = cb; - cr += fire_r[y][x]; - if(cr > 255) cr = 255; - fire_r[y][x] = cr; - } - else - { + float ttemp = (float)((int)(parts[i].life/2)); + int caddress = restrict_flt(restrict_flt(ttemp, 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3); + uint8 R = flm_data[caddress]; + uint8 G = flm_data[caddress+1]; + uint8 B = flm_data[caddress+2]; + if(cmode == 3||cmode==4 || cmode==6) + { + cr = R/8; + cg = G/8; + cb = B/8; + x = nx/CELL; + y = ny/CELL; + cg += fire_g[y][x]; + if(cg > 255) cg = 255; + fire_g[y][x] = cg; + cb += fire_b[y][x]; + if(cb > 255) cb = 255; + fire_b[y][x] = cb; + cr += fire_r[y][x]; + if(cr > 255) cr = 255; + fire_r[y][x] = cr; + } + else + { cr = parts[i].life * 8; cg = parts[i].life * 2; cb = parts[i].life; @@ -1991,9 +1991,9 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); - } - // Older Code - /*if(cmode == 3||cmode==4 || cmode==6) + } + // Older Code + /*if(cmode == 3||cmode==4 || cmode==6) { cr = parts[i].life / 4; cg = parts[i].life / 16; @@ -2137,28 +2137,28 @@ void draw_parts(pixel *vid) } if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_HFLM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH&&t!=PT_SMKE&&t!=PT_WTRV&&!(t==PT_FIRW&&parts[i].tmp==3)) { - if(t==PT_PHOT){ - cg = 0; - cb = 0; - cr = 0; - for(x=0; x<12; x++) { - cr += (parts[i].ctype >> (x+18)) & 1; - cb += (parts[i].ctype >> x) & 1; - } - for(x=0; x<14; x++) - cg += (parts[i].ctype >> (x+9)) & 1; - x = 624/(cr+cg+cb+1); - cr *= x; - cg *= x; - cb *= x; - cr = cr>255?255:cr; - cg = cg>255?255:cg; - cb = cb>255?255:cb; - } else { - cr = PIXR(ptypes[t].pcolors); - cg = PIXG(ptypes[t].pcolors); - cb = PIXB(ptypes[t].pcolors); - } + if(t==PT_PHOT) { + cg = 0; + cb = 0; + cr = 0; + for(x=0; x<12; x++) { + cr += (parts[i].ctype >> (x+18)) & 1; + cb += (parts[i].ctype >> x) & 1; + } + for(x=0; x<14; x++) + cg += (parts[i].ctype >> (x+9)) & 1; + x = 624/(cr+cg+cb+1); + cr *= x; + cg *= x; + cb *= x; + cr = cr>255?255:cr; + cg = cg>255?255:cg; + cb = cb>255?255:cb; + } else { + cr = PIXR(ptypes[t].pcolors); + cg = PIXG(ptypes[t].pcolors); + cb = PIXB(ptypes[t].pcolors); + } //if(vid[(ny-1)*YRES+(nx-1)]!=0){ // blendpixel(vid, nx, ny-1, R, G, B, 46); diff --git a/src/interface.c b/src/interface.c index eab027a..3ed4431 100644 --- a/src/interface.c +++ b/src/interface.c @@ -1871,8 +1871,8 @@ int search_ui(pixel *vid_buf) drawtext(vid_buf, XRES-61+16, 11, "\x93", 255, 255, 255, 255); drawtext(vid_buf, XRES-46+16, 13, "My Own", 255, 255, 255, 255); } - - if(search_fav) + + if(search_fav) { fillrect(vid_buf, XRES-134, 7, 18, 18, 255, 255, 255, 255); drawtext(vid_buf, XRES-130, 11, "\xCC", 192, 160, 64, 255); @@ -2155,7 +2155,7 @@ int search_ui(pixel *vid_buf) search_date = !search_date; lasttime = TIMEOUT; } - if(b && !bq && mx>=XRES-134 && mx<=XRES-134+16 && my>=8 && my<=24) + if(b && !bq && mx>=XRES-134 && mx<=XRES-134+16 && my>=8 && my<=24) { search_fav = !search_fav; lasttime = TIMEOUT; @@ -2197,10 +2197,10 @@ int search_ui(pixel *vid_buf) if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) { - if(open_ui(vid_buf, search_ids[mp], search_dates[mp]?search_dates[mp]:NULL)==1){ - goto finish; - } - /* + if(open_ui(vid_buf, search_ids[mp], search_dates[mp]?search_dates[mp]:NULL)==1) { + goto finish; + } + /* fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); info_box(vid_buf, "Loading..."); @@ -2349,7 +2349,7 @@ int search_ui(pixel *vid_buf) last_own = search_own; last_date = search_date; last_page = search_page; - last_fav = search_fav; + last_fav = search_fav; active = 1; // TODO: Create a better fix for this bug uri = malloc(strlen(last)*3+180+strlen(SERVER)+strlen(svf_user)+20); //Increase "padding" from 80 to 180 to fix the search memory corruption bug @@ -2381,10 +2381,10 @@ int search_ui(pixel *vid_buf) strcaturl(uri, " user:"); strcaturl(uri, svf_user); } - if(search_fav) - { - strcaturl(uri, " cat:favs"); - } + if(search_fav) + { + strcaturl(uri, " cat:favs"); + } if(search_date) strcaturl(uri, " sort:date"); @@ -2524,71 +2524,71 @@ finish: int open_ui(pixel *vid_buf, char *save_id, char *save_date) { - int b=1,bq,mx,my,ca=0,thumb_w,thumb_h,active=0,active_2=0,cc=0,ccy=0,cix=0,hasdrawninfo=0,hasdrawnthumb=0,authoritah=0,queue_open=0,data_size=0,retval=0; - char *uri, *uri_2; - void *data, *info_data; - save_info *info = malloc(sizeof(save_info)); - void *http = NULL, *http_2 = NULL; + int b=1,bq,mx,my,ca=0,thumb_w,thumb_h,active=0,active_2=0,cc=0,ccy=0,cix=0,hasdrawninfo=0,hasdrawnthumb=0,authoritah=0,queue_open=0,data_size=0,retval=0; + char *uri, *uri_2; + void *data, *info_data; + save_info *info = malloc(sizeof(save_info)); + void *http = NULL, *http_2 = NULL; int lasttime = TIMEOUT; - int status, status_2, info_ready = 0, data_ready = 0; - time_t http_last_use = HTTP_TIMEOUT, http_last_use_2 = HTTP_TIMEOUT; - pixel *save_pic;// = malloc((XRES/2)*(YRES/2)); + int status, status_2, info_ready = 0, data_ready = 0; + time_t http_last_use = HTTP_TIMEOUT, http_last_use_2 = HTTP_TIMEOUT; + pixel *save_pic;// = malloc((XRES/2)*(YRES/2)); - pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); - fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); + pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); - fillrect(vid_buf, 50, 50, XRES+BARSIZE-100, YRES+MENUSIZE-100, 0, 0, 0, 255); - drawrect(vid_buf, 50, 50, XRES+BARSIZE-100, YRES+MENUSIZE-100, 255, 255, 255, 255); - drawrect(vid_buf, 50, 50, (XRES/2)+1, (YRES/2)+1, 255, 255, 255, 155); - drawrect(vid_buf, 50+(XRES/2)+1, 50, XRES+BARSIZE-100-((XRES/2)+1), YRES+MENUSIZE-100, 155, 155, 155, 255); - drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128); + fillrect(vid_buf, 50, 50, XRES+BARSIZE-100, YRES+MENUSIZE-100, 0, 0, 0, 255); + drawrect(vid_buf, 50, 50, XRES+BARSIZE-100, YRES+MENUSIZE-100, 255, 255, 255, 255); + drawrect(vid_buf, 50, 50, (XRES/2)+1, (YRES/2)+1, 255, 255, 255, 155); + drawrect(vid_buf, 50+(XRES/2)+1, 50, XRES+BARSIZE-100-((XRES/2)+1), YRES+MENUSIZE-100, 155, 155, 155, 255); + drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128); memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - - while(!sdl_poll()) + + while(!sdl_poll()) { b = SDL_GetMouseState(&mx, &my); if(!b) break; } - //Begin Async loading of data - if(save_date) { - // We're loading an historical save - uri = malloc(strlen(save_id)*3+strlen(save_date)*3+strlen(SERVER)+71); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, save_id); - strappend(uri, "&Date="); - strcaturl(uri, save_date); - - uri_2 = malloc(strlen(save_id)*3+strlen(save_date)*3+strlen(SERVER)+71); - strcpy(uri_2, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri_2, save_id); - strappend(uri_2, "&Date="); - strcaturl(uri_2, save_date); - } else { - //We're loading a normal save + //Begin Async loading of data + if(save_date) { + // We're loading an historical save + uri = malloc(strlen(save_id)*3+strlen(save_date)*3+strlen(SERVER)+71); + strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri, save_id); + strappend(uri, "&Date="); + strcaturl(uri, save_date); + + uri_2 = malloc(strlen(save_id)*3+strlen(save_date)*3+strlen(SERVER)+71); + strcpy(uri_2, "http://" SERVER "/Get.api?Op=save&ID="); + strcaturl(uri_2, save_id); + strappend(uri_2, "&Date="); + strcaturl(uri_2, save_date); + } else { + //We're loading a normal save uri = malloc(strlen(save_id)*3+strlen(SERVER)+64); strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); strcaturl(uri, save_id); - uri_2 = malloc(strlen(save_id)*3+strlen(SERVER)+64); + uri_2 = malloc(strlen(save_id)*3+strlen(SERVER)+64); strcpy(uri_2, "http://" SERVER "/Info.api?ID="); strcaturl(uri_2, save_id); } - http = http_async_req_start(http, uri, NULL, 0, 1); - http_2 = http_async_req_start(http_2, uri_2, NULL, 0, 1); - if(svf_login) + http = http_async_req_start(http, uri, NULL, 0, 1); + http_2 = http_async_req_start(http_2, uri_2, NULL, 0, 1); + if(svf_login) { - http_auth_headers(http, svf_user, svf_pass); - http_auth_headers(http_2, svf_user, svf_pass); + http_auth_headers(http, svf_user, svf_pass); + http_auth_headers(http_2, svf_user, svf_pass); } http_last_use = time(NULL); - http_last_use_2 = time(NULL); + http_last_use_2 = time(NULL); free(uri); - free(uri_2); - active = 1; - active_2 = 1; + free(uri_2); + active = 1; + active_2 = 1; while(!sdl_poll()) { bq = b; @@ -2596,188 +2596,188 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) mx /= sdl_scale; my /= sdl_scale; - if(active && http_async_req_status(http)) + if(active && http_async_req_status(http)) { - int imgh, imgw, nimgh, nimgw; + int imgh, imgw, nimgh, nimgw; http_last_use = time(NULL); data = http_async_req_stop(http, &status, &data_size); if(status == 200) { - pixel *full_save = prerender_save(data, data_size, &imgw, &imgh); - save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2); + pixel *full_save = prerender_save(data, data_size, &imgw, &imgh); + save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2); data_ready = 1; - free(full_save); + free(full_save); } - active = 0; - free(http); - http = NULL; + active = 0; + free(http); + http = NULL; } - if(active_2 && http_async_req_status(http_2)) + if(active_2 && http_async_req_status(http_2)) { http_last_use_2 = time(NULL); info_data = http_async_req_stop(http_2, &status_2, NULL); if(status_2 == 200) { info_ready = info_parse(info_data, info); - if(info_ready==-1){ - error_ui(vid_buf, 0, "Not found"); - break; - } + if(info_ready==-1) { + error_ui(vid_buf, 0, "Not found"); + break; + } } free(info_data); active_2 = 0; - free(http_2); - http_2 = NULL; - } - - if(data_ready && !hasdrawnthumb){ - draw_image(vid_buf, save_pic, 51, 51, thumb_w, thumb_h, 255); - hasdrawnthumb = 1; - memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - } - if(info_ready && !hasdrawninfo){ - //drawtext(vid_buf, 2, 2, info->name, 255, 255, 255, 255); - cix = drawtext(vid_buf, 60, (YRES/2)+60, info->name, 255, 255, 255, 255); - cix = drawtext(vid_buf, 60, (YRES/2)+72, "Author:", 255, 255, 255, 155); - cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->author, 255, 255, 255, 255); - cix = drawtext(vid_buf, cix+4, (YRES/2)+72, "Date:", 255, 255, 255, 155); - cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->date, 255, 255, 255, 255); - drawtextwrap(vid_buf, 62, (YRES/2)+86, (XRES/2)-24, info->description, 255, 255, 255, 200); - - ccy = 0; - for(cc=0;cccomment_count;cc++){ - drawtext(vid_buf, 60+(XRES/2)+1, ccy+60, info->commentauthors[cc], 255, 255, 255, 255); - ccy += 12; - ccy += drawtextwrap(vid_buf, 60+(XRES/2)+1, ccy+60, XRES+BARSIZE-100-((XRES/2)+1)-20, info->comments[cc], 255, 255, 255, 185); - ccy += 10; - draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE); - } - hasdrawninfo = 1; - authoritah = svf_login && (!strcmp(info->author, svf_user) || svf_admin || svf_mod); - memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); - } - - if(queue_open){ - if(info_ready && data_ready){ - // Do Open! - status = parse_save(data, data_size, 1, 0, 0); - if(!status){ - //if(svf_last) - //free(svf_last); - svf_last = data; - svf_lsize = data_size; - - svf_open = 1; - svf_own = svf_login && !strcmp(info->author, svf_user); - svf_publish = info->publish && svf_login && !strcmp(info->author, svf_user); - - strcpy(svf_id, save_id); - strcpy(svf_name, info->name); - if(info->tags) - { - strncpy(svf_tags, info->tags, 255); - svf_tags[255] = 0; - } else { - svf_tags[0] = 0; - } - svf_myvote = info->myvote; - retval = 1; - break; - } else { - queue_open = 0; - - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - error_ui(vid_buf, 0, "An Error Occurred"); - } - } else { - fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 190); - drawtext(vid_buf, XRES+BARSIZE/2, XRES+MENUSIZE, "Loading...", 0, 0, 0, 200); - } - } - - //Open Button - if(sdl_key==SDLK_RETURN){ + free(http_2); + http_2 = NULL; + } + + if(data_ready && !hasdrawnthumb) { + draw_image(vid_buf, save_pic, 51, 51, thumb_w, thumb_h, 255); + hasdrawnthumb = 1; + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + } + if(info_ready && !hasdrawninfo) { + //drawtext(vid_buf, 2, 2, info->name, 255, 255, 255, 255); + cix = drawtext(vid_buf, 60, (YRES/2)+60, info->name, 255, 255, 255, 255); + cix = drawtext(vid_buf, 60, (YRES/2)+72, "Author:", 255, 255, 255, 155); + cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->author, 255, 255, 255, 255); + cix = drawtext(vid_buf, cix+4, (YRES/2)+72, "Date:", 255, 255, 255, 155); + cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->date, 255, 255, 255, 255); + drawtextwrap(vid_buf, 62, (YRES/2)+86, (XRES/2)-24, info->description, 255, 255, 255, 200); + + ccy = 0; + for(cc=0; cccomment_count; cc++) { + drawtext(vid_buf, 60+(XRES/2)+1, ccy+60, info->commentauthors[cc], 255, 255, 255, 255); + ccy += 12; + ccy += drawtextwrap(vid_buf, 60+(XRES/2)+1, ccy+60, XRES+BARSIZE-100-((XRES/2)+1)-20, info->comments[cc], 255, 255, 255, 185); + ccy += 10; + draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE); + } + hasdrawninfo = 1; + authoritah = svf_login && (!strcmp(info->author, svf_user) || svf_admin || svf_mod); + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + } + + if(queue_open) { + if(info_ready && data_ready) { + // Do Open! + status = parse_save(data, data_size, 1, 0, 0); + if(!status) { + //if(svf_last) + //free(svf_last); + svf_last = data; + svf_lsize = data_size; + + svf_open = 1; + svf_own = svf_login && !strcmp(info->author, svf_user); + svf_publish = info->publish && svf_login && !strcmp(info->author, svf_user); + + strcpy(svf_id, save_id); + strcpy(svf_name, info->name); + if(info->tags) + { + strncpy(svf_tags, info->tags, 255); + svf_tags[255] = 0; + } else { + svf_tags[0] = 0; + } + svf_myvote = info->myvote; + retval = 1; + break; + } else { + queue_open = 0; + + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + error_ui(vid_buf, 0, "An Error Occurred"); + } + } else { + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 190); + drawtext(vid_buf, XRES+BARSIZE/2, XRES+MENUSIZE, "Loading...", 0, 0, 0, 200); + } + } + + //Open Button + if(sdl_key==SDLK_RETURN) { queue_open = 1; - } - drawrect(vid_buf, 70, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); - drawtext(vid_buf, 93, YRES+MENUSIZE-63, "Open", 255, 255, 255, 255); - drawtext(vid_buf, 78, YRES+MENUSIZE-64, "\x81", 255, 255, 255, 255); - if(mx > 70 && mx < 70+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50){ - fillrect(vid_buf, 70, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); - if(b && !bq){ - queue_open = 1; - } - } - - //Fav Button - if(svf_login){ - drawrect(vid_buf, 140, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); - drawtext(vid_buf, 162, YRES+MENUSIZE-63, "Fav.", 255, 255, 255, 255); - drawtext(vid_buf, 147, YRES+MENUSIZE-64, "\xCC", 255, 255, 255, 255); - if(mx > 140 && mx < 140+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50){ - fillrect(vid_buf, 140, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); - if(b && !bq){ - //Button Clicked - } - } - } - - //Report Button - if(svf_login){ - drawrect(vid_buf, 210, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); - drawtext(vid_buf, 228, YRES+MENUSIZE-63, "Report", 255, 255, 255, 255); - drawtext(vid_buf, 218, YRES+MENUSIZE-63, "!", 255, 255, 255, 255); - if(mx > 210 && mx < 210+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50){ - fillrect(vid_buf, 210, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); - if(b && !bq){ - //Button Clicked - } - } - } - - //Delete Button - if(authoritah){ - drawrect(vid_buf, 280, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); - drawtext(vid_buf, 298, YRES+MENUSIZE-63, "Delete", 255, 255, 255, 255); - drawtext(vid_buf, 286, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, 255); - if(mx > 280 && mx < 280+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50){ - fillrect(vid_buf, 280, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); - if(b && !bq){ - //Button Clicked - } - } - } - - - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + } + drawrect(vid_buf, 70, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); + drawtext(vid_buf, 93, YRES+MENUSIZE-63, "Open", 255, 255, 255, 255); + drawtext(vid_buf, 78, YRES+MENUSIZE-64, "\x81", 255, 255, 255, 255); + if(mx > 70 && mx < 70+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50) { + fillrect(vid_buf, 70, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq) { + queue_open = 1; + } + } + + //Fav Button + if(svf_login) { + drawrect(vid_buf, 140, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); + drawtext(vid_buf, 162, YRES+MENUSIZE-63, "Fav.", 255, 255, 255, 255); + drawtext(vid_buf, 147, YRES+MENUSIZE-64, "\xCC", 255, 255, 255, 255); + if(mx > 140 && mx < 140+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50) { + fillrect(vid_buf, 140, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq) { + //Button Clicked + } + } + } + + //Report Button + if(svf_login) { + drawrect(vid_buf, 210, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); + drawtext(vid_buf, 228, YRES+MENUSIZE-63, "Report", 255, 255, 255, 255); + drawtext(vid_buf, 218, YRES+MENUSIZE-63, "!", 255, 255, 255, 255); + if(mx > 210 && mx < 210+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50) { + fillrect(vid_buf, 210, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq) { + //Button Clicked + } + } + } + + //Delete Button + if(authoritah) { + drawrect(vid_buf, 280, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); + drawtext(vid_buf, 298, YRES+MENUSIZE-63, "Delete", 255, 255, 255, 255); + drawtext(vid_buf, 286, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, 255); + if(mx > 280 && mx < 280+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50) { + fillrect(vid_buf, 280, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq) { + //Button Clicked + } + } + } + + + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); if(sdl_key==SDLK_ESCAPE) break; - if(lasttimetitle = mystrdup(info_data+6); j++; } - else if(!strncmp(info_data, "NAME ", 5)) + else if(!strncmp(info_data, "NAME ", 5)) { info->name = mystrdup(info_data+5); j++; } - else if(!strncmp(info_data, "AUTHOR ", 7)) + else if(!strncmp(info_data, "AUTHOR ", 7)) { info->author = mystrdup(info_data+7); j++; } - else if(!strncmp(info_data, "DATE ", 5)) + else if(!strncmp(info_data, "DATE ", 5)) { info->date = mystrdup(info_data+5); j++; } - else if(!strncmp(info_data, "DESCRIPTION ", 12)) + else if(!strncmp(info_data, "DESCRIPTION ", 12)) { info->description = mystrdup(info_data+12); j++; } - else if(!strncmp(info_data, "VOTEUP ", 7)) + else if(!strncmp(info_data, "VOTEUP ", 7)) { info->voteup = atoi(info_data+7); j++; } - else if(!strncmp(info_data, "VOTEDOWN ", 9)) + else if(!strncmp(info_data, "VOTEDOWN ", 9)) { info->votedown = atoi(info_data+9); j++; } - else if(!strncmp(info_data, "VOTE ", 5)) + else if(!strncmp(info_data, "VOTE ", 5)) { info->vote = atoi(info_data+5); j++; } - else if(!strncmp(info_data, "MYVOTE ", 7)) + else if(!strncmp(info_data, "MYVOTE ", 7)) { info->myvote = atoi(info_data+7); j++; } - else if(!strncmp(info_data, "MYFAV ", 6)) + else if(!strncmp(info_data, "MYFAV ", 6)) { info->myfav = atoi(info_data+6); j++; } - else if(!strncmp(info_data, "PUBLISH ", 8)) + else if(!strncmp(info_data, "PUBLISH ", 8)) { - info->publish = atoi(info_data+8); + info->publish = atoi(info_data+8); j++; } - else if(!strncmp(info_data, "TAGS ", 5)) + else if(!strncmp(info_data, "TAGS ", 5)) { info->tags = mystrdup(info_data+5); j++; } - else if(!strncmp(info_data, "COMMENT ", 8)) - { - if(info->comment_count>=6){ - info_data = p; - continue; - } else { - q = strchr(info_data+8, ' '); - *(q++) = 0; - info->commentauthors[info->comment_count] = mystrdup(info_data+8); - info->comments[info->comment_count] = mystrdup(q); - info->comment_count++; - } + else if(!strncmp(info_data, "COMMENT ", 8)) + { + if(info->comment_count>=6) { + info_data = p; + continue; + } else { + q = strchr(info_data+8, ' '); + *(q++) = 0; + info->commentauthors[info->comment_count] = mystrdup(info_data+8); + info->comments[info->comment_count] = mystrdup(q); + info->comment_count++; + } j++; } - info_data = p; + info_data = p; + } + if(j>=8) { + return 1; + } else { + return -1; } - if(j>=8){ - return 1; - } else { - return -1; - } } int search_results(char *str, int votes) diff --git a/src/main.c b/src/main.c old mode 100755 new mode 100644 index 77133f9..5ef9ce3 --- a/src/main.c +++ b/src/main.c @@ -272,9 +272,9 @@ void *build_save(int *size, int x0, int y0, int w, int h) y = (int)(parts[i].y+0.5f); if(x>=x0 && x=y0 && y= size) goto corrupt; j=d[p++]; - if(j >= PT_NUM){ - //TODO: Possibly some server side translation - j = PT_DUST;//goto corrupt; - } + if(j >= PT_NUM) { + //TODO: Possibly some server side translation + j = PT_DUST;//goto corrupt; + } if(j)// && !(isplayer == 1 && j==PT_STKM)) { if(pmap[y][x]) { k = pmap[y][x]>>8; parts[k].type = j; - if(j == PT_PHOT) - parts[k].ctype = 0x3fffffff; + if(j == PT_PHOT) + parts[k].ctype = 0x3fffffff; parts[k].x = (float)x; parts[k].y = (float)y; m[(x-x0)+(y-y0)*w] = k+1; @@ -526,8 +526,8 @@ int parse_save(void *save, int size, int replace, int x0, int y0) else if(i < nf) { parts[fp[i]].type = j; - if(j == PT_PHOT) - parts[fp[i]].ctype = 0x3fffffff; + if(j == PT_PHOT) + parts[fp[i]].ctype = 0x3fffffff; parts[fp[i]].x = (float)x; parts[fp[i]].y = (float)y; m[(x-x0)+(y-y0)*w] = fp[i]+1; diff --git a/src/powder.c b/src/powder.c index 2d2e099..9dca982 100644 --- a/src/powder.c +++ b/src/powder.c @@ -26,10 +26,10 @@ static int pn_junction_sprk(int x, int y, int pt) { unsigned r = pmap[y][x]; if((r & 0xFF) != pt) - return 0; + return 0; r >>= 8; if(parts[r].type != pt) - return 0; + return 0; parts[r].ctype = pt; parts[r].type = PT_SPRK; @@ -42,16 +42,16 @@ static void photoelectric_effect(int nx, int ny) unsigned r = pmap[ny][nx]; if((r&0xFF) == PT_PSCN) { - if((pmap[ny][nx-1] & 0xFF) == PT_NSCN || - (pmap[ny][nx+1] & 0xFF) == PT_NSCN || - (pmap[ny-1][nx] & 0xFF) == PT_NSCN || - (pmap[ny+1][nx] & 0xFF) == PT_NSCN) - pn_junction_sprk(nx, ny, PT_PSCN); + if((pmap[ny][nx-1] & 0xFF) == PT_NSCN || + (pmap[ny][nx+1] & 0xFF) == PT_NSCN || + (pmap[ny-1][nx] & 0xFF) == PT_NSCN || + (pmap[ny+1][nx] & 0xFF) == PT_NSCN) + pn_junction_sprk(nx, ny, PT_PSCN); } } /* RETURN-value explenation -1 = Swap +1 = Swap 0 = No move/Bounce 2 = Both particles occupy the same space. */ @@ -69,16 +69,13 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) *rr = r; if((r&0xFF)==PT_VOID || (r&0xFF)==PT_BHOL) - return 1; - - if(pt==PT_NEUT && (r&0xFF)==PT_GLAS) - return 2; + return 1; if(pt==PT_PHOT&&( (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT || (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || - (r&0xFF)==PT_GLOW || - (r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW || + (r&0xFF)==PT_GLOW || (r&0xFF)==PT_WATR || + (r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW || ((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) return 2; @@ -99,17 +96,19 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) return 0; if(pt == PT_PHOT) - return 2; - - if(pt == PT_NEUT) + return 0; + if(pt == PT_NEUT) return 1; - if((r&0xFF) == PT_NEUT) + if(pt == PT_NEUT && (r&0xFF == PT_WATR||r&0xFF == PT_SLTW ||r&0xFF == PT_DSTW)) + return 2; + + if((r&0xFF) == PT_NEUT) return 0; - - if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight <= ptypes[(r&0xFF)].weight))) + + if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight <= ptypes[(r&0xFF)].weight))) return 0; - - + + return 1; } @@ -127,32 +126,38 @@ int try_move(int i, int x, int y, int nx, int ny) /* half-silvered mirror */ if(!e && parts[i].type==PT_PHOT && - (((r&0xFF)==PT_BMTL && rand()>8].temp = parts[i].temp; + if((r & 0xFF) < PT_NUM) - parts[i].temp = parts[r>>8].temp = - restrict_flt((parts[r>>8].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP); + parts[i].temp = parts[r>>8].temp = restrict_flt((parts[r>>8].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP); } return 0; } - if(e == 2) { - if(parts[i].type == PT_PHOT && (r&0xFF)==PT_GLOW && !parts[r>>8].life) - if(rand() < RAND_MAX/30) { - parts[r>>8].life = 120; - create_gain_photon(i); - } - if(parts[i].type == PT_NEUT && (r&0xFF)==PT_GLAS) { - if(rand() < RAND_MAX/10) - create_cherenkov_photon(i); - } + + if(e == 2) + { + if(parts[i].type == PT_PHOT && (r&0xFF)==PT_GLOW && !parts[r>>8].life) + if(rand() < RAND_MAX/30) + { + parts[r>>8].life = 120; + create_gain_photon(i); + } + + if(parts[i].type == PT_NEUT && (r&0xFF)==PT_GLAS) { + if(rand() < RAND_MAX/10) + create_cherenkov_photon(i); + } return 1; - } + } if((r&0xFF)==PT_VOID) { @@ -181,13 +186,13 @@ int try_move(int i, int x, int y, int nx, int ny) return 0; if(parts[i].type == PT_PHOT) - return 1; + return 1; e = r >> 8; if(r && e=0 && y>=0 && x=0 && y>=0 && x>8].type = PT_SPRK; @@ -500,15 +505,15 @@ inline int create_part(int p, int x, int y, int t) parts[i].vx = r*cosf(a); parts[i].vy = r*sinf(a); } - if(t==PT_MORT) - { - parts[i].vx = 2; - } + if(t==PT_MORT) + { + parts[i].vx = 2; + } if(t==PT_PHOT) { - float a = (rand()%8) * 0.78540f; + float a = (rand()%8) * 0.78540f; parts[i].life = 680; - parts[i].ctype = 0x3FFFFFFF; + parts[i].ctype = 0x3FFFFFFF; parts[i].vx = 3.0f*cosf(a); parts[i].vy = 3.0f*sinf(a); } @@ -569,10 +574,10 @@ static void create_gain_photon(int pp) lr = rand() % 2; if(lr) { - xx = parts[pp].x - 0.3*parts[pp].vy; + xx = parts[pp].x - 0.3*parts[pp].vy; yy = parts[pp].y + 0.3*parts[pp].vx; } else { - xx = parts[pp].x + 0.3*parts[pp].vy; + xx = parts[pp].x + 0.3*parts[pp].vy; yy = parts[pp].y - 0.3*parts[pp].vx; } @@ -580,10 +585,10 @@ static void create_gain_photon(int pp) ny = (int)(yy + 0.5f); if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) - return; + return; if((pmap[ny][nx] & 0xFF) != PT_GLOW) - return; + return; pfree = parts[i].life; @@ -614,10 +619,10 @@ static void create_cherenkov_photon(int pp) nx = (int)(parts[pp].x + 0.5f); ny = (int)(parts[pp].y + 0.5f); if((pmap[ny][nx] & 0xFF) != PT_GLAS) - return; + return; if(hypotf(parts[pp].vx, parts[pp].vy) < 1.44f) - return; + return; pfree = parts[i].life; @@ -632,11 +637,11 @@ static void create_cherenkov_photon(int pp) parts[i].tmp = 0; if(lr) { - parts[i].vx = parts[pp].vx - 2.5f*parts[pp].vy; - parts[i].vy = parts[pp].vy + 2.5f*parts[pp].vx; + parts[i].vx = parts[pp].vx - 2.5f*parts[pp].vy; + parts[i].vy = parts[pp].vy + 2.5f*parts[pp].vx; } else { - parts[i].vx = parts[pp].vx + 2.5f*parts[pp].vy; - parts[i].vy = parts[pp].vy - 2.5f*parts[pp].vx; + parts[i].vx = parts[pp].vx + 2.5f*parts[pp].vy; + parts[i].vy = parts[pp].vy - 2.5f*parts[pp].vx; } /* photons have speed of light. no discussion. */ @@ -686,18 +691,18 @@ int get_wavelength_bin(int *wm) int i, w0=30, wM=0; if(!*wm) - return -1; + return -1; for(i=0; i<30; i++) - if(*wm & (1< wM) - wM = i; - } + if(*wm & (1< wM) + wM = i; + } if(wM-w0 < 5) - return (wM+w0)/2; + return (wM+w0)/2; i = rand() % (wM-w0-3); i += w0; @@ -1288,67 +1293,67 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if(t==PT_BMTL){ - if(parts[i].tmp>1){ - parts[i].tmp--; - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - rt =parts[r>>8].type; - if((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100))) - { - parts[r>>8].type=PT_BMTL; - parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100; - } - } - } else if(parts[i].tmp==1 && 1>rand()%1000){ - parts[i].tmp = 0; - t = parts[i].type = PT_BRMT; - } - } - - else if(t==PT_IRON){ - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) || - ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) || - ((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) || - ((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) || - ((r&0xFF) == PT_LO2))&& - (!(parts[i].life)) - ) - { - parts[i].type=PT_BMTL; - parts[i].tmp=(rand()/(RAND_MAX/10))+20; - } - } - } - else if((t==PT_SPRK||parts[i].type==PT_SPRK) && parts[i].ctype==PT_IRON){ - for(nx=-1; nx<2; nx++) - for(ny=-1; ny<2; ny++) - if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) - continue; - if(((r&0xFF) == PT_DSTW && 30>(rand()/(RAND_MAX/1000))) || - ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/1000))) || - ((r&0xFF) == PT_WATR && 30>(rand()/(RAND_MAX/1000)))) - { - parts[r>>8].type=PT_O2; - //parts[r>>8].tmp=(rand()/(RAND_MAX/10))+20; - } - } - } + else if(t==PT_BMTL) { + if(parts[i].tmp>1) { + parts[i].tmp--; + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + rt =parts[r>>8].type; + if((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100))) + { + parts[r>>8].type=PT_BMTL; + parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100; + } + } + } else if(parts[i].tmp==1 && 1>rand()%1000) { + parts[i].tmp = 0; + t = parts[i].type = PT_BRMT; + } + } + + else if(t==PT_IRON) { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) || + ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) || + ((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) || + ((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) || + ((r&0xFF) == PT_LO2))&& + (!(parts[i].life)) + ) + { + parts[i].type=PT_BMTL; + parts[i].tmp=(rand()/(RAND_MAX/10))+20; + } + } + } + else if((t==PT_SPRK||parts[i].type==PT_SPRK) && parts[i].ctype==PT_IRON) { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && x+nx>8)>=NPART || !r) + continue; + if(((r&0xFF) == PT_DSTW && 30>(rand()/(RAND_MAX/1000))) || + ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/1000))) || + ((r&0xFF) == PT_WATR && 30>(rand()/(RAND_MAX/1000)))) + { + parts[r>>8].type=PT_O2; + //parts[r>>8].tmp=(rand()/(RAND_MAX/10))+20; + } + } + } else if(t==PT_COAL) { if(parts[i].life<=0) { @@ -1420,15 +1425,15 @@ void update_particles_i(pixel *vid, int start, int inc) //t = parts[i].life = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_PLSM); - if(r!=-1) - parts[r].life = 50; + if(r!=-1) + parts[r].life = 50; //goto killed; } else if (parts[i].life < 40) { parts[i].life--; if((rand()%100)==0) { r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - if(r!=-1) - parts[r].life = 50; + if(r!=-1) + parts[r].life = 50; } } if((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40) @@ -1463,15 +1468,15 @@ void update_particles_i(pixel *vid, int start, int inc) //t = PT_NONE; kill_part(i); r = create_part(-1, x, y, PT_PLSM); - if(r!=-1) - parts[r].life = 50; + if(r!=-1) + parts[r].life = 50; //goto killed; } else if (parts[i].life < 40) { parts[i].life--; if((rand()%10)==0) { r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM); - if(r!=-1) - parts[r].life = 50; + if(r!=-1) + parts[r].life = 50; } } for(nx=-2; nx<3; nx++) @@ -1777,9 +1782,9 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if(t==PT_MORT){ - create_part(-1, x, y-1, PT_SMKE); - } + else if(t==PT_MORT) { + create_part(-1, x, y-1, PT_SMKE); + } else if(t==PT_LCRY) { for(nx=-1; nx<2; nx++) @@ -1946,7 +1951,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } else if(parts[i].tmp==2) { - int col = rand()%200+4; + int col = rand()%200+4; for(nx=-2; nx<3; nx++) { for(ny=-2; ny<3; ny++) { if(x+nx>=0 && y+ny>0 && x+nx>8].type; if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) && - !(t==PT_PHOT && rt==PT_INSL) && + !(t==PT_PHOT && rt==PT_INSL) && (t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) && ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000)) { @@ -2621,8 +2626,8 @@ killed: parts[i].ctype = pmap[y+ny][x+nx]&0xFF; } else { - create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); - } + create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); + } } if(parts[i].type==PT_PCLN) @@ -2641,21 +2646,21 @@ killed: (pmap[y+ny][x+nx]&0xFF)!=PT_STKM && (pmap[y+ny][x+nx]&0xFF)!=0xFF) parts[i].ctype = pmap[y+ny][x+nx]&0xFF; - if(parts[i].ctype && parts[i].life==10){ - if(parts[i].ctype==PT_PHOT){ - for(nx=-1; nx<2; nx++){ - for(ny=-1; ny<2; ny++){ - r = create_part(-1, x+nx, y+ny, parts[i].ctype); - if(r!=-1){ - parts[r].vx = nx*3; - parts[r].vy = ny*3; - } - } - } - } else { - create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); - } - } + if(parts[i].ctype && parts[i].life==10) { + if(parts[i].ctype==PT_PHOT) { + for(nx=-1; nx<2; nx++) { + for(ny=-1; ny<2; ny++) { + r = create_part(-1, x+nx, y+ny, parts[i].ctype); + if(r!=-1) { + parts[r].vx = nx*3; + parts[r].vy = ny*3; + } + } + } + } else { + create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); + } + } } if(t==PT_YEST) { @@ -2697,7 +2702,7 @@ killed: lt = pmap[y][x] & 0xFF; - r = eval_move(PT_PHOT, nx, ny, NULL); + r = eval_move(PT_PHOT, nx, ny, NULL); if(((rt==PT_GLAS && lt!=PT_GLAS) || (rt!=PT_GLAS && lt==PT_GLAS)) && r) { if(!get_normal_interp(REFRACT|parts[i].type, x, y, parts[i].vx, parts[i].vy, &nrx, &nry)) { @@ -2705,13 +2710,13 @@ killed: continue; } - r = get_wavelength_bin(&parts[i].ctype); - if(r == -1) { - kill_part(i); - continue; - } - nn = GLASS_IOR - GLASS_DISP*(r-15)/15.0f; - nn *= nn; + r = get_wavelength_bin(&parts[i].ctype); + if(r == -1) { + kill_part(i); + continue; + } + nn = GLASS_IOR - GLASS_DISP*(r-15)/15.0f; + nn *= nn; nrx = -nrx; nry = -nry; @@ -2722,10 +2727,10 @@ killed: if(ct2 < 0.0f) { parts[i].vx -= 2.0f*ct1*nrx; parts[i].vy -= 2.0f*ct1*nry; - parts[i].x = lx; - parts[i].y = ly; - nx = (int)(lx + 0.5f); - ny = (int)(ly + 0.5f); + parts[i].x = lx; + parts[i].y = ly; + nx = (int)(lx + 0.5f); + ny = (int)(ly + 0.5f); } else { ct2 = sqrtf(ct2); ct2 = ct2 - nn*ct1; @@ -2855,25 +2860,25 @@ killed: } else if(t==PT_NEUT || t==PT_PHOT) { - r = pmap[ny][nx]; - - /* this should be replaced with a particle type attribute ("photwl" or something) */ - if((r & 0xFF) == PT_PSCN) parts[i].ctype = 0x00000000; - if((r & 0xFF) == PT_NSCN) parts[i].ctype = 0x00000000; - if((r & 0xFF) == PT_SPRK) parts[i].ctype = 0x00000000; - if((r & 0xFF) == PT_COAL) parts[i].ctype = 0x00000000; - if((r & 0xFF) == PT_BCOL) parts[i].ctype = 0x00000000; - if((r & 0xFF) == PT_PLEX) parts[i].ctype &= 0x1F00003E; - if((r & 0xFF) == PT_NITR) parts[i].ctype &= 0x0007C000; - if((r & 0xFF) == PT_NBLE) parts[i].ctype &= 0x3FFF8000; - if((r & 0xFF) == PT_LAVA) parts[i].ctype &= 0x3FF00000; - if((r & 0xFF) == PT_ACID) parts[i].ctype &= 0x1FE001FE; - if((r & 0xFF) == PT_DUST) parts[i].ctype &= 0x3FFFFFC0; - if((r & 0xFF) == PT_SNOW) parts[i].ctype &= 0x03FFFFFF; - if((r & 0xFF) == PT_GOO) parts[i].ctype &= 0x3FFAAA00; - if((r & 0xFF) == PT_PLNT) parts[i].ctype &= 0x0007C000; - if((r & 0xFF) == PT_PLUT) parts[i].ctype &= 0x001FCE00; - if((r & 0xFF) == PT_URAN) parts[i].ctype &= 0x003FC000; + r = pmap[ny][nx]; + + /* this should be replaced with a particle type attribute ("photwl" or something) */ + if((r & 0xFF) == PT_PSCN) parts[i].ctype = 0x00000000; + if((r & 0xFF) == PT_NSCN) parts[i].ctype = 0x00000000; + if((r & 0xFF) == PT_SPRK) parts[i].ctype = 0x00000000; + if((r & 0xFF) == PT_COAL) parts[i].ctype = 0x00000000; + if((r & 0xFF) == PT_BCOL) parts[i].ctype = 0x00000000; + if((r & 0xFF) == PT_PLEX) parts[i].ctype &= 0x1F00003E; + if((r & 0xFF) == PT_NITR) parts[i].ctype &= 0x0007C000; + if((r & 0xFF) == PT_NBLE) parts[i].ctype &= 0x3FFF8000; + if((r & 0xFF) == PT_LAVA) parts[i].ctype &= 0x3FF00000; + if((r & 0xFF) == PT_ACID) parts[i].ctype &= 0x1FE001FE; + if((r & 0xFF) == PT_DUST) parts[i].ctype &= 0x3FFFFFC0; + if((r & 0xFF) == PT_SNOW) parts[i].ctype &= 0x03FFFFFF; + if((r & 0xFF) == PT_GOO) parts[i].ctype &= 0x3FFAAA00; + if((r & 0xFF) == PT_PLNT) parts[i].ctype &= 0x0007C000; + if((r & 0xFF) == PT_PLUT) parts[i].ctype &= 0x001FCE00; + if((r & 0xFF) == PT_URAN) parts[i].ctype &= 0x003FC000; if(get_normal_interp(t, lx, ly, parts[i].vx, parts[i].vy, &nrx, &nry)) { dp = nrx*parts[i].vx + nry*parts[i].vy; @@ -2893,10 +2898,10 @@ killed: continue; } - if(!parts[i].ctype) { - kill_part(i); - continue; - } + if(!parts[i].ctype) { + kill_part(i); + continue; + } } else @@ -2958,9 +2963,9 @@ void update_particles(pixel *vid) x = (int)(parts[i].x+0.5f); y = (int)(parts[i].y+0.5f); if(x>=0 && y>=0 && x Date: Thu, 21 Oct 2010 18:45:14 +0200 Subject: I am not sure what to make of this, neutrons still can not pass through plut. diff --git a/src/powder.c b/src/powder.c index 9dca982..5031081 100644 --- a/src/powder.c +++ b/src/powder.c @@ -74,6 +74,62 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(pt==PT_PHOT&&( (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT || (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || + (r&0xFF)==PT_GLOW || (r&0xFF)==PT_WATR || + (r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW || + ((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) + return 2; + if(pt==PT_NEUT&&( + (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT || + (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || + (r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || + (r&0xFF)==PT_SLTW || (r%0xFF)==PT_PLUT)) + return 2; + + if(pt==PT_STKM) //Stick man's head shouldn't collide + return 2; + + if(bmap[ny/CELL][nx/CELL]==13 && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) + return 0; + if(ptypes[pt].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) + return 0; + if((pt==PT_NEUT ||pt==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) + return 0; + + if(bmap[ny/CELL][nx/CELL]==9) + return 0; + + if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) + return 0; + + if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight <= ptypes[(r&0xFF)].weight))) + return 0; + + if(pt == PT_PHOT) + return 2; + + if(pt==PT_NEUT) + return 2; + return 1; +} +/*static int eval_move(int pt, int nx, int ny, unsigned *rr) +{ + unsigned r; + + if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) + return 0; + + r = pmap[ny][nx]; + if(r && (r>>8)>8].type; + if(rr) + *rr = r; + + if((r&0xFF)==PT_VOID || (r&0xFF)==PT_BHOL) + return 1; + + if(pt==PT_PHOT&&( + (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT || + (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || (r&0xFF)==PT_GLOW || (r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW || ((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) @@ -111,7 +167,7 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) return 1; } - +*/ static void create_cherenkov_photon(int pp); static void create_gain_photon(int pp); @@ -136,13 +192,13 @@ int try_move(int i, int x, int y, int nx, int ny) { if((r & 0xFF) == PT_COAL || (r & 0xFF) == PT_BCOL) parts[r>>8].temp = parts[i].temp; - + if((r & 0xFF) < PT_NUM) parts[i].temp = parts[r>>8].temp = restrict_flt((parts[r>>8].temp+parts[i].temp)/2, MIN_TEMP, MAX_TEMP); } return 0; } - + if(e == 2) { if(parts[i].type == PT_PHOT && (r&0xFF)==PT_GLOW && !parts[r>>8].life) @@ -151,13 +207,13 @@ int try_move(int i, int x, int y, int nx, int ny) parts[r>>8].life = 120; create_gain_photon(i); } - - if(parts[i].type == PT_NEUT && (r&0xFF)==PT_GLAS) { + + if(parts[i].type == PT_NEUT && (r&0xFF)==PT_GLAS) { if(rand() < RAND_MAX/10) create_cherenkov_photon(i); - } - return 1; } + return 1; + } if((r&0xFF)==PT_VOID) { -- cgit v0.9.2-21-gd62e From f88bb0f246c7c7130b44d8b4b1b63012fadef94e Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 21 Oct 2010 23:49:45 +0100 Subject: Changes for open_ui diff --git a/includes/graphics.h b/includes/graphics.h index 260c69b..ec0d597 100644 --- a/includes/graphics.h +++ b/includes/graphics.h @@ -93,12 +93,14 @@ int drawtextmax(pixel *vid, int x, int y, int w, char *s, int r, int g, int b, i int textnwidth(char *s, int n); +int textnheight(char *s, int n, int w); + int textwidthx(char *s, int w); #ifdef WIN32 _inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); #else -inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); +void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); #endif void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag); diff --git a/includes/interface.h b/includes/interface.h index a284475..f145543 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -67,9 +67,9 @@ static menu_section msections[] = struct ui_edit { - int x, y, w, nx; + int x, y, w, nx, h; char str[256],*def; - int focus, cursor, hide; + int focus, cursor, hide, multiline; }; typedef struct ui_edit ui_edit; @@ -208,5 +208,7 @@ void execute_fav(pixel *vid_buf, char *id); int execute_vote(pixel *vid_buf, char *id, char *action); +void open_link(char *uri); + #endif diff --git a/includes/powder.h b/includes/powder.h deleted file mode 100644 index 99d12ee..0000000 --- a/includes/powder.h +++ /dev/null @@ -1,437 +0,0 @@ -#ifndef POWDER_H -#define POWDER_H - -#include "graphics.h" -#include "defines.h" -#include "interface.h" - -#define CM_COUNT 7 -#define CM_FANCY 6 -#define CM_HEAT 5 -#define CM_BLOB 4 -#define CM_FIRE 3 -#define CM_PERS 2 -#define CM_PRESS 1 -#define CM_VEL 0 - -#define UI_WALLSTART 37 -#define UI_WALLCOUNT 19 - -#define SPC_AIR 136 -#define SPC_HEAT 137 -#define SPC_COOL 138 -#define SPC_VACUUM 139 - -#define WL_WALLELEC 22 -#define WL_EWALL 23 -#define WL_DETECT 24 -#define WL_STREAM 25 -#define WL_SIGN 26 -#define WL_FAN 27 -#define WL_ALLOWLIQUID 28 -#define WL_DESTROYALL 29 -#define WL_ERASE 30 -#define WL_WALL 31 -#define WL_ALLOWAIR 32 -#define WL_ALLOWSOLID 33 -#define WL_ALLOWALLELEC 34 -#define WL_EHOLE 35 -#define WL_ALLOWGAS 40 - -#define PT_NONE 0 -#define PT_DUST 1 -#define PT_WATR 2 -#define PT_OIL 3 -#define PT_FIRE 4 -#define PT_STNE 5 -#define PT_LAVA 6 -#define PT_GUNP 7 -#define PT_NITR 8 -#define PT_CLNE 9 -#define PT_GAS 10 -#define PT_PLEX 11 -#define PT_GOO 12 -#define PT_ICEI 13 -#define PT_METL 14 -#define PT_SPRK 15 -#define PT_SNOW 16 -#define PT_WOOD 17 -#define PT_NEUT 18 -#define PT_PLUT 19 -#define PT_PLNT 20 -#define PT_ACID 21 -#define PT_VOID 22 -#define PT_WTRV 23 -#define PT_CNCT 24 -#define PT_DSTW 25 -#define PT_SALT 26 -#define PT_SLTW 27 -#define PT_DMND 28 -#define PT_BMTL 29 -#define PT_BRMT 30 -#define PT_PHOT 31 -#define PT_URAN 32 -#define PT_WAX 33 -#define PT_MWAX 34 -#define PT_PSCN 35 -#define PT_NSCN 36 -#define PT_LNTG 37 -#define PT_INSL 38 -#define PT_BHOL 39 -#define PT_WHOL 40 -#define PT_RBDM 41 -#define PT_LRBD 42 -#define PT_NTCT 43 -#define PT_SAND 44 -#define PT_GLAS 45 -#define PT_PTCT 46 -#define PT_BGLA 47 -#define PT_THDR 48 -#define PT_PLSM 49 -#define PT_ETRD 50 -#define PT_NICE 51 -#define PT_NBLE 52 -#define PT_BTRY 53 -#define PT_LCRY 54 -#define PT_STKM 55 -#define PT_SWCH 56 -#define PT_SMKE 57 -#define PT_DESL 58 -#define PT_COAL 59 -#define PT_LO2 60 -#define PT_O2 61 -#define PT_INWR 62 -#define PT_YEST 63 -#define PT_DYST 64 -#define PT_THRM 65 -#define PT_GLOW 66 -#define PT_BRCK 67 -#define PT_HFLM 68 -#define PT_FIRW 69 -#define PT_FUSE 70 -#define PT_FSEP 71 -#define PT_AMTR 72 -#define PT_BCOL 73 -#define PT_PCLN 74 -#define PT_HSWC 75 -#define PT_IRON 76 -#define PT_MORT 77 -#define PT_NUM 78 - -#define R_TEMP 22 -#define MAX_TEMP 9999 -#define MIN_TEMP 0 -#define O_MAX_TEMP 3500 -#define O_MIN_TEMP -273 - -#define ST_NONE 0 -#define ST_SOLID 1 -#define ST_LIQUID 2 -#define ST_GAS 3 -/* - We should start to implement these. -*/ -static const unsigned short TYPE_PART = 0x01; //1 -static const unsigned short TYPE_LIQUID = 0x02; //2 -static const unsigned short TYPE_SOLID = 0x04; //4 -static const unsigned short TYPE_GAS = 0x08; //8 -static const unsigned short PROP_CONDUCTS = 0x10; //16 -static const unsigned short PROP_DEADLY = 0x12; //18 Is deadly for stickman. -#define FLAG_STAGNANT 1 - -struct particle -{ - int type; - int life, ctype; - float x, y, vx, vy; - float temp; - float pavg[2]; - int flags; - int tmp; -}; -typedef struct particle particle; - -struct part_type -{ - const char *name; - pixel pcolors; - float advection; - float airdrag; - float airloss; - float loss; - float collision; - float gravity; - float diffusion; - float hotair; - int falldown; - int flammable; - int explosive; - int meltable; - int hardness; - int menu; - int weight; - int menusection; - float heat; - unsigned char hconduct; - const char *descs; - const unsigned short properties; -}; -typedef struct part_type part_type; - -struct part_state -{ - char state; - int solid; - float stemp; - int liquid; - float ltemp; - int gas; - float gtemp; - int burn; - float btemp; -}; -typedef struct part_state part_state; -//Should probably be const. -/* Weight Help - * 1 = Gas || - * 2 = Light || Liquids 0-49 - * 98 = Heavy || Powder 50-99 - * 100 = Solid || - * -1 is Neutrons and Photons - */ -static const part_type ptypes[PT_NUM] = -{ - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description - {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, - {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, - {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, - {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, - {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, - {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, - {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, - {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, - {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, - {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, - {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, - {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, - {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, - {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, - {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, - {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, - {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, - {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. - {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, - {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, - {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, - {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, - {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, - {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, - {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, - {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, - {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, - {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, - {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, - {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, - {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, - {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, - {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, - {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, - {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures"}, - {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, - {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, - {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, - {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, - {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, - {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, - {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, - {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, - {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, - {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, - {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, - {"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Steam Train."}, - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description -}; - -static part_state pstates[PT_NUM] = -{ - // Name Solid Frzp Liquid Mpnt Gas Bpoint - /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, - /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f}, - /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f}, - /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LAVA */ {ST_LIQUID, PT_STNE, 973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, - /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, - /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, - /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, - /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, - /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f}, - /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, - /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f}, - /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, - /* LRBD */ {ST_LIQUID, PT_RBDM, 311.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, - /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, - /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, - /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f}, - /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, - /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, - /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* BCOL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* IRON */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, -}; - -extern int isplayer; -extern float player[27]; - -extern particle *parts; -extern particle *cb_parts; - -extern unsigned char bmap[YRES/CELL][XRES/CELL]; -extern unsigned char emap[YRES/CELL][XRES/CELL]; - -extern unsigned char cb_bmap[YRES/CELL][XRES/CELL]; -extern unsigned char cb_emap[YRES/CELL][XRES/CELL]; - -extern int pfree; - -extern unsigned pmap[YRES][XRES]; -unsigned cb_pmap[YRES][XRES]; - -int try_move(int i, int x, int y, int nx, int ny); - -void kill_part(int i); - -#ifdef WIN32 -extern _inline int create_part(int p, int x, int y, int t); -#else -extern inline int create_part(int p, int x, int y, int t); -#endif - -#ifdef WIN32 -extern _inline void delete_part(int x, int y); -#else -extern inline void delete_part(int x, int y); -#endif - -#ifdef WIN32 -extern _inline int is_wire(int x, int y); -#else -extern inline int is_wire(int x, int y); -#endif - -#ifdef WIN32 -extern _inline int is_wire_off(int x, int y); -#else -extern inline int is_wire_off(int x, int y); -#endif - -void set_emap(int x, int y); - -#ifdef WIN32 -_inline int parts_avg(int ci, int ni); -#else -inline int parts_avg(int ci, int ni); -#endif - -int nearest_part(int ci, int t); - -void update_particles_i(pixel *vid, int start, int inc); - -void update_particles(pixel *vid); - -void clear_area(int area_x, int area_y, int area_w, int area_h); - -void create_box(int x1, int y1, int x2, int y2, int c); - -int flood_parts(int x, int y, int c, int cm, int bm); - -int create_parts(int x, int y, int r, int c); - -void create_line(int x1, int y1, int x2, int y2, int r, int c); - -#endif diff --git a/src/graphics.c b/src/graphics.c index b63e384..d6604a3 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1002,6 +1002,19 @@ int textnwidth(char *s, int n) } return x-1; } +int textnheight(char *s, int n, int w) +{ + int x = 0; + //TODO: Implement Textnheight for wrapped text + for(; *s; s++) + { + if(!n) + break; + x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + n--; + } + return x-1; +} int textwidthx(char *s, int w) { diff --git a/src/interface.c b/src/interface.c index 3ed4431..e072f16 100644 --- a/src/interface.c +++ b/src/interface.c @@ -1,3 +1,6 @@ +#ifdef MACOSX +#include +#endif #include #include #include @@ -208,7 +211,7 @@ void add_sign_ui(pixel *vid_buf, int mx, int my) strcpy(signs[i].text, ed.str); signs[i].ju = ju; } - +//TODO: Finish text wrapping in text edits void ui_edit_draw(pixel *vid_buf, ui_edit *ed) { int cx, i; @@ -226,8 +229,13 @@ void ui_edit_draw(pixel *vid_buf, ui_edit *ed) if(ed->str[0]) { - drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); - drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + if(ed->multiline){ + drawtextwrap(vid_buf, ed->x, ed->y, ed->h, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } else { + drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); + drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); + } } else if(!ed->focus) drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); @@ -259,19 +267,35 @@ void ui_edit_process(int mx, int my, int mb, ui_edit *ed) else str = ed->str; - if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = 0; - ed->str[0] = 0; - } - else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) - { - ed->focus = 1; - ed->cursor = textwidthx(str, mx-ed->x); - } - else - ed->focus = 0; + if(ed->multiline){ + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } + else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+ed->h) + { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } + else + ed->focus = 0; + } else { + if(mx>=ed->x+ed->w-11 && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = 0; + ed->str[0] = 0; + } + else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+11) + { + ed->focus = 1; + ed->cursor = textwidthx(str, mx-ed->x); + } + else + ed->focus = 0; + } } if(ed->focus && sdl_key) { @@ -1122,6 +1146,7 @@ int save_name_ui(pixel *vid_buf) ed.focus = 1; ed.hide = 0; ed.cursor = strlen(svf_name); + ed.multiline = 0; strcpy(ed.str, svf_name); cb.x = x0+10; @@ -1818,6 +1843,7 @@ int search_ui(pixel *vid_buf) ed.focus = 1; ed.hide = 0; ed.cursor = strlen(search_expr); + ed.multiline = 0; strcpy(ed.str, search_expr); sdl_wheel = 0; @@ -2524,8 +2550,8 @@ finish: int open_ui(pixel *vid_buf, char *save_id, char *save_date) { - int b=1,bq,mx,my,ca=0,thumb_w,thumb_h,active=0,active_2=0,cc=0,ccy=0,cix=0,hasdrawninfo=0,hasdrawnthumb=0,authoritah=0,queue_open=0,data_size=0,retval=0; - char *uri, *uri_2; + int b=1,bq,mx,my,ca=0,thumb_w,thumb_h,active=0,active_2=0,cc=0,ccy=0,cix=0,hasdrawninfo=0,hasdrawnthumb=0,authoritah=0,myown=0,queue_open=0,data_size=0,retval=0,bc=255,openable=1; + char *uri, *uri_2, *o_uri; void *data, *info_data; save_info *info = malloc(sizeof(save_info)); void *http = NULL, *http_2 = NULL; @@ -2533,6 +2559,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) int status, status_2, info_ready = 0, data_ready = 0; time_t http_last_use = HTTP_TIMEOUT, http_last_use_2 = HTTP_TIMEOUT; pixel *save_pic;// = malloc((XRES/2)*(YRES/2)); + ui_edit ed; pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); @@ -2543,6 +2570,18 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) drawrect(vid_buf, 50+(XRES/2)+1, 50, XRES+BARSIZE-100-((XRES/2)+1), YRES+MENUSIZE-100, 155, 155, 155, 255); drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128); + ed.x = 57+(XRES/2)+1; + ed.y = YRES+MENUSIZE-118; + ed.w = XRES+BARSIZE-114-((XRES/2)+1); + ed.h = 48; + ed.nx = 1; + ed.def = "Add comment"; + ed.focus = 1; + ed.hide = 0; + ed.multiline = 1; + ed.cursor = 0; + strcpy(ed.str, ""); + memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); while(!sdl_poll()) @@ -2629,7 +2668,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) free(http_2); http_2 = NULL; } - + if(data_ready && !hasdrawnthumb) { draw_image(vid_buf, save_pic, 51, 51, thumb_w, thumb_h, 255); hasdrawnthumb = 1; @@ -2653,9 +2692,22 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE); } hasdrawninfo = 1; - authoritah = svf_login && (!strcmp(info->author, svf_user) || svf_admin || svf_mod); + myown = svf_login && !strcmp(info->author, svf_user); + authoritah = svf_login && (!strcmp(info->author, svf_user) || svf_admin || svf_mod); memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); } + if(info_ready && svf_login){ + + fillrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 0, 0, 0, 255); + drawrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 200, 200, 200, 255); + + drawrect(vid_buf, 54+(XRES/2)+1, YRES+MENUSIZE-121, XRES+BARSIZE-108-((XRES/2)+1), 48, 255, 255, 255, 200); + + ui_edit_draw(vid_buf, &ed); + + drawrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); + drawtext(vid_buf, XRES+BARSIZE-90, YRES+MENUSIZE-63, "Submit", 255, 255, 255, 255); + } if(queue_open) { if(info_ready && data_ready) { @@ -2705,61 +2757,103 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) } //Open Button - if(sdl_key==SDLK_RETURN) { + bc = openable?255:150; + drawrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc); + drawtext(vid_buf, 73, YRES+MENUSIZE-63, "Open", 255, 255, 255, bc); + drawtext(vid_buf, 58, YRES+MENUSIZE-64, "\x81", 255, 255, 255, bc); + //Fav Button + bc = svf_login?255:150; + drawrect(vid_buf, 100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc); + drawtext(vid_buf, 122, YRES+MENUSIZE-63, "Fav.", 255, 255, 255, bc); + drawtext(vid_buf, 107, YRES+MENUSIZE-64, "\xCC", 255, 255, 255, bc); + //Report Button + bc = (svf_login && info_ready)?255:150; + drawrect(vid_buf, 150, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc); + drawtext(vid_buf, 168, YRES+MENUSIZE-63, "Report", 255, 255, 255, bc); + drawtext(vid_buf, 158, YRES+MENUSIZE-63, "!", 255, 255, 255, bc); + //Delete Button + bc = authoritah?255:150; + drawrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc); + drawtext(vid_buf, 218, YRES+MENUSIZE-63, "Delete", 255, 255, 255, bc); + drawtext(vid_buf, 206, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, bc); + //Open in browser button + bc = 255; + drawrect(vid_buf, 250, YRES+MENUSIZE-68, 107, 18, 255, 255, 255, bc); + drawtext(vid_buf, 273, YRES+MENUSIZE-63, "Open in Browser", 255, 255, 255, bc); + drawtext(vid_buf, 258, YRES+MENUSIZE-64, "\x81", 255, 255, 255, bc); + + //Open Button + if(sdl_key==SDLK_RETURN && openable) { queue_open = 1; } - drawrect(vid_buf, 70, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); - drawtext(vid_buf, 93, YRES+MENUSIZE-63, "Open", 255, 255, 255, 255); - drawtext(vid_buf, 78, YRES+MENUSIZE-64, "\x81", 255, 255, 255, 255); - if(mx > 70 && mx < 70+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50) { - fillrect(vid_buf, 70, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(mx > 50 && mx < 50+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && openable) { + fillrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); if(b && !bq) { + //Button Clicked queue_open = 1; } } - - //Fav Button - if(svf_login) { - drawrect(vid_buf, 140, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); - drawtext(vid_buf, 162, YRES+MENUSIZE-63, "Fav.", 255, 255, 255, 255); - drawtext(vid_buf, 147, YRES+MENUSIZE-64, "\xCC", 255, 255, 255, 255); - if(mx > 140 && mx < 140+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50) { - fillrect(vid_buf, 140, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); - if(b && !bq) { - //Button Clicked - } - } - } - - //Report Button - if(svf_login) { - drawrect(vid_buf, 210, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); - drawtext(vid_buf, 228, YRES+MENUSIZE-63, "Report", 255, 255, 255, 255); - drawtext(vid_buf, 218, YRES+MENUSIZE-63, "!", 255, 255, 255, 255); - if(mx > 210 && mx < 210+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50) { - fillrect(vid_buf, 210, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); - if(b && !bq) { - //Button Clicked - } - } - } - - //Delete Button - if(authoritah) { - drawrect(vid_buf, 280, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255); - drawtext(vid_buf, 298, YRES+MENUSIZE-63, "Delete", 255, 255, 255, 255); - drawtext(vid_buf, 286, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, 255); - if(mx > 280 && mx < 280+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50) { - fillrect(vid_buf, 280, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); - if(b && !bq) { - //Button Clicked - } + //Fav Button + if(mx > 100 && mx < 100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login) { + fillrect(vid_buf, 100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq) { + //Button Clicked + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); + info_box(vid_buf, "Adding to favourites..."); + execute_fav(vid_buf, save_id); + } + } + //Report Button + if(mx > 150 && mx < 150+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready) { + fillrect(vid_buf, 150, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq) { + //Button Clicked + if(confirm_ui(vid_buf, "Are you sure?", "Are you sure you wish to report this save?", "Report")){ + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); + info_box(vid_buf, "Reporting..."); + execute_report(vid_buf, save_id); + } + } + } + //Delete Button + if(mx > 200 && mx < 200+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && authoritah) { + fillrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq) { + //Button Clicked + if(myown || !info->publish){ + if(confirm_ui(vid_buf, "Are you sure you wish to delete this?", "This you will not be able recover it.", "Delete")){ + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); + info_box(vid_buf, "Deleting..."); + execute_delete(vid_buf, save_id); + } + } else if(authoritah){ + if(confirm_ui(vid_buf, "Are you sure?", "This save will be removed from the search index.", "Remove")){ + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); + info_box(vid_buf, "Removing..."); + execute_delete(vid_buf, save_id); + } + } + } + } + //Open in browser button + if(mx > 250 && mx < 250+107 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50) { + fillrect(vid_buf, 250, YRES+MENUSIZE-68, 107, 18, 255, 255, 255, 40); + if(b && !bq) { + //Button Clicked + //TODO: Open link + o_uri = malloc(7+strlen(SERVER)+41+strlen(save_id)*3); + strcpy(o_uri, "http://" SERVER "/Browse/View.html?ID="); + strcaturl(o_uri, save_id); + open_link(o_uri); + free(o_uri); } } - sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); + if(info_ready && svf_login){ + ui_edit_process(mx, my, b, &ed); + } if(sdl_key==SDLK_ESCAPE) break; @@ -3409,3 +3503,16 @@ int execute_vote(pixel *vid_buf, char *id, char *action) free(result); return 1; } +void open_link(char *uri){ +#ifdef WIN32 + ShellExecute(0, "OPEN", uri, NULL, NULL, 0) +#elif MACOSX + //LSOpenCFURLRef(CFURLCreateWithString(NULL, CFStringCreateWithCString(NULL, uri, 0) ,NULL), NULL); //TODO: Get this crap working +#elif LIN32 + execvp("xdg-open", uri); +#elif LIN64 + execvp("xdg-open", uri); +#else + printf("Cannot open browser\n"); +#endif +} -- cgit v0.9.2-21-gd62e From 1bc0afc2bfd276c576b9267c4bc30707143c4790 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 22 Oct 2010 00:04:45 +0100 Subject: Whoops diff --git a/includes/powder.h b/includes/powder.h new file mode 100644 index 0000000..cf9848a --- /dev/null +++ b/includes/powder.h @@ -0,0 +1,437 @@ +#ifndef POWDER_H +#define POWDER_H + +#include "graphics.h" +#include "defines.h" +#include "interface.h" + +#define CM_COUNT 7 +#define CM_FANCY 6 +#define CM_HEAT 5 +#define CM_BLOB 4 +#define CM_FIRE 3 +#define CM_PERS 2 +#define CM_PRESS 1 +#define CM_VEL 0 + +#define UI_WALLSTART 37 +#define UI_WALLCOUNT 19 + +#define SPC_AIR 136 +#define SPC_HEAT 137 +#define SPC_COOL 138 +#define SPC_VACUUM 139 + +#define WL_WALLELEC 22 +#define WL_EWALL 23 +#define WL_DETECT 24 +#define WL_STREAM 25 +#define WL_SIGN 26 +#define WL_FAN 27 +#define WL_ALLOWLIQUID 28 +#define WL_DESTROYALL 29 +#define WL_ERASE 30 +#define WL_WALL 31 +#define WL_ALLOWAIR 32 +#define WL_ALLOWSOLID 33 +#define WL_ALLOWALLELEC 34 +#define WL_EHOLE 35 +#define WL_ALLOWGAS 40 + +#define PT_NONE 0 +#define PT_DUST 1 +#define PT_WATR 2 +#define PT_OIL 3 +#define PT_FIRE 4 +#define PT_STNE 5 +#define PT_LAVA 6 +#define PT_GUNP 7 +#define PT_NITR 8 +#define PT_CLNE 9 +#define PT_GAS 10 +#define PT_PLEX 11 +#define PT_GOO 12 +#define PT_ICEI 13 +#define PT_METL 14 +#define PT_SPRK 15 +#define PT_SNOW 16 +#define PT_WOOD 17 +#define PT_NEUT 18 +#define PT_PLUT 19 +#define PT_PLNT 20 +#define PT_ACID 21 +#define PT_VOID 22 +#define PT_WTRV 23 +#define PT_CNCT 24 +#define PT_DSTW 25 +#define PT_SALT 26 +#define PT_SLTW 27 +#define PT_DMND 28 +#define PT_BMTL 29 +#define PT_BRMT 30 +#define PT_PHOT 31 +#define PT_URAN 32 +#define PT_WAX 33 +#define PT_MWAX 34 +#define PT_PSCN 35 +#define PT_NSCN 36 +#define PT_LNTG 37 +#define PT_INSL 38 +#define PT_BHOL 39 +#define PT_WHOL 40 +#define PT_RBDM 41 +#define PT_LRBD 42 +#define PT_NTCT 43 +#define PT_SAND 44 +#define PT_GLAS 45 +#define PT_PTCT 46 +#define PT_BGLA 47 +#define PT_THDR 48 +#define PT_PLSM 49 +#define PT_ETRD 50 +#define PT_NICE 51 +#define PT_NBLE 52 +#define PT_BTRY 53 +#define PT_LCRY 54 +#define PT_STKM 55 +#define PT_SWCH 56 +#define PT_SMKE 57 +#define PT_DESL 58 +#define PT_COAL 59 +#define PT_LO2 60 +#define PT_O2 61 +#define PT_INWR 62 +#define PT_YEST 63 +#define PT_DYST 64 +#define PT_THRM 65 +#define PT_GLOW 66 +#define PT_BRCK 67 +#define PT_HFLM 68 +#define PT_FIRW 69 +#define PT_FUSE 70 +#define PT_FSEP 71 +#define PT_AMTR 72 +#define PT_BCOL 73 +#define PT_PCLN 74 +#define PT_HSWC 75 +#define PT_IRON 76 +#define PT_MORT 77 +#define PT_NUM 78 + +#define R_TEMP 22 +#define MAX_TEMP 9999 +#define MIN_TEMP 0 +#define O_MAX_TEMP 3500 +#define O_MIN_TEMP -273 + +#define ST_NONE 0 +#define ST_SOLID 1 +#define ST_LIQUID 2 +#define ST_GAS 3 +/* + We should start to implement these. +*/ +static const unsigned short TYPE_PART = 0x01; //1 +static const unsigned short TYPE_LIQUID = 0x02; //2 +static const unsigned short TYPE_SOLID = 0x04; //4 +static const unsigned short TYPE_GAS = 0x08; //8 +static const unsigned short PROP_CONDUCTS = 0x10; //16 +static const unsigned short PROP_DEADLY = 0x12; //18 Is deadly for stickman. +#define FLAG_STAGNANT 1 + +struct particle +{ + int type; + int life, ctype; + float x, y, vx, vy; + float temp; + float pavg[2]; + int flags; + int tmp; +}; +typedef struct particle particle; + +struct part_type +{ + const char *name; + pixel pcolors; + float advection; + float airdrag; + float airloss; + float loss; + float collision; + float gravity; + float diffusion; + float hotair; + int falldown; + int flammable; + int explosive; + int meltable; + int hardness; + int menu; + int weight; + int menusection; + float heat; + unsigned char hconduct; + const char *descs; + const unsigned short properties; +}; +typedef struct part_type part_type; + +struct part_state +{ + char state; + int solid; + float stemp; + int liquid; + float ltemp; + int gas; + float gtemp; + int burn; + float btemp; +}; +typedef struct part_state part_state; +//Should probably be const. +/* Weight Help + * 1 = Gas || + * 2 = Light || Liquids 0-49 + * 98 = Heavy || Powder 50-99 + * 100 = Solid || + * -1 is Neutrons and Photons + */ +static const part_type ptypes[PT_NUM] = +{ + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, + {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, + {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, + {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, + {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, + {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, + {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, + {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, + {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, + {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, + {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, + {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, + {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, + {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, + {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, + {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures"}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, + {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, + {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, + {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, + {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, + {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, + {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, + {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, + {"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Steam Train."}, + //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description +}; + +static part_state pstates[PT_NUM] = +{ + // Name Solid Frzp Liquid Mpnt Gas Bpoint + /* NONE */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DUST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WATR */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* OIL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_GAS, 333.0f, PT_NONE, 0.0f}, + /* FIRE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2773.0f}, + /* STNE */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 983.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LAVA */ {ST_LIQUID, PT_STNE, 973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GUN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* NITR */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* CLNE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GAS */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_FIRE, 573.0f}, + /* C-4 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* GOO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ICE */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 274.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 873.0f}, + /* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, + /* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f}, + /* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f}, + /* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SLTW */ {ST_LIQUID, PT_ICEI, 233.0f, PT_NONE, 0.0f, PT_WTRV, 483.0f, PT_NONE, 0.0f}, + /* DMND */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BMTL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRMT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PHOT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* URAN */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 2373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WAX */ {ST_SOLID, PT_NONE, 0.0f, PT_MWAX, 319.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* MWAX */ {ST_LIQUID, PT_WAX, 318.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 673.0f}, + /* PSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LNTG */ {ST_SOLID, PT_NICE, 63.0f, PT_NONE, 0.0f, PT_NONE, 77.0f, PT_NONE, 0.0f}, + /* FOAM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* WHOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* RBDM */ {ST_SOLID, PT_NONE, 0.0f, PT_LRBD, 312.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, + /* LRBD */ {ST_LIQUID, PT_RBDM, 311.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 961.0f}, + /* HSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SAND */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLAS */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* CSCN */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1414.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BGLA */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1973.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THDR */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PLSM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ETRD */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NICE */ {ST_SOLID, PT_NONE, 0.0f, PT_LNTG, 63.1f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* NBLE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BTRY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_PLSM, 2273.0f}, + /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, + /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f}, + /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, + /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, + /* O2 */ {ST_GAS, PT_NONE, 0.0f, PT_LO2, 90.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* INWR */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* YEST */ {ST_SOLID, PT_NONE, 0.0f, PT_DYST, 373.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* DYST */ {ST_SOLID, PT_NONE, 0.0f, PT_DUST, 473.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* THRM */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GLOW */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BRCK */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1223.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HFLM */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FIRW */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FUSE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* FSEP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* AMtr */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BCOL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* IRON */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, +}; + +extern int isplayer; +extern float player[27]; + +extern particle *parts; +extern particle *cb_parts; + +extern unsigned char bmap[YRES/CELL][XRES/CELL]; +extern unsigned char emap[YRES/CELL][XRES/CELL]; + +extern unsigned char cb_bmap[YRES/CELL][XRES/CELL]; +extern unsigned char cb_emap[YRES/CELL][XRES/CELL]; + +extern int pfree; + +extern unsigned pmap[YRES][XRES]; +unsigned cb_pmap[YRES][XRES]; + +int try_move(int i, int x, int y, int nx, int ny); + +void kill_part(int i); + +#ifdef WIN32 +extern _inline int create_part(int p, int x, int y, int t); +#else +extern inline int create_part(int p, int x, int y, int t); +#endif + +#ifdef WIN32 +extern _inline void delete_part(int x, int y); +#else +extern inline void delete_part(int x, int y); +#endif + +#ifdef WIN32 +extern _inline int is_wire(int x, int y); +#else +extern inline int is_wire(int x, int y); +#endif + +#ifdef WIN32 +extern _inline int is_wire_off(int x, int y); +#else +extern inline int is_wire_off(int x, int y); +#endif + +void set_emap(int x, int y); + +#ifdef WIN32 +_inline int parts_avg(int ci, int ni); +#else +int parts_avg(int ci, int ni); +#endif + +int nearest_part(int ci, int t); + +void update_particles_i(pixel *vid, int start, int inc); + +void update_particles(pixel *vid); + +void clear_area(int area_x, int area_y, int area_w, int area_h); + +void create_box(int x1, int y1, int x2, int y2, int c); + +int flood_parts(int x, int y, int c, int cm, int bm); + +int create_parts(int x, int y, int r, int c); + +void create_line(int x1, int y1, int x2, int y2, int r, int c); + +#endif -- cgit v0.9.2-21-gd62e From 1b03d85d0931f84e10f3cbe4d92ebb6c4dea3723 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 22 Oct 2010 13:33:56 +0100 Subject: Fix neutrons, add properties, fix photons diff --git a/includes/powder.h b/includes/powder.h index cf9848a..fbf79fc 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -129,14 +129,18 @@ #define ST_LIQUID 2 #define ST_GAS 3 /* - We should start to implement these. + TODO: We should start to implement these. */ -static const unsigned short TYPE_PART = 0x01; //1 -static const unsigned short TYPE_LIQUID = 0x02; //2 -static const unsigned short TYPE_SOLID = 0x04; //4 -static const unsigned short TYPE_GAS = 0x08; //8 -static const unsigned short PROP_CONDUCTS = 0x10; //16 -static const unsigned short PROP_DEADLY = 0x12; //18 Is deadly for stickman. +#define TYPE_PART 0x0001 //1 Powders +#define TYPE_LIQUID 0x0002 //2 Liquids +#define TYPE_SOLID 0x0004 //4 Solids +#define TYPE_GAS 0x0008 //8 Gasses (Includes plasma) +#define TYPE_ENERGY 0x0018 //16 Energy (Thunder, Light, Neutrons etc.) +#define PROP_CONDUCTS 0x0020 //32 Conducts electricity (Currently Unused) +#define PROP_BLACK 0x0040 //64 Absorbs Photons +#define PROP_NEUTPENETRATE 0x0080 //128 Penetrated by neutrons +#define PROP_NEUTABSORB 0x0100 //256 Absorbs neutrons, reflect is default +#define PROP_DEADLY 0x0200 //512 Is deadly for stickman. #define FLAG_STAGNANT 1 struct particle @@ -202,84 +206,84 @@ typedef struct part_state part_state; static const part_type ptypes[PT_NUM] = { //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weight Section H Ins(real world, by triclops200) Description - {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles."}, - {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable."}, - {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires."}, - {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable."}, - {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f +273.15f, 88, "Ignites flammable materials. Heats air."}, - {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable."}, - {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f +273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold."}, - {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive."}, - {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive."}, - {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches."}, - {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure."}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive."}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure."}, - {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f +273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air."}, - {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable."}, - {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water."}, - {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f +273.15f, 46, "Light particles."}, - {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable. Can be pressurised into COAL"}, - {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways."}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure."}, - {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows."}, - {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything."}, - {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles."}, - {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f +273.15f, 48, "Steam, heats up air, produced from hot water."}, - {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone."}, - {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity."}, - {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water."}, - {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze."}, - {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable."}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. - {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal."}, - {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal."}, - {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f +273.15f, 251, "Photons. Travel in straight lines."}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f +273.15f, 251, "Heavy particles. Generates heat under pressure."}, - {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures."}, - {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f +273.15f, 44, "Liquid Wax."}, - {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor."}, - {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon."}, - {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold."}, - {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity."}, - {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f +273.15f, 255, "Black hole, sucks in other particles and heats up."}, - {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f +273.15f, 255, "White hole, pushes other particles away."}, - {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point"}, - {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f +273.15f, 170, "Liquid Rubidium."}, - {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)"}, - {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable."}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure"}, - {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)"}, - {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels."}, - {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals."}, - {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot."}, - {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)"}, - {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice."}, - {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity"}, - {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity."}, - {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)"}, - {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f +273.15f, 0, "Stickman. Don't kill him!"}, - {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)"}, - {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f +273.15f, 88, "Smoke"}, - {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures"}, - {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly."}, - {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire"}, - {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily."}, - {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors."}, - {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C)."}, - {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Deat Yeast."}, - {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature."}, - {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f +273.15f, 44, "Glow, Glows under pressure"}, - {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."}, - {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame."}, - {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!"}, - {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity."}, - {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE."}, - {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles"}, - {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL"}, - {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches."}, - {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated"}, - {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR"}, - {"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Steam Train."}, + {"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Erases particles.", 0}, + {"DUST", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable.", TYPE_PART}, + {"WATR", PIXPACK(0x2030D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Liquid. Conducts electricity. Freezes. Extinguishes fires.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE}, + {"OIL", PIXPACK(0x404010), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 20, 0, 0, 5, 1, 20, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Flammable.", TYPE_LIQUID}, + {"FIRE", PIXPACK(0xFF1000), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_EXPLOSIVE, R_TEMP+400.0f+273.15f, 88, "Ignites flammable materials. Heats air.", TYPE_GAS}, + {"STNE", PIXPACK(0xA0A0A0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Heavy particles. Meltable.", TYPE_PART}, + {"LAVA", PIXPACK(0xE05010), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 45, SC_LIQUID, R_TEMP+1500.0f+273.15f, 60, "Heavy liquid. Ignites flammable materials. Solidifies when cold.", TYPE_LIQUID}, + {"GUN", PIXPACK(0xC0C0D0), 0.7f, 0.02f * CFDS, 0.94f, 0.80f, -0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 600, 1, 0, 10, 1, 85, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 97, "Light dust. Explosive.", TYPE_PART}, + {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive.", TYPE_LIQUID}, + {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches.", TYPE_SOLID}, + {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure.", TYPE_GAS}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive.", TYPE_SOLID}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure.", TYPE_SOLID}, + {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f+273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air.", TYPE_SOLID}, + {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable.", TYPE_SOLID|PROP_CONDUCTS}, + {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water.", TYPE_SOLID}, + {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f+273.15f, 46, "Light particles.", TYPE_PART}, + {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable.", TYPE_SOLID}, + {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways.", TYPE_ENERGY}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure.", TYPE_PART|PROP_NEUTPENETRATE}, + {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows.", TYPE_SOLID}, + {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything.", TYPE_LIQUID}, + {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles.", TYPE_SOLID}, + {"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water.", TYPE_GAS}, + {"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone.", TYPE_PART}, + {"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity.", TYPE_LIQUID|PROP_NEUTPENETRATE}, + {"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water.", TYPE_PART}, + {"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE}, + {"DMND", PIXPACK(0xCCFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 186, "Diamond. Indestructable.", TYPE_SOLID}, //ief015 - Added diamond. Because concrete blocks are kinda pointless. + {"BMTL", PIXPACK(0x505070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal.", TYPE_SOLID|PROP_CONDUCTS}, + {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal.", TYPE_PART|PROP_CONDUCTS}, + {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f+273.15f, 251, "Photons. Travel in straight lines.", TYPE_ENERGY}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure.", TYPE_PART}, + {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures.", TYPE_SOLID}, + {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax.", TYPE_LIQUID}, + {"PSCN", PIXPACK(0x805050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "P-Type Silicon, Will transfer current to any conductor.", TYPE_SOLID}, + {"NSCN", PIXPACK(0x505080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "N-Type Silicon, Will only transfer current to P-Type Silicon.", TYPE_SOLID}, + {"LN2", PIXPACK(0x80A0DF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 0, 1, 30, SC_LIQUID, 70.15f, 70, "Liquid Nitrogen. Very cold.", TYPE_LIQUID}, + {"INSL", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 0, "Insulator, does not conduct heat or electricity.", TYPE_SOLID}, + {"BHOL", PIXPACK(0x202020), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, -0.01f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+70.0f+273.15f, 255, "Black hole, sucks in other particles and heats up.", TYPE_SOLID}, + {"WHOL", PIXPACK(0xEFEFEF), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.010f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP-16.0f+273.15f, 255, "White hole, pushes other particles away.", TYPE_SOLID}, + {"RBDM", PIXPACK(0xCCCCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 1, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 240, "Rubidium, explosive, especially on contact with water, low melting point", TYPE_SOLID|PROP_CONDUCTS}, + {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f+273.15f, 170, "Liquid Rubidium.", TYPE_LIQUID|PROP_CONDUCTS}, + {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)", TYPE_SOLID}, + {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable.", TYPE_PART}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure", TYPE_SOLID}, + {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)", TYPE_SOLID}, + {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels.", TYPE_PART}, + {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", TYPE_ENERGY}, + {"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_GAS, 9000.0f +273.15f, 115, "Plasma, extremely hot.", TYPE_GAS}, + {"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)", TYPE_SOLID}, + {"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice.", TYPE_SOLID}, + {"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when intruduced to electricity", TYPE_GAS}, + {"BTRY", PIXPACK(0x858505), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Generates Electricity.", TYPE_SOLID}, + {"LCRY", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Liquid Crystal. Changes colour when charged. (PSCN Charges, NSCN Discharges)", TYPE_SOLID}, + {"STKM", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0}, + {"SWCH", PIXPACK(0x103B11), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Only conducts when switched on. (PSCN switches on, NSCN switches off)", TYPE_SOLID}, + {"SMKE", PIXPACK(0x222222), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.001f * CFDS, 1, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+320.0f+273.15f, 88, "Smoke", TYPE_GAS}, + {"DESL", PIXPACK(0x440000), 1.0f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.0f, 0.0f * CFDS, 2, 2, 0, 0, 5, 1, 15, SC_LIQUID, R_TEMP+0.0f +273.15f, 42, "Liquid. Explodes under high pressure and temperatures", TYPE_LIQUID}, + {"COAL", PIXPACK(0x222222), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly.", TYPE_SOLID}, + {"LO2", PIXPACK(0x80A0EF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 5000, 0, 0, 0, 1, 30, SC_LIQUID, 80.0f, 70, "Liquid Oxygen. Very cold. Reacts with fire", TYPE_LIQUID}, + {"O2", PIXPACK(0x80A0FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 3.0f, 0.000f * CFDS, 0, 1000, 0, 0, 0, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 70, "Gas. Ignites easily.", TYPE_GAS}, + {"INWR", PIXPACK(0x544141), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Insulated Wire. Doesn't conduct to metal or semiconductors.", TYPE_SOLID}, + {"YEST", PIXPACK(0xEEE0C0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 15, 0, 0, 30, 1, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Yeast, grows when warm (~37C).", TYPE_PART}, + {"DYST", PIXPACK(0xBBB0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 20, 0, 0, 30, 0, 80, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Dead Yeast.", TYPE_PART}, + {"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 211, "Thermite. Burns at extremly high temperature.", TYPE_PART}, + {"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, 40, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow, Glows under pressure", TYPE_LIQUID}, + {"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material.", TYPE_SOLID}, + {"CFLM", PIXPACK(0x8080FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.00f, 0.0005f * CFDS, 1, 0, 0, 0, 1, 1, 2, SC_SPECIAL, 0.0f, 88, "Sub-zero flame.", TYPE_GAS}, + {"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", TYPE_PART}, + {"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", TYPE_SOLID}, + {"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", TYPE_PART}, + {"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles", TYPE_PART}, //Maybe TYPE_ENERGY? + {"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL", TYPE_PART}, + {"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When actived, duplicates any particles it touches.", TYPE_SOLID}, + {"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated", TYPE_SOLID}, + {"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR", TYPE_SOLID}, + {"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 0, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Steam Train.", TYPE_PART}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description }; diff --git a/src/powder.c b/src/powder.c index 5031081..a445cff 100644 --- a/src/powder.c +++ b/src/powder.c @@ -74,62 +74,6 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(pt==PT_PHOT&&( (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT || (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || - (r&0xFF)==PT_GLOW || (r&0xFF)==PT_WATR || - (r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW || - ((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) - return 2; - if(pt==PT_NEUT&&( - (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT || - (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || - (r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || - (r&0xFF)==PT_SLTW || (r%0xFF)==PT_PLUT)) - return 2; - - if(pt==PT_STKM) //Stick man's head shouldn't collide - return 2; - - if(bmap[ny/CELL][nx/CELL]==13 && ptypes[pt].falldown!=0 && pt!=PT_FIRE && pt!=PT_SMKE) - return 0; - if(ptypes[pt].falldown!=2 && bmap[ny/CELL][nx/CELL]==3) - return 0; - if((pt==PT_NEUT ||pt==PT_PHOT) && bmap[ny/CELL][nx/CELL]==7 && !emap[ny/CELL][nx/CELL]) - return 0; - - if(bmap[ny/CELL][nx/CELL]==9) - return 0; - - if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) - return 0; - - if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight <= ptypes[(r&0xFF)].weight))) - return 0; - - if(pt == PT_PHOT) - return 2; - - if(pt==PT_NEUT) - return 2; - return 1; -} -/*static int eval_move(int pt, int nx, int ny, unsigned *rr) -{ - unsigned r; - - if(nx<0 || ny<0 || nx>=XRES || ny>=YRES) - return 0; - - r = pmap[ny][nx]; - if(r && (r>>8)>8].type; - if(rr) - *rr = r; - - if((r&0xFF)==PT_VOID || (r&0xFF)==PT_BHOL) - return 1; - - if(pt==PT_PHOT&&( - (r&0xFF)==PT_GLAS || (r&0xFF)==PT_PHOT || - (r&0xFF)==PT_CLNE || (r&0xFF)==PT_PCLN || (r&0xFF)==PT_GLOW || (r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_SLTW || ((r&0xFF)==PT_LCRY&&parts[r>>8].life > 5))) @@ -151,23 +95,23 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) return 0; - if(pt == PT_PHOT) - return 0; - if(pt == PT_NEUT) - return 1; - if(pt == PT_NEUT && (r&0xFF == PT_WATR||r&0xFF == PT_SLTW ||r&0xFF == PT_DSTW)) - return 2; - - if((r&0xFF) == PT_NEUT) - return 0; - + if(ptypes[pt].properties&TYPE_ENERGY && (r && ((r&0xFF) >= PT_NUM || (ptypes[(r&0xFF)].properties&TYPE_ENERGY)))) + return 2; + + if(pt==PT_NEUT && (r && ((r&0xFF) >= PT_NUM || (ptypes[(r&0xFF)].properties&PROP_NEUTPENETRATE)))) + return 1; + if((r&0xFF)==PT_NEUT && ptypes[pt].properties&PROP_NEUTPENETRATE) + return 0; + if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight <= ptypes[(r&0xFF)].weight))) return 0; + if(pt == PT_PHOT) + return 2; return 1; } -*/ + static void create_cherenkov_photon(int pp); static void create_gain_photon(int pp); -- cgit v0.9.2-21-gd62e From a2491b03486097f7265708ecce5303d2b6eecae1 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Sat, 23 Oct 2010 10:14:49 +0200 Subject: removed LOLOLOLOLOLOL comment.. what the ...? diff --git a/src/powder.c b/src/powder.c index a445cff..fc645a5 100644 --- a/src/powder.c +++ b/src/powder.c @@ -3595,7 +3595,6 @@ int create_parts(int x, int y, int r, int c) bmap[j][i] = 5; return 1; } - //LOLOLOLOLLOLOLOLO if(c == 127) { b = 4; -- cgit v0.9.2-21-gd62e From ba1b9f7584e28ef4201ed8a4a7af679ec34585ed Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Mon, 25 Oct 2010 12:13:34 +0100 Subject: More functionality and improvements to open_ui diff --git a/includes/interface.h b/includes/interface.h index f145543..0f4dd3f 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -200,9 +200,11 @@ int execute_tagop(pixel *vid_buf, char *op, char *tag); void execute_save(pixel *vid_buf); -void execute_delete(pixel *vid_buf, char *id); +int execute_delete(pixel *vid_buf, char *id); -void execute_report(pixel *vid_buf, char *id); +int execute_report(pixel *vid_buf, char *id); + +void execute_submit(pixel *vid_buf, char *id, char *message); void execute_fav(pixel *vid_buf, char *id); diff --git a/src/interface.c b/src/interface.c index e072f16..4ab7bf4 100644 --- a/src/interface.c +++ b/src/interface.c @@ -230,7 +230,7 @@ void ui_edit_draw(pixel *vid_buf, ui_edit *ed) if(ed->str[0]) { if(ed->multiline){ - drawtextwrap(vid_buf, ed->x, ed->y, ed->h, str, 255, 255, 255, 255); + drawtextwrap(vid_buf, ed->x, ed->y, ed->w-14, str, 255, 255, 255, 255); drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255); } else { drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255); @@ -360,19 +360,19 @@ void ui_edit_process(int mx, int my, int mb, ui_edit *ed) } ts[0]=ed->hide?0x8D:ch; ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) + if((textwidth(str)+textwidth(ts) > ed->w-14 && !ed->multiline) || (float)(((textwidth(str)+textwidth(ts))/(ed->w-14)*12) > ed->h && ed->multiline)) break; memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); ed->str[ed->cursor] = ch; ed->cursor++; } #else - if(sdl_ascii>=' ' && sdl_ascii<127) + if(sdl_ascii>=' ' && sdl_ascii<127 && l<255) { ch = sdl_ascii; ts[0]=ed->hide?0x8D:ch; ts[1]=0; - if(textwidth(str)+textwidth(ts) > ed->w-14) + if((textwidth(str)+textwidth(ts) > ed->w-14 && !ed->multiline) || (float)(((textwidth(str)+textwidth(ts))/(ed->w-14)*12) > ed->h && ed->multiline)) break; memmove(ed->str+ed->cursor+1, ed->str+ed->cursor, l+1-ed->cursor); ed->str[ed->cursor] = ch; @@ -2601,7 +2601,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) strcaturl(uri, save_date); uri_2 = malloc(strlen(save_id)*3+strlen(save_date)*3+strlen(SERVER)+71); - strcpy(uri_2, "http://" SERVER "/Get.api?Op=save&ID="); + strcpy(uri_2, "http://" SERVER "/Info.api?ID="); strcaturl(uri_2, save_id); strappend(uri_2, "&Date="); strcaturl(uri_2, save_date); @@ -2811,26 +2811,36 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) if(confirm_ui(vid_buf, "Are you sure?", "Are you sure you wish to report this save?", "Report")){ fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); info_box(vid_buf, "Reporting..."); - execute_report(vid_buf, save_id); + if(execute_report(vid_buf, save_id)){ + info_ui(vid_buf, "Success", "This save has been reported"); + retval = 0; + break; + } } } } //Delete Button - if(mx > 200 && mx < 200+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && authoritah) { + if(mx > 200 && mx < 200+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && (authoritah || myown)) { fillrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); if(b && !bq) { //Button Clicked if(myown || !info->publish){ - if(confirm_ui(vid_buf, "Are you sure you wish to delete this?", "This you will not be able recover it.", "Delete")){ + if(confirm_ui(vid_buf, "Are you sure you wish to delete this?", "You will not be able recover it.", "Delete")){ fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); info_box(vid_buf, "Deleting..."); - execute_delete(vid_buf, save_id); + if(execute_delete(vid_buf, save_id)){ + retval = 0; + break; + } } - } else if(authoritah){ + } else { if(confirm_ui(vid_buf, "Are you sure?", "This save will be removed from the search index.", "Remove")){ fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); info_box(vid_buf, "Removing..."); - execute_delete(vid_buf, save_id); + if(execute_delete(vid_buf, save_id)){ + retval = 0; + break; + } } } } @@ -2848,6 +2858,16 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) free(o_uri); } } + //Submit Button + if(mx > XRES+BARSIZE-100 && mx < XRES+BARSIZE-100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready) { + fillrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + if(b && !bq) { + //Button Clicked + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); + info_box(vid_buf, "Submitting Comment..."); + execute_submit(vid_buf, save_id, ed.str); + } + } sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); @@ -3366,7 +3386,7 @@ void execute_save(pixel *vid_buf) free(result); } -void execute_delete(pixel *vid_buf, char *id) +int execute_delete(pixel *vid_buf, char *id) { int status; char *result; @@ -3387,6 +3407,42 @@ void execute_delete(pixel *vid_buf, char *id) error_ui(vid_buf, status, http_ret_text(status)); if(result) free(result); + return 0; + } + if(result && strncmp(result, "OK", 2)) + { + error_ui(vid_buf, 0, result); + free(result); + return 0; + } + + if(result) + free(result); + return 1; +} + +void execute_submit(pixel *vid_buf, char *id, char *message) +{ + int status; + char *result; + + char *names[] = {"ID", "Message", NULL}; + char *parts[2]; + + parts[0] = id; + parts[1] = message; + + result = http_multipart_post( + "http://" SERVER "/Comment.api", + names, parts, NULL, + svf_user, svf_pass, + &status, NULL); + + if(status!=200) + { + error_ui(vid_buf, status, http_ret_text(status)); + if(result) + free(result); return; } if(result && strncmp(result, "OK", 2)) @@ -3400,7 +3456,7 @@ void execute_delete(pixel *vid_buf, char *id) free(result); } -void execute_report(pixel *vid_buf, char *id) +int execute_report(pixel *vid_buf, char *id) { int status; char *result; @@ -3421,17 +3477,18 @@ void execute_report(pixel *vid_buf, char *id) error_ui(vid_buf, status, http_ret_text(status)); if(result) free(result); - return; + return 0; } if(result && strncmp(result, "OK", 2)) { error_ui(vid_buf, 0, result); free(result); - return; + return 0; } if(result) free(result); + return 1; } void execute_fav(pixel *vid_buf, char *id) -- cgit v0.9.2-21-gd62e From b902572251e093b4d00b5fbae835152269e1d269 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sat, 30 Oct 2010 12:33:33 +0100 Subject: open_ui imrovements, almost ready diff --git a/src/interface.c b/src/interface.c index 4ab7bf4..94b0e8a 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2757,7 +2757,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) } //Open Button - bc = openable?255:150; + bc = openable?255:150; drawrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc); drawtext(vid_buf, 73, YRES+MENUSIZE-63, "Open", 255, 255, 255, bc); drawtext(vid_buf, 58, YRES+MENUSIZE-64, "\x81", 255, 255, 255, bc); @@ -2772,40 +2772,40 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) drawtext(vid_buf, 168, YRES+MENUSIZE-63, "Report", 255, 255, 255, bc); drawtext(vid_buf, 158, YRES+MENUSIZE-63, "!", 255, 255, 255, bc); //Delete Button - bc = authoritah?255:150; - drawrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc); - drawtext(vid_buf, 218, YRES+MENUSIZE-63, "Delete", 255, 255, 255, bc); - drawtext(vid_buf, 206, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, bc); - //Open in browser button - bc = 255; + bc = authoritah?255:150; + drawrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc); + drawtext(vid_buf, 218, YRES+MENUSIZE-63, "Delete", 255, 255, 255, bc); + drawtext(vid_buf, 206, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, bc); + //Open in browser button + bc = 255; drawrect(vid_buf, 250, YRES+MENUSIZE-68, 107, 18, 255, 255, 255, bc); drawtext(vid_buf, 273, YRES+MENUSIZE-63, "Open in Browser", 255, 255, 255, bc); drawtext(vid_buf, 258, YRES+MENUSIZE-64, "\x81", 255, 255, 255, bc); - //Open Button - if(sdl_key==SDLK_RETURN && openable) { + //Open Button + if(sdl_key==SDLK_RETURN && openable) { queue_open = 1; } - if(mx > 50 && mx < 50+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && openable) { + if(mx > 50 && mx < 50+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && openable && !queue_open) { fillrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); if(b && !bq) { - //Button Clicked + //Button Clicked queue_open = 1; } } - //Fav Button - if(mx > 100 && mx < 100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login) { + //Fav Button + if(mx > 100 && mx < 100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && !queue_open) { fillrect(vid_buf, 100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); - if(b && !bq) { + if(b && !bq) { //Button Clicked - fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); - info_box(vid_buf, "Adding to favourites..."); - execute_fav(vid_buf, save_id); + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); + info_box(vid_buf, "Adding to favourites..."); + execute_fav(vid_buf, save_id); } - } - //Report Button - if(mx > 150 && mx < 150+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready) { - fillrect(vid_buf, 150, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); + } + //Report Button + if(mx > 150 && mx < 150+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready && !queue_open) { + fillrect(vid_buf, 150, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); if(b && !bq) { //Button Clicked if(confirm_ui(vid_buf, "Are you sure?", "Are you sure you wish to report this save?", "Report")){ @@ -2820,7 +2820,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) } } //Delete Button - if(mx > 200 && mx < 200+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && (authoritah || myown)) { + if(mx > 200 && mx < 200+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && (authoritah || myown) && !queue_open) { fillrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); if(b && !bq) { //Button Clicked @@ -2846,7 +2846,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) } } //Open in browser button - if(mx > 250 && mx < 250+107 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50) { + if(mx > 250 && mx < 250+107 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && !queue_open) { fillrect(vid_buf, 250, YRES+MENUSIZE-68, 107, 18, 255, 255, 255, 40); if(b && !bq) { //Button Clicked @@ -2859,7 +2859,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) } } //Submit Button - if(mx > XRES+BARSIZE-100 && mx < XRES+BARSIZE-100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready) { + if(mx > XRES+BARSIZE-100 && mx < XRES+BARSIZE-100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready && !queue_open) { fillrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); if(b && !bq) { //Button Clicked @@ -2869,6 +2869,10 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) } } + if(!(mx>50 && my>50 && mx Date: Sat, 30 Oct 2010 13:39:05 +0100 Subject: Increased nuke heat, and fixed gas bug caused by overlapping flags diff --git a/src/powder.c b/src/powder.c index fc645a5..e9be0f3 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1115,6 +1115,11 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].tmp = 0; parts[i].ctype = PT_BMTL; } + if(parts[i].ctype==PT_PLUT) + { + parts[i].tmp = 0; + parts[i].ctype = PT_LAVA; + } t = parts[i].type = parts[i].ctype; parts[i].ctype = PT_NONE; } @@ -1182,6 +1187,11 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].tmp--; parts[i].temp = 3500; } + if(parts[i].ctype==PT_PLUT&&parts[i].tmp>0) + { + parts[i].tmp--; + parts[i].temp = MAX_TEMP; + } } pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); } @@ -1722,7 +1732,12 @@ void update_particles_i(pixel *vid, int start, int inc) { if(33>rand()%100) { - create_part(r>>8, x+nx, y+ny, rand()%2 ? PT_LAVA : PT_URAN); + create_part(r>>8, x+nx, y+ny, rand()%3 ? PT_LAVA : PT_URAN); + parts[r>>8].temp = MAX_TEMP; + if(parts[r>>8].type==PT_LAVA){ + parts[r>>8].tmp = 100; + parts[r>>8].ctype = PT_PLUT; + } } else { -- cgit v0.9.2-21-gd62e From de9171c1eb5b9e130b8bf0607d509cbefe042730 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sat, 30 Oct 2010 14:36:13 +0100 Subject: FINALLY NEUTRONS ARE FIXED diff --git a/src/powder.c b/src/powder.c index e9be0f3..9db1fbf 100644 --- a/src/powder.c +++ b/src/powder.c @@ -95,13 +95,19 @@ static int eval_move(int pt, int nx, int ny, unsigned *rr) if(ptypes[pt].falldown!=1 && bmap[ny/CELL][nx/CELL]==10) return 0; - if(ptypes[pt].properties&TYPE_ENERGY && (r && ((r&0xFF) >= PT_NUM || (ptypes[(r&0xFF)].properties&TYPE_ENERGY)))) + if(r && (r&0xFF) < PT_NUM){ + //if(ptypes[pt].properties&TYPE_ENERGY && (r && ((r&0xFF) >= PT_NUM || (ptypes[(r&0xFF)].properties&TYPE_ENERGY)))) + if(ptypes[pt].properties&TYPE_ENERGY && ptypes[(r&0xFF)].properties&TYPE_ENERGY) return 2; - if(pt==PT_NEUT && (r && ((r&0xFF) >= PT_NUM || (ptypes[(r&0xFF)].properties&PROP_NEUTPENETRATE)))) + //if(pt==PT_NEUT && (r && ((r&0xFF) >= PT_NUM || (ptypes[(r&0xFF)].properties&PROP_NEUTPENETRATE)))) + if(pt==PT_NEUT && ptypes[(r&0xFF)].properties&PROP_NEUTPASS) + return 2; + if(pt==PT_NEUT && ptypes[(r&0xFF)].properties&PROP_NEUTPENETRATE) return 1; if((r&0xFF)==PT_NEUT && ptypes[pt].properties&PROP_NEUTPENETRATE) return 0; + } if (r && ((r&0xFF) >= PT_NUM || (ptypes[pt].weight <= ptypes[(r&0xFF)].weight))) return 0; @@ -2873,7 +2879,7 @@ killed: kill_part(i); continue; } - else if(t==PT_NEUT || t==PT_PHOT) + else if(t==PT_NEUT || t==PT_PHOT) //Seems to break neutrons, sorry Skylark { r = pmap[ny][nx]; @@ -2909,12 +2915,14 @@ killed: continue; } } else { - kill_part(i); + if(t!=PT_NEUT) + kill_part(i); continue; } if(!parts[i].ctype) { - kill_part(i); + if(t!=PT_NEUT) + kill_part(i); continue; } } -- cgit v0.9.2-21-gd62e From 457c049f955431c3d0d906b7580e93d629d116dd Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sat, 30 Oct 2010 20:50:36 +0100 Subject: Functionality finished, tweeks needed diff --git a/includes/interface.h b/includes/interface.h index 0f4dd3f..f12d25b 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -202,7 +202,7 @@ void execute_save(pixel *vid_buf); int execute_delete(pixel *vid_buf, char *id); -int execute_report(pixel *vid_buf, char *id); +int execute_report(pixel *vid_buf, char *id, char *reason); void execute_submit(pixel *vid_buf, char *id, char *message); @@ -212,5 +212,7 @@ int execute_vote(pixel *vid_buf, char *id, char *action); void open_link(char *uri); +int report_ui(pixel *vid_buf, char *save_id); + #endif diff --git a/src/interface.c b/src/interface.c index 94b0e8a..10e272c 100644 --- a/src/interface.c +++ b/src/interface.c @@ -33,6 +33,7 @@ int svf_myvote = 0; int svf_publish = 0; char svf_id[16] = ""; char svf_name[64] = ""; +char svf_description[255] = ""; char svf_tags[256] = ""; void *svf_last = NULL; int svf_lsize; @@ -1124,9 +1125,10 @@ finish: int save_name_ui(pixel *vid_buf) { - int x0=(XRES-192)/2,y0=(YRES-68-YRES/4)/2,b=1,bq,mx,my,ths,nd=0; + int x0=(XRES-400)/2,y0=(YRES-68-YRES/4)/2,b=1,bq,mx,my,ths,nd=0; void *th; ui_edit ed; + ui_edit ed2; ui_checkbox cb; th = build_thumb(&ths, 0); @@ -1148,6 +1150,18 @@ int save_name_ui(pixel *vid_buf) ed.cursor = strlen(svf_name); ed.multiline = 0; strcpy(ed.str, svf_name); + + ed2.x = x0+13; + ed2.y = y0+45; + ed2.w = 166; + ed2.h = 85; + ed2.nx = 1; + ed2.def = "[simulation description]"; + ed2.focus = 0; + ed2.hide = 0; + ed2.cursor = strlen(svf_description); + ed2.multiline = 1; + strcpy(ed2.str, svf_description); cb.x = x0+10; cb.y = y0+53+YRES/4; @@ -1162,16 +1176,19 @@ int save_name_ui(pixel *vid_buf) mx /= sdl_scale; my /= sdl_scale; - drawrect(vid_buf, x0, y0, 192, 90+YRES/4, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 192, 90+YRES/4); + drawrect(vid_buf, x0, y0, 400, 90+YRES/4, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 400, 90+YRES/4); drawtext(vid_buf, x0+8, y0+8, "New simulation name:", 255, 255, 255, 255); drawtext(vid_buf, x0+10, y0+23, "\x82", 192, 192, 192, 255); drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); + + drawrect(vid_buf, x0+8, y0+40, 176, 95, 192, 192, 192, 255); ui_edit_draw(vid_buf, &ed); + ui_edit_draw(vid_buf, &ed2); - drawrect(vid_buf, x0+(192-XRES/4)/2-2, y0+42, XRES/4+3, YRES/4+3, 128, 128, 128, 255); - render_thumb(th, ths, 0, vid_buf, x0+(192-XRES/4)/2, y0+44, 4); + drawrect(vid_buf, x0+(192-XRES/3)/2-2+200, y0+34, XRES/3+3, YRES/3+3, 128, 128, 128, 255); + render_thumb(th, ths, 0, vid_buf, x0+(200-XRES/3)/2+200, y0+36, 3); ui_checkbox_draw(vid_buf, &cb); drawtext(vid_buf, x0+34, y0+50+YRES/4, "Publish? (Do not publish others'\nworks without permission)", 192, 192, 192, 255); @@ -1182,6 +1199,7 @@ int save_name_ui(pixel *vid_buf) sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); ui_edit_process(mx, my, b, &ed); + ui_edit_process(mx, my, b, &ed2); ui_checkbox_process(mx, my, b, bq, &cb); if(b && !bq && ((mx>=x0+9 && mx=y0+22 && my(XRES+BARSIZE-400)+150 && my>(YRES+MENUSIZE-150)-18 && mx<(XRES+BARSIZE-400)+200 && my<(YRES+MENUSIZE-150)){ + fillrect(vid_buf, (XRES+BARSIZE-400)+150, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 40); + if(b){ + if(execute_report(vid_buf, save_id, ed.str)){ + info_ui(vid_buf, "Success", "This save has been reported"); + return 1; + } else { + return 0; + } + } + } + if(mx>200 && my>(YRES+MENUSIZE-150)-18 && mx<250 && my<(YRES+MENUSIZE-150)){ + fillrect(vid_buf, 200, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 40); + if(b) + return 0; + } + ui_edit_draw(vid_buf, &ed); + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); + ui_edit_process(mx, my, b, &ed); + } + return 0; +} + int open_ui(pixel *vid_buf, char *save_id, char *save_date) { int b=1,bq,mx,my,ca=0,thumb_w,thumb_h,active=0,active_2=0,cc=0,ccy=0,cix=0,hasdrawninfo=0,hasdrawnthumb=0,authoritah=0,myown=0,queue_open=0,data_size=0,retval=0,bc=255,openable=1; @@ -2709,53 +2794,6 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) drawtext(vid_buf, XRES+BARSIZE-90, YRES+MENUSIZE-63, "Submit", 255, 255, 255, 255); } - if(queue_open) { - if(info_ready && data_ready) { - // Do Open! - status = parse_save(data, data_size, 1, 0, 0); - if(!status) { - //if(svf_last) - //free(svf_last); - svf_last = data; - svf_lsize = data_size; - - svf_open = 1; - svf_own = svf_login && !strcmp(info->author, svf_user); - svf_publish = info->publish && svf_login && !strcmp(info->author, svf_user); - - strcpy(svf_id, save_id); - strcpy(svf_name, info->name); - if(info->tags) - { - strncpy(svf_tags, info->tags, 255); - svf_tags[255] = 0; - } else { - svf_tags[0] = 0; - } - svf_myvote = info->myvote; - retval = 1; - break; - } else { - queue_open = 0; - - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - error_ui(vid_buf, 0, "An Error Occurred"); - } - } else { - fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 190); - drawtext(vid_buf, XRES+BARSIZE/2, XRES+MENUSIZE, "Loading...", 0, 0, 0, 200); - } - } - //Open Button bc = openable?255:150; drawrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc); @@ -2808,14 +2846,9 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) fillrect(vid_buf, 150, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40); if(b && !bq) { //Button Clicked - if(confirm_ui(vid_buf, "Are you sure?", "Are you sure you wish to report this save?", "Report")){ - fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192); - info_box(vid_buf, "Reporting..."); - if(execute_report(vid_buf, save_id)){ - info_ui(vid_buf, "Success", "This save has been reported"); - retval = 0; - break; - } + if(report_ui(vid_buf, save_id)){ + retval = 0; + break; } } } @@ -2870,17 +2903,69 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) } if(!(mx>50 && my>50 && mxauthor, svf_user); + svf_publish = info->publish && svf_login && !strcmp(info->author, svf_user); + + strcpy(svf_id, save_id); + strcpy(svf_name, info->name); + strcpy(svf_description, info->description); + if(info->tags) + { + strncpy(svf_tags, info->tags, 255); + svf_tags[255] = 0; + } else { + svf_tags[0] = 0; + } + svf_myvote = info->myvote; + retval = 1; + break; + } else { + queue_open = 0; + + svf_open = 0; + svf_publish = 0; + svf_own = 0; + svf_myvote = 0; + svf_id[0] = 0; + svf_name[0] = 0; + svf_description[0] = 0; + svf_tags[0] = 0; + if(svf_last) + free(svf_last); + svf_last = NULL; + error_ui(vid_buf, 0, "An Error Occurred"); + } + } else { + fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 190); + drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128); + } + } + sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); if(info_ready && svf_login){ ui_edit_process(mx, my, b, &ed); } - if(sdl_key==SDLK_ESCAPE) + if(sdl_key==SDLK_ESCAPE){ + retval = 0; break; + } if(lasttime Date: Sun, 31 Oct 2010 10:26:32 +0000 Subject: Inlude missing header file for neutron fix diff --git a/includes/powder.h b/includes/powder.h index fbf79fc..4f1f2ff 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -129,18 +129,19 @@ #define ST_LIQUID 2 #define ST_GAS 3 /* - TODO: We should start to implement these. + TODO: We should start to implement these. (Almost done) */ #define TYPE_PART 0x0001 //1 Powders #define TYPE_LIQUID 0x0002 //2 Liquids #define TYPE_SOLID 0x0004 //4 Solids #define TYPE_GAS 0x0008 //8 Gasses (Includes plasma) -#define TYPE_ENERGY 0x0018 //16 Energy (Thunder, Light, Neutrons etc.) +#define TYPE_ENERGY 0x0010 //16 Energy (Thunder, Light, Neutrons etc.) #define PROP_CONDUCTS 0x0020 //32 Conducts electricity (Currently Unused) #define PROP_BLACK 0x0040 //64 Absorbs Photons #define PROP_NEUTPENETRATE 0x0080 //128 Penetrated by neutrons #define PROP_NEUTABSORB 0x0100 //256 Absorbs neutrons, reflect is default -#define PROP_DEADLY 0x0200 //512 Is deadly for stickman. +#define PROP_NEUTPASS 0x0200 //512 Neutrons pass through, such as with glass +#define PROP_DEADLY 0x0400 //1024 Is deadly for stickman. #define FLAG_STAGNANT 1 struct particle @@ -217,8 +218,8 @@ static const part_type ptypes[PT_NUM] = {"NITR", PIXPACK(0x20E010), 0.5f, 0.02f * CFDS, 0.92f, 0.97f, 0.0f, 0.2f, 0.00f, 0.000f * CFDS, 2, 1000, 2, 0, 3, 1, 23, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 50, "Liquid. Pressure sensitive explosive.", TYPE_LIQUID}, {"CLNE", PIXPACK(0xFFD010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Solid. Duplicates any particles it touches.", TYPE_SOLID}, {"GAS", PIXPACK(0xE0FF20), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 600, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Gas. Diffuses. Flammable. Liquifies under pressure.", TYPE_GAS}, - {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive.", TYPE_SOLID}, - {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure.", TYPE_SOLID}, + {"C-4", PIXPACK(0xD080E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 1000, 2, 50, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Solid. Pressure sensitive explosive.", TYPE_SOLID | PROP_NEUTPENETRATE}, + {"GOO", PIXPACK(0x804000), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 75, "Solid. Deforms and disappears under pressure.", TYPE_SOLID | PROP_NEUTPENETRATE}, {"ICE", PIXPACK(0xA0C0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP-50.0f+273.15f, 46, "Solid. Freezes water. Crushes under pressure. Cools down air.", TYPE_SOLID}, {"METL", PIXPACK(0x404060), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. Conducts electricity. Meltable.", TYPE_SOLID|PROP_CONDUCTS}, {"SPRK", PIXPACK(0xFFFF80), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electricity. Conducted by metal and water.", TYPE_SOLID}, @@ -251,7 +252,7 @@ static const part_type ptypes[PT_NUM] = {"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f+273.15f, 170, "Liquid Rubidium.", TYPE_LIQUID|PROP_CONDUCTS}, {"NTCT", PIXPACK(0x505040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when hot (More than 100C)", TYPE_SOLID}, {"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable.", TYPE_PART}, - {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure", TYPE_SOLID}, + {"GLAS", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure", TYPE_SOLID | PROP_NEUTPASS}, {"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 120C)", TYPE_SOLID}, {"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels.", TYPE_PART}, {"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", TYPE_ENERGY}, -- cgit v0.9.2-21-gd62e From 103af8d5446409ff0207be795ebb75c9aa309184 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sun, 31 Oct 2010 10:50:43 +0000 Subject: Browser opening working diff --git a/src/interface.c b/src/interface.c index 10e272c..f108efc 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3654,13 +3654,27 @@ int execute_vote(pixel *vid_buf, char *id, char *action) } void open_link(char *uri){ #ifdef WIN32 - ShellExecute(0, "OPEN", uri, NULL, NULL, 0) + ShellExecute(0, "OPEN", uri, NULL, NULL, 0); #elif MACOSX + //char *cmd[] = { "open", uri, (char *)0 }; + //execvp("open", cmd); //LSOpenCFURLRef(CFURLCreateWithString(NULL, CFStringCreateWithCString(NULL, uri, 0) ,NULL), NULL); //TODO: Get this crap working + char *cmd = malloc(7+strlen(uri)); + strcpy(cmd, "open "); + strappend(cmd, uri); + system(cmd); #elif LIN32 - execvp("xdg-open", uri); + //execlp("xdg-open", "xdg-open", uri, (char *)0); + char *cmd = malloc(11+strlen(uri)); + strcpy(cmd, "xdg-open "); + strappend(cmd, uri); + system(cmd); #elif LIN64 - execvp("xdg-open", uri); + //execlp("xdg-open", "xdg-open", uri, (char *)0); + char *cmd = malloc(11+strlen(uri)); + strcpy(cmd, "xdg-open "); + strappend(cmd, uri); + system(cmd); #else printf("Cannot open browser\n"); #endif -- cgit v0.9.2-21-gd62e From 401000098a1dae5e42747e86aa9bfff228ae652f Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Mon, 1 Nov 2010 11:52:26 +0100 Subject: removed -j3 option.. put it in the wrong place diff --git a/Makefile b/Makefile index 9e1f41e..88e5711 100755 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ powder-64-sse3-opengl: $(SOURCES) $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -lGL -lGLU -DOpenGL strip $@ powder-64-sse3: $(SOURCES) - $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -j3 + $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 strip $@ mv $@ build powder-64-sse2: $(SOURCES) -- cgit v0.9.2-21-gd62e From 79a36b526d4e5365727aff5c2bcda225a53bf5d6 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Tue, 2 Nov 2010 16:44:55 +0100 Subject: OHNOES powder-debug didn't work on 32bit systems.. for obvious reasons diff --git a/Makefile b/Makefile index 88e5711..b2412ca 100755 --- a/Makefile +++ b/Makefile @@ -13,9 +13,10 @@ WIN32_TARG := powder-sse.exe powder-sse2.exe powder: $(SOURCES) $(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 +powder-debug-64: $(SOURCES) + $(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) -Iincludes/ powder-debug: $(SOURCES) - $(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) -Iincludes/ -DLIN64 - + $(COMPILER) -m32 -o$@ $(FLAGS_DBUG) -DLIN32 $(SOURCES) -Iincludes/ powder-sse3: $(SOURCES) $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 strip $@ -- cgit v0.9.2-21-gd62e From 175b37d23944be2c4c5928476e67d380d5920461 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Wed, 3 Nov 2010 11:50:48 +0100 Subject: added debug flag diff --git a/Makefile b/Makefile index b2412ca..eca90db 100755 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ LFLAGS := -lSDL -lm -lbz2 MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE2 := -march=native-DX86 -DX86_SSE2 -msse2 MFLAGS_SSE := -march=native -DX86 -DX86_SSE -FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lbz2 +FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lbz2 -g COMPILER := gcc LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 WIN32_TARG := powder-sse.exe powder-sse2.exe diff --git a/src/main.c b/src/main.c index 5ef9ce3..dd6a02a 100644 --- a/src/main.c +++ b/src/main.c @@ -21,7 +21,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ - #include #include #include @@ -29,7 +28,7 @@ #include #include #include - +#include #ifdef WIN32 #include #else -- cgit v0.9.2-21-gd62e From c3a0a9262c0d00056857af18d93252c87410bad1 Mon Sep 17 00:00:00 2001 From: Felix Wallin Date: Wed, 3 Nov 2010 11:51:53 +0100 Subject: how did that get in there? diff --git a/src/main.c b/src/main.c index dd6a02a..9260abf 100644 --- a/src/main.c +++ b/src/main.c @@ -28,7 +28,6 @@ #include #include #include -#include #ifdef WIN32 #include #else -- cgit v0.9.2-21-gd62e From d1ce8e55dfd07faa3eb8029ea47a1db6a30f6988 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 3 Nov 2010 14:29:01 +0000 Subject: A Comment diff --git a/src/air.c b/src/air.c index dd98a12..385abef 100644 --- a/src/air.c +++ b/src/air.c @@ -124,6 +124,7 @@ void update_air(void) dy += fvy[y][x]; } + //Pressure Caps, remove for lulz if(dp > 256.0f) dp = 256.0f; if(dp < -256.0f) dp = -256.0f; if(dx > 256.0f) dx = 256.0f; -- cgit v0.9.2-21-gd62e From 9a40e4924e99af80a50b2c5f409d8463f993c4da Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 3 Nov 2010 15:51:02 +0000 Subject: Major improvements to text wrapping, acceptible but still character based diff --git a/includes/graphics.h b/includes/graphics.h index ec0d597..7019351 100644 --- a/includes/graphics.h +++ b/includes/graphics.h @@ -93,10 +93,12 @@ int drawtextmax(pixel *vid, int x, int y, int w, char *s, int r, int g, int b, i int textnwidth(char *s, int n); -int textnheight(char *s, int n, int w); +void textnpos(char *s, int n, int w, int *cx, int *cy); int textwidthx(char *s, int w); +int textposxy(char *s, int width, int w, int h); + #ifdef WIN32 _inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); #else diff --git a/src/graphics.c b/src/graphics.c index d6604a3..83b1141 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1002,18 +1002,25 @@ int textnwidth(char *s, int n) } return x-1; } -int textnheight(char *s, int n, int w) +void textnpos(char *s, int n, int w, int *cx, int *cy) { int x = 0; + int y = 0; //TODO: Implement Textnheight for wrapped text for(; *s; s++) { - if(!n) + if(!n){ break; + } x += font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + if(x>=w) { + x = 0; + y += FONT_H+2; + } n--; } - return x-1; + *cx = x-1; + *cy = y; } int textwidthx(char *s, int w) @@ -1029,6 +1036,23 @@ int textwidthx(char *s, int w) } return n; } +int textposxy(char *s, int width, int w, int h) +{ + int x=0,y=0,n=0,cw; + for(; *s; s++) + { + cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]]; + if(x+(cw/2) >= w && y+6 >= h) + break; + x += cw; + if(x>=width) { + x = 0; + y += FONT_H+2; + } + n++; + } + return n; +} #ifdef WIN32 _inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a) diff --git a/src/interface.c b/src/interface.c index f108efc..3a58ba4 100644 --- a/src/interface.c +++ b/src/interface.c @@ -215,7 +215,7 @@ void add_sign_ui(pixel *vid_buf, int mx, int my) //TODO: Finish text wrapping in text edits void ui_edit_draw(pixel *vid_buf, ui_edit *ed) { - int cx, i; + int cx, i, cy; char echo[256], *str; if(ed->hide) @@ -242,9 +242,15 @@ void ui_edit_draw(pixel *vid_buf, ui_edit *ed) drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255); if(ed->focus) { - cx = textnwidth(str, ed->cursor); + if(ed->multiline){ + textnpos(str, ed->cursor, ed->w-14, &cx, &cy); + } else { + cx = textnwidth(str, ed->cursor); + cy = 0; + } + for(i=-3; i<9; i++) - drawpixel(vid_buf, ed->x+cx, ed->y+i, 255, 255, 255, 255); + drawpixel(vid_buf, ed->x+cx, ed->y+i+cy, 255, 255, 255, 255); } } @@ -278,7 +284,7 @@ void ui_edit_process(int mx, int my, int mb, ui_edit *ed) else if(mx>=ed->x-ed->nx && mxx+ed->w && my>=ed->y-5 && myy+ed->h) { ed->focus = 1; - ed->cursor = textwidthx(str, mx-ed->x); + ed->cursor = textposxy(str, ed->w-14, mx-ed->x, my-ed->y); } else ed->focus = 0; -- cgit v0.9.2-21-gd62e From 9067564650343042b7a5d1ebdaec1faaec481afd Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 3 Nov 2010 16:13:00 +0000 Subject: 2 bug fixes diff --git a/src/interface.c b/src/interface.c index 3a58ba4..4a26998 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2251,131 +2251,14 @@ int search_ui(pixel *vid_buf) if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) { + //Cancel any ongoing requests, they cause a bug when open_ui is finished. At the moment I cannot be 100% sure this will solve the issue. + if(http){ + http_async_req_close(http); + http = NULL; + } if(open_ui(vid_buf, search_ids[mp], search_dates[mp]?search_dates[mp]:NULL)==1) { goto finish; } - /* - fillrect(vid_buf, 0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 255); - info_box(vid_buf, "Loading..."); - - if(search_dates[mp]) { - uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - strappend(uri, "&Date="); - strcaturl(uri, search_dates[mp]); - } else { - uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); - strcaturl(uri, search_ids[mp]); - } - data = http_simple_get(uri, &status, &dlen); - free(uri); - - if(status == 200) - { - status = parse_save(data, dlen, 1, 0, 0); - switch(status) - { - case 1: - error_ui(vid_buf, 0, "Simulation corrupted"); - break; - case 2: - error_ui(vid_buf, 0, "Simulation from a newer version"); - break; - case 3: - error_ui(vid_buf, 0, "Simulation on a too large grid"); - break; - } - if(!status) - { - char *tnames[] = {"ID", NULL}; - char *tparts[1]; - int tplens[1]; - if(svf_last) - free(svf_last); - svf_last = data; - svf_lsize = dlen; - - tparts[0] = search_ids[mp]; - tplens[0] = strlen(search_ids[mp]); - data = http_multipart_post("http://" SERVER "/Tags.api", tnames, tparts, tplens, svf_user, svf_pass, &status, NULL); - - svf_open = 1; - svf_own = svf_login && !strcmp(search_owners[mp], svf_user); - svf_publish = search_publish[mp] && svf_login && !strcmp(search_owners[mp], svf_user); - - strcpy(svf_id, search_ids[mp]); - strcpy(svf_name, search_names[mp]); - if(status == 200) - { - if(data) - { - strncpy(svf_tags, data, 255); - svf_tags[255] = 0; - } - else - svf_tags[0] = 0; - } - else - { - svf_tags[0] = 0; - } - - if(svf_login) - { - char *names[] = {"ID", NULL}; - char *parts[1]; - parts[0] = search_ids[mp]; - data = http_multipart_post("http://" SERVER "/Vote.api", names, parts, NULL, svf_user, svf_pass, &status, NULL); - if(status == 200) - { - if(data) - { - if(!strcmp(data, "Up")) - { - svf_myvote = 1; - } - else if(!strcmp(data, "Down")) - { - svf_myvote = -1; - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - else - { - svf_myvote = 0; - } - } - } - else - { - svf_open = 0; - svf_publish = 0; - svf_own = 0; - svf_myvote = 0; - svf_id[0] = 0; - svf_name[0] = 0; - svf_tags[0] = 0; - if(svf_last) - free(svf_last); - svf_last = NULL; - } - } - else - error_ui(vid_buf, status, http_ret_text(status)); - - if(data) - free(data); - goto finish;*/ } if(!last) @@ -2908,7 +2791,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) } } - if(!(mx>50 && my>50 && mx50 && my>50 && mx Date: Wed, 3 Nov 2010 18:10:59 +0000 Subject: Dem vote bars diff --git a/src/interface.c b/src/interface.c index 4a26998..9c6491e 100644 --- a/src/interface.c +++ b/src/interface.c @@ -1131,7 +1131,7 @@ finish: int save_name_ui(pixel *vid_buf) { - int x0=(XRES-400)/2,y0=(YRES-68-YRES/4)/2,b=1,bq,mx,my,ths,nd=0; + int x0=(XRES-420)/2,y0=(YRES-68-YRES/4)/2,b=1,bq,mx,my,ths,nd=0; void *th; ui_edit ed; ui_edit ed2; @@ -1182,8 +1182,8 @@ int save_name_ui(pixel *vid_buf) mx /= sdl_scale; my /= sdl_scale; - drawrect(vid_buf, x0, y0, 400, 90+YRES/4, 192, 192, 192, 255); - clearrect(vid_buf, x0, y0, 400, 90+YRES/4); + drawrect(vid_buf, x0, y0, 420, 90+YRES/4, 192, 192, 192, 255); + clearrect(vid_buf, x0, y0, 420, 90+YRES/4); drawtext(vid_buf, x0+8, y0+8, "New simulation name:", 255, 255, 255, 255); drawtext(vid_buf, x0+10, y0+23, "\x82", 192, 192, 192, 255); drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255); @@ -1193,14 +1193,16 @@ int save_name_ui(pixel *vid_buf) ui_edit_draw(vid_buf, &ed); ui_edit_draw(vid_buf, &ed2); - drawrect(vid_buf, x0+(192-XRES/3)/2-2+200, y0+34, XRES/3+3, YRES/3+3, 128, 128, 128, 255); - render_thumb(th, ths, 0, vid_buf, x0+(200-XRES/3)/2+200, y0+36, 3); + drawrect(vid_buf, x0+(205-XRES/3)/2-2+205, y0+30, XRES/3+3, YRES/3+3, 128, 128, 128, 255); + render_thumb(th, ths, 0, vid_buf, x0+(205-XRES/3)/2+205, y0+32, 3); ui_checkbox_draw(vid_buf, &cb); drawtext(vid_buf, x0+34, y0+50+YRES/4, "Publish? (Do not publish others'\nworks without permission)", 192, 192, 192, 255); drawtext(vid_buf, x0+5, y0+79+YRES/4, "Save simulation", 255, 255, 255, 255); drawrect(vid_buf, x0, y0+74+YRES/4, 192, 16, 192, 192, 192, 255); + + draw_line(vid_buf, x0+192, y0, x0+192, y0+90+YRES/4, 150, 150, 150, XRES+BARSIZE); sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE)); @@ -2251,11 +2253,6 @@ int search_ui(pixel *vid_buf) if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) { - //Cancel any ongoing requests, they cause a bug when open_ui is finished. At the moment I cannot be 100% sure this will solve the issue. - if(http){ - http_async_req_close(http); - http = NULL; - } if(open_ui(vid_buf, search_ids[mp], search_dates[mp]?search_dates[mp]:NULL)==1) { goto finish; } @@ -2525,7 +2522,9 @@ int report_ui(pixel* vid_buf, char *save_id) int open_ui(pixel *vid_buf, char *save_id, char *save_date) { int b=1,bq,mx,my,ca=0,thumb_w,thumb_h,active=0,active_2=0,cc=0,ccy=0,cix=0,hasdrawninfo=0,hasdrawnthumb=0,authoritah=0,myown=0,queue_open=0,data_size=0,retval=0,bc=255,openable=1; - char *uri, *uri_2, *o_uri; + int nyd,nyu,ry,lv; + + char *uri, *uri_2, *o_uri; void *data, *info_data; save_info *info = malloc(sizeof(save_info)); void *http = NULL, *http_2 = NULL; @@ -2649,13 +2648,44 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); } if(info_ready && !hasdrawninfo) { - //drawtext(vid_buf, 2, 2, info->name, 255, 255, 255, 255); + //Render all the save information cix = drawtext(vid_buf, 60, (YRES/2)+60, info->name, 255, 255, 255, 255); cix = drawtext(vid_buf, 60, (YRES/2)+72, "Author:", 255, 255, 255, 155); cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->author, 255, 255, 255, 255); cix = drawtext(vid_buf, cix+4, (YRES/2)+72, "Date:", 255, 255, 255, 155); cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->date, 255, 255, 255, 255); drawtextwrap(vid_buf, 62, (YRES/2)+86, (XRES/2)-24, info->description, 255, 255, 255, 200); + + //Draw the score bars + if(info->voteup>0||info->votedown>0) + { + lv = (info->voteup>info->votedown?info->voteup:info->votedown); + + if(50>lv) + { + ry = ((float)(50)/(float)lv); + if(lv<8) + { + ry = ry/(8-lv); + } + nyu = info->voteup*ry; + nyd = info->votedown*ry; + } + else + { + ry = ((float)lv/(float)(50)); + nyu = info->voteup/ry; + nyd = info->votedown/ry; + } + + fillrect(vid_buf, 46+(XRES/2)-51, (YRES/2)+53, 54, 6, 0, 107, 10, 255); + fillrect(vid_buf, 46+(XRES/2)-51, (YRES/2)+59, 54, 6, 107, 10, 0, 255); + drawrect(vid_buf, 46+(XRES/2)-51, (YRES/2)+53, 54, 6, 128, 128, 128, 255); + drawrect(vid_buf, 46+(XRES/2)-51, (YRES/2)+59, 54, 6, 128, 128, 128, 255); + + fillrect(vid_buf, 48+(XRES/2)-nyu, (YRES/2)+54, nyu, 4, 57, 187, 57, 255); + fillrect(vid_buf, 48+(XRES/2)-nyd, (YRES/2)+60, nyd, 4, 187, 57, 57, 255); + } ccy = 0; for(cc=0; cccomment_count; cc++) { @@ -2671,7 +2701,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE); } if(info_ready && svf_login){ - + //Render the comment box. fillrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 0, 0, 0, 255); drawrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 200, 200, 200, 255); -- cgit v0.9.2-21-gd62e From 53eaaec77af41cecf5180a5e3f7e4fd48fbcdbb2 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 3 Nov 2010 18:18:53 +0000 Subject: Another possible fix for the search bug diff --git a/src/interface.c b/src/interface.c index 9c6491e..defed5e 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2253,6 +2253,7 @@ int search_ui(pixel *vid_buf) if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) { + active = 0; if(open_ui(vid_buf, search_ids[mp], search_dates[mp]?search_dates[mp]:NULL)==1) { goto finish; } -- cgit v0.9.2-21-gd62e From 6124922b9f47003e4935580d792b7ba3b8ba1ede Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 3 Nov 2010 18:40:57 +0000 Subject: Gah, another attempt diff --git a/src/interface.c b/src/interface.c index defed5e..994b8c4 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2253,7 +2253,6 @@ int search_ui(pixel *vid_buf) if((b && !bq && mp!=-1 && !st && !uih) || do_open==1) { - active = 0; if(open_ui(vid_buf, search_ids[mp], search_dates[mp]?search_dates[mp]:NULL)==1) { goto finish; } @@ -2897,6 +2896,11 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date) if(!b) break; } + //Close open connections + if(http) + http_async_req_close(http); + if(http_2) + http_async_req_close(http_2); return retval; } -- cgit v0.9.2-21-gd62e