Compare commits
179 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 944784b329 | |||
| df4c1366fe | |||
| 1ee1ea560b | |||
| 5c7f72253c | |||
| e2e41cf435 | |||
| 674323d445 | |||
| f4e2c11f1b | |||
| 1b130feb85 | |||
| 5f3ecbbd79 | |||
| 250efd69bf | |||
| 7cd5fec3f8 | |||
| 8e612aaa2e | |||
| 2d045642ff | |||
| 01dff96fdc | |||
| 62d1a566c0 | |||
| 39016a3912 | |||
| 866cb56f1b | |||
| 6de3050255 | |||
| f602b5ff7a | |||
| c34b4d8944 | |||
| c835f943b5 | |||
| 9b265c6cca | |||
| 6a526df9b3 | |||
| 3def97bcb8 | |||
| 0a07edcb5c | |||
| 62d90a605f | |||
| d718e20767 | |||
| 20c63c7ef5 | |||
| a68ffa8e21 | |||
| 693939a6d5 | |||
| 031e4b99f4 | |||
| 1a095d292f | |||
| d51d564642 | |||
| bafde2a778 | |||
| 7dcc1d7809 | |||
| 38aadb984d | |||
| e259313cc9 | |||
| c49323cfdf | |||
| 619acbc9b4 | |||
| e39806f1a3 | |||
| e2618f40db | |||
| 97a6ba474f | |||
| 07054544e4 | |||
| 99f6ea7dd4 | |||
| 45b75dc75f | |||
| a4fd00794d | |||
| ee261f4509 | |||
| eb713006c6 | |||
| a07eeff6e4 | |||
| cce0ccba76 | |||
| 0ea7eb0b9c | |||
| 4a2d27dc59 | |||
| 71be364141 | |||
| 16cc725cb3 | |||
| a05dbc7581 | |||
| 2db0b43d23 | |||
| d6c100379e | |||
| 22e8579337 | |||
| d0c0715640 | |||
| 38e0573a0e | |||
| f259fbb3a5 | |||
| 663e1ed32e | |||
| b1887fe6da | |||
| 3fcf3b23e0 | |||
| 284f7d5bad | |||
| adab0b420c | |||
| 4f9d8bec42 | |||
| 31e657d138 | |||
| 8b3d257baf | |||
| d1143b9dfe | |||
| 68ebff722e | |||
| 3be9d4459c | |||
| 76e928e21d | |||
| 9c6924d7bb | |||
| 5007bea835 | |||
| 5e7be1c2fb | |||
| faf2e69b63 | |||
| 4c3c844ccf | |||
| 48b8ae049a | |||
| c0d4eddde7 | |||
| f590101047 | |||
| c7fcbd0258 | |||
| b2061c86d2 | |||
| 510a6ca718 | |||
| ec8209265a | |||
| e963251fd9 | |||
| a2f1efd2a6 | |||
| 8959b7bcce | |||
| 4d8bb46a52 | |||
| 2abde36a5e | |||
| 0a083af712 | |||
| f322b1b81b | |||
| 13fe98edb3 | |||
| c90b49c8be | |||
| d3a5c0e54f | |||
| 254ff50ef3 | |||
| e551206351 | |||
| b22e830dac | |||
| a81d42cb25 | |||
| 3ea0025fb4 | |||
| d7c49a0578 | |||
| 4cbe55c2d4 | |||
| 564f316586 | |||
| 522ab8e726 | |||
| 4911282777 | |||
| 06ecabc676 | |||
| 5d89a3057e | |||
| 75228cc451 | |||
| 357eec20b1 | |||
| 62c1e2715e | |||
| 34fc2b6b06 | |||
| 6557dea2bb | |||
| 2caea7ba6e | |||
| d33d2e4a09 | |||
| d9174dcdb9 | |||
| 22f7204e08 | |||
| 06fab0d457 | |||
| f180f88068 | |||
| 4109d6c938 | |||
| 9c2264ca75 | |||
| c59739c7ba | |||
| 4a430c0d5b | |||
| 5a7f637f4b | |||
| c63298b555 | |||
| 82aa91bead | |||
| f4129e109a | |||
| 5e8714697d | |||
| dd4355051f | |||
| 160b212a43 | |||
| 69d3b076d7 | |||
| 3817a01712 | |||
| ba19dcb904 | |||
| b035b92ff4 | |||
| 8c425f5698 | |||
| d382bb6403 | |||
| da64a5e082 | |||
| 7070dac482 | |||
| ea5360ea74 | |||
| 3aa4440390 | |||
| ce105e252e | |||
| 1aac5b7719 | |||
| a8b467290f | |||
| 706ad6f9c0 | |||
| 54d428ed96 | |||
| c71adfbac4 | |||
| c955543d31 | |||
| fae8e2d82c | |||
| ff7b825cbb | |||
| 09ed0105e9 | |||
| 07ae93fd3a | |||
| 72fb30b927 | |||
| 8d37f31a08 | |||
| e6fb412c4d | |||
| 10c29eb547 | |||
| 1f9e36dc93 | |||
| c114884de1 | |||
| d6a366555d | |||
| fd0d8a05fe | |||
| 79d610a7d9 | |||
| 9060e1c92a | |||
| 0d586c0827 | |||
| fd0bebf533 | |||
| 2665b93b70 | |||
| c35be7d21c | |||
| bc84968b23 | |||
| 1b49097f80 | |||
| 859e3f3b44 | |||
| 3fa7657c79 | |||
| e90c61a416 | |||
| d003b51de4 | |||
| 8d381010c8 | |||
| 2216c9632e | |||
| fdc8797d2b | |||
| 90bdad7d51 | |||
| d50b193d9f | |||
| ee885d5ca7 | |||
| bb3a0f263b | |||
| 85d6c48f42 | |||
| 896dd9daef |
7
.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
.vscode
|
||||
*config.txt
|
||||
*data/config/config.txt
|
||||
*stats.txt
|
||||
*.DS_Store
|
||||
thumbs.db
|
||||
@@ -10,4 +10,7 @@ thumbs.db
|
||||
*.tar.gz
|
||||
*.zip
|
||||
*.app
|
||||
*_debug
|
||||
*_debug*
|
||||
sync_jail_engine.sh
|
||||
jaildoctors_dilemma*
|
||||
todo
|
||||
233
LICENSE
@@ -1,232 +1 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
“This License” refers to version 3 of the GNU General Public License.
|
||||
|
||||
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
||||
|
||||
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
||||
|
||||
A “covered work” means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
||||
|
||||
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
||||
|
||||
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
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 state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program 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, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU 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 Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
GNU General Public License v3.0 only
|
||||
85
Makefile
@@ -1,8 +1,8 @@
|
||||
executable = jaildoctors_dilemma
|
||||
source = source/*.cpp source/common/*.cpp
|
||||
source = source/*.cpp source/jail_engine/*.cpp
|
||||
appName = JailDoctor's Dilemma
|
||||
releaseFolder = jdd_release
|
||||
version = v1.04
|
||||
version = v1.08
|
||||
|
||||
# Release names
|
||||
windowsRelease = $(executable)-$(version)-win32-x64.zip
|
||||
@@ -12,34 +12,33 @@ linuxRelease = $(executable)-$(version)-linux.tar.gz
|
||||
|
||||
windows:
|
||||
@echo off
|
||||
g++ $(source) -D DEBUG -std=c++11 -Wall -Os -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o $(executable).exe
|
||||
strip -s -R .comment -R .gnu.version $(executable).exe --strip-unneeded
|
||||
g++ $(source) -std=c++11 -Wall -Os -lmingw32 -lws2_32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(executable).exe"
|
||||
strip -s -R .comment -R .gnu.version "$(executable).exe" --strip-unneeded
|
||||
|
||||
windows_debug:
|
||||
@echo off
|
||||
g++ $(source) -D DEBUG -std=c++11 -Wall -Os -lmingw32 -lws2_32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(executable)_debug.exe"
|
||||
strip -s -R .comment -R .gnu.version "$(executable)_debug.exe" --strip-unneeded
|
||||
|
||||
windows_release:
|
||||
@echo off
|
||||
|
||||
# Remove data
|
||||
powershell if (Test-Path $(releaseFolder)) {Remove-Item $(releaseFolder) -Recurse -Force}
|
||||
# Create release folder
|
||||
powershell if (Test-Path "$(releaseFolder)") {Remove-Item "$(releaseFolder)" -Recurse -Force}
|
||||
powershell if (-not (Test-Path "$(releaseFolder)")) {New-Item "$(releaseFolder)" -ItemType Directory}
|
||||
|
||||
# Create folders
|
||||
powershell if (-not (Test-Path $(releaseFolder))) {New-Item $(releaseFolder) -ItemType Directory}
|
||||
|
||||
# Copy data
|
||||
# Prepare data folder
|
||||
powershell Copy-Item -Path "data" -Destination "$(releaseFolder)" -recurse -Force
|
||||
powershell Copy-Item "LICENSE" -Destination "$(releaseFolder)"
|
||||
powershell Copy-Item "README.md" -Destination "$(releaseFolder)"
|
||||
powershell Copy-Item "release/SDL2.dll" -Destination "$(releaseFolder)"
|
||||
|
||||
# Remove data
|
||||
powershell if (Test-Path "$(releaseFolder)\data\room\map.world") {Remove-Item "$(releaseFolder)\data\room\map.world" -Recurse -Force}
|
||||
powershell if (Test-Path "$(releaseFolder)\data\room\standard.tsx") {Remove-Item "$(releaseFolder)\data\room\standard.tsx" -Recurse -Force}
|
||||
powershell if (Test-Path "$(releaseFolder)\data\config") {Remove-Item "$(releaseFolder)\data\config" -Recurse -Force}
|
||||
|
||||
# Create data
|
||||
powershell if (-not (Test-Path "$(releaseFolder)\data\config")) {New-Item "$(releaseFolder)\data\config" -ItemType Directory}
|
||||
# Copy root files
|
||||
powershell Copy-Item "LICENSE" -Destination "$(releaseFolder)"
|
||||
powershell Copy-Item "README.md" -Destination "$(releaseFolder)"
|
||||
powershell Copy-Item "release\*.dll" -Destination "$(releaseFolder)"
|
||||
|
||||
# Build
|
||||
g++ $(source) -std=c++11 -Wall -Os -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(releaseFolder)/$(executable).exe"
|
||||
g++ $(source) -std=c++11 -Wall -Os -lmingw32 -lws2_32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(releaseFolder)/$(executable).exe"
|
||||
strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable).exe" --strip-unneeded
|
||||
|
||||
# Create ZIP
|
||||
@@ -47,13 +46,16 @@ windows_release:
|
||||
powershell Compress-Archive -Path "$(releaseFolder)"/* -DestinationPath $(windowsRelease)
|
||||
|
||||
# Remove folder
|
||||
powershell if (Test-Path $(releaseFolder)) {Remove-Item $(releaseFolder) -Recurse -Force}
|
||||
powershell if (Test-Path "$(releaseFolder)") {Remove-Item "$(releaseFolder)" -Recurse -Force}
|
||||
|
||||
macos:
|
||||
clang++ $(source) -D DEBUG -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -o $(executable)_macos
|
||||
clang++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -o "$(executable)"
|
||||
|
||||
macos_debug:
|
||||
clang++ $(source) -D DEBUG -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -o "$(executable)_debug"
|
||||
|
||||
macos_release:
|
||||
# Remove data and possible data
|
||||
# Remove data and possible data from previous builds
|
||||
rm -rdf "$(releaseFolder)"
|
||||
rm -rdf Frameworks
|
||||
rm -f tmp.dmg
|
||||
@@ -74,10 +76,6 @@ macos_release:
|
||||
# Delete data
|
||||
rm -f "$(releaseFolder)/$(appName).app/Contents/Resources/data/room/map.world"
|
||||
rm -f "$(releaseFolder)/$(appName).app/Contents/Resources/data/room/standard.tsx"
|
||||
rm -rdf "$(releaseFolder)/$(appName).app/Contents/Resources/data/config"
|
||||
|
||||
# Create folders
|
||||
mkdir -p "$(releaseFolder)/$(appName).app/Contents/Resources/data/config"
|
||||
|
||||
# Copy files
|
||||
cp release/*.icns "$(releaseFolder)/$(appName).app/Contents/Resources"
|
||||
@@ -85,6 +83,9 @@ macos_release:
|
||||
cp LICENSE "$(releaseFolder)"
|
||||
cp README.md "$(releaseFolder)"
|
||||
|
||||
# Create links
|
||||
ln -s /Applications "$(releaseFolder)"/Applications
|
||||
|
||||
# Build INTEL
|
||||
clang++ $(source) -D MACOS_BUNDLE -std=c++11 -Wall -Os -framework SDL2 -F ./Frameworks -ffunction-sections -fdata-sections -o "$(releaseFolder)/$(appName).app/Contents/MacOS/$(executable)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12
|
||||
|
||||
@@ -106,36 +107,36 @@ macos_release:
|
||||
rm -rdf "$(releaseFolder)"
|
||||
|
||||
linux:
|
||||
g++ $(source) -D DEBUG -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o $(executable)_linux
|
||||
strip -s -R .comment -R .gnu.version $(executable)_linux --strip-unneeded
|
||||
g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(executable)"
|
||||
strip -s -R .comment -R .gnu.version "$(executable)" --strip-unneeded
|
||||
|
||||
linux_debug:
|
||||
g++ $(source) -D DEBUG -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(executable)_debug"
|
||||
strip -s -R .comment -R .gnu.version "$(executable)_debug" --strip-unneeded
|
||||
|
||||
linux_release:
|
||||
# Remove data
|
||||
rm -rdf $(releaseFolder)
|
||||
rm -rdf "$(releaseFolder)"
|
||||
|
||||
# Create folders
|
||||
mkdir -p $(releaseFolder)
|
||||
mkdir -p "$(releaseFolder)"
|
||||
|
||||
# Copy data
|
||||
cp -R data $(releaseFolder)
|
||||
cp LICENSE $(releaseFolder)
|
||||
cp README.md $(releaseFolder)
|
||||
cp -R data "$(releaseFolder)"
|
||||
cp LICENSE "$(releaseFolder)"
|
||||
cp README.md "$(releaseFolder)"
|
||||
|
||||
# Delete data
|
||||
rm -f "$(releaseFolder)/data/room/map.world"
|
||||
rm -f "$(releaseFolder)/data/room/standard.tsx"
|
||||
rm -rdf "$(releaseFolder)/data/config"
|
||||
|
||||
# Create folders
|
||||
mkdir -p "$(releaseFolder)/data/config"
|
||||
|
||||
# Build
|
||||
g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o $(releaseFolder)/$(executable)
|
||||
strip -s -R .comment -R .gnu.version $(releaseFolder)/$(executable) --strip-unneeded
|
||||
g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(releaseFolder)/$(executable)"
|
||||
strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable)" --strip-unneeded
|
||||
|
||||
# Pack files
|
||||
rm -f $(linuxRelease)
|
||||
cd $(releaseFolder) && tar -czvf ../$(linuxRelease) *
|
||||
rm -f "$(linuxRelease)"
|
||||
cd "$(releaseFolder)" && tar -czvf "../$(linuxRelease)" *
|
||||
|
||||
# Remove data
|
||||
rm -rdf $(releaseFolder)
|
||||
rm -rdf "$(releaseFolder)"
|
||||
58
README.md
@@ -1,37 +1,89 @@
|
||||
# JailDoctor's Dilemma
|
||||
|
||||
JailDoc es un Jailer. A los Jailers les gusta empezar proyectos. A nadie le gusta terminarlos. Los Jailers viven en la Jail. A la Jail va uno a empezar proyectos. A la Jail va uno a enseñar sus proyectos. A la Jail va uno a aprender como empezar nuevos proyectos. A la Jail va uno a ayudar a sus compañeros a que empiecen nuevos proyectos.
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
JailDoc es un Jailer destacado entre los Jailers. Tiene más proyectos empezados que nadie y es el que más ayuda a que los demas empiecen los suyos.
|
||||
|
||||
|
||||
|
||||
Un día, ocurrió algo. Alguien terminó un proyecto. Alguien liberó el *Puzzle Jail Facker*. Algún desaprensivo.
|
||||
|
||||
|
||||
|
||||
Esto hizo que JailDoc decidiera terminar y entregar uno de sus proyectos, pero, ¿cual? ¿JailBattle? ¿Sigmasuá? ¿Calculín Doom? Menudo dilema. JailDoc se arremangó y decidió finalizar y entregar todos sus proyectos inacabados. ¿Lo logrará?
|
||||
|
||||
|
||||
|
||||
## Jugabilidad
|
||||
|
||||
Ayuda a JailDoc a recuperar las partes de su proyecto que estan desperdigadas por cualquier lugar del Universo Jailer. Hay mas de **150 piezas** desperdigadas por **60 pantallas**. Algunas son un paseo, pero en otras tendras que calcular muy bien tus movimientos si no quieres acabar como un arounder del montón.
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
Cuando consigas recuperar gran parte de las piezas desperdigadas, dirigete a la Jail a mostrar a los Jailers como se termina un proyecto. Ten en cuenta que Bry no te dejará entrar. Solo aquellos que han realizado un *Fire Effect* o un *Facedor de Tornejos* son dignos de tal privilegio.
|
||||
|
||||
|
||||
|
||||
## Controles
|
||||
|
||||
El juego permite tanto el uso del teclado como de un mando de control. Las teclas para manejar el juego son las siguientes:
|
||||
|
||||
- **Cursores**: Para mover a izquierda o derecha a JailDoc y para saltar
|
||||
|
||||
|
||||
- **Cursores**: Para mover a izquierda o derecha a JailDoc y para saltar. En el fichero de configuración se pueden cambiar las teclas por otras opciones prefijadas: O, P para moverse y Q para saltar o A, D para moverse y W para saltar.
|
||||
|
||||
- **Tecla M**: Activa o desactiva la música
|
||||
|
||||
- **Tecla P**: Pone en pausa el juego
|
||||
|
||||
- **Tecla ESC**: Sale del juego si estas jugando. Sale del programa en cualquier otra circunstancia
|
||||
- **Tecla F**: Cambia a modo de pantalla completa o de ventana
|
||||
- **Teclas F1 a F4**: Cambian el tamaño de la ventana
|
||||
|
||||
- **Tecla F1**: Disminuye el tamaño de la ventana
|
||||
|
||||
- **Tecla F2**: Aumenta el tamaño de la ventana
|
||||
|
||||
- **Tecla F3**: Cambia entre el modo de pantalla completa y el de ventana
|
||||
|
||||
- **Tecla F5**: Cambia la paleta de colores del juego
|
||||
|
||||
- **Tecla B**: Activa o desactiva el borde de colores de la pantalla cuando el programa se ejecuta en modo de ventana
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
## Datos del programa
|
||||
El programa guarda automáticamente la configuración del modo de video y las estadísticas de juego en tu carpeta personal del sistema. Esta carpeta tiene una ubicación distinta en función del sistema operativo que utilices.
|
||||
|
||||
En **Windows** se encuentra en:
|
||||
`C:\Users\<nombre_de_usuario>\AppData\Roaming\jailgames\jaildoctors_dilemma`
|
||||
|
||||
En **MacOS** se encuentra en:
|
||||
`~/Library/Application Support/jailgames/jaildoctors_dilemma`
|
||||
|
||||
En **Linux** se encuentra en:
|
||||
`~/./jailgames/jaildoctors_dilemma`
|
||||
|
||||
En la carpeta está el fichero de configuración `config.txt` donde se puede modificar la configuración para conectarse al servicio online y los ficheros `stats.csv` y `stats_buffer.csv` con información de las estadisticas de juego.
|
||||
|
||||
## Agradecimientos
|
||||
|
||||
Agradecimientos como siempre a todos los Jailers por motivarme a hacer el juego y ayudarme en los momentos de duda a la hora de escribir el código. Y, como siempre, en especial a JailDoc por su unidad de Jail_Audio y cualquier otro código/ayuda/enseñanzas que haya necesitado para terminar el programa.
|
||||
|
||||
|
||||
|
||||
Si no me he descontado, este es el cuarto juego que consigo crear.
|
||||
|
||||
|
||||
|
||||
*13 de noviembre de 2022, JailDesigner*
|
||||
|
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
|
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
|
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 323 B |
|
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 378 B |
@@ -3,7 +3,7 @@ frameHeight=16
|
||||
|
||||
[animation]
|
||||
name=default
|
||||
speed=8
|
||||
speed=4
|
||||
loop=0
|
||||
frames=0,1,2,3
|
||||
frames=0,1,2,3,4,5,6,7
|
||||
[/animation]
|
||||
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |
|
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
BIN
data/font/gauntlet.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
194
data/font/gauntlet.txt
Normal file
@@ -0,0 +1,194 @@
|
||||
# box width
|
||||
8
|
||||
# box height
|
||||
8
|
||||
# 32 espacio ( )
|
||||
6
|
||||
# 33 !
|
||||
2
|
||||
# 34 "
|
||||
5
|
||||
# 35 #
|
||||
6
|
||||
# 36 $
|
||||
6
|
||||
# 37 %
|
||||
7
|
||||
# 38 &
|
||||
7
|
||||
# 39 '
|
||||
2
|
||||
# 40 (
|
||||
4
|
||||
# 41 )
|
||||
4
|
||||
# 42 *
|
||||
6
|
||||
# 43 +
|
||||
8
|
||||
# 44 ,
|
||||
2
|
||||
# 45 -
|
||||
7
|
||||
# 46 .
|
||||
2
|
||||
# 47 /
|
||||
7
|
||||
# 48 0
|
||||
7
|
||||
# 49 1
|
||||
6
|
||||
# 50 2
|
||||
6
|
||||
# 51 3
|
||||
6
|
||||
# 52 4
|
||||
7
|
||||
# 53 5
|
||||
6
|
||||
# 54 6
|
||||
6
|
||||
# 55 7
|
||||
6
|
||||
# 56 8
|
||||
6
|
||||
# 57 9
|
||||
6
|
||||
# 58 :
|
||||
2
|
||||
# 59 ;
|
||||
2
|
||||
# 60 <
|
||||
5
|
||||
# 61 =
|
||||
6
|
||||
# 62 >
|
||||
5
|
||||
# 63 ?
|
||||
6
|
||||
# 64 @
|
||||
6
|
||||
# 65 A
|
||||
6
|
||||
# 66 B
|
||||
7
|
||||
# 67 C
|
||||
7
|
||||
# 68 D
|
||||
7
|
||||
# 69 E
|
||||
7
|
||||
# 70 F
|
||||
7
|
||||
# 71 G
|
||||
7
|
||||
# 72 H
|
||||
6
|
||||
# 73 I
|
||||
6
|
||||
# 74 J
|
||||
7
|
||||
# 75 K
|
||||
7
|
||||
# 76 L
|
||||
7
|
||||
# 77 M
|
||||
7
|
||||
# 78 N
|
||||
7
|
||||
# 79 O
|
||||
7
|
||||
# 80 P
|
||||
7
|
||||
# 81 Q
|
||||
7
|
||||
# 82 R
|
||||
7
|
||||
# 83 S
|
||||
6
|
||||
# 84 T
|
||||
6
|
||||
# 85 U
|
||||
6
|
||||
# 86 V
|
||||
6
|
||||
# 87 W
|
||||
7
|
||||
# 88 X
|
||||
7
|
||||
# 89 Y
|
||||
6
|
||||
# 90 Z
|
||||
7
|
||||
# 91 [
|
||||
8
|
||||
# 92 \
|
||||
3
|
||||
# 93 ]
|
||||
7
|
||||
# 94 ^
|
||||
7
|
||||
# 95 _
|
||||
8
|
||||
# 96 `
|
||||
0
|
||||
# 97 a
|
||||
6
|
||||
# 98 b
|
||||
7
|
||||
# 99 c
|
||||
7
|
||||
# 100 d
|
||||
7
|
||||
# 101 e
|
||||
7
|
||||
# 102 f
|
||||
7
|
||||
# 103 g
|
||||
7
|
||||
# 104 h
|
||||
6
|
||||
# 105 i
|
||||
6
|
||||
# 106 j
|
||||
7
|
||||
# 107 k
|
||||
7
|
||||
# 108 l
|
||||
7
|
||||
# 109 m
|
||||
7
|
||||
# 110 n
|
||||
7
|
||||
# 111 o
|
||||
7
|
||||
# 112 p
|
||||
7
|
||||
# 113 q
|
||||
7
|
||||
# 114 r
|
||||
7
|
||||
# 115 s
|
||||
6
|
||||
# 116 t
|
||||
6
|
||||
# 117 u
|
||||
6
|
||||
# 118 v
|
||||
6
|
||||
# 119 w
|
||||
7
|
||||
# 120 x
|
||||
7
|
||||
# 121 y
|
||||
6
|
||||
# 122 z
|
||||
7
|
||||
# 123 {
|
||||
0
|
||||
# 124 |
|
||||
0
|
||||
# 125 }
|
||||
0
|
||||
# 126 ~
|
||||
0
|
||||
BIN
data/font/subatomic.png
Normal file
|
After Width: | Height: | Size: 902 B |
194
data/font/subatomic.txt
Normal file
@@ -0,0 +1,194 @@
|
||||
# box width
|
||||
7
|
||||
# box height
|
||||
7
|
||||
# 32 espacio ( )
|
||||
4
|
||||
# 33 !
|
||||
1
|
||||
# 34 "
|
||||
3
|
||||
# 35 #
|
||||
5
|
||||
# 36 $
|
||||
5
|
||||
# 37 %
|
||||
5
|
||||
# 38 &
|
||||
6
|
||||
# 39 '
|
||||
1
|
||||
# 40 (
|
||||
2
|
||||
# 41 )
|
||||
2
|
||||
# 42 *
|
||||
5
|
||||
# 43 +
|
||||
5
|
||||
# 44 ,
|
||||
1
|
||||
# 45 -
|
||||
5
|
||||
# 46 .
|
||||
1
|
||||
# 47 /
|
||||
5
|
||||
# 48 0
|
||||
5
|
||||
# 49 1
|
||||
2
|
||||
# 50 2
|
||||
5
|
||||
# 51 3
|
||||
5
|
||||
# 52 4
|
||||
5
|
||||
# 53 5
|
||||
5
|
||||
# 54 6
|
||||
5
|
||||
# 55 7
|
||||
5
|
||||
# 56 8
|
||||
5
|
||||
# 57 9
|
||||
5
|
||||
# 58 :
|
||||
1
|
||||
# 59 ;
|
||||
2
|
||||
# 60 <
|
||||
3
|
||||
# 61 =
|
||||
5
|
||||
# 62 >
|
||||
3
|
||||
# 63 ?
|
||||
4
|
||||
# 64 @
|
||||
5
|
||||
# 65 A
|
||||
5
|
||||
# 66 B
|
||||
5
|
||||
# 67 C
|
||||
5
|
||||
# 68 D
|
||||
5
|
||||
# 69 E
|
||||
4
|
||||
# 70 F
|
||||
5
|
||||
# 71 G
|
||||
5
|
||||
# 72 H
|
||||
5
|
||||
# 73 I
|
||||
1
|
||||
# 74 J
|
||||
5
|
||||
# 75 K
|
||||
5
|
||||
# 76 L
|
||||
2
|
||||
# 77 M
|
||||
5
|
||||
# 78 N
|
||||
5
|
||||
# 79 O
|
||||
5
|
||||
# 80 P
|
||||
5
|
||||
# 81 Q
|
||||
5
|
||||
# 82 R
|
||||
5
|
||||
# 83 S
|
||||
5
|
||||
# 84 T
|
||||
5
|
||||
# 85 U
|
||||
5
|
||||
# 86 V
|
||||
5
|
||||
# 87 W
|
||||
5
|
||||
# 88 X
|
||||
5
|
||||
# 89 Y
|
||||
5
|
||||
# 90 Z
|
||||
5
|
||||
# 91 [
|
||||
2
|
||||
# 92 \
|
||||
5
|
||||
# 93 ]
|
||||
2
|
||||
# 94 ^
|
||||
3
|
||||
# 95 _
|
||||
5
|
||||
# 96 `
|
||||
2
|
||||
# 97 a
|
||||
4
|
||||
# 98 b
|
||||
4
|
||||
# 99 c
|
||||
3
|
||||
# 100 d
|
||||
4
|
||||
# 101 e
|
||||
4
|
||||
# 102 f
|
||||
3
|
||||
# 103 g
|
||||
4
|
||||
# 104 h
|
||||
4
|
||||
# 105 i
|
||||
1
|
||||
# 106 j
|
||||
2
|
||||
# 107 k
|
||||
3
|
||||
# 108 l
|
||||
1
|
||||
# 109 m
|
||||
5
|
||||
# 110 n
|
||||
4
|
||||
# 111 o
|
||||
4
|
||||
# 112 p
|
||||
4
|
||||
# 113 q
|
||||
4
|
||||
# 114 r
|
||||
3
|
||||
# 115 s
|
||||
4
|
||||
# 116 t
|
||||
2
|
||||
# 117 u
|
||||
4
|
||||
# 118 v
|
||||
4
|
||||
# 119 w
|
||||
5
|
||||
# 120 x
|
||||
3
|
||||
# 121 y
|
||||
4
|
||||
# 122 z
|
||||
4
|
||||
# 123 {
|
||||
0
|
||||
# 124 |
|
||||
0
|
||||
# 125 }
|
||||
0
|
||||
# 126 ~
|
||||
0
|
||||
BIN
data/notifications/notify.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
@@ -9,8 +9,8 @@ roomLeft=0
|
||||
roomRight=02.room
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailer.png
|
||||
animation=jailer.ani
|
||||
tileSetFile=jailer_#1.png
|
||||
animation=jailer_#1.ani
|
||||
width=16
|
||||
height=16
|
||||
x=1
|
||||
@@ -25,8 +25,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailer3.png
|
||||
animation=jailer3.ani
|
||||
tileSetFile=jailer_#3.png
|
||||
animation=jailer_#3.ani
|
||||
width=16
|
||||
height=16
|
||||
x=4
|
||||
@@ -41,8 +41,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailer.png
|
||||
animation=jailer.ani
|
||||
tileSetFile=jailer_#1.png
|
||||
animation=jailer_#1.ani
|
||||
width=16
|
||||
height=16
|
||||
x=7
|
||||
@@ -57,8 +57,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailer2.png
|
||||
animation=jailer2.ani
|
||||
tileSetFile=jailer_#2.png
|
||||
animation=jailer_#2.ani
|
||||
width=16
|
||||
height=16
|
||||
x=10
|
||||
@@ -73,8 +73,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jailer.png
|
||||
animation=jailer.ani
|
||||
tileSetFile=jailer_#1.png
|
||||
animation=jailer_#1.ani
|
||||
width=16
|
||||
height=16
|
||||
x=13
|
||||
@@ -89,8 +89,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=printer.png
|
||||
animation=printer.ani
|
||||
tileSetFile=elsa.png
|
||||
animation=elsa.ani
|
||||
width=16
|
||||
height=16
|
||||
x=3
|
||||
@@ -105,8 +105,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=printer.png
|
||||
animation=printer.ani
|
||||
tileSetFile=elsa.png
|
||||
animation=elsa.ani
|
||||
width=16
|
||||
height=16
|
||||
x=6
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<tileset firstgid="1" source="standard.tsx"/>
|
||||
<layer id="1" name="Capa de patrones 1" width="32" height="16">
|
||||
<data encoding="csv">
|
||||
164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,
|
||||
164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,43,43,43,43,43,43,43,43,43,43,43,43,43,43,164,
|
||||
164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
|
||||
192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
|
||||
168,166,185,167,166,185,166,166,168,166,166,167,166,166,185,166,166,43,43,43,43,43,43,43,43,43,43,43,43,43,43,166,
|
||||
211,181,211,213,211,181,211,212,213,211,181,211,211,212,211,213,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
|
||||
164,43,43,43,43,43,43,43,43,43,43,43,43,43,43,164,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
|
||||
43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
|
||||
43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name=ROAD TO THE JAIL
|
||||
bgColor=black
|
||||
border=cyan
|
||||
border=blue
|
||||
tileMapFile=02.tmx
|
||||
tileSetFile=standard.png
|
||||
roomUp=0
|
||||
|
||||
@@ -3,22 +3,22 @@
|
||||
<tileset firstgid="1" source="standard.tsx"/>
|
||||
<layer id="1" name="Capa de patrones 1" width="32" height="16">
|
||||
<data encoding="csv">
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,43,43,43,43,
|
||||
43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,25,
|
||||
43,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,0,0,0,
|
||||
192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,43,43,43,43,43,
|
||||
43,166,166,167,168,166,185,167,166,185,166,166,168,166,166,167,166,166,185,166,166,166,185,167,166,166,166,185,25,25,25,25,
|
||||
43,43,211,212,212,211,181,211,213,211,181,211,212,213,211,181,211,211,211,211,212,213,211,181,211,213,181,211,135,0,0,0,
|
||||
43,43,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,0,0,0,
|
||||
43,43,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,25,
|
||||
34,34,304,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,
|
||||
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,303,25,25,
|
||||
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,
|
||||
34,34,0,413,413,413,413,0,0,0,0,413,413,413,413,413,0,0,0,0,413,413,413,413,413,413,413,0,0,0,25,25,
|
||||
34,34,0,413,413,413,413,0,0,0,0,413,304,413,413,413,0,0,0,0,413,304,413,413,413,413,304,0,0,0,25,25,
|
||||
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,
|
||||
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,387,25,25,
|
||||
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,411,25,25,
|
||||
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,
|
||||
34,34,389,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,387,25,25,
|
||||
34,34,413,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,411,25,25,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,513,190,189,190,537,0,0,0,0,
|
||||
34,34,189,190,189,190,189,190,189,190,189,190,189,190,189,190,189,190,189,191,0,0,189,190,189,190,189,190,189,190,25,25
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,524,189,191,548,0,0,0,0,
|
||||
34,34,189,190,189,190,189,190,189,190,189,190,189,190,189,190,189,190,189,191,0,0,189,190,189,190,189,190,189,191,25,25
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
||||
|
||||
@@ -11,8 +11,8 @@ itemColor1=bright_green
|
||||
itemColor2=green
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
tileSetFile=floppy.png
|
||||
animation=floppy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=15
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
134,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117,
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117,
|
||||
25,0,0,0,0,0,0,0,0,0,0,417,417,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,
|
||||
25,0,0,556,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,0,0,0,0,0,0,0,0,0,387,25,
|
||||
25,0,0,556,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,0,0,0,0,0,0,0,0,0,0,25,
|
||||
25,25,25,25,25,25,0,0,0,417,417,0,0,0,0,0,0,0,305,31,0,0,0,0,0,0,0,0,0,0,0,305,
|
||||
0,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,417,417,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,417,417,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
0,0,0,0,0,0,0,0,531,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,
|
||||
0,0,0,0,0,0,0,0,0,531,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,
|
||||
0,0,0,0,0,0,0,0,0,0,349,349,349,349,349,349,349,349,349,349,349,538,0,0,0,0,0,0,0,0,0,17,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,41,41,41,41,349,349,349,349,349,349,349,349,349,349,0,0,349,349,349
|
||||
563,563,563,563,563,563,563,563,563,563,0,0,0,41,41,41,41,349,349,349,349,349,349,349,349,349,349,0,0,349,349,349
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
||||
|
||||
@@ -11,8 +11,8 @@ itemColor1=red
|
||||
itemColor2=magenta
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
tileSetFile=floppy.png
|
||||
animation=floppy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=9
|
||||
@@ -27,8 +27,8 @@ color=green
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
tileSetFile=floppy.png
|
||||
animation=floppy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=1
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
25,0,0,0,527,25,25,25,25,25,25,25,25,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,25,25,25,0,0,0,0,0,0,0,0,0,0,0,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,527,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,527,25,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,551,0,0,0,0,0,0,0,0,0,527,25,25,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,25,0,0,0,0,0,25,25,25,25,25,
|
||||
25,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,251,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,395,395,395,395,395,371,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,0,0,0,0,0,0,0,
|
||||
25,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,251,0,0,0,0,0,25,25,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
|
||||
0,0,0,0,395,395,395,395,395,371,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,0,0,0,0,0,0,25,
|
||||
0,0,0,0,0,0,0,0,0,323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
25,25,551,0,0,0,0,0,0,347,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
|
||||
|
||||
@@ -30,7 +30,7 @@ flip=true
|
||||
[enemy]
|
||||
tileSetFile=bat.png
|
||||
animation=bat.ani
|
||||
width=9
|
||||
width=8
|
||||
height=7
|
||||
x=14
|
||||
y=2
|
||||
@@ -46,7 +46,7 @@ color=bright_blue
|
||||
[enemy]
|
||||
tileSetFile=bat.png
|
||||
animation=bat.ani
|
||||
width=9
|
||||
width=8
|
||||
height=7
|
||||
x=10
|
||||
y=10
|
||||
@@ -62,7 +62,7 @@ color=cyan
|
||||
[enemy]
|
||||
tileSetFile=bat.png
|
||||
animation=bat.ani
|
||||
width=9
|
||||
width=8
|
||||
height=7
|
||||
x=15
|
||||
y=1
|
||||
|
||||
@@ -11,8 +11,8 @@ itemColor1=yellow
|
||||
itemColor2=red
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
tileSetFile=floppy.png
|
||||
animation=floppy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=5
|
||||
@@ -27,8 +27,8 @@ color=green
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
tileSetFile=floppy.png
|
||||
animation=floppy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=12
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
<tileset firstgid="1" source="standard.tsx"/>
|
||||
<layer id="1" name="Capa de patrones 1" width="32" height="16">
|
||||
<data encoding="csv">
|
||||
5,5,5,5,5,5,5,5,5,5,5,0,0,0,506,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,0,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,
|
||||
5,5,5,5,5,5,5,5,0,0,0,0,0,0,506,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,0,0,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,
|
||||
5,5,5,5,5,5,5,0,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
|
||||
5,5,5,5,5,5,5,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
|
||||
5,5,5,5,5,5,5,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
|
||||
0,0,0,0,0,0,134,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
|
||||
0,0,0,0,0,0,134,0,415,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
|
||||
5,5,5,5,173,0,134,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
|
||||
557,557,557,557,557,557,134,0,415,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
|
||||
5,5,5,5,5,5,5,415,415,415,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
|
||||
5,5,5,5,5,5,5,0,0,0,0,530,0,0,0,0,0,0,449,449,449,449,449,449,449,449,449,449,449,449,449,5,
|
||||
5,5,5,5,5,5,5,0,0,0,0,0,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
|
||||
5,5,5,5,5,5,0,0,0,0,0,530,0,0,0,0,0,0,449,449,449,449,449,449,449,449,449,449,449,449,449,5,
|
||||
5,5,5,5,5,0,0,0,0,0,0,0,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,517,367,5,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,367,367,367,367,429,429,0,429,429,367,367,367,367,367,367,367,367,5,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,343,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
<layer id="1" name="Capa de patrones 1" width="32" height="16">
|
||||
<data encoding="csv">
|
||||
349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,38,38,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,241,241,0,0,0,0,0,0,241,241,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,38,38,241,241,0,0,0,0,0,0,0,0,0,0,0,0,241,241,38,38,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,38,38,38,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
|
||||
0,0,0,0,0,0,0,0,0,0,0,241,241,0,0,0,0,0,0,241,241,0,0,0,0,0,0,0,0,0,0,188,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
|
||||
0,0,0,0,0,0,38,38,241,241,0,0,0,0,0,0,0,0,0,0,0,0,241,241,38,38,0,0,0,0,0,188,
|
||||
0,0,0,0,0,38,38,0,0,0,0,241,241,0,0,0,0,0,0,241,241,0,0,0,0,38,38,0,0,0,0,0,
|
||||
0,0,0,0,38,38,0,0,0,0,0,0,0,0,241,241,241,241,0,0,0,0,0,0,0,0,38,38,0,0,0,0,
|
||||
0,0,0,0,38,0,0,0,0,0,0,241,241,0,0,0,0,0,0,241,241,0,0,0,0,0,0,38,0,0,0,0,
|
||||
|
||||
@@ -9,8 +9,8 @@ roomLeft=26.room
|
||||
roomRight=0
|
||||
|
||||
#[enemy]
|
||||
#tileSetFile=diskette.png
|
||||
#animation=diskette.ani
|
||||
#tileSetFile=floppy.png
|
||||
#animation=floppy.ani
|
||||
#width=16
|
||||
#height=16
|
||||
#x=2
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
<tileset firstgid="1" source="standard.tsx"/>
|
||||
<layer id="1" name="Capa de patrones 1" width="32" height="16">
|
||||
<data encoding="csv">
|
||||
90,89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,90,41,235,235,0,0,235,235,41,89,90,89,
|
||||
89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,90,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,235,0,0,0,0,0,0,
|
||||
90,89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,94,41,235,235,0,0,235,235,41,89,90,89,
|
||||
89,94,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,214,215,0,0,0,0,0,0,0,0,214,89,90,
|
||||
214,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,214,89,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,235,0,0,0,0,0,214,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,235,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,0,0,0,0,
|
||||
94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,
|
||||
94,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,
|
||||
89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,415,415,415,415,415,
|
||||
94,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,415,415,415,415,415,
|
||||
89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,0,0,0,0,0,
|
||||
90,89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
89,90,89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
||||
@@ -11,8 +11,8 @@ itemColor1=green
|
||||
itemColor2=red
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
tileSetFile=floppy.png
|
||||
animation=floppy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=20
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
116,0,0,0,377,377,377,0,0,0,0,0,0,115,114,115,114,0,0,0,0,0,377,377,377,377,0,0,0,0,140,116,
|
||||
140,0,0,0,0,0,0,0,0,0,0,377,0,114,115,114,115,0,0,377,0,0,0,0,0,0,0,0,0,0,116,140,
|
||||
116,0,0,0,0,0,0,0,0,0,0,0,0,115,114,115,114,0,0,0,0,0,0,0,0,0,431,432,114,115,140,116,
|
||||
140,0,0,0,0,0,0,0,377,0,0,0,0,114,115,114,115,0,0,0,0,0,0,431,432,431,432,431,432,0,116,140,
|
||||
140,0,0,0,0,0,0,377,377,0,0,0,0,114,115,114,115,0,0,0,0,0,0,431,432,431,432,431,432,0,116,140,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,377,115,114,115,114,0,0,377,0,0,0,0,0,0,0,0,0,0,140,116,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,114,115,114,115,0,0,0,0,0,0,0,0,0,0,0,0,0,116,140,
|
||||
114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,0,0,114,115,114,115,114,115
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name=STATIC
|
||||
name=BE CAREFUL WITH THE FUSE
|
||||
bgColor=black
|
||||
border=bright_cyan
|
||||
tileMapFile=36.tmx
|
||||
|
||||
@@ -9,8 +9,8 @@ roomLeft=39.room
|
||||
roomRight=37.room
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_stop.png
|
||||
animation=arounder_stop.ani
|
||||
tileSetFile=stopped_arounder.png
|
||||
animation=stopped_arounder.ani
|
||||
width=7
|
||||
height=8
|
||||
x=9
|
||||
@@ -25,8 +25,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_stop.png
|
||||
animation=arounder_stop.ani
|
||||
tileSetFile=stopped_arounder.png
|
||||
animation=stopped_arounder.ani
|
||||
width=7
|
||||
height=8
|
||||
x=18
|
||||
@@ -41,8 +41,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_walk.png
|
||||
animation=arounder_walk.ani
|
||||
tileSetFile=walking_arounder.png
|
||||
animation=walking_arounder.ani
|
||||
width=5
|
||||
height=8
|
||||
x=12
|
||||
@@ -75,8 +75,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_fly.png
|
||||
animation=arounder_fly.ani
|
||||
tileSetFile=flying_arounder.png
|
||||
animation=flying_arounder.ani
|
||||
width=7
|
||||
height=7
|
||||
x=3
|
||||
|
||||
@@ -27,8 +27,8 @@ color=white
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_fly.png
|
||||
animation=arounder_fly.ani
|
||||
tileSetFile=flying_arounder.png
|
||||
animation=flying_arounder.ani
|
||||
width=7
|
||||
height=7
|
||||
x=9
|
||||
@@ -44,8 +44,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_fly.png
|
||||
animation=arounder_fly.ani
|
||||
tileSetFile=flying_arounder.png
|
||||
animation=flying_arounder.ani
|
||||
width=7
|
||||
height=7
|
||||
x=15
|
||||
@@ -61,8 +61,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_fly.png
|
||||
animation=arounder_fly.ani
|
||||
tileSetFile=flying_arounder.png
|
||||
animation=flying_arounder.ani
|
||||
width=7
|
||||
height=7
|
||||
x=22
|
||||
@@ -78,8 +78,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_fly.png
|
||||
animation=arounder_fly.ani
|
||||
tileSetFile=flying_arounder.png
|
||||
animation=flying_arounder.ani
|
||||
width=7
|
||||
height=7
|
||||
x=16
|
||||
|
||||
@@ -25,8 +25,8 @@ color=red
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_walk.png
|
||||
animation=arounder_walk.ani
|
||||
tileSetFile=walking_arounder.png
|
||||
animation=walking_arounder.ani
|
||||
width=5
|
||||
height=8
|
||||
x=10
|
||||
@@ -42,8 +42,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_walk.png
|
||||
animation=arounder_walk.ani
|
||||
tileSetFile=walking_arounder.png
|
||||
animation=walking_arounder.ani
|
||||
width=5
|
||||
height=8
|
||||
x=15
|
||||
@@ -59,8 +59,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_walk.png
|
||||
animation=arounder_walk.ani
|
||||
tileSetFile=walking_arounder.png
|
||||
animation=walking_arounder.ani
|
||||
width=5
|
||||
height=8
|
||||
x=20
|
||||
@@ -76,8 +76,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_walk.png
|
||||
animation=arounder_walk.ani
|
||||
tileSetFile=walking_arounder.png
|
||||
animation=walking_arounder.ani
|
||||
width=5
|
||||
height=8
|
||||
x=14
|
||||
|
||||
@@ -25,8 +25,8 @@ color=bright_cyan
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_stop.png
|
||||
animation=arounder_stop.ani
|
||||
tileSetFile=stopped_arounder.png
|
||||
animation=stopped_arounder.ani
|
||||
width=7
|
||||
height=8
|
||||
x=8
|
||||
@@ -41,8 +41,8 @@ color=bright_cyan
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_stop.png
|
||||
animation=arounder_stop.ani
|
||||
tileSetFile=stopped_arounder.png
|
||||
animation=stopped_arounder.ani
|
||||
width=7
|
||||
height=8
|
||||
x=11
|
||||
@@ -57,8 +57,8 @@ color=bright_cyan
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_stop.png
|
||||
animation=arounder_stop.ani
|
||||
tileSetFile=stopped_arounder.png
|
||||
animation=stopped_arounder.ani
|
||||
width=7
|
||||
height=8
|
||||
x=24
|
||||
@@ -73,8 +73,8 @@ color=bright_cyan
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_walk.png
|
||||
animation=arounder_walk.ani
|
||||
tileSetFile=walking_arounder.png
|
||||
animation=walking_arounder.ani
|
||||
width=5
|
||||
height=8
|
||||
x=12
|
||||
@@ -90,8 +90,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_walk.png
|
||||
animation=arounder_walk.ani
|
||||
tileSetFile=walking_arounder.png
|
||||
animation=walking_arounder.ani
|
||||
width=5
|
||||
height=8
|
||||
x=14
|
||||
@@ -107,8 +107,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=arounder_walk.png
|
||||
animation=arounder_walk.ani
|
||||
tileSetFile=walking_arounder.png
|
||||
animation=walking_arounder.ani
|
||||
width=5
|
||||
height=8
|
||||
x=14
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name=P.A.C.O. ON THE GO
|
||||
bgColor=black
|
||||
border=black
|
||||
border=blue
|
||||
tileMapFile=42.tmx
|
||||
tileSetFile=standard.png
|
||||
roomUp=0
|
||||
@@ -23,7 +23,7 @@ x1=10
|
||||
y1=2
|
||||
x2=10
|
||||
y2=11
|
||||
color=green
|
||||
color=magenta
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,421,62,
|
||||
36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,421,0,0,0,0,0,0,0,0,
|
||||
36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,415,421,415,0,0,0,0,0,0,0,0,0,0,0,
|
||||
36,0,0,0,0,0,0,0,305,0,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
36,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,421,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
36,0,0,0,0,0,0,0,306,0,0,0,0,306,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
36,0,0,0,306,0,0,0,0,0,0,0,0,0,0,0,0,421,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
36,0,415,421,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,415,0,0,421,415,0,0,0,0,0,0,
|
||||
36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
|
||||
@@ -11,6 +11,22 @@ itemColor1=red
|
||||
itemColor2=magenta
|
||||
autoSurface=left
|
||||
|
||||
[enemy]
|
||||
tileSetFile=batman_fire.png
|
||||
animation=batman_fire.ani
|
||||
width=16
|
||||
height=16
|
||||
x=10
|
||||
y=13
|
||||
vx=1.3
|
||||
vy=0
|
||||
x1=0
|
||||
y1=13
|
||||
x2=29
|
||||
y2=13
|
||||
color=cyan
|
||||
flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=heavy.png
|
||||
|
||||
@@ -11,8 +11,8 @@ itemColor1=red
|
||||
itemColor2=yellow
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jb_alien.png
|
||||
animation=jb_alien.ani
|
||||
tileSetFile=jailbattle_alien.png
|
||||
animation=jailbattle_alien.ani
|
||||
width=13
|
||||
height=15
|
||||
x=10
|
||||
@@ -28,8 +28,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jb_alien.png
|
||||
animation=jb_alien.ani
|
||||
tileSetFile=jailbattle_alien.png
|
||||
animation=jailbattle_alien.ani
|
||||
width=13
|
||||
height=15
|
||||
x=25
|
||||
@@ -45,8 +45,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jb_human.png
|
||||
animation=jb_human.ani
|
||||
tileSetFile=jailbattle_human.png
|
||||
animation=jailbattle_human.ani
|
||||
width=11
|
||||
height=13
|
||||
x=7
|
||||
@@ -62,8 +62,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jb_human.png
|
||||
animation=jb_human.ani
|
||||
tileSetFile=jailbattle_human.png
|
||||
animation=jailbattle_human.ani
|
||||
width=11
|
||||
height=13
|
||||
x=18
|
||||
|
||||
@@ -11,8 +11,8 @@ itemColor1=white
|
||||
itemColor2=green
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jb_human.png
|
||||
animation=jb_human.ani
|
||||
tileSetFile=jailbattle_human.png
|
||||
animation=jailbattle_human.ani
|
||||
width=11
|
||||
height=13
|
||||
x=17
|
||||
@@ -28,8 +28,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jb_human.png
|
||||
animation=jb_human.ani
|
||||
tileSetFile=jailbattle_human.png
|
||||
animation=jailbattle_human.ani
|
||||
width=11
|
||||
height=13
|
||||
x=2
|
||||
@@ -45,8 +45,8 @@ flip=true
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=jb_alien.png
|
||||
animation=jb_alien.ani
|
||||
tileSetFile=jailbattle_alien.png
|
||||
animation=jailbattle_alien.ani
|
||||
width=11
|
||||
height=13
|
||||
x=24
|
||||
|
||||
@@ -9,8 +9,8 @@ roomLeft=0
|
||||
roomRight=49.room
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
tileSetFile=floppy.png
|
||||
animation=floppy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=7
|
||||
@@ -25,8 +25,8 @@ color=magenta
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
tileSetFile=floppy.png
|
||||
animation=floppy.ani
|
||||
width=16
|
||||
height=16
|
||||
x=20
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<layer id="1" name="Capa de patrones 1" width="32" height="16">
|
||||
<data encoding="csv">
|
||||
42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,
|
||||
42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,
|
||||
42,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,42,
|
||||
42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,
|
||||
42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,
|
||||
42,0,0,0,0,0,0,0,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,4 +1,4 @@
|
||||
name=P.A.C.O WORKSHOP
|
||||
name=P.A.C.O. WORKSHOP
|
||||
bgColor=black
|
||||
border=yellow
|
||||
tileMapFile=53.tmx
|
||||
|
||||
BIN
data/sound/notify.wav
Normal file
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 7.1 KiB |
BIN
data/title/loading_screen_color.gif
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 8.9 KiB |
BIN
data/title/title_logo.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.jaildoctors_dilemma_debug</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -11,9 +11,9 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>jaildoctors_dilemma</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>jaildoctors_dilemma</string>
|
||||
<string>icon</string>
|
||||
<key>CFBundleIconName</key>
|
||||
<string>jaildoctors_dilemma</string>
|
||||
<string>icon</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.jailgames.jaildoctors_dilemma</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
@@ -23,11 +23,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.4.3</string>
|
||||
<string>1.08</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.0</string>
|
||||
<string>1.08</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
BIN
release/libgcc_s_seh-1.dll
Normal file
BIN
release/libstdc++-6.dll
Normal file
BIN
release/libwinpthread-1.dll
Normal file
339
source/cheevos.cpp
Normal file
@@ -0,0 +1,339 @@
|
||||
#include "cheevos.h"
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
Cheevos::Cheevos(Screen *screen, options_t *options, std::string file, Online *online)
|
||||
{
|
||||
// Copia la dirección de los objetos
|
||||
this->options = options;
|
||||
this->screen = screen;
|
||||
this->file = file;
|
||||
this->online = online;
|
||||
|
||||
// Inicializa los logros
|
||||
init();
|
||||
|
||||
// Inicializa variables
|
||||
enabled = true;
|
||||
|
||||
// Carga el estado de los logros
|
||||
load();
|
||||
}
|
||||
|
||||
// Destructor
|
||||
Cheevos::~Cheevos()
|
||||
{
|
||||
// Guarda el estado de los logros
|
||||
save();
|
||||
|
||||
cheevos.clear();
|
||||
}
|
||||
|
||||
// Inicializa los logros
|
||||
void Cheevos::init()
|
||||
{
|
||||
cheevos.clear();
|
||||
|
||||
cheevos_t c;
|
||||
c.completed = false;
|
||||
c.valid = true;
|
||||
c.icon = 2;
|
||||
|
||||
c.id = 1;
|
||||
c.caption = "SHINY THINGS";
|
||||
c.description = "Get 25\% of the items";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 2;
|
||||
c.caption = "HALF THE WORK";
|
||||
c.description = "Get 50\% of the items";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 3;
|
||||
c.caption = "GETTING THERE";
|
||||
c.description = "Get 75\% of the items";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 4;
|
||||
c.caption = "THE COLLECTOR";
|
||||
c.description = "Get 100\% of the items";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 5;
|
||||
c.caption = "WANDERING AROUND";
|
||||
c.description = "Visit 20 rooms";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 6;
|
||||
c.caption = "I GOT LOST";
|
||||
c.description = "Visit 40 rooms";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 7;
|
||||
c.caption = "I LIKE TO EXPLORE";
|
||||
c.description = "Visit all rooms";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 8;
|
||||
c.caption = "FINISH THE GAME";
|
||||
c.description = "Complete the game";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 9;
|
||||
c.caption = "I WAS SUCKED BY A HOLE";
|
||||
c.description = "Complete the game without entering the jail";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 10;
|
||||
c.caption = "MY LITTLE PROJECTS";
|
||||
c.description = "Complete the game with all items";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 11;
|
||||
c.caption = "I LIKE MY MULTICOLOURED FRIENDS";
|
||||
c.description = "Complete the game without dying";
|
||||
cheevos.push_back(c);
|
||||
|
||||
c.id = 12;
|
||||
c.caption = "SHIT PROJECTS DONE FAST";
|
||||
c.description = "Complete the game in under 30 minutes";
|
||||
cheevos.push_back(c);
|
||||
}
|
||||
|
||||
// Busca un logro por id y devuelve el indice
|
||||
int Cheevos::find(int id)
|
||||
{
|
||||
for (int i = 0; i < (int)cheevos.size(); ++i)
|
||||
{
|
||||
if (cheevos[i].id == id)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Desbloquea un logro
|
||||
void Cheevos::unlock(int id)
|
||||
{
|
||||
const int index = find(id);
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cheevos[index].valid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (cheevos[index].completed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cheevos[index].completed = true;
|
||||
screen->showNotification("ACHIEVEMENT UNLOCKED!", cheevos[index].caption, cheevos[index].icon);
|
||||
save();
|
||||
}
|
||||
|
||||
// Invalida un logro
|
||||
void Cheevos::invalidate(int id)
|
||||
{
|
||||
const int index = find(id);
|
||||
if (index == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
cheevos[index].valid = false;
|
||||
}
|
||||
|
||||
// Habilita o deshabilita los logros
|
||||
void Cheevos::enable(bool value)
|
||||
{
|
||||
enabled = value;
|
||||
}
|
||||
|
||||
// Carga el estado de los logros
|
||||
void Cheevos::load()
|
||||
{
|
||||
if (options->online.enabled)
|
||||
{ // Carga el estado de los logros desde el servidor online
|
||||
loadFromServer();
|
||||
}
|
||||
else
|
||||
{ // Carga el estado de los logros desde un fichero
|
||||
loadFromFile();
|
||||
}
|
||||
}
|
||||
|
||||
// Guarda el estado de los logros
|
||||
void Cheevos::save()
|
||||
{
|
||||
if (options->online.enabled)
|
||||
{ // Guarda el estado de los logros en el servidor online
|
||||
saveToServer();
|
||||
}
|
||||
else
|
||||
{ // Guarda el estado de los logros en un fichero
|
||||
saveToFile();
|
||||
}
|
||||
}
|
||||
|
||||
// Carga el estado de los logros desde un fichero
|
||||
void Cheevos::loadFromFile()
|
||||
{
|
||||
// Abre el fichero en modo lectura (binario)
|
||||
SDL_RWops *file = SDL_RWFromFile(this->file.c_str(), "r+b");
|
||||
|
||||
// El fichero no existe
|
||||
if (file == NULL)
|
||||
{
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Warning: Unable to open file! SDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
|
||||
// Crea el fichero en modo escritura (binario)
|
||||
file = SDL_RWFromFile(this->file.c_str(), "w+b");
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "New file created!" << std::endl;
|
||||
}
|
||||
|
||||
// Guarda la información
|
||||
for (int i = 0; i < (int)cheevos.size(); ++i)
|
||||
{
|
||||
SDL_RWwrite(file, &cheevos[i].completed, sizeof(bool), 1);
|
||||
}
|
||||
|
||||
// Cierra el fichero
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Error: Unable to create file! SDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
// El fichero existe
|
||||
else
|
||||
{
|
||||
// Carga los datos
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Reading file...!" << std::endl;
|
||||
}
|
||||
for (int i = 0; i < (int)cheevos.size(); ++i)
|
||||
{
|
||||
SDL_RWread(file, &cheevos[i].completed, sizeof(bool), 1);
|
||||
}
|
||||
|
||||
// Cierra el fichero
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
// Guarda el estado de los logros en un fichero
|
||||
void Cheevos::saveToFile()
|
||||
{
|
||||
// Abre el fichero en modo escritura (binario)
|
||||
SDL_RWops *file = SDL_RWFromFile(this->file.c_str(), "w+b");
|
||||
if (file != NULL)
|
||||
{
|
||||
// Guarda la información
|
||||
for (int i = 0; i < (int)cheevos.size(); ++i)
|
||||
{
|
||||
SDL_RWwrite(file, &cheevos[i].completed, sizeof(bool), 1);
|
||||
}
|
||||
|
||||
// Cierra el fichero
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Error: Unable to save file! " << SDL_GetError() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lista los logros
|
||||
std::vector<cheevos_t> Cheevos::list()
|
||||
{
|
||||
return cheevos;
|
||||
}
|
||||
|
||||
// Devuelve el número total de logros desbloqueados
|
||||
int Cheevos::unlocked()
|
||||
{
|
||||
int count = 0;
|
||||
for (auto cheevo : cheevos)
|
||||
{
|
||||
if (cheevo.completed)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Devuelve el número total de logros
|
||||
int Cheevos::count()
|
||||
{
|
||||
return cheevos.size();
|
||||
}
|
||||
|
||||
// Carga el estado de los logros desde el servidor online
|
||||
void Cheevos::loadFromServer()
|
||||
{
|
||||
std::string cheevosData = online->getCheevos();
|
||||
|
||||
// Gestiona los posibles errores
|
||||
const bool noData = cheevosData == "" ? true : false;
|
||||
const bool incompleteData = cheevosData.length() != cheevos.size() ? true : false;
|
||||
if (noData || incompleteData)
|
||||
{
|
||||
// Pone todos los logros en incompleto
|
||||
init();
|
||||
return;
|
||||
}
|
||||
|
||||
// Asigna los valores leídos desde el servidor
|
||||
for (int i = 0; i < (int)cheevosData.length(); ++i)
|
||||
{
|
||||
bool value = cheevosData.at(i) == '1' ? true : false;
|
||||
cheevos.at(i).completed = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Guarda el estado de los logros en el servidor online
|
||||
void Cheevos::saveToServer()
|
||||
{
|
||||
std::string cheevosData = "";
|
||||
// cheevos[2].completed = true;
|
||||
for (auto cheevo : cheevos)
|
||||
{
|
||||
std::string data = cheevo.completed ? "1" : "0";
|
||||
cheevosData.append(data);
|
||||
}
|
||||
|
||||
online->setCheevos(cheevosData);
|
||||
}
|
||||
|
||||
// Vuelve a cargar los logros desde el origen
|
||||
void Cheevos::reload()
|
||||
{
|
||||
load();
|
||||
}
|
||||
88
source/cheevos.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
#include "jail_engine/screen.h"
|
||||
#include "jail_engine/utils.h"
|
||||
#include "online.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef CHEEVOS_H
|
||||
#define CHEEVOS_H
|
||||
|
||||
struct cheevos_t
|
||||
{
|
||||
int id; // Identificador del logro
|
||||
std::string caption; // Texto con el nombre del logro
|
||||
std::string description; // Texto que describe el logro
|
||||
int icon; // Indice del icono a utilizar en la notificación
|
||||
bool completed; // Indica si se ha obtenido el logro
|
||||
bool valid; // Indica si se puede obtener el logro
|
||||
};
|
||||
|
||||
class Cheevos
|
||||
{
|
||||
private:
|
||||
// Punteros y objetos
|
||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||
options_t *options; // Puntero a las opciones del juego
|
||||
Online *online; // Objeto para gestionar la lectura y escritura de datos en el servidor remoto
|
||||
|
||||
// Variables
|
||||
std::vector<cheevos_t> cheevos; // Listado de logros
|
||||
bool enabled; // Indica si los logros se pueden obtener
|
||||
std::string file; // Fichero done leer/almacenar el estado de los logros
|
||||
|
||||
// Inicializa los logros
|
||||
void init();
|
||||
|
||||
// Busca un logro por id y devuelve el indice
|
||||
int find(int id);
|
||||
|
||||
// Carga el estado de los logros
|
||||
void load();
|
||||
|
||||
// Guarda el estado de los logros
|
||||
void save();
|
||||
|
||||
// Carga el estado de los logros desde un fichero
|
||||
void loadFromFile();
|
||||
|
||||
// Guarda el estado de los logros en un fichero
|
||||
void saveToFile();
|
||||
|
||||
// Carga el estado de los logros desde el servidor online
|
||||
void loadFromServer();
|
||||
|
||||
// Guarda el estado de los logros en el servidor online
|
||||
void saveToServer();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Cheevos(Screen *screen, options_t *options, std::string file, Online *online);
|
||||
|
||||
// Destructor
|
||||
~Cheevos();
|
||||
|
||||
// Desbloquea un logro
|
||||
void unlock(int id);
|
||||
|
||||
// Invalida un logro
|
||||
void invalidate(int id);
|
||||
|
||||
// Habilita o deshabilita los logros
|
||||
void enable(bool value);
|
||||
|
||||
// Lista los logros
|
||||
std::vector<cheevos_t> list();
|
||||
|
||||
// Devuelve el número total de logros desbloqueados
|
||||
int unlocked();
|
||||
|
||||
// Devuelve el número total de logros
|
||||
int count();
|
||||
|
||||
// Vuelve a cargar los logros desde el origen
|
||||
void reload();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,341 +0,0 @@
|
||||
#include "screen.h"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, int gameInternalResX, int gameInternalResY)
|
||||
{
|
||||
// Inicializa variables
|
||||
this->window = window;
|
||||
this->renderer = renderer;
|
||||
this->options = options;
|
||||
|
||||
gameCanvasWidth = gameInternalResX;
|
||||
gameCanvasHeight = gameInternalResY;
|
||||
|
||||
iniFade();
|
||||
iniSpectrumFade();
|
||||
|
||||
// Define el color del borde para el modo de pantalla completa
|
||||
borderColor = {0x00, 0x00, 0x00};
|
||||
|
||||
// Crea la textura donde se dibujan los graficos del juego
|
||||
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
|
||||
if (gameCanvas == nullptr)
|
||||
{
|
||||
std::cout << "TitleSurface could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
|
||||
// Establece el modo de video
|
||||
setVideoMode(options->fullScreenMode);
|
||||
|
||||
// Calcula los anclajes
|
||||
anchor.left = 0;
|
||||
anchor.right = gameCanvasWidth;
|
||||
anchor.center = gameCanvasWidth / 2;
|
||||
anchor.top = 0;
|
||||
anchor.bottom = gameCanvasHeight;
|
||||
anchor.middle = gameCanvasHeight / 2;
|
||||
}
|
||||
|
||||
// Limpia la pantalla
|
||||
void Screen::clean(color_t color)
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 0xFF);
|
||||
SDL_RenderClear(renderer);
|
||||
}
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
void Screen::start()
|
||||
{
|
||||
SDL_SetRenderTarget(renderer, gameCanvas);
|
||||
}
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
void Screen::blit()
|
||||
{
|
||||
// Vuelve a dejar el renderizador en modo normal
|
||||
SDL_SetRenderTarget(renderer, nullptr);
|
||||
|
||||
// Borra el contenido previo
|
||||
SDL_SetRenderDrawColor(renderer, borderColor.r, borderColor.g, borderColor.b, 0xFF);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
// Copia la textura de juego en el renderizador en la posición adecuada
|
||||
SDL_RenderCopy(renderer, gameCanvas, nullptr, &dest);
|
||||
|
||||
// Muestra por pantalla el renderizador
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
// Establece el modo de video
|
||||
void Screen::setVideoMode(int fullScreenMode)
|
||||
{
|
||||
// Aplica el modo de video
|
||||
SDL_SetWindowFullscreen(window, fullScreenMode);
|
||||
|
||||
// Si está activo el modo ventana quita el borde
|
||||
if (fullScreenMode == 0)
|
||||
{
|
||||
if (options->borderEnabled)
|
||||
{
|
||||
const int incWidth = gameCanvasWidth * options->borderSize;
|
||||
const int incHeight = gameCanvasHeight * options->borderSize;
|
||||
screenWidth = gameCanvasWidth + incWidth;
|
||||
screenHeight = gameCanvasHeight + incHeight;
|
||||
dest = {0 + (incWidth / 2), 0 + (incHeight / 2), gameCanvasWidth, gameCanvasHeight};
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
screenWidth = gameCanvasWidth;
|
||||
screenHeight = gameCanvasHeight;
|
||||
dest = {0, 0, gameCanvasWidth, gameCanvasHeight};
|
||||
}
|
||||
|
||||
// Modifica el tamaño del renderizador y de la ventana
|
||||
SDL_RenderSetLogicalSize(renderer, screenWidth, screenHeight);
|
||||
SDL_SetWindowSize(window, screenWidth * options->windowSize, screenHeight * options->windowSize);
|
||||
}
|
||||
|
||||
// Si está activo el modo de pantalla completa añade el borde
|
||||
else if (fullScreenMode == SDL_WINDOW_FULLSCREEN_DESKTOP)
|
||||
{
|
||||
// Obten el alto y el ancho de la ventana
|
||||
SDL_GetWindowSize(window, &screenWidth, &screenHeight);
|
||||
|
||||
// Aplica el escalado al rectangulo donde se pinta la textura del juego
|
||||
if (options->integerScale)
|
||||
{
|
||||
// Calcula el tamaño de la escala máxima
|
||||
int scale = 0;
|
||||
while (((gameCanvasWidth * (scale + 1)) <= screenWidth) && ((gameCanvasHeight * (scale + 1)) <= screenHeight))
|
||||
{
|
||||
scale++;
|
||||
}
|
||||
|
||||
dest.w = gameCanvasWidth * scale;
|
||||
dest.h = gameCanvasHeight * scale;
|
||||
dest.x = (screenWidth - dest.w) / 2;
|
||||
dest.y = (screenHeight - dest.h) / 2;
|
||||
}
|
||||
else if (options->keepAspect)
|
||||
{
|
||||
float ratio = (float)gameCanvasWidth / (float)gameCanvasHeight;
|
||||
if ((screenWidth - gameCanvasWidth) >= (screenHeight - gameCanvasHeight))
|
||||
{
|
||||
dest.h = screenHeight;
|
||||
dest.w = (int)((screenHeight * ratio) + 0.5f);
|
||||
dest.x = (screenWidth - dest.w) / 2;
|
||||
dest.y = (screenHeight - dest.h) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
dest.w = screenWidth;
|
||||
dest.h = (int)((screenWidth / ratio) + 0.5f);
|
||||
dest.x = (screenWidth - dest.w) / 2;
|
||||
dest.y = (screenHeight - dest.h) / 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dest.w = screenWidth;
|
||||
dest.h = screenHeight;
|
||||
dest.x = dest.y = 0;
|
||||
}
|
||||
|
||||
// Modifica el tamaño del renderizador
|
||||
SDL_RenderSetLogicalSize(renderer, screenWidth, screenHeight);
|
||||
}
|
||||
|
||||
// Actualiza el valor de la variable
|
||||
options->fullScreenMode = fullScreenMode;
|
||||
}
|
||||
|
||||
// Camibia entre pantalla completa y ventana
|
||||
void Screen::switchVideoMode()
|
||||
{
|
||||
if (options->fullScreenMode == 0)
|
||||
{
|
||||
options->fullScreenMode = SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->fullScreenMode = 0;
|
||||
}
|
||||
|
||||
setVideoMode(options->fullScreenMode);
|
||||
}
|
||||
|
||||
// Cambia el tamaño de la ventana
|
||||
void Screen::setWindowSize(int size)
|
||||
{
|
||||
options->windowSize = size;
|
||||
setVideoMode(0);
|
||||
}
|
||||
|
||||
// Cambia el color del borde
|
||||
void Screen::setBorderColor(color_t color)
|
||||
{
|
||||
borderColor = color;
|
||||
}
|
||||
|
||||
// Cambia el tipo de mezcla
|
||||
void Screen::setBlendMode(SDL_BlendMode blendMode)
|
||||
{
|
||||
SDL_SetRenderDrawBlendMode(renderer, blendMode);
|
||||
}
|
||||
|
||||
// Establece el tamaño del borde
|
||||
void Screen::setBorderSize(float s)
|
||||
{
|
||||
options->borderSize = s;
|
||||
}
|
||||
|
||||
// Establece si se ha de ver el borde en el modo ventana
|
||||
void Screen::setBorderEnabled(bool value)
|
||||
{
|
||||
options->borderEnabled = value;
|
||||
}
|
||||
|
||||
// Cambia entre borde visible y no visible
|
||||
void Screen::switchBorder()
|
||||
{
|
||||
options->borderEnabled = !options->borderEnabled;
|
||||
setVideoMode(0);
|
||||
}
|
||||
|
||||
// Activa el fade
|
||||
void Screen::setFade()
|
||||
{
|
||||
fade = true;
|
||||
}
|
||||
|
||||
// Comprueba si ha terminado el fade
|
||||
bool Screen::fadeEnded()
|
||||
{
|
||||
if (fade || fadeCounter > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Activa el spectrum fade
|
||||
void Screen::setspectrumFade()
|
||||
{
|
||||
spectrumFade = true;
|
||||
}
|
||||
|
||||
// Comprueba si ha terminado el spectrum fade
|
||||
bool Screen::spectrumFadeEnded()
|
||||
{
|
||||
if (spectrumFade || spectrumFadeCounter > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Inicializa las variables para el fade
|
||||
void Screen::iniFade()
|
||||
{
|
||||
fade = false;
|
||||
fadeCounter = 0;
|
||||
fadeLenght = 200;
|
||||
}
|
||||
|
||||
// Actualiza el fade
|
||||
void Screen::updateFade()
|
||||
{
|
||||
if (!fade)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fadeCounter++;
|
||||
if (fadeCounter > fadeLenght)
|
||||
{
|
||||
iniFade();
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja el fade
|
||||
void Screen::renderFade()
|
||||
{
|
||||
if (!fade)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const SDL_Rect rect = {0, 0, gameCanvasWidth, gameCanvasHeight};
|
||||
color_t color = {0, 0, 0};
|
||||
const float step = (float)fadeCounter / (float)fadeLenght;
|
||||
const int alpha = 0 + (255 - 0) * step;
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, alpha);
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
}
|
||||
|
||||
// Inicializa las variables para el fade spectrum
|
||||
void Screen::iniSpectrumFade()
|
||||
{
|
||||
spectrumFade = false;
|
||||
spectrumFadeCounter = 0;
|
||||
spectrumFadeLenght = 50;
|
||||
|
||||
spectrumColor.clear();
|
||||
|
||||
// Inicializa el vector de colores
|
||||
const std::vector<std::string> vColors = {"black", "blue", "red", "magenta", "green", "cyan", "yellow", "bright_white"};
|
||||
for (auto v : vColors)
|
||||
{
|
||||
spectrumColor.push_back(stringToColor(options->palette, v));
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza el spectrum fade
|
||||
void Screen::updateSpectrumFade()
|
||||
{
|
||||
if (!spectrumFade)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
spectrumFadeCounter++;
|
||||
if (spectrumFadeCounter > spectrumFadeLenght)
|
||||
{
|
||||
iniSpectrumFade();
|
||||
SDL_SetTextureColorMod(gameCanvas, 255, 255, 255);
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja el spectrum fade
|
||||
void Screen::renderSpectrumFade()
|
||||
{
|
||||
if (!spectrumFade)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const float step = (float)spectrumFadeCounter / (float)spectrumFadeLenght;
|
||||
const int max = spectrumColor.size() - 1;
|
||||
const int index = max + (0 - max) * step;
|
||||
const color_t c = spectrumColor.at(index);
|
||||
SDL_SetTextureColorMod(gameCanvas, c.r, c.g, c.b);
|
||||
}
|
||||
|
||||
// Actualiza los efectos
|
||||
void Screen::updateFX()
|
||||
{
|
||||
updateFade();
|
||||
updateSpectrumFade();
|
||||
}
|
||||
|
||||
// Dibuja los efectos
|
||||
void Screen::renderFX()
|
||||
{
|
||||
renderFade();
|
||||
renderSpectrumFade();
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "utils.h"
|
||||
#include <vector>
|
||||
|
||||
#ifndef SCREEN_H
|
||||
#define SCREEN_H
|
||||
|
||||
#define FILTER_NEAREST 0
|
||||
#define FILTER_LINEAL 1
|
||||
|
||||
struct anchor_t
|
||||
{
|
||||
int left; // Parte izquierda de la pantalla de juego
|
||||
int right; // Parte drecha de la pantalla de juego
|
||||
int center; // Parte central horizontal de la pantalla de juego
|
||||
int top; // Parte superior de la pantalla de juego
|
||||
int bottom; // Parte infoerior de la pantalla de juego
|
||||
int middle; // Parte central vertical de la pantalla de juego
|
||||
};
|
||||
|
||||
// Clase Screen
|
||||
class Screen
|
||||
{
|
||||
private:
|
||||
// Objetos y punteros
|
||||
SDL_Window *window; // Ventana de la aplicación
|
||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||
SDL_Texture *gameCanvas; // Textura para completar la ventana de juego hasta la pantalla completa
|
||||
options_t *options; // Variable con todas las opciones del programa
|
||||
|
||||
// Variables
|
||||
int screenWidth; // Ancho de la pantalla o ventana
|
||||
int screenHeight; // Alto de la pantalla o ventana
|
||||
int gameCanvasWidth; // Resolución interna del juego. Es el ancho de la textura donde se dibuja el juego
|
||||
int gameCanvasHeight; // Resolución interna del juego. Es el alto de la textura donde se dibuja el juego
|
||||
anchor_t anchor; // Variable con los anclajes de la pantalla
|
||||
SDL_Rect dest; // Coordenadas donde se va a dibujar la textura del juego sobre la pantalla o ventana
|
||||
color_t borderColor; // Color del borde añadido a la textura de juego para rellenar la pantalla
|
||||
|
||||
// Variables - Efectos
|
||||
bool fade; // Indica si esta activo el efecto de fade
|
||||
int fadeCounter; // Temporizador para el efecto de fade
|
||||
int fadeLenght; // Duración del fade
|
||||
bool spectrumFade; // Indica si esta activo el efecto de fade spectrum
|
||||
int spectrumFadeCounter; // Temporizador para el efecto de fade spectrum
|
||||
int spectrumFadeLenght; // Duración del fade spectrum
|
||||
std::vector<color_t> spectrumColor; // Colores para el fade spectrum
|
||||
|
||||
// Inicializa las variables para el fade
|
||||
void iniFade();
|
||||
|
||||
// Actualiza el fade
|
||||
void updateFade();
|
||||
|
||||
// Dibuja el fade
|
||||
void renderFade();
|
||||
|
||||
// Inicializa las variables para el fade spectrum
|
||||
void iniSpectrumFade();
|
||||
|
||||
// Actualiza el spectrum fade
|
||||
void updateSpectrumFade();
|
||||
|
||||
// Dibuja el spectrum fade
|
||||
void renderSpectrumFade();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, int gameInternalResX, int gameInternalResY);
|
||||
|
||||
// Limpia la pantalla
|
||||
void clean(color_t color = {0x00, 0x00, 0x00});
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
void start();
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
void blit();
|
||||
|
||||
// Establece el modo de video
|
||||
void setVideoMode(int fullScreenMode);
|
||||
|
||||
// Camibia entre pantalla completa y ventana
|
||||
void switchVideoMode();
|
||||
|
||||
// Cambia el tamaño de la ventana
|
||||
void setWindowSize(int size);
|
||||
|
||||
// Cambia el color del borde
|
||||
void setBorderColor(color_t color);
|
||||
|
||||
// Cambia el tipo de mezcla
|
||||
void setBlendMode(SDL_BlendMode blendMode);
|
||||
|
||||
// Establece el tamaño del borde
|
||||
void setBorderSize(float s);
|
||||
|
||||
// Establece si se ha de ver el borde en el modo ventana
|
||||
void setBorderEnabled(bool value);
|
||||
|
||||
// Cambia entre borde visible y no visible
|
||||
void switchBorder();
|
||||
|
||||
// Activa el fade
|
||||
void setFade();
|
||||
|
||||
// Comprueba si ha terminado el fade
|
||||
bool fadeEnded();
|
||||
|
||||
// Activa el spectrum fade
|
||||
void setspectrumFade();
|
||||
|
||||
// Comprueba si ha terminado el spectrum fade
|
||||
bool spectrumFadeEnded();
|
||||
|
||||
// Actualiza los efectos
|
||||
void updateFX();
|
||||
|
||||
// Dibuja los efectos
|
||||
void renderFX();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,141 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "texture.h"
|
||||
#include <string>
|
||||
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
// Estructura para definir un circulo
|
||||
struct circle_t
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int r;
|
||||
};
|
||||
|
||||
// Estructura para definir una linea horizontal
|
||||
struct h_line_t
|
||||
{
|
||||
int x1, x2, y;
|
||||
};
|
||||
|
||||
// Estructura para definir una linea vertical
|
||||
struct v_line_t
|
||||
{
|
||||
int x, y1, y2;
|
||||
};
|
||||
|
||||
// Estructura para definir una linea diagonal
|
||||
struct d_line_t
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
};
|
||||
|
||||
// Estructura para definir una linea
|
||||
struct line_t
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
};
|
||||
|
||||
// Estructura para definir un color
|
||||
struct color_t
|
||||
{
|
||||
Uint8 r;
|
||||
Uint8 g;
|
||||
Uint8 b;
|
||||
};
|
||||
|
||||
// Tipos de paleta
|
||||
enum palette_e
|
||||
{
|
||||
p_zxspectrum,
|
||||
p_zxarne
|
||||
};
|
||||
|
||||
// Estructura para saber la seccion y subseccion del programa
|
||||
struct section_t
|
||||
{
|
||||
Uint8 name;
|
||||
Uint8 subsection;
|
||||
};
|
||||
|
||||
// Estructura para albergar trucos
|
||||
struct cheat_t
|
||||
{
|
||||
bool infiniteLives; // Indica si el jugador dispone de vidas infinitas
|
||||
bool invincible; // Indica si el jugador puede morir
|
||||
bool jailEnabled; // Indica si la Jail está abierta
|
||||
bool altSkin; // Indicxa si se usa una skin diferente para el jugador
|
||||
};
|
||||
|
||||
// Estructura con todas las opciones de configuración del programa
|
||||
struct options_t
|
||||
{
|
||||
Uint32 fullScreenMode; // Contiene el valor del modo de pantalla completa
|
||||
int windowSize; // Contiene el valor por el que se multiplica el tamaño de la ventana
|
||||
Uint32 filter; // Filtro usado para el escalado de la imagen
|
||||
bool vSync; // Indica si se quiere usar vsync o no
|
||||
int screenWidth; // Ancho de la pantalla o ventana
|
||||
int screenHeight; // Alto de la pantalla o ventana
|
||||
bool integerScale; // Indica si el escalado de la imagen ha de ser entero en el modo a pantalla completa
|
||||
bool keepAspect; // Indica si se ha de mantener la relación de aspecto al poner el modo a pantalla completa
|
||||
bool borderEnabled; // Indica si ha de mostrar el borde en el modo de ventana
|
||||
float borderSize; // Porcentaje de borde que se añade a lo ventana
|
||||
palette_e palette; // Paleta de colores a usar en el juego
|
||||
bool console; // Indica si ha de mostrar información por la consola de texto
|
||||
cheat_t cheat; // Contiene trucos y ventajas para el juego
|
||||
int rooms; // Cantidad de habitaciones visitadas
|
||||
int items; // Cantidad de items obtenidos
|
||||
};
|
||||
|
||||
// Calcula el cuadrado de la distancia entre dos puntos
|
||||
double distanceSquared(int x1, int y1, int x2, int y2);
|
||||
|
||||
// Detector de colisiones entre dos circulos
|
||||
bool checkCollision(circle_t &a, circle_t &b);
|
||||
|
||||
// Detector de colisiones entre un circulo y un rectangulo
|
||||
bool checkCollision(circle_t &a, SDL_Rect &b);
|
||||
|
||||
// Detector de colisiones entre un dos rectangulos
|
||||
bool checkCollision(SDL_Rect &a, SDL_Rect &b);
|
||||
|
||||
// Detector de colisiones entre un punto y un rectangulo
|
||||
bool checkCollision(SDL_Point &p, SDL_Rect &r);
|
||||
|
||||
// Detector de colisiones entre una linea horizontal y un rectangulo
|
||||
bool checkCollision(h_line_t &l, SDL_Rect &r);
|
||||
|
||||
// Detector de colisiones entre una linea vertical y un rectangulo
|
||||
bool checkCollision(v_line_t &l, SDL_Rect &r);
|
||||
|
||||
// Detector de colisiones entre una linea horizontal y un punto
|
||||
bool checkCollision(h_line_t &l, SDL_Point &p);
|
||||
|
||||
// Detector de colisiones entre dos lineas
|
||||
SDL_Point checkCollision(line_t &l1, line_t &l2);
|
||||
|
||||
// Detector de colisiones entre dos lineas
|
||||
SDL_Point checkCollision(d_line_t &l1, v_line_t &l2);
|
||||
|
||||
// Detector de colisiones entre un punto y una linea diagonal
|
||||
bool checkCollision(SDL_Point &p, d_line_t &l);
|
||||
|
||||
// Normaliza una linea diagonal
|
||||
void normalizeLine(d_line_t &l);
|
||||
|
||||
// Devuelve un color_t a partir de un string
|
||||
color_t stringToColor(palette_e pal, std::string str);
|
||||
|
||||
// Convierte una cadena en un valor booleano
|
||||
bool stringToBool(std::string str);
|
||||
|
||||
// Convierte un valor booleano en una cadena
|
||||
std::string boolToString(bool value);
|
||||
|
||||
// Compara dos colores
|
||||
bool colorAreEqual(color_t color1, color_t color2);
|
||||
|
||||
#endif
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <string>
|
||||
#include "common/utils.h"
|
||||
#include "jail_engine/utils.h"
|
||||
|
||||
#ifndef CONST_H
|
||||
#define CONST_H
|
||||
@@ -48,20 +48,22 @@ const int GAMECANVAS_FIRST_QUARTER_Y = GAMECANVAS_HEIGHT / 4;
|
||||
const int GAMECANVAS_THIRD_QUARTER_Y = (GAMECANVAS_HEIGHT / 4) * 3;
|
||||
|
||||
// Secciones del programa
|
||||
#define SECTION_PROG_LOGO 0
|
||||
#define SECTION_PROG_INTRO 1
|
||||
#define SECTION_PROG_TITLE 2
|
||||
#define SECTION_PROG_CREDITS 3
|
||||
#define SECTION_PROG_GAME 4
|
||||
#define SECTION_PROG_DEMO 5
|
||||
#define SECTION_PROG_GAME_OVER 6
|
||||
#define SECTION_PROG_ENDING 7
|
||||
#define SECTION_PROG_ENDING2 8
|
||||
#define SECTION_PROG_QUIT 9
|
||||
#define SECTION_LOGO 0
|
||||
#define SECTION_LOADING_SCREEN 1
|
||||
#define SECTION_TITLE 2
|
||||
#define SECTION_CREDITS 3
|
||||
#define SECTION_GAME 4
|
||||
#define SECTION_DEMO 5
|
||||
#define SECTION_GAME_OVER 6
|
||||
#define SECTION_ENDING 7
|
||||
#define SECTION_ENDING2 8
|
||||
#define SECTION_QUIT 9
|
||||
|
||||
// Subsecciones
|
||||
#define SUBSECTION_LOGO_TO_INTRO 0
|
||||
#define SUBSECTION_LOGO_TO_TITLE 1
|
||||
#define SUBSECTION_TITLE_WITH_LOADING_SCREEN 2
|
||||
#define SUBSECTION_TITLE_WITHOUT_LOADING_SCREEN 3
|
||||
|
||||
// Colores
|
||||
const color_t borderColor = {0x27, 0x27, 0x36};
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
#include "common/asset.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/input.h"
|
||||
#include "common/jail_audio.h"
|
||||
#include "common/movingsprite.h"
|
||||
#include "common/resource.h"
|
||||
#include "common/sprite.h"
|
||||
#include "common/text.h"
|
||||
#include "common/utils.h"
|
||||
#include "jail_engine/asset.h"
|
||||
#include "jail_engine/debug.h"
|
||||
#include "jail_engine/input.h"
|
||||
#include "jail_engine/jail_audio.h"
|
||||
#include "jail_engine/movingsprite.h"
|
||||
#include "jail_engine/resource.h"
|
||||
#include "jail_engine/sprite.h"
|
||||
#include "jail_engine/text.h"
|
||||
#include "jail_engine/utils.h"
|
||||
#include "const.h"
|
||||
#include "credits.h"
|
||||
#include "demo.h"
|
||||
#include "game.h"
|
||||
#include "intro.h"
|
||||
#include "logo.h"
|
||||
#include "title.h"
|
||||
#include "game_over.h"
|
||||
#include "ending.h"
|
||||
#include "ending2.h"
|
||||
#include "gamestate_credits.h"
|
||||
#include "gamestate_demo.h"
|
||||
#include "gamestate_ending.h"
|
||||
#include "gamestate_ending2.h"
|
||||
#include "enter_id.h"
|
||||
#include "gamestate_game_over.h"
|
||||
#include "gamestate_game.h"
|
||||
#include "gamestate_loading_screen.h"
|
||||
#include "gamestate_logo.h"
|
||||
#include "online.h"
|
||||
#include "gamestate_title.h"
|
||||
|
||||
#ifndef DIRECTOR_H
|
||||
#define DIRECTOR_H
|
||||
@@ -36,22 +38,27 @@ private:
|
||||
Game *game; // Objeto para gestionar la sección del juego
|
||||
Logo *logo; // Objeto para gestionar la sección del logo del programa
|
||||
Title *title; // Objeto para gestionar la pantalla de título
|
||||
Intro *intro; // Objeto para gestionar la introducción del juego
|
||||
LoadingScreen *loadingScreen; // Objeto para gestionar la introducción del juego
|
||||
Credits *credits; // Objeto para gestionar los creditos del juego
|
||||
Demo *demo; // Objeto para gestionar el modo demo, en el que se ven pantallas del juego
|
||||
Ending *ending; // Objeto para gestionar el final del juego
|
||||
Ending2 *ending2; // Objeto para gestionar el final del juego
|
||||
GameOver *gameOver; // Objeto para gestionar el final de la partida
|
||||
Debug *debug; // Objeto para getsionar la información de debug
|
||||
Online *online; // Objeto para gestionar la lectura y escritura de datos en el servidor remoto
|
||||
struct options_t *options; // Variable con todas las opciones del programa
|
||||
section_t *section; // Sección y subsección actual del programa;
|
||||
|
||||
// Variables
|
||||
JA_Music music; // Musica del titulo
|
||||
JA_Music_t *music; // Musica del titulo
|
||||
std::string executablePath; // Path del ejecutable
|
||||
section_t section; // Sección y subsección actual del programa;
|
||||
std::string systemFolder; // Carpeta del sistema donde guardar datos
|
||||
|
||||
// Crea e inicializa las opciones del programa
|
||||
void iniOptions();
|
||||
void initOptions();
|
||||
|
||||
// Inicializa los servicios online
|
||||
void initOnline();
|
||||
|
||||
// Comprueba los parametros del programa
|
||||
void checkProgramArguments(int argc, char *argv[]);
|
||||
@@ -62,8 +69,11 @@ private:
|
||||
// Guarda el fichero de configuración
|
||||
bool saveConfig();
|
||||
|
||||
// Crea la carpeta del sistema donde guardar datos
|
||||
void createSystemFolder(std::string folder);
|
||||
|
||||
// Carga los recursos
|
||||
void loadResources(section_t section);
|
||||
void loadResources(section_t *section);
|
||||
|
||||
// Asigna variables a partir de dos cadenas
|
||||
bool setOptions(options_t *options, std::string var, std::string value);
|
||||
@@ -80,20 +90,11 @@ private:
|
||||
// Crea el indice de ficheros
|
||||
bool setFileList();
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
Uint8 getSubsection();
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
Uint8 getSection();
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setSection(section_t section);
|
||||
|
||||
// Ejecuta la seccion de juego con el logo
|
||||
void runLogo();
|
||||
|
||||
// Ejecuta la seccion de juego de la introducción
|
||||
void runIntro();
|
||||
// Ejecuta la seccion de juego de la pantalla de carga
|
||||
void runLoadingScreen();
|
||||
|
||||
// Ejecuta la seccion de juego con el titulo y los menus
|
||||
void runTitle();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "common/animatedsprite.h"
|
||||
#include "common/asset.h"
|
||||
#include "common/utils.h"
|
||||
#include "jail_engine/animatedsprite.h"
|
||||
#include "jail_engine/asset.h"
|
||||
#include "jail_engine/utils.h"
|
||||
#include <string>
|
||||
|
||||
#ifndef ENEMY_H
|
||||
|
||||
326
source/enter_id.cpp
Normal file
@@ -0,0 +1,326 @@
|
||||
#include "jail_engine/jail_audio.h"
|
||||
#include "jail_engine/jscore.h"
|
||||
#include "const.h"
|
||||
#include "enter_id.h"
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options, section_t *section)
|
||||
{
|
||||
// Copia la dirección de los objetos
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->asset = asset;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros
|
||||
eventHandler = new SDL_Event();
|
||||
texture = new Texture(renderer, asset->get("smb2.png"));
|
||||
text = new Text(asset->get("smb2.txt"), texture, renderer);
|
||||
|
||||
// Crea la textura para el texto que se escribe en pantalla
|
||||
textTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
||||
if (textTexture == nullptr)
|
||||
{
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Error: textTexture could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
}
|
||||
SDL_SetTextureBlendMode(textTexture, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Inicializa variables
|
||||
oldJailerID = options->online.jailerID;
|
||||
loopRunning = true;
|
||||
counter = 0;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
jailerIDPos = 0;
|
||||
initName();
|
||||
|
||||
// Escribe el texto en la textura
|
||||
fillTexture();
|
||||
}
|
||||
|
||||
// Destructor
|
||||
EnterID::~EnterID()
|
||||
{
|
||||
delete eventHandler;
|
||||
delete text;
|
||||
delete texture;
|
||||
SDL_DestroyTexture(textTexture);
|
||||
}
|
||||
|
||||
// Bucle para el logo del juego
|
||||
void EnterID::run()
|
||||
{
|
||||
while (loopRunning)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void EnterID::checkEvents()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
{
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section->name = SECTION_QUIT;
|
||||
loopRunning = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
{
|
||||
if (eventHandler->key.keysym.scancode == SDL_SCANCODE_RETURN)
|
||||
{
|
||||
options->online.jailerID = toLower((std::string)name);
|
||||
endSection();
|
||||
break;
|
||||
}
|
||||
|
||||
if (eventHandler->key.keysym.scancode >= SDL_SCANCODE_A && eventHandler->key.keysym.scancode <= SDL_SCANCODE_Z)
|
||||
{ // Si pulsa una letra
|
||||
if (pos < maxLenght)
|
||||
{
|
||||
name[pos++] = eventHandler->key.keysym.scancode + 61;
|
||||
name[pos] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode >= SDL_SCANCODE_1 && eventHandler->key.keysym.scancode <= SDL_SCANCODE_9)
|
||||
{ // Si pulsa un número
|
||||
if (pos < maxLenght)
|
||||
{ // En ascii el '0' va antes del '1', pero en scancode el '0' va despues de '9'
|
||||
name[pos++] = eventHandler->key.keysym.scancode + 19;
|
||||
name[pos] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_0)
|
||||
{
|
||||
if (pos < maxLenght)
|
||||
{
|
||||
name[pos++] = 48;
|
||||
name[pos] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_BACKSPACE)
|
||||
{
|
||||
if (pos > 0)
|
||||
{
|
||||
name[--pos] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_ESCAPE)
|
||||
{
|
||||
section->name = SECTION_QUIT;
|
||||
loopRunning = false;
|
||||
break;
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_F1)
|
||||
{
|
||||
screen->setWindowSize(1);
|
||||
break;
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_F2)
|
||||
{
|
||||
screen->setWindowSize(2);
|
||||
break;
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_F3)
|
||||
{
|
||||
screen->setWindowSize(3);
|
||||
break;
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_F4)
|
||||
{
|
||||
screen->setWindowSize(4);
|
||||
break;
|
||||
}
|
||||
|
||||
else if (eventHandler->key.keysym.scancode == SDL_SCANCODE_F5)
|
||||
{
|
||||
switchPalette();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza las variables
|
||||
void EnterID::update()
|
||||
{
|
||||
// Comprueba que la diferencia de ticks sea mayor a la velocidad del juego
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
{
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Actualiza el contador
|
||||
counter++;
|
||||
|
||||
// Actualiza el cursor
|
||||
cursor = (counter % 20 >= 10) ? " " : "_";
|
||||
|
||||
// Actualiza las notificaciones
|
||||
screen->updateNotifier();
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja en pantalla
|
||||
void EnterID::render()
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Dibuja la textura con el texto en pantalla
|
||||
SDL_RenderCopy(renderer, textTexture, nullptr, nullptr);
|
||||
|
||||
// Escribe el jailerID
|
||||
const std::string jailerID = (std::string)name + cursor;
|
||||
const color_t color = stringToColor(options->palette, "white");
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, jailerIDPos, jailerID, 1, color);
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
|
||||
// Inicializa los textos
|
||||
void EnterID::iniTexts()
|
||||
{
|
||||
texts.clear();
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"ONLINE CONFIGURATION:", stringToColor(options->palette, "green")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"PLEASE ENTER AN ID OR", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"LEAVE BLANK FOR OFFLINE MODE", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"JAILER_ID:", stringToColor(options->palette, "green")});
|
||||
|
||||
jailerIDPos = ((int)texts.size() + 1) * text->getCharacterSize();
|
||||
}
|
||||
|
||||
// Escribe el texto en la textura
|
||||
void EnterID::fillTexture()
|
||||
{
|
||||
// Inicializa los textos
|
||||
iniTexts();
|
||||
|
||||
// Rellena la textura de texto
|
||||
SDL_SetRenderTarget(renderer, textTexture);
|
||||
color_t c = stringToColor(options->palette, "black");
|
||||
SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, 0xFF);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
// Escribe el texto en la textura
|
||||
const int size = text->getCharacterSize();
|
||||
int i = 0;
|
||||
|
||||
for (auto t : texts)
|
||||
{
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, PLAY_AREA_CENTER_X, i * size, t.label, 1, t.color);
|
||||
i++;
|
||||
}
|
||||
|
||||
SDL_SetRenderTarget(renderer, nullptr);
|
||||
}
|
||||
|
||||
// Inicializa los servicios online
|
||||
void EnterID::initOnline()
|
||||
{
|
||||
// Si ya ha iniciado la sesión y no ha cambiado el jailerID, que no continue
|
||||
if (options->online.sessionEnabled)
|
||||
{
|
||||
if (oldJailerID == options->online.jailerID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (options->online.jailerID == "")
|
||||
{ // Jailer ID no definido
|
||||
options->online.enabled = false;
|
||||
options->online.sessionEnabled = false;
|
||||
}
|
||||
else
|
||||
{ // Jailer ID iniciado
|
||||
options->online.enabled = options->online.sessionEnabled = true;
|
||||
// Establece el servidor y el puerto
|
||||
jscore::init(options->online.server, options->online.port);
|
||||
#ifdef DEBUG
|
||||
const std::string caption = "IS LOGGED IN (DEBUG)";
|
||||
#else
|
||||
const std::string caption = "IS LOGGED IN";
|
||||
#endif
|
||||
screen->showNotification(options->online.jailerID, caption, 12);
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << caption << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Termina la sección
|
||||
void EnterID::endSection()
|
||||
{
|
||||
loopRunning = false;
|
||||
initOnline();
|
||||
}
|
||||
|
||||
// Inicializa el vector utilizado para almacenar el texto que se escribe en pantalla
|
||||
void EnterID::initName()
|
||||
{
|
||||
// Calcula el tamaño del vector
|
||||
name[0] = 0;
|
||||
maxLenght = sizeof(name) / sizeof(name[pos]);
|
||||
|
||||
// Inicializa el vector con ceros
|
||||
for (int i = 0; i < maxLenght; ++i)
|
||||
{
|
||||
name[i] = 0;
|
||||
}
|
||||
|
||||
// Si no hay definido ningun JailerID, coloca el cursor en primera posición
|
||||
if (options->online.jailerID == "")
|
||||
{
|
||||
pos = 0;
|
||||
}
|
||||
else
|
||||
{ // En caso contrario, copia el texto al vector y coloca el cursor en posición
|
||||
const int len = std::min((int)options->online.jailerID.size(), maxLenght);
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
name[i] = (char)options->online.jailerID[i];
|
||||
}
|
||||
pos = len;
|
||||
}
|
||||
}
|
||||
|
||||
// Cambia la paleta
|
||||
void EnterID::switchPalette()
|
||||
{
|
||||
options->palette = options->palette == p_zxspectrum ? p_zxarne : p_zxspectrum;
|
||||
fillTexture();
|
||||
}
|
||||
86
source/enter_id.h
Normal file
@@ -0,0 +1,86 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
#include "jail_engine/asset.h"
|
||||
#include "jail_engine/screen.h"
|
||||
#include "jail_engine/utils.h"
|
||||
#include "jail_engine/text.h"
|
||||
#include "jail_engine/texture.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef ENTER_ID_H
|
||||
#define ENTER_ID_H
|
||||
|
||||
class EnterID
|
||||
{
|
||||
private:
|
||||
struct captions_t
|
||||
{
|
||||
std::string label; // Texto a escribir
|
||||
color_t color; // Color del texto
|
||||
};
|
||||
|
||||
// Punteros y objetos
|
||||
Asset *asset; // Objeto con los ficheros de recursos
|
||||
options_t *options; // Puntero a las opciones del juego
|
||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||
SDL_Event *eventHandler; // Manejador de eventos
|
||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||
SDL_Texture *textTexture; // Textura para dibujar el texto
|
||||
Text *text; // Objeto para escribir texto en pantalla
|
||||
Texture *texture; // Textura para la fuente para el texto
|
||||
section_t *section; // Estado del bucle principal para saber si continua o se sale
|
||||
|
||||
// Variables
|
||||
bool loopRunning; // Indica si ha de terminar el bucle principal
|
||||
int counter; // Contador
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
std::vector<captions_t> texts; // Vector con los textos
|
||||
std::string cursor; // Contiene el caracter que se muestra como cursor
|
||||
|
||||
char name[15]; // Aqui se guardan los caracteres de las teclas que se van pulsando
|
||||
int pos; // Posición actual en el vector name
|
||||
int maxLenght; // Tamaño máximo del jailerID
|
||||
std::string oldJailerID; // Almacena el valor de jailerID al inicio para ver si se ha modificado
|
||||
int jailerIDPos; // Posición en el eje Y donde ser va a escribir el texto
|
||||
|
||||
// Actualiza las variables
|
||||
void update();
|
||||
|
||||
// Dibuja en pantalla
|
||||
void render();
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void checkEvents();
|
||||
|
||||
// Inicializa los textos
|
||||
void iniTexts();
|
||||
|
||||
// Escribe el texto en la textura
|
||||
void fillTexture();
|
||||
|
||||
// Inicializa los servicios online
|
||||
void initOnline();
|
||||
|
||||
// Termina la sección
|
||||
void endSection();
|
||||
|
||||
// Inicializa el vector utilizado para almacenar el texto que se escribe en pantalla
|
||||
void initName();
|
||||
|
||||
// Cambia la paleta
|
||||
void switchPalette();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options, section_t *section);
|
||||
|
||||
// Destructor
|
||||
~EnterID();
|
||||
|
||||
// Bucle principal
|
||||
void run();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,15 +1,17 @@
|
||||
#include "credits.h"
|
||||
#include "gamestate_credits.h"
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
Credits::Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options)
|
||||
Credits::Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||
{
|
||||
// Copia la dirección de los objetos
|
||||
this->resource = resource;
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->resource = resource;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros
|
||||
eventHandler = new SDL_Event();
|
||||
@@ -20,8 +22,8 @@ Credits::Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Ass
|
||||
counter = 0;
|
||||
counterEnabled = true;
|
||||
subCounter = 0;
|
||||
section.name = SECTION_PROG_CREDITS;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_CREDITS;
|
||||
section->subsection = 0;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
sprite->setRect({194, 174, 8, 8});
|
||||
@@ -66,7 +68,7 @@ Credits::~Credits()
|
||||
}
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void Credits::checkEventHandler()
|
||||
void Credits::checkEvents()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
@@ -74,65 +76,71 @@ void Credits::checkEventHandler()
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section->name = SECTION_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
// Comprueba las entradas
|
||||
void Credits::checkInput()
|
||||
{
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_B:
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_QUIT;
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_toggle_border, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchBorder();
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchVideoMode();
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->setWindowSize(1);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->decWindowSize();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->setWindowSize(2);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->incWindowSize();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
screen->setWindowSize(3);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
screen->setWindowSize(4);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
else if (input->checkInput(input_swap_palette, REPEAT_FALSE))
|
||||
{
|
||||
switchPalette();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
section.name = SECTION_PROG_TITLE;
|
||||
section.subsection = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (input->checkInput(input_pause, REPEAT_FALSE) || input->checkInput(input_accept, REPEAT_FALSE) || input->checkInput(input_jump, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_TITLE;
|
||||
section->subsection = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Inicializa los textos
|
||||
void Credits::iniTexts()
|
||||
{
|
||||
std::string keys = "";
|
||||
if (options->keys == ctrl_cursor)
|
||||
{
|
||||
keys = "CURSORS";
|
||||
}
|
||||
else if (options->keys == ctrl_opqa)
|
||||
{
|
||||
keys = "O,P AND Q";
|
||||
}
|
||||
else
|
||||
{
|
||||
keys = "A,D AND W";
|
||||
}
|
||||
|
||||
#ifndef GAME_CONSOLE
|
||||
texts.clear();
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"INSTRUCTIONS:", stringToColor(options->palette, "yellow")});
|
||||
@@ -145,12 +153,12 @@ void Credits::iniTexts()
|
||||
|
||||
texts.push_back({"KEYS:", stringToColor(options->palette, "yellow")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"CURSORS TO MOVE AND JUMP", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"M TO TURN ON/OFF THE MUSIC", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"P TO PAUSE THE GAME", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"F1-F4 TO CHANGE WINDOWS SIZE", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"F TO SWITCH TO FULLSCREEN", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"B TO SWITCH THE BORDER SCREEN", stringToColor(options->palette, "white")});
|
||||
texts.push_back({keys + " TO MOVE AND JUMP", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"M TO SWITCH THE MUSIC", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"H TO PAUSE THE GAME", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"F1-F2 TO CHANGE WINDOWS SIZE", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"F3 TO SWITCH TO FULLSCREEN", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"B TO TOOGLE THE BORDER SCREEN", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
|
||||
@@ -161,6 +169,36 @@ void Credits::iniTexts()
|
||||
|
||||
texts.push_back({"I LOVE JAILGAMES! ", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
#else
|
||||
texts.clear();
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"INSTRUCTIONS:", stringToColor(options->palette, "yellow")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"HELP JAILDOC TO GET BACK ALL", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"HIS PROJECTS AND GO TO THE", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"JAIL TO FINISH THEM", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
|
||||
texts.push_back({"KEYS:", stringToColor(options->palette, "yellow")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"B TO JUMP", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"R TO SWITCH THE MUSIC", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"L TO SWAP THE COLOR PALETTE", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"START TO PAUSE", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"SELECT TO EXIT", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
|
||||
texts.push_back({"A GAME BY JAILDESIGNER", stringToColor(options->palette, "yellow")});
|
||||
texts.push_back({"MADE ON SUMMER/FALL 2022", stringToColor(options->palette, "yellow")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
|
||||
texts.push_back({"I LOVE JAILGAMES! ", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
#endif
|
||||
}
|
||||
|
||||
// Escribe el texto en la textura
|
||||
@@ -186,7 +224,7 @@ void Credits::fillTexture()
|
||||
}
|
||||
|
||||
// Escribe el corazón
|
||||
const int textLenght = text->lenght(texts.at(22).label, 1) - text->lenght(" ", 1); // Se resta el ultimo caracter que es un espacio
|
||||
const int textLenght = text->lenght(texts[22].label, 1) - text->lenght(" ", 1); // Se resta el ultimo caracter que es un espacio
|
||||
const int posX = ((PLAY_AREA_WIDTH - textLenght) / 2) + textLenght;
|
||||
text->writeColored(posX, 176, "}", stringToColor(options->palette, "bright_red"));
|
||||
|
||||
@@ -245,7 +283,7 @@ void Credits::updateCounter()
|
||||
// Comprueba si ha terminado la sección
|
||||
if (counter > 1200)
|
||||
{
|
||||
section.name = SECTION_PROG_DEMO;
|
||||
section->name = SECTION_DEMO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,12 +296,15 @@ void Credits::update()
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
checkEventHandler();
|
||||
// Comprueba las entradas
|
||||
checkInput();
|
||||
|
||||
// Actualiza el contador
|
||||
updateCounter();
|
||||
|
||||
// Actualiza las notificaciones
|
||||
screen->updateNotifier();
|
||||
|
||||
// Actualiza el sprite con el brillo
|
||||
if (counter > 770)
|
||||
{
|
||||
@@ -301,28 +342,19 @@ void Credits::render()
|
||||
}
|
||||
|
||||
// Bucle para el logo del juego
|
||||
section_t Credits::run()
|
||||
void Credits::run()
|
||||
{
|
||||
while (section.name == SECTION_PROG_CREDITS)
|
||||
while (section->name == SECTION_CREDITS)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
// Cambia la paleta
|
||||
void Credits::switchPalette()
|
||||
{
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
options->palette = p_zxarne;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->palette = p_zxspectrum;
|
||||
}
|
||||
|
||||
options->palette = options->palette == p_zxspectrum ? p_zxarne : p_zxspectrum;
|
||||
fillTexture();
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "common/animatedsprite.h"
|
||||
#include "common/asset.h"
|
||||
#include "common/jail_audio.h"
|
||||
#include "common/resource.h"
|
||||
#include "common/screen.h"
|
||||
#include "common/sprite.h"
|
||||
#include "common/text.h"
|
||||
#include "common/texture.h"
|
||||
#include "common/utils.h"
|
||||
#include "jail_engine/animatedsprite.h"
|
||||
#include "jail_engine/asset.h"
|
||||
#include "jail_engine/input.h"
|
||||
#include "jail_engine/jail_audio.h"
|
||||
#include "jail_engine/resource.h"
|
||||
#include "jail_engine/screen.h"
|
||||
#include "jail_engine/sprite.h"
|
||||
#include "jail_engine/text.h"
|
||||
#include "jail_engine/texture.h"
|
||||
#include "jail_engine/utils.h"
|
||||
#include "const.h"
|
||||
#include <vector>
|
||||
|
||||
@@ -30,18 +31,19 @@ private:
|
||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||
Resource *resource; // Objeto con los recursos
|
||||
Asset *asset; // Objeto con los ficheros de recursos
|
||||
Input *input; // Objeto pata gestionar la entrada
|
||||
SDL_Event *eventHandler; // Manejador de eventos
|
||||
Text *text; // Objeto para escribir texto en pantalla
|
||||
SDL_Texture *textTexture; // Textura para dibujar el texto
|
||||
SDL_Texture *coverTexture; // Textura para cubrir el texto
|
||||
AnimatedSprite *sprite; // Sprite para el brillo del corazón
|
||||
options_t *options; // Puntero a las opciones del juego
|
||||
section_t *section; // Estado del bucle principal para saber si continua o se sale
|
||||
|
||||
// Variables
|
||||
int counter; // Contador
|
||||
bool counterEnabled; // Indica si esta activo el contador
|
||||
int subCounter; // Contador secundario
|
||||
section_t section; // Estado del bucle principal para saber si continua o se sale
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
std::vector<captions_t> texts; // Vector con los textos
|
||||
@@ -53,7 +55,10 @@ private:
|
||||
void render();
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void checkEventHandler();
|
||||
void checkEvents();
|
||||
|
||||
// Comprueba las entradas
|
||||
void checkInput();
|
||||
|
||||
// Actualiza el contador
|
||||
void updateCounter();
|
||||
@@ -69,13 +74,13 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options);
|
||||
Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section);
|
||||
|
||||
// Destructor
|
||||
~Credits();
|
||||
|
||||
// Bucle principal
|
||||
section_t run();
|
||||
void run();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "demo.h"
|
||||
#include "gamestate_demo.h"
|
||||
|
||||
// Constructor
|
||||
Demo::Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, Debug *debug)
|
||||
Demo::Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section, Debug *debug)
|
||||
{
|
||||
// Inicia algunas variables
|
||||
board.iniClock = SDL_GetTicks();
|
||||
@@ -15,15 +15,17 @@ Demo::Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
||||
rooms.push_back("44.room");
|
||||
|
||||
roomIndex = 0;
|
||||
currentRoom = rooms.at(roomIndex);
|
||||
currentRoom = rooms[roomIndex];
|
||||
|
||||
// Copia los punteros
|
||||
this->resource = resource;
|
||||
this->renderer = renderer;
|
||||
this->asset = asset;
|
||||
this->screen = screen;
|
||||
this->debug = debug;
|
||||
this->resource = resource;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
this->debug = debug;
|
||||
|
||||
// Crea los objetos
|
||||
itemTracker = new ItemTracker();
|
||||
@@ -40,12 +42,12 @@ Demo::Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
||||
board.lives = 9;
|
||||
board.items = 0;
|
||||
board.rooms = 1;
|
||||
board.jailEnabled = options->cheat.jailEnabled;
|
||||
board.jailEnabled = false;
|
||||
board.music = true;
|
||||
setScoreBoardColor();
|
||||
|
||||
section.name = SECTION_PROG_DEMO;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_DEMO;
|
||||
section->subsection = 0;
|
||||
}
|
||||
|
||||
Demo::~Demo()
|
||||
@@ -59,7 +61,7 @@ Demo::~Demo()
|
||||
}
|
||||
|
||||
// Comprueba los eventos de la cola
|
||||
void Demo::checkEventHandler()
|
||||
void Demo::checkEvents()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
@@ -67,73 +69,67 @@ void Demo::checkEventHandler()
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section->name = SECTION_QUIT;
|
||||
screen->setBorderColor(stringToColor(options->palette, "black"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
// Comprueba las entradas
|
||||
void Demo::checkInput()
|
||||
{
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_B:
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_QUIT;
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_toggle_border, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchBorder();
|
||||
reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchVideoMode();
|
||||
reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->setWindowSize(1);
|
||||
else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->decWindowSize();
|
||||
reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->setWindowSize(2);
|
||||
else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->incWindowSize();
|
||||
reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
screen->setWindowSize(3);
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
screen->setWindowSize(4);
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
else if (input->checkInput(input_swap_palette, REPEAT_FALSE))
|
||||
{
|
||||
switchPalette();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
section.name = SECTION_PROG_TITLE;
|
||||
section.subsection = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (input->checkInput(input_pause, REPEAT_FALSE) || input->checkInput(input_accept, REPEAT_FALSE) || input->checkInput(input_jump, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_TITLE;
|
||||
section->subsection = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Bucle para el juego
|
||||
section_t Demo::run()
|
||||
void Demo::run()
|
||||
{
|
||||
while (section.name == SECTION_PROG_DEMO)
|
||||
while (section->name == SECTION_DEMO)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
// Actualiza el juego, las variables, comprueba la entrada, etc.
|
||||
@@ -145,14 +141,17 @@ void Demo::update()
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Comprueba los eventos de la cola
|
||||
checkEventHandler();
|
||||
// Comprueba las entradas
|
||||
checkInput();
|
||||
|
||||
// Actualiza los objetos
|
||||
room->update();
|
||||
scoreboard->update();
|
||||
screen->updateFX();
|
||||
checkRoomChange();
|
||||
|
||||
// Actualiza las notificaciones
|
||||
screen->updateNotifier();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,8 +160,8 @@ void Demo::render()
|
||||
{
|
||||
// Prepara para dibujar el frame
|
||||
screen->start();
|
||||
screen->clean(room->getBGColor());
|
||||
|
||||
// Dibuja los elementos del juego en orden
|
||||
room->renderMap();
|
||||
room->renderEnemies();
|
||||
room->renderItems();
|
||||
@@ -252,12 +251,12 @@ void Demo::checkRoomChange()
|
||||
roomIndex++;
|
||||
if (roomIndex == (int)rooms.size())
|
||||
{
|
||||
section.name = SECTION_PROG_LOGO;
|
||||
section.subsection = SUBSECTION_LOGO_TO_TITLE;
|
||||
section->name = SECTION_LOGO;
|
||||
section->subsection = SUBSECTION_LOGO_TO_TITLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
changeRoom(rooms.at(roomIndex));
|
||||
changeRoom(rooms[roomIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "common/animatedsprite.h"
|
||||
#include "common/asset.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/input.h"
|
||||
#include "common/resource.h"
|
||||
#include "common/screen.h"
|
||||
#include "common/sprite.h"
|
||||
#include "common/text.h"
|
||||
#include "common/utils.h"
|
||||
#include "jail_engine/animatedsprite.h"
|
||||
#include "jail_engine/asset.h"
|
||||
#include "jail_engine/input.h"
|
||||
#include "jail_engine/debug.h"
|
||||
#include "jail_engine/input.h"
|
||||
#include "jail_engine/resource.h"
|
||||
#include "jail_engine/screen.h"
|
||||
#include "jail_engine/sprite.h"
|
||||
#include "jail_engine/text.h"
|
||||
#include "jail_engine/utils.h"
|
||||
#include "const.h"
|
||||
#include "item_tracker.h"
|
||||
#include "room_tracker.h"
|
||||
@@ -29,16 +30,17 @@ private:
|
||||
Room *room; // Objeto encargado de gestionar cada habitación del juego
|
||||
Resource *resource; // Objeto con los recursos
|
||||
Asset *asset; // Objeto con la ruta a todos los ficheros de recursos
|
||||
Input *input; // Objeto pata gestionar la entrada
|
||||
Text *text; // Objeto para los textos del juego
|
||||
ScoreBoard *scoreboard; // Objeto encargado de gestionar el marcador
|
||||
ItemTracker *itemTracker; // Lleva el control de los objetos recogidos
|
||||
Debug *debug; // Objeto para gestionar la información de debug
|
||||
options_t *options; // Puntero a las opciones del juego
|
||||
section_t *section; // Seccion actual dentro del juego
|
||||
|
||||
// Variables
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
section_t section; // Seccion actual dentro del juego
|
||||
std::string currentRoom; // Fichero de la habitación actual
|
||||
board_t board; // Estructura con los datos del marcador
|
||||
int counter; // Contador para el modo demo
|
||||
@@ -53,7 +55,10 @@ private:
|
||||
void render();
|
||||
|
||||
// Comprueba los eventos de la cola
|
||||
void checkEventHandler();
|
||||
void checkEvents();
|
||||
|
||||
// Comprueba las entradas
|
||||
void checkInput();
|
||||
|
||||
// Escribe el nombre de la pantalla
|
||||
void renderRoomName();
|
||||
@@ -75,13 +80,13 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, Debug *debug);
|
||||
Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section, Debug *debug);
|
||||
|
||||
// Destructor
|
||||
~Demo();
|
||||
|
||||
// Bucle para el juego
|
||||
section_t run();
|
||||
void run();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,14 +1,16 @@
|
||||
#include "ending.h"
|
||||
#include "gamestate_ending.h"
|
||||
|
||||
// Constructor
|
||||
Ending::Ending(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options)
|
||||
Ending::Ending(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||
{
|
||||
// Copia los punteros
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->resource = resource;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros a objetos
|
||||
eventHandler = new SDL_Event();
|
||||
@@ -19,8 +21,8 @@ Ending::Ending(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset
|
||||
counter = -1;
|
||||
preCounter = 0;
|
||||
coverCounter = 0;
|
||||
section.name = SECTION_PROG_ENDING;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_ENDING;
|
||||
section->subsection = 0;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
scene = 0;
|
||||
@@ -89,8 +91,8 @@ void Ending::update()
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
checkEventHandler();
|
||||
// Comprueba las entradas
|
||||
checkInput();
|
||||
|
||||
// Actualiza el contador
|
||||
updateCounters();
|
||||
@@ -103,6 +105,9 @@ void Ending::update()
|
||||
|
||||
// Actualiza el volumen de la musica
|
||||
updateMusicVolume();
|
||||
|
||||
// Actualiza las notificaciones
|
||||
screen->updateNotifier();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,16 +121,16 @@ void Ending::render()
|
||||
screen->clean(stringToColor(options->palette, "black"));
|
||||
|
||||
// Dibuja las imagenes de la escena
|
||||
spritePics.at(scene).sprite->render();
|
||||
spritePics.at(scene).coverSprite->render();
|
||||
spritePics[scene].sprite->render();
|
||||
spritePics[scene].coverSprite->render();
|
||||
|
||||
// Dibuja los textos de la escena
|
||||
for (auto ti : scenes.at(scene).textIndex)
|
||||
for (auto ti : scenes[scene].textIndex)
|
||||
{
|
||||
if (counter > ti.trigger)
|
||||
{
|
||||
spriteTexts.at(ti.index).sprite->render();
|
||||
spriteTexts.at(ti.index).coverSprite->render();
|
||||
spriteTexts[ti.index].sprite->render();
|
||||
spriteTexts[ti.index].coverSprite->render();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +144,7 @@ void Ending::render()
|
||||
}
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void Ending::checkEventHandler()
|
||||
void Ending::checkEvents()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
@@ -147,57 +152,45 @@ void Ending::checkEventHandler()
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section->name = SECTION_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
// Comprueba las entradas
|
||||
void Ending::checkInput()
|
||||
{
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_B:
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_LOGO;
|
||||
section->subsection = SUBSECTION_LOGO_TO_INTRO;
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_toggle_border, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchBorder();
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchVideoMode();
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->setWindowSize(1);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->decWindowSize();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->setWindowSize(2);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->incWindowSize();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
screen->setWindowSize(3);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
screen->setWindowSize(4);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
else if (input->checkInput(input_swap_palette, REPEAT_FALSE))
|
||||
{
|
||||
switchPalette();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,20 +472,19 @@ void Ending::iniScenes()
|
||||
}
|
||||
|
||||
// Bucle principal
|
||||
section_t Ending::run()
|
||||
void Ending::run()
|
||||
{
|
||||
JA_PlayMusic(music);
|
||||
|
||||
while (section.name == SECTION_PROG_ENDING)
|
||||
while (section->name == SECTION_ENDING)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
}
|
||||
|
||||
JA_StopMusic();
|
||||
JA_SetVolume(128);
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
// Actualiza los contadores
|
||||
@@ -508,7 +500,7 @@ void Ending::updateCounters()
|
||||
counter++;
|
||||
}
|
||||
|
||||
if (counter > scenes.at(scene).counterEnd - 100)
|
||||
if (counter > scenes[scene].counterEnd - 100)
|
||||
{
|
||||
coverCounter++;
|
||||
}
|
||||
@@ -519,20 +511,20 @@ void Ending::updateSpriteCovers()
|
||||
{ // Actualiza la cortinilla de los textos
|
||||
if (counter % 4 == 0)
|
||||
{
|
||||
for (auto ti : scenes.at(scene).textIndex)
|
||||
for (auto ti : scenes[scene].textIndex)
|
||||
{
|
||||
if (counter > ti.trigger)
|
||||
{
|
||||
if (spriteTexts.at(ti.index).clipDesp > 0)
|
||||
if (spriteTexts[ti.index].clipDesp > 0)
|
||||
{
|
||||
spriteTexts.at(ti.index).clipDesp -= 2;
|
||||
spriteTexts[ti.index].clipDesp -= 2;
|
||||
}
|
||||
else if (spriteTexts.at(ti.index).clipHeight > 0)
|
||||
else if (spriteTexts[ti.index].clipHeight > 0)
|
||||
{
|
||||
spriteTexts.at(ti.index).clipHeight -= 2;
|
||||
spriteTexts.at(ti.index).coverSprite->setPosY(spriteTexts.at(ti.index).coverSprite->getPosY() + 2);
|
||||
spriteTexts[ti.index].clipHeight -= 2;
|
||||
spriteTexts[ti.index].coverSprite->setPosY(spriteTexts[ti.index].coverSprite->getPosY() + 2);
|
||||
}
|
||||
spriteTexts.at(ti.index).coverSprite->setSpriteClip(0, spriteTexts.at(ti.index).clipDesp, spriteTexts.at(ti.index).coverSprite->getWidth(), spriteTexts.at(ti.index).clipHeight);
|
||||
spriteTexts[ti.index].coverSprite->setSpriteClip(0, spriteTexts[ti.index].clipDesp, spriteTexts[ti.index].coverSprite->getWidth(), spriteTexts[ti.index].clipHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -540,27 +532,27 @@ void Ending::updateSpriteCovers()
|
||||
// Actualiza la cortinilla de las imagenes
|
||||
if (counter % 2 == 0)
|
||||
{
|
||||
if (spritePics.at(scene).clipDesp > 0)
|
||||
if (spritePics[scene].clipDesp > 0)
|
||||
{
|
||||
spritePics.at(scene).clipDesp -= 2;
|
||||
spritePics[scene].clipDesp -= 2;
|
||||
}
|
||||
else if (spritePics.at(scene).clipHeight > 0)
|
||||
else if (spritePics[scene].clipHeight > 0)
|
||||
{
|
||||
spritePics.at(scene).clipHeight -= 2;
|
||||
if (spritePics.at(scene).clipHeight < 0)
|
||||
spritePics[scene].clipHeight -= 2;
|
||||
if (spritePics[scene].clipHeight < 0)
|
||||
{
|
||||
spritePics.at(scene).clipHeight = 0;
|
||||
spritePics[scene].clipHeight = 0;
|
||||
}
|
||||
spritePics.at(scene).coverSprite->setPosY(spritePics.at(scene).coverSprite->getPosY() + 2);
|
||||
spritePics[scene].coverSprite->setPosY(spritePics[scene].coverSprite->getPosY() + 2);
|
||||
}
|
||||
spritePics.at(scene).coverSprite->setSpriteClip(0, spritePics.at(scene).clipDesp, spritePics.at(scene).coverSprite->getWidth(), spritePics.at(scene).clipHeight);
|
||||
spritePics[scene].coverSprite->setSpriteClip(0, spritePics[scene].clipDesp, spritePics[scene].coverSprite->getWidth(), spritePics[scene].clipHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba si se ha de cambiar de escena
|
||||
void Ending::checkChangeScene()
|
||||
{
|
||||
if (counter > scenes.at(scene).counterEnd)
|
||||
if (counter > scenes[scene].counterEnd)
|
||||
{
|
||||
scene++;
|
||||
counter = 0;
|
||||
@@ -568,7 +560,7 @@ void Ending::checkChangeScene()
|
||||
if (scene == 5)
|
||||
{
|
||||
// Termina el bucle
|
||||
section.name = SECTION_PROG_ENDING2;
|
||||
section->name = SECTION_ENDING2;
|
||||
|
||||
// Mantiene los valores anteriores
|
||||
scene = 4;
|
||||
@@ -636,20 +628,20 @@ void Ending::switchPalette()
|
||||
{
|
||||
options->palette = p_zxarne;
|
||||
|
||||
spritePics.at(0).sprite->setTexture(resource->getTexture("ending1_zxarne.png"));
|
||||
spritePics.at(1).sprite->setTexture(resource->getTexture("ending2_zxarne.png"));
|
||||
spritePics.at(2).sprite->setTexture(resource->getTexture("ending3_zxarne.png"));
|
||||
spritePics.at(3).sprite->setTexture(resource->getTexture("ending4_zxarne.png"));
|
||||
spritePics.at(4).sprite->setTexture(resource->getTexture("ending5_zxarne.png"));
|
||||
spritePics[0].sprite->setTexture(resource->getTexture("ending1_zxarne.png"));
|
||||
spritePics[1].sprite->setTexture(resource->getTexture("ending2_zxarne.png"));
|
||||
spritePics[2].sprite->setTexture(resource->getTexture("ending3_zxarne.png"));
|
||||
spritePics[3].sprite->setTexture(resource->getTexture("ending4_zxarne.png"));
|
||||
spritePics[4].sprite->setTexture(resource->getTexture("ending5_zxarne.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
options->palette = p_zxspectrum;
|
||||
|
||||
spritePics.at(0).sprite->setTexture(resource->getTexture("ending1.png"));
|
||||
spritePics.at(1).sprite->setTexture(resource->getTexture("ending2.png"));
|
||||
spritePics.at(2).sprite->setTexture(resource->getTexture("ending3.png"));
|
||||
spritePics.at(3).sprite->setTexture(resource->getTexture("ending4.png"));
|
||||
spritePics.at(4).sprite->setTexture(resource->getTexture("ending5.png"));
|
||||
spritePics[0].sprite->setTexture(resource->getTexture("ending1.png"));
|
||||
spritePics[1].sprite->setTexture(resource->getTexture("ending2.png"));
|
||||
spritePics[2].sprite->setTexture(resource->getTexture("ending3.png"));
|
||||
spritePics[3].sprite->setTexture(resource->getTexture("ending4.png"));
|
||||
spritePics[4].sprite->setTexture(resource->getTexture("ending5.png"));
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
#include "common/asset.h"
|
||||
#include "common/jail_audio.h"
|
||||
#include "common/resource.h"
|
||||
#include "common/screen.h"
|
||||
#include "common/sprite.h"
|
||||
#include "common/sprite.h"
|
||||
#include "common/text.h"
|
||||
#include "common/texture.h"
|
||||
#include "common/utils.h"
|
||||
#include "jail_engine/asset.h"
|
||||
#include "jail_engine/input.h"
|
||||
#include "jail_engine/jail_audio.h"
|
||||
#include "jail_engine/resource.h"
|
||||
#include "jail_engine/screen.h"
|
||||
#include "jail_engine/sprite.h"
|
||||
#include "jail_engine/sprite.h"
|
||||
#include "jail_engine/text.h"
|
||||
#include "jail_engine/texture.h"
|
||||
#include "jail_engine/utils.h"
|
||||
#include "const.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -54,23 +55,24 @@ private:
|
||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||
Resource *resource; // Objeto con los recursos
|
||||
Asset *asset; // Objeto con los ficheros de recursos
|
||||
Input *input; // Objeto pata gestionar la entrada
|
||||
options_t *options; // Puntero a las opciones del juego
|
||||
SDL_Event *eventHandler; // Manejador de eventos
|
||||
Text *text; // Objeto para escribir texto en pantalla
|
||||
SDL_Texture *coverTexture; // Textura para cubrir el texto
|
||||
section_t *section; // Estado del bucle principal para saber si continua o se sale
|
||||
|
||||
// Variables
|
||||
int counter; // Contador
|
||||
int preCounter; // Contador previo
|
||||
int coverCounter; // Contador para la cortinilla
|
||||
section_t section; // Estado del bucle principal para saber si continua o se sale
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
std::vector<endingTexture_t> spriteTexts; // Vector con los sprites de texto con su cortinilla
|
||||
std::vector<endingTexture_t> spritePics; // Vector con los sprites de texto con su cortinilla
|
||||
int scene; // Escena actual
|
||||
std::vector<scene_t> scenes; // Vector con los textos e imagenes de cada escena
|
||||
JA_Music music; // Musica que suena durante el final
|
||||
JA_Music_t *music; // Musica que suena durante el final
|
||||
|
||||
// Actualiza el objeto
|
||||
void update();
|
||||
@@ -79,7 +81,10 @@ private:
|
||||
void render();
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void checkEventHandler();
|
||||
void checkEvents();
|
||||
|
||||
// Comprueba las entradas
|
||||
void checkInput();
|
||||
|
||||
// Inicializa los textos
|
||||
void iniTexts();
|
||||
@@ -113,13 +118,13 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Ending(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options);
|
||||
Ending(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section);
|
||||
|
||||
// Destructor
|
||||
~Ending();
|
||||
|
||||
// Bucle principal
|
||||
section_t run();
|
||||
void run();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,15 +1,17 @@
|
||||
#include "ending2.h"
|
||||
#include "gamestate_ending2.h"
|
||||
#include <algorithm>
|
||||
|
||||
// Constructor
|
||||
Ending2::Ending2(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options)
|
||||
Ending2::Ending2(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||
{
|
||||
// Copia los punteros
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->resource = resource;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros a objetos
|
||||
eventHandler = new SDL_Event();
|
||||
@@ -21,8 +23,8 @@ Ending2::Ending2(SDL_Renderer *renderer, Screen *screen, Resource *resource, Ass
|
||||
preCounter = 0;
|
||||
postCounter = 0;
|
||||
postCounterEnabled = false;
|
||||
section.name = SECTION_PROG_ENDING2;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_ENDING2;
|
||||
section->subsection = 0;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
distSpriteText = 8;
|
||||
@@ -79,8 +81,8 @@ void Ending2::update()
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
checkEventHandler();
|
||||
// Comprueba las entradas
|
||||
checkInput();
|
||||
|
||||
// Actualiza los contadores
|
||||
updateCounters();
|
||||
@@ -102,6 +104,9 @@ void Ending2::update()
|
||||
|
||||
// Actualiza el volumen de la musica
|
||||
updateMusicVolume();
|
||||
|
||||
// Actualiza las notificaciones
|
||||
screen->updateNotifier();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +178,7 @@ void Ending2::render()
|
||||
}
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void Ending2::checkEventHandler()
|
||||
void Ending2::checkEvents()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
@@ -181,75 +186,62 @@ void Ending2::checkEventHandler()
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section->name = SECTION_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
// Comprueba las entradas
|
||||
void Ending2::checkInput()
|
||||
{
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_B:
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_LOGO;
|
||||
section->subsection = SUBSECTION_LOGO_TO_INTRO;
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_toggle_border, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchBorder();
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchVideoMode();
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->setWindowSize(1);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->decWindowSize();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->setWindowSize(2);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->incWindowSize();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
screen->setWindowSize(3);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
screen->setWindowSize(4);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
else if (input->checkInput(input_swap_palette, REPEAT_FALSE))
|
||||
{
|
||||
switchPalette();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bucle principal
|
||||
section_t Ending2::run()
|
||||
void Ending2::run()
|
||||
{
|
||||
JA_PlayMusic(music);
|
||||
|
||||
while (section.name == SECTION_PROG_ENDING2)
|
||||
while (section->name == SECTION_ENDING2)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
}
|
||||
|
||||
JA_StopMusic();
|
||||
JA_SetVolume(128);
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
// Actualiza los contadores
|
||||
@@ -272,8 +264,8 @@ void Ending2::updateCounters()
|
||||
|
||||
if (postCounter > 600)
|
||||
{
|
||||
section.name = SECTION_PROG_LOGO;
|
||||
section.subsection = SUBSECTION_LOGO_TO_INTRO;
|
||||
section->name = SECTION_LOGO;
|
||||
section->subsection = SUBSECTION_LOGO_TO_INTRO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,14 +277,14 @@ void Ending2::iniSpriteList()
|
||||
|
||||
// Añade los valores
|
||||
spriteList.push_back("bin");
|
||||
spriteList.push_back("diskette");
|
||||
spriteList.push_back("floppy");
|
||||
spriteList.push_back("bird");
|
||||
spriteList.push_back("chip");
|
||||
spriteList.push_back("jeannine");
|
||||
spriteList.push_back("spark");
|
||||
spriteList.push_back("code");
|
||||
spriteList.push_back("paco");
|
||||
spriteList.push_back("printer");
|
||||
spriteList.push_back("elsa");
|
||||
spriteList.push_back("z80");
|
||||
|
||||
spriteList.push_back("bell");
|
||||
@@ -301,9 +293,9 @@ void Ending2::iniSpriteList()
|
||||
spriteList.push_back("amstrad_cs");
|
||||
spriteList.push_back("breakout");
|
||||
|
||||
spriteList.push_back("arounder_fly");
|
||||
spriteList.push_back("arounder_stop");
|
||||
spriteList.push_back("arounder_walk");
|
||||
spriteList.push_back("flying_arounder");
|
||||
spriteList.push_back("stopped_arounder");
|
||||
spriteList.push_back("walking_arounder");
|
||||
spriteList.push_back("arounders_door");
|
||||
spriteList.push_back("arounders_machine");
|
||||
|
||||
@@ -321,12 +313,12 @@ void Ending2::iniSpriteList()
|
||||
spriteList.push_back("dimallas");
|
||||
spriteList.push_back("guitar");
|
||||
|
||||
spriteList.push_back("jb_alien");
|
||||
spriteList.push_back("jb_human");
|
||||
spriteList.push_back("jailbattle_alien");
|
||||
spriteList.push_back("jailbattle_human");
|
||||
|
||||
spriteList.push_back("jailer");
|
||||
spriteList.push_back("jailer2");
|
||||
spriteList.push_back("jailer3");
|
||||
spriteList.push_back("jailer_#1");
|
||||
spriteList.push_back("jailer_#2");
|
||||
spriteList.push_back("jailer_#3");
|
||||
spriteList.push_back("bry");
|
||||
spriteList.push_back("upv_student");
|
||||
|
||||
@@ -466,13 +458,13 @@ void Ending2::placeSprites()
|
||||
{
|
||||
const int x = i % 2 == 0 ? firstCol : secondCol;
|
||||
const int y = (i / 1) * (maxSpriteHeight + distSpriteText + text->getCharacterSize() + distSpriteSprite) + GAMECANVAS_HEIGHT + 40;
|
||||
const int w = sprites.at(i)->getAnimationClip(0, 0).w;
|
||||
const int h = sprites.at(i)->getAnimationClip(0, 0).h;
|
||||
const int w = sprites[i]->getAnimationClip(0, 0).w;
|
||||
const int h = sprites[i]->getAnimationClip(0, 0).h;
|
||||
const int dx = -(w / 2);
|
||||
const int dy = i % 1 == 0 ? maxSpriteHeight - h : (int)(maxSpriteHeight * 1.5f) - h;
|
||||
|
||||
sprites.at(i)->setRect({x + dx, y + dy, w, h});
|
||||
sprites.at(i)->setVelY(despSpeed);
|
||||
sprites[i]->setRect({x + dx, y + dy, w, h});
|
||||
sprites[i]->setVelY(despSpeed);
|
||||
}
|
||||
|
||||
// Recoloca el último sprite, que es el del jugador
|
||||
@@ -494,14 +486,14 @@ void Ending2::createSpriteTexts()
|
||||
for (int i = 0; i < (int)spriteList.size(); ++i)
|
||||
{
|
||||
// Calcula constantes
|
||||
std::string txt = spriteList.at(i);
|
||||
std::string txt = spriteList[i];
|
||||
std::replace(txt.begin(), txt.end(), '_', ' ');
|
||||
txt = txt == "player" ? "JAILDOCTOR" : txt; // Reemplaza el texto
|
||||
const int w = text->lenght(txt, 1);
|
||||
const int h = text->getCharacterSize();
|
||||
const int x = i % 2 == 0 ? firstCol : secondCol;
|
||||
const int dx = -(w / 2);
|
||||
const int y = sprites.at(i)->getPosY() + sprites.at(i)->getHeight() + distSpriteText;
|
||||
const int y = sprites[i]->getPosY() + sprites[i]->getHeight() + distSpriteText;
|
||||
|
||||
// Cambia la posición del último sprite
|
||||
const int X = (i == (int)spriteList.size() - 1) ? GAMECANVAS_CENTER_X - (w / 2) : x + dx;
|
||||
@@ -533,7 +525,7 @@ void Ending2::createTexts()
|
||||
for (int i = 0; i < (int)list.size(); ++i)
|
||||
{
|
||||
// Calcula constantes
|
||||
const int w = text->lenght(list.at(i), 1);
|
||||
const int w = text->lenght(list[i], 1);
|
||||
const int h = text->getCharacterSize();
|
||||
const int x = GAMECANVAS_CENTER_X;
|
||||
const int dx = -(w / 2);
|
||||
@@ -544,7 +536,7 @@ void Ending2::createTexts()
|
||||
texture->createBlank(renderer, w, h, SDL_TEXTUREACCESS_TARGET);
|
||||
texture->setAsRenderTarget(renderer);
|
||||
texture->setBlendMode(SDL_BLENDMODE_BLEND);
|
||||
text->write(0, 0, list.at(i));
|
||||
text->write(0, 0, list[i]);
|
||||
|
||||
// Crea el sprite
|
||||
MovingSprite *sprite = new MovingSprite(x + dx, y, w, h, 0.0f, despSpeed, 0.0f, 0.0f, texture, renderer);
|
||||
@@ -562,7 +554,7 @@ void Ending2::createTexts()
|
||||
for (int i = 0; i < (int)list.size(); ++i)
|
||||
{
|
||||
// Calcula constantes
|
||||
const int w = text->lenght(list.at(i), 1);
|
||||
const int w = text->lenght(list[i], 1);
|
||||
const int h = text->getCharacterSize();
|
||||
const int x = GAMECANVAS_CENTER_X;
|
||||
const int dx = -(w / 2);
|
||||
@@ -573,7 +565,7 @@ void Ending2::createTexts()
|
||||
texture->createBlank(renderer, w, h, SDL_TEXTUREACCESS_TARGET);
|
||||
texture->setAsRenderTarget(renderer);
|
||||
texture->setBlendMode(SDL_BLENDMODE_BLEND);
|
||||
text->write(0, 0, list.at(i));
|
||||
text->write(0, 0, list[i]);
|
||||
|
||||
// Crea el sprite
|
||||
MovingSprite *sprite = new MovingSprite(x + dx, y, w, h, 0.0f, despSpeed, 0.0f, 0.0f, texture, renderer);
|
||||
@@ -621,7 +613,7 @@ void Ending2::updateFinalFade()
|
||||
|
||||
for (auto t : texts)
|
||||
{
|
||||
t->getTexture()->setColor(colors.at(index).r, colors.at(index).g, colors.at(index).b);
|
||||
t->getTexture()->setColor(colors[index].r, colors[index].g, colors[index].b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
#include "common/animatedsprite.h"
|
||||
#include "common/asset.h"
|
||||
#include "common/jail_audio.h"
|
||||
#include "common/resource.h"
|
||||
#include "common/screen.h"
|
||||
#include "common/sprite.h"
|
||||
#include "common/text.h"
|
||||
#include "common/texture.h"
|
||||
#include "common/utils.h"
|
||||
#include "jail_engine/animatedsprite.h"
|
||||
#include "jail_engine/asset.h"
|
||||
#include "jail_engine/input.h"
|
||||
#include "jail_engine/jail_audio.h"
|
||||
#include "jail_engine/resource.h"
|
||||
#include "jail_engine/screen.h"
|
||||
#include "jail_engine/sprite.h"
|
||||
#include "jail_engine/text.h"
|
||||
#include "jail_engine/texture.h"
|
||||
#include "jail_engine/utils.h"
|
||||
#include "const.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -25,21 +26,22 @@ private:
|
||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||
SDL_Event *eventHandler; // Manejador de eventos
|
||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||
Input *input; // Objeto pata gestionar la entrada
|
||||
Text *text; // Objeto para escribir texto en pantalla
|
||||
options_t *options; // Puntero a las opciones del juego
|
||||
std::vector<AnimatedSprite *> sprites; // Vector con todos los sprites a dibujar
|
||||
std::vector<MovingSprite *> spriteTexts; // Vector con los sprites de texto de los sprites
|
||||
std::vector<MovingSprite *> texts; // Vector con los sprites de texto
|
||||
section_t *section; // Estado del bucle principal para saber si continua o se sale
|
||||
|
||||
// Variables
|
||||
bool counterEnabled; // Indica si está el contador habilitado
|
||||
int preCounter; // Contador previo
|
||||
int postCounter; // Contador posterior
|
||||
bool postCounterEnabled; // Indica si está habilitado el contador
|
||||
section_t section; // Estado del bucle principal para saber si continua o se sale
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
JA_Music music; // Musica que suena durante el final
|
||||
JA_Music_t *music; // Musica que suena durante el final
|
||||
std::vector<std::string> spriteList; // Lista con todos los sprites a dibujar
|
||||
std::vector<color_t> colors; // Vector con los colores para el fade
|
||||
int maxSpriteWidth; // El valor de ancho del sprite mas ancho
|
||||
@@ -57,7 +59,10 @@ private:
|
||||
void render();
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void checkEventHandler();
|
||||
void checkEvents();
|
||||
|
||||
// Comprueba las entradas
|
||||
void checkInput();
|
||||
|
||||
// Actualiza los contadores
|
||||
void updateCounters();
|
||||
@@ -115,13 +120,13 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Ending2(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options);
|
||||
Ending2(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section);
|
||||
|
||||
// Destructor
|
||||
~Ending2();
|
||||
|
||||
// Bucle principal
|
||||
section_t run();
|
||||
void run();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,33 +1,37 @@
|
||||
#include "game.h"
|
||||
#include "gamestate_game.h"
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, Input *input, Debug *debug)
|
||||
Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Online *online, options_t *options, Input *input, section_t *section, Debug *debug)
|
||||
{
|
||||
// Inicia algunas variables
|
||||
board.iniClock = SDL_GetTicks();
|
||||
currentRoom = "03.room";
|
||||
const int x = 25;
|
||||
const int y = 13;
|
||||
spawnPoint = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||
|
||||
// Copia los punteros
|
||||
this->resource = resource;
|
||||
this->renderer = renderer;
|
||||
this->asset = asset;
|
||||
this->online = online;
|
||||
this->screen = screen;
|
||||
this->input = input;
|
||||
this->debug = debug;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
|
||||
// Inicia algunas variables
|
||||
board.iniClock = SDL_GetTicks();
|
||||
#ifdef DEBUG
|
||||
currentRoom = "48.room";
|
||||
const int x1 = 18;
|
||||
const int y1 = 13;
|
||||
spawnPoint = {x1 * 8, y1 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||
currentRoom = "03.room";
|
||||
const int x = 25;
|
||||
const int y = 13;
|
||||
spawnPoint = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||
debug->setEnabled(false);
|
||||
#else
|
||||
currentRoom = "03.room";
|
||||
const int x = 25;
|
||||
const int y = 13;
|
||||
spawnPoint = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||
#endif
|
||||
|
||||
// Crea los objetos
|
||||
cheevos = new Cheevos(screen, options, asset->get("cheevos.bin"), online);
|
||||
scoreboard = new ScoreBoard(renderer, resource, asset, options, &board);
|
||||
itemTracker = new ItemTracker();
|
||||
roomTracker = new RoomTracker();
|
||||
@@ -40,13 +44,34 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
||||
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer);
|
||||
music = JA_LoadMusic(asset->get("game.ogg").c_str());
|
||||
deathSound = JA_LoadSound(asset->get("death.wav").c_str());
|
||||
stats = new Stats(asset->get("stats.txt"));
|
||||
stats->addVisit(room->getName());
|
||||
stats = new Stats(asset->get("stats.csv"), asset->get("stats_buffer.csv"), options, online);
|
||||
|
||||
// Crea la textura para poner el nombre de la habitación
|
||||
roomNameTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, text->getCharacterSize() * 2);
|
||||
if (roomNameTexture == nullptr)
|
||||
{
|
||||
if (options->console)
|
||||
{
|
||||
std::cout << "Error: roomNameTexture could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Establece el blend mode de la textura
|
||||
SDL_SetTextureBlendMode(roomNameTexture, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Establece el destino de la textura
|
||||
roomNameRect = {0, PLAY_AREA_HEIGHT, GAMECANVAS_WIDTH, text->getCharacterSize() * 2};
|
||||
|
||||
// Pone el nombre de la habitación en la textura
|
||||
fillRoomNameTexture();
|
||||
|
||||
// Inicializa el resto de variables
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
board.lives = 9;
|
||||
#ifdef DEBUG
|
||||
board.lives = 9;
|
||||
#endif
|
||||
board.items = 0;
|
||||
board.rooms = 1;
|
||||
board.music = true;
|
||||
@@ -57,14 +82,19 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
||||
blackScreen = false;
|
||||
blackScreenCounter = 0;
|
||||
totalItems = getTotalItems();
|
||||
initStats();
|
||||
stats->addVisit(room->getName());
|
||||
const bool cheats = options->cheat.infiniteLives || options->cheat.invincible || options->cheat.jailEnabled;
|
||||
cheevos->enable(!cheats); // Deshabilita los logros si hay trucos activados
|
||||
|
||||
section.name = SECTION_PROG_GAME;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_GAME;
|
||||
section->subsection = 0;
|
||||
}
|
||||
|
||||
Game::~Game()
|
||||
{
|
||||
// Libera la memoria de los objetos
|
||||
delete cheevos;
|
||||
delete scoreboard;
|
||||
delete itemTracker;
|
||||
delete roomTracker;
|
||||
@@ -74,12 +104,14 @@ Game::~Game()
|
||||
delete text;
|
||||
delete stats;
|
||||
|
||||
SDL_DestroyTexture(roomNameTexture);
|
||||
|
||||
JA_DeleteMusic(music);
|
||||
JA_DeleteSound(deathSound);
|
||||
}
|
||||
|
||||
// Comprueba los eventos de la cola
|
||||
void Game::checkEventHandler()
|
||||
void Game::checkEvents()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
@@ -87,7 +119,7 @@ void Game::checkEventHandler()
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section->name = SECTION_QUIT;
|
||||
screen->setBorderColor(stringToColor(options->palette, "black"));
|
||||
break;
|
||||
}
|
||||
@@ -97,13 +129,10 @@ void Game::checkEventHandler()
|
||||
reLoadTextures();
|
||||
}
|
||||
|
||||
if ((eventHandler->type == SDL_KEYDOWN) and (eventHandler->key.repeat == 0))
|
||||
if (eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0)
|
||||
{
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
section.name = SECTION_PROG_TITLE;
|
||||
break;
|
||||
#ifdef DEBUG
|
||||
case SDL_SCANCODE_G:
|
||||
debug->switchEnabled();
|
||||
@@ -131,51 +160,23 @@ void Game::checkEventHandler()
|
||||
case SDL_SCANCODE_D:
|
||||
goToRoom(BORDER_RIGHT);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F6:
|
||||
screen->showNotification("ACHIEVEMENT UNLOCKED!", "I LIKE MY MULTICOLOURED FRIENDS", 2);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F7:
|
||||
screen->showNotification("ACHIEVEMENT UNLOCKED!", "I LIKE MY MULTICOLOURED FRIENDS", 3);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F8:
|
||||
screen->showNotification("JAILDESIGNER IS LOGGED IN", "", 4);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F9:
|
||||
screen->showNotification("JAILDESIGNER IS LOGGED IN", "", 5);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case SDL_SCANCODE_M:
|
||||
board.music = !board.music;
|
||||
board.music ? JA_ResumeMusic() : JA_PauseMusic();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_P:
|
||||
switchPause();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_B:
|
||||
screen->switchBorder();
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
screen->switchVideoMode();
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->setWindowSize(1);
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->setWindowSize(2);
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
screen->setWindowSize(3);
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
screen->setWindowSize(4);
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
switchPalette();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -183,8 +184,57 @@ void Game::checkEventHandler()
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba el teclado
|
||||
void Game::checkInput()
|
||||
{
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_TITLE;
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_switch_music, REPEAT_FALSE))
|
||||
{
|
||||
board.music = !board.music;
|
||||
board.music ? JA_ResumeMusic() : JA_PauseMusic();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_pause, REPEAT_FALSE))
|
||||
{
|
||||
switchPause();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_toggle_border, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchBorder();
|
||||
reLoadTextures();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchVideoMode();
|
||||
reLoadTextures();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->decWindowSize();
|
||||
reLoadTextures();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->incWindowSize();
|
||||
reLoadTextures();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_swap_palette, REPEAT_FALSE))
|
||||
{
|
||||
switchPalette();
|
||||
}
|
||||
}
|
||||
|
||||
// Bucle para el juego
|
||||
section_t Game::run()
|
||||
void Game::run()
|
||||
{
|
||||
JA_PlayMusic(music);
|
||||
if (!board.music)
|
||||
@@ -192,15 +242,14 @@ section_t Game::run()
|
||||
JA_PauseMusic();
|
||||
}
|
||||
|
||||
while (section.name == SECTION_PROG_GAME)
|
||||
while (section->name == SECTION_GAME)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
}
|
||||
|
||||
JA_StopMusic();
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
// Actualiza el juego, las variables, comprueba la entrada, etc.
|
||||
@@ -212,8 +261,8 @@ void Game::update()
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Comprueba los eventos de la cola
|
||||
checkEventHandler();
|
||||
// Comprueba el teclado
|
||||
checkInput();
|
||||
|
||||
#ifdef DEBUG
|
||||
debug->clear();
|
||||
@@ -228,11 +277,16 @@ void Game::update()
|
||||
checkIfPlayerIsAlive();
|
||||
checkGameOver();
|
||||
checkEndGame();
|
||||
checkRestoringJail();
|
||||
checkSomeCheevos();
|
||||
scoreboard->update();
|
||||
input->update();
|
||||
|
||||
updateBlackScreen();
|
||||
|
||||
// Actualiza las notificaciones
|
||||
screen->updateNotifier();
|
||||
|
||||
#ifdef DEBUG
|
||||
updateDebugInfo();
|
||||
#endif
|
||||
@@ -244,8 +298,8 @@ void Game::render()
|
||||
{
|
||||
// Prepara para dibujar el frame
|
||||
screen->start();
|
||||
screen->clean(room->getBGColor());
|
||||
|
||||
// Dibuja los elementos del juego en orden
|
||||
room->renderMap();
|
||||
room->renderEnemies();
|
||||
room->renderItems();
|
||||
@@ -305,13 +359,8 @@ void Game::renderDebugInfo()
|
||||
// Escribe el nombre de la pantalla
|
||||
void Game::renderRoomName()
|
||||
{
|
||||
// Texto en el centro de la pantalla
|
||||
SDL_Rect rect = {0, 16 * BLOCK, PLAY_AREA_WIDTH, BLOCK * 2};
|
||||
color_t color = stringToColor(options->palette, "white");
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 0xFF);
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, 16 * 8 + 4, room->getName(), 1, room->getBGColor());
|
||||
// Dibuja la textura con el nombre de la habitación
|
||||
SDL_RenderCopy(renderer, roomNameTexture, nullptr, &roomNameRect);
|
||||
}
|
||||
|
||||
// Cambia de habitación
|
||||
@@ -333,6 +382,9 @@ bool Game::changeRoom(std::string file)
|
||||
// Crea un objeto habitación nuevo a partir del fichero
|
||||
room = new Room(resource->getRoom(file), renderer, screen, asset, options, itemTracker, &board.items, board.jailEnabled, debug);
|
||||
|
||||
// Pone el nombre de la habitación en la textura
|
||||
fillRoomNameTexture();
|
||||
|
||||
// Pone el color del marcador en función del color del borde de la habitación
|
||||
setScoreBoardColor();
|
||||
|
||||
@@ -340,7 +392,7 @@ bool Game::changeRoom(std::string file)
|
||||
{
|
||||
// Incrementa el contador de habitaciones visitadas
|
||||
board.rooms++;
|
||||
options->rooms = board.rooms;
|
||||
options->stats.rooms = board.rooms;
|
||||
|
||||
// Actualiza las estadisticas
|
||||
stats->addVisit(room->getName());
|
||||
@@ -401,7 +453,7 @@ void Game::checkGameOver()
|
||||
{
|
||||
if (board.lives < 0 && blackScreenCounter > 17)
|
||||
{
|
||||
section.name = SECTION_PROG_GAME_OVER;
|
||||
section->name = SECTION_GAME_OVER;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,6 +474,9 @@ void Game::killPlayer()
|
||||
// Actualiza las estadisticas
|
||||
stats->addDeath(room->getName());
|
||||
|
||||
// Invalida el logro de pasarse el juego sin morir
|
||||
cheevos->invalidate(11);
|
||||
|
||||
// Destruye la habitacion y el jugador
|
||||
delete room;
|
||||
delete this->player;
|
||||
@@ -528,7 +583,7 @@ void Game::setScoreBoardColor()
|
||||
bool Game::checkEndGame()
|
||||
{
|
||||
const bool isOnTheRoom = room->getName() == "THE JAIL"; // Estar en la habitación que toca
|
||||
const bool haveTheItems = board.items >= int(totalItems * 0.9f); // Con mas del 90% de los items recogidos
|
||||
const bool haveTheItems = board.items >= int(totalItems * 0.9f) || options->cheat.jailEnabled; // Con mas del 90% de los items recogidos
|
||||
const bool isOnTheDoor = player->getRect().x <= 128; // Y en la ubicación que toca (En la puerta)
|
||||
|
||||
if (haveTheItems)
|
||||
@@ -536,15 +591,12 @@ bool Game::checkEndGame()
|
||||
board.jailEnabled = true;
|
||||
}
|
||||
|
||||
if (isOnTheRoom && haveTheItems && isOnTheDoor)
|
||||
if (haveTheItems && isOnTheRoom && isOnTheDoor)
|
||||
{
|
||||
section.name = SECTION_PROG_ENDING;
|
||||
return true;
|
||||
}
|
||||
// Comprueba los logros de completar el juego
|
||||
checkEndGameCheevos();
|
||||
|
||||
if (options->cheat.jailEnabled && isOnTheRoom && isOnTheDoor)
|
||||
{
|
||||
section.name = SECTION_PROG_ENDING;
|
||||
section->name = SECTION_ENDING;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -594,3 +646,136 @@ void Game::switchPause()
|
||||
paused = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Da vidas al jugador cuando está en la Jail
|
||||
void Game::checkRestoringJail()
|
||||
{
|
||||
if (room->getName() != "THE JAIL" || board.lives == 9)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static int counter = 0;
|
||||
|
||||
if (!paused)
|
||||
{
|
||||
counter++;
|
||||
}
|
||||
|
||||
// Incrementa el numero de vidas
|
||||
if (counter == 100)
|
||||
{
|
||||
counter = 0;
|
||||
board.lives++;
|
||||
JA_PlaySound(deathSound);
|
||||
|
||||
// Invalida el logro de completar el juego sin entrar a la jail
|
||||
const bool haveTheItems = board.items >= int(totalItems * 0.9f);
|
||||
if (!haveTheItems)
|
||||
{
|
||||
cheevos->invalidate(9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inicializa el diccionario de las estadísticas
|
||||
void Game::initStats()
|
||||
{
|
||||
std::vector<res_room_t> *rooms = new std::vector<res_room_t>;
|
||||
rooms = resource->getAllRooms();
|
||||
|
||||
for (auto room : *rooms)
|
||||
{
|
||||
stats->addDictionary(room.room->number, room.room->name);
|
||||
}
|
||||
|
||||
stats->init();
|
||||
}
|
||||
|
||||
// Crea la textura con el nombre de la habitación
|
||||
void Game::fillRoomNameTexture()
|
||||
{
|
||||
// Pone la textura como destino de renderizado
|
||||
SDL_SetRenderTarget(renderer, roomNameTexture);
|
||||
|
||||
// Rellena la textura de color
|
||||
const color_t color = stringToColor(options->palette, "white");
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 0xFF);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
// Escribe el texto en la textura
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, text->getCharacterSize() / 2, room->getName(), 1, room->getBGColor());
|
||||
|
||||
// Deja el renderizador por defecto
|
||||
SDL_SetRenderTarget(renderer, nullptr);
|
||||
}
|
||||
|
||||
// Comprueba algunos logros
|
||||
void Game::checkSomeCheevos()
|
||||
{
|
||||
// Logros sobre la cantidad de items
|
||||
if (board.items == totalItems)
|
||||
{
|
||||
cheevos->unlock(4);
|
||||
cheevos->unlock(3);
|
||||
cheevos->unlock(2);
|
||||
cheevos->unlock(1);
|
||||
}
|
||||
else if (board.items >= totalItems * 0.75f)
|
||||
{
|
||||
cheevos->unlock(3);
|
||||
cheevos->unlock(2);
|
||||
cheevos->unlock(1);
|
||||
}
|
||||
else if (board.items >= totalItems * 0.5f)
|
||||
{
|
||||
cheevos->unlock(2);
|
||||
cheevos->unlock(1);
|
||||
}
|
||||
else if (board.items >= totalItems * 0.25f)
|
||||
{
|
||||
cheevos->unlock(1);
|
||||
}
|
||||
|
||||
// Logros sobre las habitaciones visitadas
|
||||
if (board.rooms >= 60)
|
||||
{
|
||||
cheevos->unlock(7);
|
||||
cheevos->unlock(6);
|
||||
cheevos->unlock(5);
|
||||
}
|
||||
else if (board.rooms >= 40)
|
||||
{
|
||||
cheevos->unlock(6);
|
||||
cheevos->unlock(5);
|
||||
}
|
||||
else if (board.rooms >= 20)
|
||||
{
|
||||
cheevos->unlock(5);
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba los logros de completar el juego
|
||||
void Game::checkEndGameCheevos()
|
||||
{
|
||||
// "Complete the game"
|
||||
cheevos->unlock(8);
|
||||
|
||||
// "Complete the game without entering the jail"
|
||||
cheevos->unlock(9);
|
||||
|
||||
// "Complete the game with all items"
|
||||
if (board.items == totalItems)
|
||||
{
|
||||
cheevos->unlock(10);
|
||||
}
|
||||
|
||||
// "Complete the game without dying"
|
||||
cheevos->unlock(11);
|
||||
|
||||
// "Complete the game in under 30 minutes"
|
||||
if (scoreboard->getMinutes() < 30)
|
||||
{
|
||||
cheevos->unlock(12);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "common/animatedsprite.h"
|
||||
#include "common/asset.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/input.h"
|
||||
#include "common/jail_audio.h"
|
||||
#include "common/resource.h"
|
||||
#include "common/screen.h"
|
||||
#include "common/sprite.h"
|
||||
#include "common/text.h"
|
||||
#include "common/utils.h"
|
||||
#include "cheevos.h"
|
||||
#include "jail_engine/animatedsprite.h"
|
||||
#include "jail_engine/asset.h"
|
||||
#include "jail_engine/debug.h"
|
||||
#include "jail_engine/input.h"
|
||||
#include "jail_engine/jail_audio.h"
|
||||
#include "jail_engine/resource.h"
|
||||
#include "jail_engine/screen.h"
|
||||
#include "jail_engine/sprite.h"
|
||||
#include "jail_engine/text.h"
|
||||
#include "jail_engine/utils.h"
|
||||
#include "const.h"
|
||||
#include "item_tracker.h"
|
||||
#include "player.h"
|
||||
@@ -18,6 +19,7 @@
|
||||
#include "room.h"
|
||||
#include "scoreboard.h"
|
||||
#include "stats.h"
|
||||
#include "online.h"
|
||||
|
||||
#ifndef GAME_H
|
||||
#define GAME_H
|
||||
@@ -36,25 +38,29 @@ private:
|
||||
Asset *asset; // Objeto con la ruta a todos los ficheros de recursos
|
||||
Input *input; // Objeto pata gestionar la entrada
|
||||
Text *text; // Objeto para los textos del juego
|
||||
Online *online; // Objeto para gestionar la lectura y escritura de datos en el servidor remoto
|
||||
ScoreBoard *scoreboard; // Objeto encargado de gestionar el marcador
|
||||
Cheevos *cheevos; // Objeto encargado de gestionar los logros del juego
|
||||
Resource *resource; // Objeto con los recursos
|
||||
Debug *debug; // Objeto para gestionar la información de debug
|
||||
options_t *options; // Puntero a las opciones del juego
|
||||
Stats *stats; // Objeto encargado de gestionar las estadísticas
|
||||
SDL_Texture *roomNameTexture; // Textura para escribir el nombre de la habitación
|
||||
section_t *section; // Seccion actual dentro del juego
|
||||
|
||||
// Variables
|
||||
JA_Music music; // Musica que suena durante el juego
|
||||
JA_Music_t *music; // Musica que suena durante el juego
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
section_t section; // Seccion actual dentro del juego
|
||||
std::string currentRoom; // Fichero de la habitación actual
|
||||
playerSpawn_t spawnPoint; // Lugar de la habitación donde aparece el jugador
|
||||
JA_Sound deathSound; // Sonido a reproducir cuando muere el jugador
|
||||
JA_Sound_t *deathSound; // Sonido a reproducir cuando muere el jugador
|
||||
board_t board; // Estructura con los datos del marcador
|
||||
bool paused; // Indica si el juego se encuentra en pausa
|
||||
bool blackScreen; // Indica si la pantalla está en negro. Se utiliza para la muerte del jugador
|
||||
int blackScreenCounter; // Contador para temporizar la pantalla en negro
|
||||
int totalItems; // Cantidad total de items que hay en el mapeado del juego
|
||||
SDL_Rect roomNameRect; // Rectangulo donde pintar la textura con el nombre de la habitación
|
||||
|
||||
// Actualiza el juego, las variables, comprueba la entrada, etc.
|
||||
void update();
|
||||
@@ -63,7 +69,7 @@ private:
|
||||
void render();
|
||||
|
||||
// Comprueba los eventos de la cola
|
||||
void checkEventHandler();
|
||||
void checkEvents();
|
||||
|
||||
#ifdef DEBUG
|
||||
// Pone la información de debug en pantalla
|
||||
@@ -79,6 +85,9 @@ private:
|
||||
// Cambia de habitación
|
||||
bool changeRoom(std::string file);
|
||||
|
||||
// Comprueba el teclado
|
||||
void checkInput();
|
||||
|
||||
// Comprueba si el jugador esta en el borde de la pantalla y actua
|
||||
void checkPlayerOnBorder();
|
||||
|
||||
@@ -127,15 +136,30 @@ private:
|
||||
// Pone el juego en pausa
|
||||
void switchPause();
|
||||
|
||||
// Da vidas al jugador cuando está en la Jail
|
||||
void checkRestoringJail();
|
||||
|
||||
// Inicializa el diccionario de las estadísticas
|
||||
void initStats();
|
||||
|
||||
// Pone el nombre de la habitación en la textura
|
||||
void fillRoomNameTexture();
|
||||
|
||||
// Comprueba algunos logros
|
||||
void checkSomeCheevos();
|
||||
|
||||
// Comprueba los logros de completar el juego
|
||||
void checkEndGameCheevos();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, Input *input, Debug *debug);
|
||||
Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Online *online, options_t *options, Input *input, section_t *section, Debug *debug);
|
||||
|
||||
// Destructor
|
||||
~Game();
|
||||
|
||||
// Bucle para el juego
|
||||
section_t run();
|
||||
void run();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,14 +1,16 @@
|
||||
#include "game_over.h"
|
||||
#include "gamestate_game_over.h"
|
||||
|
||||
// Constructor
|
||||
GameOver::GameOver(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options)
|
||||
GameOver::GameOver(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||
{
|
||||
// Copia los punteros
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->resource = resource;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros a objetos
|
||||
eventHandler = new SDL_Event();
|
||||
@@ -20,17 +22,17 @@ GameOver::GameOver(SDL_Renderer *renderer, Screen *screen, Resource *resource, A
|
||||
// Inicializa variables
|
||||
preCounter = 0;
|
||||
counter = 0;
|
||||
section.name = SECTION_PROG_GAME_OVER;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_GAME_OVER;
|
||||
section->subsection = 0;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
endSection = 400;
|
||||
iniFade = 310;
|
||||
fadeLenght = 20;
|
||||
playerSprite->setPosX(GAMECANVAS_CENTER_X + 10);
|
||||
playerSprite->setPosY(GAMECANVAS_CENTER_Y - 10);
|
||||
playerSprite->setPosY(30);
|
||||
tvSprite->setPosX(GAMECANVAS_CENTER_X - tvSprite->getAnimationClip(0, 0).w - 10);
|
||||
tvSprite->setPosY(GAMECANVAS_CENTER_Y - 10);
|
||||
tvSprite->setPosY(30);
|
||||
|
||||
// Inicializa el vector de colores
|
||||
const std::vector<std::string> colorList = {"white", "yellow", "cyan", "green", "magenta", "red", "blue", "black"};
|
||||
@@ -61,8 +63,8 @@ void GameOver::update()
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
checkEventHandler();
|
||||
// Comprueba las entradas
|
||||
checkInput();
|
||||
|
||||
// Actualiza el color usado para renderizar los textos e imagenes
|
||||
updateColor();
|
||||
@@ -73,12 +75,17 @@ void GameOver::update()
|
||||
// Actualiza los dos sprites
|
||||
playerSprite->update();
|
||||
tvSprite->update();
|
||||
|
||||
// Actualiza las notificaciones
|
||||
screen->updateNotifier();
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja el final en pantalla
|
||||
void GameOver::render()
|
||||
{
|
||||
const int y = 32;
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
@@ -86,24 +93,29 @@ void GameOver::render()
|
||||
screen->clean();
|
||||
|
||||
// Escribe el texto de GAME OVER
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y - 40, "G A M E O V E R", 1, color);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, y, "G A M E O V E R", 1, color);
|
||||
|
||||
// Dibuja los sprites
|
||||
playerSprite->setPosY(y + 30);
|
||||
tvSprite->setPosY(y + 30);
|
||||
renderSprites();
|
||||
|
||||
// Escribe el texto con las habitaciones y los items
|
||||
const std::string itemsTxt = std::to_string(options->items / 100) + std::to_string((options->items % 100) / 10) + std::to_string(options->items % 10);
|
||||
const std::string roomsTxt = std::to_string(options->rooms / 100) + std::to_string((options->rooms % 100) / 10) + std::to_string(options->rooms % 10);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y + 40, "ITEMS: " + itemsTxt, 1, color);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y + 55, "ROOMS: " + roomsTxt, 1, color);
|
||||
const std::string itemsTxt = std::to_string(options->stats.items / 100) + std::to_string((options->stats.items % 100) / 10) + std::to_string(options->stats.items % 10);
|
||||
const std::string roomsTxt = std::to_string(options->stats.rooms / 100) + std::to_string((options->stats.rooms % 100) / 10) + std::to_string(options->stats.rooms % 10);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, y + 80, "ITEMS: " + itemsTxt, 1, color);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, y + 90, "ROOMS: " + roomsTxt, 1, color);
|
||||
|
||||
// Escribe el texto con "Tu peor pesadilla"
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, y + 110, "YOUR WORST NIGHTMARE IS", 1, color);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, y + 120, options->stats.worstNightmare, 1, color);
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void GameOver::checkEventHandler()
|
||||
void GameOver::checkEvents()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
@@ -111,71 +123,57 @@ void GameOver::checkEventHandler()
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
section.subsection = 0;
|
||||
section->name = SECTION_QUIT;
|
||||
section->subsection = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
// Comprueba las entradas
|
||||
void GameOver::checkInput()
|
||||
{
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
section.name = SECTION_PROG_QUIT;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_B:
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_QUIT;
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_toggle_border, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchBorder();
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchVideoMode();
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->setWindowSize(1);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->decWindowSize();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->setWindowSize(2);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->incWindowSize();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
screen->setWindowSize(3);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
screen->setWindowSize(4);
|
||||
resource->reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
else if (input->checkInput(input_swap_palette, REPEAT_FALSE))
|
||||
{
|
||||
switchPalette();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bucle principal
|
||||
section_t GameOver::run()
|
||||
void GameOver::run()
|
||||
{
|
||||
while (section.name == SECTION_PROG_GAME_OVER)
|
||||
while (section->name == SECTION_GAME_OVER)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
// Actualiza el color usado para renderizar los textos e imagenes
|
||||
@@ -185,16 +183,15 @@ void GameOver::updateColor()
|
||||
|
||||
if (counter < half)
|
||||
{
|
||||
// const float step = std::min(std::max(counter, iniFade) - iniFade, fadeLenght) / (float)fadeLenght;
|
||||
const float step = std::min(counter, fadeLenght) / (float)fadeLenght;
|
||||
const int index = (colors.size() - 1) - int((colors.size() - 1) * step);
|
||||
color = colors.at(index);
|
||||
color = colors[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
const float step = std::min(std::max(counter, iniFade) - iniFade, fadeLenght) / (float)fadeLenght;
|
||||
const int index = (colors.size() - 1) * step;
|
||||
color = colors.at(index);
|
||||
color = colors[index];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,8 +227,8 @@ void GameOver::updateCounters()
|
||||
// Comprueba si ha terminado la sección
|
||||
else if (counter == endSection)
|
||||
{
|
||||
section.name = SECTION_PROG_LOGO;
|
||||
section.subsection = SUBSECTION_LOGO_TO_TITLE;
|
||||
section->name = SECTION_LOGO;
|
||||
section->subsection = SUBSECTION_LOGO_TO_TITLE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
#include "common/animatedsprite.h"
|
||||
#include "common/asset.h"
|
||||
#include "common/jail_audio.h"
|
||||
#include "common/resource.h"
|
||||
#include "common/screen.h"
|
||||
#include "common/sprite.h"
|
||||
#include "common/text.h"
|
||||
#include "common/texture.h"
|
||||
#include "common/utils.h"
|
||||
#include "jail_engine/animatedsprite.h"
|
||||
#include "jail_engine/asset.h"
|
||||
#include "jail_engine/input.h"
|
||||
#include "jail_engine/jail_audio.h"
|
||||
#include "jail_engine/resource.h"
|
||||
#include "jail_engine/screen.h"
|
||||
#include "jail_engine/sprite.h"
|
||||
#include "jail_engine/text.h"
|
||||
#include "jail_engine/texture.h"
|
||||
#include "jail_engine/utils.h"
|
||||
#include "const.h"
|
||||
#include <vector>
|
||||
|
||||
@@ -23,16 +24,17 @@ private:
|
||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||
Resource *resource; // Objeto con los recursos
|
||||
Asset *asset; // Objeto con los ficheros de recursos
|
||||
Input *input; // Objeto pata gestionar la entrada
|
||||
options_t *options; // Puntero a las opciones del juego
|
||||
SDL_Event *eventHandler; // Manejador de eventos
|
||||
Text *text; // Objeto para escribir texto en pantalla
|
||||
AnimatedSprite *playerSprite; // Sprite con el jugador
|
||||
AnimatedSprite *tvSprite; // Sprite con el televisor
|
||||
section_t *section; // Estado del bucle principal para saber si continua o se sale
|
||||
|
||||
// Variables
|
||||
int preCounter; // Contador previo
|
||||
int counter; // Contador
|
||||
section_t section; // Estado del bucle principal para saber si continua o se sale
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
std::vector<color_t> colors; // Vector con los colores para el fade
|
||||
@@ -40,7 +42,7 @@ private:
|
||||
int endSection; // Contador: cuando acaba la sección
|
||||
int iniFade; // Contador: cuando emiepza el fade
|
||||
int fadeLenght; // Contador: duración del fade
|
||||
JA_Music music; // Musica que suena durante el juego
|
||||
JA_Music_t *music; // Musica que suena durante el juego
|
||||
|
||||
// Actualiza el objeto
|
||||
void update();
|
||||
@@ -49,7 +51,10 @@ private:
|
||||
void render();
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void checkEventHandler();
|
||||
void checkEvents();
|
||||
|
||||
// Comprueba las entradas
|
||||
void checkInput();
|
||||
|
||||
// Actualiza el color usado para renderizar los textos e imagenes
|
||||
void updateColor();
|
||||
@@ -65,13 +70,13 @@ private:
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
GameOver(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options);
|
||||
GameOver(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section);
|
||||
|
||||
// Destructor
|
||||
~GameOver();
|
||||
|
||||
// Bucle principal
|
||||
section_t run();
|
||||
void run();
|
||||
};
|
||||
|
||||
#endif
|
||||
358
source/gamestate_loading_screen.cpp
Normal file
@@ -0,0 +1,358 @@
|
||||
#include "gamestate_loading_screen.h"
|
||||
|
||||
// Constructor
|
||||
LoadingScreen::LoadingScreen(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||
{
|
||||
// Copia la dirección de los objetos
|
||||
this->resource = resource;
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros
|
||||
eventHandler = new SDL_Event();
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
loadingScreenTexture1 = resource->getTexture("loading_screen_bn.png");
|
||||
loadingScreenTexture2 = resource->getTexture("loading_screen_color.png");
|
||||
}
|
||||
else if (options->palette == p_zxarne)
|
||||
{
|
||||
loadingScreenTexture1 = resource->getTexture("loading_screen_bn_zxarne.png");
|
||||
loadingScreenTexture2 = resource->getTexture("loading_screen_color_zxarne.png");
|
||||
}
|
||||
sprite1 = new Sprite(0, 0, loadingScreenTexture1->getWidth(), loadingScreenTexture1->getHeight(), loadingScreenTexture1, renderer);
|
||||
sprite2 = new Sprite(0, 0, loadingScreenTexture2->getWidth(), loadingScreenTexture2->getHeight(), loadingScreenTexture2, renderer);
|
||||
loadingSound1 = JA_LoadMusic(asset->get("loading_sound1.ogg").c_str());
|
||||
loadingSound2 = JA_LoadMusic(asset->get("loading_sound2.ogg").c_str());
|
||||
loadingSound3 = JA_LoadMusic(asset->get("loading_sound3.ogg").c_str());
|
||||
|
||||
// Inicializa variables
|
||||
preCounter = 0;
|
||||
counter = 0;
|
||||
section->name = SECTION_LOADING_SCREEN;
|
||||
section->subsection = 0;
|
||||
ticks = 0;
|
||||
ticksSpeed = 15;
|
||||
loadCounter = 0;
|
||||
loadingFirstPart = true;
|
||||
loadRect = {0, 0, 51, 1};
|
||||
|
||||
// Establece el orden de las lineas para imitar el direccionamiento de memoria del spectrum
|
||||
for (int i = 0; i < 192; ++i)
|
||||
{
|
||||
if (i < 64)
|
||||
{ // Primer bloque de 2K
|
||||
lineIndex[i] = ((i % 8) * 8) + (i / 8);
|
||||
}
|
||||
|
||||
else if (i >= 64 && i < 128)
|
||||
{ // Segundo bloque de 2K
|
||||
lineIndex[i] = 64 + ((i % 8) * 8) + ((i - 64) / 8);
|
||||
}
|
||||
|
||||
else if (i >= 128 && i < 192)
|
||||
{ // tercer bloque de 2K
|
||||
lineIndex[i] = 128 + ((i % 8) * 8) + ((i - 128) / 8);
|
||||
}
|
||||
}
|
||||
|
||||
// Cambia el color del borde
|
||||
screen->setBorderColor(stringToColor(options->palette, "black"));
|
||||
}
|
||||
|
||||
// Destructor
|
||||
LoadingScreen::~LoadingScreen()
|
||||
{
|
||||
delete sprite1;
|
||||
delete sprite2;
|
||||
delete eventHandler;
|
||||
JA_DeleteMusic(loadingSound1);
|
||||
JA_DeleteMusic(loadingSound2);
|
||||
JA_DeleteMusic(loadingSound3);
|
||||
}
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
void LoadingScreen::checkEvents()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
{
|
||||
// Evento de salida de la aplicación
|
||||
if (eventHandler->type == SDL_QUIT)
|
||||
{
|
||||
section->name = SECTION_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Comprueba las entradas
|
||||
void LoadingScreen::checkInput()
|
||||
{
|
||||
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_QUIT;
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_toggle_border, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchBorder();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchVideoMode();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->decWindowSize();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->incWindowSize();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_swap_palette, REPEAT_FALSE))
|
||||
{
|
||||
switchPalette();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_pause, REPEAT_FALSE) || input->checkInput(input_accept, REPEAT_FALSE) || input->checkInput(input_jump, REPEAT_FALSE))
|
||||
{
|
||||
section->name = SECTION_TITLE;
|
||||
section->subsection = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Gestiona el contador de carga
|
||||
void LoadingScreen::updateLoad()
|
||||
{
|
||||
// Primera parte de la carga, la parte en blanco y negro
|
||||
if (loadingFirstPart)
|
||||
{
|
||||
// Cada 5 pasos el loadCounter se incrementa en uno
|
||||
const int numSteps = 5;
|
||||
const int step = 51;
|
||||
loadCounter = counter / numSteps;
|
||||
|
||||
if (loadCounter < 192)
|
||||
{
|
||||
loadRect.x = step * (counter % numSteps);
|
||||
loadRect.y = lineIndex[loadCounter];
|
||||
sprite1->setSpriteClip(loadRect);
|
||||
sprite1->setRect(loadRect);
|
||||
}
|
||||
// Una vez actualizadas las 192 lineas, pasa a la segunda fase de la carga
|
||||
else if (loadCounter == 192)
|
||||
{
|
||||
loadingFirstPart = false;
|
||||
loadCounter = 0;
|
||||
loadRect = {0, 0, 16, 8};
|
||||
sprite2->setRect(loadRect);
|
||||
sprite2->setSpriteClip(loadRect);
|
||||
JA_PlayMusic(loadingSound3);
|
||||
}
|
||||
}
|
||||
// Segunda parte de la carga, la parte de los bloques en color
|
||||
else
|
||||
{
|
||||
loadCounter += 2;
|
||||
loadRect.x = (loadCounter * 8) % 256;
|
||||
loadRect.y = (loadCounter / 32) * 8;
|
||||
sprite2->setSpriteClip(loadRect);
|
||||
sprite2->setRect(loadRect);
|
||||
|
||||
// Comprueba si ha terminado la intro
|
||||
if (loadCounter >= 768)
|
||||
{
|
||||
section->name = SECTION_TITLE;
|
||||
section->subsection = SUBSECTION_TITLE_WITH_LOADING_SCREEN;
|
||||
JA_StopMusic();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Gestiona el contador interno
|
||||
void LoadingScreen::updateCounter()
|
||||
{
|
||||
(preCounter >= 50) ? counter++ : preCounter++;
|
||||
|
||||
if (counter == 1)
|
||||
{
|
||||
JA_PlayMusic(loadingSound2);
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja la pantalla de carga
|
||||
void LoadingScreen::renderLoad()
|
||||
{
|
||||
loadingFirstPart ? sprite1->render() : sprite2->render();
|
||||
}
|
||||
|
||||
// Dibuja el efecto de carga en el borde
|
||||
void LoadingScreen::renderBorder()
|
||||
{
|
||||
// Pinta el borde de colro azul
|
||||
color_t color = stringToColor(options->palette, "blue");
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 0xFF);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
// Añade lineas amarillas
|
||||
color = stringToColor(options->palette, "yellow");
|
||||
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 0xFF);
|
||||
const int width = GAMECANVAS_WIDTH + (options->borderWidth * 2);
|
||||
const int height = GAMECANVAS_HEIGHT + (options->borderHeight * 2);
|
||||
bool drawEnabled = rand() % 2 == 0 ? true : false;
|
||||
// for (int i = 0; i < height; ++i)
|
||||
//{
|
||||
// if (rand() % 2 == 0)
|
||||
// {
|
||||
// SDL_RenderDrawLine(renderer, 0, i, width, i);
|
||||
// }
|
||||
// }
|
||||
int row = 0;
|
||||
int rowSize = 1;
|
||||
while (row < height)
|
||||
{
|
||||
rowSize = (rand() % 4) + 3;
|
||||
if (drawEnabled)
|
||||
for (int i = row; i < row + rowSize; ++i)
|
||||
{
|
||||
SDL_RenderDrawLine(renderer, 0, i, width, i);
|
||||
}
|
||||
row += rowSize;
|
||||
drawEnabled = !drawEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza las variables
|
||||
void LoadingScreen::update()
|
||||
{
|
||||
// Comprueba que la diferencia de ticks sea mayor a la velocidad del juego
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
{
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
// Comprueba las entradas
|
||||
checkInput();
|
||||
|
||||
// Gestiona el contador interno
|
||||
updateCounter();
|
||||
|
||||
// Gestiona el contador de carga
|
||||
updateLoad();
|
||||
|
||||
// Actualiza las notificaciones
|
||||
screen->updateNotifier();
|
||||
}
|
||||
}
|
||||
|
||||
// Dibuja en pantalla
|
||||
void LoadingScreen::render()
|
||||
{
|
||||
if (options->borderEnabled)
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura del borde
|
||||
screen->startDrawOnBorder();
|
||||
|
||||
// Dibuja el efecto de carga en el borde
|
||||
renderBorder();
|
||||
}
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Dibuja la pantalla de carga
|
||||
renderLoad();
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||
|
||||
// Bucle para el logo del juego
|
||||
void LoadingScreen::run()
|
||||
{
|
||||
// Inicia el sonido de carga
|
||||
JA_SetVolume(64);
|
||||
JA_PlayMusic(loadingSound1);
|
||||
|
||||
// Limpia la pantalla
|
||||
screen->start();
|
||||
screen->clean();
|
||||
screen->blit();
|
||||
|
||||
while (section->name == SECTION_LOADING_SCREEN)
|
||||
{
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
}
|
||||
|
||||
JA_SetVolume(128);
|
||||
}
|
||||
|
||||
// Cambia la paleta
|
||||
void LoadingScreen::switchPalette()
|
||||
{
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
options->palette = p_zxarne;
|
||||
sprite1->setTexture(resource->getTexture("loading_screen_bn_zxarne.png"));
|
||||
sprite2->setTexture(resource->getTexture("loading_screen_color_zxarne.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
options->palette = p_zxspectrum;
|
||||
sprite1->setTexture(resource->getTexture("loading_screen_bn.png"));
|
||||
sprite2->setTexture(resource->getTexture("loading_screen_color.png"));
|
||||
}
|
||||
|
||||
recreateLoadingScreen();
|
||||
}
|
||||
|
||||
// Reconstruye la pantalla de carga
|
||||
void LoadingScreen::recreateLoadingScreen()
|
||||
{
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
// Primera parte de la carga, la parte en blanco y negro
|
||||
if (loadingFirstPart)
|
||||
{
|
||||
const int numSteps = 5;
|
||||
const int step = 51;
|
||||
|
||||
for (int i = 0; i <= counter; i++)
|
||||
{
|
||||
loadCounter = i / numSteps;
|
||||
loadRect.x = step * (i % numSteps);
|
||||
loadRect.y = lineIndex[loadCounter];
|
||||
sprite1->setSpriteClip(loadRect);
|
||||
sprite1->setRect(loadRect);
|
||||
sprite1->render();
|
||||
}
|
||||
}
|
||||
// Segunda parte de la carga, la parte de los bloques en color
|
||||
else
|
||||
{
|
||||
for (int i = 0; i <= loadCounter; i++)
|
||||
{
|
||||
loadRect.x = (i * 8) % 256;
|
||||
loadRect.y = (i / 32) * 8;
|
||||
sprite2->setSpriteClip(loadRect);
|
||||
sprite2->setRect(loadRect);
|
||||
sprite2->render();
|
||||
}
|
||||
}
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
}
|
||||