diff --git a/Game/data/fonts/freeserif.ttf b/Game/data/fonts/freeserif.ttf new file mode 100644 index 0000000..2f3dfc3 Binary files /dev/null and b/Game/data/fonts/freeserif.ttf differ diff --git a/Game/data/fonts/penguin_attack_license.txt b/Game/data/fonts/penguin_attack_license.txt new file mode 100644 index 0000000..b3e5b5e --- /dev/null +++ b/Game/data/fonts/penguin_attack_license.txt @@ -0,0 +1,365 @@ +Penguin Attack is Copyright (C) 2002 Dustin Norlander +Homepage: http://www.cheapskatefonts.com +email: dustin@dustismo.com + + + 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. + + + +------------------------------------------------------------------------------- + + + + + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + + diff --git a/Game/data/fonts/penguinattack.ttf b/Game/data/fonts/penguinattack.ttf new file mode 100644 index 0000000..622ae2d Binary files /dev/null and b/Game/data/fonts/penguinattack.ttf differ diff --git a/Game/data/music/bgmusic.ogg b/Game/data/music/bgmusic.ogg new file mode 100644 index 0000000..562b4bb Binary files /dev/null and b/Game/data/music/bgmusic.ogg differ diff --git a/Game/data/music/highbeat.ogg b/Game/data/music/highbeat.ogg new file mode 100644 index 0000000..3d21dae Binary files /dev/null and b/Game/data/music/highbeat.ogg differ diff --git a/Game/data/sprites/blockattack.sprite b/Game/data/sprites/blockattack.sprite new file mode 100644 index 0000000..80dc159 --- /dev/null +++ b/Game/data/sprites/blockattack.sprite @@ -0,0 +1,171 @@ +//This file contains the difinition of all sprites +//The file is in json-format but with support for C++-style comments + +{ + +//This is the fallback sprite that are used if the game request a sprite not in any file +"fallback" : { + "texture" : "fallback", + "topx" : 0, + "topy" : 0, + "height" : 64, + "width" : 64, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"backboard" : { + "texture" : "backboard", + "topx" : 0, + "topy" : 0, + "height" : 600, + "width" : 300, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"background" : { + "texture" : "background", + "topx" : 0, + "topy" : 0, + "height" : 768, + "width" : 1024, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"bexit" : { + "texture" : "bexit", + "topx" : 0, + "topy" : 0, + "height" : 100, + "width" : 100, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"block_blue" : { + "texture" : "blue", + "topx" : 0, + "topy" : 0, + "height" : 50, + "width" : 50, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"block_bomb" : { + "texture" : "bomb", + "topx" : 0, + "topy" : 0, + "height" : 50, + "width" : 50, + "number_of_frames" : 2, + "frame_time" : 150 +}, + +"block_green" : { + "texture" : "green", + "topx" : 0, + "topy" : 0, + "height" : 50, + "width" : 50, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"block_grey" : { + "texture" : "grey", + "topx" : 0, + "topy" : 0, + "height" : 50, + "width" : 50, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"block_purple" : { + "texture" : "purple", + "topx" : 0, + "topy" : 0, + "height" : 50, + "width" : 50, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"block_ready" : { + "texture" : "ready", + "topx" : 0, + "topy" : 0, + "height" : 50, + "width" : 50, + "number_of_frames" : 2, + "frame_time" : 500 +}, + +"block_red" : { + "texture" : "red", + "topx" : 0, + "topy" : 0, + "height" : 50, + "width" : 50, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"block_trans" : { + "texture" : "transover", + "topx" : 0, + "topy" : 0, + "height" : 50, + "width" : 50, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"block_turkish" : { + "texture" : "turkish", + "topx" : 0, + "topy" : 0, + "height" : 50, + "width" : 50, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"block_yellow" : { + "texture" : "yellow", + "topx" : 0, + "topy" : 0, + "height" : 50, + "width" : 50, + "number_of_frames" : 1, + "frame_time" : 1 +}, + +"boardbackback" : { + "texture" : "boardbackback", + "topx" : 0, + "topy" : 0, + "height" : 699, + "width" : 476, + "number_of_frames" : 1, + "frame_time" : 1, + "originx" : 57, + "originy" : 72 +}, + +"cursor" : { + "texture" : "cursor", + "topx" : 0, + "topy" : 0, + "height" : 58, + "width" : 108, + "number_of_frames" : 2, + "frame_time" : 400, + "originx" : 4, //This tells the game that the top left corner is placed a little different + "originy" : 4 +} + +} diff --git a/Game/data/textures/blue.png b/Game/data/textures/blue.png new file mode 100755 index 0000000..a6520c9 Binary files /dev/null and b/Game/data/textures/blue.png differ diff --git a/Game/data/textures/green.png b/Game/data/textures/green.png new file mode 100755 index 0000000..79b604a Binary files /dev/null and b/Game/data/textures/green.png differ diff --git a/Game/data/textures/grey.png b/Game/data/textures/grey.png new file mode 100755 index 0000000..91451d7 Binary files /dev/null and b/Game/data/textures/grey.png differ diff --git a/Game/data/textures/purple.png b/Game/data/textures/purple.png new file mode 100755 index 0000000..c6c1c87 Binary files /dev/null and b/Game/data/textures/purple.png differ diff --git a/Game/data/textures/red.png b/Game/data/textures/red.png new file mode 100755 index 0000000..c8359bf Binary files /dev/null and b/Game/data/textures/red.png differ diff --git a/Game/data/textures/turkish.png b/Game/data/textures/turkish.png new file mode 100755 index 0000000..f59e812 Binary files /dev/null and b/Game/data/textures/turkish.png differ diff --git a/Game/data/textures/yellow.png b/Game/data/textures/yellow.png new file mode 100755 index 0000000..524ac66 Binary files /dev/null and b/Game/data/textures/yellow.png differ diff --git a/Game/fonts/FreeSerif.ttf b/Game/fonts/FreeSerif.ttf deleted file mode 100644 index 2f3dfc3..0000000 Binary files a/Game/fonts/FreeSerif.ttf and /dev/null differ diff --git a/Game/fonts/PenguinAttack.ttf b/Game/fonts/PenguinAttack.ttf deleted file mode 100644 index 622ae2d..0000000 Binary files a/Game/fonts/PenguinAttack.ttf and /dev/null differ diff --git a/Game/fonts/penguin_attack_license.txt b/Game/fonts/penguin_attack_license.txt deleted file mode 100644 index b3e5b5e..0000000 --- a/Game/fonts/penguin_attack_license.txt +++ /dev/null @@ -1,365 +0,0 @@ -Penguin Attack is Copyright (C) 2002 Dustin Norlander -Homepage: http://www.cheapskatefonts.com -email: dustin@dustismo.com - - - 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. - - - -------------------------------------------------------------------------------- - - - - - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - - diff --git a/Game/gfx/bricks/blue.png b/Game/gfx/bricks/blue.png deleted file mode 100755 index a6520c9..0000000 Binary files a/Game/gfx/bricks/blue.png and /dev/null differ diff --git a/Game/gfx/bricks/green.png b/Game/gfx/bricks/green.png deleted file mode 100755 index 79b604a..0000000 Binary files a/Game/gfx/bricks/green.png and /dev/null differ diff --git a/Game/gfx/bricks/grey.png b/Game/gfx/bricks/grey.png deleted file mode 100755 index 91451d7..0000000 Binary files a/Game/gfx/bricks/grey.png and /dev/null differ diff --git a/Game/gfx/bricks/purple.png b/Game/gfx/bricks/purple.png deleted file mode 100755 index c6c1c87..0000000 Binary files a/Game/gfx/bricks/purple.png and /dev/null differ diff --git a/Game/gfx/bricks/red.png b/Game/gfx/bricks/red.png deleted file mode 100755 index c8359bf..0000000 Binary files a/Game/gfx/bricks/red.png and /dev/null differ diff --git a/Game/gfx/bricks/turkish.png b/Game/gfx/bricks/turkish.png deleted file mode 100755 index f59e812..0000000 Binary files a/Game/gfx/bricks/turkish.png and /dev/null differ diff --git a/Game/gfx/bricks/yellow.png b/Game/gfx/bricks/yellow.png deleted file mode 100755 index 524ac66..0000000 Binary files a/Game/gfx/bricks/yellow.png and /dev/null differ diff --git a/Game/music/bgMusic.ogg b/Game/music/bgMusic.ogg deleted file mode 100644 index 562b4bb..0000000 Binary files a/Game/music/bgMusic.ogg and /dev/null differ diff --git a/Game/music/highbeat.ogg b/Game/music/highbeat.ogg deleted file mode 100644 index 3d21dae..0000000 Binary files a/Game/music/highbeat.ogg and /dev/null differ diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp index 4a9c3a0..dd307af 100644 --- a/source/code/BlockGame.cpp +++ b/source/code/BlockGame.cpp @@ -457,13 +457,11 @@ void BlockGame::putStartBlocks() { } void BlockGame::putStartBlocks(Uint32 n) { -#if DEBUG - cout << n << ":" << f.str() << endl; -#endif - for (int i=0; i<7; i++) + for (int i=0; i<7; i++) { for (int j=0; j<30; j++) { board[i][j] = -1; } + } nextRandomNumber = n; int choice = rand2()%3; //Pick a random layout switch (choice) { diff --git a/source/code/CppSdlImageHolder.cpp b/source/code/CppSdlImageHolder.cpp index 2144281..ea47f38 100644 --- a/source/code/CppSdlImageHolder.cpp +++ b/source/code/CppSdlImageHolder.cpp @@ -89,7 +89,7 @@ void CppSdlImageHolder::PaintTo(SDL_Surface* target, int x, int y) { } dest.x = x; dest.y = y; - SDL_BlitSurface(data,&area, target,&dest); + SDL_BlitSurface(data, &area, target,&dest); } diff --git a/source/code/Makefile b/source/code/Makefile index b3d2276..53f4e42 100644 --- a/source/code/Makefile +++ b/source/code/Makefile @@ -2,6 +2,8 @@ GAMEDIR=../../Game/ BINARY=$(GAMEDIR)blockattack +-include sago/Makefile.sago + ifndef CC CC=gcc endif @@ -16,7 +18,7 @@ ifndef BUILDDIR BUILDDIR=build endif -BASE_LIBS=$(shell $(CROSS)sdl2-config --libs) -lSDL_ttf $(shell $(CROSS)pkg-config SDL_image SDL_mixer --libs) +BASE_LIBS=$(shell $(CROSS)sdl2-config --libs) -lSDL_ttf $(shell $(CROSS)pkg-config SDL_image SDL_mixer --libs) $(SAGO_BASE_LIBS) #For developement only ifndef DEBUG @@ -43,7 +45,7 @@ endif BASE_LIBS += -lphysfs -OFILES=main.o highscore.o ReadKeyboard.o joypad.o listFiles.o common.o stats.o CppSdlImageHolder.o Libs/NFont.o MenuSystem.o menudef.o puzzlehandler.o +OFILES=main.o highscore.o ReadKeyboard.o joypad.o listFiles.o common.o stats.o CppSdlImageHolder.o Libs/NFont.o MenuSystem.o menudef.o puzzlehandler.o ${SAGO_O_FILES} ifeq ($(CROSS),i686-pc-mingw32-) OFILES += winicon.res diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp index 0a61132..2b0f4d1 100644 --- a/source/code/MenuSystem.cpp +++ b/source/code/MenuSystem.cpp @@ -95,17 +95,17 @@ void Button::doAction() { cerr << "Warning: button \"" << label << "\" has no action assigned!"; } -void Button::drawTo(SDL_Surface** surface) { +void Button::drawToScreen() { #if DEBUG //cout << "Painting button: " << label << " at: " << x << "," << y << endl; #endif if (marked) { - gfx->marked->PaintTo(*surface,x,y); + gfx->marked->PaintTo(screen, x, y); } else { - gfx->unmarked->PaintTo(*surface,x,y); + gfx->unmarked->PaintTo(screen,x,y); } - gfx->thefont.setDest(*surface); + gfx->thefont.setDest(screen); gfx->thefont.drawCenter(x+gfx->xsize/2,y+gfx->ysize/2-gfx->thefont.getHeight("%s", label.c_str())/2, "%s", label.c_str()); } @@ -129,9 +129,9 @@ void Menu::drawSelf() { DrawIMG(backgroundImage,screen,0,0); vector::iterator it; for (it = buttons.begin(); it < buttons.end(); it++) { - (*it)->drawTo(&screen); + (*it)->drawToScreen(); } - exit.drawTo(&screen); + exit.drawToScreen(); standardButton.thefont.draw(50, 50, "%s", title.c_str()); mouse->PaintTo(screen,mousex,mousey); } @@ -171,15 +171,15 @@ void Menu::addButton(Button* b) { placeButtons(); } -Menu::Menu(SDL_Surface** screen) { - this->screen = *screen; +Menu::Menu(SDL_Surface* screen) { + this->screen = screen; buttons = vector(10); isSubmenu = true; exit.setLabel( _("Back") ); } -Menu::Menu(SDL_Surface** screen,bool submenu) { - this->screen = *screen; +Menu::Menu(SDL_Surface* screen,bool submenu) { + this->screen = screen; buttons = vector(0); isSubmenu = submenu; if (isSubmenu) { @@ -190,8 +190,8 @@ Menu::Menu(SDL_Surface** screen,bool submenu) { } } -Menu::Menu(SDL_Surface** screen, const string& title, bool submenu) { - this->screen = *screen; +Menu::Menu(SDL_Surface* screen, const string& title, bool submenu) { + this->screen = screen; buttons = vector(0); isSubmenu = submenu; this->title = title; diff --git a/source/code/MenuSystem.h b/source/code/MenuSystem.h index b0afee4..342b74e 100644 --- a/source/code/MenuSystem.h +++ b/source/code/MenuSystem.h @@ -82,7 +82,7 @@ public: bool isClicked(int x,int y); //Returns true if (x,y) is within the borders of the button virtual void doAction(); //Run the callback function - void drawTo(SDL_Surface **surface); + void drawToScreen(void); void setPopOnRun(bool popOnRun); bool isPopOnRun() const; void setGfx(ButtonGfx* gfx); //Draws to screen @@ -111,9 +111,9 @@ private: public: //numberOfItems is the expected numberOfItems for vector initialization //SubMenu is true by default - Menu(SDL_Surface **screen,bool isSubmenu); - Menu(SDL_Surface **screen); - Menu(SDL_Surface **screen, const std::string& title, bool isSubmenu); + Menu(SDL_Surface *screen,bool isSubmenu); + Menu(SDL_Surface *screen); + Menu(SDL_Surface *screen, const std::string& title, bool isSubmenu); //Add a button to the menu void addButton(Button *b); diff --git a/source/code/main.cpp b/source/code/main.cpp index 35af220..2a1ccb4 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -34,7 +34,7 @@ http://blockattack.sf.net //If DEBUG is defined: AI info and FPS will be written to screen #ifndef DEBUG -#define DEBUG 0 +#define DEBUG 1 #endif #define WITH_SDL 1 @@ -91,7 +91,6 @@ http://blockattack.sf.net using namespace std; -static void MakeBackground(int,int); SDL_Surface* IMG_Load2(const char* path) { if (!PHYSFS_exists(path)) { @@ -354,7 +353,6 @@ Mix_Chunk* Mix_LoadWAV2(const char* path) { //Load all image files to memory static int InitImages() { if (!((backgroundImage = IMG_Load2("gfx/background.png")) - && (background = IMG_Load2("gfx/blackBackGround.png")) && (bOptions = IMG_Load2("gfx/bOptions.png")) && (bConfigure = IMG_Load2("gfx/bConfigure.png")) && (bSelectPuzzle = IMG_Load2("gfx/bSelectPuzzle.png")) @@ -452,7 +450,7 @@ static int InitImages() { cerr << e.what() << endl; exit(1); } - + SDL_Color nf_button_color, nf_standard_blue_color, nf_standard_small_color; memset(&nf_button_color,0,sizeof(SDL_Color)); nf_button_color.b = 255; @@ -467,21 +465,7 @@ static int InitImages() { NFont_OpenFont(screen, &nf_button_font,"fonts/FreeSerif.ttf",24,nf_button_color); NFont_OpenFont(screen, &nf_standard_blue_font,"fonts/FreeSerif.ttf",30,nf_standard_blue_color); NFont_OpenFont(screen, &nf_standard_small_font,"fonts/FreeSerif.ttf",16,nf_standard_small_color); - SDL_RendererHolder backbackRenderer(); NFont_OpenFont(screen, &nf_scoreboard_font,"fonts/PenguinAttack.ttf",20,nf_button_color); //should draw to boardBackBack - nf_scoreboard_font.draw(370,148,_("Score:") ); - nf_scoreboard_font.draw(370,197,_("Time:") ); - nf_scoreboard_font.draw(370,246,_("Chain:") ); - nf_scoreboard_font.draw(370,295,_("Speed:") ); - nf_button_font.setDest(bRetry); - nf_button_font.drawCenter(60,10,_("Retry")); - nf_button_font.setDest(bNext); - nf_button_font.drawCenter(60,10,_("Next")); - nf_button_font.setDest(bSkip); - nf_button_font.drawCenter(60,10,_("Skip")); - nf_button_font.setDest(bBack); - nf_button_font.drawCenter(60,10,_("Back")); - nf_button_font.setDest(screen); //Loads the sound if sound present @@ -522,7 +506,6 @@ void UnloadImages() { //I think this will crash, at least it happend to me... //Chrashes no more. Caused by an undocumented double free SDL_FreeSurface(backgroundImage); - SDL_FreeSurface(background); SDL_FreeSurface(bOptions); SDL_FreeSurface(bConfigure); SDL_FreeSurface(bSelectPuzzle); @@ -602,15 +585,48 @@ static string itoa2(int num) { } /*Draws a image from on a given Surface. Takes source image, destination surface and coordinates*/ -void DrawIMG(SDL_Surface* img, SDL_Surface* target, int x, int y) { +void DrawIMG(SDL_Texture* img, SDL_Renderer* target, int x, int y) { SDL_Rect dest; dest.x = x; dest.y = y; - SDL_BlitSurface(img, nullptr, target, &dest); + dest.w = img->; + dest.h = SHAPE_SIZE; + + SDL_RenderCopy(target, img, nullptr, &dest); +} + +void DrawIMG_Bounded(SDL_Texture* img, Renderer* target, int x, int y, int minx, int miny, int maxx, int maxy) { + SDL_Rect dest; + dest.x = x; + dest.y = y; + if (dest.x >= minx && dest.y >= miny && dest.x + img->w <= maxx && dest.y + img->h <= maxy) { + SDL_BlitSurface(img, nullptr, target, &dest); + return; + } + SDL_Rect dest2; + dest2.x = 0; + dest2.y = 0; + dest2.w = img->w; + dest2.h = img->h; + if (dest.x < minx) { + dest2.x += minx-dest.x; + dest.x = minx; + } + if (dest.y < miny) { + dest2.y += miny-dest.y; + dest.y = miny; + } + if (dest.y+dest2.h > maxy) { + dest2.h -= (dest.y+dest2.h - maxy); + } + if (dest.x+dest2.w > maxx) { + dest2.w -= (dest.x+dest2.w - maxx); + } + SDL_BlitSurface(img, &dest2, target, &dest); } /*Draws a part of an image on a surface of choice*/ -void DrawIMG(SDL_Surface* img, SDL_Surface* target, int x, int y, int w, int h, int x2, int y2) { +void DrawIMG(SDL_Texture* img, Renderer* target, int x, int y, int w, int h, int x2, int y2) { SDL_Rect dest; dest.x = x; dest.y = y; @@ -623,10 +639,8 @@ void DrawIMG(SDL_Surface* img, SDL_Surface* target, int x, int y, int w, int h, } -void NFont_Write(SDL_Surface* target, int x, int y, const string& text) { - nf_standard_blue_font.setDest(target); - nf_standard_blue_font.draw(x, y, "%s", text.c_str()); - nf_standard_blue_font.setDest(screen); +void NFont_Write(SDL_Renderer* target, int x, int y, const string& text) { + nf_standard_blue_font.draw(target, x, y, "%s", text.c_str()); } void ResetFullscreen() { @@ -639,7 +653,8 @@ void ResetFullscreen() { } DrawIMG(background, screen, 0, 0); #else - SDL_WM_ToggleFullScreen(screen); //Will only work in Linux + //TODO: Find SDL2 alternative + //SDL_WM_ToggleFullScreen(screen); //Will only work in Linux #endif SDL_ShowCursor(SDL_DISABLE); } @@ -709,14 +724,10 @@ class ballManeger { public: aBall ballArray[maxNumberOfBalls]; bool ballUsed[maxNumberOfBalls]; - //The old ball information is also saved so balls can be deleted! - aBall oldBallArray[maxNumberOfBalls]; - bool oldBallUsed[maxNumberOfBalls]; ballManeger() { for (int i=0; i800 || ballArray[i].getX()>xsize || ballArray[i].getX()<-ballSize) { ballUsed[i] = false; } } - else { - oldBallUsed[i] = false; - } } } //update @@ -807,14 +813,10 @@ class explosionManeger { public: anExplosion explosionArray[maxNumberOfBalls]; bool explosionUsed[maxNumberOfBalls]; - //The old explosion information is also saved so explosions can be deleted! - anExplosion oldExplosionArray[maxNumberOfBalls]; - bool oldExplosionUsed[maxNumberOfBalls]; explosionManeger() { for (int i=0; iw, topy + backBoard->h); + } + + void PrintTextCenteredBoard(int x, int y, const char* text) { + nf_button_font.drawCenter(x+topx+60, y+topy+10, "%s", text); } int GetTopX() const { @@ -1025,21 +1013,17 @@ public: Mix_PlayChannel(1, applause, 0); } private: - void convertSurface() { - SDL_FreeSurface(sBoard); - sBoard = SDL_DisplayFormat(backBoard); - } //Draws all the bricks to the board (including garbage) void PaintBricks() const { for (int i=0; ((i<13)&&(i<30)); i++) for (int j=0; j<6; j++) { if ((board[j][i]%10 != -1) && (board[j][i]%10 < 7) && ((board[j][i]/1000000)%10==0)) { - DrawIMG(bricks[board[j][i]%10], sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(bricks[board[j][i]%10], j*bsize, bsize*12-i*bsize-pixels); if ((board[j][i]/BLOCKWAIT)%10==1) { - DrawIMG(bomb[(ticks/BOMBTIME)%2], sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoard(bomb[(ticks/BOMBTIME)%2], j*bsize, bsize*12-i*bsize-pixels); } if ((board[j][i]/BLOCKHANG)%10==1) { - DrawIMG(ready[(ticks/READYTIME)%2], sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(ready[(ticks/READYTIME)%2], j*bsize, bsize*12-i*bsize-pixels); } } @@ -1071,51 +1055,51 @@ private: under = board[j][i-1]; } if ((left == number)&&(right == number)&&(over == number)&&(under == number)) { - DrawIMG(garbageFill, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageFill, j*bsize, bsize*12-i*bsize-pixels); } if ((left != number)&&(right == number)&&(over == number)&&(under == number)) { - DrawIMG(garbageL, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageL, j*bsize, bsize*12-i*bsize-pixels); } if ((left == number)&&(right != number)&&(over == number)&&(under == number)) { - DrawIMG(garbageR, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageR, j*bsize, bsize*12-i*bsize-pixels); } if ((left == number)&&(right == number)&&(over != number)&&(under == number)) { - DrawIMG(garbageT, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageT, j*bsize, bsize*12-i*bsize-pixels); } if ((left == number)&&(right == number)&&(over == number)&&(under != number)) { - DrawIMG(garbageB, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageB, j*bsize, bsize*12-i*bsize-pixels); } if ((left != number)&&(right == number)&&(over != number)&&(under == number)) { - DrawIMG(garbageTL, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageTL, j*bsize, bsize*12-i*bsize-pixels); } if ((left != number)&&(right == number)&&(over == number)&&(under != number)) { - DrawIMG(garbageBL, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageBL, j*bsize, bsize*12-i*bsize-pixels); } if ((left == number)&&(right != number)&&(over != number)&&(under == number)) { - DrawIMG(garbageTR, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageTR, j*bsize, bsize*12-i*bsize-pixels); } if ((left == number)&&(right != number)&&(over == number)&&(under != number)) { - DrawIMG(garbageBR, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageBR, j*bsize, bsize*12-i*bsize-pixels); } if ((left == number)&&(right != number)&&(over != number)&&(under != number)) { - DrawIMG(garbageMR, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageMR, j*bsize, bsize*12-i*bsize-pixels); } if ((left == number)&&(right == number)&&(over != number)&&(under != number)) { - DrawIMG(garbageM, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageM, j*bsize, bsize*12-i*bsize-pixels); } if ((left != number)&&(right == number)&&(over != number)&&(under != number)) { - DrawIMG(garbageML, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageML, j*bsize, bsize*12-i*bsize-pixels); } } if ((board[j][i]/1000000)%10==2) { if (j==0) { - DrawIMG(garbageGML, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageGML, j*bsize, bsize*12-i*bsize-pixels); } else if (j==5) { - DrawIMG(garbageGMR, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageGMR, j*bsize, bsize*12-i*bsize-pixels); } else { - DrawIMG(garbageGM, sBoard, j*bsize, bsize*12-i*bsize-pixels); + DrawImgBoardBounded(garbageGM, j*bsize, bsize*12-i*bsize-pixels); } } } @@ -1151,7 +1135,7 @@ private: under = board[j][i-1]; } if (((left != number)&&(right == number)&&(over != number)&&(under == number))&&(garbageSize>0)) { - DrawIMG(smiley[board[j][i]%4], sBoard, 2*bsize, 12*bsize-i*bsize-pixels+(bsize/2)*garbageSize); + DrawImgBoardBounded(smiley[board[j][i]%4], 2*bsize, 12*bsize-i*bsize-pixels+(bsize/2)*garbageSize); } if (!((left != number)&&(right == number)&&(over == number)&&(under == number))) { //not in garbage garbageSize=0; @@ -1162,68 +1146,81 @@ private: } } - for (int i=0; i<6; i++) + for (int i=0; i<6; i++) { if (board[i][0]!=-1) { - DrawIMG(transCover, sBoard, i*bsize, 12*bsize-pixels); //Make the appering blocks transperant + DrawImgBoardBounded(transCover, i*bsize, 12*bsize-pixels); //Make the appering blocks transperant } + } } public: //Draws everything void DoPaintJob() { - DrawIMG(backBoard, sBoard, 0, 0); - nf_standard_blue_font.setDest(sBoard); //reset to screen at the end of this funciton! + DrawIMG(boardBackBack,screen,this->GetTopX()-60,this->GetTopY()-68); + + nf_scoreboard_font.draw(this->GetTopX()+310,this->GetTopY()-68+148,_("Score:") ); + nf_scoreboard_font.draw(this->GetTopX()+310,this->GetTopY()-68+197,_("Time:") ); + nf_scoreboard_font.draw(this->GetTopX()+310,this->GetTopY()-68+246,_("Chain:") ); + nf_scoreboard_font.draw(this->GetTopX()+310,this->GetTopY()-68+295,_("Speed:") ); + DrawImgBoard(backBoard, 0, 0); + nf_standard_blue_font.setDest(screen); //reset to screen at the end of this funciton! PaintBricks(); if (stageClear) { - DrawIMG(blackLine, sBoard, 0, bsize*(12+2)+bsize*(stageClearLimit-linesCleared)-pixels-1); + DrawImgBoard(blackLine, 0, bsize*(12+2)+bsize*(stageClearLimit-linesCleared)-pixels-1); } if (puzzleMode&&(!bGameOver)) { //We need to write nr. of moves left! strHolder = "Moves left: " + itoa(MovesLeft); - nf_standard_blue_font.draw(5,5, "%s",strHolder.c_str()); + nf_standard_blue_font.draw(topx+5, topy+5, "%s",strHolder.c_str()); } if (puzzleMode && stageButtonStatus == SBpuzzleMode) { - DrawIMG(bRetry,sBoard, cordRetryButton.x, cordRetryButton.y); + DrawImgBoard(bRetry, cordRetryButton.x, cordRetryButton.y); + PrintTextCenteredBoard(cordRetryButton.x, cordRetryButton.y, _("Retry")); if (LevelisShuttingDown()) { DrawIMG(dialogBox,screen,x,y); @@ -1394,8 +1386,7 @@ bool OpenDialogbox(int x, int y, std::string& name) { //Draws the highscores void DrawHighscores(int x, int y, bool endless) { - MakeBackground(xsize,ysize); - DrawIMG(background,screen,0,0); + DrawIMG(backgroundImage,screen,0,0); if (endless) { nf_standard_blue_font.draw(x+100,y+100, "%s",_("Endless:") ); } @@ -1423,8 +1414,7 @@ void DrawHighscores(int x, int y, bool endless) { } void DrawStats() { - MakeBackground(xsize,ysize); - DrawIMG(background,screen,0,0); + DrawIMG(backgroundImage,screen,0,0); int y = 5; const int y_spacing = 30; NFont_Write(screen, 10,y,_("Stats") ); @@ -1514,13 +1504,15 @@ void OpenScoresDisplay() { //Draw buttons: DrawIMG(bHighScore,screen,scoreX,scoreY); DrawIMG(bBack,screen,backX,backY); + nf_button_font.drawCenter(backX+60,backY+10,_("Back")); DrawIMG(bNext,screen,nextX,nextY); + nf_button_font.drawCenter(nextX+60,nextY+10,_("Next")); //Draw page number string pageXofY = (boost::format(_("Page %1% of %2%") )%(page+1)%numberOfPages).str(); NFont_Write(screen, xsize/2-nf_standard_blue_font.getWidth( "%s", pageXofY.c_str())/2,ysize-60,pageXofY.c_str()); - SDL_Delay(10); + SDL_Delay(1); SDL_Event event; SDL_GetMouseState(&mousex,&mousey); @@ -1617,12 +1609,12 @@ bool OpenFileDialogbox(int x, int y, char* name) { string homeFolder = (string)getenv("HOME")+(string)"/.gamesaves/blockattack/puzzles"; lf.setDirectory2(homeFolder.c_str()); #endif - MakeBackground(xsize,ysize); - DrawIMG(background,screen,0,0); - DrawIMG(bForward,background,x+460,y+420); - DrawIMG(bBack,background,x+20,y+420); while (!done && !Config::getInstance()->isShuttingDown()) { - DrawIMG(background,screen,0,0); + DrawIMG(backgroundImage,screen,0,0); + DrawIMG(bForward,screen,x+460,y+420); + nf_button_font.drawCenter(x+20+60, y+420+10, _("Forward")); + DrawIMG(bBack,screen,x+20,y+420); + nf_button_font.drawCenter(x+20+60, y+420+10, _("Back")); const int nrOfFiles = 10; DrawIMG(changeButtonsBack,screen,x,y); for (int i=0; isBoard,screen,theGame->GetTopX(),theGame->GetTopY()); + DrawIMG(backgroundImage,screen,0,0); + theGame->DoPaintJob(); + theGame2->DoPaintJob(); string strHolder; strHolder = itoa(theGame->GetScore()+theGame->GetHandicap()); NFont_Write(screen, theGame->GetTopX()+310,theGame->GetTopY()+100,strHolder.c_str()); @@ -1863,9 +1823,6 @@ void DrawEverything(int xsize, int ysize,BlockGameSdl* theGame, BlockGameSdl* th NFont_Write(screen, theGame2->GetTopX()+7,y+160,( _("Push line: ")+getKeyName(keySettings[0].push) ).c_str() ); } } - else { - DrawIMG(theGame2->sBoard,screen,theGame2->GetTopX(),theGame2->GetTopY()); - } strHolder = itoa(theGame2->GetScore()+theGame2->GetHandicap()); NFont_Write(screen, theGame2->GetTopX()+310,theGame2->GetTopY()+100,strHolder.c_str()); if (theGame2->GetAIenabled()) { @@ -1940,39 +1897,13 @@ void DrawEverything(int xsize, int ysize,BlockGameSdl* theGame, BlockGameSdl* th } //NFont_Write(screen, 800,4,FPS); - nf_standard_blue_font.draw(800,4,FPS); + nf_standard_blue_font.draw(800, 4, "%s", FPS); #endif //SDL_Flip(screen); Update screen is now called outside DrawEvrything, bacause the mouse needs to be painted } -//Generates the standard background -static void MakeBackground(int xsize,int ysize) { - int w = backgroundImage->w; - int h = backgroundImage->h; - for (int i=0; i*wGetTopX()-60,theGame->GetTopY()-68); - DrawIMG(boardBackBack,background,theGame2->GetTopX()-60,theGame2->GetTopY()-68); - standardBackground = false; -} - -static void MakeBackground(int xsize, int ysize, BlockGameSdl* theGame) { - MakeBackground(xsize,ysize); - DrawIMG(boardBackBack,background,theGame->GetTopX()-60,theGame->GetTopY()-68); - standardBackground = false; -} - - //The function that allows the player to choose PuzzleLevel int PuzzleLevelSelect(int Type) { const int xplace = 200; @@ -1997,7 +1928,6 @@ int PuzzleLevelSelect(int Type) { //Keeps track of background; SDL_GetTicks(); - MakeBackground(xsize,ysize); if (Type == 0) { nrOfLevels = PuzzleGetNumberOfPuzzles(); } @@ -2048,7 +1978,7 @@ int PuzzleLevelSelect(int Type) { SDL_GetTicks(); - DrawIMG(background, screen, 0, 0); + DrawIMG(backgroundImage, screen, 0, 0); DrawIMG(iCheckBoxArea,screen,xplace,yplace); if (Type == 0) { NFont_Write(screen, xplace+12,yplace+2,_("Select Puzzle") ); @@ -2173,153 +2103,10 @@ int PuzzleLevelSelect(int Type) { SDL_Flip(screen); //draws it all to the screen } - DrawIMG(background, screen, 0, 0); + DrawIMG(backgroundImage, screen, 0, 0); return levelNr; } - -//The function that allows the player to choose Level number -void startVsMenu() { - const int xplace = 200; - const int yplace = 100; - int mousex, mousey; - bool done = false; - - //Keeps track of background; - //int nowTime=SDL_GetTicks(); - - MakeBackground(xsize,ysize); - NFont_Write(background, 360,650, _("Press ESC to accept") ); - DrawIMG(bBack,background,xsize/2-120/2,600); - do { - //nowTime=SDL_GetTicks(); - DrawIMG(background, screen, 0, 0); - DrawIMG(changeButtonsBack,screen,xplace,yplace); - NFont_Write(screen, xplace+50,yplace+20,"Player 1"); - NFont_Write(screen, xplace+300+50,yplace+20,"Player 2"); - NFont_Write(screen, xplace+50,yplace+70,"Speed:"); - NFont_Write(screen, xplace+50+300,yplace+70,"Speed:"); - for (int i=0; i<5; i++) { - char levelS[2]; //level string; - levelS[0]='1'+i; - levelS[1]=0; - NFont_Write(screen, xplace+50+i*40,yplace+110,levelS); - DrawIMG(iLevelCheckBox,screen,xplace+50+i*40,yplace+150); - if (player1Speed==i) { - DrawIMG(iLevelCheck,screen,xplace+50+i*40,yplace+150); - } - } - for (int i=0; i<5; i++) { - char levelS[2]; //level string; - levelS[0]='1'+i; - levelS[1]=0; - NFont_Write(screen, xplace+300+50+i*40,yplace+110,levelS); - DrawIMG(iLevelCheckBox,screen,xplace+300+50+i*40,yplace+150); - if (player2Speed==i) { - DrawIMG(iLevelCheck,screen,xplace+300+50+i*40,yplace+150); - } - } - NFont_Write(screen, xplace+50,yplace+200,"AI: "); - DrawIMG(iLevelCheckBox,screen,xplace+50+70,yplace+200); - if (player1AI) { - DrawIMG(iLevelCheck,screen,xplace+50+70,yplace+200); - } - NFont_Write(screen, xplace+50,yplace+250,"TT Handicap: "); - NFont_Write(screen, xplace+50+300,yplace+200,"AI: "); - DrawIMG(iLevelCheckBox,screen,xplace+50+70+300,yplace+200); - if (player2AI) { - DrawIMG(iLevelCheck,screen,xplace+50+70+300,yplace+200); - } - NFont_Write(screen, xplace+50+300,yplace+250,"TT Handicap: "); - for (int i=0; i<5; i++) { - char levelS[2]; //level string; - levelS[0]='1'+i; - levelS[1]=0; - NFont_Write(screen, xplace+50+i*40,yplace+290,levelS); - DrawIMG(iLevelCheckBox,screen,xplace+50+i*40,yplace+330); - if (player1handicap==i) { - DrawIMG(iLevelCheck,screen,xplace+50+i*40,yplace+330); - } - } - for (int i=0; i<5; i++) { - char levelS[2]; //level string; - levelS[0]='1'+i; - levelS[1]=0; - NFont_Write(screen, xplace+50+i*40+300,yplace+290,levelS); - DrawIMG(iLevelCheckBox,screen,xplace+50+i*40+300,yplace+330); - if (player2handicap==i) { - DrawIMG(iLevelCheck,screen,xplace+50+i*40+300,yplace+330); - } - } - - SDL_Event event; - while ( SDL_PollEvent(&event) ) { - if ( event.type == SDL_KEYDOWN ) { - if ( event.key.keysym.sym == SDLK_ESCAPE ) { - done = true; - } - if ( event.key.keysym.sym == SDLK_RETURN ) { - done = true; - } - if ( event.key.keysym.sym == SDLK_KP_ENTER ) { - done = true; - } - } - } - - SDL_GetKeyState(nullptr); - - SDL_GetMouseState(&mousex,&mousey); - - // If the mouse button is released, make bMouseUp equal true - if (!SDL_GetMouseState(nullptr, nullptr)&SDL_BUTTON(1)) { - bMouseUp=true; - } - - if (SDL_GetMouseState(nullptr,nullptr)&SDL_BUTTON(1) && bMouseUp) { - bMouseUp = false; - - if ((mousex>xplace+50+70)&&(mousey>yplace+200)&&(mousexxplace+50+70+300)&&(mousey>yplace+200)&&(mousexxplace+50+i*40)&&(mousexyplace+150)&&(mouseyxplace+50+i*40+300)&&(mousexyplace+150)&&(mouseyxplace+50+i*40)&&(mousexyplace+330)&&(mouseyxplace+50+i*40+300)&&(mousexyplace+330)&&(mouseyxsize/2-120/2)&&(mousex600)&&(mousey<640)) { - done = true; - } - } - - //DrawIMG(mouse,screen,mousex,mousey); - mouse->PaintTo(screen,mousex,mousey); - SDL_Flip(screen); //draws it all to the screen - SDL_Delay(10); - - } - while (!done && !Config::getInstance()->isShuttingDown()); - DrawIMG(background, screen, 0, 0); -} - //This function will promt for the user to select another file for puzzle mode void changePuzzleLevels() { char theFileName[30]; @@ -2385,8 +2172,7 @@ static int StartSinglePlayerPuzzle(int level) { return 1; } player1->NewPuzzleGame(myLevel,SDL_GetTicks()); - MakeBackground(xsize,ysize,player1,player2); - DrawIMG(background, screen, 0, 0); + DrawIMG(backgroundImage, screen, 0, 0); twoPlayers = false; player2->SetGameOver(); //vsMode = true; @@ -2479,12 +2265,9 @@ int main(int argc, char* argv[]) { textdomain (PACKAGE); if (argc > 1) { int argumentNr = 1; - forceredraw = 2; while (argc>argumentNr) { const char helpString[] = "--help"; const char priorityString[] = "-priority"; - const char forceRedrawString[] = "-forceredraw"; - const char forcepartdrawString[] = "-forcepartdraw"; const char singlePuzzleString[] = "-SP"; const char noSoundAtAll[] = "-nosound"; const char selectTheme[] = "-theme"; @@ -2492,8 +2275,6 @@ int main(int argc, char* argv[]) { if (strequals(argv[argumentNr],helpString)) { cout << "Block Attack Help" << endl << helpString << " " << _("Displays this message") << endl << "-priority " << _("Starts game in high priority") << endl << - "-forceredraw " << _("Redraw the whole screen every frame, prevents garbage") << endl << - "-forcepartdraw " << _("Only draw what is changed, sometimes cause garbage") << endl << "-nosound " << _("No sound will be played at all, and sound hardware will not be loaded (use this if game crashes because of sound)") << endl << "-theme <" << _("THEMENAME") << "> " << _("Changes to the theme on startup") << endl; #ifdef WIN32 @@ -2507,12 +2288,6 @@ int main(int argc, char* argv[]) { } highPriority = true; } - if (strequals(argv[argumentNr],forceRedrawString)) { - forceredraw = 1; - } - if (strequals(argv[argumentNr],forcepartdrawString)) { - forceredraw = 2; - } if (strequals(argv[argumentNr],singlePuzzleString)) { singlePuzzle = true; //We will just have one puzzle if (argv[argumentNr+1][1]!=0) { @@ -2775,8 +2550,6 @@ int main(int argc, char* argv[]) { theGame2.GetTopY()=10000; theGame2.GetTopX()=10000; }*/ - theGame.DoPaintJob(); //Makes sure what there is something to paint - theGame2.DoPaintJob(); theGame.SetGameOver(); //sets the game over in the beginning theGame2.SetGameOver(); @@ -2789,14 +2562,7 @@ int main(int argc, char* argv[]) { LoadPuzzleStages(); theGame.NewPuzzleGame(singlePuzzleNr, SDL_GetTicks()); } - //Draws everything to screen - if (!editorMode) { - MakeBackground(xsize,ysize,&theGame,&theGame2); - } - else { - MakeBackground(xsize,ysize,&theGame); - } - DrawIMG(background, screen, 0, 0); + DrawIMG(backgroundImage, screen, 0, 0); DrawEverything(xsize,ysize,&theGame,&theGame2); SDL_Flip(screen); //game loop @@ -2917,16 +2683,6 @@ int runGame(int gametype, int level) { LoadPuzzleStages(); theGame.NewPuzzleGame(singlePuzzleNr, SDL_GetTicks()); } - //Draws everything to screen - if (!editorMode) { - MakeBackground(xsize,ysize,&theGame,&theGame2); - } - else { - MakeBackground(xsize,ysize,&theGame); - } - /*DrawIMG(background, screen, 0, 0); - DrawEverything(xsize,ysize,&theGame,&theGame2); - SDL_Flip(screen);*/ //game loop int done = 0; if (verboseLevel) { @@ -2952,8 +2708,7 @@ int runGame(int gametype, int level) { return 1; } theGame.NewStageGame(myLevel,SDL_GetTicks()); - MakeBackground(xsize,ysize,&theGame,&theGame2); - DrawIMG(background, screen, 0, 0); + DrawIMG(backgroundImage, screen, 0, 0); twoPlayers =false; theGame2.SetGameOver(); theGame.name = player1name; @@ -2970,8 +2725,7 @@ int runGame(int gametype, int level) { int theAIlevel = level; //startSingleVs(); theGame.NewVsGame(&theGame2, SDL_GetTicks()); theGame2.NewVsGame(&theGame, SDL_GetTicks()); - MakeBackground(xsize,ysize,&theGame,&theGame2); - DrawIMG(background, screen, 0, 0); + DrawIMG(backgroundImage, screen, 0, 0); twoPlayers = true; //Single player, but AI plays theGame2.setAIlevel((Uint8)theAIlevel); int theTime = time(0); @@ -2993,25 +2747,15 @@ int runGame(int gametype, int level) { break; }; mustsetupgame = false; - DrawIMG(background, screen, 0, 0); + DrawIMG(backgroundImage, screen, 0, 0); DrawEverything(xsize,ysize,&theGame,&theGame2); SDL_Flip(screen); } if (!(highPriority)) { - SDL_Delay(10); - } - - if ((standardBackground)&&(!editorMode)) { - MakeBackground(xsize,ysize,&theGame,&theGame2); - DrawIMG(background, screen, 0, 0); - } - - if ((standardBackground)&&(editorMode)) { - DrawIMG(backgroundImage, screen, 0, 0); - MakeBackground(xsize,ysize,&theGame); - DrawIMG(background, screen, 0, 0); + SDL_Delay(1); } + DrawIMG(backgroundImage, screen, 0, 0); //updates the balls and explosions: theBallManeger.update(); @@ -3030,7 +2774,7 @@ int runGame(int gametype, int level) { if ( event.type == SDL_KEYDOWN ) { if ( event.key.keysym.sym == SDLK_ESCAPE || ( event.key.keysym.sym == SDLK_RETURN && theGame.isGameOver() ) ) { done=1; - DrawIMG(background, screen, 0, 0); + DrawIMG(backgroundImage, screen, 0, 0); } if ((!editorMode)&&(!editorModeTest)&&(!theGame.GetAIenabled())) { @@ -3436,7 +3180,7 @@ int runGame(int gametype, int level) { //read mouse events if (SDL_GetMouseState(nullptr,nullptr)&SDL_BUTTON(1) && bMouseUp) { bMouseUp = false; - DrawIMG(background, screen, 0, 0); + DrawIMG(backgroundImage, screen, 0, 0); /******************************************************************** diff --git a/source/code/mainVars.hpp b/source/code/mainVars.hpp index 13d8066..578328e 100644 --- a/source/code/mainVars.hpp +++ b/source/code/mainVars.hpp @@ -36,7 +36,6 @@ http://blockattack.sf.net const char sharedir[] = SHAREDIR; //All graphic in the game (as pointers): -static SDL_Surface *background; //Stores background SDL_Surface *backgroundImage; //Stores the background image static SDL_Surface *backBoard; //Stores the background to the board static std::shared_ptr bNewGame; //The New Game botton @@ -215,7 +214,7 @@ static int oldMousex, oldMousey; static int oldBubleX, oldBubleY; //bool doublebuf = false; //if true, screen is double buffered -static char forceredraw; //If 1: always redraw, if 2: rarely redraw +static char forceredraw = 1; //If 1: always redraw, if 2: rarely redraw static bool singlePuzzle = false; //if true we are just in a little 300x600 window static int singlePuzzleNr = 0; diff --git a/source/code/menudef.cpp b/source/code/menudef.cpp index 6fca97d..36d33cc 100644 --- a/source/code/menudef.cpp +++ b/source/code/menudef.cpp @@ -187,7 +187,7 @@ static void buttonActionHighscores(Button* b) { } static void ChangeKeysMenu(long playernumber) { - Menu km(&screen,_("Change key bindings"),true); + Menu km(screen,_("Change key bindings"),true); Button_changekey bLeft(&keySettings[playernumber].left,_("Left") ); Button_changekey bRight(&keySettings[playernumber].right,_("Right") ); Button_changekey bUp(&keySettings[playernumber].up,_("Up") ); @@ -212,7 +212,7 @@ static void ChangeKeysMenu2(Button* b) { } static void ConfigureMenu(Button* b) { - Menu cm(&screen,_("Configuration"),true); + Menu cm(screen,_("Configuration"),true); Button bMusic,bSound,buttonFullscreen,bPlayer1Name,bPlayer2Name; Button bPlayer1Keys, bPlayer2Keys; bMusic.setLabel(MusicEnabled? _("Music: On") : _("Music: Off") ); @@ -240,7 +240,7 @@ static void ConfigureMenu(Button* b) { } static void SinglePlayerVsMenu(Button* b) { - Menu spvs(&screen,_("Single player VS"),true); + Menu spvs(screen,_("Single player VS"),true); Button d1,d2,d3,d4,d5,d6,d7; d1.setAction(runSinglePlayerVs); d2.setAction(runSinglePlayerVs); @@ -281,7 +281,7 @@ static void SinglePlayerVsMenu(Button* b) { } static void MultiplayerMenu(Button* b) { - Menu mm(&screen,_("Multiplayer"),true); + Menu mm(screen,_("Multiplayer"),true); Button bTT, bVs, bNet; bTT.setLabel(_("Two player - time trial")); bTT.setAction(runTwoPlayerTimeTrial); @@ -294,7 +294,7 @@ static void MultiplayerMenu(Button* b) { void MainMenu() { InitMenues(); - Menu m(&screen,_("Block Attack - Rise of the blocks"),false); + Menu m(screen,_("Block Attack - Rise of the blocks"),false); Button bHi,bTimetrial1, bStageClear, bPuzzle, bVs1, bMulti, bConfigure,bHighscore; bHi.setLabel(_("Single player - endless") ); bHi.setAction(runSinglePlayerEndless);