diff --git a/.travis.yml b/.travis.yml
index a9f4ddfb..3166ed78 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -70,8 +70,23 @@ matrix:
- p7zip-full
- gcc-7
compiler: gcc-7
- env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3"
+ env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough"
#gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802
+ - os: linux
+ addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - libsdl2-mixer-dev
+ - libpng-dev
+ - libgl1-mesa-dev
+ - libgme-dev
+ - p7zip-full
+ - gcc-8
+ compiler: gcc-8
+ env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow"
+ #gcc-8 (Ubuntu 7.2.0-1ubuntu1~14.04) 8.1.0
- os: linux
compiler: clang
#clang version 3.5.0 (tags/RELEASE_350/final)
@@ -212,6 +227,7 @@ matrix:
- compiler: clang-3.9
- compiler: clang-4.0
- compiler: clang-5.0
+ - compiler: gcc-8
cache:
apt: true
diff --git a/SRB2.cbp b/SRB2.cbp
index 5aa623fa..2a1eb87b 100644
--- a/SRB2.cbp
+++ b/SRB2.cbp
@@ -1549,6 +1549,9 @@ HW3SOUND for 3D hardware sound support
+
+
+
diff --git a/assets/.gitignore b/assets/.gitignore
index 37bb465d..9ed61ca1 100644
--- a/assets/.gitignore
+++ b/assets/.gitignore
@@ -1,2 +1,5 @@
*
*.*
+!README.txt
+!LICENSE.txt
+!LICENSE-3RD-PARTY.txt
\ No newline at end of file
diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt
index 72124c1b..2cf93c84 100644
--- a/assets/CMakeLists.txt
+++ b/assets/CMakeLists.txt
@@ -12,6 +12,9 @@ set(SRB2_ASSET_ALL
${CMAKE_CURRENT_SOURCE_DIR}/sounds.kart
#${CMAKE_CURRENT_SOURCE_DIR}/music.dta
${CMAKE_CURRENT_SOURCE_DIR}/music.kart
+ ${CMAKE_CURRENT_SOURCE_DIR}/README.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE-3RD-PARTY.txt
)
set(SRB2_ASSET_HASHED
diff --git a/assets/LICENSE-3RD-PARTY.txt b/assets/LICENSE-3RD-PARTY.txt
new file mode 100644
index 00000000..42ea20e9
--- /dev/null
+++ b/assets/LICENSE-3RD-PARTY.txt
@@ -0,0 +1,1710 @@
+--------------------------------------------------------------------------------
+ 3-Clause BSD License
+ applies to:
+ - MiniUPnPc
+ Copyright (c) 2005-2011, Thomas BERNARD
+ All rights reserved.
+ http://miniupnp.free.fr
+--------------------------------------------------------------------------------
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+--------------------------------------------------------------------------------
+ curl License
+ applies to:
+ - curl
+ Copyright (c) 1996 - 2018, Daniel Stenberg, daniel@haxx.se,
+ and many contributors, see the THANKS file.
+ https://curl.haxx.se
+--------------------------------------------------------------------------------
+
+All rights reserved.
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright notice
+and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization of the copyright holder.
+
+--------------------------------------------------------------------------------
+ FMOD End User License Agreement
+ applies to:
+ - FMOD Ex
+ Copyright (c), Firelight Technologies Pty, Ltd. 2004-2018.
+ https://www.fmod.com
+--------------------------------------------------------------------------------
+
+This FMOD End User Licence Agreement (EULA) is a legal agreement between you and Firelight
+Technologies Pty Ltd (ACN 099 182 448) (us or we) and governs your use of FMOD Studio and FMOD
+Engine software (FMOD).
+
+1. GRANT OF LICENCE
+This EULA grants you the right to use FMOD, in a software application (Product), for
+personal (hobbyist), educational (students and teachers) or Non-Commercial use only,
+subject to the following:
+i) Non-Commercial use does not involve any form of monetisation, sponsorship
+or promotion.
+ii) FMOD is distributed as integrated into a Product only;
+iii) FMOD is not distributed as part of any Commercial Product or service;
+iv) FMOD is not distributed as part of a game engine or tool set;
+v) FMOD is not used in any Commercial enterprise or for any Commercial
+production or subcontracting, except for the purposes of Evaluation or
+Development of a Commercial Product;
+vi) Product includes attribution in accordance with Clause 3;
+
+2. OTHER USE
+For all Commercial use, and any Non Commercial use not permitted by this license, a
+separate license is required. Refer to www.fmod.com/licensing for information.
+
+3. CREDITS AND LOGO
+All Products require an in game credit line which must include the words "FMOD" or
+"FMOD Studio" (if applicable) and "Firelight Technologies Pty Ltd". This is non
+negotiable. Refer to www.fmod.com/licensing for examples. All products require a
+logo to be presented during start up of the application, before encountering any
+menus or interactivity. See www.fmod.com/licensing for logo information. The user
+has the option to 'buy out' the requirement to have a logo at the start of the
+product.
+
+4. INTELLECTUAL PROPERTY RIGHTS
+a) We are and remain at all times the owner of FMOD (including all intellectual
+property rights in or to the Software). For the avoidance of doubt, nothing in
+this EULA may be deemed to grant or assign to you any proprietary or ownership
+interest or intellectual property rights in or to FMOD other than the rights
+licensed pursuant to clause 1.
+b) You acknowledge and agree that you have no right, title or interest in and to the
+intellectual property rights in FMOD.
+
+5. SECURITY AND RISK
+You are responsible for protecting FMOD and any related materials at all times from
+unauthorised access, use or damage.
+
+6. WARRANTY AND LIMITATION OF LIABILITY
+a) FMOD is provided by us "as is" and, to the maximum extent permitted by law,
+any express or implied warranties of any kind, including (but not limited to) all
+implied warranties of merchantability and fitness for a particular purpose are
+disclaimed.
+b) In no event shall we (and our employees, contractors and subcontractors),
+developers and contributors be liable for any direct, special, indirect or
+consequential damages whatsoever resulting from loss of use of data or profits,
+whether in an action of contract, negligence or other tortious conduct, arising
+out of or in connection with the use or performance FMOD.
+
+7. OGG VORBIS CODEC
+a) FMOD uses the Ogg Vorbis codec.
+b) (c) 2002, Xiph.Org Foundation
+c) Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+i) Redistributions of source code must retain the above copyright notice, the
+list of conditions and the following disclaimer.
+ii) Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other material provided with the distribution.
+iii) Neither the name of the Xiph.org Foundation nor the names of its
+contributors may be used to endorse or promote products derived from this
+software without specific prior written permission.
+d) THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTIAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+8. GOOGLE VR (GVR)
+FMOD includes Google VR, licensed under the Apache Licence, Version 2.0 (the Licence);
+you may not use this file except in compliance with the License. You may obtain a copy of
+the License at:
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software distributed under the
+License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+either express or implied. See the License for the specific language governing permissions
+and limitations under the License.
+
+9. ANDROID PLATFORM CODE
+Copyright (C) 2010 The Android Open Source Project All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are
+permitted provided that the following conditions are met:
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+10. AUDIOGAMING AUDIOMOTORS DEMO CONTENT
+AudioGaming AudioMotors Demo Engine.agp is provided for evaluation purposes
+only and is not to be redistributed. To create your own engine content, you
+will need AudioMotors V2 Pro. A trial version be found at
+http://store.audiogaming.net/content/audiomotors-v2-pro-trial. For access to
+the full version, contact sales@fmod.com.
+
+© 2018 Firelight Technologies Pty Ltd.
+
+--------------------------------------------------------------------------------
+ GCC Runtime Library Exception, Version 3.1
+ applies to:
+ - GCC Runtime Library
+ Copyright (C) Free Software Foundation, Inc.
+ https://www.gnu.org/software/gcc/
+--------------------------------------------------------------------------------
+
+GCC RUNTIME LIBRARY EXCEPTION Version 3.1, 31 March 2009
+
+Copyright © 2009 Free Software Foundation, Inc.
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+This GCC Runtime Library Exception ("Exception") is an additional permission
+under section 7 of the GNU General Public License, version 3 ("GPLv3"). It
+applies to a given file (the "Runtime Library") that bears a notice placed by
+the copyright holder of the file stating that the file is governed by GPLv3
+along with this Exception.
+
+When you use GCC to compile a program, GCC may combine portions of certain GCC
+header files and runtime libraries with the compiled program. The purpose of
+this Exception is to allow compilation of non-GPL (including proprietary)
+programs to use, in this way, the header files and runtime libraries covered by
+this Exception.
+
+0. Definitions. A file is an "Independent Module" if it either requires the
+Runtime Library for execution after a Compilation Process, or makes use of an
+interface provided by the Runtime Library, but is not otherwise based on the
+Runtime Library.
+
+"GCC" means a version of the GNU Compiler Collection, with or without
+modifications, governed by version 3 (or a specified later version) of the GNU
+General Public License (GPL) with the option of using any subsequent versions
+published by the FSF.
+
+"GPL-compatible Software" is software whose conditions of propagation,
+modification and use would permit combination with GCC in accord with the
+license of GCC.
+
+"Target Code" refers to output from any compiler for a real or virtual target
+processor architecture, in executable form or suitable for input to an
+assembler, loader, linker and/or execution phase. Notwithstanding that, Target
+Code does not include data in any format that is used as a compiler
+intermediate representation, or used for producing a compiler intermediate
+representation.
+
+The "Compilation Process" transforms code entirely represented in
+non-intermediate languages designed for human-written code, and/or in Java
+Virtual Machine byte code, into Target Code. Thus, for example, use of source
+code generators and preprocessors need not be considered part of the
+Compilation Process, since the Compilation Process can be understood as
+starting with the output of the generators or preprocessors.
+
+A Compilation Process is "Eligible" if it is done using GCC, alone or with
+other GPL-compatible software, or if it is done without using any work based on
+GCC. For example, using non-GPL-compatible Software to optimize any GCC
+intermediate representations would not qualify as an Eligible Compilation
+Process.
+
+1. Grant of Additional Permission. You have permission to propagate a work of
+Target Code formed by combining the Runtime Library with Independent Modules,
+even if such propagation would otherwise violate the terms of GPLv3, provided
+that all Target Code was generated by Eligible Compilation Processes. You may
+then convey such a combination under terms of your choice, consistent with the
+licensing of the Independent Modules.
+
+2. No Weakening of GCC Copyleft. The availability of this Exception does not
+imply any general presumption that third-party software is unaffected by the
+copyleft requirements of the license of GCC.
+
+--------------------------------------------------------------------------------
+ GNU General Public License, Version 3
+ applies to:
+ - GCC Runtime Library
+ Copyright (C) Free Software Foundation, Inc.
+ https://www.gnu.org/software/gcc/
+--------------------------------------------------------------------------------
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ 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.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 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 .
+
+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:
+
+ Copyright (C)
+ 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
+.
+
+ 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
+.
+
+--------------------------------------------------------------------------------
+ GNU Lesser General Public License, Version 2.1
+ applies to:
+ - Game_Music_Emu
+ Shay Green
+ http://www.slack.net/~ant/
+
+ - libintl
+ Copyright (C) 1995-2018 Free Software Foundation, Inc.
+ https://www.gnu.org/software/gettext/
+
+ - mpg123
+ Copyright (c) 1995-2013 by Michael Hipp and others,
+ free software under the terms of the LGPL v2.1
+ https://www.mpg123.de
+--------------------------------------------------------------------------------
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser 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 Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "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
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY 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
+LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+--------------------------------------------------------------------------------
+ libpng License
+ applies to:
+ - libpng
+ Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson
+ http://www.libpng.org/pub/png/libpng.html
+--------------------------------------------------------------------------------
+
+This copy of the libpng notices is provided for your convenience. In case of
+any discrepancy between this copy and the notices in the file png.h that is
+included in the libpng distribution, the latter shall prevail.
+
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+
+If you modify libpng you may insert additional notices immediately following
+this sentence.
+
+This code is released under the libpng license.
+
+libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
+Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
+derived from libpng-1.0.6, and are distributed according to the same
+disclaimer and license as libpng-1.0.6 with the following individuals
+added to the list of Contributing Authors:
+
+ Simon-Pierre Cadieux
+ Eric S. Raymond
+ Mans Rullgard
+ Cosmin Truta
+ Gilles Vollant
+ James Yu
+ Mandar Sahastrabuddhe
+ Google Inc.
+ Vadim Barkov
+
+and with the following additions to the disclaimer:
+
+ There is no warranty against interference with your enjoyment of the
+ library or against infringement. There is no warranty that our
+ efforts or the library will fulfill any of your particular purposes
+ or needs. This library is provided with all faults, and the entire
+ risk of satisfactory quality, performance, accuracy, and effort is with
+ the user.
+
+Some files in the "contrib" directory and some configure-generated
+files that are distributed with libpng have other copyright owners and
+are released under other open source licenses.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
+libpng-0.96, and are distributed according to the same disclaimer and
+license as libpng-0.96, with the following individuals added to the list
+of Contributing Authors:
+
+ Tom Lane
+ Glenn Randers-Pehrson
+ Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
+and are distributed according to the same disclaimer and license as
+libpng-0.88, with the following individuals added to the list of
+Contributing Authors:
+
+ John Bowler
+ Kevin Bracey
+ Sam Bushell
+ Magnus Holmgren
+ Greg Roelofs
+ Tom Tanner
+
+Some files in the "scripts" directory have other copyright owners
+but are released under this license.
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"
+is defined as the following set of individuals:
+
+ Andreas Dilger
+ Dave Martindale
+ Guy Eric Schalnat
+ Paul Schmidt
+ Tim Wegner
+
+The PNG Reference Library is supplied "AS IS". The Contributing Authors
+and Group 42, Inc. disclaim all warranties, expressed or implied,
+including, without limitation, the warranties of merchantability and of
+fitness for any purpose. The Contributing Authors and Group 42, Inc.
+assume no liability for direct, indirect, incidental, special, exemplary,
+or consequential damages, which may result from the use of the PNG
+Reference Library, even if advised of the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+source code, or portions hereof, for any purpose, without fee, subject
+to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented.
+
+ 2. Altered versions must be plainly marked as such and must not
+ be misrepresented as being the original source.
+
+ 3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit, without
+fee, and encourage the use of this source code as a component to
+supporting the PNG file format in commercial products. If you use this
+source code in a product, acknowledgment is not required but would be
+appreciated.
+
+END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
+
+TRADEMARK:
+
+The name "libpng" has not been registered by the Copyright owner
+as a trademark in any jurisdiction. However, because libpng has
+been distributed and maintained world-wide, continually since 1995,
+the Copyright owner claims "common-law trademark protection" in any
+jurisdiction where common-law trademark is recognized.
+
+OSI CERTIFICATION:
+
+Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
+a certification mark of the Open Source Initiative. OSI has not addressed
+the additional disclaimers inserted at version 1.0.7.
+
+EXPORT CONTROL:
+
+The Copyright owner believes that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because
+it is open source, publicly available software, that does not contain
+any encryption software. See the EAR, paragraphs 734.3(b)(3) and
+734.7(b).
+
+Glenn Randers-Pehrson
+glennrp at users.sourceforge.net
+July 15, 2018
+
+--------------------------------------------------------------------------------
+ New BSD License
+ applies to:
+ - FLAC
+ Copyright (C) 2000-2009 Josh Coalson
+ Copyright (C) 2011-2016 Xiph.Org Foundation
+ https://xiph.org/flac/api/
+
+ - Vorbis
+ Copyright (c) 2002-2008 Xiph.org Foundation
+ https://xiph.org/vorbis/
+
+ - Opus
+ Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic,
+ Jean-Marc Valin, Timothy B. Terriberry,
+ CSIRO, Gregory Maxwell, Mark Borgerding,
+ Erik de Castro Lopo
+ https://opus-codec.org
+
+ - Opus File
+ Copyright (c) 1994-2013 Xiph.Org Foundation and contributors
+ https://opus-codec.org
+--------------------------------------------------------------------------------
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+- Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+[ For FLAC, Vorbis, and Opus File
+- Neither the name of the Xiph.org Foundation nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+]
+
+[ For Opus
+- Neither the name of Internet Society, IETF or IETF Trust, nor the
+names of specific contributors, may be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+]
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+--------------------------------------------------------------------------------
+ Public Domain
+ applies to:
+ - win_iconv
+ Yukihiro Nakadaira
+ win_iconv is placed in the public domain.
+ https://github.com/win-iconv/win-iconv
+
+ - libmodplug
+ ModPlug-XMMS and libmodplug are now in the public domain.
+ http://modplug-xmms.sourceforge.net
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+ zlib License
+ applies to:
+ - Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga
+ https://www.libsdl.org/hg.php
+
+ - SDL_mixer: An audio mixer library based on the SDL library
+ Copyright (C) 1997-2018 Sam Lantinga
+ https://www.libsdl.org/projects/SDL_mixer/
+
+ - zlib
+ Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
+ https://zlib.net
+--------------------------------------------------------------------------------
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
diff --git a/assets/LICENSE.txt b/assets/LICENSE.txt
new file mode 100644
index 00000000..d159169d
--- /dev/null
+++ b/assets/LICENSE.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/assets/README.txt b/assets/README.txt
new file mode 100644
index 00000000..e8e21a84
--- /dev/null
+++ b/assets/README.txt
@@ -0,0 +1,65 @@
+SONIC ROBO BLAST 2 KART
+
+SRB2Kart is a kart racer based on SRB2, the 3D Sonic the Hedgehog
+fangame based on a modified version of Doom Legacy.
+
+LICENSE
+
+The source code for SRB2 & SRB2Kart is licensed under the GNU General
+Public License, Version 2. See LICENSE.txt for the full text of this
+license.
+
+SRB2 & SRB2Kart uses various third-party libraries, including SDL, SDL
+Mixer, and their dependencies. See LICENSE-3RD-PARTY.txt for the
+licenses of these libraries.
+
+SOURCE CODE
+
+You may obtain the source code for SRB2Kart, including the source code
+for specific version releases, at the following web site:
+
+STJr GitLab:
+https://git.magicalgirl.moe/KartKrew/Kart-Public
+
+You may obtain the source code for the parent game, SRB2, at the
+following web sites:
+
+STJr GitLab:
+https://git.magicalgirl.moe/STJr/SRB2
+
+GitHub:
+https://github.com/STJr/SRB2
+
+CONTACT
+
+You may contact Kart Krew via the following web site:
+
+Kart Krew Official Discord:
+https://discord.gg/WJmqDtN
+
+You may contact Sonic Team Junior via the following web sites:
+
+SRB2.ORG:
+https://www.srb2.org
+
+SRB2 Message Board:
+https://mb.srb2.org
+
+SRB2 Official Discord:
+https://discord.gg/pYDXzpX
+
+COPYRIGHT AND DISCLAIMER
+
+Design and content on SRB2Kart is copyright 2018 by Kart Krew.
+Design and content on SRB2 is copyright 1998-2018 by Sonic Team Junior.
+All non-original material on SRB2.ORG is copyrighted by their
+respective owners, and no copyright infringement is intended. The owner
+of the SRB2.ORG domain is only acting as an ISP, and is therefore not
+responsible for any content on SRB2.ORG under the 1998 DMCA. This
+site, its webmaster, and its staff make no profit whatsoever (in fact,
+we lose money). Sonic Team Junior assumes no responsibility for the
+content on any Sonic Team Junior fan sites.
+
+Kart Krew nor Sonic Team Junior is in no way affiliated with SEGA or
+Sonic Team. We do not claim ownership of any of SEGA's intellectual
+property used in SRB2 or SRB2Kart.
diff --git a/assets/debian/README.Debian b/assets/debian/README.Debian
index 4d9f067a..68c952a4 100644
--- a/assets/debian/README.Debian
+++ b/assets/debian/README.Debian
@@ -3,10 +3,45 @@ srb2 for Debian
SRB2 Debian package!
Hi there, to rebuild this package just use the SRB2 Makefile system, or, optionally, run
-dpkg-buildpackage in the in /bin/Resources directory. You can build these with or without a key
+dpkg-buildpackage in the in /assets directory. You can build these with or without a key
if you want, but if you want to put these on a repo, generate your own GnuPG key as per the
https://help.ubuntu.com/community/GnuPrivacyGuardHowto instructions and pass the -k
command to debuild. Make sure you export the key footprint and give them to your users to install
with apt-key add. Thanks!
-- Callum Dickinson Fri, 26 Nov 2010 18:25:31 +1300
+
+
+Signing for Launchpad PPA
+
+First, follow the above instructions to generate a GnuPG key with your identity. You will need
+to publish the fingerprint of that key to Ubuntu's key server.
+
+ https://help.ubuntu.com/community/GnuPrivacyGuardHowto#Uploading_the_key_to_Ubuntu_keyserver
+
+Next, you will have to add that key fingerprint to your Launchpad account. Go to your Launchpad
+profile and click the yellow Edit button next to "OpenPGP keys". Once you add the key, you can
+upload signed source packages and publish them onto your PPA.
+
+IF YOU UPLOAD A PACKAGE and Launchpad does NOT send you a confirmation or rejection email, that
+means your key is not set up correctly with your Launchpad account.
+
+
+Building for Launchpad PPA
+
+Use these steps to prepare building a source package for Launchpad:
+
+ 1. Highly recommend copying the assets/ folder to outside your repo folder, or else the asset
+ files may be included in the main source package, when you build that.
+ 2. cd [wherever-your-assets-folder-is]/assets/
+ 3. debuild -T clean (optional, if you already have asset files)
+
+Building the source package is a two-step process:
+
+ 1. debuild -T build (this downloads the asset files from srb2.org if necessary)
+ 2. debuild -S (builds the source package for Launchpad, including the asset files)
+
+Then follow the instructions at to upload
+to your PPA and have Launchpad build your binary deb packages.
+
+ -- Marco Zafra Mon, 26 Nov 2018 21:13:00 -0500
diff --git a/assets/debian/changelog b/assets/debian/changelog
index a316b7df..f3a92e1c 100644
--- a/assets/debian/changelog
+++ b/assets/debian/changelog
@@ -1,3 +1,10 @@
+srb2-data (2.1.21~7) trusty; urgency=high
+
+ * Updated for SRB2 v2.1.21
+
+ -- Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500
+
+
srb2-data (2.1.14~1) unstable; urgency=low
* Updated for SRB2 v2.1.14
diff --git a/assets/debian/control b/assets/debian/control
index 123b5842..22d9643e 100644
--- a/assets/debian/control
+++ b/assets/debian/control
@@ -3,8 +3,9 @@
Source: srb2-data
Section: games
Priority: extra
-Maintainer: Callum Dickinson
-Build-Depends: debhelper (>= 7.0.50~)
+Maintainer: Sonic Team Junior
+Build-Depends: debhelper (>= 7.0.50~),
+ wget
Standards-Version: 3.8.4
Homepage: http://www.srb2.org
@@ -15,8 +16,7 @@ Description: A cross-platform 3D Sonic fangame
fangame built using a modified version of the Doom Legacy
port of Doom. SRB2 is closely inspired by the original
Sonic games from the Sega Genesis, and attempts to recreate
- the design in 3D. While SRB2 isn't fully completed, it already
- features tons of levels, enemies, speed, and quite a lot
- of the fun that the original Sonic games provided.
+ the design in 3D. It features tons of levels, enemies, speed,
+ and quite a lot of the fun that the original Sonic games provided.
This is the data package that provides the data files that
- SRB2 requires to run, it will not work without it.
+ SRB2 requires to run; it will not work without it.
diff --git a/assets/debian/copyright b/assets/debian/copyright
index 8a870519..97d606b0 100644
--- a/assets/debian/copyright
+++ b/assets/debian/copyright
@@ -1,6 +1,6 @@
This work was packaged for Debian by:
- Callum Dickinson on Fri, 26 Nov 2010 15:19:16 +1300
+ Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500
It was downloaded from:
@@ -12,7 +12,7 @@ Upstream Author(s):
Copyright:
- Copyright (C) 1998-2010 Sonic Team Junior
+ Copyright (C) 1998-2018 Sonic Team Junior
License:
@@ -21,6 +21,7 @@ License:
The Debian packaging is:
Copyright (C) 2010 Callum Dickinson
+ Copyright (C) 2010-2018 Sonic Team Junior
and is licensed under the GPL version 2,
see "/usr/share/common-licenses/GPL-2".
diff --git a/assets/debian/rules b/assets/debian/rules
index d86f92af..a34a3393 100755
--- a/assets/debian/rules
+++ b/assets/debian/rules
@@ -37,7 +37,7 @@ RM := rm -rf
DIR := $(shell pwd)
PACKAGE := $(shell cat $(DIR)/debian/control | grep 'Package:' | sed -e 's/Package: //g')
-DATAFILES := srb2.srb zones.dta player.dta rings.dta music.dta
+DATAFILES := srb2.srb zones.dta player.dta rings.dta music.dta patch.dta README.txt LICENSE.txt LICENSE-3RD-PARTY.txt
DATADIR := usr/games/SRB2
RESOURCEDIR := .
@@ -45,16 +45,21 @@ WGET := wget -P $(RESOURCEDIR) -c -nc
build:
$(MKDIR) $(DIR)/debian/tmp/$(DATADIR)
+ > $(DIR)/debian/source/include-binaries
# This will need to be updated every time SRB2 official version is
# Copy data files to their install locations, and add data files to include-binaries
for file in $(DATAFILES); do \
- $(WGET) http://alam.srb2.org/SRB2/2.1.14-Final/Resources/$$file; \
- if test "$$file" = "srb2.wad"; then \
- $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/srb2.srb; \
- else \
- $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/$$file; \
+ if [ ! -f $(RESOURCEDIR)/$$file ]; then \
+ $(WGET) http://alam.srb2.org/SRB2/2.1.21-Final/Resources/$$file; \
+ fi; \
+ if [ -f $(RESOURCEDIR)/$$file ]; then \
+ $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/$$file; \
+ echo $(RESOURCEDIR)/$$file >> $(DIR)/debian/source/include-binaries; \
+ fi; \
+ if [ ! -f $(DIR)/debian/tmp/$(DATADIR)/$$file ]; then \
+ echo $(DIR)/debian/tmp/$(DATADIR)/$$file not found and could not be downloaded!; \
+ return 1; \
fi; \
- echo $(RESOURCEDIR)/$$file >> $(DIR)/debian/source/include-binaries; \
done
binary-indep:
@@ -95,15 +100,18 @@ binary: binary-indep
dh_builddeb
clean:
- $(RM) $(RESOURCEDIR)/*.wad
- $(RM) $(RESOURCEDIR)/*.dta
- $(RM) $(RESOURCEDIR)/*.plr
- $(RM) $(RESOURCEDIR)/*.wpn
- $(RM) $(RESOURCEDIR)/*.srb
- $(RM) $(RESOURCEDIR)/*.dll
- $(RM) $(DIR)/debian/tmp/*
- $(RM) $(DIR)/debian/$(PACKAGE).install
- $(RM) $(DIR)/debian/files
- $(RM) $(DIR)/debian/source/include-binaries
+ $(RM) $(DIR)/debian/tmp/*; \
+ $(RM) $(DIR)/debian/$(PACKAGE).install; \
+ $(RM) $(DIR)/debian/files; \
+
+clean-all: clean
+ $(RM) $(RESOURCEDIR)/*.wad; \
+ $(RM) $(RESOURCEDIR)/*.dta; \
+ $(RM) $(RESOURCEDIR)/*.plr; \
+ $(RM) $(RESOURCEDIR)/*.wpn; \
+ $(RM) $(RESOURCEDIR)/*.srb; \
+ $(RM) $(RESOURCEDIR)/*.dll; \
+ $(RM) $(RESOURCEDIR)/*.txt; \
+ $(RM) $(DIR)/debian/source/include-binaries; \
.PHONY: all clean binary binary-arch binary-indep build
diff --git a/assets/debian/source/options b/assets/debian/source/options
new file mode 100644
index 00000000..8b331485
--- /dev/null
+++ b/assets/debian/source/options
@@ -0,0 +1 @@
+tar-ignore = "tmp/*"
diff --git a/bin/Resources/exchndl.dll b/bin/Resources/i686/exchndl.dll
similarity index 100%
rename from bin/Resources/exchndl.dll
rename to bin/Resources/i686/exchndl.dll
diff --git a/bin/Resources/fmod.dll b/bin/Resources/i686/fmod.dll
similarity index 100%
rename from bin/Resources/fmod.dll
rename to bin/Resources/i686/fmod.dll
diff --git a/bin/Resources/fmodex.dll b/bin/Resources/i686/fmodex.dll
similarity index 100%
rename from bin/Resources/fmodex.dll
rename to bin/Resources/i686/fmodex.dll
diff --git a/bin/Resources/fmodexL.dll b/bin/Resources/i686/fmodexL.dll
similarity index 100%
rename from bin/Resources/fmodexL.dll
rename to bin/Resources/i686/fmodexL.dll
diff --git a/bin/Resources/libgcc_s_dw2-1.dll b/bin/Resources/i686/libgcc_s_dw2-1.dll
similarity index 100%
rename from bin/Resources/libgcc_s_dw2-1.dll
rename to bin/Resources/i686/libgcc_s_dw2-1.dll
diff --git a/bin/Resources/libgme.dll b/bin/Resources/i686/libgme.dll
similarity index 100%
rename from bin/Resources/libgme.dll
rename to bin/Resources/i686/libgme.dll
diff --git a/bin/Resources/libintl-8.dll b/bin/Resources/i686/libintl-8.dll
similarity index 100%
rename from bin/Resources/libintl-8.dll
rename to bin/Resources/i686/libintl-8.dll
diff --git a/bin/Resources/fmod64.dll b/bin/Resources/x86_64/fmod64.dll
similarity index 100%
rename from bin/Resources/fmod64.dll
rename to bin/Resources/x86_64/fmod64.dll
diff --git a/bin/Resources/fmodex64.dll b/bin/Resources/x86_64/fmodex64.dll
similarity index 100%
rename from bin/Resources/fmodex64.dll
rename to bin/Resources/x86_64/fmodex64.dll
diff --git a/bin/Resources/fmodexL64.dll b/bin/Resources/x86_64/fmodexL64.dll
similarity index 100%
rename from bin/Resources/fmodexL64.dll
rename to bin/Resources/x86_64/fmodexL64.dll
diff --git a/bin/Resources/x86_64/libgme.dll b/bin/Resources/x86_64/libgme.dll
new file mode 100644
index 00000000..2ba99450
Binary files /dev/null and b/bin/Resources/x86_64/libgme.dll differ
diff --git a/debian/README.Debian b/debian/README.Debian
index bbc306b1..4b724816 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -9,3 +9,38 @@ instructions and pass the -k command to debuild. Make sure you export the
and give them to your users to install with apt-key add. Thanks!
-- Callum Dickinson Fri, 26 Nov 2010 18:25:31 +1300
+
+
+Signing for Launchpad PPA
+
+First, follow the above instructions to generate a GnuPG key with your identity. You will need
+to publish the fingerprint of that key to Ubuntu's key server.
+
+ https://help.ubuntu.com/community/GnuPrivacyGuardHowto#Uploading_the_key_to_Ubuntu_keyserver
+
+Next, you will have to add that key fingerprint to your Launchpad account. Go to your Launchpad
+profile and click the yellow Edit button next to "OpenPGP keys". Once you add the key, you can
+upload signed source packages and publish them onto your PPA.
+
+IF YOU UPLOAD A PACKAGE and Launchpad does NOT send you a confirmation or rejection email, that
+means your key is not set up correctly with your Launchpad account.
+
+
+Building for Launchpad PPA
+
+Use these steps to prepare building a source package for Launchpad:
+
+ 1. cd [srb2repo]
+ 2. git reset --hard; git clean -fd; git clean -fx;
+ * Resets your repo folder to a committed state and removes untracked files
+ * If you built srb2-data in the assets/ folder, MAKE SURE THAT FOLDER DOES NOT HAVE ASSETS,
+ OR THEY MAY BE INCLUDED IN THE MAIN SOURCE PACKAGE!
+
+Building the source package takes just one step:
+
+ 1. debuild -S (builds the source package for Launchpad)
+
+Then follow the instructions at to upload
+to your PPA and have Launchpad build your binary deb packages.
+
+ -- Marco Zafra Mon, 26 Nov 2018 21:13:00 -0500
diff --git a/debian/README.source b/debian/README.source
index ff2dddd4..f63a42ca 100644
--- a/debian/README.source
+++ b/debian/README.source
@@ -22,6 +22,10 @@ Build instructions:
make -C src LINUX=1
+Build instructions for non-X86 devices (such as X64):
+
+make -C src LINUX=1 NONX86=1
+
Build instructions to build for Wii Linux/SRB2Wii on a PowerPC system,
follow cross-compiling instructions for cross-compiling on a x86 system:
diff --git a/debian/changelog b/debian/changelog
index b454b1ab..855c1c1b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+srb2 (2.1.21~9) trusty; urgency=high
+
+ * SRB2 v2.1.21 release
+
+ -- Marco Zafra Mon, 27 Nov 2018 16:45:00 -0500
+
+
srb2 (2.0.6-5) maverick; urgency=high
* Initial proper release..
diff --git a/debian/control b/debian/control
index 63b075f1..ce3b33fb 100644
--- a/debian/control
+++ b/debian/control
@@ -3,11 +3,13 @@
Source: srb2
Section: games
Priority: extra
-Maintainer: Callum Dickinson
+Maintainer: Sonic Team Junior
Build-Depends: debhelper (>= 7.0.50~),
libsdl2-dev,
libsdl2-mixer-dev,
- libpng12-dev (>= 1.2.7),
+ libpng12-dev (>= 1.2.7) | libpng-dev,
+ zlib1g-dev,
+ libgme-dev,
libglu1-dev | libglu-dev,
libosmesa6-dev | libgl-dev,
nasm [i386]
@@ -16,27 +18,26 @@ Homepage: http://www.srb2.org
Package: srb2
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14)
+Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.21)
Description: A cross-platform 3D Sonic fangame
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
fangame built using a modified version of the Doom Legacy
port of Doom. SRB2 is closely inspired by the original
Sonic games from the Sega Genesis, and attempts to recreate
- the design in 3D. While SRB2 isn't fully completed, it already
- features tons of levels, enemies, speed, and quite a lot
- of the fun that the original Sonic games provided.
+ the design in 3D. It features tons of levels, enemies, speed,
+ and quite a lot of the fun that the original Sonic games provided.
+
Package: srb2-dbg
Architecture: any
# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat
-Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.14), srb2
+Depends: libc6, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.21), srb2
Description: A cross-platform 3D Sonic fangame
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
fangame built using a modified version of the Doom Legacy
port of Doom. SRB2 is closely inspired by the original
Sonic games from the Sega Genesis, and attempts to recreate
- the design in 3D. While SRB2 isn't fully completed, it already
- features tons of levels, enemies, speed, and quite a lot
- of the fun that the original Sonic games provided.
- This is a debug binary, its symbols will be loaded by gdb
+ the design in 3D. It features tons of levels, enemies, speed,
+ and quite a lot of the fun that the original Sonic games provided.
+ This is a debug binary; its symbols will be loaded by gdb
when the user starts the game with gdb for debugging.
diff --git a/debian/copyright b/debian/copyright
index 8a870519..97d606b0 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,6 +1,6 @@
This work was packaged for Debian by:
- Callum Dickinson on Fri, 26 Nov 2010 15:19:16 +1300
+ Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500
It was downloaded from:
@@ -12,7 +12,7 @@ Upstream Author(s):
Copyright:
- Copyright (C) 1998-2010 Sonic Team Junior
+ Copyright (C) 1998-2018 Sonic Team Junior
License:
@@ -21,6 +21,7 @@ License:
The Debian packaging is:
Copyright (C) 2010 Callum Dickinson
+ Copyright (C) 2010-2018 Sonic Team Junior
and is licensed under the GPL version 2,
see "/usr/share/common-licenses/GPL-2".
diff --git a/debian/docs b/debian/docs
index b43bf86b..dba2cd4c 100644
--- a/debian/docs
+++ b/debian/docs
@@ -1 +1,4 @@
README.md
+assets/README.txt
+assets/LICENSE.txt
+assets/LICENSE-3RD-PARTY.txt
diff --git a/debian/rules b/debian/rules
index e49784a0..02e3dc78 100755
--- a/debian/rules
+++ b/debian/rules
@@ -57,21 +57,32 @@ SECTION = Games/Action
EXENAME = srb2
DBGNAME = debug/$(EXENAME)
-PKGDIR = usr/games
+PKGDIR = usr/games/SRB2
DBGDIR = usr/lib/debug/$(PKGDIR)
PIXMAPS_DIR = usr/share/pixmaps
DESKTOP_DIR = usr/share/applications
PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)")
OS = LINUX=1
NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "NONX86=1")
-MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng NOOBJDUMP=1
+MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) NOOBJDUMP=1 # SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng
MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)"
MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)"
-# FIXME pkg-config dir hacks
-export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig
BINDIR := $(DIR)/bin/Linux/Release
+
+# FIXME pkg-config dir hacks
+# Launchpad doesn't need this; it actually makes i386 builds fail due to cross-compile
+# export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig
LDFLAGS += "-Wl,-rpath=/usr/lib/$(CROSS_COMPILE_HOST)"
+# Some libgme-dev packages don't use pkg-config yet, so include the linker flag ourselves
+PKG_CONFIG?=pkg-config
+LIBGME_PKGCONFIG?=libgme
+LIBGME_LDFLAGS?=$(shell $(PKG_CONFIG) $(LIBGME_PKGCONFIG) --libs)
+
+ifeq ($(LIBGME_LDFLAGS),)
+MAKEARGS += LIBGME_LDFLAGS=-lgme
+endif
+
build:
$(MKDIR) $(BINDIR)/debug
$(MAKE) -C $(DIR)/src $(MAKEARGS)
@@ -100,8 +111,8 @@ binary-arch:
echo $(DESKTOP_DIR) >> $(DIR)/debian/$(PACKAGE).install
echo $(PIXMAPS_DIR) >> $(DIR)/debian/$(PACKAGE).install
echo $(DBGDIR) > $(DIR)/debian/$(DBGPKG).install
-
-binary: binary-arch
+# Launchpad only calls binary-arch, so just move everything up
+#binary: binary-arch
# Generate .desktop specifications
echo "`echo '$(MENUFILE1)\\'`" > $(DIR)/debian/menu
echo " `echo '$(MENUFILE2)'`" >> $(DIR)/debian/menu
@@ -133,6 +144,8 @@ binary: binary-arch
dh_md5sums
dh_builddeb
+binary: binary-arch
+
clean:
$(MAKE) -C $(DIR)/src $(MAKEARGS) clean cleandep
$(RM) $(BINDIR)/*
@@ -145,4 +158,4 @@ clean:
$(RM) $(DIR)/debian/files
$(RM) $(DIR)/debian/source/include-binaries
-.PHONY: all clean binary binary-arch binary-indep build
+.PHONY: all clean binary binary-indep build
diff --git a/debian/source/options b/debian/source/options
new file mode 100644
index 00000000..841c65a6
--- /dev/null
+++ b/debian/source/options
@@ -0,0 +1,10 @@
+tar-ignore = "assets/*.srb"
+tar-ignore = "assets/*.pk3"
+tar-ignore = "assets/*.dta"
+tar-ignore = "assets/*.wad"
+tar-ignore = "assets/debian/srb2-data/*"
+tar-ignore = "assets/debian/tmp/*"
+tar-ignore = "*.obj"
+tar-ignore = "*.dep"
+tar-ignore = ".git/*"
+tar-ignore = ".git*"
diff --git a/debian/srb2.desktop b/debian/srb2.desktop
index 661832b9..3a1cac9f 100644
--- a/debian/srb2.desktop
+++ b/debian/srb2.desktop
@@ -1,8 +1,8 @@
[Desktop Entry]
Name=Sonic Robo Blast 2
-Comment=A free 3D Sonic the Hedgehog fan-game built using a modified ver. of the Doom Legacy source port
+Comment=A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis.
Encoding=UTF-8
-Exec=srb2
+Exec=/usr/games/SRB2/srb2
Icon=/usr/share/pixmaps/srb2.png
Terminal=false
Type=Application
diff --git a/libs/gme/win64/libgme.dll.a b/libs/gme/win64/libgme.dll.a
new file mode 100644
index 00000000..38079dc2
Binary files /dev/null and b/libs/gme/win64/libgme.dll.a differ
diff --git a/srb2.png b/srb2.png
index 9c13eae9..72a08f66 100644
Binary files a/srb2.png and b/srb2.png differ
diff --git a/srb2banner.png b/srb2banner.png
new file mode 100644
index 00000000..9c13eae9
Binary files /dev/null and b/srb2banner.png differ
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 26583e55..f4e2898e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -229,10 +229,17 @@ set(SRB2_CONFIG_YASM OFF CACHE BOOL
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
"Use statically linked OpenGL. NOT RECOMMENDED.")
+### use internal libraries?
+if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
+ set(SRB2_CONFIG_USE_INTERNAL_LIBRARIES OFF CACHE BOOL
+ "Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME).")
+endif()
+
if(${SRB2_CONFIG_HAVE_BLUA})
add_definitions(-DHAVE_BLUA)
set(SRB2_LUA_SOURCES
lua_baselib.c
+ lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
@@ -316,7 +323,17 @@ if(${SRB2_CONFIG_HAVE_BLUA})
endif()
if(${SRB2_CONFIG_HAVE_GME})
- find_package(GME)
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(GME_FOUND ON)
+ set(GME_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/gme/include)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win64 -lgme")
+ else() # 32-bit
+ set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win32 -lgme")
+ endif()
+ else()
+ find_package(GME)
+ endif()
if(${GME_FOUND})
set(SRB2_HAVE_GME ON)
add_definitions(-DHAVE_LIBGME)
@@ -326,9 +343,20 @@ if(${SRB2_CONFIG_HAVE_GME})
endif()
if(${SRB2_CONFIG_HAVE_ZLIB})
- find_package(ZLIB)
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(ZLIB_FOUND ON)
+ set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/zlib)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(ZLIB_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/zlib/win32 -lz64")
+ else() # 32-bit
+ set(ZLIB_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/zlib/win32 -lz32")
+ endif()
+ else()
+ find_package(ZLIB)
+ endif()
if(${ZLIB_FOUND})
set(SRB2_HAVE_ZLIB ON)
+ add_definitions(-DHAVE_ZLIB)
else()
message(WARNING "You have specified that ZLIB is available but it was not found. SRB2 may not compile correctly.")
endif()
@@ -336,7 +364,17 @@ endif()
if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
if (${ZLIB_FOUND})
- find_package(PNG)
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(PNG_FOUND ON)
+ set(PNG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libpng-src)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(PNG_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libpng-src/projects -lpng64")
+ else() # 32-bit
+ set(PNG_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libpng-src/projects -lpng32")
+ endif()
+ else()
+ find_package(PNG)
+ endif()
if(${PNG_FOUND})
set(SRB2_HAVE_PNG ON)
add_definitions(-DHAVE_PNG)
diff --git a/src/Makefile b/src/Makefile
index 1f68fc06..a2279a94 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,7 @@
# GNU Make makefile for SRB2
#############################################################################
# Copyright (C) 1998-2000 by DooM Legacy Team.
-# Copyright (C) 2003-2014 by Sonic Team Junior.
+# Copyright (C) 2003-2018 by Sonic Team Junior.
#
# This program is free software distributed under the
# terms of the GNU General Public License, version 2.
@@ -179,6 +179,11 @@ ifdef MINGW
include win32/Makefile.cfg
endif #ifdef MINGW
+ifdef MINGW64
+MINGW=1
+include win32/Makefile.cfg
+endif #ifdef MINGW64
+
ifdef UNIX
UNIXCOMMON=1
endif
@@ -715,7 +720,6 @@ $(BIN)/s_openal.so: $(OBJDIR)/s_openal.o
-$(MKDIR) $(BIN)
@echo Linking S_OpenAL.so...
$(CC) --shared $^ -o $@ -g --nostartfiles -lm -lopenal
-
endif
else
diff --git a/src/Makefile.cfg b/src/Makefile.cfg
index 68cced81..20219168 100644
--- a/src/Makefile.cfg
+++ b/src/Makefile.cfg
@@ -190,9 +190,6 @@ endif
ifdef GCC46
WFLAGS+=-Wno-suggest-attribute=noreturn
endif
-ifdef GCC71
-WFLAGS+=-Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3
-endif
ifndef MINGW
ifdef GCC45
@@ -222,6 +219,18 @@ endif
ifdef GCC61
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
endif
+ifdef GCC71
+ WFLAGS+=-Wno-error=implicit-fallthrough
+ WFLAGS+=-Wno-implicit-fallthrough
+endif
+ifdef GCC80
+ WFLAGS+=-Wno-error=format-overflow
+ WFLAGS+=-Wno-error=stringop-truncation
+ WFLAGS+=-Wno-error=stringop-overflow
+ WFLAGS+=-Wno-format-overflow
+ WFLAGS+=-Wno-stringop-truncation
+ WFLAGS+=-Wno-stringop-overflow
+endif
#indicate platform and what interface use with
@@ -235,6 +244,7 @@ ifndef LINUX
ifndef FREEBSD
ifndef CYGWIN32
ifndef MINGW
+ifndef MINGW64
ifndef SDL
ifndef NDS
ifndef DUMMY
@@ -252,6 +262,7 @@ endif
endif
endif
endif
+endif
#determine the interface directory (where you put all i_*.c)
i_cdmus_o=$(OBJDIR)/i_cdmus.o
diff --git a/src/am_map.c b/src/am_map.c
index b28cecf1..6b97dd28 100644
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/am_map.h b/src/am_map.h
index df145848..4e8c782a 100644
--- a/src/am_map.h
+++ b/src/am_map.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/asm_defs.inc b/src/asm_defs.inc
index db59d2c6..e494a676 100644
--- a/src/asm_defs.inc
+++ b/src/asm_defs.inc
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2014 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/b_bot.c b/src/b_bot.c
index ca48a98b..b84db288 100644
--- a/src/b_bot.c
+++ b/src/b_bot.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2007-2016 by John "JTE" Muniz.
-// Copyright (C) 2011-2016 by Sonic Team Junior.
+// Copyright (C) 2011-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/b_bot.h b/src/b_bot.h
index 259405f3..20b2803b 100644
--- a/src/b_bot.h
+++ b/src/b_bot.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2007-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/blua/Makefile.cfg b/src/blua/Makefile.cfg
index e3fb3df4..b1131eac 100644
--- a/src/blua/Makefile.cfg
+++ b/src/blua/Makefile.cfg
@@ -39,6 +39,7 @@ OBJS:=$(OBJS) \
$(OBJDIR)/lvm.o \
$(OBJDIR)/lua_script.o \
$(OBJDIR)/lua_baselib.o \
+ $(OBJDIR)/lua_blockmaplib.o \
$(OBJDIR)/lua_mathlib.o \
$(OBJDIR)/lua_hooklib.o \
$(OBJDIR)/lua_consolelib.o \
diff --git a/src/byteptr.h b/src/byteptr.h
index 364e6520..aa09d6be 100644
--- a/src/byteptr.h
+++ b/src/byteptr.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/command.c b/src/command.c
index 53508667..4f824aa3 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/command.h b/src/command.h
index dbac8bd8..13c0c406 100644
--- a/src/command.h
+++ b/src/command.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/config.h.in b/src/config.h.in
index ae401f8b..885d21d6 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -52,7 +52,7 @@
#define ASSET_HASH_CHARS_KART "784ee9177b01c8cb26edff43eaf93d87"
#define ASSET_HASH_MAPS_KART "84018d9b35d181ca9fcc2be5a9d43a45"
#ifdef USE_PATCH_KART
-#define ASSET_HASH_PATCH_KART "bb055c2cbbe1547f44606d394df1e068"
+#define ASSET_HASH_PATCH_KART "843a13a73935dc4df721427a8948fb89"
#endif
#endif
diff --git a/src/console.c b/src/console.c
index 54c70841..d98fe45b 100644
--- a/src/console.c
+++ b/src/console.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -102,8 +102,6 @@ static void CON_RecalcSize(void);
static void CONS_hudlines_Change(void);
static void CONS_backcolor_Change(void);
-static void CON_DrawBackpic(patch_t *pic, INT32 startx, INT32 destwidth);
-//static void CON_DrawBackpic2(pic_t *pic, INT32 startx, INT32 destwidth);
//======================================================================
// CONSOLE VARS AND COMMANDS
@@ -1302,24 +1300,15 @@ void CONS_Printf(const char *fmt, ...)
if (con_startup)
{
#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL))
- static lumpnum_t con_backpic_lumpnum = UINT32_MAX;
- patch_t *con_backpic;
+ patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_CACHE);
- if (con_backpic_lumpnum == UINT32_MAX)
- con_backpic_lumpnum = W_GetNumForName("KARTKREW");
+ // Jimita: CON_DrawBackpic just called V_DrawScaledPatch
+ V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, con_backpic, NULL);
- // We load the raw lump, even in hardware mode
- con_backpic = (patch_t*)W_CacheLumpNum(con_backpic_lumpnum, PU_CACHE);
-
- // show startup screen and message using only 'software' graphics
- // (rendermode may be hardware accelerated, but the video mode is not set yet)
- CON_DrawBackpic(con_backpic, 0, vid.width); // put console background
- I_LoadingScreen(txt);
-
- Z_Unlock(con_backpic);
+ W_UnlockCachedPatch(con_backpic);
+ I_LoadingScreen(txt); // Win32/OS2 only
#else
- // here we display the console background and console text
- // (no hardware accelerated support for these versions)
+ // here we display the console text
CON_Drawer();
I_FinishUpdate(); // page flip or blit buffer
#endif
@@ -1546,64 +1535,6 @@ static void CON_DrawHudlines(void)
con_clearlines = y; // this is handled by HU_Erase();
}
-// Scale a pic_t at 'startx' pos, to 'destwidth' columns.
-// startx, destwidth is resolution dependent
-// Used to draw console borders, console background.
-// The pic must be sized BASEVIDHEIGHT height.
-static void CON_DrawBackpic(patch_t *pic, INT32 startx, INT32 destwidth)
-{
- (void)startx;
- (void)destwidth;
- V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, pic, NULL);
-}
-
-#if 0
-static inline void CON_DrawBackpic2(pic_t *pic, INT32 startx, INT32 destwidth)
-{
- INT32 x, y;
- INT32 v;
- UINT8 *src, *dest;
- const UINT8 *deststop;
- INT32 frac, fracstep;
-
- dest = screens[0]+startx;
- deststop = screens[0] + vid.rowbytes * vid.height;
-
- for (y = 0; y < con_curlines; y++, dest += vid.width)
- {
- // scale the picture to the resolution
- v = SHORT(pic->height) - ((con_curlines - y) * (BASEVIDHEIGHT-1) / vid.height) - 1;
-
- src = pic->data + v*SHORT(pic->width);
-
- // in case of the console backpic, simplify
- if (SHORT(pic->width) == destwidth)
- M_Memcpy(dest, src, destwidth);
- else
- {
- // scale pic to screen width
- frac = 0;
- fracstep = (SHORT(pic->width)<<16)/destwidth;
- for (x = 0; x < destwidth; x += 4)
- {
- if (dest+x > deststop) break;
- dest[x] = src[frac>>FRACBITS];
- frac += fracstep;
- if (dest+x+1 > deststop) break;
- dest[x+1] = src[frac>>FRACBITS];
- frac += fracstep;
- if (dest+x+2 > deststop) break;
- dest[x+2] = src[frac>>FRACBITS];
- frac += fracstep;
- if (dest+x+3 > deststop) break;
- dest[x+3] = src[frac>>FRACBITS];
- frac += fracstep;
- }
- }
- }
-}
-#endif
-
// draw the console background, text, and prompt if enough place
//
static void CON_DrawConsole(void)
@@ -1626,18 +1557,10 @@ static void CON_DrawConsole(void)
// draw console background
if (cons_backpic.value || con_forcepic)
{
- static lumpnum_t con_backpic_lumpnum = UINT32_MAX;
- patch_t *con_backpic;
+ patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_CACHE);
- if (con_backpic_lumpnum == UINT32_MAX)
- con_backpic_lumpnum = W_GetNumForName("KARTKREW");
-
- con_backpic = (patch_t*)W_CachePatchNum(con_backpic_lumpnum, PU_CACHE);
-
- if (rendermode != render_soft)
- V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, con_backpic, NULL);
- else if (rendermode != render_none)
- CON_DrawBackpic(con_backpic, 0, vid.width); // picture as background
+ // Jimita: CON_DrawBackpic just called V_DrawScaledPatch
+ V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, con_backpic, NULL);
W_UnlockCachedPatch(con_backpic);
}
diff --git a/src/console.h b/src/console.h
index e4f01c8e..98df6ee2 100644
--- a/src/console.h
+++ b/src/console.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index d3503971..76c319b9 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -84,7 +84,7 @@ UINT8 playernode[MAXPLAYERS];
// Minimum timeout for sending the savegame
// The actual timeout will be longer depending on the savegame length
-tic_t jointimeout = (10*TICRATE);
+tic_t jointimeout = (3*TICRATE);
static boolean sendingsavegame[MAXNETNODES]; // Are we sending the savegame?
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
@@ -163,7 +163,7 @@ ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
-static consvar_t cv_showjoinaddress = {"showjoinaddress", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_showjoinaddress = {"showjoinaddress", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}};
consvar_t cv_playbackspeed = {"playbackspeed", "1", 0, playbackspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -619,7 +619,6 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->starposty = SHORT(players[i].starposty);
rsp->starpostz = SHORT(players[i].starpostz);
rsp->starpostnum = LONG(players[i].starpostnum);
- rsp->starpostcount = LONG(players[i].starpostcount);
rsp->starposttime = (tic_t)LONG(players[i].starposttime);
rsp->starpostangle = (angle_t)LONG(players[i].starpostangle);
@@ -755,7 +754,6 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].starposty = SHORT(rsp->starposty);
players[i].starpostz = SHORT(rsp->starpostz);
players[i].starpostnum = LONG(rsp->starpostnum);
- players[i].starpostcount = LONG(rsp->starpostcount);
players[i].starposttime = (tic_t)LONG(rsp->starposttime);
players[i].starpostangle = (angle_t)LONG(rsp->starpostangle);
@@ -1304,7 +1302,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime);
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
- netbuffer->u.serverinfo.maxplayer = (UINT8)cv_maxplayers.value;
+ netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
netbuffer->u.serverinfo.gametype = (UINT8)(G_BattleGametype() ? VANILLA_GT_MATCH : VANILLA_GT_RACE); // SRB2Kart: Vanilla's gametype constants for MS support
netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame;
netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled();
@@ -1739,6 +1737,8 @@ static void SendAskInfo(INT32 node, boolean viams)
serverelem_t serverlist[MAXSERVERLIST];
UINT32 serverlistcount = 0;
+#define FORCECLOSE 0x8000
+
static void SL_ClearServerList(INT32 connectedserver)
{
UINT32 i;
@@ -1746,7 +1746,7 @@ static void SL_ClearServerList(INT32 connectedserver)
for (i = 0; i < serverlistcount; i++)
if (connectedserver != serverlist[i].node)
{
- Net_CloseConnection(serverlist[i].node);
+ Net_CloseConnection(serverlist[i].node|FORCECLOSE);
serverlist[i].node = 0;
}
serverlistcount = 0;
@@ -1828,12 +1828,25 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
// Make sure MS version matches our own, to
// thwart nefarious servers who lie to the MS.
- if(strcmp(version, server_list[i].version) == 0)
+ if (strcmp(version, server_list[i].version) == 0)
{
INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
if (node == -1)
break; // no more node free
SendAskInfo(node, true);
+ // Force close the connection so that servers can't eat
+ // up nodes forever if we never get a reply back from them
+ // (usually when they've not forwarded their ports).
+ //
+ // Don't worry, we'll get in contact with the working
+ // servers again when they send SERVERINFO to us later!
+ //
+ // (Note: as a side effect this probably means every
+ // server in the list will probably be using the same node (e.g. node 1),
+ // not that it matters which nodes they use when
+ // the connections are closed afterwards anyway)
+ // -- Monster Iestyn 12/11/18
+ Net_CloseConnection(node|FORCECLOSE);
}
}
}
@@ -3010,7 +3023,7 @@ consvar_t cv_joinnextround = {"joinnextround", "Off", CV_NETVAR, CV_OnOff, NULL,
static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {MAXPLAYERS, "MAX"}, {0, NULL}};
consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t resynchattempts_cons_t[] = {{0, "MIN"}, {20, "MAX"}, {0, NULL}};
-consvar_t cv_resynchattempts = {"resynchattempts", "10", 0, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
+consvar_t cv_resynchattempts = {"resynchattempts", "5", CV_SAVE, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
consvar_t cv_blamecfail = {"blamecfail", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
// max file size to send to a player (in kilobytes)
@@ -3343,6 +3356,7 @@ static boolean SV_AddWaitingPlayers(void)
UINT8 newplayernum = 0;
// What is the reason for this? Why can't newplayernum always be 0?
+ // Sal: Because the dedicated player is stupidly forced into players[0].....
if (dedicated)
newplayernum = 1;
@@ -3529,6 +3543,11 @@ static size_t TotalTextCmdPerTic(tic_t tic)
*/
static void HandleConnect(SINT8 node)
{
+ // Sal: Dedicated mode is INCREDIBLY hacked together.
+ // If a server filled out, then it'd overwrite the host and turn everyone into weird husks.....
+ // It's too much effort to legimately fix right now. Just prevent it from reaching that state.
+ UINT8 maxplayers = min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value);
+
if (bannednode && bannednode[node])
SV_SendRefuse(node, M_GetText("You have been banned\nfrom the server"));
else if (netbuffer->u.clientcfg.version != VERSION
@@ -3536,10 +3555,10 @@ static void HandleConnect(SINT8 node)
SV_SendRefuse(node, va(M_GetText("Different SRB2 versions cannot\nplay a netgame!\n(server version %d.%d.%d)"), VERSION/100, VERSION%100, SUBVERSION));
else if (!cv_allownewplayer.value && node)
SV_SendRefuse(node, M_GetText("The server is not accepting\njoins for the moment"));
- else if (D_NumPlayers() >= cv_maxplayers.value)
- SV_SendRefuse(node, va(M_GetText("Maximum players reached: %d"), cv_maxplayers.value));
- else if (netgame && D_NumPlayers() + netbuffer->u.clientcfg.localplayers > cv_maxplayers.value)
- SV_SendRefuse(node, va(M_GetText("Number of local players\nwould exceed maximum: %d"), cv_maxplayers.value));
+ else if (D_NumPlayers() >= maxplayers)
+ SV_SendRefuse(node, va(M_GetText("Maximum players reached: %d"), maxplayers));
+ else if (netgame && D_NumPlayers() + netbuffer->u.clientcfg.localplayers > maxplayers)
+ SV_SendRefuse(node, va(M_GetText("Number of local players\nwould exceed maximum: %d"), maxplayers));
else if (netgame && netbuffer->u.clientcfg.localplayers > 4) // Hacked client?
SV_SendRefuse(node, M_GetText("Too many players from\nthis node."));
else if (netgame && !netbuffer->u.clientcfg.localplayers) // Stealth join?
@@ -4557,31 +4576,30 @@ static void CL_SendClientCmd(void)
}
else if (gamestate != GS_NULL)
{
+ packetsize = sizeof (clientcmd_pak);
G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds, 1);
netbuffer->u.clientpak.consistancy = SHORT(consistancy[gametic%BACKUPTICS]);
if (splitscreen || botingame) // Send a special packet with 2 cmd for splitscreen
{
netbuffer->packettype = (mis ? PT_CLIENT2MIS : PT_CLIENT2CMD);
+ packetsize = sizeof (client2cmd_pak);
G_MoveTiccmd(&netbuffer->u.client2pak.cmd2, &localcmds2, 1);
+
if (splitscreen > 1)
{
netbuffer->packettype = (mis ? PT_CLIENT3MIS : PT_CLIENT3CMD);
+ packetsize = sizeof (client3cmd_pak);
G_MoveTiccmd(&netbuffer->u.client3pak.cmd3, &localcmds3, 1);
+
if (splitscreen > 2)
{
netbuffer->packettype = (mis ? PT_CLIENT4MIS : PT_CLIENT4CMD);
- G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds4, 1);
packetsize = sizeof (client4cmd_pak);
+ G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds4, 1);
}
- else
- packetsize = sizeof (client3cmd_pak);
}
- else
- packetsize = sizeof (client2cmd_pak);
}
- else
- packetsize = sizeof (clientcmd_pak);
HSendPacket(servernode, false, 0, packetsize);
}
diff --git a/src/d_clisrv.h b/src/d_clisrv.h
index a3fcfde0..4207325e 100644
--- a/src/d_clisrv.h
+++ b/src/d_clisrv.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -26,7 +26,11 @@
// SOME numpty changed all the gametype constants and it fell out of sync with vanilla and now we have to pretend to be vanilla when talking to the master server...
#define VANILLA_GT_RACE 2
+#if VERSION < 210
+#define VANILLA_GT_MATCH 1
+#else
#define VANILLA_GT_MATCH 3
+#endif
// Networking and tick handling related.
#define BACKUPTICS 32
@@ -251,7 +255,6 @@ typedef struct
INT16 starposty;
INT16 starpostz;
INT32 starpostnum;
- INT32 starpostcount;
tic_t starposttime;
angle_t starpostangle;
@@ -472,6 +475,7 @@ extern INT32 mapchangepending;
// Points inside doomcom
extern doomdata_t *netbuffer;
+extern consvar_t cv_showjoinaddress;
extern consvar_t cv_playbackspeed;
#define BASEPACKETSIZE ((size_t)&(((doomdata_t *)0)->u))
diff --git a/src/d_event.h b/src/d_event.h
index 09ff167b..8cbf8560 100644
--- a/src/d_event.h
+++ b/src/d_event.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_main.c b/src/d_main.c
index 01839014..6d130d76 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -662,7 +662,6 @@ void D_SRB2Loop(void)
"===========================================================================\n"
" We hope you enjoy this game as\n"
" much as we did making it!\n"
- " ...wait. =P\n"
"===========================================================================\n");
// hack to start on a nice clear console screen.
@@ -917,7 +916,7 @@ static void IdentifyVersion(void)
else if (srb2wad1 != NULL && FIL_ReadFileOK(srb2wad1))
D_AddFile(srb2wad1);
else
- I_Error("SRB2.SRB/SRB2.WAD not found! Expected in %s, ss files: %s and %s\n", srb2waddir, srb2wad1, srb2wad2);
+ I_Error("SRB2.SRB/SRB2.WAD not found! Expected in %s, ss files: %s or %s\n", srb2waddir, srb2wad1, srb2wad2);
if (srb2wad1)
free(srb2wad1);
@@ -1029,6 +1028,20 @@ void D_SRB2Main(void)
INT32 pstartmap = 1;
boolean autostart = false;
+ // Print GPL notice for our console users (Linux)
+ CONS_Printf(
+ "\n\nSonic Robo Blast 2 Kart\n"
+ "Copyright (C) 1998-2018 by Kart Krew & STJr\n\n"
+ "This program comes with ABSOLUTELY NO WARRANTY.\n\n"
+ "This is free software, and you are welcome to redistribute it\n"
+ "and/or modify it under the terms of the GNU General Public License\n"
+ "as published by the Free Software Foundation; either version 2 of\n"
+ "the License, or (at your option) any later version.\n"
+ "See the 'LICENSE.txt' file for details.\n\n"
+ "Sonic the Hedgehog and related characters are trademarks of SEGA.\n"
+ "We do not claim ownership of SEGA's intellectual property used\n"
+ "in this program.\n\n");
+
// keep error messages until the final flush(stderr)
#if !defined (PC_DOS) && !defined (_WIN32_WCE) && !defined(NOTERMIOS)
if (setvbuf(stderr, NULL, _IOFBF, 1000))
diff --git a/src/d_main.h b/src/d_main.h
index 4c9c99ea..d67a5bb4 100644
--- a/src/d_main.h
+++ b/src/d_main.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_net.c b/src/d_net.c
index eca301f0..eae921fa 100644
--- a/src/d_net.c
+++ b/src/d_net.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_net.h b/src/d_net.h
index f6544ab2..0174ba89 100644
--- a/src/d_net.h
+++ b/src/d_net.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index 2dc94a45..f2979838 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -424,11 +424,12 @@ consvar_t cv_killingdead = {"killingdead", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_On
consvar_t cv_netstat = {"netstat", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // show bandwidth statistics
static CV_PossibleValue_t nettimeout_cons_t[] = {{TICRATE/7, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
-consvar_t cv_nettimeout = {"nettimeout", "350", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
-static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
-consvar_t cv_jointimeout = {"jointimeout", "350", CV_CALL|CV_SAVE, jointimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_nettimeout = {"nettimeout", "105", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
+//static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
+consvar_t cv_jointimeout = {"jointimeout", "105", CV_CALL|CV_SAVE, nettimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
#ifdef NEWPING
-consvar_t cv_maxping = {"maxping", "0", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
+static CV_PossibleValue_t maxping_cons_t[] = {{0, "MIN"}, {1000, "MAX"}, {0, NULL}};
+consvar_t cv_maxping = {"maxping", "800", CV_SAVE, maxping_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
// Intermission time Tails 04-19-2002
static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}};
@@ -521,9 +522,9 @@ void D_RegisterServerCommands(void)
COM_AddCommand("password", Command_Changepassword_f);
RegisterNetXCmd(XD_LOGIN, Got_Login);
COM_AddCommand("login", Command_Login_f); // useful in dedicated to kick off remote admin
- COM_AddCommand("giveadmin", Command_Verify_f);
+ COM_AddCommand("promote", Command_Verify_f);
RegisterNetXCmd(XD_VERIFIED, Got_Verification);
- COM_AddCommand("removeadmin", Command_RemoveAdmin_f);
+ COM_AddCommand("demote", Command_RemoveAdmin_f);
RegisterNetXCmd(XD_DEMOTED, Got_Removal);
COM_AddCommand("motd", Command_MotD_f);
@@ -793,6 +794,8 @@ void D_RegisterClientCommands(void)
//CV_RegisterVar(&cv_crosshair4);
//CV_RegisterVar(&cv_alwaysfreelook);
//CV_RegisterVar(&cv_alwaysfreelook2);
+ //CV_RegisterVar(&cv_chasefreelook);
+ //CV_RegisterVar(&cv_chasefreelook2);
// g_input.c
CV_RegisterVar(&cv_turnaxis);
@@ -1206,7 +1209,7 @@ static void ForceAllSkins(INT32 forcedskin)
SetPlayerSkinByNum(i, forcedskin);
- // If it's me (or my brother), set appropriate skin value in cv_skin/cv_skin2
+ // If it's me (or my brother (or my sister (or my trusty pet dog))), set appropriate skin value in cv_skin
if (!dedicated) // But don't do this for dedicated servers, of course.
{
if (i == consoleplayer)
@@ -2076,6 +2079,7 @@ void D_SetupVote(void)
UINT8 *p = buf;
INT32 i;
UINT8 secondgt = G_SometimesGetDifferentGametype();
+ INT16 votebuffer[3] = {-1,-1,-1};
if (cv_kartencore.value && G_RaceGametype())
WRITEUINT8(p, (gametype|0x80));
@@ -2086,12 +2090,16 @@ void D_SetupVote(void)
for (i = 0; i < 5; i++)
{
+ UINT16 m;
if (i == 2) // sometimes a different gametype
- WRITEUINT16(p, G_RandMap(G_TOLFlag(secondgt), prevmap, false, false, 0, true));
+ m = G_RandMap(G_TOLFlag(secondgt), prevmap, false, 0, true, votebuffer);
else if (i >= 3) // unknown-random and force-unknown MAP HELL
- WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, true, false, (i-2), (i < 4)));
+ m = G_RandMap(G_TOLFlag(gametype), prevmap, false, (i-2), (i < 4), votebuffer);
else
- WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, false, false, 0, true));
+ m = G_RandMap(G_TOLFlag(gametype), prevmap, false, 0, true, votebuffer);
+ if (i < 3)
+ votebuffer[i] = m;
+ WRITEUINT16(p, m);
}
SendNetXCmd(XD_SETUPVOTE, buf, p - buf);
@@ -2302,6 +2310,9 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
INT32 resetplayer = 1, lastgametype;
UINT8 skipprecutscene, FLS;
boolean pencoremode;
+/*#ifdef HAVE_BLUA
+ INT16 mapnumber;
+#endif*/
forceresetplayers = deferencoremode = false;
@@ -2352,6 +2363,10 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
mapname, resetplayer, lastgametype, gametype, chmappending));
CON_LogMessage(M_GetText("Speeding off to level...\n"));
}
+
+ CON_ToggleOff();
+ CON_ClearHUD();
+
if (demoplayback && !timingdemo)
precache = false;
@@ -2364,14 +2379,14 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
if (modeattacking) // i remember moving this here in internal fixed a heisenbug so
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
-#ifdef HAVE_BLUA
- LUAh_MapChange();
-#endif
+/*#ifdef HAVE_BLUA
+ mapnumber = M_MapNumber(mapname[3], mapname[4]);
+ LUAh_MapChange(mapnumber);
+#endif*/
G_InitNew(pencoremode, mapname, resetplayer, skipprecutscene);
if (demoplayback && !timingdemo)
precache = true;
- CON_ToggleOff();
if (timingdemo)
G_DoneLevelLoad();
@@ -3487,7 +3502,7 @@ static void Got_Login(UINT8 **cp, INT32 playernum)
if (!memcmp(sentmd5, finalmd5, 16))
{
CONS_Printf(M_GetText("%s passed authentication.\n"), player_names[playernum]);
- COM_BufInsertText(va("giveadmin %d\n", playernum)); // do this immediately
+ COM_BufInsertText(va("promote %d\n", playernum)); // do this immediately
}
else
CONS_Printf(M_GetText("Password from %s failed.\n"), player_names[playernum]);
@@ -3561,7 +3576,7 @@ static void Command_Verify_f(void)
if (COM_Argc() != 2)
{
- CONS_Printf(M_GetText("giveadmin : give admin privileges to a node\n"));
+ CONS_Printf(M_GetText("promote : give admin privileges to a node\n"));
return;
}
@@ -3617,7 +3632,7 @@ static void Command_RemoveAdmin_f(void)
if (COM_Argc() != 2)
{
- CONS_Printf(M_GetText("removeadmin : remove admin privileges from a node\n"));
+ CONS_Printf(M_GetText("demote : remove admin privileges from a node\n"));
return;
}
@@ -3862,7 +3877,7 @@ static void Command_Addfile(void)
// Add file on your client directly if it is trivial, or you aren't in a netgame.
if (!(netgame || multiplayer) || musiconly)
{
- P_AddWadFile(fn, NULL);
+ P_AddWadFile(fn);
return;
}
@@ -4072,7 +4087,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
ncs = findfile(filename,md5sum,true);
- if (ncs != FS_FOUND || !P_AddWadFile(filename, NULL))
+ if (ncs != FS_FOUND || !P_AddWadFile(filename))
{
Command_ExitGame_f();
if (ncs == FS_FOUND)
@@ -4225,9 +4240,17 @@ static void PointLimit_OnChange(void)
static void NumLaps_OnChange(void)
{
+ if (!G_RaceGametype() || (modeattacking || demoplayback))
+ return;
+
+ if (server && Playing()
+ && (netgame || multiplayer)
+ && (mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
+ && (cv_numlaps.value > mapheaderinfo[gamemap - 1]->numlaps))
+ CV_StealthSetValue(&cv_numlaps, mapheaderinfo[gamemap - 1]->numlaps);
+
// Just don't be verbose
- if (G_RaceGametype() && !(modeattacking || demoplayback))
- CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value);
+ CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value);
}
static void NetTimeout_OnChange(void)
diff --git a/src/d_netcmd.h b/src/d_netcmd.h
index 67793f0f..7927aea0 100644
--- a/src/d_netcmd.h
+++ b/src/d_netcmd.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_netfil.c b/src/d_netfil.c
index 9889ad12..c7cfdbc1 100644
--- a/src/d_netfil.c
+++ b/src/d_netfil.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -94,7 +94,7 @@ static filetran_t transfer[MAXNETNODES];
// Receiver structure
INT32 fileneedednum; // Number of files needed to join the server
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
-char downloaddir[256] = "DOWNLOAD";
+char downloaddir[512] = "DOWNLOAD";
#ifdef CLIENT_LOADINGSCREEN
// for cl loading screen
@@ -425,7 +425,7 @@ void CL_LoadServerFiles(void)
continue; // Already loaded
else if (fileneeded[i].status == FS_FOUND)
{
- P_AddWadFile(fileneeded[i].filename, NULL);
+ P_AddWadFile(fileneeded[i].filename);
G_SetGameModified(true);
fileneeded[i].status = FS_OPEN;
}
diff --git a/src/d_netfil.h b/src/d_netfil.h
index 6fdd0a8a..3d7c2ed5 100644
--- a/src/d_netfil.h
+++ b/src/d_netfil.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -47,7 +47,7 @@ typedef struct
extern INT32 fileneedednum;
extern fileneeded_t fileneeded[MAX_WADFILES];
-extern char downloaddir[256];
+extern char downloaddir[512];
#ifdef CLIENT_LOADINGSCREEN
extern INT32 lastfilenum;
diff --git a/src/d_player.h b/src/d_player.h
index a5907646..1b1d4d0a 100644
--- a/src/d_player.h
+++ b/src/d_player.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -348,6 +348,10 @@ typedef enum
k_wanted, // Timer for determining WANTED status, lowers when hitting people, prevents the game turning into Camp Lazlo
k_yougotem, // "You Got Em" gfx when hitting someone as a karma player via a method that gets you back in the game instantly
+ // v1.0.2 vars
+ k_itemblink, // Item flashing after roulette, prevents Hyudoro stealing AND serves as a mashing indicator
+ k_itemblinkmode, // Type of flashing: 0 = white (normal), 1 = red (mashing), 2 = rainbow (enhanced items)
+
NUMKARTSTUFF
} kartstufftype_t;
//}
@@ -511,7 +515,6 @@ typedef struct player_s
INT16 starposty;
INT16 starpostz;
INT32 starpostnum; // The number of the last starpost you hit
- INT32 starpostcount; // SRB2kart: how many did you hit?
tic_t starposttime; // Your time when you hit the starpost
angle_t starpostangle; // Angle that the starpost is facing - you respawn facing this way
diff --git a/src/d_think.h b/src/d_think.h
index 2831b9f2..b907c17f 100644
--- a/src/d_think.h
+++ b/src/d_think.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h
index afb052ce..7df2d412 100644
--- a/src/d_ticcmd.h
+++ b/src/d_ticcmd.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/dehacked.c b/src/dehacked.c
index c943dbfe..8cb70412 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -38,6 +38,7 @@
#ifdef HAVE_BLUA
#include "v_video.h" // video flags (for lua)
+#include "r_draw.h" // translation colormap consts (for lua)
#endif
#ifdef HWRENDER
@@ -3133,7 +3134,7 @@ static void readmaincfg(MYFILE *f)
strncpy(timeattackfolder, gamedatafilename, filenamelen);
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
- strncpy(savegamename, timeattackfolder, filenamelen);
+ strncpy(savegamename, timeattackfolder, strlen(timeattackfolder));
strlcat(savegamename, "%u.ssg", sizeof(savegamename));
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP);
@@ -7092,6 +7093,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_LIZARDMAN",
"S_LIONMAN",
+ "S_KARMAFIREWORK1",
+ "S_KARMAFIREWORK2",
+ "S_KARMAFIREWORK3",
+ "S_KARMAFIREWORK4",
+ "S_KARMAFIREWORKTRAIL",
+
#ifdef SEENAMES
"S_NAMECHECK",
#endif
@@ -7877,6 +7884,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_LIZARDMAN",
"MT_LIONMAN",
+ "MT_KARMAFIREWORK",
+
#ifdef SEENAMES
"MT_NAMECHECK",
#endif
@@ -8270,6 +8279,9 @@ static const char *const KARTSTUFF_LIST[] = {
"COMEBACKMODE",
"WANTED",
"YOUGOTEM",
+
+ "ITEMBLINK",
+ "ITEMBLINKMODE"
};
static const char *const HUDITEMS_LIST[] = {
@@ -8819,6 +8831,14 @@ struct {
{"KRITEM_QUADORBINAUT",KRITEM_QUADORBINAUT},
{"KRITEM_DUALJAWZ",KRITEM_DUALJAWZ},
{"NUMKARTRESULTS",NUMKARTRESULTS},
+
+ // translation colormaps
+ {"TC_DEFAULT",TC_DEFAULT},
+ {"TC_BOSS",TC_BOSS},
+ {"TC_METALSONIC",TC_METALSONIC},
+ {"TC_ALLWHITE",TC_ALLWHITE},
+ {"TC_RAINBOW",TC_RAINBOW},
+ {"TC_BLINK",TC_BLINK},
#endif
{NULL,0}
@@ -9163,7 +9183,7 @@ static fixed_t find_const(const char **rword)
free(word);
return r;
}
- else if (fastncmp("SKINCOLOR_",word,20)) {
+ else if (fastncmp("SKINCOLOR_",word,10)) {
char *p = word+10;
for (i = 0; i < MAXTRANSLATIONS; i++)
if (fastcmp(p, COLOR_ENUMS[i])) {
@@ -9595,7 +9615,7 @@ static inline int lib_getenum(lua_State *L)
if (mathlib) return luaL_error(L, "huditem '%s' could not be found.\n", word);
return 0;
}
- else if (fastncmp("SKINCOLOR_",word,20)) {
+ else if (fastncmp("SKINCOLOR_",word,10)) {
p = word+10;
for (i = 0; i < MAXTRANSLATIONS; i++)
if (fastcmp(p, COLOR_ENUMS[i])) {
@@ -9770,6 +9790,9 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"thwompsactive")) {
lua_pushboolean(L, thwompsactive);
return 1;
+ } else if (fastcmp(word,"spbplace")) {
+ lua_pushinteger(L, spbplace);
+ return 1;
}
return 0;
diff --git a/src/dehacked.h b/src/dehacked.h
index 8832216b..411cb6c1 100644
--- a/src/dehacked.h
+++ b/src/dehacked.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/djgppdos/rdb-s.h b/src/djgppdos/rdb-s.h
index 6202dacf..7a6d8be3 100644
--- a/src/djgppdos/rdb-s.h
+++ b/src/djgppdos/rdb-s.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2005 by Sonic Team Jr.
+// Copyright (C) 2005-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/doomdata.h b/src/doomdata.h
index 1b91c94d..6319238b 100644
--- a/src/doomdata.h
+++ b/src/doomdata.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/doomdef.h b/src/doomdef.h
index af56c22e..a35f3291 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -150,9 +150,9 @@ extern FILE *logstream;
// we use comprevision and compbranch instead.
#else
#define VERSION 100 // Game version
-#define SUBVERSION 1 // more precise version number
-#define VERSIONSTRING "v1.0.1"
-#define VERSIONSTRINGW L"v1.0.1"
+#define SUBVERSION 2 // more precise version number
+#define VERSIONSTRING "v1.0.2"
+#define VERSIONSTRINGW L"v1.0.2"
// Hey! If you change this, add 1 to the MODVERSION below!
// Otherwise we can't force updates!
#endif
@@ -218,7 +218,7 @@ extern FILE *logstream;
// it's only for detection of the version the player is using so the MS can alert them of an update.
// Only set it higher, not lower, obviously.
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
-#define MODVERSION 1
+#define MODVERSION 2
// =========================================================================
diff --git a/src/doomstat.h b/src/doomstat.h
index 34456b32..69e2e7cd 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -461,6 +461,7 @@ extern tic_t indirectitemcooldown;
extern tic_t mapreset;
extern UINT8 nospectategrief;
extern boolean thwompsactive;
+extern SINT8 spbplace;
extern boolean legitimateexit;
extern boolean comebackshowninfo;
@@ -530,6 +531,11 @@ extern boolean singletics;
extern consvar_t cv_timetic; // display high resolution timer
extern consvar_t cv_forceskin; // force clients to use the server's skin
extern consvar_t cv_downloading; // allow clients to downloading WADs.
+extern consvar_t cv_nettimeout; // SRB2Kart: Advanced server options menu
+extern consvar_t cv_jointimeout;
+#ifdef NEWPING
+extern consvar_t cv_maxping;
+#endif
extern ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
extern INT32 serverplayer;
extern INT32 adminplayers[MAXPLAYERS];
diff --git a/src/doomtype.h b/src/doomtype.h
index c8499df2..5d643484 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/endian.h b/src/endian.h
index 2b876e7c..d3c1cb18 100644
--- a/src/endian.h
+++ b/src/endian.h
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
-// Copyright (C) 2014-2016 by Sonic Team Junior.
+// Copyright (C) 2014-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/f_finale.c b/src/f_finale.c
index ea89b2b7..4394ee6e 100644
--- a/src/f_finale.c
+++ b/src/f_finale.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -450,10 +450,12 @@ static const char *credits[] = {
"\1Support Artists",
"Sally \"TehRealSalt\" Cochenour",
"Sherman \"CoatRack\" DesJardins",
+ "\"DrTapeworm\"",
"Jesse \"Jeck Jims\" Emerick",
"Wesley \"Charyb\" Gillebaard",
"Vivian \"toaster\" Grannell",
"James \"SeventhSentinel\" Hall",
+ "\"Lat\'\"",
"\"Tyrannosaur Chao\"",
"\"ZarroTsu\"",
"",
@@ -465,8 +467,10 @@ static const char *credits[] = {
"\"Ritz\"",
"\"Rob\"",
"\"SmithyGNC\"",
+ "\"Snu\"",
"\"Spherallic\"",
"\"VAdaPEGA\"",
+ "\"Virt\"",
"",
"\1Sound Design",
"James \"SeventhSentinel\" Hall",
@@ -581,7 +585,7 @@ static struct {
// This Tyler52 gag is troublesome
// Alignment should be ((spaces+1 * 100) + (headers+1 * 38) + (lines * 15))
// Current max image spacing: (200*17)
- {112, (15*100)+(17*38)+(97*15), "TYLER52", SKINCOLOR_NONE},
+ {112, (15*100)+(17*38)+(101*15), "TYLER52", SKINCOLOR_NONE},
{0, 0, NULL, SKINCOLOR_NONE}
};
@@ -643,6 +647,9 @@ void F_CreditDrawer(void)
V_DrawFixedPatch(credits_pics[i].x<angleturn = (INT16)(cmd->angleturn - angleturn[tspeed]);
- cmd->driftturn = (INT16)(cmd->driftturn - angleturn[tspeed]);
+ cmd->angleturn = (INT16)(cmd->angleturn - (angleturn[tspeed] * realtics));
+ cmd->driftturn = (INT16)(cmd->driftturn - (angleturn[tspeed] * realtics));
}
else if (turnleft && !(turnright))
{
- cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
- cmd->driftturn = (INT16)(cmd->driftturn + angleturn[tspeed]);
+ cmd->angleturn = (INT16)(cmd->angleturn + (angleturn[tspeed] * realtics));
+ cmd->driftturn = (INT16)(cmd->driftturn + (angleturn[tspeed] * realtics));
}
if (analogjoystickmove && axis != 0)
{
// JOYAXISRANGE should be 1023 (divide by 1024)
- cmd->angleturn = (INT16)(cmd->angleturn - ((axis * angleturn[1]) >> 10)); // ANALOG!
- cmd->driftturn = (INT16)(cmd->driftturn - ((axis * angleturn[1]) >> 10));
+ cmd->angleturn = (INT16)(cmd->angleturn - (((axis * angleturn[1]) >> 10) * realtics)); // ANALOG!
+ cmd->driftturn = (INT16)(cmd->driftturn - (((axis * angleturn[1]) >> 10) * realtics));
}
// Specator mouse turning
if (player->spectator)
{
- cmd->angleturn = (INT16)(cmd->angleturn - (mousex*(encoremode ? -1 : 1)*8));
- cmd->driftturn = (INT16)(cmd->driftturn - (mousex*(encoremode ? -1 : 1)*8));
+ cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8) * realtics));
+ cmd->driftturn = (INT16)(cmd->driftturn - ((mousex*(encoremode ? -1 : 1)*8) * realtics));
}
// Speed bump strafing
@@ -1380,8 +1383,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
{
+ axis = JoyAxis(AXISMOVE, ssplayer);
if (InputDown(gc_accelerate, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_ACCELERATE;
+ axis = JoyAxis(AXISBRAKE, ssplayer);
if (InputDown(gc_brake, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_BRAKE;
axis = JoyAxis(AXISAIM, ssplayer);
@@ -1536,15 +1541,15 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
//{ SRB2kart - Drift support
// Not grouped with the rest of turn stuff because it needs to know what buttons you're pressing for rubber-burn turn
// limit turning to angleturn[1] to stop mouselook letting you look too fast
- if (cmd->angleturn > angleturn[1])
- cmd->angleturn = angleturn[1];
- else if (cmd->angleturn < -angleturn[1])
- cmd->angleturn = -angleturn[1];
+ if (cmd->angleturn > (angleturn[1] * realtics))
+ cmd->angleturn = (angleturn[1] * realtics);
+ else if (cmd->angleturn < (-angleturn[1] * realtics))
+ cmd->angleturn = (-angleturn[1] * realtics);
- if (cmd->driftturn > angleturn[1])
- cmd->driftturn = angleturn[1];
- else if (cmd->driftturn < -angleturn[1])
- cmd->driftturn = -angleturn[1];
+ if (cmd->driftturn > (angleturn[1] * realtics))
+ cmd->driftturn = (angleturn[1] * realtics);
+ else if (cmd->driftturn < (-angleturn[1] * realtics))
+ cmd->driftturn = (-angleturn[1] * realtics);
if (player->mo)
cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn);
@@ -1552,6 +1557,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// SRB2kart - no additional angle if not moving
if (((player->mo && player->speed > 0) // Moving
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
+ || (player->kartstuff[k_respawn]) // Respawning
|| (player->spectator || objectplacing)) // Not a physical player
&& !(player->kartstuff[k_spinouttimer] && player->kartstuff[k_sneakertimer])) // Spinning and boosting cancels out turning
lang += (cmd->angleturn<<16);
@@ -1950,7 +1956,8 @@ boolean G_Responder(event_t *ev)
{
case ev_keydown:
if (ev->data1 == gamecontrol[gc_pause][0]
- || ev->data1 == gamecontrol[gc_pause][1])
+ || ev->data1 == gamecontrol[gc_pause][1]
+ || ev->data1 == KEY_PAUSE)
{
if (!pausedelay)
{
@@ -2264,7 +2271,6 @@ static inline void G_PlayerFinishLevel(INT32 player)
p->starposty = 0;
p->starpostz = 0;
p->starpostnum = 0;
- p->starpostcount = 0;
// SRB2kart: Increment the "matches played" counter.
if (player == consoleplayer)
@@ -2316,7 +2322,6 @@ void G_PlayerReborn(INT32 player)
INT16 starposty;
INT16 starpostz;
INT32 starpostnum;
- INT32 starpostcount;
INT32 starpostangle;
fixed_t jumpfactor;
INT32 exiting;
@@ -2380,7 +2385,6 @@ void G_PlayerReborn(INT32 player)
starposty = players[player].starposty;
starpostz = players[player].starpostz;
starpostnum = players[player].starpostnum;
- starpostcount = players[player].starpostcount;
starpostangle = players[player].starpostangle;
jumpfactor = players[player].jumpfactor;
thokitem = players[player].thokitem;
@@ -2472,7 +2476,6 @@ void G_PlayerReborn(INT32 player)
p->starposty = starposty;
p->starpostz = starpostz;
p->starpostnum = starpostnum;
- p->starpostcount = starpostcount;
p->starpostangle = starpostangle;
p->jumpfactor = jumpfactor;
p->exiting = exiting;
@@ -2936,7 +2939,6 @@ void G_DoReborn(INT32 playernum)
player->starposty = 0;
player->starpostz = 0;
player->starpostnum = 0;
- player->starpostcount = 0;
}
if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD))
{
@@ -2986,21 +2988,19 @@ void G_DoReborn(INT32 playernum)
}
}
else
-#ifdef HAVE_BLUA
{
- LUAh_MapChange();
+#ifdef HAVE_BLUA
+ LUAh_MapChange(gamemap);
#endif
G_DoLoadLevel(true);
-#ifdef HAVE_BLUA
}
-#endif
}*/
else
{
// respawn at the start
mobj_t *oldmo = NULL;
- if (player->starpostnum) // SRB2kart
+ if (player->starpostnum || ((mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE) && player->laps)) // SRB2kart
starpost = true;
// first dissasociate the corpse
@@ -3137,8 +3137,7 @@ INT16 G_SometimesGetDifferentGametype(void)
if (randmapbuffer[NUMMAPS] > 0 && (encorepossible || cv_kartvoterulechanges.value != 3))
{
- if (cv_kartvoterulechanges.value != 1)
- randmapbuffer[NUMMAPS]--;
+ randmapbuffer[NUMMAPS]--;
if (encorepossible)
{
switch (cv_kartvoterulechanges.value)
@@ -3166,6 +3165,8 @@ INT16 G_SometimesGetDifferentGametype(void)
randmapbuffer[NUMMAPS] = 1; // every other vote (or always if !encorepossible)
break;
case 1: // sometimes
+ randmapbuffer[NUMMAPS] = 10; // ...every two cups?
+ break;
default:
// fallthrough - happens when clearing buffer, but needs a reasonable countdown if cvar is modified
case 2: // frequent
@@ -3239,7 +3240,6 @@ INT16 G_TOLFlag(INT32 pgametype)
return INT16_MAX;
}
-#ifdef FLUSHMAPBUFFEREARLY
static INT32 TOLMaps(INT16 tolflags)
{
INT32 num = 0;
@@ -3250,14 +3250,14 @@ static INT32 TOLMaps(INT16 tolflags)
{
if (!mapheaderinfo[i])
continue;
-
+ if (mapheaderinfo[i]->menuflags & LF2_HIDEINMENU) // Don't include Map Hell
+ continue;
if ((mapheaderinfo[i]->typeoflevel & tolflags) == tolflags)
num++;
}
return num;
}
-#endif
/** Select a random map with the given typeoflevel flags.
* If no map has those flags, this arbitrarily gives you map 1.
@@ -3268,16 +3268,28 @@ static INT32 TOLMaps(INT16 tolflags)
* \author Graue
*/
static INT16 *okmaps = NULL;
-INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon)
+INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer)
{
INT32 numokmaps = 0;
INT16 ix, bufx;
+ UINT16 extbufsize = 0;
+ boolean usehellmaps; // Only consider Hell maps in this pick
if (!okmaps)
okmaps = Z_Malloc(NUMMAPS * sizeof(INT16), PU_STATIC, NULL);
+ if (extbuffer != NULL)
+ {
+ bufx = 0;
+ while (extbuffer[bufx]) {
+ extbufsize++; bufx++;
+ }
+ }
+
tryagain:
+ usehellmaps = (maphell == 0 ? false : (maphell == 2 || M_RandomChance(FRACUNIT/100))); // 1% chance of Hell
+
// Find all the maps that are ok and and put them in an array.
for (ix = 0; ix < NUMMAPS; ix++)
{
@@ -3289,12 +3301,28 @@ tryagain:
if ((mapheaderinfo[ix]->typeoflevel & tolflags) != tolflags
|| ix == pprevmap
|| (!dedicated && M_MapLocked(ix+1))
- || (!maphell && (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU)) // this is bad
- || ((maphell == 2) && !(mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // gasp
+ || (usehellmaps != (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // this is bad
continue; //isokmap = false;
if (!ignorebuffer)
{
+ if (extbufsize > 0)
+ {
+ for (bufx = 0; bufx < extbufsize; bufx++)
+ {
+ if (extbuffer[bufx] == -1) // Rest of buffer SHOULD be empty
+ break;
+ if (ix == extbuffer[bufx])
+ {
+ isokmap = false;
+ break;
+ }
+ }
+
+ if (!isokmap)
+ continue;
+ }
+
for (bufx = 0; bufx < (maphell ? 3 : NUMMAPS); bufx++)
{
if (randmapbuffer[bufx] == -1) // Rest of buffer SHOULD be empty
@@ -3305,12 +3333,12 @@ tryagain:
break;
}
}
+
+ if (!isokmap)
+ continue;
}
- if (!isokmap)
- continue;
-
- if (pprevmap == -2) // title demos
+ if (pprevmap == -2) // title demo hack
{
lumpnum_t l;
if ((l = W_CheckNumForName(va("%sS01",G_BuildMapName(ix+1)))) == LUMPERROR)
@@ -3327,20 +3355,18 @@ tryagain:
if (randmapbuffer[3] == -1) // Is the buffer basically empty?
{
ignorebuffer = true; // This will probably only help in situations where there's very few maps, but it's folly not to at least try it
- goto tryagain; //return G_RandMap(tolflags, pprevmap, dontadd, true, maphell, callagainsoon);
+ goto tryagain;
}
for (bufx = 3; bufx < NUMMAPS; bufx++) // Let's clear all but the three most recent maps...
randmapbuffer[bufx] = -1;
- if (cv_kartvoterulechanges.value == 1) // sometimes
- randmapbuffer[NUMMAPS] = 0;
- goto tryagain; //return G_RandMap(tolflags, pprevmap, dontadd, ignorebuffer, maphell, callagainsoon);
+ goto tryagain;
}
if (maphell) // Any wiggle room to loosen our restrictions here?
{
maphell--;
- goto tryagain; //return G_RandMap(tolflags, pprevmap, dontadd, true, maphell-1, callagainsoon);
+ goto tryagain;
}
ix = 0; // Sorry, none match. You get MAP01.
@@ -3348,15 +3374,7 @@ tryagain:
randmapbuffer[bufx] = -1; // if we're having trouble finding a map we should probably clear it
}
else
- {
ix = okmaps[M_RandomKey(numokmaps)];
- if (!dontadd)
- {
- for (bufx = NUMMAPS-1; bufx > 0; bufx--)
- randmapbuffer[bufx] = randmapbuffer[bufx-1];
- randmapbuffer[0] = ix;
- }
- }
if (!callagainsoon)
{
@@ -3367,6 +3385,25 @@ tryagain:
return ix;
}
+void G_AddMapToBuffer(INT16 map)
+{
+ INT16 bufx, refreshnum = (TOLMaps(G_TOLFlag(gametype)) / 2) + 1;
+
+ // Add the map to the buffer.
+ for (bufx = NUMMAPS-1; bufx > 0; bufx--)
+ randmapbuffer[bufx] = randmapbuffer[bufx-1];
+ randmapbuffer[0] = map;
+
+ // We're getting pretty full, so lets flush this for future usage.
+ if (randmapbuffer[refreshnum] != -1)
+ {
+ // Clear all but the five most recent maps.
+ for (bufx = 5; bufx < NUMMAPS; bufx++) // bufx < refreshnum? Might not handle everything for gametype switches, though.
+ randmapbuffer[bufx] = -1;
+ //CONS_Printf("Random map buffer has been flushed.\n");
+ }
+}
+
//
// G_DoCompleted
//
@@ -3502,22 +3539,12 @@ static void G_DoCompleted(void)
automapactive = false;
-#ifdef FLUSHMAPBUFFEREARLY
- if (randmapbuffer[TOLMaps(G_TOLFlag(gametype))-5] != -1) // We're getting pretty full, so! -- no need for this, handled in G_RandMap
- {
- for (i = 3; i < NUMMAPS; i++) // Let's clear all but the three most recent maps...
- randmapbuffer[i] = -1;
- if (cv_kartvoterulechanges.value == 1) // sometimes
- randmapbuffer[NUMMAPS] = 0;
- }
-#endif
-
if (gametype != GT_COOP)
{
if (cv_advancemap.value == 0) // Stay on same map.
nextmap = prevmap;
else if (cv_advancemap.value == 2) // Go to random map.
- nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false, false, 0, false);
+ nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false, 0, false, NULL);
}
// We are committed to this map now.
@@ -4297,7 +4324,6 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
players[i].playerstate = PST_REBORN;
players[i].starpostangle = players[i].starpostnum = players[i].starposttime = 0;
players[i].starpostx = players[i].starposty = players[i].starpostz = 0;
- players[i].starpostcount = 0; // srb2kart
#if 0
if (netgame || multiplayer)
@@ -4372,7 +4398,12 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
if (!skipprecutscene && mapheaderinfo[gamemap-1]->precutscenenum && !modeattacking) // Start a custom cutscene.
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->precutscenenum-1, true, resetplayer);
else
+ {
+#ifdef HAVE_BLUA
+ LUAh_MapChange(gamemap);
+#endif
G_DoLoadLevel(resetplayer);
+ }
if (netgame)
{
@@ -4538,6 +4569,7 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
// SRB2kart: Copy-pasted from ticcmd building, removes that crappy demo cam
if (((players[displayplayer].mo && players[displayplayer].speed > 0) // Moving
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
+ || (players[displayplayer].kartstuff[k_respawn]) // Respawning
|| (players[displayplayer].spectator || objectplacing)) // Not a physical player
&& !(players[displayplayer].kartstuff[k_spinouttimer] && players[displayplayer].kartstuff[k_sneakertimer])) // Spinning and boosting cancels out spinout
localangle += (cmd->angleturn<<16);
@@ -5885,9 +5917,9 @@ void G_DoPlayDemo(char *defdemoname)
// didn't start recording right away.
demo_start = false;
-#ifdef HAVE_BLUA
- LUAh_MapChange();
-#endif
+/*#ifdef HAVE_BLUA
+ LUAh_MapChange(gamemap);
+#endif*/
displayplayer = consoleplayer = 0;
memset(playeringame,0,sizeof(playeringame));
playeringame[0] = true;
diff --git a/src/g_game.h b/src/g_game.h
index 621da3f8..035a59bd 100644
--- a/src/g_game.h
+++ b/src/g_game.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -56,8 +56,8 @@ extern INT16 rw_maximums[NUM_WEAPONS];
// used in game menu
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatspamprotection, cv_chatbacktint;
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
-extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove;
-extern consvar_t cv_invertmouse2, cv_alwaysfreelook2, cv_mousemove2;
+extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/;
+extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/;
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis;
@@ -255,6 +255,7 @@ FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
// Don't split up TOL handling
INT16 G_TOLFlag(INT32 pgametype);
-INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon);
+INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer);
+void G_AddMapToBuffer(INT16 map);
#endif
diff --git a/src/g_input.c b/src/g_input.c
index d671ec57..e8b00e9d 100644
--- a/src/g_input.c
+++ b/src/g_input.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -25,11 +25,11 @@ static CV_PossibleValue_t mousesens_cons_t[] = {{1, "MIN"}, {MAXMOUSESENSITIVITY
static CV_PossibleValue_t onecontrolperkey_cons_t[] = {{1, "One"}, {2, "Several"}, {0, NULL}};
// mouse values are used once
-consvar_t cv_mousesens = {"mousesens", "35", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_mousesens2 = {"mousesens2", "35", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_mouseysens = {"mouseysens", "35", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_mouseysens2 = {"mouseysens2", "35", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_controlperkey = {"controlperkey", "Several", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_mousesens2 = {"mousesens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_mouseysens2 = {"mouseysens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
INT32 mousex, mousey;
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
@@ -1274,71 +1274,82 @@ INT32 G_KeyStringtoNum(const char *keystr)
}
// SRB2Kart
-void G_Controldefault(void)
+void G_Controldefault(UINT8 player)
{
- // Main controls
- gamecontrol[gc_aimforward ][0] = KEY_UPARROW;
- gamecontrol[gc_aimbackward][0] = KEY_DOWNARROW;
- gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW;
- gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW;
- gamecontrol[gc_accelerate ][0] = 'a';
- gamecontrol[gc_drift ][0] = 's';
- gamecontrol[gc_brake ][0] = 'd';
- gamecontrol[gc_fire ][0] = KEY_SPACE;
- gamecontrol[gc_lookback ][0] = KEY_LSHIFT;
+ if (player == 0 || player == 1)
+ {
+ // Main controls
+ gamecontrol[gc_aimforward ][0] = KEY_UPARROW;
+ gamecontrol[gc_aimbackward][0] = KEY_DOWNARROW;
+ gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW;
+ gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW;
+ gamecontrol[gc_accelerate ][0] = 'a';
+ gamecontrol[gc_drift ][0] = 's';
+ gamecontrol[gc_brake ][0] = 'd';
+ gamecontrol[gc_fire ][0] = KEY_SPACE;
+ gamecontrol[gc_lookback ][0] = KEY_LSHIFT;
- gamecontrol[gc_accelerate ][1] = KEY_JOY1+0; // A
- gamecontrol[gc_lookback ][1] = KEY_JOY1+2; // X
- gamecontrol[gc_brake ][1] = KEY_JOY1+1; // B
- gamecontrol[gc_fire ][1] = KEY_JOY1+4; // LB
- gamecontrol[gc_drift ][1] = KEY_JOY1+5; // RB
-
- // Extra controls
- gamecontrol[gc_pause ][0] = KEY_PAUSE;
- gamecontrol[gc_console ][0] = KEY_CONSOLE;
- gamecontrol[gc_screenshot ][0] = KEY_F8;
- gamecontrol[gc_recordgif ][0] = KEY_F9;
- gamecontrol[gc_viewpoint ][0] = KEY_F12;
- gamecontrol[gc_talkkey ][0] = 't';
- //gamecontrol[gc_teamkey ][0] = 'y';
- gamecontrol[gc_scores ][0] = KEY_TAB;
- gamecontrol[gc_spectate ][0] = '\'';
- gamecontrol[gc_lookup ][0] = KEY_PGUP;
- gamecontrol[gc_lookdown ][0] = KEY_PGDN;
- gamecontrol[gc_centerview ][0] = KEY_END;
- gamecontrol[gc_camreset ][0] = KEY_HOME;
- gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE;
+ gamecontrol[gc_accelerate ][1] = KEY_JOY1+0; // A
+ gamecontrol[gc_lookback ][1] = KEY_JOY1+2; // X
+ gamecontrol[gc_brake ][1] = KEY_JOY1+1; // B
+ gamecontrol[gc_fire ][1] = KEY_JOY1+4; // LB
+ gamecontrol[gc_drift ][1] = KEY_JOY1+5; // RB
+
+ // Extra controls
+ gamecontrol[gc_pause ][0] = KEY_PAUSE;
+ gamecontrol[gc_console ][0] = KEY_CONSOLE;
+ gamecontrol[gc_screenshot ][0] = KEY_F8;
+ gamecontrol[gc_recordgif ][0] = KEY_F9;
+ gamecontrol[gc_viewpoint ][0] = KEY_F12;
+ gamecontrol[gc_talkkey ][0] = 't';
+ //gamecontrol[gc_teamkey ][0] = 'y';
+ gamecontrol[gc_scores ][0] = KEY_TAB;
+ gamecontrol[gc_spectate ][0] = '\'';
+ gamecontrol[gc_lookup ][0] = KEY_PGUP;
+ gamecontrol[gc_lookdown ][0] = KEY_PGDN;
+ gamecontrol[gc_centerview ][0] = KEY_END;
+ gamecontrol[gc_camreset ][0] = KEY_HOME;
+ gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE;
- gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y
- gamecontrol[gc_pause ][1] = KEY_JOY1+6; // Back
- gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start
- gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up
- gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down
- gamecontrol[gc_talkkey ][1] = KEY_HAT1+2; // D-Pad Left
- gamecontrol[gc_scores ][1] = KEY_HAT1+3; // D-Pad Right
+ gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y
+ gamecontrol[gc_pause ][1] = KEY_JOY1+6; // Back
+ gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start
+ gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up
+ gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down
+ gamecontrol[gc_talkkey ][1] = KEY_HAT1+2; // D-Pad Left
+ gamecontrol[gc_scores ][1] = KEY_HAT1+3; // D-Pad Right
+ }
- // Player 2 controls
- gamecontrolbis[gc_accelerate ][0] = KEY_2JOY1+0; // A
- gamecontrolbis[gc_lookback ][0] = KEY_2JOY1+2; // X
- gamecontrolbis[gc_brake ][0] = KEY_2JOY1+1; // B
- gamecontrolbis[gc_fire ][0] = KEY_2JOY1+4; // LB
- gamecontrolbis[gc_drift ][0] = KEY_2JOY1+5; // RB
+ if (player == 0 || player == 2)
+ {
+ // Player 2 controls
+ gamecontrolbis[gc_accelerate ][0] = KEY_2JOY1+0; // A
+ gamecontrolbis[gc_lookback ][0] = KEY_2JOY1+2; // X
+ gamecontrolbis[gc_brake ][0] = KEY_2JOY1+1; // B
+ gamecontrolbis[gc_fire ][0] = KEY_2JOY1+4; // LB
+ gamecontrolbis[gc_drift ][0] = KEY_2JOY1+5; // RB
+ }
- // Player 3 controls
- gamecontrol3[gc_accelerate ][0] = KEY_3JOY1+0; // A
- gamecontrol3[gc_lookback ][0] = KEY_3JOY1+2; // X
- gamecontrol3[gc_brake ][0] = KEY_3JOY1+1; // B
- gamecontrol3[gc_fire ][0] = KEY_3JOY1+4; // LB
- gamecontrol3[gc_drift ][0] = KEY_3JOY1+5; // RB
+ if (player == 0 || player == 3)
+ {
+ // Player 3 controls
+ gamecontrol3[gc_accelerate ][0] = KEY_3JOY1+0; // A
+ gamecontrol3[gc_lookback ][0] = KEY_3JOY1+2; // X
+ gamecontrol3[gc_brake ][0] = KEY_3JOY1+1; // B
+ gamecontrol3[gc_fire ][0] = KEY_3JOY1+4; // LB
+ gamecontrol3[gc_drift ][0] = KEY_3JOY1+5; // RB
+ }
- // Player 4 controls
- gamecontrol4[gc_accelerate ][0] = KEY_4JOY1+0; // A
- gamecontrol4[gc_lookback ][0] = KEY_4JOY1+2; // X
- gamecontrol4[gc_brake ][0] = KEY_4JOY1+1; // B
- gamecontrol4[gc_fire ][0] = KEY_4JOY1+4; // LB
- gamecontrol4[gc_drift ][0] = KEY_4JOY1+5; // RB
+ if (player == 0 || player == 4)
+ {
+ // Player 4 controls
+ gamecontrol4[gc_accelerate ][0] = KEY_4JOY1+0; // A
+ gamecontrol4[gc_lookback ][0] = KEY_4JOY1+2; // X
+ gamecontrol4[gc_brake ][0] = KEY_4JOY1+1; // B
+ gamecontrol4[gc_fire ][0] = KEY_4JOY1+4; // LB
+ gamecontrol4[gc_drift ][0] = KEY_4JOY1+5; // RB
+ }
}
-//#endif
void G_SaveKeySetting(FILE *f)
{
@@ -1393,25 +1404,20 @@ void G_CheckDoubleUsage(INT32 keynum)
{
if (cv_controlperkey.value == 1)
{
- INT32 i;
+ INT32 i, j;
for (i = 0; i < num_gamecontrols; i++)
{
- if (gamecontrol[i][0] == keynum)
- gamecontrol[i][0] = KEY_NULL;
- if (gamecontrol[i][1] == keynum)
- gamecontrol[i][1] = KEY_NULL;
- if (gamecontrolbis[i][0] == keynum)
- gamecontrolbis[i][0] = KEY_NULL;
- if (gamecontrolbis[i][1] == keynum)
- gamecontrolbis[i][1] = KEY_NULL;
- if (gamecontrol3[i][0] == keynum)
- gamecontrol3[i][0] = KEY_NULL;
- if (gamecontrol3[i][1] == keynum)
- gamecontrol3[i][1] = KEY_NULL;
- if (gamecontrol4[i][0] == keynum)
- gamecontrol4[i][0] = KEY_NULL;
- if (gamecontrol4[i][1] == keynum)
- gamecontrol4[i][1] = KEY_NULL;
+ for (j = 0; j < 2; j++)
+ {
+ if (gamecontrol[i][j] == keynum)
+ gamecontrol[i][j] = KEY_NULL;
+ if (gamecontrolbis[i][j] == keynum)
+ gamecontrolbis[i][j] = KEY_NULL;
+ if (gamecontrol3[i][j] == keynum)
+ gamecontrol3[i][j] = KEY_NULL;
+ if (gamecontrol4[i][j] == keynum)
+ gamecontrol4[i][j] = KEY_NULL;
+ }
}
}
}
@@ -1432,11 +1438,31 @@ static void setcontrol(INT32 (*gc)[2], INT32 na)
return;
}
keynum = G_KeyStringtoNum(COM_Argv(2));
+
+ if (keynum == KEY_PAUSE) // fail silently; pause is hardcoded
+ {
+ if (na == 4)
+ {
+ na--;
+ keynum = G_KeyStringtoNum(COM_Argv(3));
+ if (keynum == KEY_PAUSE)
+ return;
+ }
+ else
+ return;
+ }
+
G_CheckDoubleUsage(keynum);
gc[numctrl][0] = keynum;
if (na == 4)
- gc[numctrl][1] = G_KeyStringtoNum(COM_Argv(3));
+ {
+ keynum = G_KeyStringtoNum(COM_Argv(3));
+ if (keynum != KEY_PAUSE)
+ gc[numctrl][1] = keynum;
+ else
+ gc[numctrl][1] = 0;
+ }
else
gc[numctrl][1] = 0;
}
diff --git a/src/g_input.h b/src/g_input.h
index c12f28aa..966e186d 100644
--- a/src/g_input.h
+++ b/src/g_input.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -165,7 +165,7 @@ void Command_Setcontrol_f(void);
void Command_Setcontrol2_f(void);
void Command_Setcontrol3_f(void);
void Command_Setcontrol4_f(void);
-void G_Controldefault(void);
+void G_Controldefault(UINT8 player);
void G_SaveKeySetting(FILE *f);
void G_CheckDoubleUsage(INT32 keynum);
diff --git a/src/g_state.h b/src/g_state.h
index 38ad4145..f9f1babd 100644
--- a/src/g_state.h
+++ b/src/g_state.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/hardware/hw_bsp.c b/src/hardware/hw_bsp.c
index 9378a22c..e02c3ede 100644
--- a/src/hardware/hw_bsp.c
+++ b/src/hardware/hw_bsp.c
@@ -634,6 +634,7 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
HWR_SubsecPoly(bspnum&(~NF_SUBSECTOR), poly);
//Hurdler: implement a loading status
+#ifdef HWR_LOADING_SCREEN
if (ls_count-- <= 0)
{
char s[16];
@@ -658,6 +659,7 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b
I_UpdateNoVsync();
}
+#endif
}
M_ClearBox(bbox);
poly = extrasubsectors[bspnum&~NF_SUBSECTOR].planepoly;
diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h
index 2d346878..ece627d3 100644
--- a/src/hardware/hw_defs.h
+++ b/src/hardware/hw_defs.h
@@ -104,7 +104,7 @@ typedef struct
typedef struct
{
FLOAT x,y,z; // position
- FLOAT anglex,angley; // aimingangle / viewangle
+ FLOAT anglex,angley,anglez; // aimingangle / viewangle
FLOAT scalex,scaley,scalez;
FLOAT fovxangle, fovyangle;
UINT8 splitscreen;
diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h
index 5d1a81d4..9656e54e 100644
--- a/src/hardware/hw_glob.h
+++ b/src/hardware/hw_glob.h
@@ -27,6 +27,9 @@
// the original aspect ratio of Doom graphics isn't square
#define ORIGINAL_ASPECT (320.0f/200.0f)
+// Uncomment this to enable the OpenGL loading screen
+//#define HWR_LOADING_SCREEN
+
// -----------
// structures
// -----------
diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 68915e97..e4c9e833 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -3569,9 +3569,7 @@ static void HWR_Subsector(size_t num, UINT8 ssplayer)
#ifndef POLYSKY
// Moved here because before, when above the ceiling and the floor does not have the sky flat, it doesn't draw the sky
if (gr_frontsector->ceilingpic == skyflatnum || gr_frontsector->floorpic == skyflatnum)
- {
drawsky = true;
- }
#endif
#ifdef R_FAKEFLOORS
@@ -5740,7 +5738,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
// ==========================================================================
//
// ==========================================================================
-static void HWR_DrawSkyBackground(player_t *player)
+static void HWR_DrawSkyBackground(void)
{
FOutVector v[4];
angle_t angle;
@@ -5748,18 +5746,18 @@ static void HWR_DrawSkyBackground(player_t *player)
float aspectratio;
float angleturn;
-// 3--2
-// | /|
-// |/ |
-// 0--1
-
- (void)player;
HWR_GetTexture(texturetranslation[skytexture]);
+ aspectratio = (float)vid.width/(float)vid.height;
//Hurdler: the sky is the only texture who need 4.0f instead of 1.0
// because it's called just after clearing the screen
// and thus, the near clipping plane is set to 3.99
// Sryder: Just use the near clipping plane value then
+
+ // 3--2
+ // | /|
+ // |/ |
+ // 0--1
v[0].x = v[3].x = -ZCLIP_PLANE-1;
v[1].x = v[2].x = ZCLIP_PLANE+1;
v[0].y = v[1].y = -ZCLIP_PLANE-1;
@@ -5788,9 +5786,13 @@ static void HWR_DrawSkyBackground(player_t *player)
// Y
angle = aimingangle;
- aspectratio = (float)vid.width/(float)vid.height;
dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->height/(128.0f*aspectratio));
- angleturn = (((float)ANGLE_45-1.0f)*aspectratio)*dimensionmultiply;
+
+ if (splitscreen == 1)
+ {
+ dimensionmultiply *= 2;
+ angle *= 2;
+ }
// Middle of the sky should always be at angle 0
// need to keep correct aspect ratio with X
@@ -5806,6 +5808,8 @@ static void HWR_DrawSkyBackground(player_t *player)
v[0].tow = v[1].tow = -(0.5f-(0.5f/dimensionmultiply));
}
+ angleturn = (((float)ANGLE_45-1.0f)*aspectratio)*dimensionmultiply;
+
if (angle > ANGLE_180) // Do this because we don't want the sky to suddenly teleport when crossing over 0 to 360 and vice versa
{
angle = InvAngle(angle);
@@ -5968,6 +5972,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
// It should replace all other gr_viewxxx when finished
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
+ atransform.anglez = 0.0f;
if (*type == postimg_flip)
atransform.flip = true;
@@ -6002,12 +6007,8 @@ if (0)
HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off
}
-#ifndef _NDS
if (drawsky)
- HWR_DrawSkyBackground(player);
-#else
- (void)HWR_DrawSkyBackground;
-#endif
+ HWR_DrawSkyBackground();
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
@@ -6230,6 +6231,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
// It should replace all other gr_viewxxx when finished
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
+ atransform.anglez = 0.0f;
if (*type == postimg_flip)
atransform.flip = true;
@@ -6264,12 +6266,8 @@ if (0)
HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off
}
-#ifndef _NDS
if (!skybox && drawsky) // Don't draw the regular sky if there's a skybox
- HWR_DrawSkyBackground(player);
-#else
- (void)HWR_DrawSkyBackground;
-#endif
+ HWR_DrawSkyBackground();
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c
index c545cb80..2856cada 100644
--- a/src/hardware/hw_md2.c
+++ b/src/hardware/hw_md2.c
@@ -963,7 +963,7 @@ spritemd2found:
// (See this same define in k_kart.c!)
#define SETBRIGHTNESS(brightness,r,g,b) \
brightness = (UINT8)(((1063*((UINT16)r)/5000) + (3576*((UINT16)g)/5000) + (361*((UINT16)b)/5000)) / 3)
-
+
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color)
{
UINT8 i;
@@ -1389,6 +1389,18 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
p.angley = FIXED_TO_FLOAT(anglef);
}
p.anglex = 0.0f;
+ p.anglez = 0.0f;
+ if (spr->mobj->standingslope)
+ {
+ fixed_t tempz = spr->mobj->standingslope->normal.z;
+ fixed_t tempy = spr->mobj->standingslope->normal.y;
+ fixed_t tempx = spr->mobj->standingslope->normal.x;
+ fixed_t tempangle = AngleFixed(R_PointToAngle2(0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
+ p.anglez = FIXED_TO_FLOAT(tempangle);
+ tempangle = -AngleFixed(R_PointToAngle2(0, 0, tempz, tempy));
+ p.anglex = FIXED_TO_FLOAT(tempangle);
+ }
+
color[0] = Surf.FlatColor.s.red;
color[1] = Surf.FlatColor.s.green;
diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c
index 179dbaad..91578e7f 100644
--- a/src/hardware/r_opengl/r_opengl.c
+++ b/src/hardware/r_opengl/r_opengl.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 1998-2006 by Sonic Team Junior.
+// Copyright (C) 1998-2018 by Sonic Team Junior.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -112,10 +112,10 @@ static GLint viewport[4];
// These need to start at 0 and be set to their number, and be reset to 0 when deleted so that intel GPUs
// can know when the textures aren't there, as textures are always considered resident in their virtual memory
// TODO: Store them in a more normal way
-#define SCRTEX_SCREENTEXTURE 4294967295
-#define SCRTEX_STARTSCREENWIPE 4294967294
-#define SCRTEX_ENDSCREENWIPE 4294967293
-#define SCRTEX_FINALSCREENTEXTURE 4294967292
+#define SCRTEX_SCREENTEXTURE 4294967295U
+#define SCRTEX_STARTSCREENWIPE 4294967294U
+#define SCRTEX_ENDSCREENWIPE 4294967293U
+#define SCRTEX_FINALSCREENTEXTURE 4294967292U
static GLuint screentexture = 0;
static GLuint startScreenWipe = 0;
static GLuint endScreenWipe = 0;
@@ -1962,8 +1962,9 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration,
pglTranslatef(pos->x, pos->z, pos->y);
if (flipped)
scaley = -scaley;
- pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
+ pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f);
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
+ pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
val = *gl_cmd_buffer++;
diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index 88027c66..9bdf9bd7 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/hu_stuff.h b/src/hu_stuff.h
index a9194975..ecfdb041 100644
--- a/src/hu_stuff.h
+++ b/src/hu_stuff.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_addrinfo.c b/src/i_addrinfo.c
index 4dafd8f8..20766275 100644
--- a/src/i_addrinfo.c
+++ b/src/i_addrinfo.c
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
-// Copyright (C) 2011-2016 by Sonic Team Junior.
+// Copyright (C) 2011-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_addrinfo.h b/src/i_addrinfo.h
index 744ea0cf..1b8ce915 100644
--- a/src/i_addrinfo.h
+++ b/src/i_addrinfo.h
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
-// Copyright (C) 2011-2016 by Sonic Team Junior.
+// Copyright (C) 2011-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_joy.h b/src/i_joy.h
index 00302eb0..f780d801 100644
--- a/src/i_joy.h
+++ b/src/i_joy.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_net.h b/src/i_net.h
index 2bfa5eac..0e17077b 100644
--- a/src/i_net.h
+++ b/src/i_net.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_sound.h b/src/i_sound.h
index bc9829fd..fd73d145 100644
--- a/src/i_sound.h
+++ b/src/i_sound.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_system.h b/src/i_system.h
index 447e5934..d1708fe5 100644
--- a/src/i_system.h
+++ b/src/i_system.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_tcp.c b/src/i_tcp.c
index 9227865e..739355cc 100644
--- a/src/i_tcp.c
+++ b/src/i_tcp.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_tcp.h b/src/i_tcp.h
index a084abb8..06680cd9 100644
--- a/src/i_tcp.h
+++ b/src/i_tcp.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_video.h b/src/i_video.h
index 7ee07f00..4bb2c582 100644
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/info.c b/src/info.c
index fa241ad7..aaba2479 100644
--- a/src/info.c
+++ b/src/info.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -68,8 +68,8 @@ char sprnames[NUMSPRITES + 1][5] =
"FROG","CBRA","HOLE","BBRA","EGFG","SMKP","MTYM","THWP","SNOB","ICEB",
"CNDL","DOCH","DUCK","GTRE","CHES","CHIM","DRGN","LZMN","PGSS","ZTCH",
"MKMA","MKMP","RTCH","BOWL","BOWH","BRRL","BRRR","HRSE","TOAH","BFRT",
- "OFRT","RFRT","PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN","XMS4",
- "XMS5","VIEW"
+ "OFRT","RFRT","PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN","FWRK",
+ "XMS4","XMS5","VIEW"
};
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
@@ -3293,100 +3293,106 @@ state_t states[NUMSTATES] =
{SPR_ICEB, 3, 10, {NULL}, 0, 0, S_NULL}, // S_SMK_ICEBLOCK_DEBRIS2
// Ezo's maps
- {SPR_CNDL, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE2}, // S_BLUEFIRE1
- {SPR_CNDL, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE3}, // S_BLUEFIRE2
- {SPR_CNDL, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE4}, // S_BLUEFIRE3
- {SPR_CNDL, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE1}, // S_BLUEFIRE4
+ {SPR_CNDL, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE2}, // S_BLUEFIRE1
+ {SPR_CNDL, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE3}, // S_BLUEFIRE2
+ {SPR_CNDL, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE4}, // S_BLUEFIRE3
+ {SPR_CNDL, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE1}, // S_BLUEFIRE4
- {SPR_CNDL, 4|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE2}, // S_GREENFIRE1
- {SPR_CNDL, 5|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE3}, // S_GREENFIRE2
- {SPR_CNDL, 6|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE4}, // S_GREENFIRE3
- {SPR_CNDL, 7|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE1}, // S_GREENFIRE4
+ {SPR_CNDL, 4|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE2}, // S_GREENFIRE1
+ {SPR_CNDL, 5|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE3}, // S_GREENFIRE2
+ {SPR_CNDL, 6|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE4}, // S_GREENFIRE3
+ {SPR_CNDL, 7|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE1}, // S_GREENFIRE4
- {SPR_CHES, 0, -1, {NULL}, 0, 0, S_NULL}, // S_REGALCHEST
- {SPR_CHIM, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_CHIMERASTATUE
- {SPR_DRGN, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_DRAGONSTATUE
- {SPR_LZMN, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_LIZARDMANSTATUE
- {SPR_PGSS, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_PEGASUSSTATUE
+ {SPR_CHES, 0, -1, {NULL}, 0, 0, S_NULL}, // S_REGALCHEST
+ {SPR_CHIM, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_CHIMERASTATUE
+ {SPR_DRGN, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_DRAGONSTATUE
+ {SPR_LZMN, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_LIZARDMANSTATUE
+ {SPR_PGSS, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_PEGASUSSTATUE
- {SPR_ZTCH, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE2}, // S_ZELDAFIRE1
- {SPR_ZTCH, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE3}, // S_ZELDAFIRE2
- {SPR_ZTCH, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE4}, // S_ZELDAFIRE3
- {SPR_ZTCH, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE1}, // S_ZELDAFIRE4
+ {SPR_ZTCH, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE2}, // S_ZELDAFIRE1
+ {SPR_ZTCH, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE3}, // S_ZELDAFIRE2
+ {SPR_ZTCH, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE4}, // S_ZELDAFIRE3
+ {SPR_ZTCH, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE1}, // S_ZELDAFIRE4
- {SPR_DOCH, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBARETHING
- {SPR_DUCK, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBAREDUCK
- {SPR_GTRE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBARETREE
+ {SPR_DOCH, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBARETHING
+ {SPR_DUCK, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBAREDUCK
+ {SPR_GTRE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBARETREE
- {SPR_MKMA, 1, 2, {A_Look}, (256<<16)|1, 0, S_MONOIDLE}, // S_MONOIDLE
- {SPR_MKMA, 0, 3, {A_Chase}, 3, 0, S_MONOCHASE2}, // S_MONOCHASE1
- {SPR_MKMA, 1, 3, {A_Chase}, 3, 0, S_MONOCHASE3}, // S_MONOCHASE2
- {SPR_MKMA, 2, 3, {A_Chase}, 3, 0, S_MONOCHASE4}, // S_MONOCHASE3
- {SPR_MKMA, 3, 3, {A_Chase}, 3, 0, S_MONOCHASE1}, // S_MONOCHASE4
- {SPR_MKMP, 0, 24, {A_Pain}, 3, 0, S_MONOIDLE}, // S_MONOPAIN
+ {SPR_MKMA, 1, 2, {A_Look}, (256<<16)|1, 0, S_MONOIDLE}, // S_MONOIDLE
+ {SPR_MKMA, 0, 3, {A_Chase}, 3, 0, S_MONOCHASE2}, // S_MONOCHASE1
+ {SPR_MKMA, 1, 3, {A_Chase}, 3, 0, S_MONOCHASE3}, // S_MONOCHASE2
+ {SPR_MKMA, 2, 3, {A_Chase}, 3, 0, S_MONOCHASE4}, // S_MONOCHASE3
+ {SPR_MKMA, 3, 3, {A_Chase}, 3, 0, S_MONOCHASE1}, // S_MONOCHASE4
+ {SPR_MKMP, 0, 24, {A_Pain}, 3, 0, S_MONOIDLE}, // S_MONOPAIN
- {SPR_RTCH, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE2}, // S_REDZELDAFIRE1
- {SPR_RTCH, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE3}, // S_REDZELDAFIRE2
- {SPR_RTCH, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE4}, // S_REDZELDAFIRE3
- {SPR_RTCH, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE1}, // S_REDZELDAFIRE4
+ {SPR_RTCH, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE2}, // S_REDZELDAFIRE1
+ {SPR_RTCH, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE3}, // S_REDZELDAFIRE2
+ {SPR_RTCH, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE4}, // S_REDZELDAFIRE3
+ {SPR_RTCH, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE1}, // S_REDZELDAFIRE4
- {SPR_BOWL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BOWLINGPIN
- {SPR_BOWH, 0, 4, {A_BunnyHop}, 5, 20, S_BOWLINGHIT2}, // S_BOWLINGHIT1
- {SPR_BOWH, 1, 2, {NULL}, 0, 0, S_BOWLINGHIT3}, // S_BOWLINGHIT2
- {SPR_BOWH, 2, 2, {NULL}, 0, 0, S_BOWLINGHIT4}, // S_BOWLINGHIT3
- {SPR_BOWH, 3, 2, {NULL}, 0, 0, S_NULL}, // S_BOWLINGHIT4
+ {SPR_BOWL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BOWLINGPIN
+ {SPR_BOWH, 0, 4, {A_BunnyHop}, 5, 20, S_BOWLINGHIT2}, // S_BOWLINGHIT1
+ {SPR_BOWH, 1, 2, {NULL}, 0, 0, S_BOWLINGHIT3}, // S_BOWLINGHIT2
+ {SPR_BOWH, 2, 2, {NULL}, 0, 0, S_BOWLINGHIT4}, // S_BOWLINGHIT3
+ {SPR_BOWH, 3, 2, {NULL}, 0, 0, S_NULL}, // S_BOWLINGHIT4
- {SPR_TOAD, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ARIDTOAD
- {SPR_TOAH, 0, 4, {A_BunnyHop}, 10, 60, S_TOADHIT2}, // S_TOADHIT1
- {SPR_TOAH, 1, 3, {NULL}, 0, 0, S_TOADHIT3}, // S_TOADHIT2
- {SPR_TOAH, 2, 3, {NULL}, 0, 0, S_TOADHIT4}, // S_TOADHIT3
- {SPR_TOAH, 3, 3, {NULL}, 0, 0, S_EBARREL18}, // S_TOADHIT4
+ {SPR_TOAD, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ARIDTOAD
+ {SPR_TOAH, 0, 4, {A_BunnyHop}, 10, 60, S_TOADHIT2}, // S_TOADHIT1
+ {SPR_TOAH, 1, 3, {NULL}, 0, 0, S_TOADHIT3}, // S_TOADHIT2
+ {SPR_TOAH, 2, 3, {NULL}, 0, 0, S_TOADHIT4}, // S_TOADHIT3
+ {SPR_TOAH, 3, 3, {NULL}, 0, 0, S_EBARREL18}, // S_TOADHIT4
- {SPR_BRRL, 0, 1, {A_Look}, (96<<16)|1, 0, S_EBARRELIDLE}, // S_EBARRELIDLE
- {SPR_BRRR, 0, 4, {NULL}, 0, 0, S_EBARREL2}, // S_EBARREL1
- {SPR_BRRR, 1, 4, {NULL}, 0, 0, S_EBARREL3}, // S_EBARREL2
- {SPR_BRRR, 2, 4, {NULL}, 0, 0, S_EBARREL4}, // S_EBARREL3
- {SPR_BRRR, 3, 4, {NULL}, 0, 0, S_EBARREL5}, // S_EBARREL4
- {SPR_BRRR, 4, 4, {NULL}, 0, 0, S_EBARREL6}, // S_EBARREL5
- {SPR_BRRR, 5, 4, {NULL}, 0, 0, S_EBARREL7}, // S_EBARREL6
- {SPR_BRRR, 6, 4, {NULL}, 0, 0, S_EBARREL8}, // S_EBARREL7
- {SPR_BRRR, 7, 4, {NULL}, 0, 0, S_EBARREL9}, // S_EBARREL8
- {SPR_BRRR, 8, 4, {NULL}, 0, 0, S_EBARREL10}, // S_EBARREL9
- {SPR_BRRR, 9, 4, {NULL}, 0, 0, S_EBARREL11}, // S_EBARREL10
- {SPR_BRRR, 10, 4, {NULL}, 0, 0, S_EBARREL12}, // S_EBARREL11
- {SPR_BRRR, 11, 4, {NULL}, 0, 0, S_EBARREL13}, // S_EBARREL12
- {SPR_BRRR, 12, 4, {NULL}, 0, 0, S_EBARREL14}, // S_EBARREL13
- {SPR_BRRR, 13, 4, {NULL}, 0, 0, S_EBARREL15}, // S_EBARREL14
- {SPR_BRRR, 14, 4, {NULL}, 0, 0, S_EBARREL16}, // S_EBARREL15
- {SPR_BRRR, 15, 4, {NULL}, 0, 0, S_EBARREL17}, // S_EBARREL16
- {SPR_BRRR, 16, 4, {NULL}, 0, 0, S_EBARREL18}, // S_EBARREL17
- {SPR_BRRR, 16, 0, {A_MineExplode}, MT_MINEEXPLOSION, 0, S_NULL}, // S_EBARREL18
+ {SPR_BRRL, 0, 1, {A_Look}, (96<<16)|1, 0, S_EBARRELIDLE}, // S_EBARRELIDLE
+ {SPR_BRRR, 0, 4, {NULL}, 0, 0, S_EBARREL2}, // S_EBARREL1
+ {SPR_BRRR, 1, 4, {NULL}, 0, 0, S_EBARREL3}, // S_EBARREL2
+ {SPR_BRRR, 2, 4, {NULL}, 0, 0, S_EBARREL4}, // S_EBARREL3
+ {SPR_BRRR, 3, 4, {NULL}, 0, 0, S_EBARREL5}, // S_EBARREL4
+ {SPR_BRRR, 4, 4, {NULL}, 0, 0, S_EBARREL6}, // S_EBARREL5
+ {SPR_BRRR, 5, 4, {NULL}, 0, 0, S_EBARREL7}, // S_EBARREL6
+ {SPR_BRRR, 6, 4, {NULL}, 0, 0, S_EBARREL8}, // S_EBARREL7
+ {SPR_BRRR, 7, 4, {NULL}, 0, 0, S_EBARREL9}, // S_EBARREL8
+ {SPR_BRRR, 8, 4, {NULL}, 0, 0, S_EBARREL10}, // S_EBARREL9
+ {SPR_BRRR, 9, 4, {NULL}, 0, 0, S_EBARREL11}, // S_EBARREL10
+ {SPR_BRRR, 10, 4, {NULL}, 0, 0, S_EBARREL12}, // S_EBARREL11
+ {SPR_BRRR, 11, 4, {NULL}, 0, 0, S_EBARREL13}, // S_EBARREL12
+ {SPR_BRRR, 12, 4, {NULL}, 0, 0, S_EBARREL14}, // S_EBARREL13
+ {SPR_BRRR, 13, 4, {NULL}, 0, 0, S_EBARREL15}, // S_EBARREL14
+ {SPR_BRRR, 14, 4, {NULL}, 0, 0, S_EBARREL16}, // S_EBARREL15
+ {SPR_BRRR, 15, 4, {NULL}, 0, 0, S_EBARREL17}, // S_EBARREL16
+ {SPR_BRRR, 16, 4, {NULL}, 0, 0, S_EBARREL18}, // S_EBARREL17
+ {SPR_BRRR, 16, 0, {A_MineExplode}, MT_MINEEXPLOSION, 0, S_NULL}, // S_EBARREL18
- {SPR_HRSE, 0, 230, {A_PlaySeeSound}, 0, 0, S_MERRYHORSE}, // S_MERRYHORSE
+ {SPR_HRSE, 0, 230, {A_PlaySeeSound}, 0, 0, S_MERRYHORSE}, // S_MERRYHORSE
- {SPR_BFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BLUEFRUIT
- {SPR_OFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ORANGEFRUIT
- {SPR_RFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_REDFRUIT
- {SPR_PFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_PINKFRUIT
+ {SPR_BFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BLUEFRUIT
+ {SPR_OFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ORANGEFRUIT
+ {SPR_RFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_REDFRUIT
+ {SPR_PFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_PINKFRUIT
- {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEA2}, // S_ADVENTURESPIKEA1
- {SPR_ASPK, 0, 50, {A_BunnyHop}, 20, 0, S_ADVENTURESPIKEA1}, // S_ADVENTURESPIKEA2
- {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEB2}, // S_ADVENTURESPIKEB1
- {SPR_ASPK, 0, 35, {A_BunnyHop}, 15, 0, S_ADVENTURESPIKEB1}, // S_ADVENTURESPIKEB2
- {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEC2}, // S_ADVENTURESPIKEC1
- {SPR_ASPK, 0, 65, {A_BunnyHop}, 25, 0, S_ADVENTURESPIKEC1}, // S_ADVENTURESPIKEC1
+ {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEA2}, // S_ADVENTURESPIKEA1
+ {SPR_ASPK, 0, 50, {A_BunnyHop}, 20, 0, S_ADVENTURESPIKEA1}, // S_ADVENTURESPIKEA2
+ {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEB2}, // S_ADVENTURESPIKEB1
+ {SPR_ASPK, 0, 35, {A_BunnyHop}, 15, 0, S_ADVENTURESPIKEB1}, // S_ADVENTURESPIKEB2
+ {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEC2}, // S_ADVENTURESPIKEC1
+ {SPR_ASPK, 0, 65, {A_BunnyHop}, 25, 0, S_ADVENTURESPIKEC1}, // S_ADVENTURESPIKEC1
- {SPR_HBST, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTPROMPT2}, // S_BOOSTPROMPT1
- {SPR_HBST, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTPROMPT1}, // S_BOOSTPROMPT2
+ {SPR_HBST, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTPROMPT2}, // S_BOOSTPROMPT1
+ {SPR_HBST, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTPROMPT1}, // S_BOOSTPROMPT2
- {SPR_HBSF, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTOFF2}, // S_BOOSTOFF1
- {SPR_HBSF, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTOFF1}, // S_BOOSTOFF2
+ {SPR_HBSF, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTOFF2}, // S_BOOSTOFF1
+ {SPR_HBSF, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTOFF1}, // S_BOOSTOFF2
- {SPR_HBSO, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTON2}, // S_BOOSTON1
- {SPR_HBSO, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTON1}, // S_BOOSTON2
+ {SPR_HBSO, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTON2}, // S_BOOSTON1
+ {SPR_HBSO, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTON1}, // S_BOOSTON2
- {SPR_WBLZ, 0, -1, {NULL}, 0, 0, S_NULL}, // S_LIZARDMAN
- {SPR_WBLN, 0, -1, {NULL}, 0, 0, S_NULL}, // S_LIONMAN
+ {SPR_WBLZ, 0, -1, {NULL}, 0, 0, S_NULL}, // S_LIZARDMAN
+ {SPR_WBLN, 0, -1, {NULL}, 0, 0, S_NULL}, // S_LIONMAN
+
+ {SPR_FWRK, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_KARMAFIREWORK2}, // S_KARMAFIREWORK1
+ {SPR_FWRK, 1|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_KARMAFIREWORK3}, // S_KARMAFIREWORK2
+ {SPR_FWRK, 2|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_KARMAFIREWORK4}, // S_KARMAFIREWORK3
+ {SPR_FWRK, 3|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_KARMAFIREWORK1}, // S_KARMAFIREWORK4
+ {SPR_FWRK, 4|FF_FULLBRIGHT, TICRATE, {NULL}, 0, 0, S_NULL}, // S_KARMAFIREWORKTRAIL
#ifdef SEENAMES
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK
@@ -13747,7 +13753,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
10, // mass
0, // damage
sfx_None, // activesound
- MF_NOTHINK|MF_NOBLOCKMAP|MF_NOGRAVITY, // flags
+ MF_SCENERY|MF_NOBLOCKMAP|MF_NOGRAVITY, // flags
S_NULL // raisestate
},
@@ -15571,7 +15577,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
6*TICRATE, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
- 288*FRACUNIT, // painchance
+ 192*FRACUNIT, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@@ -15598,7 +15604,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
- 288*FRACUNIT, // painchance
+ 192*FRACUNIT, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@@ -15841,7 +15847,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
- 288*FRACUNIT, // painchance
+ 192*FRACUNIT, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@@ -17282,7 +17288,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // speed
36*FRACUNIT, // radius
37*FRACUNIT, // height
- 0, // display offset
+ -2, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -17309,7 +17315,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // speed
36*FRACUNIT, // radius
37*FRACUNIT, // height
- 0, // display offset
+ -2, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -17363,7 +17369,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
0, // speed
8*FRACUNIT, // radius
16*FRACUNIT, // height
- 0, // display offset
+ -1, // display offset
0, // mass
0, // damage
sfx_None, // activesound
@@ -19623,7 +19629,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
- 288*FRACUNIT, // painchance
+ 192*FRACUNIT, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@@ -20019,6 +20025,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
+ { // MT_KARMAFIREWORK
+ -1, // doomednum
+ S_KARMAFIREWORK1, // spawnstate
+ 1000, // spawnhealth
+ S_NULL, // seestate
+ sfx_None, // seesound
+ 8, // reactiontime
+ sfx_None, // attacksound
+ S_NULL, // painstate
+ 0, // painchance
+ sfx_None, // painsound
+ S_NULL, // meleestate
+ S_NULL, // missilestate
+ S_NULL, // deathstate
+ S_NULL, // xdeathstate
+ sfx_None, // deathsound
+ 0, // speed
+ 8<kartstuff[k_itemtype] = KITEM_JAWZ;
player->kartstuff[k_itemamount] = 2;
break;
+ case KITEM_SPB:
+ case KITEM_SHRINK: // Indirect items
+ indirectitemcooldown = 20*TICRATE;
+ /* FALLTHRU */
default:
if (getitem <= 0 || getitem >= NUMKARTRESULTS) // Sad (Fallback)
{
@@ -644,7 +657,8 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed)
// POWERITEMODDS handles all of the "frantic item" related functionality, for all of our powerful items.
// First, it multiplies it by 2 if franticitems is true; easy-peasy.
- // Then, it multiplies it further if there's less than 5 players in game.
+ // Next, it multiplies it again if it's in SPB mode and 2nd needs to apply pressure to 1st.
+ // Then, it multiplies it further if there's less than 8 players in game.
// This is done to make low player count races more fair & interesting. (1v1s are basically the same as franticitems false in a normal race)
// Lastly, it *divides* it by your mashed value, which was determined in K_KartItemRoulette, to punish those who are impatient.
// The last two are very fractional and complicated, very sorry!
@@ -756,7 +770,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed)
//{ SRB2kart Roulette Code - Distance Based, no waypoints
-static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT32 bestbumper)
+static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT32 bestbumper, boolean spbrush)
{
const INT32 distvar = (64*14);
INT32 i;
@@ -796,7 +810,7 @@ static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT3
players[i].mo->y - player->mo->y),
players[i].mo->z - player->mo->z) / mapheaderinfo[gamemap-1]->mobj_scale
* (pingame - players[i].kartstuff[k_position])
- / ((pingame - 1) * (pingame + 1) / 3);
+ / max(1, ((pingame - 1) * (pingame + 1) / 3));
}
#define SETUPDISTTABLE(odds, num) \
@@ -836,13 +850,15 @@ static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT3
if (oddsvalid[8]) SETUPDISTTABLE(8,1);
if (franticitems) // Frantic items make the distances between everyone artifically higher, for crazier items
- pdis = (15*pdis/14);
- if (pingame < 8 && !G_BattleGametype())
- pdis = ((28+(8-pingame))*pdis/28);
+ pdis = (15*pdis)/14;
+ if (spbrush) // SPB Rush Mode: It's 2nd place's job to catch-up items and make 1st place's job hell
+ pdis = (3*pdis)/2;
+ if (pingame < 8)
+ pdis = ((28+(8-pingame))*pdis)/28;
if (pingame == 1 && oddsvalid[0]) // Record Attack, or just alone
useodds = 0;
- else if (pdis <= 0) // (64*14) * 0 = 0
+ else if (pdis <= 0) // (64*14) * 0 = 0
useodds = disttable[0];
else if (pdis > distvar * ((12 * distlen) / 14)) // (64*14) * 12 = 10752
useodds = disttable[distlen-1];
@@ -944,6 +960,8 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
if (player->kartstuff[k_roulettetype] == 2) // Fake items
{
player->kartstuff[k_eggmanexplode] = 4*TICRATE;
+ //player->kartstuff[k_itemblink] = TICRATE;
+ //player->kartstuff[k_itemblinkmode] = 1;
player->kartstuff[k_itemroulette] = 0;
player->kartstuff[k_roulettetype] = 0;
if (P_IsLocalPlayer(player))
@@ -955,6 +973,8 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
{
K_KartGetItemResult(player, cv_kartdebugitem.value);
player->kartstuff[k_itemamount] = cv_kartdebugamount.value;
+ player->kartstuff[k_itemblink] = TICRATE;
+ player->kartstuff[k_itemblinkmode] = 2;
player->kartstuff[k_itemroulette] = 0;
player->kartstuff[k_roulettetype] = 0;
if (P_IsLocalPlayer(player))
@@ -967,7 +987,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
spawnchance[i] = 0;
// Split into another function for a debug function below
- useodds = K_FindUseodds(player, mashed, pingame, bestbumper);
+ useodds = K_FindUseodds(player, mashed, pingame, bestbumper, (spbplace != -1 && player->kartstuff[k_position] == spbplace+1));
#define SETITEMRESULT(itemnum) \
for (chance = 0; chance < K_KartGetItemOdds(useodds, itemnum, mashed); chance++) \
@@ -987,11 +1007,14 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
player->kartstuff[k_itemamount] = 1;
}
+ if (P_IsLocalPlayer(player))
+ S_StartSound(NULL, ((player->kartstuff[k_roulettetype] == 1) ? sfx_itrolk : (mashed ? sfx_itrolm : sfx_itrolf)));
+
+ player->kartstuff[k_itemblink] = TICRATE;
+ player->kartstuff[k_itemblinkmode] = ((player->kartstuff[k_roulettetype] == 1) ? 2 : (mashed ? 1 : 0));
+
player->kartstuff[k_itemroulette] = 0; // Since we're done, clear the roulette number
player->kartstuff[k_roulettetype] = 0; // This too
-
- if (P_IsLocalPlayer(player))
- S_StartSound(NULL, sfx_itrolf);
}
//}
@@ -1257,8 +1280,6 @@ static void K_UpdateOffroad(player_t *player)
if (player->kartstuff[k_offroad] > 0)
{
- if (kartweight < 1) { kartweight = 1; } if (kartweight > 9) { kartweight = 9; } // Safety Net
-
// 1872 is the magic number - 35 frames adds up to approximately 65536. 1872/4 = 468/3 = 156
// A higher kart weight means you can stay offroad for longer without losing speed
offroad = (1872 + 5*156 - kartweight*156)*offroadstrength;
@@ -1626,7 +1647,10 @@ static void K_GetKartBoostPower(player_t *player)
boostpower = 4*boostpower/5;
// Banana drag/offroad dust
- if (boostpower < FRACUNIT)
+ if (boostpower < FRACUNIT
+ && player->mo && P_IsObjectOnGround(player->mo)
+ && player->speed > 0
+ && !player->spectator)
{
K_SpawnWipeoutTrail(player->mo, true);
if (leveltime % 6 == 0)
@@ -1837,9 +1861,25 @@ void K_SpawnBattlePoints(player_t *source, player_t *victim, UINT8 amount)
pt->color = source->skincolor;
}
-void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem)
+void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflictor, boolean trapitem)
{
UINT8 scoremultiply = 1;
+ // PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
+#ifdef HAVE_BLUA
+ boolean force = false; // Used to check if Lua ShouldSpin should get us damaged reguardless of flashtics or heck knows what.
+ UINT8 shouldForce = LUAh_ShouldSpin(player, inflictor, source);
+ if (P_MobjWasRemoved(player->mo))
+ return; // mobj was removed (in theory that shouldn't happen)
+ if (shouldForce == 1)
+ force = true;
+ else if (shouldForce == 2)
+ return;
+#else
+ static const boolean force = false;
+ (void)inflictor; // in case some weirdo doesn't want Lua.
+#endif
+
+
if (!trapitem && G_BattleGametype())
{
if (K_IsPlayerWanted(player))
@@ -1855,16 +1895,26 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem
|| player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0
|| (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1)))
{
- K_DoInstashield(player);
- return;
+ if (!force) // if shoulddamage force, we go THROUGH that.
+ {
+ K_DoInstashield(player);
+ return;
+ }
}
+ if (LUAh_PlayerSpin(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
+ return;
+
if (source && source != player->mo && source->player)
K_PlayHitEmSound(source);
//player->kartstuff[k_sneakertimer] = 0;
player->kartstuff[k_driftboost] = 0;
+ player->kartstuff[k_drift] = 0;
+ player->kartstuff[k_driftcharge] = 0;
+ player->kartstuff[k_pogospring] = 0;
+
if (G_BattleGametype())
{
if (source && source->player && player != source->player)
@@ -1931,9 +1981,24 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem
return;
}
-void K_SquishPlayer(player_t *player, mobj_t *source)
+void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
{
UINT8 scoremultiply = 1;
+ // PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
+#ifdef HAVE_BLUA
+ boolean force = false; // Used to check if Lua ShouldSquish should get us damaged reguardless of flashtics or heck knows what.
+ UINT8 shouldForce = LUAh_ShouldSquish(player, inflictor, source);
+ if (P_MobjWasRemoved(player->mo))
+ return; // mobj was removed (in theory that shouldn't happen)
+ if (shouldForce == 1)
+ force = true;
+ else if (shouldForce == 2)
+ return;
+#else
+ static const boolean force = false;
+ (void)inflictor; // Please stop forgetting to put inflictor in yer functions thank -Lat'
+#endif
+
if (G_BattleGametype())
{
if (K_IsPlayerWanted(player))
@@ -1949,13 +2014,23 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
|| player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0
|| (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1)))
{
- K_DoInstashield(player);
- return;
+ if (!force) // You know the drill by now.
+ {
+ K_DoInstashield(player);
+ return;
+ }
}
+ if (LUAh_PlayerSquish(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
+ return;
+
player->kartstuff[k_sneakertimer] = 0;
player->kartstuff[k_driftboost] = 0;
+ player->kartstuff[k_drift] = 0;
+ player->kartstuff[k_driftcharge] = 0;
+ player->kartstuff[k_pogospring] = 0;
+
if (G_BattleGametype())
{
if (source && source->player && player != source->player)
@@ -1997,6 +2072,14 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
player->kartstuff[k_squishedtimer] = TICRATE;
+ // Reduce Shrink timer
+ if (player->kartstuff[k_growshrinktimer] < 0)
+ {
+ player->kartstuff[k_growshrinktimer] += TICRATE;
+ if (player->kartstuff[k_growshrinktimer] > -2)
+ player->kartstuff[k_growshrinktimer] = -2;
+ }
+
player->powers[pw_flashing] = K_GetKartFlashing(player);
player->mo->flags |= MF_NOCLIP;
@@ -2017,6 +2100,19 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A bit of a hack, we just throw the player up higher here and extend their spinout timer
{
UINT8 scoremultiply = 1;
+#ifdef HAVE_BLUA
+ boolean force = false; // Used to check if Lua ShouldExplode should get us damaged reguardless of flashtics or heck knows what.
+ UINT8 shouldForce = LUAh_ShouldExplode(player, inflictor, source);
+ if (P_MobjWasRemoved(player->mo))
+ return; // mobj was removed (in theory that shouldn't happen)
+ if (shouldForce == 1)
+ force = true;
+ else if (shouldForce == 2)
+ return;
+
+#else
+ static const boolean force = false;
+#endif
if (G_BattleGametype())
{
if (K_IsPlayerWanted(player))
@@ -2032,10 +2128,16 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
||*/player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0
|| (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1)))
{
- K_DoInstashield(player);
- return;
+ if (!force) // ShouldDamage can bypass that, again.
+ {
+ K_DoInstashield(player);
+ return;
+ }
}
+ if (LUAh_PlayerExplode(player, inflictor, source)) // Same thing. Also make sure to let Instashield happen blah blah
+ return;
+
if (source && source != player->mo && source->player)
K_PlayHitEmSound(source);
@@ -2045,6 +2147,10 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
player->kartstuff[k_sneakertimer] = 0;
player->kartstuff[k_driftboost] = 0;
+ player->kartstuff[k_drift] = 0;
+ player->kartstuff[k_driftcharge] = 0;
+ player->kartstuff[k_pogospring] = 0;
+
// This is the only part that SHOULDN'T combo :VVVVV
if (G_BattleGametype() && !(player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_spinouttimer] > 0))
{
@@ -2660,6 +2766,13 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent)
P_SetScale(dust, mo->scale);
dust->eflags = (dust->eflags & ~MFE_VERTICALFLIP)|(mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags because hyudoro shouldn't be able to wipeout
+ if (translucent) // offroad effect
+ {
+ dust->momx = mo->momx/2;
+ dust->momy = mo->momy/2;
+ dust->momz = mo->momz/2;
+ }
+
if (translucent)
dust->flags2 |= MF2_SHADOW;
}
@@ -3009,7 +3122,8 @@ static void K_DoHyudoroSteal(player_t *player)
// Has an item
&& (players[i].kartstuff[k_itemtype]
&& players[i].kartstuff[k_itemamount]
- && !players[i].kartstuff[k_itemheld]))
+ && !players[i].kartstuff[k_itemheld]
+ && !players[i].kartstuff[k_itemblink]))
{
playerswappable[numplayers] = i;
numplayers++;
@@ -3125,62 +3239,46 @@ void K_DoSneaker(player_t *player, INT32 type)
}
}
-static void K_DoShrink(player_t *player)
+static void K_DoShrink(player_t *user)
{
INT32 i;
- S_StartSound(player->mo, sfx_kc46); // Sound the BANG!
- player->pflags |= PF_ATTACKDOWN;
+ S_StartSound(user->mo, sfx_kc46); // Sound the BANG!
+ user->pflags |= PF_ATTACKDOWN;
for (i = 0; i < MAXPLAYERS; i++)
{
- if (!playeringame[i] || player->spectator || !players[i].mo)
+ if (!playeringame[i] || players[i].spectator || !players[i].mo)
continue;
- if (&players[i] == player)
+ if (&players[i] == user)
continue;
- if (players[i].kartstuff[k_position] < player->kartstuff[k_position])
+ if (players[i].kartstuff[k_position] < user->kartstuff[k_position])
{
- //P_FlashPal(&players[i], PAL_NUKE, 10);
-
- if (!player->kartstuff[k_invincibilitytimer] // Don't hit while invulnerable!
- && player->kartstuff[k_growshrinktimer] <= 0)
+ // Don't hit while invulnerable!
+ if (!players[i].kartstuff[k_invincibilitytimer]
+ && players[i].kartstuff[k_growshrinktimer] <= 0
+ && !players[i].kartstuff[k_hyudorotimer])
{
// Start shrinking!
+ K_DropItems(&players[i]);
players[i].mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/TICRATE;
players[i].mo->destscale = 6*(mapheaderinfo[gamemap-1]->mobj_scale)/8;
if (cv_kartdebugshrink.value && !modeattacking && !players[i].bot)
players[i].mo->destscale = 6*players[i].mo->destscale/8;
-
- // Wipeout
- K_DropItems(&players[i]);
- K_SpinPlayer(&players[i], player->mo, 1, false);
-
- // P_RingDamage
- P_DoPlayerPain(&players[i], player->mo, player->mo);
- P_ForceFeed(&players[i], 40, 10, TICRATE, 40 + min((players[i].mo->health-1), 100)*2);
- P_PlayRinglossSound(players[i].mo); // Ringledingle!
-
- P_PlayerRingBurst(&players[i], 5);
- players[i].mo->momx = players[i].mo->momy = 0;
- if (P_IsLocalPlayer(&players[i]))
- {
- quake.intensity = 32*FRACUNIT;
- quake.time = 5;
- }
-
- players[i].kartstuff[k_growshrinktimer] -= (200+(40*(16-players[i].kartstuff[k_position])));
- players[i].kartstuff[k_sneakertimer] = 0;
+ players[i].kartstuff[k_growshrinktimer] -= (200+(40*(MAXPLAYERS-players[i].kartstuff[k_position])));
}
// Grow should get taken away.
if (players[i].kartstuff[k_growshrinktimer] > 0)
players[i].kartstuff[k_growshrinktimer] = 2;
+ //P_FlashPal(&players[i], PAL_NUKE, 10);
S_StartSound(players[i].mo, sfx_kc59);
}
}
}
+
void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
{
const fixed_t vscale = mapheaderinfo[gamemap-1]->mobj_scale + (mo->scale - mapheaderinfo[gamemap-1]->mobj_scale);
@@ -3861,12 +3959,24 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
{
const INT32 numsnds = 13;
- INT32 class = ((player->kartspeed-1)/3) + (3*((player->kartweight-1)/3)); // engine class number
+ INT32 class, s, w; // engine class number
UINT8 volume = 255;
fixed_t volumedampen = 0;
INT32 targetsnd = 0;
INT32 i;
+ s = (player->kartspeed-1)/3;
+ w = (player->kartweight-1)/3;
+
+#define LOCKSTAT(stat) \
+ if (stat < 0) { stat = 0; } \
+ if (stat > 2) { stat = 2; }
+ LOCKSTAT(s);
+ LOCKSTAT(w);
+#undef LOCKSTAT
+
+ class = s+(3*w);
+
// Silence the engines
if (leveltime < 8 || player->spectator || player->exiting)
{
@@ -3921,6 +4031,8 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
dist = P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x,
player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) / 2;
+ dist = FixedDiv(dist, mapheaderinfo[gamemap-1]->mobj_scale);
+
if (dist > 1536<kartstuff[k_lapanimation])
+ player->kartstuff[k_lapanimation]--;
+
+ if (player->kartstuff[k_yougotem])
+ player->kartstuff[k_yougotem]--;
+
+ if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer]))
+ {
+ if (player->exiting)
+ {
+ if (player->exiting < 6*TICRATE)
+ player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
+ else if (player->exiting == 6*TICRATE)
+ player->kartstuff[k_cardanimation] = 0;
+ else if (player->kartstuff[k_cardanimation] < 2*TICRATE)
+ player->kartstuff[k_cardanimation]++;
+ }
+ else
+ {
+ if (player->kartstuff[k_comebacktimer] < 6*TICRATE)
+ player->kartstuff[k_cardanimation] -= ((164-player->kartstuff[k_cardanimation])/8)+1;
+ else if (player->kartstuff[k_comebacktimer] < 9*TICRATE)
+ player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
+ }
+
+ if (player->kartstuff[k_cardanimation] > 164)
+ player->kartstuff[k_cardanimation] = 164;
+ if (player->kartstuff[k_cardanimation] < 0)
+ player->kartstuff[k_cardanimation] = 0;
+ }
+ else if (G_RaceGametype() && player->exiting)
+ {
+ if (player->kartstuff[k_cardanimation] < 2*TICRATE)
+ player->kartstuff[k_cardanimation]++;
+ }
+ else
+ player->kartstuff[k_cardanimation] = 0;
+}
+
/** \brief Decreases various kart timers and powers per frame. Called in P_PlayerThink in p_user.c
\param player player object passed from P_PlayerThink
@@ -4188,43 +4341,14 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->kartstuff[k_justbumped])
player->kartstuff[k_justbumped]--;
- if (player->kartstuff[k_lapanimation])
- player->kartstuff[k_lapanimation]--;
-
- if (player->kartstuff[k_yougotem])
- player->kartstuff[k_yougotem]--;
-
- if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer]))
+ // This doesn't go in HUD update because it has potential gameplay ramifications
+ if (player->kartstuff[k_itemblink] && player->kartstuff[k_itemblink]-- <= 0)
{
- if (player->exiting)
- {
- if (player->exiting < 6*TICRATE)
- player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
- else if (player->exiting == 6*TICRATE)
- player->kartstuff[k_cardanimation] = 0;
- else if (player->kartstuff[k_cardanimation] < 2*TICRATE)
- player->kartstuff[k_cardanimation]++;
- }
- else
- {
- if (player->kartstuff[k_comebacktimer] < 6*TICRATE)
- player->kartstuff[k_cardanimation] -= ((164-player->kartstuff[k_cardanimation])/8)+1;
- else if (player->kartstuff[k_comebacktimer] < 9*TICRATE)
- player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
- }
+ player->kartstuff[k_itemblinkmode] = 0;
+ player->kartstuff[k_itemblink] = 0;
+ }
- if (player->kartstuff[k_cardanimation] > 164)
- player->kartstuff[k_cardanimation] = 164;
- if (player->kartstuff[k_cardanimation] < 0)
- player->kartstuff[k_cardanimation] = 0;
- }
- else if (G_RaceGametype() && player->exiting)
- {
- if (player->kartstuff[k_cardanimation] < 2*TICRATE)
- player->kartstuff[k_cardanimation]++;
- }
- else
- player->kartstuff[k_cardanimation] = 0;
+ K_KartPlayerHUDUpdate(player);
if (player->kartstuff[k_voices])
player->kartstuff[k_voices]--;
@@ -4600,7 +4724,7 @@ static void K_KartDrift(player_t *player, boolean onground)
//
// K_KartUpdatePosition
//
-static void K_KartUpdatePosition(player_t *player)
+void K_KartUpdatePosition(player_t *player)
{
fixed_t position = 1;
fixed_t oldposition = player->kartstuff[k_position];
@@ -6189,29 +6313,84 @@ static void K_drawKartItem(void)
INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT);
const INT32 numberdisplaymin = ((!offset && stplyr->kartstuff[k_itemtype] == KITEM_ORBINAUT) ? 5 : 2);
INT32 itembar = 0;
+ UINT8 localcolor = SKINCOLOR_NONE;
+ SINT8 colormode = TC_RAINBOW;
+ UINT8 *colmap = NULL;
if (stplyr->kartstuff[k_itemroulette])
{
- switch((stplyr->kartstuff[k_itemroulette] % (13*3)) / 3)
+ if (stplyr->skincolor)
+ localcolor = stplyr->skincolor;
+
+ switch((stplyr->kartstuff[k_itemroulette] % (14*3)) / 3)
{
// Each case is handled in threes, to give three frames of in-game time to see the item on the roulette
- case 0: localpatch = kp_sneaker[offset]; break; // Sneaker
- case 1: localpatch = kp_banana[offset]; break; // Banana
- case 2: localpatch = kp_orbinaut[3+offset]; break; // Orbinaut
- case 3: localpatch = kp_mine[offset]; break; // Mine
- case 4: localpatch = kp_grow[offset]; break; // Grow
- case 5: localpatch = kp_hyudoro[offset]; break; // Hyudoro
- case 6: localpatch = kp_rocketsneaker[offset]; break; // Rocket Sneaker
- case 7: localpatch = kp_jawz[offset]; break; // Jawz
- case 8: localpatch = kp_selfpropelledbomb[offset]; break; // Self-Propelled Bomb
- case 9: localpatch = kp_shrink[offset]; break; // Shrink
- case 10: localpatch = localinv; break; // Invincibility
- case 11: localpatch = kp_eggman[offset]; break; // Eggman Monitor
- case 12: localpatch = kp_ballhog[offset]; break; // Ballhog
- case 13: localpatch = kp_thundershield[offset]; break; // Thunder Shield
- //case 14: localpatch = kp_pogospring[offset]; break; // Pogo Spring
- //case 15: localpatch = kp_kitchensink[offset]; break; // Kitchen Sink
- default: break;
+ case 0: // Sneaker
+ localpatch = kp_sneaker[offset];
+ //localcolor = SKINCOLOR_RASPBERRY;
+ break;
+ case 1: // Banana
+ localpatch = kp_banana[offset];
+ //localcolor = SKINCOLOR_YELLOW;
+ break;
+ case 2: // Orbinaut
+ localpatch = kp_orbinaut[3+offset];
+ //localcolor = SKINCOLOR_STEEL;
+ break;
+ case 3: // Mine
+ localpatch = kp_mine[offset];
+ //localcolor = SKINCOLOR_JET;
+ break;
+ case 4: // Grow
+ localpatch = kp_grow[offset];
+ //localcolor = SKINCOLOR_TEAL;
+ break;
+ case 5: // Hyudoro
+ localpatch = kp_hyudoro[offset];
+ //localcolor = SKINCOLOR_STEEL;
+ break;
+ case 6: // Rocket Sneaker
+ localpatch = kp_rocketsneaker[offset];
+ //localcolor = SKINCOLOR_TANGERINE;
+ break;
+ case 7: // Jawz
+ localpatch = kp_jawz[offset];
+ //localcolor = SKINCOLOR_JAWZ;
+ break;
+ case 8: // Self-Propelled Bomb
+ localpatch = kp_selfpropelledbomb[offset];
+ //localcolor = SKINCOLOR_JET;
+ break;
+ case 9: // Shrink
+ localpatch = kp_shrink[offset];
+ //localcolor = SKINCOLOR_ORANGE;
+ break;
+ case 10: // Invincibility
+ localpatch = localinv;
+ //localcolor = SKINCOLOR_GREY;
+ break;
+ case 11: // Eggman Monitor
+ localpatch = kp_eggman[offset];
+ //localcolor = SKINCOLOR_ROSE;
+ break;
+ case 12: // Ballhog
+ localpatch = kp_ballhog[offset];
+ //localcolor = SKINCOLOR_LILAC;
+ break;
+ case 13: // Thunder Shield
+ localpatch = kp_thundershield[offset];
+ //localcolor = SKINCOLOR_CYAN;
+ break;
+ /*case 14: // Pogo Spring
+ localpatch = kp_pogospring[offset];
+ localcolor = SKINCOLOR_TANGERINE;
+ break;
+ case 15: // Kitchen Sink
+ localpatch = kp_kitchensink[offset];
+ localcolor = SKINCOLOR_STEEL;
+ break;*/
+ default:
+ break;
}
}
else
@@ -6267,41 +6446,97 @@ static void K_drawKartItem(void)
switch(stplyr->kartstuff[k_itemtype])
{
- case KITEM_SNEAKER: localpatch = kp_sneaker[offset]; break;
- case KITEM_ROCKETSNEAKER: localpatch = kp_rocketsneaker[offset]; break;
- case KITEM_INVINCIBILITY: localpatch = localinv; localbg = kp_itembg[offset+1]; break;
- case KITEM_BANANA: localpatch = kp_banana[offset]; break;
- case KITEM_EGGMAN: localpatch = kp_eggman[offset]; break;
- case KITEM_ORBINAUT:
- localpatch = kp_orbinaut[(offset ? 4
- : min(stplyr->kartstuff[k_itemamount]-1, 3))];
+ case KITEM_SNEAKER:
+ localpatch = kp_sneaker[offset];
break;
- case KITEM_JAWZ: localpatch = kp_jawz[offset]; break;
- case KITEM_MINE: localpatch = kp_mine[offset]; break;
- case KITEM_BALLHOG: localpatch = kp_ballhog[offset]; break;
- case KITEM_SPB: localpatch = kp_selfpropelledbomb[offset]; localbg = kp_itembg[offset+1]; break;
- case KITEM_GROW: localpatch = kp_grow[offset]; break;
- case KITEM_SHRINK: localpatch = kp_shrink[offset]; break;
- case KITEM_THUNDERSHIELD: localpatch = kp_thundershield[offset]; localbg = kp_itembg[offset+1]; break;
- case KITEM_HYUDORO: localpatch = kp_hyudoro[offset]; break;
- case KITEM_POGOSPRING: localpatch = kp_pogospring[offset]; break;
- case KITEM_KITCHENSINK: localpatch = kp_kitchensink[offset]; break;
- case KITEM_SAD: localpatch = kp_sadface[offset]; break;
- default: return;
+ case KITEM_ROCKETSNEAKER:
+ localpatch = kp_rocketsneaker[offset];
+ break;
+ case KITEM_INVINCIBILITY:
+ localpatch = localinv;
+ localbg = kp_itembg[offset+1];
+ break;
+ case KITEM_BANANA:
+ localpatch = kp_banana[offset];
+ break;
+ case KITEM_EGGMAN:
+ localpatch = kp_eggman[offset];
+ break;
+ case KITEM_ORBINAUT:
+ localpatch = kp_orbinaut[(offset ? 4 : min(stplyr->kartstuff[k_itemamount]-1, 3))];
+ break;
+ case KITEM_JAWZ:
+ localpatch = kp_jawz[offset];
+ break;
+ case KITEM_MINE:
+ localpatch = kp_mine[offset];
+ break;
+ case KITEM_BALLHOG:
+ localpatch = kp_ballhog[offset];
+ break;
+ case KITEM_SPB:
+ localpatch = kp_selfpropelledbomb[offset];
+ localbg = kp_itembg[offset+1];
+ break;
+ case KITEM_GROW:
+ localpatch = kp_grow[offset];
+ break;
+ case KITEM_SHRINK:
+ localpatch = kp_shrink[offset];
+ break;
+ case KITEM_THUNDERSHIELD:
+ localpatch = kp_thundershield[offset];
+ localbg = kp_itembg[offset+1];
+ break;
+ case KITEM_HYUDORO:
+ localpatch = kp_hyudoro[offset];
+ break;
+ case KITEM_POGOSPRING:
+ localpatch = kp_pogospring[offset];
+ break;
+ case KITEM_KITCHENSINK:
+ localpatch = kp_kitchensink[offset];
+ break;
+ case KITEM_SAD:
+ localpatch = kp_sadface[offset];
+ break;
+ default:
+ return;
}
if (stplyr->kartstuff[k_itemheld] && !(leveltime & 1))
localpatch = kp_nodraw;
}
+
+ if (stplyr->kartstuff[k_itemblink] && (leveltime & 1))
+ {
+ colormode = TC_BLINK;
+
+ switch (stplyr->kartstuff[k_itemblinkmode])
+ {
+ case 2:
+ localcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
+ break;
+ case 1:
+ localcolor = SKINCOLOR_RED;
+ break;
+ default:
+ localcolor = SKINCOLOR_WHITE;
+ break;
+ }
+ }
}
+ if (localcolor != SKINCOLOR_NONE)
+ colmap = R_GetTranslationColormap(colormode, localcolor, 0);
+
V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, localbg);
// Then, the numbers:
if (stplyr->kartstuff[k_itemamount] >= numberdisplaymin && !stplyr->kartstuff[k_itemroulette])
{
V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, kp_itemmulsticker[offset]);
- V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, localpatch);
+ V_DrawFixedPatch(ITEM_X<kartstuff[k_itemamount]));
else
@@ -6311,7 +6546,7 @@ static void K_drawKartItem(void)
}
}
else
- V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, localpatch);
+ V_DrawFixedPatch(ITEM_X<kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback)
+ else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator)
{
UINT16 t = stplyr->kartstuff[k_comebacktimer]/(10*TICRATE);
INT32 txoff, adjust = (splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease
@@ -7762,7 +7997,7 @@ static void K_drawDistributionDebugger(void)
bestbumper = players[i].kartstuff[k_bumper];
}
- useodds = K_FindUseodds(stplyr, 0, pingame, bestbumper);
+ useodds = K_FindUseodds(stplyr, 0, pingame, bestbumper, (spbplace != -1 && stplyr->kartstuff[k_position] == spbplace+1));
for (i = 1; i < NUMKARTRESULTS; i++)
{
@@ -7811,10 +8046,10 @@ static void K_drawCheckpointDebugger(void)
if (stplyr != &players[displayplayer]) // only for p1
return;
- if ((numstarposts/2 + stplyr->starpostnum) >= numstarposts)
+ if (stplyr->starpostnum >= (numstarposts - (numstarposts/2)))
V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Can finish)", stplyr->starpostnum, numstarposts));
else
- V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Skip: %d)", stplyr->starpostnum, numstarposts, (numstarposts/2 + stplyr->starpostnum)));
+ V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Skip: %d)", stplyr->starpostnum, numstarposts, ((numstarposts/2) + stplyr->starpostnum)));
V_DrawString(8, 192, 0, va("Waypoint dist: Prev %d, Next %d", stplyr->kartstuff[k_prevcheck], stplyr->kartstuff[k_nextcheck]));
}
diff --git a/src/k_kart.h b/src/k_kart.h
index 8f8cd100..fed490db 100644
--- a/src/k_kart.h
+++ b/src/k_kart.h
@@ -24,12 +24,13 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master);
void K_RespawnChecker(player_t *player);
void K_KartMoveAnimation(player_t *player);
+void K_KartPlayerHUDUpdate(player_t *player);
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
void K_KartPlayerAfterThink(player_t *player);
void K_DoInstashield(player_t *player);
void K_SpawnBattlePoints(player_t *source, player_t *victim, UINT8 amount);
-void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem);
-void K_SquishPlayer(player_t *player, mobj_t *source);
+void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflictor, boolean trapitem);
+void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor);
void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor);
void K_StealBumper(player_t *player, player_t *victim, boolean force);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
@@ -48,6 +49,7 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source);
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
INT32 K_GetKartDriftSparkValue(player_t *player);
+void K_KartUpdatePosition(player_t *player);
void K_DropItems(player_t *player);
void K_StripItems(player_t *player);
void K_StripOther(player_t *player);
diff --git a/src/keys.h b/src/keys.h
index 654aa1d9..cf3a0d06 100644
--- a/src/keys.h
+++ b/src/keys.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_baselib.c b/src/lua_baselib.c
index 1c14093c..4d630d9e 100644
--- a/src/lua_baselib.c
+++ b/src/lua_baselib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -2190,13 +2190,16 @@ static int lib_kSpinPlayer(lua_State *L)
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *source = NULL;
INT32 type = (INT32)luaL_optinteger(L, 3, 0);
- boolean trapitem = lua_optboolean(L, 4);
+ mobj_t *inflictor = NULL;
+ boolean trapitem = lua_optboolean(L, 5);
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
- K_SpinPlayer(player, source, type, trapitem);
+ if (!lua_isnone(L, 4) && lua_isuserdata(L, 4))
+ inflictor = *((mobj_t **)luaL_checkudata(L, 4, META_MOBJ));
+ K_SpinPlayer(player, source, type, inflictor, trapitem);
return 0;
}
@@ -2204,12 +2207,15 @@ static int lib_kSquishPlayer(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *source = NULL;
+ mobj_t *inflictor = NULL;
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
- K_SquishPlayer(player, source);
+ if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
+ inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
+ K_SquishPlayer(player, source, inflictor);
return 0;
}
@@ -2248,7 +2254,7 @@ static int lib_kSpawnKartExplosion(lua_State *L)
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
fixed_t z = luaL_checkfixed(L, 3);
- fixed_t radius = (fixed_t)luaL_optinteger(L, 4, 32*FRACUNIT);
+ fixed_t radius = (fixed_t)luaL_optinteger(L, 4, 32*FRACUNIT);
INT32 number = (INT32)luaL_optinteger(L, 5, 32);
mobjtype_t type = luaL_optinteger(L, 6, MT_MINEEXPLOSION);
angle_t rotangle = luaL_optinteger(L, 7, 0);
@@ -2386,6 +2392,16 @@ static int lib_kGetKartDriftSparkValue(lua_State *L)
return 1;
}
+static int lib_kKartUpdatePosition(lua_State *L)
+{
+ player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
+ NOHUD
+ if (!player)
+ return LUA_ErrInvalid(L, "player_t");
+ K_KartUpdatePosition(player);
+ return 0;
+}
+
static int lib_kDropItems(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@@ -2677,6 +2693,7 @@ static luaL_Reg lib[] = {
{"K_RepairOrbitChain",lib_kRepairOrbitChain},
{"K_FindJawzTarget",lib_kFindJawzTarget},
{"K_GetKartDriftSparkValue",lib_kGetKartDriftSparkValue},
+ {"K_KartUpdatePosition",lib_kKartUpdatePosition},
{"K_DropItems",lib_kDropItems},
{"K_StripItems",lib_kStripItems},
{"K_StripOther",lib_kStripOther},
diff --git a/src/lua_blockmaplib.c b/src/lua_blockmaplib.c
new file mode 100644
index 00000000..dabbdd9f
--- /dev/null
+++ b/src/lua_blockmaplib.c
@@ -0,0 +1,266 @@
+// SONIC ROBO BLAST 2
+//-----------------------------------------------------------------------------
+// Copyright (C) 2016 by Iestyn "Monster Iestyn" Jealous.
+// Copyright (C) 2016 by Sonic Team Junior.
+//
+// This program is free software distributed under the
+// terms of the GNU General Public License, version 2.
+// See the 'LICENSE' file for more details.
+//-----------------------------------------------------------------------------
+/// \file lua_blockmaplib.c
+/// \brief blockmap library for Lua scripting
+
+#include "doomdef.h"
+#ifdef HAVE_BLUA
+#include "p_local.h"
+#include "r_main.h" // validcount
+#include "lua_script.h"
+#include "lua_libs.h"
+//#include "lua_hud.h" // hud_running errors
+
+static const char *const search_opt[] = {
+ "objects",
+ "lines",
+ NULL};
+
+// a quickly-made function pointer typedef used by lib_searchBlockmap...
+// return values:
+// 0 - normal, no interruptions
+// 1 - stop search through current block
+// 2 - stop search completely
+typedef UINT8 (*blockmap_func)(lua_State *, INT32, INT32, mobj_t *);
+
+static boolean blockfuncerror = false; // errors should only print once per search blockmap call
+
+// Helper function for "objects" search
+static UINT8 lib_searchBlockmap_Objects(lua_State *L, INT32 x, INT32 y, mobj_t *thing)
+{
+ mobj_t *mobj, *bnext = NULL;
+
+ if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
+ return 0;
+
+ // Check interaction with the objects in the blockmap.
+ for (mobj = blocklinks[y*bmapwidth + x]; mobj; mobj = bnext)
+ {
+ P_SetTarget(&bnext, mobj->bnext); // We want to note our reference to bnext here incase it is MF_NOTHINK and gets removed!
+ if (mobj == thing)
+ continue; // our thing just found itself, so move on
+ lua_pushvalue(L, 1); // push function
+ LUA_PushUserdata(L, thing, META_MOBJ);
+ LUA_PushUserdata(L, mobj, META_MOBJ);
+ if (lua_pcall(gL, 2, 1, 0)) {
+ if (!blockfuncerror || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ blockfuncerror = true;
+ return 0; // *shrugs*
+ }
+ if (!lua_isnil(gL, -1))
+ { // if nil, continue
+ if (lua_toboolean(gL, -1))
+ return 2; // stop whole search
+ else
+ return 1; // stop block search
+ }
+ lua_pop(gL, 1);
+ if (P_MobjWasRemoved(thing) // func just popped our thing, cannot continue.
+ || (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue.
+ {
+ P_SetTarget(&bnext, NULL);
+ return (P_MobjWasRemoved(thing)) ? 2 : 1;
+ }
+ }
+ return 0;
+}
+
+// Helper function for "lines" search
+static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *thing)
+{
+ INT32 offset;
+ const INT32 *list; // Big blockmap
+#ifdef POLYOBJECTS
+ polymaplink_t *plink; // haleyjd 02/22/06
+#endif
+ line_t *ld;
+
+ if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
+ return 0;
+
+ offset = y*bmapwidth + x;
+
+#ifdef POLYOBJECTS
+ // haleyjd 02/22/06: consider polyobject lines
+ plink = polyblocklinks[offset];
+
+ while (plink)
+ {
+ polyobj_t *po = plink->po;
+
+ if (po->validcount != validcount) // if polyobj hasn't been checked
+ {
+ size_t i;
+ po->validcount = validcount;
+
+ for (i = 0; i < po->numLines; ++i)
+ {
+ if (po->lines[i]->validcount == validcount) // line has been checked
+ continue;
+ po->lines[i]->validcount = validcount;
+
+ lua_pushvalue(L, 1);
+ LUA_PushUserdata(L, thing, META_MOBJ);
+ LUA_PushUserdata(L, po->lines[i], META_LINE);
+ if (lua_pcall(gL, 2, 1, 0)) {
+ if (!blockfuncerror || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ blockfuncerror = true;
+ return 0; // *shrugs*
+ }
+ if (!lua_isnil(gL, -1))
+ { // if nil, continue
+ if (lua_toboolean(gL, -1))
+ return 2; // stop whole search
+ else
+ return 1; // stop block search
+ }
+ lua_pop(gL, 1);
+ if (P_MobjWasRemoved(thing))
+ return 2;
+ }
+ }
+ plink = (polymaplink_t *)(plink->link.next);
+ }
+#endif
+
+ offset = *(blockmap + offset); // offset = blockmap[y*bmapwidth+x];
+
+ // First index is really empty, so +1 it.
+ for (list = blockmaplump + offset + 1; *list != -1; list++)
+ {
+ ld = &lines[*list];
+
+ if (ld->validcount == validcount)
+ continue; // Line has already been checked.
+
+ ld->validcount = validcount;
+
+ lua_pushvalue(L, 1);
+ LUA_PushUserdata(L, thing, META_MOBJ);
+ LUA_PushUserdata(L, ld, META_LINE);
+ if (lua_pcall(gL, 2, 1, 0)) {
+ if (!blockfuncerror || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ blockfuncerror = true;
+ return 0; // *shrugs*
+ }
+ if (!lua_isnil(gL, -1))
+ { // if nil, continue
+ if (lua_toboolean(gL, -1))
+ return 2; // stop whole search
+ else
+ return 1; // stop block search
+ }
+ lua_pop(gL, 1);
+ if (P_MobjWasRemoved(thing))
+ return 2;
+ }
+ return 0; // Everything was checked.
+}
+
+// The searchBlockmap function
+// arguments: searchBlockmap(searchtype, function, mobj, [x1, x2, y1, y2])
+// return value:
+// true = search completely uninteruppted,
+// false = searching of at least one block stopped mid-way (including if the whole search was stopped)
+static int lib_searchBlockmap(lua_State *L)
+{
+ int searchtype = luaL_checkoption(L, 1, "objects", search_opt);
+ int n;
+ mobj_t *mobj;
+ INT32 xl, xh, yl, yh, bx, by;
+ fixed_t x1, x2, y1, y2;
+ boolean retval = true;
+ UINT8 funcret = 0;
+ blockmap_func searchFunc;
+
+ lua_remove(L, 1); // remove searchtype, stack is now function, mobj, [x1, x2, y1, y2]
+ luaL_checktype(L, 1, LUA_TFUNCTION);
+
+ switch (searchtype)
+ {
+ case 0: // "objects"
+ default:
+ searchFunc = lib_searchBlockmap_Objects;
+ break;
+ case 1: // "lines"
+ searchFunc = lib_searchBlockmap_Lines;
+ break;
+ }
+
+ // the mobj we are searching around, the "calling" mobj we could say
+ mobj = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
+ if (!mobj)
+ return LUA_ErrInvalid(L, "mobj_t");
+
+ n = lua_gettop(L);
+
+ if (n > 2) // specific x/y ranges have been supplied
+ {
+ if (n < 6)
+ return luaL_error(L, "arguments 4 to 6 not all given (expected 4 fixed-point integers)");
+
+ x1 = luaL_checkfixed(L, 3);
+ x2 = luaL_checkfixed(L, 4);
+ y1 = luaL_checkfixed(L, 5);
+ y2 = luaL_checkfixed(L, 6);
+ }
+ else // mobj and function only - search around mobj's radius by default
+ {
+ fixed_t radius = mobj->radius + MAXRADIUS;
+ x1 = mobj->x - radius;
+ x2 = mobj->x + radius;
+ y1 = mobj->y - radius;
+ y2 = mobj->y + radius;
+ }
+ lua_settop(L, 2); // pop everything except function, mobj
+
+ xl = (unsigned)(x1 - bmaporgx)>>MAPBLOCKSHIFT;
+ xh = (unsigned)(x2 - bmaporgx)>>MAPBLOCKSHIFT;
+ yl = (unsigned)(y1 - bmaporgy)>>MAPBLOCKSHIFT;
+ yh = (unsigned)(y2 - bmaporgy)>>MAPBLOCKSHIFT;
+
+ BMBOUNDFIX(xl, xh, yl, yh);
+
+ blockfuncerror = false; // reset
+ validcount++;
+ for (bx = xl; bx <= xh; bx++)
+ for (by = yl; by <= yh; by++)
+ {
+ funcret = searchFunc(L, bx, by, mobj);
+ // return value of searchFunc determines searchFunc's return value and/or when to stop
+ if (funcret == 2){ // stop whole search
+ lua_pushboolean(L, false); // return false
+ return 1;
+ }
+ else if (funcret == 1) // search was interrupted for this block
+ retval = false; // this changes the return value, but doesn't stop the whole search
+ // else don't do anything, continue as normal
+ if (P_MobjWasRemoved(mobj)){ // ...unless the original object was removed
+ lua_pushboolean(L, false); // in which case we have to stop now regardless
+ return 1;
+ }
+ }
+ lua_pushboolean(L, retval);
+ return 1;
+}
+
+int LUA_BlockmapLib(lua_State *L)
+{
+ lua_register(L, "searchBlockmap", lib_searchBlockmap);
+ return 0;
+}
+
+#endif
diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c
index 366f0917..0ea0c809 100644
--- a/src/lua_consolelib.c
+++ b/src/lua_consolelib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_hook.h b/src/lua_hook.h
index 26b70570..2c9cd346 100644
--- a/src/lua_hook.h
+++ b/src/lua_hook.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -44,12 +44,18 @@ enum hook {
hook_HurtMsg,
hook_PlayerSpawn,
hook_PlayerQuit,
+ hook_ShouldSpin, //SRB2KART
+ hook_ShouldExplode, //SRB2KART
+ hook_ShouldSquish, //SRB2KART
+ hook_PlayerSpin, //SRB2KART
+ hook_PlayerExplode, //SRB2KART
+ hook_PlayerSquish, //SRB2KART
hook_MAX // last hook
};
extern const char *const hookNames[];
-void LUAh_MapChange(void); // Hook for map change (before load)
+void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load)
void LUAh_MapLoad(void); // Hook for map load
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
@@ -80,4 +86,11 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Ho
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
+UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
+UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
+UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
+
+boolean LUAh_PlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
+boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
+boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
#endif
diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c
index f06e28cd..13ad03d3 100644
--- a/src/lua_hooklib.c
+++ b/src/lua_hooklib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -55,6 +55,12 @@ const char *const hookNames[hook_MAX+1] = {
"HurtMsg",
"PlayerSpawn",
"PlayerQuit",
+ "ShouldSpin",
+ "ShouldExplode",
+ "ShouldSquish",
+ "PlayerSpin",
+ "PlayerExplode",
+ "PlayerSquish",
NULL
};
@@ -154,6 +160,12 @@ static int lib_addHook(lua_State *L)
*p = 0;
}
break;
+ case hook_ShouldSpin:
+ case hook_ShouldExplode:
+ case hook_ShouldSquish:
+ case hook_PlayerSpin:
+ case hook_PlayerExplode:
+ case hook_PlayerSquish:
default:
break;
}
@@ -195,6 +207,12 @@ static int lib_addHook(lua_State *L)
case hook_LinedefExecute:
lastp = &linedefexecutorhooks;
break;
+ case hook_ShouldSpin:
+ case hook_ShouldExplode:
+ case hook_ShouldSquish:
+ case hook_PlayerSpin:
+ case hook_PlayerExplode:
+ case hook_PlayerSquish:
default:
lastp = &roothook;
break;
@@ -315,14 +333,14 @@ boolean LUAh_PlayerHook(player_t *plr, enum hook which)
}
// Hook for map change (before load)
-void LUAh_MapChange(void)
+void LUAh_MapChange(INT16 mapnumber)
{
hook_p hookp;
if (!gL || !(hooksAvailable[hook_MapChange/8] & (1<<(hook_MapChange%8))))
return;
lua_settop(gL, 0);
- lua_pushinteger(gL, gamemap);
+ lua_pushinteger(gL, mapnumber);
for (hookp = roothook; hookp; hookp = hookp->next)
if (hookp->type == hook_MapChange)
@@ -953,7 +971,7 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
}
// Hook for player chat
-// Added the "mute" field. It's set to true if the message was supposed to be eaten by spam protection.
+// Added the "mute" field. It's set to true if the message was supposed to be eaten by spam protection.
// But for netgame consistency purposes, this hook is ran first reguardless, so this boolean allows for modders to adapt if they so desire.
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute)
{
@@ -987,7 +1005,7 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute)
if (mute)
lua_pushboolean(gL, true); // the message was supposed to be eaten by spamprotecc.
else
- lua_pushboolean(gL, false);
+ lua_pushboolean(gL, false);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
@@ -1108,4 +1126,268 @@ void LUAh_PlayerQuit(player_t *plr, int reason)
lua_settop(gL, 0);
}
+// Hook for K_SpinPlayer. Determines if yes or no we should get damaged reguardless of circumstances.
+UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no.
+ if (!gL || !(hooksAvailable[hook_ShouldSpin/8] & (1<<(hook_ShouldSpin%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to check for mobj type because it will always be MT_PLAYER in this case.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_ShouldSpin)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (!lua_isnil(gL, -1))
+ {
+ if (lua_toboolean(gL, -1))
+ shouldDamage = 1; // Force yes
+ else
+ shouldDamage = 2; // Force no
+ }
+ lua_pop(gL, 1);
+ }
+
+ lua_settop(gL, 0);
+ return shouldDamage;
+}
+
+// Hook for K_ExplodePlayer. Determines if yes or no we should get damaged reguardless of circumstances.
+UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no.
+ if (!gL || !(hooksAvailable[hook_ShouldExplode/8] & (1<<(hook_ShouldExplode%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to check for mobj type because it will always be MT_PLAYER in this case.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_ShouldExplode)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (!lua_isnil(gL, -1))
+ {
+ if (lua_toboolean(gL, -1))
+ shouldDamage = 1; // Force yes
+ else
+ shouldDamage = 2; // Force no
+ }
+ lua_pop(gL, 1);
+ }
+
+ lua_settop(gL, 0);
+ return shouldDamage;
+}
+
+// Hook for K_SquishPlayer. Determines if yes or no we should get damaged reguardless of circumstances.
+UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no.
+ if (!gL || !(hooksAvailable[hook_ShouldSquish/8] & (1<<(hook_ShouldSquish%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to check for mobj type because it will always be MT_PLAYER in this case.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_ShouldSquish)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (!lua_isnil(gL, -1))
+ {
+ if (lua_toboolean(gL, -1))
+ shouldDamage = 1; // Force yes
+ else
+ shouldDamage = 2; // Force no
+ }
+ lua_pop(gL, 1);
+ }
+
+ lua_settop(gL, 0);
+ return shouldDamage;
+}
+
+// Hook for K_SpinPlayer. This is used when the player has actually been spun out, but before anything has actually been done. This allows Lua to overwrite the behavior or to just perform actions.
+boolean LUAh_PlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ boolean hooked = false;
+ if (!gL || !(hooksAvailable[hook_PlayerSpin/8] & (1<<(hook_PlayerSpin%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to look for target->type because it will always be MT_PLAYER.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_PlayerSpin)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (lua_toboolean(gL, -1))
+ hooked = true;
+ lua_pop(gL, 1);
+ }
+ lua_settop(gL, 0);
+ return hooked;
+}
+
+// Hook for K_SquishPlayer. This is used when the player has actually been spun out, but before anything has actually been done. This allows Lua to overwrite the behavior or to just perform actions.
+boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ boolean hooked = false;
+ if (!gL || !(hooksAvailable[hook_PlayerSquish/8] & (1<<(hook_PlayerSquish%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to look for target->type because it will always be MT_PLAYER.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_PlayerSquish)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (lua_toboolean(gL, -1))
+ hooked = true;
+ lua_pop(gL, 1);
+ }
+ lua_settop(gL, 0);
+ return hooked;
+}
+
+// Hook for K_ExplodePlayer. This is used when the player has actually been spun out, but before anything has actually been done. This allows Lua to overwrite the behavior or to just perform actions.
+boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ boolean hooked = false;
+ if (!gL || !(hooksAvailable[hook_PlayerExplode/8] & (1<<(hook_PlayerExplode%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to look for target->type because it will always be MT_PLAYER.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_PlayerExplode)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (lua_toboolean(gL, -1))
+ hooked = true;
+ lua_pop(gL, 1);
+ }
+ lua_settop(gL, 0);
+ return hooked;
+}
+
#endif
diff --git a/src/lua_hud.h b/src/lua_hud.h
index 17281b4e..3216ab15 100644
--- a/src/lua_hud.h
+++ b/src/lua_hud.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2014-2016 by John "JTE" Muniz.
-// Copyright (C) 2014-2016 by Sonic Team Junior.
+// Copyright (C) 2014-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c
index f042e8f5..353aebb2 100644
--- a/src/lua_hudlib.c
+++ b/src/lua_hudlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2014-2016 by John "JTE" Muniz.
-// Copyright (C) 2014-2016 by Sonic Team Junior.
+// Copyright (C) 2014-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -515,8 +515,8 @@ static int libd_getColormap(lua_State *L)
else if (lua_type(L, 1) == LUA_TNUMBER) // skin number
{
skinnum = (INT32)luaL_checkinteger(L, 1);
- if (skinnum < TC_ALLWHITE || skinnum >= MAXSKINS)
- return luaL_error(L, "skin number %d is out of range (%d - %d)", skinnum, TC_ALLWHITE, MAXSKINS-1);
+ if (skinnum < TC_BLINK || skinnum >= MAXSKINS)
+ return luaL_error(L, "skin number %d is out of range (%d - %d)", skinnum, TC_BLINK, MAXSKINS-1);
}
else // skin name
{
diff --git a/src/lua_infolib.c b/src/lua_infolib.c
index f6bb7d30..9b22170f 100644
--- a/src/lua_infolib.c
+++ b/src/lua_infolib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_libs.h b/src/lua_libs.h
index 01345ee1..cb1cb49c 100644
--- a/src/lua_libs.h
+++ b/src/lua_libs.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -71,6 +71,7 @@ int LUA_PlayerLib(lua_State *L);
int LUA_SkinLib(lua_State *L);
int LUA_ThinkerLib(lua_State *L);
int LUA_MapLib(lua_State *L);
+int LUA_BlockmapLib(lua_State *L);
int LUA_HudLib(lua_State *L);
#endif
diff --git a/src/lua_maplib.c b/src/lua_maplib.c
index 655165e6..4dbdcf20 100644
--- a/src/lua_maplib.c
+++ b/src/lua_maplib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c
index 50a194c8..8c9d1006 100644
--- a/src/lua_mathlib.c
+++ b/src/lua_mathlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c
index 71bef8c7..34aba0a3 100644
--- a/src/lua_mobjlib.c
+++ b/src/lua_mobjlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c
index 1eed10b0..067124ba 100644
--- a/src/lua_playerlib.c
+++ b/src/lua_playerlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -246,8 +246,6 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->starpostz);
else if (fastcmp(field,"starpostnum"))
lua_pushinteger(L, plr->starpostnum);
- else if (fastcmp(field,"starpostcount"))
- lua_pushinteger(L, plr->starpostcount);
else if (fastcmp(field,"starposttime"))
lua_pushinteger(L, plr->starposttime);
else if (fastcmp(field,"starpostangle"))
@@ -519,8 +517,6 @@ static int player_set(lua_State *L)
plr->starpostz = (INT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starpostnum"))
plr->starpostnum = (INT32)luaL_checkinteger(L, 3);
- else if (fastcmp(field,"starpostcount"))
- plr->starpostcount = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starposttime"))
plr->starposttime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starpostangle"))
diff --git a/src/lua_script.c b/src/lua_script.c
index 0f5c64a5..34a26052 100644
--- a/src/lua_script.c
+++ b/src/lua_script.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -51,6 +51,7 @@ static lua_CFunction liblist[] = {
LUA_SkinLib, // skin_t, skins[]
LUA_ThinkerLib, // thinker_t
LUA_MapLib, // line_t, side_t, sector_t, subsector_t
+ LUA_BlockmapLib, // blockmap stuff
LUA_HudLib, // HUD stuff
NULL
};
@@ -173,6 +174,7 @@ static inline void LUA_LoadFile(MYFILE *f, char *name)
LUA_ClearState();
lua_pushinteger(gL, f->wad);
lua_setfield(gL, LUA_REGISTRYINDEX, "WAD");
+
if (luaL_loadbuffer(gL, f->data, f->size, va("@%s",name)) || lua_pcall(gL, 0, 0, 0)) {
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
lua_pop(gL,1);
@@ -192,17 +194,23 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
W_ReadLumpPwad(wad, lump, f.data);
f.curpos = f.data;
- len = strlen(wadfiles[wad]->filename);
- name = malloc(len+10);
- strcpy(name, wadfiles[wad]->filename);
- if (!fasticmp(&name[len - 4], ".lua")) {
- // If it's not a .lua file, copy the lump name in too.
- name[len] = '|';
- M_Memcpy(name+len+1, wadfiles[wad]->lumpinfo[lump].name, 8);
- name[len+9] = '\0';
+ len = strlen(wadfiles[wad]->filename); // length of file name
+
+ if (wadfiles[wad]->type == RET_LUA)
+ {
+ name = malloc(len+1);
+ strcpy(name, wadfiles[wad]->filename);
+ }
+ else // If it's not a .lua file, copy the lump name in too.
+ {
+ lumpinfo_t *lump_p = &wadfiles[wad]->lumpinfo[lump];
+ len += 1 + strlen(lump_p->name2); // length of file name, '|', and lump name
+ name = malloc(len+1);
+ sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->name2);
+ name[len] = '\0';
}
- LUA_LoadFile(&f, name);
+ LUA_LoadFile(&f, name); // actually load file!
free(name);
Z_Free(f.data);
diff --git a/src/lua_script.h b/src/lua_script.h
index 3b159234..f944149d 100644
--- a/src/lua_script.h
+++ b/src/lua_script.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c
index 7223e8db..8fdd92a5 100644
--- a/src/lua_skinlib.c
+++ b/src/lua_skinlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2014-2016 by John "JTE" Muniz.
-// Copyright (C) 2014-2016 by Sonic Team Junior.
+// Copyright (C) 2014-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_thinkerlib.c b/src/lua_thinkerlib.c
index aaa8435e..ae859d46 100644
--- a/src/lua_thinkerlib.c
+++ b/src/lua_thinkerlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_aatree.c b/src/m_aatree.c
index 6cb3a32c..f19fa1dc 100644
--- a/src/m_aatree.c
+++ b/src/m_aatree.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_aatree.h b/src/m_aatree.h
index eeaebca3..e7f1eba0 100644
--- a/src/m_aatree.h
+++ b/src/m_aatree.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_anigif.c b/src/m_anigif.c
index edb41f6a..4e68819b 100644
--- a/src/m_anigif.c
+++ b/src/m_anigif.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2013 by "Ninji".
-// Copyright (C) 2013-2016 by Sonic Team Junior.
+// Copyright (C) 2013-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_anigif.h b/src/m_anigif.h
index dbf7b10a..6d94ecf8 100644
--- a/src/m_anigif.h
+++ b/src/m_anigif.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 2013-2016 by Sonic Team Junior.
+// Copyright (C) 2013-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_argv.c b/src/m_argv.c
index 859fc902..e8bfdd3d 100644
--- a/src/m_argv.c
+++ b/src/m_argv.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -25,6 +25,10 @@ INT32 myargc;
*/
char **myargv;
+/** \brief did we alloc myargv ourselves?
+*/
+boolean myargmalloc = false;
+
/** \brief founded the parm
*/
static INT32 found;
@@ -176,6 +180,7 @@ void M_FindResponseFile(void)
free(file);
I_Error("Not enough memory to read response file");
}
+ myargmalloc = true; // mark as having been allocated by us
memset(myargv, 0, sizeof (char *) * MAXARGVS);
myargv[0] = firstargv;
@@ -198,14 +203,12 @@ void M_FindResponseFile(void)
k++;
} while (k < size);
- free(file);
-
for (k = 0; k < pindex; k++)
myargv[indexinfile++] = moreargs[k];
myargc = indexinfile;
// display arguments
- CONS_Printf(M_GetText("%d command-line args:\n"), myargc);
+ CONS_Printf(M_GetText("%d command-line args:\n"), myargc-1); // -1 so @ don't actually get counted for
for (k = 1; k < myargc; k++)
CONS_Printf("%s\n", myargv[k]);
diff --git a/src/m_argv.h b/src/m_argv.h
index 46ef9a2c..d654dcc1 100644
--- a/src/m_argv.h
+++ b/src/m_argv.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -19,6 +19,7 @@
//
extern INT32 myargc;
extern char **myargv;
+extern boolean myargmalloc;
// Returns the position of the given parameter in the arg list (0 if not found).
INT32 M_CheckParm(const char *check);
diff --git a/src/m_bbox.c b/src/m_bbox.c
index fb44b853..0c57de43 100644
--- a/src/m_bbox.c
+++ b/src/m_bbox.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_bbox.h b/src/m_bbox.h
index a11257b8..db5c2b4a 100644
--- a/src/m_bbox.h
+++ b/src/m_bbox.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_cheat.c b/src/m_cheat.c
index e57a85ae..9c53f901 100644
--- a/src/m_cheat.c
+++ b/src/m_cheat.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -97,7 +97,7 @@ static UINT8 cheatf_warp(void)
if (success)
{
- G_SetGameModified(false);
+ G_SaveGameData(true); //G_SetGameModified(false);
S_StartSound(0, sfx_kc42);
}
diff --git a/src/m_cheat.h b/src/m_cheat.h
index 3b5a1d0f..95c0060d 100644
--- a/src/m_cheat.h
+++ b/src/m_cheat.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_cond.c b/src/m_cond.c
index 5a9d4f2a..35eccd1c 100644
--- a/src/m_cond.c
+++ b/src/m_cond.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -535,6 +535,12 @@ UINT8 M_AnySecretUnlocked(void)
UINT8 M_SecretUnlocked(INT32 type)
{
INT32 i;
+
+#if 1
+ if (dedicated)
+ return true;
+#endif
+
for (i = 0; i < MAXUNLOCKABLES; ++i)
{
if (unlockables[i].type == type && unlockables[i].unlocked)
diff --git a/src/m_cond.h b/src/m_cond.h
index f48e6fbe..07e4480d 100644
--- a/src/m_cond.h
+++ b/src/m_cond.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_dllist.h b/src/m_dllist.h
index f19659cc..18f35114 100644
--- a/src/m_dllist.h
+++ b/src/m_dllist.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2005 by James Haley
-// Copyright (C) 2005-2016 by Sonic Team Junior.
+// Copyright (C) 2005-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_fixed.c b/src/m_fixed.c
index 01445738..d45bb70b 100644
--- a/src/m_fixed.c
+++ b/src/m_fixed.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -432,7 +432,7 @@ vector3_t *FV3_Cross(const vector3_t *a_1, const vector3_t *a_2, vector3_t *a_o)
//
vector3_t *FV3_ClosestPointOnLine(const vector3_t *Line, const vector3_t *p, vector3_t *out)
{
- // Determine t (the length of the vector from ‘Line[0]’ to ‘p’)
+ // Determine t (the length of the vector from �Line[0]� to �p�)
vector3_t c, V;
fixed_t t, d = 0;
FV3_SubEx(p, &Line[0], &c);
@@ -442,7 +442,7 @@ vector3_t *FV3_ClosestPointOnLine(const vector3_t *Line, const vector3_t *p, vec
d = FV3_Distance(&Line[0], &Line[1]);
t = FV3_Dot(&V, &c);
- // Check to see if ‘t’ is beyond the extents of the line segment
+ // Check to see if �t� is beyond the extents of the line segment
if (t < 0)
{
return FV3_Copy(out, &Line[0]);
@@ -452,7 +452,7 @@ vector3_t *FV3_ClosestPointOnLine(const vector3_t *Line, const vector3_t *p, vec
return FV3_Copy(out, &Line[1]);
}
- // Return the point between ‘Line[0]’ and ‘Line[1]’
+ // Return the point between �Line[0]� and �Line[1]�
FV3_Mul(&V, t);
return FV3_AddEx(&Line[0], &V, out);
diff --git a/src/m_fixed.h b/src/m_fixed.h
index 77382398..4609913b 100644
--- a/src/m_fixed.h
+++ b/src/m_fixed.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -75,7 +75,7 @@ typedef INT32 fixed_t;
:"=a" (ret) // eax is always the result and the first operand (%0,%1)
:"0" (a), "r" (b) // and %2 is what we use imull on with what in %1
, "I" (FRACBITS) // %3 holds FRACBITS (normally 16)
- :"%cc", "%edx" // edx and condition codes clobbered
+ :"cc", "%edx" // edx and condition codes clobbered
);
return ret;
}
diff --git a/src/m_menu.c b/src/m_menu.c
index 7d7c1fbf..907a6d74 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -3,7 +3,7 @@
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -180,9 +180,7 @@ INT16 startmap; // Mario, NiGHTS, or just a plain old normal game?
static INT16 itemOn = 1; // menu item skull is on, Hack by Tails 09-18-2002
static INT16 skullAnimCounter = 10; // skull animation counter
-static boolean setupcontrols_secondaryplayer;
-static boolean setupcontrols_thirdplayer;
-static boolean setupcontrols_fourthplayer;
+static UINT8 setupcontrolplayer;
static INT32 (*setupcontrols)[2]; // pointer to the gamecontrols of the player being edited
// shhh... what am I doing... nooooo!
@@ -304,6 +302,7 @@ static void M_Setup4PJoystickMenu(INT32 choice);
static void M_AssignJoystick(INT32 choice);
static void M_ChangeControl(INT32 choice);
+static void M_ResetControls(INT32 choice);
// Video & Sound
menu_t OP_VideoOptionsDef, OP_VideoModeDef;
@@ -311,17 +310,15 @@ menu_t OP_VideoOptionsDef, OP_VideoModeDef;
menu_t OP_OpenGLOptionsDef, OP_OpenGLFogDef, OP_OpenGLColorDef;
#endif
menu_t OP_SoundOptionsDef;
-static void M_ToggleSFX(INT32 choice);
-static void M_ToggleDigital(INT32 choice);
-#ifndef NO_MIDI
-static void M_ToggleMIDI(INT32 choice);
-#endif
//static void M_RestartAudio(void);
//Misc
menu_t /*OP_DataOptionsDef,*/ OP_ScreenshotOptionsDef, OP_EraseDataDef;
menu_t OP_HUDOptionsDef, OP_ChatOptionsDef;
menu_t OP_GameOptionsDef, OP_ServerOptionsDef;
+#ifndef NONET
+menu_t OP_AdvServerOptionsDef;
+#endif
//menu_t OP_NetgameOptionsDef, OP_GametypeOptionsDef;
menu_t OP_MonitorToggleDef;
static void M_ScreenshotOptions(INT32 choice);
@@ -1093,12 +1090,13 @@ static menuitem_t OP_ControlsMenu[] =
{IT_CALL | IT_STRING, NULL, "Player 3 Controls...", &M_Setup3PControlsMenu, 30},
{IT_CALL | IT_STRING, NULL, "Player 4 Controls...", &M_Setup4PControlsMenu, 40},
- {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 60},
+ {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 60},
};
static menuitem_t OP_AllControlsMenu[] =
{
{IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0},
+ {IT_CALL|IT_STRING, NULL, "Reset to defaults", M_ResetControls, 8},
//{IT_SPACE, NULL, NULL, NULL, 0},
{IT_HEADER, NULL, "Gameplay Controls", NULL, 0},
{IT_SPACE, NULL, NULL, NULL, 0},
@@ -1202,13 +1200,14 @@ static menuitem_t OP_JoystickSetMenu[] =
{IT_STRING | IT_CVAR, NULL, "Use Mouse", &cv_usemouse, 10},
- {IT_STRING | IT_CVAR, NULL, "Always MouseLook", &cv_alwaysfreelook, 30},
- {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove, 40},
- {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 50},
+ {IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook, 30},
+ {IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook, 40},
+ {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove, 50},
+ {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 60},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
- NULL, "Mouse X Speed", &cv_mousesens, 60},
+ NULL, "Mouse X Speed", &cv_mousesens, 70},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
- NULL, "Mouse Y Speed", &cv_mouseysens, 70},
+ NULL, "Mouse Y Speed", &cv_mouseysens, 80},
};
static menuitem_t OP_Mouse2OptionsMenu[] =
@@ -1216,13 +1215,14 @@ static menuitem_t OP_Mouse2OptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Use Mouse 2", &cv_usemouse2, 10},
{IT_STRING | IT_CVAR, NULL, "Second Mouse Serial Port",
&cv_mouse2port, 20},
- {IT_STRING | IT_CVAR, NULL, "Always MouseLook", &cv_alwaysfreelook2, 30},
- {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove2, 40},
- {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse2, 50},
+ {IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook2, 30},
+ {IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook2, 40},
+ {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove2, 50},
+ {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse2, 60},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
- NULL, "Mouse X Speed", &cv_mousesens2, 60},
+ NULL, "Mouse X Speed", &cv_mousesens2, 70},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
- NULL, "Mouse Y Speed", &cv_mouseysens2, 70},
+ NULL, "Mouse Y Speed", &cv_mouseysens2, 80},
};*/
static menuitem_t OP_VideoOptionsMenu[] =
@@ -1319,16 +1319,16 @@ static menuitem_t OP_OpenGLColorMenu[] =
static menuitem_t OP_SoundOptionsMenu[] =
{
- {IT_KEYHANDLER|IT_STRING, NULL, "SFX", M_ToggleSFX, 10},
+ {IT_STRING|IT_CVAR, NULL, "SFX", &cv_gamesounds, 10},
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
- NULL, "SFX Volume", &cv_soundvolume, 18},
+ NULL, "SFX Volume", &cv_soundvolume, 18},
- {IT_KEYHANDLER|IT_STRING, NULL, "Music", M_ToggleDigital, 30},
+ {IT_STRING|IT_CVAR, NULL, "Music", &cv_gamedigimusic, 30},
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
NULL, "Music Volume", &cv_digmusicvolume, 38},
/* -- :nonnathisshit:
- {IT_KEYHANDLER|IT_STRING, NULL, "MIDI", M_ToggleMIDI, 50},
+ {IT_STRING|IT_CVAR, NULL, "MIDI", &cv_gamemidimusic, 50},
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
NULL, "MIDI Volume", &cv_midimusicvolume, 58},
#ifdef PC_DOS
@@ -1345,7 +1345,7 @@ static menuitem_t OP_SoundOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 85},
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 95},
- {IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 110},
+ {IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 110},
};
/*static menuitem_t OP_DataOptionsMenu[] =
@@ -1480,15 +1480,34 @@ static menuitem_t OP_ServerOptionsMenu[] =
#ifndef NONET
{IT_STRING | IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 90},
{IT_STRING | IT_CVAR, NULL, "Allow Players to Join", &cv_allownewplayer, 100},
-#ifdef VANILLAJOINNEXTROUND
- {IT_STRING | IT_CVAR, NULL, "Join on Map Change", &cv_joinnextround, 110},
-#endif
+ {IT_STRING | IT_CVAR, NULL, "Allow Add-on Downloading", &cv_downloading, 110},
+ {IT_STRING | IT_CVAR, NULL, "Pause Permission", &cv_pause, 120},
+ {IT_STRING | IT_CVAR, NULL, "Mute All Chat", &cv_mute, 130},
- {IT_STRING | IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 110},
- {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 120},
+ {IT_SUBMENU|IT_STRING, NULL, "Advanced Options...", &OP_AdvServerOptionsDef,150},
#endif
};
+#ifndef NONET
+static menuitem_t OP_AdvServerOptionsMenu[] =
+{
+ {IT_STRING | IT_CVAR | IT_CV_STRING,
+ NULL, "Server Browser Address", &cv_masterserver, 10},
+
+ {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 40},
+ {IT_STRING | IT_CVAR, NULL, "Ping limit (ms)", &cv_maxping, 50},
+ {IT_STRING | IT_CVAR, NULL, "Connection timeout (tics)", &cv_nettimeout, 60},
+ {IT_STRING | IT_CVAR, NULL, "Join timeout (tics)", &cv_jointimeout, 70},
+
+ {IT_STRING | IT_CVAR, NULL, "Max. file transfer send (KB)", &cv_maxsend, 90},
+ {IT_STRING | IT_CVAR, NULL, "File transfer packet rate", &cv_downloadspeed, 100},
+
+ {IT_STRING | IT_CVAR, NULL, "Log join addresses", &cv_showjoinaddress, 120},
+ {IT_STRING | IT_CVAR, NULL, "Log resyncs", &cv_blamecfail, 130},
+ {IT_STRING | IT_CVAR, NULL, "Log file transfers", &cv_noticedownload, 140},
+};
+#endif
+
/*static menuitem_t OP_NetgameOptionsMenu[] =
{
{IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 10},
@@ -1973,6 +1992,9 @@ menu_t OP_ChatOptionsDef = DEFAULTMENUSTYLE("M_HUD", OP_ChatOptionsMenu, &OP_HUD
menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 30);
menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 24, 30);
+#ifndef NONET
+menu_t OP_AdvServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_AdvServerOptionsMenu, &OP_ServerOptionsDef, 24, 30);
+#endif
//menu_t OP_NetgameOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_NetgameOptionsMenu, &OP_ServerOptionsDef, 30, 30);
//menu_t OP_GametypeOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_GametypeOptionsMenu, &OP_ServerOptionsDef, 30, 30);
@@ -2312,7 +2334,19 @@ static void M_ChangeCvar(INT32 choice)
CV_Set(cv,s);
}
else
+ {
+#ifndef NONET
+ if (cv == &cv_nettimeout || cv == &cv_jointimeout)
+ choice *= (TICRATE/7);
+ else if (cv == &cv_maxsend)
+ choice *= 512;
+#ifdef NEWPING
+ else if (cv == &cv_maxping)
+ choice *= 50;
+#endif
+#endif
CV_AddValue(cv,choice);
+ }
}
static boolean M_ChangeStringCvar(INT32 choice)
@@ -4392,7 +4426,7 @@ static void M_Addons(INT32 choice)
addonsp[EXT_CFG] = W_CachePatchName("M_FCFG", PU_STATIC);
addonsp[EXT_WAD] = W_CachePatchName("M_FWAD", PU_STATIC);
addonsp[EXT_KART] = W_CachePatchName("M_FKART", PU_STATIC);
- //addonsp[EXT_PK3] = W_CachePatchName("M_FPK3", PU_STATIC);
+ addonsp[EXT_PK3] = W_CachePatchName("M_FPK3", PU_STATIC);
addonsp[EXT_SOC] = W_CachePatchName("M_FSOC", PU_STATIC);
addonsp[EXT_LUA] = W_CachePatchName("M_FLUA", PU_STATIC);
addonsp[NUM_EXT] = W_CachePatchName("M_FUNKN", PU_STATIC);
@@ -4838,7 +4872,7 @@ static void M_HandleAddons(INT32 choice)
case EXT_SOC:
case EXT_WAD:
case EXT_KART:
- //case EXT_PK3:
+ case EXT_PK3:
COM_BufAddText(va("addfile \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
break;
default:
@@ -7316,7 +7350,7 @@ void M_SortServerList(void)
#ifndef NONET
#ifdef UPDATE_ALERT
-static int M_CheckMODVersion(void)
+static boolean M_CheckMODVersion(void)
{
char updatestring[500];
const char *updatecheck = GetMODVersion();
@@ -7454,7 +7488,7 @@ static void M_StartServer(INT32 choice)
G_StopMetalDemo();
if (!cv_nextmap.value)
- CV_SetValue(&cv_nextmap, G_RandMap(G_TOLFlag(cv_newgametype.value), -1, false, false, 0, false)+1);
+ CV_SetValue(&cv_nextmap, G_RandMap(G_TOLFlag(cv_newgametype.value), -1, false, 0, false, NULL)+1);
if (cv_maxplayers.value < ssplayers+1)
CV_SetValue(&cv_maxplayers, ssplayers+1);
@@ -8514,10 +8548,10 @@ static void M_DrawJoystick(void)
{
M_DrawSaveLoadBorder(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i);
- if ((setupcontrols_fourthplayer && (i == cv_usejoystick4.value))
- || (setupcontrols_thirdplayer && (i == cv_usejoystick3.value))
- || (setupcontrols_secondaryplayer && (i == cv_usejoystick2.value))
- || (!(setupcontrols_secondaryplayer || setupcontrols_thirdplayer || setupcontrols_fourthplayer) && (i == cv_usejoystick.value)))
+ if ((setupcontrolplayer == 4 && (i == cv_usejoystick4.value))
+ || (setupcontrolplayer == 3 && (i == cv_usejoystick3.value))
+ || (setupcontrolplayer == 2 && (i == cv_usejoystick2.value))
+ || (setupcontrolplayer == 1 && (i == cv_usejoystick.value)))
V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i,recommendedflags,joystickInfo[i]);
else
V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i,0,joystickInfo[i]);
@@ -8550,42 +8584,39 @@ static void M_SetupJoystickMenu(INT32 choice)
static void M_Setup1PJoystickMenu(INT32 choice)
{
- setupcontrols_secondaryplayer = setupcontrols_thirdplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 1;
OP_JoystickSetDef.prevMenu = &OP_Joystick1Def;
M_SetupJoystickMenu(choice);
}
static void M_Setup2PJoystickMenu(INT32 choice)
{
- setupcontrols_secondaryplayer = true;
- setupcontrols_thirdplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 2;
OP_JoystickSetDef.prevMenu = &OP_Joystick2Def;
M_SetupJoystickMenu(choice);
}
static void M_Setup3PJoystickMenu(INT32 choice)
{
- setupcontrols_thirdplayer = true;
- setupcontrols_secondaryplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 3;
OP_JoystickSetDef.prevMenu = &OP_Joystick3Def;
M_SetupJoystickMenu(choice);
}
static void M_Setup4PJoystickMenu(INT32 choice)
{
- setupcontrols_fourthplayer = true;
- setupcontrols_secondaryplayer = setupcontrols_thirdplayer = false;
+ setupcontrolplayer = 3;
OP_JoystickSetDef.prevMenu = &OP_Joystick4Def;
M_SetupJoystickMenu(choice);
}
static void M_AssignJoystick(INT32 choice)
{
- if (setupcontrols_fourthplayer)
+ if (setupcontrolplayer == 4)
CV_SetValue(&cv_usejoystick4, choice);
- else if (setupcontrols_thirdplayer)
+ else if (setupcontrolplayer == 3)
CV_SetValue(&cv_usejoystick3, choice);
- else if (setupcontrols_secondaryplayer)
+ else if (setupcontrolplayer == 2)
CV_SetValue(&cv_usejoystick2, choice);
else
CV_SetValue(&cv_usejoystick, choice);
@@ -8598,7 +8629,7 @@ static void M_AssignJoystick(INT32 choice)
static void M_Setup1PControlsMenu(INT32 choice)
{
(void)choice;
- setupcontrols_secondaryplayer = setupcontrols_thirdplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 1;
setupcontrols = gamecontrol; // was called from main Options (for console player, then)
currentMenu->lastOn = itemOn;
@@ -8606,22 +8637,22 @@ static void M_Setup1PControlsMenu(INT32 choice)
OP_AllControlsMenu[0].itemaction = &OP_Joystick1Def;
// Unhide P1-only controls
- OP_AllControlsMenu[14].status = IT_CONTROL; // Chat
- //OP_AllControlsMenu[15].status = IT_CONTROL; // Team-chat
- OP_AllControlsMenu[15].status = IT_CONTROL; // Rankings
- OP_AllControlsMenu[16].status = IT_CONTROL; // Viewpoint
- // 17 is Reset Camera, 18 is Toggle Chasecam
- OP_AllControlsMenu[19].status = IT_CONTROL; // Pause
- OP_AllControlsMenu[20].status = IT_CONTROL; // Screenshot
- OP_AllControlsMenu[21].status = IT_CONTROL; // GIF
- OP_AllControlsMenu[22].status = IT_CONTROL; // System Menu
- OP_AllControlsMenu[23].status = IT_CONTROL; // Console
- /*OP_AllControlsMenu[24].status = IT_HEADER; // Spectator Controls header
- OP_AllControlsMenu[25].status = IT_SPACE; // Spectator Controls space
- OP_AllControlsMenu[26].status = IT_CONTROL; // Spectate
- OP_AllControlsMenu[27].status = IT_CONTROL; // Look Up
- OP_AllControlsMenu[28].status = IT_CONTROL; // Look Down
- OP_AllControlsMenu[29].status = IT_CONTROL; // Center View
+ OP_AllControlsMenu[15].status = IT_CONTROL; // Chat
+ //OP_AllControlsMenu[16].status = IT_CONTROL; // Team-chat
+ OP_AllControlsMenu[16].status = IT_CONTROL; // Rankings
+ OP_AllControlsMenu[17].status = IT_CONTROL; // Viewpoint
+ // 18 is Reset Camera, 19 is Toggle Chasecam
+ OP_AllControlsMenu[20].status = IT_CONTROL; // Pause
+ OP_AllControlsMenu[21].status = IT_CONTROL; // Screenshot
+ OP_AllControlsMenu[22].status = IT_CONTROL; // GIF
+ OP_AllControlsMenu[23].status = IT_CONTROL; // System Menu
+ OP_AllControlsMenu[24].status = IT_CONTROL; // Console
+ /*OP_AllControlsMenu[25].status = IT_HEADER; // Spectator Controls header
+ OP_AllControlsMenu[26].status = IT_SPACE; // Spectator Controls space
+ OP_AllControlsMenu[27].status = IT_CONTROL; // Spectate
+ OP_AllControlsMenu[28].status = IT_CONTROL; // Look Up
+ OP_AllControlsMenu[29].status = IT_CONTROL; // Look Down
+ OP_AllControlsMenu[30].status = IT_CONTROL; // Center View
*/
M_SetupNextMenu(&OP_AllControlsDef);
@@ -8630,8 +8661,7 @@ static void M_Setup1PControlsMenu(INT32 choice)
static void M_Setup2PControlsMenu(INT32 choice)
{
(void)choice;
- setupcontrols_secondaryplayer = true;
- setupcontrols_thirdplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 2;
setupcontrols = gamecontrolbis;
currentMenu->lastOn = itemOn;
@@ -8639,22 +8669,22 @@ static void M_Setup2PControlsMenu(INT32 choice)
OP_AllControlsMenu[0].itemaction = &OP_Joystick2Def;
// Hide P1-only controls
- OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat
- //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat
- OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings
- OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint
- // 17 is Reset Camera, 18 is Toggle Chasecam
- OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause
- OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot
- OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF
- OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu
- OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console
- /*OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header
- OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space
- OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate
- OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up
- OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down
- OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View
+ OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat
+ //OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Team-chat
+ OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings
+ OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Viewpoint
+ // 18 is Reset Camera, 19 is Toggle Chasecam
+ OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Pause
+ OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Screenshot
+ OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // GIF
+ OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // System Menu
+ OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Console
+ /*OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls header
+ OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectator Controls space
+ OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Spectate
+ OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Up
+ OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Look Down
+ OP_AllControlsMenu[30].status = IT_GRAYEDOUT2; // Center View
*/
M_SetupNextMenu(&OP_AllControlsDef);
@@ -8663,8 +8693,7 @@ static void M_Setup2PControlsMenu(INT32 choice)
static void M_Setup3PControlsMenu(INT32 choice)
{
(void)choice;
- setupcontrols_thirdplayer = true;
- setupcontrols_secondaryplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 3;
setupcontrols = gamecontrol3;
currentMenu->lastOn = itemOn;
@@ -8672,22 +8701,22 @@ static void M_Setup3PControlsMenu(INT32 choice)
OP_AllControlsMenu[0].itemaction = &OP_Joystick3Def;
// Hide P1-only controls
- OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat
- //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat
- OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings
- OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint
- // 17 is Reset Camera, 18 is Toggle Chasecam
- OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause
- OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot
- OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF
- OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu
- OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console
- /*OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header
- OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space
- OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate
- OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up
- OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down
- OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View
+ OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat
+ //OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Team-chat
+ OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings
+ OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Viewpoint
+ // 18 is Reset Camera, 19 is Toggle Chasecam
+ OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Pause
+ OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Screenshot
+ OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // GIF
+ OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // System Menu
+ OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Console
+ /*OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls header
+ OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectator Controls space
+ OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Spectate
+ OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Up
+ OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Look Down
+ OP_AllControlsMenu[30].status = IT_GRAYEDOUT2; // Center View
*/
M_SetupNextMenu(&OP_AllControlsDef);
@@ -8696,8 +8725,7 @@ static void M_Setup3PControlsMenu(INT32 choice)
static void M_Setup4PControlsMenu(INT32 choice)
{
(void)choice;
- setupcontrols_fourthplayer = true;
- setupcontrols_secondaryplayer = setupcontrols_thirdplayer = false;
+ setupcontrolplayer = 4;
setupcontrols = gamecontrol4;
currentMenu->lastOn = itemOn;
@@ -8705,22 +8733,22 @@ static void M_Setup4PControlsMenu(INT32 choice)
OP_AllControlsMenu[0].itemaction = &OP_Joystick4Def;
// Hide P1-only controls
- OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat
- //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat
- OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings
- OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint
- // 17 is Reset Camera, 18 is Toggle Chasecam
- OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause
- OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot
- OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF
- OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu
- OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console
- /*OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header
- OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space
- OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate
- OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up
- OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down
- OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View
+ OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat
+ //OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Team-chat
+ OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings
+ OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Viewpoint
+ // 18 is Reset Camera, 19 is Toggle Chasecam
+ OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Pause
+ OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Screenshot
+ OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // GIF
+ OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // System Menu
+ OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Console
+ /*OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls header
+ OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectator Controls space
+ OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Spectate
+ OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Up
+ OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Look Down
+ OP_AllControlsMenu[30].status = IT_GRAYEDOUT2; // Center View
*/
M_SetupNextMenu(&OP_AllControlsDef);
@@ -8783,10 +8811,8 @@ static void M_DrawControl(void)
M_DrawMenuTitle();
M_CentreText(28,
- (setupcontrols_fourthplayer ? "\x86""Set controls for ""\x82""Player 4" :
- (setupcontrols_thirdplayer ? "\x86""Set controls for ""\x82""Player 3" :
- (setupcontrols_secondaryplayer ? "\x86""Set controls for ""\x82""Player 2" :
- "\x86""Press ""\x82""ENTER""\x86"" to change, ""\x82""BACKSPACE""\x86"" to clear"))));
+ (setupcontrolplayer > 1 ? va("\x86""Set controls for ""\x82""Player %d", setupcontrolplayer) :
+ "\x86""Press ""\x82""ENTER""\x86"" to change, ""\x82""BACKSPACE""\x86"" to clear"));
if (i)
V_DrawCharacter(currentMenu->x - 16, y-(skullAnimCounter/5),
@@ -8845,6 +8871,7 @@ static void M_DrawControl(void)
#undef controlheight
static INT32 controltochange;
+static char controltochangetext[55];
static void M_ChangecontrolResponse(event_t *ev)
{
@@ -8852,8 +8879,8 @@ static void M_ChangecontrolResponse(event_t *ev)
INT32 found;
INT32 ch = ev->data1;
- // ESCAPE cancels
- if (ch != KEY_ESCAPE)
+ // ESCAPE cancels; dummy out PAUSE
+ if (ch != KEY_ESCAPE && ch != KEY_PAUSE)
{
switch (ev->type)
@@ -8903,20 +8930,41 @@ static void M_ChangecontrolResponse(event_t *ev)
setupcontrols[control][found] = ch-KEY_4JOY1+KEY_DBL4JOY1;
}
else
- {
- // check if change key1 or key2, or shuffle them along in a queue
- found = 0;
- if (setupcontrols[control][0] != KEY_NULL)
- {
- found++;
- if (setupcontrols[control][1] != KEY_NULL)
- setupcontrols[control][0] = setupcontrols[control][1];
- }
- G_CheckDoubleUsage(ch);
- setupcontrols[control][found] = ch;
- }
+ {
+ // check if change key1 or key2, or replace the two by the new
+ found = 0;
+ if (setupcontrols[control][0] == KEY_NULL)
+ found++;
+ if (setupcontrols[control][1] == KEY_NULL)
+ found++;
+ if (found == 2)
+ {
+ found = 0;
+ setupcontrols[control][1] = KEY_NULL; //replace key 1,clear key2
+ }
+ G_CheckDoubleUsage(ch);
+ setupcontrols[control][found] = ch;
+ }
S_StartSound(NULL, sfx_s221);
}
+ else if (ch == KEY_PAUSE)
+ {
+ static char tmp[155];
+ menu_t *prev = currentMenu->prevMenu;
+
+ if (controltochange == gc_pause)
+ sprintf(tmp, M_GetText("The \x82Pause Key \x80is enabled, but \nyou may select another key. \n\nHit another key for\n%s\nESC for Cancel"),
+ controltochangetext);
+ else
+ sprintf(tmp, M_GetText("The \x82Pause Key \x80is enabled, but \nit is not configurable. \n\nHit another key for\n%s\nESC for Cancel"),
+ controltochangetext);
+
+ M_StartMessage(tmp, M_ChangecontrolResponse, MM_EVENTHANDLER);
+ currentMenu->prevMenu = prev;
+
+ S_StartSound(NULL, sfx_s3k42);
+ return;
+ }
else
S_StartSound(NULL, sfx_s224);
@@ -8930,183 +8978,101 @@ static void M_ChangeControl(INT32 choice)
controltochange = currentMenu->menuitems[choice].alphaKey;
sprintf(tmp, M_GetText("Hit the new key for\n%s\nESC for Cancel"),
currentMenu->menuitems[choice].text);
+ strncpy(controltochangetext, currentMenu->menuitems[choice].text, 55);
M_StartMessage(tmp, M_ChangecontrolResponse, MM_EVENTHANDLER);
}
+static void M_ResetControlsResponse(INT32 ch)
+{
+ INT32 i;
+
+ if (ch != 'y' && ch != KEY_ENTER)
+ return;
+
+ // clear all controls
+ for (i = 0; i < num_gamecontrols; i++)
+ {
+ switch (setupcontrolplayer)
+ {
+ case 4:
+ G_ClearControlKeys(gamecontrol4, i);
+ break;
+ case 3:
+ G_ClearControlKeys(gamecontrol3, i);
+ break;
+ case 2:
+ G_ClearControlKeys(gamecontrolbis, i);
+ break;
+ case 1:
+ default:
+ G_ClearControlKeys(gamecontrol, i);
+ break;
+ }
+ }
+
+ // Setup original defaults
+ G_Controldefault(setupcontrolplayer);
+
+ // Setup gamepad option defaults (yucky)
+ switch (setupcontrolplayer)
+ {
+ case 4:
+ CV_StealthSet(&cv_usejoystick4, cv_usejoystick4.defaultvalue);
+ CV_StealthSet(&cv_turnaxis4, cv_turnaxis4.defaultvalue);
+ CV_StealthSet(&cv_moveaxis4, cv_moveaxis4.defaultvalue);
+ CV_StealthSet(&cv_brakeaxis4, cv_brakeaxis4.defaultvalue);
+ CV_StealthSet(&cv_aimaxis4, cv_aimaxis4.defaultvalue);
+ CV_StealthSet(&cv_lookaxis4, cv_lookaxis4.defaultvalue);
+ CV_StealthSet(&cv_fireaxis4, cv_fireaxis4.defaultvalue);
+ CV_StealthSet(&cv_driftaxis4, cv_driftaxis4.defaultvalue);
+ break;
+ case 3:
+ CV_StealthSet(&cv_usejoystick3, cv_usejoystick3.defaultvalue);
+ CV_StealthSet(&cv_turnaxis3, cv_turnaxis3.defaultvalue);
+ CV_StealthSet(&cv_moveaxis3, cv_moveaxis3.defaultvalue);
+ CV_StealthSet(&cv_brakeaxis3, cv_brakeaxis3.defaultvalue);
+ CV_StealthSet(&cv_aimaxis3, cv_aimaxis3.defaultvalue);
+ CV_StealthSet(&cv_lookaxis3, cv_lookaxis3.defaultvalue);
+ CV_StealthSet(&cv_fireaxis3, cv_fireaxis3.defaultvalue);
+ CV_StealthSet(&cv_driftaxis3, cv_driftaxis3.defaultvalue);
+ break;
+ case 2:
+ CV_StealthSet(&cv_usejoystick2, cv_usejoystick2.defaultvalue);
+ CV_StealthSet(&cv_turnaxis2, cv_turnaxis2.defaultvalue);
+ CV_StealthSet(&cv_moveaxis2, cv_moveaxis2.defaultvalue);
+ CV_StealthSet(&cv_brakeaxis2, cv_brakeaxis2.defaultvalue);
+ CV_StealthSet(&cv_aimaxis2, cv_aimaxis2.defaultvalue);
+ CV_StealthSet(&cv_lookaxis2, cv_lookaxis2.defaultvalue);
+ CV_StealthSet(&cv_fireaxis2, cv_fireaxis2.defaultvalue);
+ CV_StealthSet(&cv_driftaxis2, cv_driftaxis2.defaultvalue);
+ break;
+ case 1:
+ default:
+ CV_StealthSet(&cv_usejoystick, cv_usejoystick.defaultvalue);
+ CV_StealthSet(&cv_turnaxis, cv_turnaxis.defaultvalue);
+ CV_StealthSet(&cv_moveaxis, cv_moveaxis.defaultvalue);
+ CV_StealthSet(&cv_brakeaxis, cv_brakeaxis.defaultvalue);
+ CV_StealthSet(&cv_aimaxis, cv_aimaxis.defaultvalue);
+ CV_StealthSet(&cv_lookaxis, cv_lookaxis.defaultvalue);
+ CV_StealthSet(&cv_fireaxis, cv_fireaxis.defaultvalue);
+ CV_StealthSet(&cv_driftaxis, cv_driftaxis.defaultvalue);
+ break;
+ }
+
+ S_StartSound(NULL, sfx_s224);
+}
+
+static void M_ResetControls(INT32 choice)
+{
+ (void)choice;
+ M_StartMessage(va(M_GetText("Reset Player %d's controls to defaults?\n\n(Press 'Y' to confirm)\n"), setupcontrolplayer), M_ResetControlsResponse, MM_YESNO);
+}
+
// =====
// SOUND
// =====
-// Toggles sound systems in-game.
-static void M_ToggleSFX(INT32 choice)
-{
- switch (choice)
- {
- case KEY_DOWNARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn++;
- return;
-
- case KEY_UPARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn = currentMenu->numitems-1;
- return;
-
- case KEY_ESCAPE:
- currentMenu->lastOn = itemOn;
- if (currentMenu->prevMenu)
- M_SetupNextMenu(currentMenu->prevMenu);
- else
- M_ClearMenus(true);
- return;
- default:
- break;
- }
-
- if (sound_disabled)
- {
- sound_disabled = false;
- S_InitSfxChannels(cv_soundvolume.value);
- S_StartSound(NULL, sfx_s221);
- //M_StartMessage(M_GetText("SFX Enabled\n"), NULL, MM_NOTHING);
- }
- else
- {
- sound_disabled = true;
- S_StopSounds();
- //M_StartMessage(M_GetText("SFX Disabled\n"), NULL, MM_NOTHING);
- }
-}
-
-static void M_ToggleDigital(INT32 choice)
-{
- switch (choice)
- {
- case KEY_DOWNARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn++;
- return;
-
- case KEY_UPARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn--;
- return;
-
- case KEY_ESCAPE:
- currentMenu->lastOn = itemOn;
- if (currentMenu->prevMenu)
- M_SetupNextMenu(currentMenu->prevMenu);
- else
- M_ClearMenus(true);
- return;
- default:
- break;
- }
-
- if (digital_disabled)
- {
- digital_disabled = false;
- I_InitMusic();
- S_StopMusic();
- if (Playing())
- P_RestoreMusic(&players[consoleplayer]);
- else
- S_ChangeMusicInternal("titles", looptitle);
- //M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING);
- }
- else
- {
- digital_disabled = true;
-#ifndef NO_MIDI
- if (S_MusicType() != MU_MID)
- {
- if (midi_disabled)
- S_StopMusic();
- else
- {
- char mmusic[7];
- UINT16 mflags;
- boolean looping;
-
- if (S_MusicInfo(mmusic, &mflags, &looping) && S_MIDIExists(mmusic))
- {
- S_StopMusic();
- S_ChangeMusic(mmusic, mflags, looping);
- }
- else
- S_StopMusic();
- }
- }
-#else
- S_StopMusic();
-#endif
- //M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING);
- }
-}
-
-#ifndef NO_MIDI
-static void M_ToggleMIDI(INT32 choice)
-{
- switch (choice)
- {
- case KEY_DOWNARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn++;
- return;
-
- case KEY_UPARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn--;
- return;
-
- case KEY_ESCAPE:
- if (currentMenu->prevMenu)
- M_SetupNextMenu(currentMenu->prevMenu);
- else
- M_ClearMenus(true);
- return;
- default:
- break;
- }
-
- if (midi_disabled)
- {
- midi_disabled = false;
- I_InitMusic();
- if (Playing())
- P_RestoreMusic(&players[consoleplayer]);
- else
- S_ChangeMusicInternal("titles", looptitle);
- //M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING);
- }
- else
- {
- midi_disabled = true;
- if (S_MusicType() == MU_MID)
- {
- if (digital_disabled)
- S_StopMusic();
- else
- {
- char mmusic[7];
- UINT16 mflags;
- boolean looping;
-
- if (S_MusicInfo(mmusic, &mflags, &looping) && S_DigExists(mmusic))
- {
- S_StopMusic();
- S_ChangeMusic(mmusic, mflags, looping);
- }
- else
- S_StopMusic();
- }
- }
- //M_StartMessage(M_GetText("MIDI Music Disabled\n"), NULL, MM_NOTHING);
- }
-}
-#endif
-
/*static void M_RestartAudio(void)
{
COM_ImmedExecute("restartaudio");
diff --git a/src/m_menu.h b/src/m_menu.h
index dc99e6bb..79e14d4b 100644
--- a/src/m_menu.h
+++ b/src/m_menu.h
@@ -3,7 +3,7 @@
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_misc.c b/src/m_misc.c
index 0d84760f..603e3de0 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -475,7 +475,7 @@ void M_FirstLoadConfig(void)
}
// load default control
- G_Controldefault();
+ G_Controldefault(0);
// load config, make sure those commands doesnt require the screen...
COM_BufInsertText(va("exec \"%s\"\n", configfile));
diff --git a/src/m_misc.h b/src/m_misc.h
index ee0daf56..658028b4 100644
--- a/src/m_misc.h
+++ b/src/m_misc.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_queue.c b/src/m_queue.c
index daa7d7a2..a3aa0487 100644
--- a/src/m_queue.c
+++ b/src/m_queue.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2003 by James Haley
-// Copyright (C) 2003-2016 by Sonic Team Junior.
+// Copyright (C) 2003-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_queue.h b/src/m_queue.h
index 7e0d58d3..eebb2146 100644
--- a/src/m_queue.h
+++ b/src/m_queue.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2003 by James Haley
-// Copyright (C) 2003-2016 by Sonic Team Junior.
+// Copyright (C) 2003-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_random.c b/src/m_random.c
index 839b06e4..3d46f76b 100644
--- a/src/m_random.c
+++ b/src/m_random.c
@@ -3,7 +3,7 @@
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_random.h b/src/m_random.h
index 76dd9f1d..6187bcf1 100644
--- a/src/m_random.h
+++ b/src/m_random.h
@@ -3,7 +3,7 @@
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_swap.h b/src/m_swap.h
index 2352a0b2..2d42f613 100644
--- a/src/m_swap.h
+++ b/src/m_swap.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/mserv.c b/src/mserv.c
index 98849df4..f5c4fa88 100644
--- a/src/mserv.c
+++ b/src/mserv.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -206,7 +206,7 @@ static void ServerName_OnChange(void);
#define DEF_PORT "28900"
consvar_t cv_masterserver = {"masterserver", "ms.srb2.org:"DEF_PORT, CV_SAVE, NULL, MasterServer_OnChange, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_servername = {"servername", "SRB2Kart server", CV_SAVE, NULL, ServerName_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_servername = {"servername", "SRB2Kart server", CV_SAVE|CV_CALL|CV_NOINIT, NULL, ServerName_OnChange, 0, NULL, NULL, 0, 0, NULL};
INT16 ms_RoomId = -1;
@@ -557,9 +557,21 @@ const char *GetMODVersion(void)
msg.room = MODID; // Might as well use it for something.
sprintf(msg.buffer,"%d",MODVERSION);
if (MS_Write(&msg) < 0)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("Could not send to the Master Server\n"));
+ M_StartMessage(M_GetText("Could not send to the Master Server\n"), NULL, MM_NOTHING);
+ CloseConnection();
return NULL;
+ }
+
+ if (MS_Read(&msg) < 0)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("No reply from the Master Server\n"));
+ M_StartMessage(M_GetText("No reply from the Master Server\n"), NULL, MM_NOTHING);
+ CloseConnection();
+ return NULL;
+ }
- MS_Read(&msg);
CloseConnection();
if(strcmp(msg.buffer,"NULL") != 0)
@@ -587,9 +599,19 @@ void GetMODVersion_Console(void)
msg.room = MODID; // Might as well use it for something.
sprintf(msg.buffer,"%d",MODVERSION);
if (MS_Write(&msg) < 0)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("Could not send to the Master Server\n"));
+ CloseConnection();
return;
+ }
+
+ if (MS_Read(&msg) < 0)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("No reply from the Master Server\n"));
+ CloseConnection();
+ return;
+ }
- MS_Read(&msg);
CloseConnection();
if(strcmp(msg.buffer,"NULL") != 0)
@@ -956,8 +978,8 @@ void MasterClient_Ticker(void)
static void ServerName_OnChange(void)
{
- UnregisterServer();
- RegisterServer();
+ if (con_state == MSCS_REGISTERED)
+ AddToMasterServer(false);
}
static void MasterServer_OnChange(void)
diff --git a/src/mserv.h b/src/mserv.h
index c28ece26..09cd4f08 100644
--- a/src/mserv.h
+++ b/src/mserv.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_ceilng.c b/src/p_ceilng.c
index 27d73941..757edeba 100644
--- a/src/p_ceilng.c
+++ b/src/p_ceilng.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_enemy.c b/src/p_enemy.c
index 2e7df738..cc37c774 100644
--- a/src/p_enemy.c
+++ b/src/p_enemy.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -3977,6 +3977,9 @@ void A_GrenadeRing(mobj_t *actor)
return;
#endif
+ if (actor->state == &states[S_SSMINE_DEPLOY8])
+ explodedist = (3*explodedist)/2;
+
if (leveltime % 35 == 0)
S_StartSound(actor, actor->info->activesound);
@@ -4036,7 +4039,7 @@ void A_MineExplode(mobj_t *actor)
INT32 d;
INT32 locvar1 = var1;
mobjtype_t type;
- explodedist = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale);
+ explodedist = FixedMul((3*actor->info->painchance)/2, mapheaderinfo[gamemap-1]->mobj_scale);
#ifdef HAVE_BLUA
if (LUA_CallAction("A_MineExplode", actor))
return;
@@ -8353,11 +8356,35 @@ void A_SPBChase(mobj_t *actor)
if (actor->threshold) // Just fired, go straight.
{
+ actor->lastlook = -1;
+ spbplace = -1;
P_InstaThrust(actor, actor->angle, wspeed);
return;
}
- if (actor->extravalue1) // MODE: TARGETING
+ // Find the player with the best rank
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i] || players[i].spectator || players[i].exiting)
+ continue; // not in-game
+
+ if (!players[i].mo)
+ continue; // no mobj
+
+ if (players[i].mo->health <= 0)
+ continue; // dead
+
+ /*if (players[i].kartstuff[k_respawn])
+ continue;*/ // respawning
+
+ if (players[i].kartstuff[k_position] < bestrank)
+ {
+ bestrank = players[i].kartstuff[k_position];
+ player = &players[i];
+ }
+ }
+
+ if (actor->extravalue1 == 1) // MODE: TARGETING
{
if (actor->tracer && actor->tracer->health)
{
@@ -8367,10 +8394,22 @@ void A_SPBChase(mobj_t *actor)
// Maybe we want SPB to target an object later? IDK lol
if (actor->tracer->player) // 7/8ths max speed for Knuckles, 3/4ths max speed for min accel, exactly max speed for max accel
{
- if (!P_IsObjectOnGround(actor->tracer) && !actor->tracer->player->kartstuff[k_pogospring])
- defspeed = 7*actor->tracer->player->speed/8; // In the air you have no control; basically don't hit unless you make a near complete stop
+ actor->lastlook = actor->tracer->player-players; // Save the player num for death scumming...
+
+ if (!P_IsObjectOnGround(actor->tracer) /*&& !actor->tracer->player->kartstuff[k_pogospring]*/)
+ defspeed = (7*actor->tracer->player->speed)/8; // In the air you have no control; basically don't hit unless you make a near complete stop
else
defspeed = ((33 - actor->tracer->player->kartspeed) * K_GetKartSpeed(actor->tracer->player, false)) / 32;
+
+ defspeed -= (9*R_PointToDist2(0, 0, actor->tracer->player->cmomx, actor->tracer->player->cmomy))/8; // Be fairer on conveyors
+
+ // Switch targets if you're no longer 1st for long enough
+ if (actor->tracer->player->kartstuff[k_position] <= bestrank)
+ actor->extravalue2 = 7*TICRATE;
+ else if (actor->extravalue2-- <= 0)
+ actor->extravalue1 = 0; // back to SEEKING
+
+ spbplace = actor->tracer->player->kartstuff[k_position];
}
// Play the intimidating gurgle
@@ -8434,9 +8473,9 @@ void A_SPBChase(mobj_t *actor)
actor->z + (actor->height/2) + (P_RandomRange(-24,24) * actor->scale),
MT_FASTLINE);
fast->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy);
- //fast->momx = 3*actor->momx/4;
- //fast->momy = 3*actor->momy/4;
- //fast->momz = 3*actor->momz/4;
+ //fast->momx = (3*actor->momx)/4;
+ //fast->momy = (3*actor->momy)/4;
+ //fast->momz = (3*actor->momz)/4;
fast->color = SKINCOLOR_RED;
fast->colorized = true;
K_MatchGenericExtraFlags(fast, actor);
@@ -8447,33 +8486,36 @@ void A_SPBChase(mobj_t *actor)
else // Target's gone, return to SEEKING
{
P_SetTarget(&actor->tracer, NULL);
- actor->extravalue1 = 0; // Find someone new next tic
+ actor->extravalue1 = 2; // WAIT...
+ actor->extravalue2 = 52; // Slightly over the respawn timer length
return;
}
}
+ else if (actor->extravalue1 == 2) // MODE: WAIT...
+ {
+ actor->momx = actor->momy = actor->momz = 0; // Stoooop
+
+ if (actor->lastlook != -1 && playeringame[actor->lastlook] && players[actor->lastlook].mo)
+ {
+ spbplace = players[actor->lastlook].kartstuff[k_position];
+ if (actor->extravalue2-- <= 0)
+ {
+ P_SetTarget(&actor->tracer, players[actor->lastlook].mo);
+ actor->extravalue1 = 1; // TARGETING
+ actor->extravalue2 = 7*TICRATE;
+ actor->extravalue2 = 0;
+ }
+ }
+ else
+ {
+ actor->extravalue1 = 0; // SEEKING
+ actor->extravalue2 = 0;
+ spbplace = -1;
+ }
+ }
else // MODE: SEEKING
{
- // Find the player with the best rank
- for (i = 0; i < MAXPLAYERS; i++)
- {
- if (!playeringame[i] || players[i].spectator || players[i].exiting)
- continue; // not in-game
-
- if (!players[i].mo)
- continue; // no mobj
-
- if (players[i].mo->health <= 0)
- continue; // dead
-
- if (players[i].kartstuff[k_respawn])
- continue; // respawning
-
- if (players[i].kartstuff[k_position] < bestrank)
- {
- bestrank = players[i].kartstuff[k_position];
- player = &players[i];
- }
- }
+ actor->lastlook = -1; // Just make sure this is reset
// No one there?
if (player == NULL || !player->mo)
@@ -8490,11 +8532,13 @@ void A_SPBChase(mobj_t *actor)
#else
actor->momx = actor->momy = actor->momz = 0;
#endif
+ spbplace = -1;
return;
}
// Found someone, now get close enough to initiate the slaughter...
P_SetTarget(&actor->tracer, player->mo);
+ spbplace = bestrank;
dist = P_AproxDistance(P_AproxDistance(actor->x-actor->tracer->x, actor->y-actor->tracer->y), actor->z-actor->tracer->z);
@@ -8541,6 +8585,7 @@ void A_SPBChase(mobj_t *actor)
{
S_StartSound(actor, actor->info->attacksound); // Siren sound; might not need this anymore, but I'm keeping it for now just for debugging.
actor->extravalue1 = 1; // TARGET ACQUIRED
+ actor->extravalue2 = 7*TICRATE;
}
}
diff --git a/src/p_floor.c b/src/p_floor.c
index e723765c..752a66b7 100644
--- a/src/p_floor.c
+++ b/src/p_floor.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_inter.c b/src/p_inter.c
index 6a89159b..7c599016 100644
--- a/src/p_inter.c
+++ b/src/p_inter.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -497,9 +497,21 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
else if (special->target->player->kartstuff[k_comebackmode] == 1 && P_CanPickupItem(player, 1))
{
- mobj_t *poof = P_SpawnMobj(tmthing->x, tmthing->y, tmthing->z, MT_EXPLODE);
+ mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE);
S_StartSound(poof, special->info->seesound);
+ // Karma fireworks
+ for (i = 0; i < 5; i++)
+ {
+ mobj_t *firework = P_SpawnMobj(special->x, special->y, special->z, MT_KARMAFIREWORK);
+ firework->momx = (special->target->momx + toucher->momx) / 2;
+ firework->momy = (special->target->momy + toucher->momy) / 2;
+ firework->momz = (special->target->momz + toucher->momz) / 2;
+ P_Thrust(firework, FixedAngle((72*i)<scale);
+ P_SetObjectMomZ(firework, P_RandomRange(1,8)*special->scale, false);
+ firework->color = special->target->color;
+ }
+
special->target->player->kartstuff[k_comebackmode] = 0;
special->target->player->kartstuff[k_comebackpoints]++;
@@ -590,7 +602,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_RemoveMobj(special);
}
else
- K_SpinPlayer(player, special, 0, false);
+ K_SpinPlayer(player, NULL, 0, special, false);
return;
/*case MT_EERIEFOG:
special->frame &= ~FF_TRANS80;
@@ -629,6 +641,18 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
player->kartstuff[k_itemroulette] = 1;
player->kartstuff[k_roulettetype] = 1;
+ // Karma fireworks
+ for (i = 0; i < 5; i++)
+ {
+ mobj_t *firework = P_SpawnMobj(special->x, special->y, special->z, MT_KARMAFIREWORK);
+ firework->momx = toucher->momx;
+ firework->momy = toucher->momy;
+ firework->momz = toucher->momz;
+ P_Thrust(firework, FixedAngle((72*i)<scale);
+ P_SetObjectMomZ(firework, P_RandomRange(1,8)*special->scale, false);
+ firework->color = toucher->color;
+ }
+
S_StartSound(toucher, sfx_cdfm73); // they don't make this sound in the original game but it's nice to have a "reward" for good play
//special->momx = special->momy = special->momz = 0;
@@ -1416,8 +1440,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
//
// SRB2kart: make sure the player will have enough checkpoints to touch
- if (circuitmap
- && special->health >= (numstarposts/2 + player->starpostnum))
+ if (circuitmap && special->health >= ((numstarposts/2) + player->starpostnum))
{
// blatant reuse of a variable that's normally unused in circuit
if (!player->tossdelay)
@@ -1444,7 +1467,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
player->starpostz = special->z>>FRACBITS;
player->starpostangle = special->angle;
player->starpostnum = special->health;
- player->starpostcount++;
//S_StartSound(toucher, special->info->painsound);
return;
@@ -2033,6 +2055,28 @@ boolean P_CheckRacers(void)
}
}
+ if (!countdown) // Check to see if the winners have finished, to set countdown.
+ {
+ UINT8 numingame = 0, numexiting = 0;
+ UINT8 winningpos = 1;
+
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i] || players[i].spectator)
+ continue;
+ numingame++;
+ if (players[i].exiting)
+ numexiting++;
+ }
+
+ winningpos = max(1, numingame/2);
+ if (numingame % 2) // any remainder?
+ winningpos++;
+
+ if (numexiting >= winningpos)
+ countdown = (((netgame || multiplayer) ? cv_countdowntime.value : 30)*TICRATE) + 1; // 30 seconds to finish, get going!
+ }
+
return false;
}
@@ -3230,6 +3274,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return true;
}
+#ifdef HAVE_BLUA // Add this back here for ACTUAL NORMAL DAMAGE. The funny shit is that the player is barely ever "actually" damaged.
+ if (LUAh_MobjDamage(target, inflictor, source, damage))
+ return true;
+#endif
+
if (!force && inflictor && (inflictor->flags & MF_FIRE))
{
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)
@@ -3262,8 +3311,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
P_KillPlayer(player, source, damage);
else if (player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->powers[pw_flashing])
{
- K_DoInstashield(player);
- return false;
+ if (!force) // shoulddamage bypasses all of that.
+ {
+ K_DoInstashield(player);
+ return false;
+ }
}
else
{
@@ -3272,7 +3324,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|| inflictor->type == MT_SMK_THWOMP || inflictor->player))
{
player->kartstuff[k_sneakertimer] = 0;
- K_SpinPlayer(player, source, 1, false);
+ K_SpinPlayer(player, source, 1, inflictor, false);
damage = player->mo->health - 1;
P_RingDamage(player, inflictor, source, damage);
P_PlayerRingBurst(player, 5);
@@ -3284,7 +3336,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
else
{
- K_SpinPlayer(player, source, 0, false);
+ K_SpinPlayer(player, source, 0, inflictor, false);
}
return true;
}
diff --git a/src/p_lights.c b/src/p_lights.c
index 8aa2eedc..2da38d1d 100644
--- a/src/p_lights.c
+++ b/src/p_lights.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_local.h b/src/p_local.h
index a5e10757..ddcfd75e 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_map.c b/src/p_map.c
index aec6a036..115ea665 100644
--- a/src/p_map.c
+++ b/src/p_map.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -882,7 +882,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->state == &states[S_MINEEXPLOSION1])
K_ExplodePlayer(thing->player, tmthing->target, tmthing);
else
- K_SpinPlayer(thing->player, tmthing->target, 0, false);
+ K_SpinPlayer(thing->player, tmthing->target, 0, tmthing, false);
}
return true; // This doesn't collide with anything, but we want it to effect the player anyway.
@@ -915,7 +915,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->type == MT_PLAYER)
{
// Player Damage
- K_SpinPlayer(thing->player, tmthing->target, 0, (tmthing->type == MT_BANANA || tmthing->type == MT_BANANA_SHIELD));
+ K_SpinPlayer(thing->player, tmthing->target, 0, tmthing, (tmthing->type == MT_BANANA || tmthing->type == MT_BANANA_SHIELD));
// This Item Damage
if (tmthing->eflags & MFE_VERTICALFLIP)
@@ -1061,7 +1061,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true;
// Player Damage
- K_SpinPlayer(tmthing->player, thing->target, 0, (thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD));
+ K_SpinPlayer(tmthing->player, thing->target, 0, tmthing, (thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD));
// Other Item Damage
if (thing->eflags & MFE_VERTICALFLIP)
@@ -1091,7 +1091,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->state == &states[S_MINEEXPLOSION1])
K_ExplodePlayer(tmthing->player, thing->target, thing);
else
- K_SpinPlayer(tmthing->player, thing->target, 0, false);
+ K_SpinPlayer(tmthing->player, thing->target, 0, tmthing, false);
return true;
}
@@ -1349,14 +1349,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
// not (your direction) xor (stored direction)
// In other words, you can't u-turn and respawn rings near the drone.
if (pl->bonustime && (pl->pflags & PF_NIGHTSMODE) && (INT32)leveltime > droneobj->extravalue2 && (
- !(pl->anotherflyangle >= 90 && pl->anotherflyangle <= 270)
- ^ (droneobj->extravalue1 >= 90 && droneobj->extravalue1 <= 270)
+ !(pl->flyangle > 90 && pl->flyangle < 270)
+ ^ (droneobj->extravalue1 > 90 && droneobj->extravalue1 < 270)
))
{
// Reload all the fancy ring stuff!
P_ReloadRings();
}
- droneobj->extravalue1 = pl->anotherflyangle;
+ droneobj->extravalue1 = pl->flyangle;
droneobj->extravalue2 = (INT32)leveltime + TICRATE;
}*/
@@ -1423,11 +1423,11 @@ static boolean PIT_CheckThing(mobj_t *thing)
// Make sure they aren't able to damage you ANYWHERE along the Z axis, you have to be TOUCHING the person.
&& !(thing->z + thing->height < tmthing->z || thing->z > tmthing->z + tmthing->height))
{
-
- if (tmthing->scale > thing->scale + (FRACUNIT/8)) // SRB2kart - Handle squishes first!
- K_SquishPlayer(thing->player, tmthing);
- else if (thing->scale > tmthing->scale + (FRACUNIT/8))
- K_SquishPlayer(tmthing->player, thing);
+
+ if (tmthing->scale > thing->scale + (mapheaderinfo[gamemap-1]->mobj_scale/8)) // SRB2kart - Handle squishes first!
+ K_SquishPlayer(thing->player, tmthing, tmthing);
+ else if (thing->scale > tmthing->scale + (mapheaderinfo[gamemap-1]->mobj_scale/8))
+ K_SquishPlayer(tmthing->player, thing, tmthing);
else if (tmthing->player->kartstuff[k_invincibilitytimer] && !thing->player->kartstuff[k_invincibilitytimer]) // SRB2kart - Then invincibility!
P_DamageMobj(thing, tmthing, tmthing, 1);
else if (thing->player->kartstuff[k_invincibilitytimer] && !tmthing->player->kartstuff[k_invincibilitytimer])
@@ -1523,9 +1523,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true; // underneath
if (thing->player->kartstuff[k_squishedtimer] || thing->player->kartstuff[k_hyudorotimer]
- || thing->player->kartstuff[k_justbumped] || thing->scale > tmthing->scale + (FRACUNIT/8)
+ || thing->player->kartstuff[k_justbumped] || thing->scale > tmthing->scale + (mapheaderinfo[gamemap-1]->mobj_scale/8)
|| tmthing->player->kartstuff[k_squishedtimer] || tmthing->player->kartstuff[k_hyudorotimer]
- || tmthing->player->kartstuff[k_justbumped] || tmthing->scale > thing->scale + (FRACUNIT/8))
+ || tmthing->player->kartstuff[k_justbumped] || tmthing->scale > thing->scale + (mapheaderinfo[gamemap-1]->mobj_scale/8))
{
return true;
}
@@ -1543,7 +1543,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (G_BattleGametype() && tmthing->player->kartstuff[k_pogospring])
{
K_StealBumper(tmthing->player, thing->player, false);
- K_SpinPlayer(thing->player, tmthing, 0, false);
+ K_SpinPlayer(thing->player, tmthing, 0, tmthing, false);
}
}
else if (P_IsObjectOnGround(tmthing) && thing->momz < 0)
@@ -1552,7 +1552,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (G_BattleGametype() && thing->player->kartstuff[k_pogospring])
{
K_StealBumper(thing->player, tmthing->player, false);
- K_SpinPlayer(tmthing->player, thing, 0, false);
+ K_SpinPlayer(tmthing->player, thing, 0, thing, false);
}
}
else
@@ -1563,12 +1563,12 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->player->kartstuff[k_sneakertimer] && !(tmthing->player->kartstuff[k_sneakertimer]))
{
K_StealBumper(thing->player, tmthing->player, false);
- K_SpinPlayer(tmthing->player, thing, 0, false);
+ K_SpinPlayer(tmthing->player, thing, 0, tmthing, false);
}
else if (tmthing->player->kartstuff[k_sneakertimer] && !(thing->player->kartstuff[k_sneakertimer]))
{
K_StealBumper(tmthing->player, thing->player, false);
- K_SpinPlayer(thing->player, tmthing, 0, false);
+ K_SpinPlayer(thing->player, tmthing, 0, thing, false);
}
}
@@ -1664,7 +1664,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
// collide
if (tmthing->z < thing->z && thing->momz < 0)
- K_SquishPlayer(tmthing->player, thing);
+ K_SquishPlayer(tmthing->player, thing, thing);
else
{
if (thing->flags2 & MF2_AMBUSH)
@@ -2469,18 +2469,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
return true;
}
-//
-// CheckMissileImpact
-//
-static void CheckMissileImpact(mobj_t *mobj)
-{
- if (!(mobj->flags & MF_MISSILE) || !mobj->target)
- return;
-
- if (!mobj->target->player)
- return;
-}
-
// The highest the camera will "step up" onto another floor.
#define MAXCAMERASTEPMOVE MAXSTEPMOVE
@@ -2713,11 +2701,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
}
if (!P_CheckPosition(thing, tryx, tryy))
- {
- if (!P_MobjWasRemoved(thing))
- CheckMissileImpact(thing);
return false; // solid wall or thing
- }
if (!(thing->flags & MF_NOCLIP))
{
@@ -2749,7 +2733,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
if (tmceilingz - tmfloorz < thing->height)
{
- CheckMissileImpact(thing);
if (tmfloorthing)
tmhitthing = tmfloorthing;
return false; // doesn't fit
@@ -2760,16 +2743,10 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
if (thing->eflags & MFE_VERTICALFLIP)
{
if (thing->z < tmfloorz)
- {
- CheckMissileImpact(thing);
return false; // mobj must raise itself to fit
- }
}
else if (tmceilingz < thingtop)
- {
- CheckMissileImpact(thing);
return false; // mobj must lower itself to fit
- }
// Ramp test
if (maxstep > 0 && !(
@@ -2817,7 +2794,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
{
if (thingtop - tmceilingz > maxstep)
{
- CheckMissileImpact(thing);
if (tmfloorthing)
tmhitthing = tmfloorthing;
return false; // too big a step up
@@ -2825,18 +2801,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
}
else if (tmfloorz - thing->z > maxstep)
{
- CheckMissileImpact(thing);
if (tmfloorthing)
tmhitthing = tmfloorthing;
return false; // too big a step up
}
- if (tmfloorz > thing->z)
- {
- if (thing->flags & MF_MISSILE)
- CheckMissileImpact(thing);
- }
-
if (!allowdropoff && !(thing->flags & MF_FLOAT) && thing->type != MT_SKIM && !tmfloorthing)
{
if (thing->eflags & MFE_VERTICALFLIP)
@@ -3844,7 +3813,7 @@ void P_BouncePlayerMove(mobj_t *mo)
if (!mo->player)
return;
- if ((mo->eflags & MFE_JUSTBOUNCEDWALL) || (mo->player->spectator))
+ if (mo->player->spectator)
{
P_SlideMove(mo, true);
return;
@@ -3855,16 +3824,9 @@ void P_BouncePlayerMove(mobj_t *mo)
mmomx = mo->player->rmomx;
mmomy = mo->player->rmomy;
- if (mo->player->kartstuff[k_drift] != 0) // SRB2kart
- {
- mo->player->kartstuff[k_drift] = 0;
- mo->player->kartstuff[k_driftcharge] = 0;
- }
- else
- {
- mmomx = mo->momx;
- mmomy = mo->momy;
- }
+ mo->player->kartstuff[k_drift] = 0;
+ mo->player->kartstuff[k_driftcharge] = 0;
+ mo->player->kartstuff[k_pogospring] = 0;
// trace along the three leading corners
if (mo->momx > 0)
@@ -3905,8 +3867,16 @@ void P_BouncePlayerMove(mobj_t *mo)
if (bestslidefrac <= 0)
return;
- tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
- tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
+ if (mo->eflags & MFE_JUSTBOUNCEDWALL) // Stronger push-out
+ {
+ tmxmove = mmomx;
+ tmymove = mmomy;
+ }
+ else
+ {
+ tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
+ tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
+ }
{
mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP);
@@ -3919,7 +3889,6 @@ void P_BouncePlayerMove(mobj_t *mo)
S_StartSound(mo, sfx_s3k49);
}
- mo->player->kartstuff[k_pogospring] = 0; // Cancel pogo spring effect so you aren't shoved forward back into the wall you just bounced off
P_PlayerHitBounceLine(bestslideline);
mo->eflags |= MFE_JUSTBOUNCEDWALL;
@@ -3944,18 +3913,18 @@ void P_BounceMove(mobj_t *mo)
INT32 hitcount;
fixed_t mmomx = 0, mmomy = 0;
- if (mo->eflags & MFE_JUSTBOUNCEDWALL)
- {
- P_SlideMove(mo, true);
- return;
- }
-
if (mo->player)
{
P_BouncePlayerMove(mo);
return;
}
+ if (mo->eflags & MFE_JUSTBOUNCEDWALL)
+ {
+ P_SlideMove(mo, true);
+ return;
+ }
+
slidemo = mo;
hitcount = 0;
@@ -4270,7 +4239,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
if (!thing->player)
P_DamageMobj(thing, killer, killer, 10000);
else
- K_SquishPlayer(thing->player, killer); // SRB2kart - Squish instead of kill
+ K_SquishPlayer(thing->player, killer, killer); // SRB2kart - Squish instead of kill
}
}
}
diff --git a/src/p_maputl.c b/src/p_maputl.c
index 46b03338..1be57399 100644
--- a/src/p_maputl.c
+++ b/src/p_maputl.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_maputl.h b/src/p_maputl.h
index 3d74e927..1fcb68d4 100644
--- a/src/p_maputl.h
+++ b/src/p_maputl.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_mobj.c b/src/p_mobj.c
index 585bd016..3c32dc24 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -1413,6 +1413,9 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
case MT_SIGN:
gravityadd /= 8;
break;
+ case MT_KARMAFIREWORK:
+ gravityadd /= 3;
+ break;
default:
break;
}
@@ -1938,7 +1941,9 @@ void P_XYMovement(mobj_t *mo)
FIXED_TO_FLOAT(AngleFixed(newangle)),
FIXED_TO_FLOAT(AngleFixed(oldangle-newangle))
);*/
- } else if (predictedz-mo->z > abs(slopemom.z/2)) { // Now check if we were supposed to stick to this slope
+ // Sryder 2018-11-26: Don't launch here if it's a slope without physics, we stick to those like glue anyway
+ } else if (predictedz-mo->z > abs(slopemom.z/2)
+ && !(mo->standingslope->flags & SL_NOPHYSICS)) { // Now check if we were supposed to stick to this slope
//CONS_Printf("%d-%d > %d\n", (predictedz), (mo->z), (slopemom.z/2));
P_SlopeLaunch(mo);
}
@@ -2523,7 +2528,7 @@ static boolean P_ZMovement(mobj_t *mo)
if (P_MobjFlip(mo)*mom.z < 0)
{
// If going slower than a fracunit, just stop.
- if (abs(mom.z) < FixedMul(FRACUNIT, mo->scale))
+ if (abs(mom.z) < mo->scale)
{
mom.x = mom.y = mom.z = 0;
@@ -6832,6 +6837,18 @@ void P_MobjThinker(mobj_t *mobj)
P_SetScale(mobj->tracer, (mobj->tracer->destscale = mobj->scale));
}
+ // Do this in an easy way
+ if (mobj->target->player->kartstuff[k_itemroulette])
+ {
+ mobj->tracer->color = mobj->target->player->skincolor;
+ mobj->tracer->colorized = true;
+ }
+ else
+ {
+ mobj->tracer->color = SKINCOLOR_NONE;
+ mobj->tracer->colorized = false;
+ }
+
if (!(mobj->flags2 & MF2_DONTDRAW))
{
const INT32 numberdisplaymin = ((mobj->target->player->kartstuff[k_itemtype] == KITEM_ORBINAUT) ? 5 : 2);
@@ -7193,23 +7210,24 @@ void P_MobjThinker(mobj_t *mobj)
}
break;
case MT_FIREDITEM:
- {
- fixed_t x, y, z;
- if (mobj->movecount)
+ if (mobj->target && !P_MobjWasRemoved(mobj->target))
{
- x = mobj->target->x + P_ReturnThrustX(mobj->target, mobj->target->angle + mobj->movedir, mobj->target->radius + mobj->radius);
- y = mobj->target->y + P_ReturnThrustY(mobj->target, mobj->target->angle + mobj->movedir, mobj->target->radius + mobj->radius);
- z = mobj->target->z + mobj->target->height/3;
+ fixed_t x, y, z;
+ if (mobj->movecount)
+ {
+ x = mobj->target->x + P_ReturnThrustX(mobj->target, mobj->target->angle + mobj->movedir, mobj->target->radius + mobj->radius);
+ y = mobj->target->y + P_ReturnThrustY(mobj->target, mobj->target->angle + mobj->movedir, mobj->target->radius + mobj->radius);
+ z = mobj->target->z + mobj->target->height/3;
+ }
+ else
+ {
+ x = mobj->target->x;
+ y = mobj->target->y;
+ z = mobj->target->z + 80*(mapheaderinfo[gamemap-1]->mobj_scale);
+ }
+ P_TeleportMove(mobj, x, y, z);
}
- else
- {
- x = mobj->target->x;
- y = mobj->target->y;
- z = mobj->target->z + 80*(mapheaderinfo[gamemap-1]->mobj_scale);
- }
- P_TeleportMove(mobj, x, y, z);
break;
- }
default:
if (mobj->fuse)
{ // Scenery object fuse! Very basic!
@@ -7922,7 +7940,12 @@ void P_MobjThinker(mobj_t *mobj)
{
if (mobj->flags & MF_NOCLIPTHING)
{
- if (P_IsObjectOnGround(mobj))
+ if (P_CheckDeathPitCollide(mobj))
+ {
+ P_RemoveMobj(mobj);
+ return;
+ }
+ else if (P_IsObjectOnGround(mobj))
{
mobj->momx = 1;
mobj->momy = 0;
@@ -7968,11 +7991,15 @@ void P_MobjThinker(mobj_t *mobj)
mobj->sprite = SPR_ITEM;
mobj->frame = FF_FULLBRIGHT|FF_PAPERSPRITE;
break;
+ case KITEM_SPB:
+ case KITEM_SHRINK:
+ indirectitemcooldown = 20*TICRATE;
+ /* FALLTHRU */
default:
mobj->sprite = SPR_ITEM;
mobj->frame = FF_FULLBRIGHT|FF_PAPERSPRITE|(mobj->threshold);
break;
- }
+ }
break;
}
case MT_ORBINAUT:
@@ -8599,7 +8626,9 @@ void P_MobjThinker(mobj_t *mobj)
if (!S_SoundPlaying(mobj, mobj->info->attacksound))
S_StartSound(mobj, mobj->info->attacksound);
- if (mobj->extravalue2 > 70) // fire + smoke pillar
+ if (mobj->extravalue2 <= 8) // Short delay
+ mobj->extravalue2++; // flametimer
+ else // fire + smoke pillar
{
UINT8 i;
mobj_t *fire = P_SpawnMobj(mobj->x + (P_RandomRange(-32, 32)*mobj->scale), mobj->y + (P_RandomRange(-32, 32)*mobj->scale), mobj->z, MT_THOK);
@@ -8623,20 +8652,6 @@ void P_MobjThinker(mobj_t *mobj)
smoke->scalespeed = mobj->scale/24;
}
}
- else
- {
- mobj->extravalue2++; // flametimer
-
- if (mobj->extravalue2 > 8)
- {
- mobj_t *smoke = P_SpawnMobj(mobj->x + (P_RandomRange(-31, 31)*mobj->scale), mobj->y + (P_RandomRange(-31, 31)*mobj->scale),
- mobj->z + (P_RandomRange(0, 48)*mobj->scale), MT_THOK);
-
- P_SetMobjState(smoke, S_FZEROSMOKE1);
- smoke->tics += P_RandomRange(-3, 4);
- smoke->scale = mobj->scale*2;
- }
- }
break;
case MT_EZZPROPELLER:
if (mobj->hnext)
@@ -9081,6 +9096,22 @@ void P_MobjThinker(mobj_t *mobj)
}
}
break;
+ case MT_KARMAFIREWORK:
+ if (mobj->momz == 0)
+ {
+ P_RemoveMobj(mobj);
+ return;
+ }
+ else
+ {
+ mobj_t *trail = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_THOK);
+ P_SetMobjState(trail, S_KARMAFIREWORKTRAIL);
+ P_SetScale(trail, mobj->scale);
+ trail->destscale = 1;
+ trail->scalespeed = mobj->scale/12;
+ trail->color = mobj->color;
+ }
+ break;
//}
case MT_TURRET:
P_MobjCheckWater(mobj);
@@ -10378,6 +10409,9 @@ void P_RemoveMobj(mobj_t *mobj)
if (mobj->type == MT_SHADOW)
P_RemoveShadow(mobj);
+ if (mobj->type == MT_SPB)
+ spbplace = -1;
+
mobj->health = 0; // Just because
// unlink from sector and block lists
diff --git a/src/p_mobj.h b/src/p_mobj.h
index 640b7dbb..dfc8fc73 100644
--- a/src/p_mobj.h
+++ b/src/p_mobj.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_polyobj.c b/src/p_polyobj.c
index 9e670ecb..ed97f9ba 100644
--- a/src/p_polyobj.c
+++ b/src/p_polyobj.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2006 by James Haley
-// Copyright (C) 2006-2016 by Sonic Team Junior.
+// Copyright (C) 2006-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_polyobj.h b/src/p_polyobj.h
index 605215c0..60e996ca 100644
--- a/src/p_polyobj.h
+++ b/src/p_polyobj.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2006 by James Haley
-// Copyright (C) 2006-2016 by Sonic Team Junior.
+// Copyright (C) 2006-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_pspr.h b/src/p_pspr.h
index c0064bc3..e7426600 100644
--- a/src/p_pspr.h
+++ b/src/p_pspr.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_saveg.c b/src/p_saveg.c
index 1b4314b8..02f77457 100644
--- a/src/p_saveg.c
+++ b/src/p_saveg.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -198,7 +198,6 @@ static void P_NetArchivePlayers(void)
WRITEINT16(save_p, players[i].starposty);
WRITEINT16(save_p, players[i].starpostz);
WRITEINT32(save_p, players[i].starpostnum);
- WRITEINT32(save_p, players[i].starpostcount);
WRITEANGLE(save_p, players[i].starpostangle);
WRITEANGLE(save_p, players[i].angle_pos);
@@ -382,7 +381,6 @@ static void P_NetUnArchivePlayers(void)
players[i].starposty = READINT16(save_p);
players[i].starpostz = READINT16(save_p);
players[i].starpostnum = READINT32(save_p);
- players[i].starpostcount = READINT32(save_p);
players[i].starpostangle = READANGLE(save_p);
players[i].angle_pos = READANGLE(save_p);
@@ -507,16 +505,34 @@ static void P_NetArchiveWorld(void)
UINT8 *put;
// reload the map just to see difference
- const mapsector_t *ms;
- const mapsidedef_t *msd;
- const maplinedef_t *mld;
+ mapsector_t *ms;
+ mapsidedef_t *msd;
+ maplinedef_t *mld;
const sector_t *ss = sectors;
UINT8 diff, diff2;
WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD);
put = save_p;
- ms = W_CacheLumpNum(lastloadedmaplumpnum+ML_SECTORS, PU_CACHE);
+ if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
+ { // HACK: Open wad file rather quickly so we can get the data from the relevant lumps
+ UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
+ filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
+#define retrieve_mapdata(d, f)\
+ d = Z_Malloc((f)->size, PU_CACHE, NULL); \
+ M_Memcpy(d, wadData + (f)->filepos, (f)->size)
+ retrieve_mapdata(ms, fileinfo + ML_SECTORS);
+ retrieve_mapdata(mld, fileinfo + ML_LINEDEFS);
+ retrieve_mapdata(msd, fileinfo + ML_SIDEDEFS);
+#undef retrieve_mapdata
+ Z_Free(wadData); // we're done with this now
+ }
+ else // phew it's just a WAD
+ {
+ ms = W_CacheLumpNum(lastloadedmaplumpnum+ML_SECTORS, PU_CACHE);
+ mld = W_CacheLumpNum(lastloadedmaplumpnum+ML_LINEDEFS, PU_CACHE);
+ msd = W_CacheLumpNum(lastloadedmaplumpnum+ML_SIDEDEFS, PU_CACHE);
+ }
for (i = 0; i < numsectors; i++, ss++, ms++)
{
@@ -3287,6 +3303,7 @@ static void P_NetArchiveMisc(void)
WRITEUINT32(save_p, mapreset);
WRITEUINT8(save_p, nospectategrief);
WRITEUINT8(save_p, thwompsactive);
+ WRITESINT8(save_p, spbplace);
// Is it paused?
if (paused)
@@ -3393,6 +3410,7 @@ static inline boolean P_NetUnArchiveMisc(void)
mapreset = READUINT32(save_p);
nospectategrief = READUINT8(save_p);
thwompsactive = (boolean)READUINT8(save_p);
+ spbplace = READSINT8(save_p);
// Is it paused?
if (READUINT8(save_p) == 0x2f)
diff --git a/src/p_saveg.h b/src/p_saveg.h
index 3670d350..0992f118 100644
--- a/src/p_saveg.h
+++ b/src/p_saveg.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_setup.c b/src/p_setup.c
index 68cdc797..3bdb4d05 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -363,16 +363,13 @@ UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade)
* \param lump VERTEXES lump number.
* \sa ML_VERTEXES
*/
-static inline void P_LoadVertexes(lumpnum_t lumpnum)
+
+static inline void P_LoadRawVertexes(UINT8 *data, size_t i)
{
- UINT8 *data;
- size_t i;
mapvertex_t *ml;
vertex_t *li;
- // Determine number of lumps:
- // total lump length / vertex record length.
- numvertexes = W_LumpLength(lumpnum) / sizeof (mapvertex_t);
+ numvertexes = i / sizeof (mapvertex_t);
if (numvertexes <= 0)
I_Error("Level has no vertices"); // instead of crashing
@@ -380,9 +377,6 @@ static inline void P_LoadVertexes(lumpnum_t lumpnum)
// Allocate zone memory for buffer.
vertexes = Z_Calloc(numvertexes * sizeof (*vertexes), PU_LEVEL, NULL);
- // Load data into cache.
- data = W_CacheLumpNum(lumpnum, PU_STATIC);
-
ml = (mapvertex_t *)data;
li = vertexes;
@@ -392,11 +386,16 @@ static inline void P_LoadVertexes(lumpnum_t lumpnum)
li->x = SHORT(ml->x)<y = SHORT(ml->y)<numlights = 0;
li->rlights = NULL;
}
+}
+static void P_LoadSegs(lumpnum_t lumpnum)
+{
+ UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
+ P_LoadRawSegs(data, W_LumpLength(lumpnum));
Z_Free(data);
}
+
/** Loads the SSECTORS resource from a level.
*
* \param lump Lump number of the SSECTORS resource.
* \sa ::ML_SSECTORS
*/
-static inline void P_LoadSubsectors(lumpnum_t lumpnum)
+static inline void P_LoadRawSubsectors(void *data, size_t i)
{
- void *data;
- size_t i;
mapsubsector_t *ms;
subsector_t *ss;
- numsubsectors = W_LumpLength(lumpnum) / sizeof (mapsubsector_t);
+ numsubsectors = i / sizeof (mapsubsector_t);
if (numsubsectors <= 0)
I_Error("Level has no subsectors (did you forget to run it through a nodesbuilder?)");
ss = subsectors = Z_Calloc(numsubsectors * sizeof (*subsectors), PU_LEVEL, NULL);
- data = W_CacheLumpNum(lumpnum,PU_STATIC);
ms = (mapsubsector_t *)data;
@@ -519,7 +518,12 @@ static inline void P_LoadSubsectors(lumpnum_t lumpnum)
#endif
ss->validcount = 0;
}
+}
+static void P_LoadSubsectors(lumpnum_t lumpnum)
+{
+ UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
+ P_LoadRawSubsectors(data, W_LumpLength(lumpnum));
Z_Free(data);
}
@@ -653,29 +657,31 @@ INT32 P_CheckLevelFlat(const char *flatname)
return (INT32)i;
}
-static void P_LoadSectors(lumpnum_t lumpnum)
+// Sets up the ingame sectors structures.
+// Lumpnum is the lumpnum of a SECTORS lump.
+static void P_LoadRawSectors(UINT8 *data, size_t i)
{
- UINT8 *data;
- size_t i;
mapsector_t *ms;
sector_t *ss;
levelflat_t *foundflats;
- numsectors = W_LumpLength(lumpnum) / sizeof (mapsector_t);
+ // We count how many sectors we got.
+ numsectors = i / sizeof (mapsector_t);
if (numsectors <= 0)
I_Error("Level has no sectors");
+
+ // Allocate as much memory as we need into the global sectors table.
sectors = Z_Calloc(numsectors*sizeof (*sectors), PU_LEVEL, NULL);
- data = W_CacheLumpNum(lumpnum,PU_STATIC);
-
- //Fab : FIXME: allocate for whatever number of flats
- // 512 different flats per level should be plenty
+ // Allocate a big chunk of memory as big as our MAXLEVELFLATS limit.
+ //Fab : FIXME: allocate for whatever number of flats - 512 different flats per level should be plenty
foundflats = calloc(MAXLEVELFLATS, sizeof (*foundflats));
if (foundflats == NULL)
I_Error("Ran out of memory while loading sectors\n");
numlevelflats = 0;
+ // For each counted sector, copy the sector raw data from our cache pointer ms, to the global table pointer ss.
ms = (mapsector_t *)data;
ss = sectors;
for (i = 0; i < numsectors; i++, ss++, ms++)
@@ -683,9 +689,6 @@ static void P_LoadSectors(lumpnum_t lumpnum)
ss->floorheight = SHORT(ms->floorheight)<ceilingheight = SHORT(ms->ceilingheight)<floorpic = P_AddLevelFlat(ms->floorpic, foundflats);
ss->ceilingpic = P_AddLevelFlat(ms->ceilingpic, foundflats);
@@ -750,8 +753,6 @@ static void P_LoadSectors(lumpnum_t lumpnum)
#endif // ----- end special tricks -----
}
- Z_Free(data);
-
// set the sky flat num
skyflatnum = P_AddLevelFlat(SKYFLATNAME, foundflats);
@@ -763,22 +764,26 @@ static void P_LoadSectors(lumpnum_t lumpnum)
P_SetupLevelFlatAnims();
}
+static void P_LoadSectors(lumpnum_t lumpnum)
+{
+ UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
+ P_LoadRawSectors(data, W_LumpLength(lumpnum));
+ Z_Free(data);
+}
+
//
// P_LoadNodes
//
-static void P_LoadNodes(lumpnum_t lumpnum)
+static void P_LoadRawNodes(UINT8 *data, size_t i)
{
- UINT8 *data;
- size_t i;
UINT8 j, k;
mapnode_t *mn;
node_t *no;
- numnodes = W_LumpLength(lumpnum) / sizeof (mapnode_t);
+ numnodes = i / sizeof (mapnode_t);
if (numnodes <= 0)
I_Error("Level has no nodes");
nodes = Z_Calloc(numnodes * sizeof (*nodes), PU_LEVEL, NULL);
- data = W_CacheLumpNum(lumpnum, PU_STATIC);
mn = (mapnode_t *)data;
no = nodes;
@@ -796,7 +801,12 @@ static void P_LoadNodes(lumpnum_t lumpnum)
no->bbox[j][k] = SHORT(mn->bbox[j][k])<slopetype = ST_VERTICAL;
else if (!ld->dy)
ld->slopetype = ST_HORIZONTAL;
- else if (FixedDiv(ld->dy, ld->dx) > 0)
+ else if ((ld->dy > 0) == (ld->dx > 0))
ld->slopetype = ST_POSITIVE;
else
ld->slopetype = ST_NEGATIVE;
@@ -1236,7 +1243,7 @@ static void P_LoadLineDefs(lumpnum_t lumpnum)
if (ld->sidenum[j] != 0xffff && ld->sidenum[j] >= (UINT16)numsides)
{
ld->sidenum[j] = 0xffff;
- CONS_Debug(DBG_SETUP, "P_LoadLineDefs: linedef %s has out-of-range sidedef number\n", sizeu1(numlines-i-1));
+ CONS_Debug(DBG_SETUP, "P_LoadRawLineDefs: linedef %s has out-of-range sidedef number\n", sizeu1(numlines-i-1));
}
}
}
@@ -1251,14 +1258,14 @@ static void P_LoadLineDefs(lumpnum_t lumpnum)
{
ld->sidenum[0] = 0; // Substitute dummy sidedef for missing right side
// cph - print a warning about the bug
- CONS_Debug(DBG_SETUP, "P_LoadLineDefs: linedef %s missing first sidedef\n", sizeu1(numlines-i-1));
+ CONS_Debug(DBG_SETUP, "P_LoadRawLineDefs: linedef %s missing first sidedef\n", sizeu1(numlines-i-1));
}
if ((ld->sidenum[1] == 0xffff) && (ld->flags & ML_TWOSIDED))
{
ld->flags &= ~ML_TWOSIDED; // Clear 2s flag for missing left side
// cph - print a warning about the bug
- CONS_Debug(DBG_SETUP, "P_LoadLineDefs: linedef %s has two-sided flag set, but no second sidedef\n", sizeu1(numlines-i-1));
+ CONS_Debug(DBG_SETUP, "P_LoadRawLineDefs: linedef %s has two-sided flag set, but no second sidedef\n", sizeu1(numlines-i-1));
}
if (ld->sidenum[0] != 0xffff && ld->special)
@@ -1270,7 +1277,12 @@ static void P_LoadLineDefs(lumpnum_t lumpnum)
ld->polyobj = NULL;
#endif
}
+}
+static void P_LoadLineDefs(lumpnum_t lumpnum)
+{
+ UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
+ P_LoadRawLineDefs(data, W_LumpLength(lumpnum));
Z_Free(data);
}
@@ -1372,22 +1384,24 @@ static void P_LoadLineDefs2(void)
}
}
-//
-// P_LoadSideDefs
-//
-static inline void P_LoadSideDefs(lumpnum_t lumpnum)
+
+
+static inline void P_LoadRawSideDefs(size_t i)
{
- numsides = W_LumpLength(lumpnum) / sizeof (mapsidedef_t);
+ numsides = i / sizeof (mapsidedef_t);
if (numsides <= 0)
I_Error("Level has no sidedefs");
sides = Z_Calloc(numsides * sizeof (*sides), PU_LEVEL, NULL);
}
-// Delay loading texture names until after loaded linedefs.
-
-static void P_LoadSideDefs2(lumpnum_t lumpnum)
+static inline void P_LoadSideDefs(lumpnum_t lumpnum)
+{
+ P_LoadRawSideDefs(W_LumpLength(lumpnum));
+}
+
+
+static void P_LoadRawSideDefs2(void *data)
{
- UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
UINT16 i;
INT32 num;
@@ -1405,7 +1419,7 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
if (sector_num >= numsectors)
{
- CONS_Debug(DBG_SETUP, "P_LoadSideDefs2: sidedef %u has out-of-range sector num %u\n", i, sector_num);
+ CONS_Debug(DBG_SETUP, "P_LoadRawSideDefs2: sidedef %u has out-of-range sector num %u\n", i, sector_num);
sector_num = 0;
}
sd->sector = sec = §ors[sector_num];
@@ -1547,6 +1561,8 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
sd->text[6] = 0;
break;
}
+
+ case 4: // Speed pad parameters
case 414: // Play SFX
{
sd->toptexture = sd->midtexture = sd->bottomtexture = 0;
@@ -1560,6 +1576,9 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
break;
}
+ case 9: // Mace parameters
+ case 14: // Bustable block parameters
+ case 15: // Fan particle spawner parameters
case 425: // Calls P_SetMobjState on calling mobj
case 434: // Custom Power
case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors
@@ -1614,11 +1633,18 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
break;
}
}
-
- Z_Free(data);
R_ClearTextureNumCache(true);
}
+// Delay loading texture names until after loaded linedefs.
+static void P_LoadSideDefs2(lumpnum_t lumpnum)
+{
+ UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
+ P_LoadRawSideDefs2(data);
+ Z_Free(data);
+}
+
+
static boolean LineInBlock(fixed_t cx1, fixed_t cy1, fixed_t cx2, fixed_t cy2, fixed_t bx1, fixed_t by1)
{
fixed_t bbox[4];
@@ -1874,6 +1900,30 @@ static void P_CreateBlockMap(void)
}
}
+// Split from P_LoadBlockMap for convenience
+// -- Monster Iestyn 08/01/18
+static void P_ReadBlockMapLump(INT16 *wadblockmaplump, size_t count)
+{
+ size_t i;
+ blockmaplump = Z_Calloc(sizeof (*blockmaplump) * count, PU_LEVEL, NULL);
+
+ // killough 3/1/98: Expand wad blockmap into larger internal one,
+ // by treating all offsets except -1 as unsigned and zero-extending
+ // them. This potentially doubles the size of blockmaps allowed,
+ // because Doom originally considered the offsets as always signed.
+
+ blockmaplump[0] = SHORT(wadblockmaplump[0]);
+ blockmaplump[1] = SHORT(wadblockmaplump[1]);
+ blockmaplump[2] = (INT32)(SHORT(wadblockmaplump[2])) & 0xffff;
+ blockmaplump[3] = (INT32)(SHORT(wadblockmaplump[3])) & 0xffff;
+
+ for (i = 4; i < count; i++)
+ {
+ INT16 t = SHORT(wadblockmaplump[i]); // killough 3/1/98
+ blockmaplump[i] = t == -1 ? (INT32)-1 : (INT32) t & 0xffff;
+ }
+}
+
//
// P_LoadBlockMap
//
@@ -1900,38 +1950,20 @@ static boolean P_LoadBlockMap(lumpnum_t lumpnum)
return false;
{
- size_t i;
INT16 *wadblockmaplump = malloc(count); //INT16 *wadblockmaplump = W_CacheLumpNum (lump, PU_LEVEL);
-
- if (wadblockmaplump) W_ReadLump(lumpnum, wadblockmaplump);
- else return false;
+ if (!wadblockmaplump)
+ return false;
+ W_ReadLump(lumpnum, wadblockmaplump);
count /= 2;
- blockmaplump = Z_Calloc(sizeof (*blockmaplump) * count, PU_LEVEL, 0);
-
- // killough 3/1/98: Expand wad blockmap into larger internal one,
- // by treating all offsets except -1 as unsigned and zero-extending
- // them. This potentially doubles the size of blockmaps allowed,
- // because Doom originally considered the offsets as always signed.
-
- blockmaplump[0] = SHORT(wadblockmaplump[0]);
- blockmaplump[1] = SHORT(wadblockmaplump[1]);
- blockmaplump[2] = (INT32)(SHORT(wadblockmaplump[2])) & 0xffff;
- blockmaplump[3] = (INT32)(SHORT(wadblockmaplump[3])) & 0xffff;
-
- for (i = 4; i < count; i++)
- {
- INT16 t = SHORT(wadblockmaplump[i]); // killough 3/1/98
- blockmaplump[i] = t == -1 ? (INT32)-1 : (INT32) t & 0xffff;
- }
-
+ P_ReadBlockMapLump(wadblockmaplump, count);
free(wadblockmaplump);
-
- bmaporgx = blockmaplump[0]<= 0x20000)
+ return false;
+
+ CONS_Printf("Reading blockmap lump for pk3...\n");
+
+ // no need to malloc anything, assume the data is uncompressed for now
+ count /= 2;
+ P_ReadBlockMapLump((INT16 *)data, count);
+
+ bmaporgx = blockmaplump[0]<infotableofs);
+ fileinfo += ML_THINGS; // we only need the THINGS lump
+ P_PrepareRawThings(wadData + fileinfo->filepos, fileinfo->size);
+ Z_Free(wadData); // we're done with this now
+ }
+ else // phew it's just a WAD
+ P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
P_LoadThings();
P_SpawnSecretItems(true);
@@ -2796,7 +2908,12 @@ boolean P_SetupLevel(boolean skipprecip)
}
// internal game map
- lastloadedmaplumpnum = W_GetNumForName(maplumpname = G_BuildMapName(gamemap));
+ maplumpname = G_BuildMapName(gamemap);
+ //lastloadedmaplumpnum = LUMPERROR;
+ lastloadedmaplumpnum = W_CheckNumForName(maplumpname);
+
+ if (lastloadedmaplumpnum == INT16_MAX)
+ I_Error("Map %s not found.\n", maplumpname);
R_ReInitColormaps(mapheaderinfo[gamemap-1]->palette,
(encoremode ? W_CheckNumForName(va("%sE", maplumpname)) : LUMPERROR));
@@ -2807,38 +2924,93 @@ boolean P_SetupLevel(boolean skipprecip)
P_MakeMapMD5(lastloadedmaplumpnum, &mapmd5);
- // note: most of this ordering is important
- loadedbm = P_LoadBlockMap(lastloadedmaplumpnum + ML_BLOCKMAP);
+ // HACK ALERT: Cache the WAD, get the map data into the tables, free memory.
+ // As it is implemented right now, we're assuming an uncompressed WAD.
+ // (As in, a normal PWAD, not ZWAD or anything. The lump itself can be compressed.)
+ // We're not accounting for extra lumps and scrambled lump positions. Any additional data will cause an error.
+ if (W_IsLumpWad(lastloadedmaplumpnum))
+ {
+ // Remember that we're assuming that the WAD will have a specific set of lumps in a specific order.
+ UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
+ //filelump_t *fileinfo = wadData + ((wadinfo_t *)wadData)->infotableofs;
+ filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
+ UINT32 numlumps = ((wadinfo_t *)wadData)->numlumps;
- P_LoadVertexes(lastloadedmaplumpnum + ML_VERTEXES);
- P_LoadSectors(lastloadedmaplumpnum + ML_SECTORS);
+ if (numlumps < ML_REJECT) // at least 9 lumps should be in the wad for a map to be loaded
+ {
+ I_Error("Bad WAD file for map %s!\n", maplumpname);
+ }
- P_LoadSideDefs(lastloadedmaplumpnum + ML_SIDEDEFS);
+ if (numlumps > ML_BLOCKMAP) // enough room for a BLOCKMAP lump at least
+ {
+ loadedbm = P_LoadRawBlockMap(
+ wadData + (fileinfo + ML_BLOCKMAP)->filepos,
+ (fileinfo + ML_BLOCKMAP)->size,
+ (fileinfo + ML_BLOCKMAP)->name);
+ }
+ P_LoadRawVertexes(wadData + (fileinfo + ML_VERTEXES)->filepos, (fileinfo + ML_VERTEXES)->size);
+ P_LoadRawSectors(wadData + (fileinfo + ML_SECTORS)->filepos, (fileinfo + ML_SECTORS)->size);
+ P_LoadRawSideDefs((fileinfo + ML_SIDEDEFS)->size);
+ P_LoadRawLineDefs(wadData + (fileinfo + ML_LINEDEFS)->filepos, (fileinfo + ML_LINEDEFS)->size);
+ P_LoadRawSideDefs2(wadData + (fileinfo + ML_SIDEDEFS)->filepos);
+ P_LoadRawSubsectors(wadData + (fileinfo + ML_SSECTORS)->filepos, (fileinfo + ML_SSECTORS)->size);
+ P_LoadRawNodes(wadData + (fileinfo + ML_NODES)->filepos, (fileinfo + ML_NODES)->size);
+ P_LoadRawSegs(wadData + (fileinfo + ML_SEGS)->filepos, (fileinfo + ML_SEGS)->size);
+ if (numlumps > ML_REJECT) // enough room for a REJECT lump at least
+ {
+ P_LoadRawReject(
+ wadData + (fileinfo + ML_REJECT)->filepos,
+ (fileinfo + ML_REJECT)->size,
+ (fileinfo + ML_REJECT)->name);
+ }
- P_LoadLineDefs(lastloadedmaplumpnum + ML_LINEDEFS);
- if (!loadedbm)
- P_CreateBlockMap(); // Graue 02-29-2004
- P_LoadSideDefs2(lastloadedmaplumpnum + ML_SIDEDEFS);
+ // Important: take care of the ordering of the next functions.
+ if (!loadedbm)
+ P_CreateBlockMap(); // Graue 02-29-2004
+ P_LoadLineDefs2();
+ P_GroupLines();
+ numdmstarts = numredctfstarts = numbluectfstarts = 0;
- P_LoadLineDefs2();
- P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS);
- P_LoadNodes(lastloadedmaplumpnum + ML_NODES);
- P_LoadSegs(lastloadedmaplumpnum + ML_SEGS);
- P_LoadReject(lastloadedmaplumpnum + ML_REJECT);
- P_GroupLines();
+ // reset the player starts
+ for (i = 0; i < MAXPLAYERS; i++)
+ playerstarts[i] = NULL;
+ for (i = 0; i < 2; i++)
+ skyboxmo[i] = NULL;
+ P_MapStart();
- numdmstarts = numredctfstarts = numbluectfstarts = 0;
+ P_PrepareRawThings(wadData + (fileinfo + ML_THINGS)->filepos, (fileinfo + ML_THINGS)->size);
+ Z_Free(wadData);
+ }
+ else
+ {
+ // Important: take care of the ordering of the next functions.
+ loadedbm = P_LoadBlockMap(lastloadedmaplumpnum + ML_BLOCKMAP);
+ P_LoadVertexes(lastloadedmaplumpnum + ML_VERTEXES);
+ P_LoadSectors(lastloadedmaplumpnum + ML_SECTORS);
+ P_LoadSideDefs(lastloadedmaplumpnum + ML_SIDEDEFS);
+ P_LoadLineDefs(lastloadedmaplumpnum + ML_LINEDEFS);
+ P_LoadSideDefs2(lastloadedmaplumpnum + ML_SIDEDEFS);
+ P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS);
+ P_LoadNodes(lastloadedmaplumpnum + ML_NODES);
+ P_LoadSegs(lastloadedmaplumpnum + ML_SEGS);
+ P_LoadReject(lastloadedmaplumpnum + ML_REJECT);
- // reset the player starts
- for (i = 0; i < MAXPLAYERS; i++)
- playerstarts[i] = NULL;
+ // Important: take care of the ordering of the next functions.
+ if (!loadedbm)
+ P_CreateBlockMap(); // Graue 02-29-2004
- for (i = 0; i < 2; i++)
- skyboxmo[i] = NULL;
+ P_LoadLineDefs2();
+ P_GroupLines();
+ numdmstarts = numredctfstarts = numbluectfstarts = 0;
- P_MapStart();
-
- P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
+ // reset the player starts
+ for (i = 0; i < MAXPLAYERS; i++)
+ playerstarts[i] = NULL;
+ for (i = 0; i < 2; i++)
+ skyboxmo[i] = NULL;
+ P_MapStart();
+ P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
+ }
#ifdef ESLOPE
P_ResetDynamicSlopes();
@@ -3046,6 +3218,7 @@ boolean P_SetupLevel(boolean skipprecip)
mapreset = 0;
nospectategrief = 0;
thwompsactive = false;
+ spbplace = -1;
// clear special respawning que
iquehead = iquetail = 0;
@@ -3113,6 +3286,8 @@ boolean P_SetupLevel(boolean skipprecip)
#endif
}
+ G_AddMapToBuffer(gamemap-1);
+
return true;
}
@@ -3126,7 +3301,7 @@ boolean P_RunSOC(const char *socfilename)
lumpnum_t lump;
if (strstr(socfilename, ".soc") != NULL)
- return P_AddWadFile(socfilename, NULL);
+ return P_AddWadFile(socfilename);
lump = W_CheckNumForName(socfilename);
if (lump == LUMPERROR)
@@ -3142,17 +3317,17 @@ boolean P_RunSOC(const char *socfilename)
// Add a wadfile to the active wad files,
// replace sounds, musics, patches, textures, sprites and maps
//
-boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
+boolean P_AddWadFile(const char *wadfilename)
{
size_t i, j, sreplaces = 0, mreplaces = 0, digmreplaces = 0;
UINT16 numlumps, wadnum;
- INT16 firstmapreplaced = 0, num;
char *name;
lumpinfo_t *lumpinfo;
boolean texturechange = false;
+ boolean mapsadded = false;
boolean replacedcurrentmap = false;
- if ((numlumps = W_LoadWadFile(wadfilename)) == INT16_MAX)
+ if ((numlumps = W_InitFile(wadfilename)) == INT16_MAX)
{
refreshdirmenu |= REFRESHDIR_NOTLOADED;
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);
@@ -3209,6 +3384,7 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
if (!devparm && digmreplaces)
CONS_Printf(M_GetText("%s digital musics replaced\n"), sizeu1(digmreplaces));
+
//
// search for sprite replacements
//
@@ -3243,10 +3419,10 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
for (i = 0; i < numlumps; i++, lumpinfo++)
{
name = lumpinfo->name;
- num = firstmapreplaced;
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
{
+ INT16 num;
if (name[5]!='\0')
continue;
num = (INT16)M_MapNumber(name[3], name[4]);
@@ -3256,16 +3432,10 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
replacedcurrentmap = true;
CONS_Printf("%s\n", name);
- }
-
- if (num && (num < firstmapreplaced || !firstmapreplaced))
- {
- firstmapreplaced = num;
- if (firstmapname)
- *firstmapname = name;
+ mapsadded = true;
}
}
- if (!firstmapreplaced)
+ if (!mapsadded)
CONS_Printf(M_GetText("No maps added\n"));
// reload status bar (warning should have valid player!)
diff --git a/src/p_setup.h b/src/p_setup.h
index c3c206a5..c4a3aab9 100644
--- a/src/p_setup.h
+++ b/src/p_setup.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -60,7 +60,7 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
#endif
void P_LoadThingsOnly(void);
boolean P_SetupLevel(boolean skipprecip);
-boolean P_AddWadFile(const char *wadfilename, char **firstmapname);
+boolean P_AddWadFile(const char *wadfilename);
#ifdef DELFILE
boolean P_DelWadFile(void);
#endif
diff --git a/src/p_sight.c b/src/p_sight.c
index bd6ab4d7..626f8bbe 100644
--- a/src/p_sight.c
+++ b/src/p_sight.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_slopes.c b/src/p_slopes.c
index 9513cac0..ab558c53 100644
--- a/src/p_slopes.c
+++ b/src/p_slopes.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2004 by Stephen McGranahan
-// Copyright (C) 2015-2016 by Sonic Team Junior.
+// Copyright (C) 2015-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -31,8 +31,8 @@ static UINT16 slopecount = 0;
// Calculate line normal
void P_CalculateSlopeNormal(pslope_t *slope) {
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
- slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x);
- slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y);
+ slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.x);
+ slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.y);
}
// With a vertex slope that has its vertices set, configure relevant slope info
diff --git a/src/p_slopes.h b/src/p_slopes.h
index 2ff77505..708a9107 100644
--- a/src/p_slopes.h
+++ b/src/p_slopes.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2004 by Stephen McGranahan
-// Copyright (C) 2015-2016 by Sonic Team Junior.
+// Copyright (C) 2015-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_spec.c b/src/p_spec.c
index ce58948d..ea7b0c4d 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -285,10 +285,13 @@ void P_InitPicAnims(void)
Z_Free(animatedLump);
}
- // Now find ANIMDEFS
+ // Find ANIMDEFS lump in the WAD
animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0);
- if (animdefsLumpNum != INT16_MAX)
+ while (animdefsLumpNum != INT16_MAX)
+ {
P_ParseANIMDEFSLump(w, animdefsLumpNum);
+ animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", (UINT16)w, animdefsLumpNum + 1);
+ }
}
// Define the last one
animdefs[maxanims].istexture = -1;
@@ -3868,6 +3871,9 @@ DoneSection2:
}*/
player->kartstuff[k_dashpadcooldown] = TICRATE/3;
+ player->kartstuff[k_drift] = 0;
+ player->kartstuff[k_driftcharge] = 0;
+ player->kartstuff[k_pogospring] = 0;
S_StartSound(player->mo, sfx_spdpad);
{
@@ -4027,10 +4033,10 @@ DoneSection2:
}
break;
- case 7: // SRB2kart 190117 - Oil Slick
+ case 7: // SRB2kart 190117 - Oil Slick (deprecated)
if (roversector || P_MobjReadyToTrigger(player->mo, sector))
{
- K_SpinPlayer(player, NULL, 0, false);
+ K_SpinPlayer(player, NULL, 0, NULL, false);
}
break;
@@ -4095,7 +4101,6 @@ DoneSection2:
P_SetTarget(&player->mo->tracer, waypoint);
player->speed = speed;
player->pflags &= ~PF_SPINNING; // SRB2kart 200117
- player->pflags |= PF_SPINNING;
player->pflags &= ~PF_JUMPED;
player->pflags &= ~PF_GLIDING;
player->climbing = 0;
@@ -4173,7 +4178,6 @@ DoneSection2:
P_SetTarget(&player->mo->tracer, waypoint);
player->speed = speed;
player->pflags &= ~PF_SPINNING; // SRB2kart 200117
- player->pflags |= PF_SPINNING;
player->pflags &= ~PF_JUMPED;
if (!(player->mo->state >= &states[S_KART_RUN1] && player->mo->state <= &states[S_KART_RUN2]))
@@ -4189,12 +4193,12 @@ DoneSection2:
case 10: // Finish Line
// SRB2kart - 150117
- if (G_RaceGametype() && (player->starpostcount >= numstarposts/2 || player->exiting))
+ if (G_RaceGametype() && (player->starpostnum >= (numstarposts - (numstarposts/2)) || player->exiting))
player->kartstuff[k_starpostwp] = player->kartstuff[k_waypoint] = 0;
//
if (G_RaceGametype() && !player->exiting)
{
- if (player->starpostcount >= numstarposts/2) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)")
+ if (player->starpostnum >= (numstarposts - (numstarposts/2))) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)")
{
UINT8 nump = 0;
@@ -4239,13 +4243,24 @@ DoneSection2:
curlap = 0;
}
- // Reset starposts (checkpoints) info
- // SRB2kart 200117
- player->starpostangle = player->starpostnum = 0;
- player->starpostx = player->starposty = player->starpostz = 0;
- player->starpostcount = 0;
- //except the time!
player->starposttime = player->realtime;
+ player->starpostnum = 0;
+
+ if (mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
+ {
+ // SRB2Kart 281118
+ // Save the player's time and position.
+ player->starpostx = player->mo->x>>FRACBITS;
+ player->starposty = player->mo->y>>FRACBITS;
+ player->starpostz = player->mo->floorz>>FRACBITS;
+ player->starpostangle = player->mo->angle; //R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); torn; a momentum-based guess is less likely to be wrong in general, but when it IS wrong, it fucks you over entirely...
+ }
+ else
+ {
+ // SRB2kart 200117
+ // Reset starposts (checkpoints) info
+ player->starpostangle = player->starpostx = player->starposty = player->starpostz = 0;
+ }
if (P_IsLocalPlayer(player))
{
@@ -6404,9 +6419,21 @@ void P_SpawnSpecials(INT32 fromnetsave)
case 259: // Make-Your-Own FOF!
if (lines[i].sidenum[1] != 0xffff)
{
- UINT8 *data = W_CacheLumpNum(lastloadedmaplumpnum + ML_SIDEDEFS,PU_STATIC);
+ UINT8 *data;
UINT16 b;
+ if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
+ { // HACK: Open wad file rather quickly so we can get the data from the sidedefs lump
+ UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
+ filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
+ fileinfo += ML_SIDEDEFS; // we only need the SIDEDEFS lump
+ data = Z_Malloc(fileinfo->size, PU_STATIC, NULL);
+ M_Memcpy(data, wadData + fileinfo->filepos, fileinfo->size); // copy data
+ Z_Free(wadData); // we're done with this now
+ }
+ else // phew it's just a WAD
+ data = W_CacheLumpNum(lastloadedmaplumpnum + ML_SIDEDEFS,PU_STATIC);
+
for (b = 0; b < (INT16)numsides; b++)
{
register mapsidedef_t *msd = (mapsidedef_t *)data + b;
diff --git a/src/p_spec.h b/src/p_spec.h
index ad705727..1231aeda 100644
--- a/src/p_spec.h
+++ b/src/p_spec.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_telept.c b/src/p_telept.c
index 89a28ddc..24e201fc 100644
--- a/src/p_telept.c
+++ b/src/p_telept.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_tick.c b/src/p_tick.c
index e2a1bb4b..b46b248b 100644
--- a/src/p_tick.c
+++ b/src/p_tick.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_tick.h b/src/p_tick.h
index 75868fdd..169c54c8 100644
--- a/src/p_tick.h
+++ b/src/p_tick.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_user.c b/src/p_user.c
index 616fc721..853ceaf0 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -1778,22 +1778,8 @@ void P_DoPlayerExit(player_t *player)
if (G_RaceGametype()) // If in Race Mode, allow
{
- if (!countdown)
- {
- UINT8 i;
-
- for (i = 0; i < MAXPLAYERS; i++)
- {
- if (!playeringame[i] || players[i].spectator)
- continue;
- if (players[i].exiting || K_IsPlayerLosing(&players[i])) // Only start countdown when all winners are declared
- continue;
- break;
- }
-
- if (i == MAXPLAYERS)
- countdown = (((netgame || multiplayer) ? cv_countdowntime.value : 30)*TICRATE) + 1; // 30 seconds to finish, get going!
- }
+ player->exiting = raceexittime+2;
+ K_KartUpdatePosition(player);
if (cv_kartvoices.value)
{
@@ -1815,8 +1801,6 @@ void P_DoPlayerExit(player_t *player)
}
}
- player->exiting = raceexittime+2;
-
if (cv_inttime.value > 0)
P_EndingMusic(player);
@@ -7259,7 +7243,7 @@ static void P_MovePlayer(player_t *player)
P_DamageMobj(player->mo, NULL, NULL, 42000); // Respawn crushed spectators
else
{
- K_SquishPlayer(player, NULL); // SRB2kart - we don't kill when squished, we squish when squished.
+ K_SquishPlayer(player, NULL, NULL); // SRB2kart - we don't kill when squished, we squish when squished.
/*
mobj_t *killer = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_NULL);
killer->threshold = 44; // Special flag that it was crushing which killed you.
@@ -7775,13 +7759,16 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
}
if (mo->type == MT_SPB) // If you destroy a SPB, you don't get the luxury of a cooldown.
+ {
+ spbplace = -1;
indirectitemcooldown = 0;
+ }
if (mo == inflictor) // Don't nuke yourself, dummy!
continue;
if (mo->type == MT_PLAYER) // Players wipe out in Kart
- K_SpinPlayer(mo->player, source, 0, false);
+ K_SpinPlayer(mo->player, source, 0, inflictor, false);
//}
else
P_DamageMobj(mo, inflictor, source, 1000);
@@ -7963,6 +7950,8 @@ static void P_DeathThink(player_t *player)
else
player->kartstuff[k_timeovercam] = 0;
+ K_KartPlayerHUDUpdate(player);
+
if (player->deadtimer < INT32_MAX)
player->deadtimer++;
@@ -8001,6 +7990,9 @@ static void P_DeathThink(player_t *player)
if (!player->mo)
return;
+ player->mo->colorized = false;
+ player->mo->color = player->skincolor;
+
P_CalcHeight(player);
}
@@ -9115,7 +9107,10 @@ void P_PlayerThink(player_t *player)
if (player->playerstate == PST_DEAD)
{
- player->mo->flags2 &= ~MF2_SHADOW;
+ if (player->spectator)
+ player->mo->flags2 |= MF2_SHADOW;
+ else
+ player->mo->flags2 &= ~MF2_SHADOW;
P_DeathThink(player);
return;
diff --git a/src/r_bsp.c b/src/r_bsp.c
index 68e6a1ab..a658c3ca 100644
--- a/src/r_bsp.c
+++ b/src/r_bsp.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_bsp.h b/src/r_bsp.h
index 07cad27c..7810c9b5 100644
--- a/src/r_bsp.h
+++ b/src/r_bsp.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_data.c b/src/r_data.c
index 13b4957b..b2c10a65 100644
--- a/src/r_data.c
+++ b/src/r_data.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -369,8 +369,8 @@ void R_FlushTextureCache(void)
}
// Need these prototypes for later; defining them here instead of r_data.h so they're "private"
-int R_CountTexturesInTEXTURESLump(UINT16 wadNum);
-void R_ParseTEXTURESLump(UINT16 wadNum, INT32 *index);
+int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum);
+void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *index);
//
// R_LoadTextures
@@ -408,13 +408,22 @@ void R_LoadTextures(void)
// but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures.
for (w = 0, numtextures = 0; w < numwadfiles; w++)
{
- texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
- texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
- texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
-
- if (texturesLumpPos != INT16_MAX)
+ if (wadfiles[w]->type == RET_PK3)
{
- numtextures += R_CountTexturesInTEXTURESLump((UINT16)w);
+ texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
+ texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
+ }
+ else
+ {
+ texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
+ texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
+ }
+
+ texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
+ while (texturesLumpPos != INT16_MAX)
+ {
+ numtextures += R_CountTexturesInTEXTURESLump((UINT16)w, (UINT16)texturesLumpPos);
+ texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
}
// Add all the textures between TX_START and TX_END
@@ -451,12 +460,25 @@ void R_LoadTextures(void)
for (i = 0, w = 0; w < numwadfiles; w++)
{
// Get the lump numbers for the markers in the WAD, if they exist.
- texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
- texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
- texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
-
- if (texturesLumpPos != INT16_MAX)
- R_ParseTEXTURESLump(w,&i);
+ if (wadfiles[w]->type == RET_PK3)
+ {
+ texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
+ texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
+ texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
+ while (texturesLumpPos != INT16_MAX)
+ {
+ R_ParseTEXTURESLump(w, texturesLumpPos, &i);
+ texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
+ }
+ }
+ else
+ {
+ texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
+ texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
+ texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
+ if (texturesLumpPos != INT16_MAX)
+ R_ParseTEXTURESLump(w, texturesLumpPos, &i);
+ }
if (texstart == INT16_MAX || texend == INT16_MAX)
continue;
@@ -803,7 +825,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
}
// Parses the TEXTURES lump... but just to count the number of textures.
-int R_CountTexturesInTEXTURESLump(UINT16 wadNum)
+int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum)
{
char *texturesLump;
size_t texturesLumpLength;
@@ -814,11 +836,11 @@ int R_CountTexturesInTEXTURESLump(UINT16 wadNum)
// Since lumps AREN'T \0-terminated like I'd assumed they should be, I'll
// need to make a space of memory where I can ensure that it will terminate
// correctly. Start by loading the relevant data from the WAD.
- texturesLump = (char *)W_CacheLumpNumPwad(wadNum,W_CheckNumForNamePwad("TEXTURES", wadNum, 0),PU_STATIC);
+ texturesLump = (char *)W_CacheLumpNumPwad(wadNum, lumpNum, PU_STATIC);
// If that didn't exist, we have nothing to do here.
if (texturesLump == NULL) return 0;
// If we're still here, then it DOES exist; figure out how long it is, and allot memory accordingly.
- texturesLumpLength = W_LumpLengthPwad(wadNum,W_CheckNumForNamePwad("TEXTURES",wadNum,0));
+ texturesLumpLength = W_LumpLengthPwad(wadNum, lumpNum);
texturesText = (char *)Z_Malloc((texturesLumpLength+1)*sizeof(char),PU_STATIC,NULL);
// Now move the contents of the lump into this new location.
memmove(texturesText,texturesLump,texturesLumpLength);
@@ -850,7 +872,7 @@ int R_CountTexturesInTEXTURESLump(UINT16 wadNum)
}
// Parses the TEXTURES lump... for real, this time.
-void R_ParseTEXTURESLump(UINT16 wadNum, INT32 *texindex)
+void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *texindex)
{
char *texturesLump;
size_t texturesLumpLength;
@@ -863,11 +885,11 @@ void R_ParseTEXTURESLump(UINT16 wadNum, INT32 *texindex)
// Since lumps AREN'T \0-terminated like I'd assumed they should be, I'll
// need to make a space of memory where I can ensure that it will terminate
// correctly. Start by loading the relevant data from the WAD.
- texturesLump = (char *)W_CacheLumpNumPwad(wadNum,W_CheckNumForNamePwad("TEXTURES", wadNum, 0),PU_STATIC);
+ texturesLump = (char *)W_CacheLumpNumPwad(wadNum, lumpNum, PU_STATIC);
// If that didn't exist, we have nothing to do here.
if (texturesLump == NULL) return;
// If we're still here, then it DOES exist; figure out how long it is, and allot memory accordingly.
- texturesLumpLength = W_LumpLengthPwad(wadNum,W_CheckNumForNamePwad("TEXTURES",wadNum,0));
+ texturesLumpLength = W_LumpLengthPwad(wadNum, lumpNum);
texturesText = (char *)Z_Malloc((texturesLumpLength+1)*sizeof(char),PU_STATIC,NULL);
// Now move the contents of the lump into this new location.
memmove(texturesText,texturesLump,texturesLumpLength);
@@ -954,12 +976,51 @@ static void R_InitExtraColormaps(void)
CONS_Printf(M_GetText("Number of Extra Colormaps: %s\n"), sizeu1(numcolormaplumps));
}*/
-// 12/14/14 -- only take flats in F_START/F_END
+// Search for flat name.
lumpnum_t R_GetFlatNumForName(const char *name)
{
- lumpnum_t lump = W_CheckNumForNameInBlock(name, "F_START", "F_END");
- if (lump == LUMPERROR)
- lump = W_CheckNumForNameInBlock(name, "FF_START", "FF_END"); // deutex, some other old things
+ INT32 i;
+ lumpnum_t lump;
+ lumpnum_t start;
+ lumpnum_t end;
+
+ // Scan wad files backwards so patched flats take preference.
+ for (i = numwadfiles - 1; i >= 0; i--)
+ {
+ switch (wadfiles[i]->type)
+ {
+ case RET_WAD:
+ if ((start = W_CheckNumForNamePwad("F_START", (UINT16)i, 0)) == INT16_MAX)
+ {
+ if ((start = W_CheckNumForNamePwad("FF_START", (UINT16)i, 0)) == INT16_MAX)
+ continue;
+ else if ((end = W_CheckNumForNamePwad("FF_END", (UINT16)i, start)) == INT16_MAX)
+ continue;
+ }
+ else
+ if ((end = W_CheckNumForNamePwad("F_END", (UINT16)i, start)) == INT16_MAX)
+ continue;
+ break;
+ case RET_PK3:
+ if ((start = W_CheckNumForFolderStartPK3("Flats/", i, 0)) == INT16_MAX)
+ continue;
+ if ((end = W_CheckNumForFolderEndPK3("Flats/", i, start)) == INT16_MAX)
+ continue;
+ break;
+ default:
+ continue;
+ }
+
+ // Now find lump with specified name in that range.
+ lump = W_CheckNumForNamePwad(name, (UINT16)i, start);
+ if (lump < end)
+ {
+ lump += (i<<16); // found it, in our constraints
+ break;
+ }
+ lump = LUMPERROR;
+ }
+
if (lump == LUMPERROR)
{
if (strcmp(name, SKYFLATNAME))
diff --git a/src/r_data.h b/src/r_data.h
index e31484f6..640b3030 100644
--- a/src/r_data.h
+++ b/src/r_data.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_defs.h b/src/r_defs.h
index 25092ccc..967c3908 100644
--- a/src/r_defs.h
+++ b/src/r_defs.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_draw.c b/src/r_draw.c
index 60927434..02a91215 100644
--- a/src/r_draw.c
+++ b/src/r_draw.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -136,11 +136,13 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
#define METALSONIC_TT_CACHE_INDEX (MAXSKINS + 2)
#define ALLWHITE_TT_CACHE_INDEX (MAXSKINS + 3)
#define RAINBOW_TT_CACHE_INDEX (MAXSKINS + 4)
+#define BLINK_TT_CACHE_INDEX (MAXSKINS + 5)
+#define TT_CACHE_SIZE (MAXSKINS + 6)
#define SKIN_RAMP_LENGTH 16
#define DEFAULT_STARTTRANSCOLOR 160
#define NUM_PALETTE_ENTRIES 256
-static UINT8** translationtablecache[MAXSKINS + 5] = {NULL};
+static UINT8** translationtablecache[TT_CACHE_SIZE] = {NULL};
// See also the enum skincolors_t
@@ -530,6 +532,7 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
else if (skinnum == TC_METALSONIC) skintableindex = METALSONIC_TT_CACHE_INDEX;
else if (skinnum == TC_ALLWHITE) skintableindex = ALLWHITE_TT_CACHE_INDEX;
else if (skinnum == TC_RAINBOW) skintableindex = RAINBOW_TT_CACHE_INDEX;
+ else if (skinnum == TC_BLINK) skintableindex = BLINK_TT_CACHE_INDEX;
else skintableindex = skinnum;
if (flags & GTC_CACHE)
diff --git a/src/r_draw.h b/src/r_draw.h
index 0ff19bc7..9a81a7f5 100644
--- a/src/r_draw.h
+++ b/src/r_draw.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -108,6 +108,7 @@ extern lumpnum_t viewborderlump[8];
#define TC_METALSONIC -3 // For Metal Sonic battle
#define TC_ALLWHITE -4 // For Cy-Brak-demon
#define TC_RAINBOW -5 // For invincibility power
+#define TC_BLINK -6 // For item blinking
// Initialize color translation tables, for player rendering etc.
void R_InitTranslationTables(void);
diff --git a/src/r_draw16.c b/src/r_draw16.c
index a922f4d0..918dd356 100644
--- a/src/r_draw16.c
+++ b/src/r_draw16.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_draw8.c b/src/r_draw8.c
index 2fb2a8bd..634ae707 100644
--- a/src/r_draw8.c
+++ b/src/r_draw8.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_local.h b/src/r_local.h
index a3dfe7df..1d318775 100644
--- a/src/r_local.h
+++ b/src/r_local.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_main.c b/src/r_main.c
index ff0f65ec..12e3e03b 100644
--- a/src/r_main.c
+++ b/src/r_main.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -666,7 +666,7 @@ void R_ExecuteSetViewSize(void)
if (rendermode == render_soft)
{
// this is only used for planes rendering in software mode
- j = viewheight*4;
+ j = viewheight*8;
for (i = 0; i < j; i++)
{
dy = ((i - viewheight*2)<rcolormap = xwalllights[pindex];
- rlight->height += rlight->heightstep;
height = rlight->height;
+ rlight->height += rlight->heightstep;
if (height <= windowtop)
{
@@ -843,26 +843,21 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
light = &frontsector->lightlist[i];
rlight = &dc_lightlist[p];
#ifdef ESLOPE
- if (light->slope) {
- leftheight = P_GetZAt(light->slope, ds->leftpos.x, ds->leftpos.y);
- rightheight = P_GetZAt(light->slope, ds->rightpos.x, ds->rightpos.y);
- } else
- leftheight = rightheight = light->height;
- if (*pfloor->b_slope) {
- pfloorleft = P_GetZAt(*pfloor->b_slope, ds->leftpos.x, ds->leftpos.y);
- pfloorright = P_GetZAt(*pfloor->b_slope, ds->rightpos.x, ds->rightpos.y);
- } else
- pfloorleft = pfloorright = *pfloor->bottomheight;
+#define SLOPEPARAMS(slope, end1, end2, normalheight) \
+ if (slope) { \
+ end1 = P_GetZAt(slope, ds->leftpos.x, ds->leftpos.y); \
+ end2 = P_GetZAt(slope, ds->rightpos.x, ds->rightpos.y); \
+ } else \
+ end1 = end2 = normalheight;
+
+ SLOPEPARAMS(light->slope, leftheight, rightheight, light->height)
+ SLOPEPARAMS(*pfloor->b_slope, pfloorleft, pfloorright, *pfloor->bottomheight)
if (leftheight < pfloorleft && rightheight < pfloorright)
continue;
- if (*pfloor->t_slope) {
- pfloorleft = P_GetZAt(*pfloor->t_slope, ds->leftpos.x, ds->leftpos.y);
- pfloorright = P_GetZAt(*pfloor->t_slope, ds->rightpos.x, ds->rightpos.y);
- } else
- pfloorleft = pfloorright = *pfloor->topheight;
+ SLOPEPARAMS(*pfloor->t_slope, pfloorleft, pfloorright, *pfloor->topheight)
if (leftheight > pfloorleft && rightheight > pfloorright && i+1 < dc_numlights)
{
@@ -875,17 +870,17 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
leftheight -= viewz;
rightheight -= viewz;
- overflow_test = (INT64)centeryfrac - (((INT64)leftheight*ds->scale1)>>FRACBITS);
- if (overflow_test < 0) overflow_test = -overflow_test;
- if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue;
- overflow_test = (INT64)centeryfrac - (((INT64)rightheight*ds->scale2)>>FRACBITS);
- if (overflow_test < 0) overflow_test = -overflow_test;
- if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue;
+#define OVERFLOWTEST(height, scale) \
+ overflow_test = (INT64)centeryfrac - (((INT64)height*scale)>>FRACBITS); \
+ if (overflow_test < 0) overflow_test = -overflow_test; \
+ if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue;
+
+ OVERFLOWTEST(leftheight, ds->scale1)
+ OVERFLOWTEST(rightheight, ds->scale2)
rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1);
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
- rlight->height -= rlight->heightstep;
#else
if (light->height < *pfloor->bottomheight)
continue;
@@ -895,36 +890,28 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
lheight = light->height;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : light->height;
rlight->heightstep = -FixedMul (rw_scalestep, (lheight - viewz));
- rlight->height = (centeryfrac) - FixedMul((lheight - viewz), spryscale) - rlight->heightstep;
+ rlight->height = (centeryfrac) - FixedMul((lheight - viewz), spryscale);
#endif
rlight->flags = light->flags;
if (light->flags & FF_CUTLEVEL)
{
#ifdef ESLOPE
- if (*light->caster->b_slope) {
- leftheight = P_GetZAt(*light->caster->b_slope, ds->leftpos.x, ds->leftpos.y);
- rightheight = P_GetZAt(*light->caster->b_slope, ds->rightpos.x, ds->rightpos.y);
- } else
- leftheight = rightheight = *light->caster->bottomheight;
-
+ SLOPEPARAMS(*light->caster->b_slope, leftheight, rightheight, *light->caster->bottomheight)
+#undef SLOPEPARAMS
leftheight -= viewz;
rightheight -= viewz;
- overflow_test = (INT64)centeryfrac - (((INT64)leftheight*ds->scale1)>>FRACBITS);
- if (overflow_test < 0) overflow_test = -overflow_test;
- if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue;
- overflow_test = (INT64)centeryfrac - (((INT64)rightheight*ds->scale2)>>FRACBITS);
- if (overflow_test < 0) overflow_test = -overflow_test;
- if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue;
+ OVERFLOWTEST(leftheight, ds->scale1)
+ OVERFLOWTEST(rightheight, ds->scale2)
+#undef OVERFLOWTEST
rlight->botheight = (centeryfrac) - FixedMul(leftheight, ds->scale1);
rlight->botheightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(range);
- rlight->botheight -= rlight->botheightstep;
#else
lheight = *light->caster->bottomheight;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : *light->caster->bottomheight;
rlight->botheightstep = -FixedMul (rw_scalestep, (lheight - viewz));
- rlight->botheight = (centeryfrac) - FixedMul((lheight - viewz), spryscale) - rlight->botheightstep;
+ rlight->botheight = (centeryfrac) - FixedMul((lheight - viewz), spryscale);
#endif
}
@@ -1107,6 +1094,46 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
oldx = dc_x;
}
#endif
+ // Calculate bounds
+ // clamp the values if necessary to avoid overflows and rendering glitches caused by them
+
+#ifdef ESLOPE
+ if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX;
+ else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac;
+ else sprtopscreen = windowtop = CLAMPMIN;
+ if (bottom_frac > (INT64)CLAMPMAX) sprbotscreen = windowbottom = CLAMPMAX;
+ else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac;
+ else sprbotscreen = windowbottom = CLAMPMIN;
+
+ top_frac += top_step;
+ bottom_frac += bottom_step;
+#else
+ sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale));
+ sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen;
+#endif
+
+ // SoM: If column is out of range, why bother with it??
+ if (windowbottom < topbounds || windowtop > bottombounds)
+ {
+ if (dc_numlights)
+ {
+ for (i = 0; i < dc_numlights; i++)
+ {
+ rlight = &dc_lightlist[i];
+ rlight->height += rlight->heightstep;
+ if (rlight->flags & FF_CUTLEVEL)
+ rlight->botheight += rlight->botheightstep;
+ }
+ }
+ spryscale += rw_scalestep;
+ continue;
+ }
+
+ dc_iscale = 0xffffffffu / (unsigned)spryscale;
+
+ // Get data for the column
+ col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3);
+
// SoM: New code does not rely on R_DrawColumnShadowed_8 which
// will (hopefully) put less strain on the stack.
if (dc_numlights)
@@ -1117,40 +1144,6 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
INT32 solid = 0;
INT32 lighteffect = 0;
-#ifdef ESLOPE
- if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX;
- else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac;
- else sprtopscreen = windowtop = CLAMPMIN;
- if (bottom_frac > (INT64)CLAMPMAX) sprbotscreen = windowbottom = CLAMPMAX;
- else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac;
- else sprbotscreen = windowbottom = CLAMPMIN;
-
- top_frac += top_step;
- bottom_frac += bottom_step;
-#else
- sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale));
- sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen;
-#endif
-
- // SoM: If column is out of range, why bother with it??
- if (windowbottom < topbounds || windowtop > bottombounds)
- {
- for (i = 0; i < dc_numlights; i++)
- {
- rlight = &dc_lightlist[i];
- rlight->height += rlight->heightstep;
- if (rlight->flags & FF_CUTLEVEL)
- rlight->botheight += rlight->botheightstep;
- }
- spryscale += rw_scalestep;
- continue;
- }
-
- dc_iscale = 0xffffffffu / (unsigned)spryscale;
-
- // draw the texture
- col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3);
-
for (i = 0; i < dc_numlights; i++)
{
// Check if the current light effects the colormap/lightlevel
@@ -1169,7 +1162,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
- if (pindex >= MAXLIGHTSCALE)
+ if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE-1;
if (pfloor->flags & FF_FOG)
@@ -1208,13 +1201,13 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
else
solid = 0;
- rlight->height += rlight->heightstep;
height = rlight->height;
+ rlight->height += rlight->heightstep;
if (solid)
{
- rlight->botheight += rlight->botheightstep;
bheight = rlight->botheight - (FRACUNIT >> 1);
+ rlight->botheight += rlight->botheightstep;
}
if (height <= windowtop)
@@ -1234,6 +1227,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (windowbottom >= sprbotscreen)
{
windowbottom = sprbotscreen;
+ // draw the texture
colfunc_2s (col);
for (i++; i < dc_numlights; i++)
{
@@ -1244,6 +1238,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
}
continue;
}
+ // draw the texture
colfunc_2s (col);
if (solid)
windowtop = bheight;
@@ -1257,6 +1252,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
}
}
windowbottom = sprbotscreen;
+ // draw the texture, if there is any space left
if (windowtop < windowbottom)
colfunc_2s (col);
@@ -1271,33 +1267,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
pindex = MAXLIGHTSCALE - 1;
dc_colormap = walllights[pindex];
+
if (encoremap && !(curline->linedef->flags & ML_TFERLINE))
dc_colormap += (256*32);
- if (frontsector->extra_colormap)
- dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
+
if (pfloor->flags & FF_FOG && pfloor->master->frontsector->extra_colormap)
dc_colormap = pfloor->master->frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
-
-#ifdef ESLOPE
- if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX;
- else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac;
- else sprtopscreen = windowtop = CLAMPMIN;
- if (bottom_frac > (INT64)CLAMPMAX) sprbotscreen = windowbottom = CLAMPMAX;
- else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac;
- else sprbotscreen = windowbottom = CLAMPMIN;
-
- top_frac += top_step;
- bottom_frac += bottom_step;
-#else
- sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale));
- sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen;
-#endif
-
- dc_iscale = 0xffffffffu / (unsigned)spryscale;
+ else if (frontsector->extra_colormap)
+ dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
// draw the texture
- col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3);
-
colfunc_2s (col);
spryscale += rw_scalestep;
}
diff --git a/src/r_segs.h b/src/r_segs.h
index 4187d36e..92d0100e 100644
--- a/src/r_segs.h
+++ b/src/r_segs.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_sky.c b/src/r_sky.c
index ede1df04..fe1630e9 100644
--- a/src/r_sky.c
+++ b/src/r_sky.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_sky.h b/src/r_sky.h
index aa4bda37..86b61559 100644
--- a/src/r_sky.h
+++ b/src/r_sky.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_splats.c b/src/r_splats.c
index f6d7e78f..8d0a84fa 100644
--- a/src/r_splats.c
+++ b/src/r_splats.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_splats.h b/src/r_splats.h
index 349d8fa7..387b2958 100644
--- a/src/r_splats.h
+++ b/src/r_splats.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_state.h b/src/r_state.h
index b2929237..d6d123e9 100644
--- a/src/r_state.h
+++ b/src/r_state.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_things.c b/src/r_things.c
index 54b20e17..9abbdd12 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -375,21 +375,28 @@ void R_AddSpriteDefs(UINT16 wadnum)
UINT16 start, end;
char wadname[MAX_WADPATH];
- // find the sprites section in this pwad
- // we need at least the S_END
- // (not really, but for speedup)
+ switch (wadfiles[wadnum]->type)
+ {
+ case RET_WAD:
+ start = W_CheckNumForNamePwad("S_START", wadnum, 0);
+ if (start == INT16_MAX)
+ start = W_CheckNumForNamePwad("SS_START", wadnum, 0); //deutex compatib.
+ if (start == INT16_MAX)
+ start = 0; //let say S_START is lump 0
+ else
+ start++; // just after S_START
+ end = W_CheckNumForNamePwad("S_END",wadnum,start);
+ if (end == INT16_MAX)
+ end = W_CheckNumForNamePwad("SS_END",wadnum,start); //deutex compatib.
+ break;
+ case RET_PK3:
+ start = W_CheckNumForFolderStartPK3("Sprites/", wadnum, 0);
+ end = W_CheckNumForFolderEndPK3("Sprites/", wadnum, start);
+ break;
+ default:
+ return;
+ }
- start = W_CheckNumForNamePwad("S_START", wadnum, 0);
- if (start == INT16_MAX)
- start = W_CheckNumForNamePwad("SS_START", wadnum, 0); //deutex compatib.
- if (start == INT16_MAX)
- start = 0; //let say S_START is lump 0
- else
- start++; // just after S_START
-
- end = W_CheckNumForNamePwad("S_END",wadnum,start);
- if (end == INT16_MAX)
- end = W_CheckNumForNamePwad("SS_END",wadnum,start); //deutex compatib.
if (end == INT16_MAX)
{
CONS_Debug(DBG_SETUP, "no sprites in pwad %d\n", wadnum);
@@ -2680,13 +2687,6 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
// SRB2kart
player->kartspeed = skin->kartspeed;
player->kartweight = skin->kartweight;
-
- // Cheat Checks
- if (player->kartspeed < 1) player->kartspeed = 1;
- if (player->kartspeed > 9) player->kartspeed = 9;
- if (player->kartweight < 1) player->kartweight = 1;
- if (player->kartweight > 9) player->kartweight = 9;
- //
player->normalspeed = skin->normalspeed;
player->runspeed = skin->runspeed;
@@ -2911,15 +2911,22 @@ void R_AddSkins(UINT16 wadnum)
#undef GETSPEED
#define GETINT(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value);
- // SRB2kart
- GETINT(kartspeed)
- GETINT(kartweight)
- //
GETINT(thrustfactor)
GETINT(accelstart)
GETINT(acceleration)
#undef GETINT
+#define GETKARTSTAT(field) \
+ else if (!stricmp(stoken, #field)) \
+ { \
+ skin->field = atoi(value); \
+ if (skin->field < 1) skin->field = 1; \
+ if (skin->field > 9) skin->field = 9; \
+ }
+ GETKARTSTAT(kartspeed)
+ GETKARTSTAT(kartweight)
+#undef GETKARTSTAT
+
// custom translation table
else if (!stricmp(stoken, "startcolor"))
skin->starttranscolor = atoi(value);
diff --git a/src/r_things.h b/src/r_things.h
index a7542e2f..b3c7656d 100644
--- a/src/r_things.h
+++ b/src/r_things.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/s_sound.c b/src/s_sound.c
index 422a00a1..8b5d29ed 100644
--- a/src/s_sound.c
+++ b/src/s_sound.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -50,6 +50,13 @@ static void SetChannelsNum(void);
static void Command_Tunes_f(void);
static void Command_RestartAudio_f(void);
+// Sound system toggles
+#ifndef NO_MIDI
+static void GameMIDIMusic_OnChange(void);
+#endif
+static void GameSounds_OnChange(void);
+static void GameDigiMusic_OnChange(void);
+
// commands for music and sound servers
#ifdef MUSSERV
consvar_t musserver_cmd = {"musserver_cmd", "musserver", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -96,6 +103,13 @@ consvar_t cv_numChannels = {"snd_channels", "64", CV_SAVE|CV_CALL, CV_Unsigned,
consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE|CV_NOSHOWHELP, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
+// Sound system toggles, saved into the config
+consvar_t cv_gamedigimusic = {"digimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameDigiMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
+#ifndef NO_MIDI
+consvar_t cv_gamemidimusic = {"midimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameMIDIMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
+#endif
+consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameSounds_OnChange, 0, NULL, NULL, 0, 0, NULL};
+
#define S_MAX_VOLUME 127
// when to clip out sounds
@@ -250,6 +264,11 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&surround);
CV_RegisterVar(&cv_samplerate);
CV_RegisterVar(&cv_resetmusic);
+ CV_RegisterVar(&cv_gamesounds);
+ CV_RegisterVar(&cv_gamedigimusic);
+#ifndef NO_MIDI
+ CV_RegisterVar(&cv_gamemidimusic);
+#endif
COM_AddCommand("tunes", Command_Tunes_f);
COM_AddCommand("restartaudio", Command_RestartAudio_f);
@@ -1199,7 +1218,7 @@ fixed_t S_CalculateSoundDistance(fixed_t sx1, fixed_t sy1, fixed_t sz1, fixed_t
approx_dist <<= FRACBITS;
- return approx_dist;
+ return FixedDiv(approx_dist, mapheaderinfo[gamemap-1]->mobj_scale); // approx_dist
}
//
@@ -1921,3 +1940,106 @@ static void Command_RestartAudio_f(void)
else
S_ChangeMusicInternal("titles", looptitle);
}
+
+void GameSounds_OnChange(void)
+{
+ if (M_CheckParm("-nosound"))
+ return;
+
+ if (sound_disabled)
+ {
+ sound_disabled = false;
+ S_InitSfxChannels(cv_soundvolume.value);
+ S_StartSound(NULL, sfx_strpst);
+ }
+ else
+ {
+ sound_disabled = true;
+ S_StopSounds();
+ }
+}
+
+void GameDigiMusic_OnChange(void)
+{
+ if (M_CheckParm("-nomusic"))
+ return;
+ else if (M_CheckParm("-nodigmusic"))
+ return;
+
+ if (digital_disabled)
+ {
+ digital_disabled = false;
+ I_InitMusic();
+ S_StopMusic();
+ if (Playing())
+ P_RestoreMusic(&players[consoleplayer]);
+ else
+ S_ChangeMusicInternal("lclear", false);
+ }
+ else
+ {
+ digital_disabled = true;
+ if (S_MusicType() != MU_MID)
+ {
+ if (midi_disabled)
+ S_StopMusic();
+ else
+ {
+ char mmusic[7];
+ UINT16 mflags;
+ boolean looping;
+
+ if (S_MusicInfo(mmusic, &mflags, &looping) && S_MIDIExists(mmusic))
+ {
+ S_StopMusic();
+ S_ChangeMusic(mmusic, mflags, looping);
+ }
+ else
+ S_StopMusic();
+ }
+ }
+ }
+}
+
+#ifndef NO_MIDI
+void GameMIDIMusic_OnChange(void)
+{
+ if (M_CheckParm("-nomusic"))
+ return;
+ else if (M_CheckParm("-nomidimusic"))
+ return;
+
+ if (midi_disabled)
+ {
+ midi_disabled = false;
+ I_InitMusic();
+ if (Playing())
+ P_RestoreMusic(&players[consoleplayer]);
+ else
+ S_ChangeMusicInternal("lclear", false);
+ }
+ else
+ {
+ midi_disabled = true;
+ if (S_MusicType() == MU_MID)
+ {
+ if (digital_disabled)
+ S_StopMusic();
+ else
+ {
+ char mmusic[7];
+ UINT16 mflags;
+ boolean looping;
+
+ if (S_MusicInfo(mmusic, &mflags, &looping) && S_DigExists(mmusic))
+ {
+ S_StopMusic();
+ S_ChangeMusic(mmusic, mflags, looping);
+ }
+ else
+ S_StopMusic();
+ }
+ }
+ }
+}
+#endif
diff --git a/src/s_sound.h b/src/s_sound.h
index 7f46366d..c83188cf 100644
--- a/src/s_sound.h
+++ b/src/s_sound.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -28,6 +28,11 @@ extern consvar_t cv_soundvolume, cv_digmusicvolume;//, cv_midimusicvolume;
extern consvar_t cv_numChannels;
extern consvar_t surround;
extern consvar_t cv_resetmusic;
+extern consvar_t cv_gamedigimusic;
+#ifndef NO_MIDI
+extern consvar_t cv_gamemidimusic;
+#endif
+extern consvar_t cv_gamesounds;
#ifdef SNDSERV
extern consvar_t sndserver_cmd, sndserver_arg;
diff --git a/src/screen.c b/src/screen.c
index ada9af7c..d5beaf36 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/screen.h b/src/screen.h
index a61de7f9..9ad254d3 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt
index 7f677126..a3626970 100644
--- a/src/sdl/CMakeLists.txt
+++ b/src/sdl/CMakeLists.txt
@@ -3,7 +3,18 @@
set(SRB2_CONFIG_SDL2_USEMIXER ON CACHE BOOL "Use SDL2_mixer or regular sdl sound")
if(${SRB2_CONFIG_SDL2_USEMIXER})
- find_package(SDL2_mixer)
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(SDL2_MIXER_FOUND ON)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(SDL2_MIXER_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2)
+ set(SDL2_MIXER_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/lib -lSDL2_mixer")
+ else() # 32-bit
+ set(SDL2_MIXER_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/include/SDL2)
+ set(SDL2_MIXER_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/lib -lSDL2_mixer")
+ endif()
+ else()
+ find_package(SDL2_mixer)
+ endif()
if(${SDL2_MIXER_FOUND})
set(SRB2_HAVE_MIXER ON)
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
@@ -42,7 +53,18 @@ set(SRB2_SDL2_HEADERS
source_group("Interface Code" FILES ${SRB2_SDL2_SOURCES} ${SRB2_SDL2_HEADERS})
# Dependency
-find_package(SDL2)
+if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(SDL2_FOUND ON)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(SDL2_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/include/SDL2)
+ set(SDL2_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/lib -lSDL2")
+ else() # 32-bit
+ set(SDL2_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/include/SDL2)
+ set(SDL2_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/lib -lSDL2")
+ endif()
+else()
+ find_package(SDL2)
+endif()
if(${SDL2_FOUND})
set(SRB2_SDL2_TOTAL_SOURCES
@@ -185,7 +207,18 @@ if(${SDL2_FOUND})
endif()
if(MSVC)
- find_package(SDL2_MAIN REQUIRED)
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(SDL2_MAIN_FOUND ON)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(SDL2_MAIN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/include/SDL2)
+ set(SDL2_MAIN_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/lib -lSDL2main")
+ else() # 32-bit
+ set(SDL2_MAIN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/include/SDL2)
+ set(SDL2_MAIN_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/lib -lSDL2main")
+ endif()
+ else()
+ find_package(SDL2_MAIN REQUIRED)
+ endif()
target_link_libraries(SRB2SDL2 PRIVATE
${SDL2_MAIN_LIBRARIES}
)
@@ -241,17 +274,49 @@ if(${SDL2_FOUND})
if(${CMAKE_SYSTEM} MATCHES Windows)
set(win_extra_dll_list "")
macro(getwinlib dllname defaultname)
- find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}")
- list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ if (${CMAKE_GENERATOR} STREQUAL "MinGW Makefiles")
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
+ HINTS ${CMAKE_SOURCE_DIR}/Bin/Resources/x86_64
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/bin
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/bin
+ )
+ else()
+ find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
+ HINTS ${CMAKE_SOURCE_DIR}/Bin/Resources/i686
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/bin
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/bin
+ )
+ endif()
+ else()
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
+ HINTS ${CMAKE_SOURCE_DIR}/Bin/Resources/x86_64
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x64
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x64
+ )
+ else()
+ find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
+ HINTS ${CMAKE_SOURCE_DIR}/Bin/Resources/i686
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x86
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x86
+ )
+ endif()
+ endif()
+
+ list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
+ else()
+ find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}")
+ list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
+ endif()
endmacro()
getwinlib(SDL2 "SDL2.dll")
if(${SRB2_CONFIG_SDL2_USEMIXER})
getwinlib(SDL2_mixer "SDL2_mixer.dll")
- getwinlib(libmikmod-2 "libmikmod-2.dll")
getwinlib(libogg_0 "libogg-0.dll")
getwinlib(libvorbis_0 "libvorbis-0.dll")
getwinlib(libvorbisfile_3 "libvorbisfile-3.dll")
- getwinlib(smpeg2 "smpeg2.dll")
endif()
if(${SRB2_CONFIG_HAVE_GME})
getwinlib(libgme "libgme.dll")
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj
index 83851ba3..df582865 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj
+++ b/src/sdl/Srb2SDL-vc10.vcxproj
@@ -304,6 +304,7 @@
+
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters
index d30478db..09287436 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj.filters
+++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters
@@ -642,6 +642,9 @@
LUA
+
+ LUA
+
LUA
diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index 03543c30..a1a9df90 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -2801,6 +2801,8 @@ void I_Quit(void)
printf("\r");
ShowEndTxt();
}
+ if (myargmalloc)
+ free(myargv); // Deallocate allocated memory
death:
W_Shutdown();
exit(0);
diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h
index 110b03fd..93588ebb 100644
--- a/src/sdl/sdlmain.h
+++ b/src/sdl/sdlmain.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2006 by Sonic Team Jr.
+// Copyright (C) 2006-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2CE/cehelp.c b/src/sdl12/SRB2CE/cehelp.c
index 7c5efdee..13505cff 100644
--- a/src/sdl12/SRB2CE/cehelp.c
+++ b/src/sdl12/SRB2CE/cehelp.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2004 by Sonic Team Jr.
+// Copyright (C) 2004-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2CE/cehelp.h b/src/sdl12/SRB2CE/cehelp.h
index bc265b05..3ed0d9dd 100644
--- a/src/sdl12/SRB2CE/cehelp.h
+++ b/src/sdl12/SRB2CE/cehelp.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2004 by Sonic Team Jr.
+// Copyright (C) 2004-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2DC/dchelp.c b/src/sdl12/SRB2DC/dchelp.c
index 5fdf04bc..1468baa8 100644
--- a/src/sdl12/SRB2DC/dchelp.c
+++ b/src/sdl12/SRB2DC/dchelp.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2006 by Sonic Team Jr.
+// Copyright (C) 2006-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2DC/dchelp.h b/src/sdl12/SRB2DC/dchelp.h
index 236f3111..3647f9c8 100644
--- a/src/sdl12/SRB2DC/dchelp.h
+++ b/src/sdl12/SRB2DC/dchelp.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2006 by Sonic Team Jr.
+// Copyright (C) 2006-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2DC/i_udp.c b/src/sdl12/SRB2DC/i_udp.c
index ec5e305f..cf7654c1 100644
--- a/src/sdl12/SRB2DC/i_udp.c
+++ b/src/sdl12/SRB2DC/i_udp.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
-// Portions Copyright (C) 2005 by Sonic Team Jr.
+// Portions Copyright (C) 2005-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2XBOX/xboxhelp.c b/src/sdl12/SRB2XBOX/xboxhelp.c
index 9de01712..05b6c5e6 100644
--- a/src/sdl12/SRB2XBOX/xboxhelp.c
+++ b/src/sdl12/SRB2XBOX/xboxhelp.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2004 by Sonic Team Jr.
+// Copyright (C) 2004-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/i_system.c b/src/sdl12/i_system.c
index 86ac6e55..8299f6eb 100644
--- a/src/sdl12/i_system.c
+++ b/src/sdl12/i_system.c
@@ -2994,6 +2994,8 @@ void I_Quit(void)
printf("\r");
ShowEndTxt();
}
+ if (myargmalloc)
+ free(myargv); // Deallocate allocated memory
death:
W_Shutdown();
#ifdef GP2X
diff --git a/src/sdl12/sdlmain.h b/src/sdl12/sdlmain.h
index 1e497b10..d08236bd 100644
--- a/src/sdl12/sdlmain.h
+++ b/src/sdl12/sdlmain.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2006 by Sonic Team Jr.
+// Copyright (C) 2006-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sounds.c b/src/sounds.c
index 5531e7a3..a3bc8bf4 100644
--- a/src/sounds.c
+++ b/src/sounds.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -792,6 +792,8 @@ sfxinfo_t S_sfx[NUMSFX] =
{"itrol7", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"itrol8", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"itrolf", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Roulette end
+ {"itrolm", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Roulette end (mashed)
+ {"itrolk", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Roulette end (karma enhanced)
{"itrole", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Roulette end (Eggman)
{"vroom", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Kart Krew opening vroom
{"chaooo", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Chao audience cheer
diff --git a/src/sounds.h b/src/sounds.h
index e93a17a4..4c341d49 100644
--- a/src/sounds.h
+++ b/src/sounds.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -867,6 +867,8 @@ typedef enum
sfx_itrol7,
sfx_itrol8,
sfx_itrolf,
+ sfx_itrolm,
+ sfx_itrolk,
sfx_itrole,
sfx_vroom,
sfx_chaooo,
diff --git a/src/st_stuff.c b/src/st_stuff.c
index 8aefb33b..770321da 100644
--- a/src/st_stuff.c
+++ b/src/st_stuff.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/st_stuff.h b/src/st_stuff.h
index b054460b..303b87a5 100644
--- a/src/st_stuff.h
+++ b/src/st_stuff.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/string.c b/src/string.c
index d7f8b367..2a03e872 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2006 by Graue.
-// Copyright (C) 2006-2016 by Sonic Team Junior.
+// Copyright (C) 2006-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/tables.c b/src/tables.c
index 6b06c81b..d4e0e5df 100644
--- a/src/tables.c
+++ b/src/tables.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/tables.h b/src/tables.h
index d231baf9..3aaaec80 100644
--- a/src/tables.h
+++ b/src/tables.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/tmap.nas b/src/tmap.nas
index 16f53f53..78840106 100644
--- a/src/tmap.nas
+++ b/src/tmap.nas
@@ -1,7 +1,7 @@
;; SONIC ROBO BLAST 2
;;-----------------------------------------------------------------------------
;; Copyright (C) 1998-2000 by DooM Legacy Team.
-;; Copyright (C) 1999-2016 by Sonic Team Junior.
+;; Copyright (C) 1999-2018 by Sonic Team Junior.
;;
;; This program is free software distributed under the
;; terms of the GNU General Public License, version 2.
diff --git a/src/tmap.s b/src/tmap.s
index a828a9d4..babd4ec1 100644
--- a/src/tmap.s
+++ b/src/tmap.s
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -13,7 +13,7 @@
// structures, must match the C structures!
#include "asm_defs.inc"
-// Rappel: seuls EAX, ECX, EDX peuvent ˆtre ‚cras‚s librement.
+// Rappel: seuls EAX, ECX, EDX peuvent �tre �cras�s librement.
// il faut sauver esi,edi, cd...gs
/* Attention aux comparaisons! */
@@ -28,7 +28,7 @@
/* cmp A,B // B-A , set flags */
/* jg B_greater_than_A */
/* */
-/* (soustrait l'op‚rande source DE l'op‚rande destination, */
+/* (soustrait l'op�rande source DE l'op�rande destination, */
/* comme sur Motorola! ) */
// RAPPEL: Intel
@@ -66,7 +66,7 @@ C(vidwidth): .long 0 //use this one out of the inner loops
.globl C(ASM_PatchRowBytes)
C(ASM_PatchRowBytes):
pushl %ebp
- movl %esp, %ebp // assure l'"adressabilit‚ du stack"
+ movl %esp, %ebp // assure l'"adressabilit� du stack"
movl ARG1, %edx // read first arg
movl %edx, C(vidwidth)
diff --git a/src/tmap_asm.s b/src/tmap_asm.s
index e8b7af1c..99cb0b62 100644
--- a/src/tmap_asm.s
+++ b/src/tmap_asm.s
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/tmap_mmx.nas b/src/tmap_mmx.nas
index 187beec7..39380a06 100644
--- a/src/tmap_mmx.nas
+++ b/src/tmap_mmx.nas
@@ -1,7 +1,7 @@
;; SONIC ROBO BLAST 2
;;-----------------------------------------------------------------------------
;; Copyright (C) 1998-2000 by DOSDOOM.
-;; Copyright (C) 2010-2016 by Sonic Team Junior.
+;; Copyright (C) 2010-2018 by Sonic Team Junior.
;;
;; This program is free software distributed under the
;; terms of the GNU General Public License, version 2.
diff --git a/src/tmap_vc.nas b/src/tmap_vc.nas
index 8fe39ec8..e943d48d 100644
--- a/src/tmap_vc.nas
+++ b/src/tmap_vc.nas
@@ -1,7 +1,7 @@
;; SONIC ROBO BLAST 2
;;-----------------------------------------------------------------------------
;; Copyright (C) 1998-2000 by DooM Legacy Team.
-;; Copyright (C) 1999-2016 by Sonic Team Junior.
+;; Copyright (C) 1999-2018 by Sonic Team Junior.
;;
;; This program is free software distributed under the
;; terms of the GNU General Public License, version 2.
diff --git a/src/v_video.c b/src/v_video.c
index 63eb6743..90411d4e 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -348,8 +348,8 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
return;
#ifdef HWRENDER
- // oh please
- if (rendermode != render_soft && !con_startup)
+ //if (rendermode != render_soft && !con_startup) // Why?
+ if (rendermode != render_soft)
{
HWR_DrawFixedPatch((GLPatch_t *)patch, x, y, pscale, scrn, colormap);
return;
diff --git a/src/v_video.h b/src/v_video.h
index 734b8037..01710c6d 100644
--- a/src/v_video.h
+++ b/src/v_video.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/vid_copy.s b/src/vid_copy.s
index 9d8e7d4e..050a8099 100644
--- a/src/vid_copy.s
+++ b/src/vid_copy.s
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/w_wad.c b/src/w_wad.c
index 998ee2b8..512320c2 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -65,22 +65,25 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#define O_BINARY 0
#endif
-#if defined(_MSC_VER)
-#pragma pack(1)
+#ifdef HAVE_ZLIB
+#ifndef _MSC_VER
+#ifndef _LARGEFILE64_SOURCE
+#define _LARGEFILE64_SOURCE
+#endif
#endif
-// a raw entry of the wad directory
-typedef struct
-{
- UINT32 filepos; // file offset of the resource
- UINT32 size; // size of the resource
- char name[8]; // name of the resource
-} ATTRPACK filelump_t;
-
-#if defined(_MSC_VER)
-#pragma pack()
+#ifndef _LFS64_LARGEFILE
+#define _LFS64_LARGEFILE
#endif
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 0
+#endif
+
+#include "zlib.h"
+#endif
+
+
typedef struct
{
const char *name;
@@ -115,8 +118,10 @@ void W_Shutdown(void)
while (numwadfiles--)
{
fclose(wadfiles[numwadfiles]->handle);
- Z_Free(wadfiles[numwadfiles]->lumpinfo);
Z_Free(wadfiles[numwadfiles]->filename);
+ while (wadfiles[numwadfiles]->numlumps--)
+ Z_Free(wadfiles[numwadfiles]->lumpinfo[wadfiles[numwadfiles]->numlumps].name2);
+ Z_Free(wadfiles[numwadfiles]->lumpinfo);
Z_Free(wadfiles[numwadfiles]);
}
}
@@ -176,6 +181,38 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
return handle;
}
+// Look for all DEHACKED and Lua scripts inside a PK3 archive.
+static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
+{
+ UINT16 posStart, posEnd;
+ posStart = W_CheckNumForFolderStartPK3("Lua/", wadnum, 0);
+ if (posStart != INT16_MAX)
+ {
+ posEnd = W_CheckNumForFolderEndPK3("Lua/", wadnum, posStart);
+ posStart++;
+ for (; posStart < posEnd; posStart++)
+ LUA_LoadLump(wadnum, posStart);
+ }
+ posStart = W_CheckNumForFolderStartPK3("SOC/", wadnum, 0);
+ if (posStart != INT16_MAX)
+ {
+ posEnd = W_CheckNumForFolderEndPK3("SOC/", wadnum, posStart);
+ posStart++;
+ for(; posStart < posEnd; posStart++)
+ {
+ lumpinfo_t *lump_p = &wadfiles[wadnum]->lumpinfo[posStart];
+ size_t length = strlen(wadfiles[wadnum]->filename) + 1 + strlen(lump_p->name2); // length of file name, '|', and lump name
+ char *name = malloc(length + 1);
+ sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->name2);
+ name[length] = '\0';
+ CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
+ DEH_LoadDehackedLumpPwad(wadnum, posStart);
+ free(name);
+ }
+
+ }
+}
+
// search for all DEHACKED lump in all wads and load it
static inline void W_LoadDehackedLumps(UINT16 wadnum)
{
@@ -196,20 +233,13 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++)
if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump
{ // shameless copy+paste of code from LUA_LoadLump
- size_t len = strlen(wadfiles[wadnum]->filename);
- char *name = malloc(len+10);
-
- strcpy(name, wadfiles[wadnum]->filename);
- if (!fasticmp(&name[len - 4], ".soc")) {
- // If it's not a .soc file, copy the lump name in too.
- name[len] = '|';
- M_Memcpy(name+len+1, lump_p->name, 8);
- name[len+9] = '\0';
- }
+ size_t length = strlen(wadfiles[wadnum]->filename) + 1 + strlen(lump_p->name2); // length of file name, '|', and lump name
+ char *name = malloc(length + 1);
+ sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->name2);
+ name[length] = '\0';
CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
DEH_LoadDehackedLumpPwad(wadnum, lump);
-
free(name);
}
else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG
@@ -282,6 +312,324 @@ static void W_InvalidateLumpnumCache(void)
memset(lumpnumcache, 0, sizeof (lumpnumcache));
}
+/** Detect a file type.
+ * \todo Actually detect the wad/pkzip headers and whatnot, instead of just checking the extensions.
+ */
+static restype_t ResourceFileDetect (const char* filename)
+{
+ if (!stricmp(&filename[strlen(filename) - 4], ".pk3"))
+ return RET_PK3;
+ if (!stricmp(&filename[strlen(filename) - 4], ".soc"))
+ return RET_SOC;
+ if (!stricmp(&filename[strlen(filename) - 4], ".lua"))
+ return RET_LUA;
+
+ return RET_WAD;
+}
+
+/** Create a 1-lump lumpinfo_t for standalone files.
+ */
+static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const char* lumpname)
+{
+ lumpinfo_t* lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
+ lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
+ lumpinfo->position = 0;
+ fseek(handle, 0, SEEK_END);
+ lumpinfo->size = ftell(handle);
+ fseek(handle, 0, SEEK_SET);
+ strcpy(lumpinfo->name, lumpname);
+ // Allocate the lump's full name.
+ lumpinfo->name2 = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
+ strcpy(lumpinfo->name2, lumpname);
+ lumpinfo->name2[8] = '\0';
+ *numlumps = 1;
+ return lumpinfo;
+}
+
+/** Create a lumpinfo_t array for a WAD file.
+ */
+static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filename)
+{
+ UINT16 numlumps = *nlmp;
+ lumpinfo_t* lumpinfo;
+ size_t i;
+ INT32 compressed = 0;
+
+ wadinfo_t header;
+ lumpinfo_t *lump_p;
+ filelump_t *fileinfo;
+ void *fileinfov;
+
+ // read the header
+ if (fread(&header, 1, sizeof header, handle) < sizeof header)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header because %s\n"), strerror(ferror(handle)));
+ return NULL;
+ }
+
+ if (memcmp(header.identification, "ZWAD", 4) == 0)
+ compressed = 1;
+ else if (memcmp(header.identification, "IWAD", 4) != 0
+ && memcmp(header.identification, "PWAD", 4) != 0
+ && memcmp(header.identification, "SDLL", 4) != 0)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("Invalid WAD header\n"));
+ return NULL;
+ }
+
+ header.numlumps = LONG(header.numlumps);
+ header.infotableofs = LONG(header.infotableofs);
+
+ // read wad file directory
+ i = header.numlumps * sizeof (*fileinfo);
+ fileinfov = fileinfo = malloc(i);
+ if (fseek(handle, header.infotableofs, SEEK_SET) == -1
+ || fread(fileinfo, 1, i, handle) < i)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("Corrupt wadfile directory (%s)\n"), strerror(ferror(handle)));
+ free(fileinfov);
+ return NULL;
+ }
+
+ numlumps = header.numlumps;
+
+ // fill in lumpinfo for this wad
+ lump_p = lumpinfo = Z_Malloc(numlumps * sizeof (*lumpinfo), PU_STATIC, NULL);
+ for (i = 0; i < numlumps; i++, lump_p++, fileinfo++)
+ {
+ lump_p->position = LONG(fileinfo->filepos);
+ lump_p->size = lump_p->disksize = LONG(fileinfo->size);
+ if (compressed) // wad is compressed, lump might be
+ {
+ UINT32 realsize = 0;
+ if (fseek(handle, lump_p->position, SEEK_SET)
+ == -1 || fread(&realsize, 1, sizeof realsize,
+ handle) < sizeof realsize)
+ {
+ I_Error("corrupt compressed file: %s; maybe %s", /// \todo Avoid the bailout?
+ filename, strerror(ferror(handle)));
+ }
+ realsize = LONG(realsize);
+ if (realsize != 0)
+ {
+ lump_p->size = realsize;
+ lump_p->compression = CM_LZF;
+ }
+ else
+ {
+ lump_p->size -= 4;
+ lump_p->compression = CM_NOCOMPRESSION;
+ }
+
+ lump_p->position += 4;
+ lump_p->disksize -= 4;
+ }
+ else
+ lump_p->compression = CM_NOCOMPRESSION;
+ memset(lump_p->name, 0x00, 9);
+ strncpy(lump_p->name, fileinfo->name, 8);
+ // Allocate the lump's full name.
+ lump_p->name2 = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
+ strncpy(lump_p->name2, fileinfo->name, 8);
+ lump_p->name2[8] = '\0';
+ }
+ free(fileinfov);
+ *nlmp = numlumps;
+ return lumpinfo;
+}
+
+/** Optimized pattern search in a file.
+ */
+static boolean ResFindSignature (FILE* handle, char endPat[], UINT32 startpos)
+{
+ char *s;
+ int c;
+
+ fseek(handle, startpos, SEEK_SET);
+ s = endPat;
+ while((c = fgetc(handle)) != EOF)
+ {
+ if (*s != c && s > endPat) // No match?
+ s = endPat; // We "reset" the counter by sending the s pointer back to the start of the array.
+ if (*s == c)
+ {
+ s++;
+ if (*s == 0x00) // The array pointer has reached the key char which marks the end. It means we have matched the signature.
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+#if defined(_MSC_VER)
+#pragma pack(1)
+#endif
+typedef struct zend_s
+{
+ char signature[4];
+ UINT16 diskpos;
+ UINT16 cdirdisk;
+ UINT16 diskentries;
+ UINT16 entries;
+ UINT32 cdirsize;
+ UINT32 cdiroffset;
+ UINT16 commentlen;
+} ATTRPACK zend_t;
+
+typedef struct zentry_s
+{
+ char signature[4];
+ UINT16 version;
+ UINT16 versionneeded;
+ UINT16 flags;
+ UINT16 compression;
+ UINT16 modtime;
+ UINT16 moddate;
+ UINT32 CRC32;
+ UINT32 compsize;
+ UINT32 size;
+ UINT16 namelen;
+ UINT16 xtralen;
+ UINT16 commlen;
+ UINT16 diskstart;
+ UINT16 attrint;
+ UINT32 attrext;
+ UINT32 offset;
+} ATTRPACK zentry_t;
+
+typedef struct zlentry_s
+{
+ char signature[4];
+ UINT16 versionneeded;
+ UINT16 flags;
+ UINT16 compression;
+ UINT16 modtime;
+ UINT16 moddate;
+ UINT32 CRC32;
+ UINT32 compsize;
+ UINT32 size;
+ UINT16 namelen;
+ UINT16 xtralen;
+} ATTRPACK zlentry_t;
+#if defined(_MSC_VER)
+#pragma pack()
+#endif
+
+/** Create a lumpinfo_t array for a PKZip file.
+ */
+static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
+{
+ zend_t zend;
+ zentry_t* zentries;
+ zentry_t* zentry;
+
+ UINT16 numlumps = *nlmp;
+ lumpinfo_t* lumpinfo;
+ lumpinfo_t *lump_p;
+ size_t i;
+
+ char pat_central[] = {0x50, 0x4b, 0x01, 0x02, 0x00};
+ char pat_end[] = {0x50, 0x4b, 0x05, 0x06, 0x00};
+
+ // Look for central directory end signature near end of file.
+ // Contains entry number (number of lumps), and central directory start offset.
+ fseek(handle, 0, SEEK_END);
+ if (!ResFindSignature(handle, pat_end, max(0, ftell(handle) - (22 + 65536))))
+ {
+ CONS_Alert(CONS_ERROR, "Missing central directory\n");
+ return NULL;
+ }
+
+ fseek(handle, -4, SEEK_CUR);
+ if (fread(&zend, 1, sizeof zend, handle) < sizeof zend)
+ {
+ CONS_Alert(CONS_ERROR, "Corrupt central directory (%s)\n", strerror(ferror(handle)));
+ return NULL;
+ }
+ numlumps = zend.entries;
+
+ lump_p = lumpinfo = Z_Malloc(numlumps * sizeof (*lumpinfo), PU_STATIC, NULL);
+ zentry = zentries = malloc(numlumps * sizeof (*zentries));
+
+ fseek(handle, zend.cdiroffset, SEEK_SET);
+ for (i = 0; i < numlumps; i++, zentry++, lump_p++)
+ {
+ char* fullname;
+ char* trimname;
+ char* dotpos;
+
+ if (fread(zentry, 1, sizeof(zentry_t), handle) < sizeof(zentry_t))
+ {
+ CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", strerror(ferror(handle)));
+ Z_Free(lumpinfo);
+ free(zentry);
+ return NULL;
+ }
+ if (memcmp(zentry->signature, pat_central, 4))
+ {
+ CONS_Alert(CONS_ERROR, "Central directory is corrupt\n");
+ Z_Free(lumpinfo);
+ free(zentry);
+ return NULL;
+ }
+
+ lump_p->position = zentry->offset + zentry->namelen + zentry->xtralen + sizeof(zlentry_t);
+ lump_p->disksize = zentry->compsize;
+ lump_p->size = zentry->size;
+
+ fullname = malloc(zentry->namelen + 1);
+ if (fgets(fullname, zentry->namelen + 1, handle) != fullname)
+ {
+ CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", strerror(ferror(handle)));
+ Z_Free(lumpinfo);
+ free(zentry);
+ free(fullname);
+ return NULL;
+ }
+
+ // Strip away file address and extension for the 8char name.
+ if ((trimname = strrchr(fullname, '/')) != 0)
+ trimname++;
+ else
+ trimname = fullname; // Care taken for root files.
+
+ if ((dotpos = strrchr(trimname, '.')) == 0)
+ dotpos = fullname + strlen(fullname); // Watch for files without extension.
+
+ memset(lump_p->name, '\0', 9); // Making sure they're initialized to 0. Is it necessary?
+ strncpy(lump_p->name, trimname, min(8, dotpos - trimname));
+
+ lump_p->name2 = Z_Calloc(zentry->namelen + 1, PU_STATIC, NULL);
+ strncpy(lump_p->name2, fullname, zentry->namelen);
+
+ free(fullname);
+
+ switch(zentry->compression)
+ {
+ case 0:
+ lump_p->compression = CM_NOCOMPRESSION;
+ break;
+#ifdef HAVE_ZLIB
+ case 8:
+ lump_p->compression = CM_DEFLATE;
+ break;
+#endif
+ case 14:
+ lump_p->compression = CM_LZF;
+ break;
+ default:
+ CONS_Alert(CONS_WARNING, "%s: Unsupported compression method\n", fullname);
+ lump_p->compression = CM_UNSUPPORTED;
+ break;
+ }
+ }
+
+ *nlmp = numlumps;
+ return lumpinfo;
+}
+
// Allocate a wadfile, setup the lumpinfo (directory) and
// lumpcache, add the wadfile to the current active wadfiles
//
@@ -293,14 +641,14 @@ static void W_InvalidateLumpnumCache(void)
//
// Can now load dehacked files (.soc)
//
-UINT16 W_LoadWadFile(const char *filename)
+UINT16 W_InitFile(const char *filename)
{
FILE *handle;
- lumpinfo_t *lumpinfo;
+ lumpinfo_t *lumpinfo = NULL;
wadfile_t *wadfile;
- UINT32 numlumps;
+ restype_t type;
+ UINT16 numlumps = 0;
size_t i;
- INT32 compressed = 0;
size_t packetsize;
UINT8 md5sum[16];
boolean important;
@@ -352,122 +700,6 @@ UINT16 W_LoadWadFile(const char *filename)
packetsizetally = packetsize;
}
- // detect dehacked file with the "soc" extension
- if (!stricmp(&filename[strlen(filename) - 4], ".soc"))
- {
- // This code emulates a wadfile with one lump name "OBJCTCFG"
- // at position 0 and size of the whole file.
- // This allows soc files to be like all wads, copied by network and loaded at the console.
- numlumps = 1;
- lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
- lumpinfo->position = 0;
- fseek(handle, 0, SEEK_END);
- lumpinfo->size = ftell(handle);
- fseek(handle, 0, SEEK_SET);
- strcpy(lumpinfo->name, "OBJCTCFG");
- }
-#ifdef HAVE_BLUA
- // detect lua script with the "lua" extension
- else if (!stricmp(&filename[strlen(filename) - 4], ".lua"))
- {
- // This code emulates a wadfile with one lump name "LUA_INIT"
- // at position 0 and size of the whole file.
- // This allows soc files to be like all wads, copied by network and loaded at the console.
- numlumps = 1;
- lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
- lumpinfo->position = 0;
- fseek(handle, 0, SEEK_END);
- lumpinfo->size = ftell(handle);
- fseek(handle, 0, SEEK_SET);
- strcpy(lumpinfo->name, "LUA_INIT");
- }
-#endif
- else
- {
- // assume wad file
- wadinfo_t header;
- lumpinfo_t *lump_p;
- filelump_t *fileinfo;
- void *fileinfov;
-
- // read the header
- if (fread(&header, 1, sizeof header, handle) < sizeof header)
- {
- CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header from %s because %s\n"), filename, strerror(ferror(handle)));
- if (handle)
- fclose(handle);
- return INT16_MAX;
- }
-
- if (memcmp(header.identification, "ZWAD", 4) == 0)
- compressed = 1;
- else if (memcmp(header.identification, "IWAD", 4) != 0
- && memcmp(header.identification, "PWAD", 4) != 0
- && memcmp(header.identification, "SDLL", 4) != 0)
- {
- CONS_Alert(CONS_ERROR, M_GetText("%s does not have a valid WAD header\n"), filename);
- if (handle)
- fclose(handle);
- return INT16_MAX;
- }
-
- header.numlumps = LONG(header.numlumps);
- header.infotableofs = LONG(header.infotableofs);
-
- // read wad file directory
- i = header.numlumps * sizeof (*fileinfo);
- fileinfov = fileinfo = malloc(i);
- if (fseek(handle, header.infotableofs, SEEK_SET) == -1
- || fread(fileinfo, 1, i, handle) < i)
- {
- CONS_Alert(CONS_ERROR, M_GetText("Wadfile directory in %s is corrupted (%s)\n"), filename, strerror(ferror(handle)));
- free(fileinfov);
- if (handle)
- fclose(handle);
- return INT16_MAX;
- }
-
- numlumps = header.numlumps;
-
- // fill in lumpinfo for this wad
- lump_p = lumpinfo = Z_Malloc(numlumps * sizeof (*lumpinfo), PU_STATIC, NULL);
- for (i = 0; i < numlumps; i++, lump_p++, fileinfo++)
- {
- lump_p->position = LONG(fileinfo->filepos);
- lump_p->size = lump_p->disksize = LONG(fileinfo->size);
- if (compressed) // wad is compressed, lump might be
- {
- UINT32 realsize = 0;
-
- if (fseek(handle, lump_p->position, SEEK_SET)
- == -1 || fread(&realsize, 1, sizeof realsize,
- handle) < sizeof realsize)
- {
- I_Error("corrupt compressed file: %s; maybe %s",
- filename, strerror(ferror(handle)));
- }
- realsize = LONG(realsize);
- if (realsize != 0)
- {
- lump_p->size = realsize;
- lump_p->compressed = 1;
- }
- else
- {
- lump_p->size -= 4;
- lump_p->compressed = 0;
- }
-
- lump_p->position += 4;
- lump_p->disksize -= 4;
- }
- else lump_p->compressed = 0;
- memset(lump_p->name, 0x00, 9);
- strncpy(lump_p->name, fileinfo->name, 8);
- }
- free(fileinfov);
- }
-
#ifndef NOMD5
//
// w-waiiiit!
@@ -488,6 +720,32 @@ UINT16 W_LoadWadFile(const char *filename)
}
#endif
+ switch(type = ResourceFileDetect(filename))
+ {
+ case RET_SOC:
+ lumpinfo = ResGetLumpsStandalone(handle, &numlumps, "OBJCTCFG");
+ break;
+#ifdef HAVE_BLUA
+ case RET_LUA:
+ lumpinfo = ResGetLumpsStandalone(handle, &numlumps, "LUA_INIT");
+ break;
+#endif
+ case RET_PK3:
+ lumpinfo = ResGetLumpsZip(handle, &numlumps);
+ break;
+ case RET_WAD:
+ lumpinfo = ResGetLumpsWad(handle, &numlumps, filename);
+ break;
+ default:
+ CONS_Alert(CONS_ERROR, "Unsupported file format\n");
+ }
+
+ if (lumpinfo == NULL)
+ {
+ fclose(handle);
+ return INT16_MAX;
+ }
+
//
// link wad file to search files
//
@@ -499,6 +757,7 @@ UINT16 W_LoadWadFile(const char *filename)
wadfile->important = important;
fseek(handle, 0, SEEK_END);
wadfile->filesize = (unsigned)ftell(handle);
+ wadfile->type = type;
// already generated, just copy it over
M_Memcpy(&wadfile->md5sum, &md5sum, 16);
@@ -519,10 +778,28 @@ UINT16 W_LoadWadFile(const char *filename)
CONS_Printf(M_GetText("Added file %s (%u lumps)\n"), filename, numlumps);
wadfiles[numwadfiles] = wadfile;
numwadfiles++; // must come BEFORE W_LoadDehackedLumps, so any addfile called by COM_BufInsertText called by Lua doesn't overwrite what we just loaded
- W_LoadDehackedLumps(numwadfiles-1);
+
+ // TODO: HACK ALERT - Load Lua & SOC stuff right here. I feel like this should be out of this place, but... Let's stick with this for now.
+ switch (wadfile->type)
+ {
+ case RET_WAD:
+ W_LoadDehackedLumps(numwadfiles - 1);
+ break;
+ case RET_PK3:
+ W_LoadDehackedLumpsPK3(numwadfiles - 1);
+ break;
+ case RET_SOC:
+ CONS_Printf(M_GetText("Loading SOC from %s\n"), wadfile->filename);
+ DEH_LoadDehackedLumpPwad(numwadfiles - 1, 0);
+ break;
+ case RET_LUA:
+ LUA_LoadLump(numwadfiles - 1, 0);
+ break;
+ default:
+ break;
+ }
W_InvalidateLumpnumCache();
-
return wadfile->numlumps;
}
@@ -580,7 +857,7 @@ INT32 W_InitMultipleFiles(char **filenames)
for (; *filenames; filenames++)
{
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
- rc &= (W_LoadWadFile(*filenames) != INT16_MAX) ? 1 : 0;
+ rc &= (W_InitFile(*filenames) != INT16_MAX) ? 1 : 0;
}
if (!numwadfiles)
@@ -658,6 +935,51 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
return INT16_MAX;
}
+// Look for the first lump from a folder.
+UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump)
+{
+ INT32 i;
+ lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
+ for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
+ {
+ if (strnicmp(name, lump_p->name2, strlen(name)) == 0)
+ break;
+ }
+ return i;
+}
+
+// In a PK3 type of resource file, it looks for the next lumpinfo entry that doesn't share the specified pathfile.
+// Useful for finding folder ends.
+// Returns the position of the lumpinfo entry.
+UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump)
+{
+ INT32 i;
+ lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
+ for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
+ {
+ if (strnicmp(name, lump_p->name2, strlen(name)))
+ break;
+ }
+ return i;
+}
+
+// In a PK3 type of resource file, it looks for an entry with the specified full name.
+// Returns lump position in PK3's lumpinfo, or INT16_MAX if not found.
+UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump)
+{
+ INT32 i;
+ lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
+ for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
+ {
+ if (!strnicmp(name, lump_p->name2, strlen(name)))
+ {
+ return i;
+ }
+ }
+ // Not found at all?
+ return INT16_MAX;
+}
+
//
// W_CheckNumForName
// Returns LUMPERROR if name not found.
@@ -698,6 +1020,37 @@ lumpnum_t W_CheckNumForName(const char *name)
}
}
+// Look for valid map data through all added files in descendant order.
+// Get a map marker for WADs, and a standalone WAD file lump inside PK3s.
+// TODO: Make it search through cache first, maybe...?
+lumpnum_t W_CheckNumForMap(const char *name)
+{
+ UINT16 lumpNum, end;
+ UINT32 i;
+ for (i = numwadfiles - 1; i < numwadfiles; i--)
+ {
+ if (wadfiles[i]->type == RET_WAD)
+ {
+ for (lumpNum = 0; lumpNum < wadfiles[i]->numlumps; lumpNum++)
+ if (!strncmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8))
+ return (i<<16) + lumpNum;
+ }
+ else if (wadfiles[i]->type == RET_PK3)
+ {
+ lumpNum = W_CheckNumForFolderStartPK3("maps/", i, 0);
+ if (lumpNum != INT16_MAX)
+ end = W_CheckNumForFolderEndPK3("maps/", i, lumpNum);
+ else
+ continue;
+ // Now look for the specified map.
+ for (++lumpNum; lumpNum < end; lumpNum++)
+ if (!strnicmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8))
+ return (i<<16) + lumpNum;
+ }
+ }
+ return LUMPERROR;
+}
+
//
// W_GetNumForName
//
@@ -728,15 +1081,19 @@ lumpnum_t W_CheckNumForNameInBlock(const char *name, const char *blockstart, con
// scan wad files backwards so patch lump files take precedence
for (i = numwadfiles - 1; i >= 0; i--)
{
- bsid = W_CheckNumForNamePwad(blockstart,(UINT16)i,0);
- if (bsid == INT16_MAX)
- continue; // block doesn't exist, keep going
- beid = W_CheckNumForNamePwad(blockend,(UINT16)i,0);
- // if block end doesn't exist, just search through everything
+ if (wadfiles[i]->type == RET_WAD)
+ {
+ bsid = W_CheckNumForNamePwad(blockstart, (UINT16)i, 0);
+ if (bsid == INT16_MAX)
+ continue; // Start block doesn't exist?
+ beid = W_CheckNumForNamePwad(blockend, (UINT16)i, 0);
+ if (beid == INT16_MAX)
+ continue; // End block doesn't exist?
- check = W_CheckNumForNamePwad(name,(UINT16)i,bsid);
- if (check < beid)
- return (i<<16)+check; // found it, in our constraints
+ check = W_CheckNumForNamePwad(name, (UINT16)i, bsid);
+ if (check < beid)
+ return (i<<16)+check; // found it, in our constraints
+ }
}
return LUMPERROR;
}
@@ -773,103 +1130,78 @@ size_t W_LumpLength(lumpnum_t lumpnum)
return W_LumpLengthPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
}
-/** Reads bytes from the head of a lump, without doing decompression.
- *
- * \param wad Wad number to read from.
- * \param lump Lump number to read from, within wad.
- * \param dest Buffer in memory to serve as destination.
- * \param size Number of bytes to read.
- * \param offest Number of bytes to offset.
- * \return Number of bytes read (should equal size).
- * \sa W_ReadLumpHeader
- */
-static size_t W_RawReadLumpHeader(UINT16 wad, UINT16 lump, void *dest, size_t size, size_t offset)
+//
+// W_IsLumpWad
+// Is the lump a WAD? (presumably in a PK3)
+//
+boolean W_IsLumpWad(lumpnum_t lumpnum)
{
- size_t bytesread;
- lumpinfo_t *l;
- FILE *handle;
+ if (wadfiles[WADFILENUM(lumpnum)]->type == RET_PK3)
+ {
+ const char *lumpfullName = (wadfiles[WADFILENUM(lumpnum)]->lumpinfo + LUMPNUM(lumpnum))->name2;
- l = wadfiles[wad]->lumpinfo + lump;
+ if (strlen(lumpfullName) < 4)
+ return false; // can't possibly be a WAD can it?
+ return !strnicmp(lumpfullName + strlen(lumpfullName) - 4, ".wad", 4);
+ }
- handle = wadfiles[wad]->handle;
+ return false; // WADs should never be inside non-PK3s as far as SRB2 is concerned
+}
- fseek(handle, (long)(l->position + offset), SEEK_SET);
- bytesread = fread(dest, 1, size, handle);
+#ifdef HAVE_ZLIB
+/* report a zlib or i/o error */
+void zerr(int ret)
+{
+ CONS_Printf("zpipe: ");
+ switch (ret) {
+ case Z_ERRNO:
+ if (ferror(stdin))
+ CONS_Printf("error reading stdin\n");
+ if (ferror(stdout))
+ CONS_Printf("error writing stdout\n");
+ break;
+ case Z_STREAM_ERROR:
+ CONS_Printf("invalid compression level\n");
+ break;
+ case Z_DATA_ERROR:
+ CONS_Printf("invalid or incomplete deflate data\n");
+ break;
+ case Z_MEM_ERROR:
+ CONS_Printf("out of memory\n");
+ break;
+ case Z_VERSION_ERROR:
+ CONS_Printf("zlib version mismatch!\n");
+ }
+}
+#endif
-#if 1 // we're fucking sick of this
- if (bytesread < 67) // http://garethrees.org/2007/11/14/pngcrush/
- return bytesread;
+#define NO_PNG_LUMPS
-#define sigcheck ((UINT8 *)dest)
+#ifdef NO_PNG_LUMPS
+static void ErrorIfPNG(void *d, size_t s, char *f, char *l)
+{
+ if (s < 67) // http://garethrees.org/2007/11/14/pngcrush/
+ return;
+#define sigcheck ((UINT8 *)d)
if (sigcheck[0] == 0x89
- && sigcheck[1] == 0x50
- && sigcheck[2] == 0x4e
- && sigcheck[3] == 0x47
- && sigcheck[4] == 0x0d
- && sigcheck[5] == 0x0a
- && sigcheck[6] == 0x1a
- && sigcheck[7] == 0x0a)
+ && sigcheck[1] == 0x50
+ && sigcheck[2] == 0x4e
+ && sigcheck[3] == 0x47
+ && sigcheck[4] == 0x0d
+ && sigcheck[5] == 0x0a
+ && sigcheck[6] == 0x1a
+ && sigcheck[7] == 0x0a)
{
- char pnglump[9];
- strncpy(pnglump, l->name, 8);
- pnglump[8] = '\0';
- I_Error("W_Wad: Lump \"%s\" is a .PNG - have you tried converting to Doom or Flat (raw) image formats?", pnglump);
+ I_Error("W_Wad: Lump \"%s\" in file \"%s\" is a .PNG - please convert to either Doom or Flat (raw) image format.", l, f);
}
#undef sigcheck
-
-#endif
-
- return bytesread;
}
-
-// Read a compressed lump; return it in newly Z_Malloc'd memory.
-// wad is number of wad file, lump is number of lump in wad.
-static void *W_ReadCompressedLump(UINT16 wad, UINT16 lump)
-{
-#ifdef ZWAD
- char *compressed, *data;
- const lumpinfo_t *l = &wadfiles[wad]->lumpinfo[lump];
- size_t retval;
-
- compressed = Z_Malloc(l->disksize, PU_STATIC, NULL);
- data = Z_Malloc(l->size, PU_STATIC, NULL);
- if (W_RawReadLumpHeader(wad, lump, compressed, l->disksize, 0)
- < l->disksize)
- {
- I_Error("wad %d, lump %d: cannot read compressed data",
- wad, lump);
- }
-
- retval = lzf_decompress(compressed, l->disksize, data, l->size);
-#ifndef AVOID_ERRNO
- if (retval == 0 && errno == E2BIG)
- {
- I_Error("wad %d, lump %d: compressed data too big "
- "(bigger than %s)", wad, lump, sizeu1(l->size));
- }
- else if (retval == 0 && errno == EINVAL)
- I_Error("wad %d, lump %d: invalid compressed data", wad, lump);
- else
#endif
- if (retval != l->size)
- {
- I_Error("wad %d, lump %d: decompressed to wrong number of "
- "bytes (expected %s, got %s)", wad, lump,
- sizeu1(l->size), sizeu2(retval));
- }
- Z_Free(compressed);
- return data;
-#else
- (void)wad;
- (void)lump;
- //I_Error("ZWAD files not supported on this platform.");
- return NULL;
-#endif
-}
/** Reads bytes from the head of a lump.
* Note: If the lump is compressed, the whole thing has to be read anyway.
*
+ * \param wad Wad number to read from.
* \param lump Lump number to read from.
* \param dest Buffer in memory to serve as destination.
* \param size Number of bytes to read.
@@ -880,6 +1212,8 @@ static void *W_ReadCompressedLump(UINT16 wad, UINT16 lump)
size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, size_t offset)
{
size_t lumpsize;
+ lumpinfo_t *l;
+ FILE *handle;
if (!TestValidLump(wad,lump))
return 0;
@@ -893,17 +1227,130 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
if (!size || size+offset > lumpsize)
size = lumpsize - offset;
- if (wadfiles[wad]->lumpinfo[lump].compressed)
+ // Let's get the raw lump data.
+ // We setup the desired file handle to read the lump data.
+ l = wadfiles[wad]->lumpinfo + lump;
+ handle = wadfiles[wad]->handle;
+ fseek(handle, (long)(l->position + offset), SEEK_SET);
+
+ // But let's not copy it yet. We support different compression formats on lumps, so we need to take that into account.
+ switch(wadfiles[wad]->lumpinfo[lump].compression)
{
- UINT8 *data;
- data = W_ReadCompressedLump(wad, lump);
- if (!data) return 0;
- M_Memcpy(dest, data+offset, size);
- Z_Free(data);
- return size;
+ case CM_NOCOMPRESSION: // If it's uncompressed, we directly write the data into our destination, and return the bytes read.
+#ifdef NO_PNG_LUMPS
+ {
+ size_t bytesread = fread(dest, 1, size, handle);
+ ErrorIfPNG(dest, bytesread, wadfiles[wad]->filename, l->name2);
+ return bytesread;
+ }
+#else
+ return fread(dest, 1, size, handle);
+#endif
+ case CM_LZF: // Is it LZF compressed? Used by ZWADs.
+ {
+#ifdef ZWAD
+ char *rawData; // The lump's raw data.
+ char *decData; // Lump's decompressed real data.
+ size_t retval; // Helper var, lzf_decompress returns 0 when an error occurs.
+
+ rawData = Z_Malloc(l->disksize, PU_STATIC, NULL);
+ decData = Z_Malloc(l->size, PU_STATIC, NULL);
+
+ if (fread(rawData, 1, l->disksize, handle) < l->disksize)
+ I_Error("wad %d, lump %d: cannot read compressed data", wad, lump);
+ retval = lzf_decompress(rawData, l->disksize, decData, l->size);
+#ifndef AVOID_ERRNO
+ if (retval == 0) // If this was returned, check if errno was set
+ {
+ // errno is a global var set by the lzf functions when something goes wrong.
+ if (errno == E2BIG)
+ I_Error("wad %d, lump %d: compressed data too big (bigger than %s)", wad, lump, sizeu1(l->size));
+ else if (errno == EINVAL)
+ I_Error("wad %d, lump %d: invalid compressed data", wad, lump);
+ }
+ // Otherwise, fall back on below error (if zero was actually the correct size then ???)
+#endif
+ if (retval != l->size)
+ {
+ I_Error("wad %d, lump %d: decompressed to wrong number of bytes (expected %s, got %s)", wad, lump, sizeu1(l->size), sizeu2(retval));
+ }
+
+ if (!decData) // Did we get no data at all?
+ return 0;
+ M_Memcpy(dest, decData + offset, size);
+ Z_Free(rawData);
+ Z_Free(decData);
+#ifdef NO_PNG_LUMPS
+ ErrorIfPNG(dest, size, wadfiles[wad]->filename, l->name2);
+#endif
+ return size;
+#else
+ //I_Error("ZWAD files not supported on this platform.");
+ return 0;
+#endif
+ }
+#ifdef HAVE_ZLIB
+ case CM_DEFLATE: // Is it compressed via DEFLATE? Very common in ZIPs/PK3s, also what most doom-related editors support.
+ {
+ UINT8 *rawData; // The lump's raw data.
+ UINT8 *decData; // Lump's decompressed real data.
+
+ int zErr; // Helper var.
+ z_stream strm;
+ unsigned long rawSize = l->disksize;
+ unsigned long decSize = l->size;
+
+ rawData = Z_Malloc(rawSize, PU_STATIC, NULL);
+ decData = Z_Malloc(decSize, PU_STATIC, NULL);
+
+ if (fread(rawData, 1, rawSize, handle) < rawSize)
+ I_Error("wad %d, lump %d: cannot read compressed data", wad, lump);
+
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+
+ strm.total_in = strm.avail_in = rawSize;
+ strm.total_out = strm.avail_out = decSize;
+
+ strm.next_in = rawData;
+ strm.next_out = decData;
+
+ zErr = inflateInit2(&strm, -15);
+ if (zErr == Z_OK)
+ {
+ zErr = inflate(&strm, Z_FINISH);
+ if (zErr == Z_STREAM_END)
+ {
+ M_Memcpy(dest, decData, size);
+ }
+ else
+ {
+ size = 0;
+ zerr(zErr);
+ (void)inflateEnd(&strm);
+ }
+ }
+ else
+ {
+ CONS_Printf("whopet\n");
+ size = 0;
+ zerr(zErr);
+ }
+
+ Z_Free(rawData);
+ Z_Free(decData);
+
+#ifdef NO_PNG_LUMPS
+ ErrorIfPNG(dest, size, wadfiles[wad]->filename, l->name2);
+#endif
+ return size;
+ }
+#endif
+ default:
+ I_Error("wad %d, lump %d: unsupported compression type!", wad, lump);
}
- else
- return W_RawReadLumpHeader(wad, lump, dest, size, offset);
+ return -1;
}
size_t W_ReadLumpHeader(lumpnum_t lumpnum, void *dest, size_t size, size_t offset)
@@ -1187,12 +1634,12 @@ static int W_VerifyFile(const char *filename, lumpchecklist_t *checklist,
if ((handle = W_OpenWadFile(&filename, false)) == NULL)
return -1;
- // detect dehacked file with the "soc" extension
- if (stricmp(&filename[strlen(filename) - 4], ".soc") != 0
+ // detect wad file by the absence of the other supported extensions
+ if (stricmp(&filename[strlen(filename) - 4], ".soc")
#ifdef HAVE_BLUA
- && stricmp(&filename[strlen(filename) - 4], ".lua") != 0
+ && stricmp(&filename[strlen(filename) - 4], ".lua")
#endif
- )
+ && stricmp(&filename[strlen(filename) - 4], ".pk3"))
{
// assume wad file
wadinfo_t header;
diff --git a/src/w_wad.h b/src/w_wad.h
index 8da22804..e2e17740 100644
--- a/src/w_wad.h
+++ b/src/w_wad.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -22,6 +22,22 @@
#pragma interface
#endif
+// a raw entry of the wad directory
+// NOTE: This sits here and not in w_wad.c because p_setup.c makes use of it to load map WADs inside PK3s.
+#if defined(_MSC_VER)
+#pragma pack(1)
+#endif
+typedef struct
+{
+ UINT32 filepos; // file offset of the resource
+ UINT32 size; // size of the resource
+ char name[8]; // name of the resource
+} ATTRPACK filelump_t;
+#if defined(_MSC_VER)
+#pragma pack()
+#endif
+
+
// ==============================================================
// WAD FILE STRUCTURE DEFINITIONS
// ==============================================================
@@ -34,21 +50,33 @@ typedef struct
UINT32 infotableofs; // the 'directory' of resources
} wadinfo_t;
+// Available compression methods for lumps.
+typedef enum
+{
+ CM_NOCOMPRESSION,
+#ifdef HAVE_ZLIB
+ CM_DEFLATE,
+#endif
+ CM_LZF,
+ CM_UNSUPPORTED
+} compmethod;
+
// a memory entry of the wad directory
typedef struct
{
unsigned long position; // filelump_t filepos
unsigned long disksize; // filelump_t size
char name[9]; // filelump_t name[]
+ char *name2; // Used by PK3s. Dynamically allocated name.
size_t size; // real (uncompressed) size
- INT32 compressed; // i
+ compmethod compression; // lump compression method
} lumpinfo_t;
// =========================================================================
// DYNAMIC WAD LOADING
// =========================================================================
-#define MAX_WADPATH 128
+#define MAX_WADPATH 512
#define MAX_WADFILES 48 // maximum of wad files used at the same time
// (there is a max of simultaneous open files anyway, and this should be plenty)
@@ -58,9 +86,21 @@ typedef struct
#include "m_aatree.h"
#endif
+// Resource type of the WAD. Yeah, I know this sounds dumb, but I'll leave it like this until I clean up the code further.
+typedef enum restype
+{
+ RET_WAD,
+ RET_SOC,
+ RET_LUA,
+ RET_PK3,
+ RET_UNKNOWN,
+} restype_t;
+
+
typedef struct wadfile_s
{
char *filename;
+ restype_t type;
lumpinfo_t *lumpinfo;
lumpcache_t *lumpcache;
#ifdef HWRENDER
@@ -86,7 +126,7 @@ void W_Shutdown(void);
// Opens a WAD file. Returns the FILE * handle for the file, or NULL if not found or could not be opened
FILE *W_OpenWadFile(const char **filename, boolean useerrors);
// Load and add a wadfile to the active wad files, returns numbers of lumps, INT16_MAX on error
-UINT16 W_LoadWadFile(const char *filename);
+UINT16 W_InitFile(const char *filename);
#ifdef DELFILE
void W_UnloadWadFile(UINT16 num);
#endif
@@ -99,6 +139,12 @@ const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
const char *W_CheckNameForNum(lumpnum_t lumpnum);
UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump); // checks only in one pwad
+
+UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump);
+UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump);
+UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump);
+
+lumpnum_t W_CheckNumForMap(const char *name);
lumpnum_t W_CheckNumForName(const char *name);
lumpnum_t W_GetNumForName(const char *name); // like W_CheckNumForName but I_Error on LUMPERROR
lumpnum_t W_CheckNumForNameInBlock(const char *name, const char *blockstart, const char *blockend);
@@ -107,6 +153,12 @@ UINT8 W_LumpExists(const char *name); // Lua uses this.
size_t W_LumpLengthPwad(UINT16 wad, UINT16 lump);
size_t W_LumpLength(lumpnum_t lumpnum);
+boolean W_IsLumpWad(lumpnum_t lumpnum); // for loading maps from WADs in PK3s
+
+#ifdef HAVE_ZLIB
+void zerr(int ret); // zlib error checking
+#endif
+
size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, size_t offset);
size_t W_ReadLumpHeader(lumpnum_t lump, void *dest, size_t size, size_t offest); // read all or a part of a lump
void W_ReadLumpPwad(UINT16 wad, UINT16 lump, void *dest);
diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg
index da66e996..802fb517 100644
--- a/src/win32/Makefile.cfg
+++ b/src/win32/Makefile.cfg
@@ -9,6 +9,9 @@
ifdef MINGW64
NOASM=1
NONX86=1
+ HAVE_LIBGME=1
+ LIBGME_CFLAGS=-I../libs/gme/include
+ LIBGME_LDFLAGS=-L../libs/gme/win64 -lgme
SDL_CFLAGS?=-I../libs/SDL2/x86_64-w64-mingw32/include/SDL2 -I../libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2 -Dmain=SDL_main
SDL_LDFLAGS?=-L../libs/SDL2/x86_64-w64-mingw32/lib -L../libs/SDL2_mixer/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
else
@@ -23,7 +26,9 @@ ifndef NOASM
USEASM=1
endif
+ifndef MINGW64 #miniupnc is broken with MINGW64
HAVE_MINIUPNPC=1
+endif
OPTS=-DSTDC_HEADERS
diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj
index 0722c0b6..5bfa29b8 100644
--- a/src/win32/Srb2win-vc10.vcxproj
+++ b/src/win32/Srb2win-vc10.vcxproj
@@ -132,6 +132,7 @@
+
diff --git a/src/win32/Srb2win-vc10.vcxproj.filters b/src/win32/Srb2win-vc10.vcxproj.filters
index 95e79cab..d20dd672 100644
--- a/src/win32/Srb2win-vc10.vcxproj.filters
+++ b/src/win32/Srb2win-vc10.vcxproj.filters
@@ -228,6 +228,9 @@
LUA
+
+ LUA
+
LUA
diff --git a/src/win32/Srb2win.rc b/src/win32/Srb2win.rc
index 426a5e01..b60ba750 100644
--- a/src/win32/Srb2win.rc
+++ b/src/win32/Srb2win.rc
@@ -36,18 +36,18 @@ IDI_ICON1 ICON DISCARDABLE "Srb2win.ico"
// TEXTINCLUDE
//
-1 TEXTINCLUDE DISCARDABLE
+1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
-2 TEXTINCLUDE DISCARDABLE
+2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE DISCARDABLE
+3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
@@ -84,7 +84,7 @@ BEGIN
VALUE "FileDescription", "Sonic Robo Blast 2\0"
VALUE "FileVersion", "1, 09\0"
VALUE "InternalName", "srb2\0"
- VALUE "LegalCopyright", "Copyright © 1998-2005 Sonic Team Junior\0"
+ VALUE "LegalCopyright", "Copyright � 1998-2018 by Sonic Team Junior\0"
VALUE "LegalTrademarks", "Sonic the Hedgehog and related characters are trademarks of Sega.\0"
VALUE "OriginalFilename", "srb2win.exe\0"
VALUE "PrivateBuild", "\0"
diff --git a/src/win32/win_sys.c b/src/win32/win_sys.c
index 882e3e58..75aca68d 100644
--- a/src/win32/win_sys.c
+++ b/src/win32/win_sys.c
@@ -771,6 +771,8 @@ void I_Quit(void)
ShowEndTxt(co);
}
fflush(stderr);
+ if (myargmalloc)
+ free(myargv); // Deallocate allocated memory
W_Shutdown();
exit(0);
}
diff --git a/src/y_inter.c b/src/y_inter.c
index 50cae957..379d5cd3 100644
--- a/src/y_inter.c
+++ b/src/y_inter.c
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
-// Copyright (C) 2004-2016 by Sonic Team Junior.
+// Copyright (C) 2004-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -712,6 +712,9 @@ static void Y_UpdateRecordReplays(void)
if ((earnedEmblems = M_CheckLevelEmblems()))
CONS_Printf(M_GetText("\x82" "Earned %hu medal%s for Record Attack records.\n"), (UINT16)earnedEmblems, earnedEmblems > 1 ? "s" : "");
+ if (M_UpdateUnlockablesAndExtraEmblems(false))
+ S_StartSound(NULL, sfx_ncitem);
+
// SRB2Kart - save here so you NEVER lose your earned times/medals.
G_SaveGameData(false);
@@ -1159,7 +1162,10 @@ static void Y_VoteStops(SINT8 pick, SINT8 level)
S_StartSound(NULL, sfx_noooo2); // gasp
else if (mapheaderinfo[nextmap] && (mapheaderinfo[nextmap]->menuflags & LF2_HIDEINMENU))
S_StartSound(NULL, sfx_noooo1); // this is bad
- else if (!splitscreen && pick == consoleplayer)
+ else if (netgame && (pick == consoleplayer
+ || pick == secondarydisplayplayer
+ || pick == thirddisplayplayer
+ || pick == fourthdisplayplayer))
S_StartSound(NULL, sfx_yeeeah); // yeeeah!
else
S_StartSound(NULL, sfx_kc48); // just a cool sound
diff --git a/src/y_inter.h b/src/y_inter.h
index 95ea67cc..6162dc28 100644
--- a/src/y_inter.h
+++ b/src/y_inter.h
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
-// Copyright (C) 2004-2016 by Sonic Team Junior.
+// Copyright (C) 2004-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/z_zone.c b/src/z_zone.c
index eecb6e80..a3e13422 100644
--- a/src/z_zone.c
+++ b/src/z_zone.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2006 by Graue.
-// Copyright (C) 2006-2016 by Sonic Team Junior.
+// Copyright (C) 2006-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/z_zone.h b/src/z_zone.h
index cd5fb2f7..1424a378 100644
--- a/src/z_zone.h
+++ b/src/z_zone.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/tools/masterserver/structure.sql b/tools/masterserver/structure.sql
new file mode 100644
index 00000000..3cc2cb15
--- /dev/null
+++ b/tools/masterserver/structure.sql
@@ -0,0 +1,117 @@
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
+SET AUTOCOMMIT = 0;
+START TRANSACTION;
+SET time_zone = "+00:00";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8mb4 */;
+
+--
+-- Database: `srb2ms`
+--
+
+CREATE DATABASE IF NOT EXISTS `srb2ms` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+USE `srb2ms`;
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ms_bans`
+--
+
+CREATE TABLE `ms_bans` (
+ `bid` int(11) DEFAULT NULL,
+ `ipstart` int(11) DEFAULT NULL,
+ `ipend` int(11) DEFAULT NULL,
+ `full_endtime` int(11) DEFAULT NULL,
+ `permanent` tinyint(1) DEFAULT NULL,
+ `hostonly` tinyint(1) DEFAULT NULL,
+ `reason` text COLLATE utf8mb4_unicode_ci
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ms_rooms`
+--
+
+CREATE TABLE `ms_rooms` (
+ `room_id` int(11) NOT NULL,
+ `title` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `motd` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `visible` tinyint(1) NOT NULL,
+ `order` int(11) NOT NULL,
+ `private` tinyint(1) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Dumping data for table `ms_rooms`
+--
+
+INSERT INTO `ms_rooms` (`room_id`, `title`, `motd`, `visible`, `order`, `private`) VALUES
+(10, 'Example', 'Example Room', 1, 0, 0),
+(0, 'All', 'View all of the servers currently being hosted.', 1, 1, 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ms_servers`
+--
+
+CREATE TABLE `ms_servers` (
+ `sid` int(11) NOT NULL,
+ `name` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `ip` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `port` int(11) NOT NULL,
+ `version` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `timestamp` int(11) NOT NULL,
+ `room` int(11) NOT NULL,
+ `key` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `room_override` int(11) NOT NULL,
+ `upnow` tinyint(1) NOT NULL,
+ `permanent` tinyint(1) NOT NULL,
+ `delisted` tinyint(1) NOT NULL,
+ `sticky` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ms_versions`
+--
+
+CREATE TABLE `ms_versions` (
+ `mod_id` int(11) NOT NULL,
+ `mod_version` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Dumping data for table `ms_versions`
+--
+
+INSERT INTO `ms_versions` (`mod_id`, `mod_version`) VALUES
+(12, 25);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `user`
+--
+
+CREATE TABLE `user` (
+ `userid` int(11) NOT NULL,
+ `username` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `live_authkey` blob NOT NULL,
+ `live_publickey` blob NOT NULL,
+ `salt` blob NOT NULL,
+ `password` blob NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+COMMIT;
+
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;