Merge remote-tracking branch 'upstream/master' into truecolor

# Conflicts:
#	src/v_video.cpp
This commit is contained in:
Magnus Norddahl 2016-09-19 23:55:15 +02:00
commit 77233f2f65
127 changed files with 4275 additions and 1675 deletions

View file

@ -14,6 +14,11 @@ list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} )
include( CreateLaunchers )
include( FindPackageHandleStandardArgs )
# Produce a warning if XP support will be missing.
if( MSVC14 AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" )
message( WARNING "This project supports Windows XP (including XP x64), but you must set the optional toolset to v140_xp manually to have it in your build! Use -T \"v140_xp\" from the command prompt." )
endif()
# Support cross compiling
option( FORCE_CROSSCOMPILE "Turn on cross compiling." NO )
if( FORCE_CROSSCOMPILE )

27
docs/licenses/README.TXT Normal file
View file

@ -0,0 +1,27 @@
The original Doom source code was released by id Software under the
Doom Source Code License. See doomlic.txt.
Parts of the renderer use code from the BUILD engine by Ken Silverman.
See buildlic.txt.
The majority of original code uses a BSD-like lincese. See bsd.txt.
This software is based in part on the work of the Independent JPEG Group.
This software uses the 'zlib' general purpose compression library by
Jean-loup Gailly and Mark Adler.
This software uses the gdtoa package, see gdtoa.txt.
This software uses the snes_spc library, which is covered by the GNU Lesser
General Public License. See lgpl.txt.
This software uses the "Dynamic Universal Music Bibliotheque" library for
MOD music playback. See dumb.txt for original license. The version used,
however, has been heavily modified from its original form and is the same
version used by the foobar2000 component foo_dumb as of mid-2008, found at
http://kode54.foobar2000.org/.
This software uses the OPL emulator from MAME 0.95. Playback of MUS files
on the OPL emulation is accomplished with some help from Vladimir Arnost's
MUS File Player Library, with fixes to make it more accurate.

27
docs/licenses/bsd.txt Normal file
View file

@ -0,0 +1,27 @@
**---------------------------------------------------------------------------
** Copyright 1998-2009 Randy Heit, Christoph Oelckers, et al.
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. 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.
** 3. 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 AUTHOR ``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 AUTHOR 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.
**---------------------------------------------------------------------------

View file

@ -0,0 +1,71 @@
BUILD SOURCE CODE LICENSE TERMS: 06/20/2000
[1] I give you permission to make modifications to my Build source and
distribute it, BUT:
[2] Any derivative works based on my Build source may be distributed ONLY
through the INTERNET.
[3] Distribution of any derivative works MUST be done completely FREE of
charge - no commercial exploitation whatsoever.
[4] Anything you distribute which uses a part of my Build Engine source
code MUST include:
[A] The following message somewhere in the archive:
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info.
[B] This text file "BUILDLIC.TXT" along with it.
[C] Any source files that you modify must include this message as well:
// This file has been modified from Ken Silverman's original release
[5] The use of the Build Engine for commercial purposes will require an
appropriate license arrangement with me. Contact information is
on my web site.
[6] I take no responsibility for damage to your system.
[7] Technical support: Before contacting me with questions, please read
and do ALL of the following!
[A] Look though ALL of my text files. There are 7 of them (including this
one). I like to think that I wrote them for a reason. You will find
many of your answers in the history section of BUILD.TXT and
BUILD2.TXT (they're located inside SRC.ZIP).
[B] If that doesn't satisfy you, then try going to:
"http://www.advsys.net/ken/buildsrc"
where I will maintain a Build Source Code FAQ (or perhaps I might
just provide a link to a good FAQ).
[C] I am willing to respond to questions, but ONLY if they come at a rate
that I can handle.
PLEASE TRY TO AVOID ASKING DUPLICATE QUESTIONS!
As my line of defense, I will post my current policy about
answering Build source questions (right below the E-mail address
on my web site.) You can check there to see if I'm getting
overloaded with questions or not.
If I'm too busy, it might say something like this:
I'm too busy to answer Build source questions right now.
Sorry, but don't expect a reply from me any time soon.
If I'm open for Build source questions, please state your question
clearly and don't include any unsolicited attachments unless
they're really small (like less than 50k). Assume that I have
a 28.8k modem. Also, don't leave out important details just
to make your question appear shorter - making me guess what
you're asking doesn't save me time!
----------------------------------------------------------------------------
-Ken S. (official web site: http://www.advsys.net/ken)

10
docs/licenses/cephes.txt Normal file
View file

@ -0,0 +1,10 @@
Some software in this archive may be from the book _Methods and
Programs for Mathematical Functions_ (Prentice-Hall or Simon & Schuster
International, 1989) or from the Cephes Mathematical Library, a
commercial product. In either event, it is copyrighted by the author.
What you see here may be used freely but it comes with no support or
guarantee.
Stephen L. Moshier
moshier@na-net.ornl.gov

112
docs/licenses/doomlic.txt Normal file
View file

@ -0,0 +1,112 @@
LIMITED USE SOFTWARE LICENSE AGREEMENT
This Limited Use Software License Agreement (the "Agreement")
is a legal agreement between you, the end-user, and Id Software, Inc.
("ID"). By downloading or purchasing the software material, which
includes source code (the "Source Code"), artwork data, music and
software tools (collectively, the "Software"), you are agreeing to
be bound by the terms of this Agreement. If you do not agree to the
terms of this Agreement, promptly destroy the Software you may have
downloaded or copied.
ID SOFTWARE LICENSE
1. Grant of License. ID grants to you the right to use the
Software. You have no ownership or proprietary rights in or to the
Software, or the Trademark. For purposes of this section, "use" means
loading the Software into RAM, as well as installation on a hard disk
or other storage device. The Software, together with any archive copy
thereof, shall be destroyed when no longer used in accordance with
this Agreement, or when the right to use the Software is terminated.
You agree that the Software will not be shipped, transferred or
exported into any country in violation of the U.S. Export
Administration Act (or any other law governing such matters) and that
you will not utilize, in any other manner, the Software in violation
of any applicable law.
2. Permitted Uses. For educational purposes only, you, the
end-user, may use portions of the Source Code, such as particular
routines, to develop your own software, but may not duplicate the
Source Code, except as noted in paragraph 4. The limited right
referenced in the preceding sentence is hereinafter referred to as
"Educational Use." By so exercising the Educational Use right you
shall not obtain any ownership, copyright, proprietary or other
interest in or to the Source Code, or any portion of the Source
Code. You may dispose of your own software in your sole discretion.
With the exception of the Educational Use right, you may not
otherwise use the Software, or an portion of the Software, which
includes the Source Code, for commercial gain.
3. Prohibited Uses: Under no circumstances shall you, the
end-user, be permitted, allowed or authorized to commercially exploit
the Software. Neither you nor anyone at your direction shall do any
of the following acts with regard to the Software, or any portion
thereof:
Rent;
Sell;
Lease;
Offer on a pay-per-play basis;
Distribute for money or any other consideration; or
In any other manner and through any medium whatsoever
commercially exploit or use for any commercial purpose.
Notwithstanding the foregoing prohibitions, you may commercially
exploit the software you develop by exercising the Educational Use
right, referenced in paragraph 2. hereinabove.
4. Copyright. The Software and all copyrights related thereto
(including all characters and other images generated by the Software
or depicted in the Software) are owned by ID and is protected by
United States copyright laws and international treaty provisions.
Id shall retain exclusive ownership and copyright in and to the
Software and all portions of the Software and you shall have no
ownership or other proprietary interest in such materials. You must
treat the Software like any other copyrighted material. You may not
otherwise reproduce, copy or disclose to others, in whole or in any
part, the Software. You may not copy the written materials
accompanying the Software. You agree to use your best efforts to
see that any user of the Software licensed hereunder complies with
this Agreement.
5. NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS
IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT
TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL
RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO
JURISDICTION. ID DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE
WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS.
THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER EXPRESS
WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES,
DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE
MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF
OF ID.
Exclusive Remedies. The Software is being offered to you
free of any charge. You agree that you have no remedy against ID, its
affiliates, contractors, suppliers, and agents for loss or damage
caused by any defect or failure in the Software regardless of the form
of action, whether in contract, tort, includinegligence, strict
liability or otherwise, with regard to the Software. This Agreement
shall be construed in accordance with and governed by the laws of the
State of Texas. Copyright and other proprietary matters will be
governed by United States laws and international treaties. IN ANY
CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PROFITS, LOST
SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER
SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT,
NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY
OTHER PARTY. Some jurisdictions do not allow the exclusion or
limitation of incidental or consequential damages, so the above
limitation or exclusion may not apply to you.

54
docs/licenses/dumb.txt Normal file
View file

@ -0,0 +1,54 @@
/* _______ ____ __ ___ ___
* \ _ \ \ / \ / \ \ / / ' ' '
* | | \ \ | | || | \/ | . .
* | | | | | | || ||\ /| |
* | | | | | | || || \/ | | ' ' '
* | | | | | | || || | | . .
* | |_/ / \ \__// || | |
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
* / \
* / . \
* licence.txt - Conditions for use of DUMB. / / \ \
* | < / \_
* If you do not agree to these terms, please | \/ /\ /
* do not use DUMB. \_ / > /
* | \ / /
* Information in [brackets] is provided to aid | ' /
* interpretation of the licence. \__/
*/
Dynamic Universal Music Bibliotheque
Copyright (C) 2001-2003 Ben Davis, Robert J Ohannessian and Julien Cugniere
This software is provided 'as-is', without any express or implied warranty.
In no event shall 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, you are requested to acknowledge its use in the product
documentation, along with details on where to get an unmodified version of
this software, but this is not a strict requirement.
[Note that the above point asks for a link to DUMB, not just a mention.
Googling for DUMB doesn't help much! The URL is "http://dumb.sf.net/".]
[The only reason why the link is not strictly required is that such a
requirement prevents DUMB from being used in projects with certain other
licences, notably the GPL. See http://www.gnu.org/philosophy/bsd.html .]
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 from or altered in any source distribution.
4. If you are using the Program in someone else's bedroom at any Monday
3:05 PM, you are not allowed to modify the Program for ten minutes. [This
clause provided by Inphernic; every licence should contain at least one
clause, the reasoning behind which is far from obvious.]

27
docs/licenses/gdtoa.txt Normal file
View file

@ -0,0 +1,27 @@
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/

504
docs/licenses/lgpl.txt Normal file
View file

@ -0,0 +1,504 @@
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.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View file

@ -1,11 +1,17 @@
cmake_minimum_required( VERSION 2.8.7 )
if( NOT NO_FMOD AND FMOD_INCLUDE_DIR )
add_library( output_sdl MODULE output_sdl.c )
include_directories( ${FMOD_INCLUDE_DIR} ${SDL2_INCLUDE_DIR} )
check_library_exists(${FMOD_LIBRARY} "FMOD_System_GetDriverCaps" "fmod.h" FMOD_IS_EX)
# Only usable with FMOD Ex
if( FMOD_IS_EX )
include_directories( ${FMOD_INCLUDE_DIR} ${SDL2_INCLUDE_DIR} )
add_library( output_sdl MODULE output_sdl.c )
target_link_libraries( output_sdl ${SDL2_LIBRARY} )
FILE( WRITE ${CMAKE_CURRENT_BINARY_DIR}/link-make "if [ ! -e ${ZDOOM_OUTPUT_DIR}/liboutput_sdl.so ]; then ln -sf output_sdl/liboutput_sdl.so ${ZDOOM_OUTPUT_DIR}/liboutput_sdl.so; fi" )
add_custom_command( TARGET output_sdl POST_BUILD
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make
COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make )
endif()
endif()

View file

@ -262,6 +262,10 @@ if( NOT NO_FMOD )
if( FMOD_INCLUDE_DIR )
message( STATUS "FMOD include files found at ${FMOD_INCLUDE_DIR}" )
include_directories( "${FMOD_INCLUDE_DIR}" )
if( EXISTS "${FMOD_INCLUDE_DIR}/fmod_common.h" )
set( FMOD_STUDIO YES )
endif()
else()
message( STATUS "Could not find FMOD include files" )
set( NO_FMOD ON )
@ -484,9 +488,11 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( CMAKE_C_FLAGS "-Wno-unused-result ${CMAKE_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "-Wno-unused-result ${CMAKE_CXX_FLAGS}" )
endif()
if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
if( APPLE OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "3.6" )
set( CMAKE_CXX_FLAGS "-Wno-inconsistent-missing-override ${CMAKE_CXX_FLAGS}" )
endif()
endif()
set( CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers -ffp-contract=off ${CMAKE_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers -ffp-contract=off ${CMAKE_CXX_FLAGS}" )
@ -633,6 +639,7 @@ set( PLAT_WIN32_SOURCES
win32/i_main.cpp
win32/i_movie.cpp
win32/i_system.cpp
win32/i_specialpaths.cpp
win32/st_start.cpp
win32/win32video.cpp )
set( PLAT_POSIX_SOURCES
@ -650,8 +657,11 @@ set( PLAT_SDL_SOURCES
posix/sdl/i_timer.cpp
posix/sdl/sdlvideo.cpp
posix/sdl/st_start.cpp )
set( PLAT_UNIX_SOURCES
posix/unix/i_specialpaths.cpp )
set( PLAT_OSX_SOURCES
posix/osx/iwadpicker_cocoa.mm
posix/osx/i_specialpaths.mm
posix/osx/zdoom.icns )
set( PLAT_COCOA_SOURCES
posix/cocoa/critsec.cpp
@ -668,7 +678,7 @@ set( PLAT_COCOA_SOURCES
if( WIN32 )
set( SYSTEM_SOURCES_DIR win32 )
set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} )
set( OTHER_SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} )
set( OTHER_SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} ${PLAT_UNIX_SOURCES} )
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
# CMake is not set up to compile and link rc files with GCC. :(
@ -683,12 +693,12 @@ elseif( APPLE )
if( OSX_COCOA_BACKEND )
set( SYSTEM_SOURCES_DIR posix posix/cocoa )
set( SYSTEM_SOURCES ${PLAT_COCOA_SOURCES} )
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_SDL_SOURCES} )
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_UNIX_SOURCES} )
else()
set( SYSTEM_SOURCES_DIR posix posix/sdl )
set( SYSTEM_SOURCES ${PLAT_SDL_SOURCES} )
set( PLAT_OSX_SOURCES ${PLAT_OSX_SOURCES} posix/sdl/i_system.mm )
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_COCOA_SOURCES} )
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_COCOA_SOURCES} ${PLAT_UNIX_SOURCES} )
endif()
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} ${PLAT_POSIX_SOURCES} ${PLAT_OSX_SOURCES} "${FMOD_LIBRARY}" )
@ -698,7 +708,7 @@ elseif( APPLE )
set_source_files_properties( posix/osx/iwadpicker_cocoa.mm PROPERTIES COMPILE_FLAGS -fobjc-exceptions )
else()
set( SYSTEM_SOURCES_DIR posix posix/sdl )
set( SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} )
set( SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_UNIX_SOURCES} )
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} )
endif()
@ -1246,7 +1256,6 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE
${FASTMATH_SOURCES}
${PCH_SOURCES}
x86.cpp
m_specialpaths.cpp
strnatcmp.c
zstring.cpp
math/asin.c
@ -1326,7 +1335,16 @@ endif()
if( MSVC )
option( ZDOOM_GENERATE_MAPFILE "Generate .map file for debugging." OFF )
set( LINKERSTUFF "/MANIFEST:NO /DELAYLOAD:\"fmodex${X64}.dll\"" )
set( LINKERSTUFF "/MANIFEST:NO" )
if( NOT NO_FMOD )
if( FMOD_STUDIO )
set( LINKERSTUFF "${LINKERSTUFF} /DELAYLOAD:\"fmod${X64}.dll\"" )
else()
set( LINKERSTUFF "${LINKERSTUFF} /DELAYLOAD:\"fmodex${X64}.dll\"" )
endif()
endif()
if( ZDOOM_GENERATE_MAPFILE )
set( LINKERSTUFF "${LINKERSTUFF} /MAP" )
endif()
@ -1366,17 +1384,23 @@ if( APPLE )
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/posix/osx/zdoom-info.plist" )
if( NOT NO_FMOD )
if( FMOD_STUDIO )
set( FMOD_DYLIB libfmod.dylib )
else()
set( FMOD_DYLIB libfmodex.dylib )
endif()
# Fix fmod link so that it can be found in the app bundle.
find_program( OTOOL otool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" )
find_program( INSTALL_NAME_TOOL install_name_tool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" )
execute_process( COMMAND "${OTOOL}" -L "${FMOD_LIBRARY}"
COMMAND grep "libfmodex.dylib (compat"
COMMAND grep "${FMOD_DYLIB} (compat"
COMMAND head -n1
COMMAND awk "{print $1}"
OUTPUT_VARIABLE FMOD_LINK
OUTPUT_STRIP_TRAILING_WHITESPACE )
add_custom_command( TARGET zdoom POST_BUILD
COMMAND "${INSTALL_NAME_TOOL}" -change "${FMOD_LINK}" @executable_path/../Frameworks/libfmodex.dylib "$<TARGET_FILE:zdoom>"
COMMAND "${INSTALL_NAME_TOOL}" -change "${FMOD_LINK}" @executable_path/../Frameworks/${FMOD_DYLIB} "$<TARGET_FILE:zdoom>"
COMMENT "Relinking FMOD Ex" )
endif()
endif()
@ -1410,6 +1434,7 @@ source_group("Resource Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/r
source_group("POSIX Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/.+")
source_group("Cocoa Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/cocoa/.+")
source_group("OS X Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/osx/.+")
source_group("Unix Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/unix/.+")
source_group("SDL Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/sdl/.+")
source_group("SFMT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+")
source_group("Shared Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_shared/.+")

View file

@ -42,7 +42,7 @@ DEFINE_SPECIAL(Ceiling_LowerByValue, 40, 3, 5, 5)
DEFINE_SPECIAL(Ceiling_RaiseByValue, 41, 3, 4, 4)
DEFINE_SPECIAL(Ceiling_CrushAndRaise, 42, 3, 4, 4)
DEFINE_SPECIAL(Ceiling_LowerAndCrush, 43, 3, 4, 4)
DEFINE_SPECIAL(Ceiling_CrushStop, 44, 1, 1, 1)
DEFINE_SPECIAL(Ceiling_CrushStop, 44, 1, 2, 2)
DEFINE_SPECIAL(Ceiling_CrushRaiseAndStay, 45, 3, 4, 4)
DEFINE_SPECIAL(Floor_CrushStop, 46, 1, 1, 1)
DEFINE_SPECIAL(Ceiling_MoveToValue, 47, 3, 5, 5)
@ -59,7 +59,7 @@ DEFINE_SPECIAL(Sector_SetPortal, 57, -1, -1, 5)
DEFINE_SPECIAL(Sector_CopyScroller, 58, -1, -1, 2)
DEFINE_SPECIAL(Polyobj_OR_MoveToSpot, 59, 3, 3, 3)
DEFINE_SPECIAL(Plat_PerpetualRaise, 60, 3, 3, 3)
DEFINE_SPECIAL(Plat_Stop, 61, 1, 1, 1)
DEFINE_SPECIAL(Plat_Stop, 61, 1, 2, 2)
DEFINE_SPECIAL(Plat_DownWaitUpStay, 62, 3, 3, 3)
DEFINE_SPECIAL(Plat_DownByValue, 63, 4, 4, 4)
DEFINE_SPECIAL(Plat_UpWaitDownStay, 64, 3, 3, 3)

View file

@ -111,6 +111,8 @@ struct FPortalGroupArray;
// Any questions?
//
// --- mobj.flags ---
enum ActorFlag
{
@ -283,7 +285,7 @@ enum ActorFlag4
enum ActorFlag5
{
MF5_DONTDRAIN = 0x00000001, // cannot be drained health from.
/* FREE SLOT 0x00000002*/
MF5_GETOWNER = 0x00000002,
MF5_NODROPOFF = 0x00000004, // cannot drop off under any circumstances.
MF5_NOFORWARDFALL = 0x00000008, // Does not make any actor fall forward by being damaged by this
MF5_COUNTSECRET = 0x00000010, // From Doom 64: actor acts like a secret
@ -1014,7 +1016,9 @@ public:
SDWORD tics; // state tic counter
FState *state;
VMFunction *Damage; // For missiles and monster railgun
//VMFunction *Damage; // For missiles and monster railgun
int DamageVal;
VMFunction *DamageFunc;
int projectileKickback;
ActorFlags flags;
ActorFlags2 flags2; // Heretic flags
@ -1057,6 +1061,7 @@ public:
int skillrespawncount;
int TIDtoHate; // TID of things to hate (0 if none)
FNameNoInit Species; // For monster families
TObjPtr<AActor> alternative; // (Un)Morphed actors stored here. Those with the MF_UNMORPHED flag are the originals.
TObjPtr<AActor> tracer; // Thing being chased/attacked for tracers
TObjPtr<AActor> master; // Thing which spawned this one (prevents mutual attacks)
double Floorclip; // value to use for floor clipping
@ -1200,6 +1205,23 @@ public:
FState *GetRaiseState();
void Revive();
void SetDamage(int dmg)
{
DamageVal = dmg;
DamageFunc = nullptr;
}
bool IsZeroDamage() const
{
return DamageVal == 0 && DamageFunc == nullptr;
}
void RestoreDamage()
{
DamageVal = GetDefault()->DamageVal;
DamageFunc = GetDefault()->DamageFunc;
}
FState *FindState (FName label) const
{
return GetClass()->FindState(1, &label);

View file

@ -494,7 +494,7 @@ bool FCajunMaster::LoadBots ()
tmp = M_GetCajunPath(BOTFILENAME);
if (tmp.IsEmpty())
{
DPrintf ("No " BOTFILENAME ", so no bots\n");
DPrintf (DMSG_ERROR, "No " BOTFILENAME ", so no bots\n");
return false;
}
try

View file

@ -259,7 +259,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
r = pr_botmove();
if (r < 128)
{
TThinkerIterator<AInventory> it (STAT_INVENTORY, bglobal.firstthing);
TThinkerIterator<AInventory> it (MAX_STATNUM+1, bglobal.firstthing);
AInventory *item = it.Next();
if (item != NULL || (item = it.Next()) != NULL)

View file

@ -923,10 +923,21 @@ static bool IsActorACountItem(AActor *mo)
return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL && mo->flags&MF_COUNTITEM;
}
static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const char *FilterName)
// [SP] for all actors
static bool IsActor(AActor *mo)
{
if (mo->IsKindOf(RUNTIME_CLASS(AInventory)))
return static_cast<AInventory *>(mo)->Owner == NULL; // [SP] Exclude inventory-owned items
else
return true;
}
// [SP] modified - now allows showing count only, new arg must be passed. Also now still counts regardless, if lists are printed.
static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const char *FilterName, bool countOnly)
{
AActor *mo;
const PClass *FilterClass = NULL;
int counter = 0;
if (FilterName != NULL)
{
@ -943,10 +954,32 @@ static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const cha
{
if ((FilterClass == NULL || mo->IsA(FilterClass)) && IsActorType(mo))
{
counter++;
if (!countOnly)
Printf ("%s at (%f,%f,%f)\n",
mo->GetClass()->TypeName.GetChars(), mo->X(), mo->Y(), mo->Z());
}
}
Printf("%i match(s) found.\n", counter);
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
CCMD(actorlist) // [SP] print all actors (this can get quite big?)
{
if (CheckCheatmode ()) return;
PrintFilteredActorList(IsActor, argv.argc() > 1 ? argv[1] : NULL, false);
}
CCMD(actornum) // [SP] count all actors
{
if (CheckCheatmode ()) return;
PrintFilteredActorList(IsActor, argv.argc() > 1 ? argv[1] : NULL, true);
}
//-----------------------------------------------------------------------------
@ -958,7 +991,14 @@ CCMD(monster)
{
if (CheckCheatmode ()) return;
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL);
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL, false);
}
CCMD(monsternum) // [SP] count monsters
{
if (CheckCheatmode ()) return;
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL, true);
}
//-----------------------------------------------------------------------------
@ -970,7 +1010,14 @@ CCMD(items)
{
if (CheckCheatmode ()) return;
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL);
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL, false);
}
CCMD(itemsnum) // [SP] # of any items
{
if (CheckCheatmode ()) return;
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL, true);
}
//-----------------------------------------------------------------------------
@ -982,7 +1029,14 @@ CCMD(countitems)
{
if (CheckCheatmode ()) return;
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL);
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL, false);
}
CCMD(countitemsnum) // [SP] # of counted items
{
if (CheckCheatmode ()) return;
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL, true);
}
//-----------------------------------------------------------------------------

View file

@ -159,12 +159,37 @@ static int HistSize;
CVAR (Float, con_notifytime, 3.f, CVAR_ARCHIVE)
CVAR (Bool, con_centernotify, false, CVAR_ARCHIVE)
CUSTOM_CVAR (Int, con_scaletext, 0, CVAR_ARCHIVE) // Scale notify text at high resolutions?
CUSTOM_CVAR (Int, con_scaletext, 1, CVAR_ARCHIVE) // Scale notify text at high resolutions?
{
if (self < 0) self = 0;
if (self > 3) self = 3;
}
CUSTOM_CVAR(Int, con_scale, 0, CVAR_ARCHIVE)
{
if (self < 0) self = 0;
}
int active_con_scale()
{
if (con_scale == 0)
return uiscale;
else
return con_scale;
}
int active_con_scaletext()
{
switch (con_scaletext)
{
default:
case 0: return 1;
case 1: return uiscale;
case 2: return 2;
case 3: return 4;
}
}
CUSTOM_CVAR(Float, con_alpha, 0.75f, CVAR_ARCHIVE)
{
if (self < 0.f) self = 0.f;
@ -493,13 +518,13 @@ void C_AddNotifyString (int printlevel, const char *source)
return;
}
switch (con_scaletext)
if (active_con_scaletext() == 0)
{
default:
case 0: width = DisplayWidth; break;
case 1: width = DisplayWidth / CleanXfac; break;
case 2: width = DisplayWidth / 2; break;
case 3: width = DisplayWidth / 4; break;
width = DisplayWidth / CleanXfac;
}
else
{
width = DisplayWidth / active_con_scaletext();
}
if (addtype == APPENDLINE && NotifyStrings[NUMNOTIFIES-1].PrintLevel == printlevel)
@ -612,12 +637,12 @@ int Printf (const char *format, ...)
return count;
}
int DPrintf (const char *format, ...)
int DPrintf (int level, const char *format, ...)
{
va_list argptr;
int count;
if (developer)
if (developer >= level)
{
va_start (argptr, format);
count = VPrintf (PRINT_HIGH, format, argptr);
@ -721,7 +746,7 @@ static void C_DrawNotifyText ()
canskip = true;
lineadv = SmallFont->GetHeight ();
if (con_scaletext == 1)
if (active_con_scaletext() == 0)
{
lineadv *= CleanYfac;
}
@ -755,7 +780,7 @@ static void C_DrawNotifyText ()
else
color = PrintColors[NotifyStrings[i].PrintLevel];
if (con_scaletext == 1)
if (active_con_scaletext() == 0)
{
if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
@ -766,7 +791,7 @@ static void C_DrawNotifyText ()
line, NotifyStrings[i].Text, DTA_CleanNoMove, true,
DTA_AlphaF, alpha, TAG_DONE);
}
else if (con_scaletext == 0)
else if (active_con_scaletext() == 1)
{
if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
@ -777,37 +802,20 @@ static void C_DrawNotifyText ()
line, NotifyStrings[i].Text,
DTA_AlphaF, alpha, TAG_DONE);
}
else if (con_scaletext == 3)
{
if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
DTA_VirtualWidth, screen->GetWidth() / 4,
DTA_VirtualHeight, screen->GetHeight() / 4,
DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE);
else
screen->DrawText (SmallFont, color, (screen->GetWidth() / 4 -
SmallFont->StringWidth (NotifyStrings[i].Text))/4,
line, NotifyStrings[i].Text,
DTA_VirtualWidth, screen->GetWidth() / 4,
DTA_VirtualHeight, screen->GetHeight() / 4,
DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE);
}
else
{
if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
DTA_VirtualWidth, screen->GetWidth() / 2,
DTA_VirtualHeight, screen->GetHeight() / 2,
DTA_VirtualWidth, screen->GetWidth() / active_con_scaletext(),
DTA_VirtualHeight, screen->GetHeight() / active_con_scaletext(),
DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE);
else
screen->DrawText (SmallFont, color, (screen->GetWidth() / 2 -
SmallFont->StringWidth (NotifyStrings[i].Text))/2,
screen->DrawText (SmallFont, color, (screen->GetWidth() -
SmallFont->StringWidth (NotifyStrings[i].Text) * active_con_scaletext()) / 2 / active_con_scaletext(),
line, NotifyStrings[i].Text,
DTA_VirtualWidth, screen->GetWidth() / 2,
DTA_VirtualHeight, screen->GetHeight() / 2,
DTA_VirtualWidth, screen->GetWidth() / active_con_scaletext(),
DTA_VirtualHeight, screen->GetHeight() / active_con_scaletext(),
DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE);
}
@ -851,9 +859,13 @@ void C_DrawConsole (bool hw2d)
static int oldbottom = 0;
int lines, left, offset;
int textScale = active_con_scale();
if (textScale == 0)
textScale = CleanXfac;
left = LEFTMARGIN;
lines = (ConBottom-ConFont->GetHeight()*2)/ConFont->GetHeight();
if (-ConFont->GetHeight() + lines*ConFont->GetHeight() > ConBottom - ConFont->GetHeight()*7/2)
lines = (ConBottom/textScale-ConFont->GetHeight()*2)/ConFont->GetHeight();
if (-ConFont->GetHeight() + lines*ConFont->GetHeight() > ConBottom/textScale - ConFont->GetHeight()*7/2)
{
offset = -ConFont->GetHeight()/2;
lines--;
@ -899,16 +911,26 @@ void C_DrawConsole (bool hw2d)
if (ConBottom >= 12)
{
if (textScale == 1)
screen->DrawText (ConFont, CR_ORANGE, SCREENWIDTH - 8 -
ConFont->StringWidth (GetVersionString()),
ConBottom - ConFont->GetHeight() - 4,
ConBottom / textScale - ConFont->GetHeight() - 4,
GetVersionString(), TAG_DONE);
else
screen->DrawText(ConFont, CR_ORANGE, SCREENWIDTH / textScale - 8 -
ConFont->StringWidth(GetVersionString()),
ConBottom / textScale - ConFont->GetHeight() - 4,
GetVersionString(),
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
if (TickerMax)
{
char tickstr[256];
const int tickerY = ConBottom - ConFont->GetHeight() - 4;
const int tickerY = ConBottom / textScale - ConFont->GetHeight() - 4;
size_t i;
int tickend = ConCols - SCREENWIDTH / 90 - 6;
int tickend = ConCols / textScale - SCREENWIDTH / textScale / 90 - 6;
int tickbegin = 0;
if (TickerLabel)
@ -931,11 +953,23 @@ void C_DrawConsole (bool hw2d)
{
tickstr[tickend+3] = 0;
}
if (textScale == 1)
screen->DrawText (ConFont, CR_BROWN, LEFTMARGIN, tickerY, tickstr, TAG_DONE);
else
screen->DrawText (ConFont, CR_BROWN, LEFTMARGIN, tickerY, tickstr,
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
// Draw the marker
i = LEFTMARGIN+5+tickbegin*8 + Scale (TickerAt, (SDWORD)(tickend - tickbegin)*8, TickerMax);
if (textScale == 1)
screen->DrawChar (ConFont, CR_ORANGE, (int)i, tickerY, 0x13, TAG_DONE);
else
screen->DrawChar(ConFont, CR_ORANGE, (int)i, tickerY, 0x13,
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
TickerVisible = true;
}
@ -971,19 +1005,29 @@ void C_DrawConsole (bool hw2d)
if (lines > 0)
{
// No more enqueuing because adding new text to the console won't touch the actual print data.
conbuffer->FormatText(ConFont, ConWidth);
conbuffer->FormatText(ConFont, ConWidth / textScale);
unsigned int consolelines = conbuffer->GetFormattedLineCount();
FBrokenLines **blines = conbuffer->GetLines();
FBrokenLines **printline = blines + consolelines - 1 - RowAdjust;
int bottomline = ConBottom - ConFont->GetHeight()*2 - 4;
int bottomline = ConBottom / textScale - ConFont->GetHeight()*2 - 4;
ConsoleDrawing = true;
for(FBrokenLines **p = printline; p >= blines && lines > 0; p--, lines--)
{
if (textScale == 1)
{
screen->DrawText(ConFont, CR_TAN, LEFTMARGIN, offset + lines * ConFont->GetHeight(), (*p)->Text, TAG_DONE);
}
else
{
screen->DrawText(ConFont, CR_TAN, LEFTMARGIN, offset + lines * ConFont->GetHeight(), (*p)->Text,
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
}
ConsoleDrawing = false;
@ -997,21 +1041,52 @@ void C_DrawConsole (bool hw2d)
FString command((char *)&CmdLine[2+CmdLine[259]]);
int cursorpos = CmdLine[1] - CmdLine[259];
screen->DrawChar (ConFont, CR_ORANGE, left, bottomline, '\x1c', TAG_DONE);
screen->DrawText (ConFont, CR_ORANGE, left + ConFont->GetCharWidth(0x1c), bottomline,
if (textScale == 1)
{
screen->DrawChar(ConFont, CR_ORANGE, left, bottomline, '\x1c', TAG_DONE);
screen->DrawText(ConFont, CR_ORANGE, left + ConFont->GetCharWidth(0x1c), bottomline,
command, TAG_DONE);
if (cursoron)
{
screen->DrawChar (ConFont, CR_YELLOW, left + ConFont->GetCharWidth(0x1c) + cursorpos * ConFont->GetCharWidth(0xb),
screen->DrawChar(ConFont, CR_YELLOW, left + ConFont->GetCharWidth(0x1c) + cursorpos * ConFont->GetCharWidth(0xb),
bottomline, '\xb', TAG_DONE);
}
}
else
{
screen->DrawChar(ConFont, CR_ORANGE, left, bottomline, '\x1c',
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
screen->DrawText(ConFont, CR_ORANGE, left + ConFont->GetCharWidth(0x1c), bottomline,
command,
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
if (cursoron)
{
screen->DrawChar(ConFont, CR_YELLOW, left + ConFont->GetCharWidth(0x1c) + cursorpos * ConFont->GetCharWidth(0xb),
bottomline, '\xb',
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
}
}
if (RowAdjust && ConBottom >= ConFont->GetHeight()*7/2)
{
// Indicate that the view has been scrolled up (10)
// and if we can scroll no further (12)
if (textScale == 1)
screen->DrawChar (ConFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10, TAG_DONE);
else
screen->DrawChar(ConFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10,
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
}
}
@ -1672,6 +1747,14 @@ void C_AddTabCommand (const char *name)
void C_RemoveTabCommand (const char *name)
{
if (TabCommands.Size() == 0)
{
// There are no tab commands that can be removed.
// This is important to skip construction of aname
// in case the NameManager has already been destroyed.
return;
}
FName aname(name, true);
if (aname == NAME_None)

View file

@ -109,8 +109,8 @@ static FCompatOption Options[] =
{ "ignoreteleporttags", BCOMPATF_BADTELEPORTERS, SLOT_BCOMPAT },
{ "rebuildnodes", BCOMPATF_REBUILDNODES, SLOT_BCOMPAT },
{ "linkfrozenprops", BCOMPATF_LINKFROZENPROPS, SLOT_BCOMPAT },
{ "disablepushwindowcheck", BCOMPATF_NOWINDOWCHECK, SLOT_BCOMPAT },
{ "floatbob", BCOMPATF_FLOATBOB, SLOT_BCOMPAT },
{ "noslopeid", BCOMPATF_NOSLOPEID, SLOT_BCOMPAT },
// list copied from g_mapinfo.cpp
{ "shorttex", COMPATF_SHORTTEX, SLOT_COMPAT },
@ -147,6 +147,8 @@ static FCompatOption Options[] =
{ "soundcutoff", COMPATF2_SOUNDCUTOFF, SLOT_COMPAT2 },
{ "pointonline", COMPATF2_POINTONLINE, SLOT_COMPAT2 },
{ "multiexit", COMPATF2_MULTIEXIT, SLOT_COMPAT2 },
{ "teleport", COMPATF2_TELEPORT, SLOT_COMPAT2 },
{ "disablepushwindowcheck", COMPATF2_PUSHWINDOW, SLOT_COMPAT2 },
{ NULL, 0, 0 }
};
@ -397,7 +399,7 @@ void CheckCompatibility(MapData *map)
flags = BCompatMap.CheckKey(md5);
if (developer)
if (developer >= DMSG_NOTIFY)
{
Printf("MD5 = ");
for (size_t j = 0; j < sizeof(md5.Bytes); ++j)

View file

@ -46,6 +46,8 @@ EXTERN_CVAR (Bool, sb_cooperative_enable)
EXTERN_CVAR (Bool, sb_deathmatch_enable)
EXTERN_CVAR (Bool, sb_teamdeathmatch_enable)
int active_con_scaletext();
// Public data
void CT_Init ();
@ -224,7 +226,7 @@ void CT_Drawer (void)
int i, x, scalex, y, promptwidth;
y = (viewactive || gamestate != GS_LEVEL) ? -10 : -30;
if (con_scaletext == 1)
if (active_con_scaletext() == 0)
{
scalex = CleanXfac;
y *= CleanYfac;
@ -235,25 +237,17 @@ void CT_Drawer (void)
}
int screen_width, screen_height, st_y;
switch (con_scaletext)
if (active_con_scaletext() == 0)
{
default:
case 0:
case 1:
screen_width = SCREENWIDTH;
screen_height = SCREENHEIGHT;
st_y = ST_Y;
break;
case 2:
screen_width = SCREENWIDTH / 2;
screen_height = SCREENHEIGHT / 2;
st_y = ST_Y / 2;
break;
case 3:
screen_width = SCREENWIDTH / 4;
screen_height = SCREENHEIGHT / 4;
st_y = ST_Y / 4;
break;
}
else
{
screen_width = SCREENWIDTH / active_con_scaletext();
screen_height = SCREENHEIGHT / active_con_scaletext();
st_y = ST_Y / active_con_scaletext();
}
y += ((SCREENHEIGHT == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y;
@ -280,10 +274,10 @@ void CT_Drawer (void)
// draw the prompt, text, and cursor
ChatQueue[len] = SmallFont->GetCursor();
ChatQueue[len+1] = '\0';
if (con_scaletext < 2)
if (active_con_scaletext() < 2)
{
screen->DrawText (SmallFont, CR_GREEN, 0, y, prompt, DTA_CleanNoMove, *con_scaletext, TAG_DONE);
screen->DrawText (SmallFont, CR_GREY, promptwidth, y, (char *)(ChatQueue + i), DTA_CleanNoMove, *con_scaletext, TAG_DONE);
screen->DrawText (SmallFont, CR_GREEN, 0, y, prompt, DTA_CleanNoMove, active_con_scaletext() == 0, TAG_DONE);
screen->DrawText (SmallFont, CR_GREY, promptwidth, y, (char *)(ChatQueue + i), DTA_CleanNoMove, active_con_scaletext() == 0, TAG_DONE);
}
else
{

View file

@ -450,7 +450,7 @@ int FindStyle (const char *namestr)
{
if (!stricmp(StyleNames[i].Name, namestr)) return StyleNames[i].Num;
}
DPrintf("Unknown render style %s\n", namestr);
DPrintf(DMSG_ERROR, "Unknown render style %s\n", namestr);
return -1;
}
@ -861,7 +861,7 @@ static int PatchThing (int thingy)
}
else
{
DPrintf ("Thing %d\n", thingy);
DPrintf (DMSG_SPAMMY, "Thing %d\n", thingy);
if (thingy > 0)
{
type = InfoNames[thingy - 1];
@ -915,7 +915,7 @@ static int PatchThing (int thingy)
}
else if (linelen == 14 && stricmp (Line1, "Missile damage") == 0)
{
info->Damage = CreateDamageFunction(val);
info->SetDamage(val);
}
else if (linelen == 5)
{
@ -1086,7 +1086,7 @@ static int PatchThing (int thingy)
}
if (i == BitNames.Size())
{
DPrintf("Unknown bit mnemonic %s\n", strval);
DPrintf(DMSG_ERROR, "Unknown bit mnemonic %s\n", strval);
}
}
}
@ -1242,7 +1242,7 @@ static int PatchThing (int thingy)
else
info->renderflags &= ~RF_INVISIBLE;
}
DPrintf ("Bits: %d,%d (0x%08x,0x%08x)\n", info->flags.GetValue(), info->flags2.GetValue(),
DPrintf (DMSG_SPAMMY, "Bits: %d,%d (0x%08x,0x%08x)\n", info->flags.GetValue(), info->flags2.GetValue(),
info->flags.GetValue(), info->flags2.GetValue());
}
else if (stricmp (Line1, "ID #") == 0)
@ -1328,7 +1328,7 @@ static int PatchSound (int soundNum)
{
int result;
DPrintf ("Sound %d (no longer supported)\n", soundNum);
//DPrintf ("Sound %d (no longer supported)\n", soundNum);
/*
sfxinfo_t *info, dummy;
int offset = 0;
@ -1385,7 +1385,7 @@ static int PatchFrame (int frameNum)
info = FindState (frameNum);
if (info)
{
DPrintf ("Frame %d\n", frameNum);
DPrintf (DMSG_SPAMMY, "Frame %d\n", frameNum);
if (frameNum == 47)
{ // Use original tics for S_DSGUNFLASH1
tics = 5;
@ -1487,7 +1487,7 @@ static int PatchSprite (int sprNum)
if ((unsigned)sprNum < OrgSprNames.Size())
{
DPrintf ("Sprite %d\n", sprNum);
DPrintf (DMSG_SPAMMY, "Sprite %d\n", sprNum);
}
else
{
@ -1534,7 +1534,7 @@ static int PatchAmmo (int ammoNum)
if (ammoNum >= 0 && ammoNum < 4 && (unsigned)ammoNum <= AmmoNames.Size())
{
DPrintf ("Ammo %d.\n", ammoNum);
DPrintf (DMSG_SPAMMY, "Ammo %d.\n", ammoNum);
ammoType = AmmoNames[ammoNum];
if (ammoType != NULL)
{
@ -1617,7 +1617,7 @@ static int PatchWeapon (int weapNum)
if (type != NULL)
{
info = (AWeapon *)GetDefaultByType (type);
DPrintf ("Weapon %d\n", weapNum);
DPrintf (DMSG_SPAMMY, "Weapon %d\n", weapNum);
}
}
@ -1757,7 +1757,7 @@ static int PatchPointer (int ptrNum)
{
if (CodePConv[ptrNum] == indexnum) break;
}
DPrintf("Final ptrNum: %i\n", ptrNum);
DPrintf(DMSG_SPAMMY, "Final ptrNum: %i\n", ptrNum);
}
// End of hack.
@ -1765,7 +1765,7 @@ static int PatchPointer (int ptrNum)
// Better to just use the size of the array rather than a hardcoded value.
if (ptrNum >= 0 && (unsigned int) ptrNum < CodePConv.Size())
{
DPrintf ("Pointer %d\n", ptrNum);
DPrintf (DMSG_SPAMMY, "Pointer %d\n", ptrNum);
}
else
{
@ -1789,7 +1789,7 @@ static int PatchPointer (int ptrNum)
{
SetPointer(state, Actions[index], CodePConv[ptrNum]);
}
DPrintf("%s has a hacked state for pointer num %i with index %i\nLine1=%s, Line2=%s\n",
DPrintf(DMSG_SPAMMY, "%s has a hacked state for pointer num %i with index %i\nLine1=%s, Line2=%s\n",
state->StaticFindStateOwner(state)->TypeName.GetChars(), ptrNum, index, Line1, Line2);
}
else
@ -1806,7 +1806,7 @@ static int PatchCheats (int dummy)
{
int result;
DPrintf ("Cheats (support removed by request)\n");
DPrintf (DMSG_NOTIFY, "Dehacked cheats support removed by request\n");
while ((result = GetLine ()) == 1)
{
@ -1836,7 +1836,7 @@ static int PatchMisc (int dummy)
};
int result;
DPrintf ("Misc\n");
DPrintf (DMSG_SPAMMY, "Misc\n");
while ((result = GetLine()) == 1)
{
@ -2017,7 +2017,7 @@ static int PatchPars (int dummy)
level_info_t *info;
int result, par;
DPrintf ("[Pars]\n");
DPrintf (DMSG_SPAMMY, "[Pars]\n");
while ( (result = GetLine()) ) {
// Argh! .bex doesn't follow the same rules as .deh
@ -2058,7 +2058,7 @@ static int PatchPars (int dummy)
}
info->partime = par;
DPrintf ("Par for %s changed to %d\n", mapname, par);
DPrintf (DMSG_SPAMMY, "Par for %s changed to %d\n", mapname, par);
}
return result;
}
@ -2067,7 +2067,7 @@ static int PatchCodePtrs (int dummy)
{
int result;
DPrintf ("[CodePtr]\n");
DPrintf (DMSG_SPAMMY, "[CodePtr]\n");
while ((result = GetLine()) == 1)
{
@ -2132,7 +2132,7 @@ static int PatchMusic (int dummy)
{
int result;
DPrintf ("[Music]\n");
DPrintf (DMSG_SPAMMY, "[Music]\n");
while ((result = GetLine()) == 1)
{
@ -2142,7 +2142,7 @@ static int PatchMusic (int dummy)
keystring << "MUSIC_" << Line1;
GStrings.SetString (keystring, newname);
DPrintf ("Music %s set to:\n%s\n", keystring.GetChars(), newname);
DPrintf (DMSG_SPAMMY, "Music %s set to:\n%s\n", keystring.GetChars(), newname);
}
return result;
@ -2198,7 +2198,7 @@ static int PatchText (int oldSize)
goto donewithtext;
}
DPrintf ("Searching for text:\n%s\n", oldStr);
DPrintf (DMSG_SPAMMY, "Searching for text:\n%s\n", oldStr);
good = false;
// Search through sprite names; they are always 4 chars
@ -2264,7 +2264,7 @@ static int PatchText (int oldSize)
if (!good)
{
DPrintf (" (Unmatched)\n");
DPrintf (DMSG_SPAMMY, " (Unmatched)\n");
}
donewithtext:
@ -2284,7 +2284,7 @@ static int PatchStrings (int dummy)
{
int result;
DPrintf ("[Strings]\n");
DPrintf (DMSG_SPAMMY, "[Strings]\n");
while ((result = GetLine()) == 1)
{
@ -2310,7 +2310,7 @@ static int PatchStrings (int dummy)
const char *ll = Line1;
if (!stricmp(ll, "GOTREDSKULL")) ll = "GOTREDSKUL";
GStrings.SetString (ll, holdstring);
DPrintf ("%s set to:\n%s\n", Line1, holdstring.GetChars());
DPrintf (DMSG_SPAMMY, "%s set to:\n%s\n", Line1, holdstring.GetChars());
}
return result;
@ -2350,7 +2350,7 @@ static int DoInclude (int dummy)
else
{
data = Line2;
DPrintf ("Including %s\n", data);
DPrintf (DMSG_SPAMMY, "Including %s\n", data);
savepatchname = PatchName;
savepatchfile = PatchFile;
savepatchpt = PatchPt;
@ -2384,7 +2384,7 @@ static int DoInclude (int dummy)
delete[] path;
}
DPrintf ("Done with include\n");
DPrintf (DMSG_SPAMMY, "Done with include\n");
PatchName = savepatchname;
PatchFile = savepatchfile;
PatchPt = savepatchpt;
@ -2536,7 +2536,7 @@ static bool DoDehPatch()
}
else
{
DPrintf ("Patch does not have DeHackEd signature. Assuming .bex\n");
DPrintf (DMSG_WARNING, "Patch does not have DeHackEd signature. Assuming .bex\n");
dversion = 19;
pversion = 6;
PatchPt = PatchFile;
@ -3027,7 +3027,7 @@ void FinishDehPatch ()
subclass->Replacement = old_replacement;
}
DPrintf ("%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars());
DPrintf (DMSG_NOTIFY, "%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars());
}
// Now that all Dehacked patches have been processed, it's okay to free StateMap.

View file

@ -574,7 +574,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
case 4: // Old ZDoom compat mode
v = COMPATF_SOUNDTARGET | COMPATF_LIGHT;
w = COMPATF2_MULTIEXIT;
w = COMPATF2_MULTIEXIT | COMPATF2_TELEPORT | COMPATF2_PUSHWINDOW;
break;
case 5: // MBF compat mode
@ -630,6 +630,8 @@ CVAR (Flag, compat_floormove, compatflags2, COMPATF2_FLOORMOVE);
CVAR (Flag, compat_soundcutoff, compatflags2, COMPATF2_SOUNDCUTOFF);
CVAR (Flag, compat_pointonline, compatflags2, COMPATF2_POINTONLINE);
CVAR (Flag, compat_multiexit, compatflags2, COMPATF2_MULTIEXIT);
CVAR (Flag, compat_teleport, compatflags2, COMPATF2_TELEPORT);
CVAR (Flag, compat_pushwindow, compatflags2, COMPATF2_PUSHWINDOW);
//==========================================================================
//

View file

@ -231,7 +231,7 @@ static struct TicSpecial
specialsize = MAX(specialsize * 2, needed + 30);
DPrintf ("Expanding special size to %zu\n", specialsize);
DPrintf (DMSG_NOTIFY, "Expanding special size to %zu\n", specialsize);
for (i = 0; i < BACKUPTICS; i++)
streams[i] = (BYTE *)M_Realloc (streams[i], specialsize);

View file

@ -2134,7 +2134,7 @@ bool PArray::ReadValue(FArchive &ar, void *addr) const
}
if (i < ElementCount)
{
DPrintf("Array on disk (%u) is bigger than in memory (%u)\n",
DPrintf(DMSG_WARNING, "Array on disk (%u) is bigger than in memory (%u)\n",
count, ElementCount);
for (; i < ElementCount; ++i)
{
@ -2501,13 +2501,13 @@ bool PStruct::ReadFields(FArchive &ar, void *addr) const
const PSymbol *sym = Symbols.FindSymbol(FName(label, true), true);
if (sym == NULL)
{
DPrintf("Cannot find field %s in %s\n",
DPrintf(DMSG_ERROR, "Cannot find field %s in %s\n",
label, TypeName.GetChars());
SkipValue(ar);
}
else if (!sym->IsKindOf(RUNTIME_CLASS(PField)))
{
DPrintf("Symbol %s in %s is not a field\n",
DPrintf(DMSG_ERROR, "Symbol %s in %s is not a field\n",
label, TypeName.GetChars());
SkipValue(ar);
}
@ -2806,7 +2806,7 @@ bool PClass::ReadValue(FArchive &ar, void *addr) const
}
else
{
DPrintf("Unknown superclass %s of class %s\n",
DPrintf(DMSG_ERROR, "Unknown superclass %s of class %s\n",
type->TypeName.GetChars(), TypeName.GetChars());
SkipValue(ar, VAL_Struct);
}
@ -3243,7 +3243,7 @@ PClass *PClass::CreateDerivedClass(FName name, unsigned int size)
{
I_Error("%s must inherit from %s but doesn't.", name.GetChars(), type->ParentClass->TypeName.GetChars());
}
DPrintf("Defining placeholder class %s\n", name.GetChars());
DPrintf(DMSG_SPAMMY, "Defining placeholder class %s\n", name.GetChars());
notnew = true;
}
else
@ -3327,7 +3327,7 @@ PClass *PClass::FindClassTentative(FName name, bool fatal)
return static_cast<PClass *>(found);
}
PClass *type = static_cast<PClass *>(GetClass()->CreateNew());
DPrintf("Creating placeholder class %s : %s\n", name.GetChars(), TypeName.GetChars());
DPrintf(DMSG_SPAMMY, "Creating placeholder class %s : %s\n", name.GetChars(), TypeName.GetChars());
type->TypeName = name;
type->ParentClass = this;

View file

@ -18,6 +18,7 @@ typedef std::pair<const class PType *, unsigned> FTypeAndOffset;
#define VARF_Method (1<<1) // func has an implied self parameter
#define VARF_Action (1<<2) // func has implied owner and state parameters
#define VARF_Native (1<<3) // func is native code/don't auto serialize field
#define VARF_ReadOnly (1<<4) // field is read only, do not write to it
// Symbol information -------------------------------------------------------

View file

@ -342,6 +342,8 @@ enum : unsigned int
COMPATF2_SOUNDCUTOFF = 1 << 2, // Cut off sounds when an actor vanishes instead of making it owner-less
COMPATF2_POINTONLINE = 1 << 3, // Use original but buggy P_PointOnLineSide() and P_PointOnDivlineSideCompat()
COMPATF2_MULTIEXIT = 1 << 4, // Level exit can be triggered multiple times (required by Daedalus's travel tubes, thanks to a faulty script)
COMPATF2_TELEPORT = 1 << 5, // Don't let indirect teleports trigger sector actions
COMPATF2_PUSHWINDOW = 1 << 6, // Disable the window check in CheckForPushSpecial()
};
// Emulate old bugs for select maps. These are not exposed by a cvar
@ -355,8 +357,8 @@ enum
BCOMPATF_BADPORTALS = 1 << 4, // Restores the old unstable portal behavior
BCOMPATF_REBUILDNODES = 1 << 5, // Force node rebuild
BCOMPATF_LINKFROZENPROPS = 1 << 6, // Clearing PROP_TOTALLYFROZEN or PROP_FROZEN also clears the other
BCOMPATF_NOWINDOWCHECK = 1 << 7, // Disable the window check in CheckForPushSpecial()
BCOMPATF_FLOATBOB = 1 << 8, // Use Hexen's original method of preventing floatbobbing items from falling down
BCOMPATF_NOSLOPEID = 1 << 9, // disable line IDs on slopes.
};
// phares 3/20/98:

View file

@ -39,7 +39,7 @@ FStringTable GStrings;
EGameSpeed GameSpeed = SPEED_Normal;
// Show developer messages if true.
CVAR (Bool, developer, false, 0)
CVAR (Int, developer, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
// [RH] Feature control cvars
CVAR (Bool, var_friction, true, CVAR_SERVERINFO);

View file

@ -204,7 +204,7 @@ extern int bodyqueslot;
// ---- [RH] ----
EXTERN_CVAR (Bool, developer)
EXTERN_CVAR (Int, developer)
extern bool ToggleFullscreen;

View file

@ -152,7 +152,7 @@ int Printf (int printlevel, const char *, ...) GCCPRINTF(2,3);
int Printf (const char *, ...) GCCPRINTF(1,2);
// [RH] Same here:
int DPrintf (const char *, ...) GCCPRINTF(1,2);
int DPrintf (int level, const char *, ...) GCCPRINTF(2,3);
extern "C" int mysnprintf(char *buffer, size_t count, const char *format, ...) GCCPRINTF(3,4);
extern "C" int myvsnprintf(char *buffer, size_t count, const char *format, va_list argptr) GCCFORMAT(3);
@ -165,15 +165,19 @@ enum
PRINT_MEDIUM, // death messages
PRINT_HIGH, // critical messages
PRINT_CHAT, // chat messages
PRINT_TEAMCHAT // chat messages from a teammate
PRINT_TEAMCHAT, // chat messages from a teammate
PRINT_LOG, // only to logfile
PRINT_BOLD = 200 // What Printf_Bold used
};
enum
{
DMSG_OFF, // no developer messages.
DMSG_ERROR, // general notification messages
DMSG_WARNING, // warnings
DMSG_NOTIFY, // general notification messages
DMSG_SPAMMY, // for those who want to see everything, regardless of its usefulness.
};
#define PRINT_LOW 0 // pickup messages
#define PRINT_MEDIUM 1 // death messages
#define PRINT_HIGH 2 // critical messages
#define PRINT_CHAT 3 // chat messages
#define PRINT_TEAMCHAT 4 // chat messages from a teammate
#define PRINT_LOG 5 // only to logfile
#define PRINT_BOLD 200 // What Printf_Bold used
struct PalEntry
{

View file

@ -77,6 +77,11 @@ public:
static void RunThinkers (int statnum);
static void DestroyAllThinkers ();
static void DestroyMostThinkers ();
static void DestroyThinkersInList(int statnum)
{
DestroyThinkersInList(Thinkers[statnum]);
DestroyThinkersInList(FreshThinkers[statnum]);
}
static void SerializeAll (FArchive &arc, bool keepPlayers);
static void MarkRoots();

View file

@ -354,12 +354,12 @@ void FCompressedFile::Implode ()
// If the data could not be compressed, store it as-is.
if (r != Z_OK || outlen >= len)
{
DPrintf ("cfile could not be compressed\n");
DPrintf (DMSG_SPAMMY, "cfile could not be compressed\n");
outlen = 0;
}
else
{
DPrintf ("cfile shrank from %lu to %lu bytes\n", len, outlen);
DPrintf (DMSG_SPAMMY, "cfile shrank from %lu to %lu bytes\n", len, outlen);
}
}
else
@ -717,7 +717,7 @@ void FArchive::Close ()
{
m_File->Close ();
m_File = NULL;
DPrintf ("Processed %u objects\n", ArchiveToObject.Size());
DPrintf (DMSG_SPAMMY, "Processed %u objects\n", ArchiveToObject.Size());
}
}
@ -1194,6 +1194,7 @@ FArchive &FArchive::ReadObject (DObject* &obj, PClass *wanttype)
const PClass *type;
BYTE playerNum;
DWORD index;
DObject *newobj;
operator<< (objHead);
@ -1255,11 +1256,11 @@ FArchive &FArchive::ReadObject (DObject* &obj, PClass *wanttype)
case NEW_CLS_OBJ:
type = ReadClass (wanttype);
// Printf ("New class: %s (%u)\n", type->Name, m_File->Tell());
obj = type->CreateNew ();
newobj = obj = type->CreateNew ();
MapObject (obj);
obj->SerializeUserVars (*this);
obj->Serialize (*this);
obj->CheckIfSerialized ();
newobj->SerializeUserVars (*this);
newobj->Serialize (*this);
newobj->CheckIfSerialized ();
break;
case NEW_PLYR_OBJ:

View file

@ -1452,7 +1452,8 @@ void FParser::SF_SetCamera(void)
newcamera->specialf1 = newcamera->Angles.Yaw.Degrees;
newcamera->specialf2 = newcamera->Z();
newcamera->SetZ(t_argc < 3 ? newcamera->Z() + 41 : floatvalue(t_argv[2]));
double z = t_argc < 3 ? newcamera->Sector->floorplane.ZatPoint(newcamera) + 41 : floatvalue(t_argv[2]);
newcamera->SetOrigin(newcamera->PosAtZ(z), false);
newcamera->Angles.Yaw = angle;
if (t_argc < 4) newcamera->Angles.Pitch = 0.;
else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.);

View file

@ -47,7 +47,7 @@ static void BrainishExplosion (const DVector3 &pos)
boom->SetState (state);
}
boom->effects = 0;
boom->Damage = NULL; // disables collision detection which is not wanted here
boom->SetDamage(0); // disables collision detection which is not wanted here
boom->tics -= pr_brainscream() & 7;
if (boom->tics < 1)
boom->tics = 1;

View file

@ -115,7 +115,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
fire->target = baseFire->target;
fire->Angles.Yaw = baseFire->Angles.Yaw;
fire->Vel = baseFire->Vel;
fire->Damage = NULL;
fire->SetDamage(0);
fire->health = (i+1) * 2;
P_CheckMissileSpawn (fire, self->radius);
}
@ -205,7 +205,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichFireGrow)
self->AddZ(9.);
if (self->health == 0)
{
self->Damage = self->GetDefault()->Damage;
self->RestoreDamage();
self->SetState (self->FindState("NoGrow"));
}
return 0;

View file

@ -340,7 +340,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LastZap)
{
mo->SetState (mo->FindState (NAME_Death));
mo->Vel.Z = 40;
mo->Damage = NULL;
mo->SetDamage(0);
}
return 0;
}

View file

@ -1295,6 +1295,11 @@ void G_FinishTravel ()
}
bglobal.FinishTravel ();
// make sure that, after travelling has completed, no travelling thinkers are left.
// Since this list is excluded from regular thinker cleaning, anything that may survive through here
// will endlessly multiply and severely break the following savegames or just simply crash on broken pointers.
DThinker::DestroyThinkersInList(STAT_TRAVELLING);
}
//==========================================================================

View file

@ -1341,6 +1341,8 @@ MapFlagHandlers[] =
{ "compat_soundcutoff", MITYPE_COMPATFLAG, 0, COMPATF2_SOUNDCUTOFF },
{ "compat_pointonline", MITYPE_COMPATFLAG, 0, COMPATF2_POINTONLINE },
{ "compat_multiexit", MITYPE_COMPATFLAG, 0, COMPATF2_MULTIEXIT },
{ "compat_teleport", MITYPE_COMPATFLAG, 0, COMPATF2_TELEPORT },
{ "compat_pushwindow", MITYPE_COMPATFLAG, 0, COMPATF2_PUSHWINDOW },
{ "cd_start_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end1_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end2_track", MITYPE_EATNEXT, 0, 0 },

View file

@ -825,13 +825,13 @@ void ADecal::BeginPlay ()
// without effectively doing anything.
if (NULL == ShootDecal(tpl, this, Sector, X(), Y(), Z(), Angles.Yaw + 180, 64., true))
{
DPrintf ("Could not find a wall to stick decal to at (%f,%f)\n", X(), Y());
DPrintf (DMSG_WARNING, "Could not find a wall to stick decal to at (%f,%f)\n", X(), Y());
}
}
}
else
{
DPrintf ("Decal actor at (%f,%f) does not have a good template\n", X(), Y());
DPrintf (DMSG_ERROR, "Decal actor at (%f,%f) does not have a good template\n", X(), Y());
}
// This actor doesn't need to stick around anymore.
Destroy();

View file

@ -166,8 +166,14 @@ void AFastProjectile::Effect()
if (trail != NULL)
{
AActor *act = Spawn (trail, PosAtZ(hitz), ALLOW_REPLACE);
if (act != NULL)
if (act != nullptr)
{
if ((flags5 & MF5_GETOWNER) && (target != nullptr))
act->target = target;
else
act->target = this;
act->Angles.Pitch = Angles.Pitch;
act->Angles.Yaw = Angles.Yaw;
}
}

View file

@ -38,7 +38,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
APlayerPawn *actor;
actor = p->mo;
if (actor == NULL)
if (actor == nullptr)
{
return false;
}
@ -55,7 +55,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
if ((p->mo->GetClass() == spawntype)
&& (p->mo->PlayerFlags & PPF_CANSUPERMORPH)
&& (p->morphTics < (((duration) ? duration : MORPHTICS) - TICRATE))
&& (p->mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true) == NULL))
&& (p->mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true) == nullptr))
{ // Make a super chicken
p->mo->GiveInventoryType (RUNTIME_CLASS(APowerWeaponLevel2));
}
@ -65,7 +65,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
{ // Dead players cannot morph
return false;
}
if (spawntype == NULL)
if (spawntype == nullptr)
{
return false;
}
@ -94,7 +94,8 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
}
morphed->Angles.Yaw = actor->Angles.Yaw;
morphed->target = actor->target;
morphed->tracer = actor;
morphed->tracer = actor->tracer;
morphed->alternative = actor;
morphed->FriendPlayer = actor->FriendPlayer;
morphed->DesignatedTeam = actor->DesignatedTeam;
morphed->Score = actor->Score;
@ -113,7 +114,8 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
morphed->flags2 |= actor->flags2 & MF2_FLY;
morphed->flags3 |= actor->flags3 & MF3_GHOST;
AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE);
actor->player = NULL;
actor->player = nullptr;
actor->alternative = morphed;
actor->flags &= ~(MF_SOLID|MF_SHOOTABLE);
actor->flags |= MF_UNMORPHED;
actor->renderflags |= RF_INVISIBLE;
@ -129,7 +131,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
p->Vel.X = p->Vel.Y = 0;
morphed->ObtainInventory (actor);
// Remove all armor
for (item = morphed->Inventory; item != NULL; )
for (item = morphed->Inventory; item != nullptr; )
{
AInventory *next = item->Inventory;
if (item->IsKindOf (RUNTIME_CLASS(AArmor)))
@ -182,7 +184,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
// because the level or game is ended while morphed,
// by the time it gets executed the morphed player
// pawn instance may have already been destroyed.
if (pmo == NULL || pmo->tracer == NULL)
if (pmo == nullptr || pmo->alternative == nullptr)
{
return false;
}
@ -197,7 +199,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
return false;
}
mo = barrier_cast<APlayerPawn *>(pmo->tracer);
mo = barrier_cast<APlayerPawn *>(pmo->alternative);
mo->SetOrigin (pmo->Pos(), false);
mo->flags |= MF_SOLID;
pmo->flags &= ~MF_SOLID;
@ -208,10 +210,14 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
player->morphTics = 2*TICRATE;
return false;
}
pmo->player = NULL;
// No longer using tracer as morph storage. That is what 'alternative' is for.
// If the tracer has changed on the morph, change the original too.
mo->target = pmo->target;
mo->tracer = pmo->tracer;
pmo->player = nullptr;
// Remove the morph power if the morph is being undone prematurely.
for (AInventory *item = pmo->Inventory, *next = NULL; item != NULL; item = next)
for (AInventory *item = pmo->Inventory, *next = nullptr; item != nullptr; item = next)
{
next = item->Inventory;
if (item->IsKindOf(RUNTIME_CLASS(APowerMorph)))
@ -252,10 +258,10 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
player->morphTics = 0;
player->MorphedPlayerClass = 0;
player->MorphStyle = 0;
player->MorphExitFlash = NULL;
player->MorphExitFlash = nullptr;
player->viewheight = mo->ViewHeight;
AInventory *level2 = mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true);
if (level2 != NULL)
if (level2 != nullptr)
{
level2->Destroy ();
}
@ -310,31 +316,31 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
}
}
AActor *eflash = NULL;
if (exit_flash != NULL)
AActor *eflash = nullptr;
if (exit_flash != nullptr)
{
eflash = Spawn(exit_flash, pmo->Vec3Angle(20., mo->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE);
if (eflash) eflash->target = mo;
}
mo->SetupWeaponSlots(); // Use original class's weapon slots.
beastweap = player->ReadyWeapon;
if (player->PremorphWeapon != NULL)
if (player->PremorphWeapon != nullptr)
{
player->PremorphWeapon->PostMorphWeapon ();
}
else
{
player->ReadyWeapon = player->PendingWeapon = NULL;
player->ReadyWeapon = player->PendingWeapon = nullptr;
}
if (correctweapon)
{ // Better "lose morphed weapon" semantics
PClassActor *morphweapon = PClass::FindActor(pmo->MorphWeapon);
if (morphweapon != NULL && morphweapon->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
if (morphweapon != nullptr && morphweapon->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
AWeapon *OriginalMorphWeapon = static_cast<AWeapon *>(mo->FindInventory (morphweapon));
if ((OriginalMorphWeapon != NULL) && (OriginalMorphWeapon->GivenAsMorphWeapon))
if ((OriginalMorphWeapon != nullptr) && (OriginalMorphWeapon->GivenAsMorphWeapon))
{ // You don't get to keep your morphed weapon.
if (OriginalMorphWeapon->SisterWeapon != NULL)
if (OriginalMorphWeapon->SisterWeapon != nullptr)
{
OriginalMorphWeapon->SisterWeapon->Destroy ();
}
@ -344,20 +350,21 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
}
else // old behaviour (not really useful now)
{ // Assumptions made here are no longer valid
if (beastweap != NULL)
if (beastweap != nullptr)
{ // You don't get to keep your morphed weapon.
if (beastweap->SisterWeapon != NULL)
if (beastweap->SisterWeapon != nullptr)
{
beastweap->SisterWeapon->Destroy ();
}
beastweap->Destroy ();
}
}
pmo->tracer = NULL;
mo->alternative = nullptr;
pmo->alternative = nullptr;
pmo->Destroy ();
// Restore playerclass armor to its normal amount.
AHexenArmor *hxarmor = mo->FindInventory<AHexenArmor>();
if (hxarmor != NULL)
if (hxarmor != nullptr)
{
hxarmor->Slots[4] = mo->GetClass()->HexenArmor[0];
}
@ -517,9 +524,9 @@ bool P_MorphedDeath(AActor *actor, AActor **morphed, int *morphedstyle, int *mor
(actor->player->morphTics) &&
(actor->player->MorphStyle & MORPH_UNDOBYDEATH) &&
(actor->player->mo) &&
(actor->player->mo->tracer))
(actor->player->mo->alternative))
{
AActor *realme = actor->player->mo->tracer;
AActor *realme = actor->player->mo->alternative;
int realstyle = actor->player->MorphStyle;
int realhealth = actor->health;
if (P_UndoPlayerMorph(actor->player, actor->player, 0, !!(actor->player->MorphStyle & MORPH_UNDOBYDEATHFORCED)))

View file

@ -572,7 +572,6 @@ bool AInventory::ShouldRespawn ()
void AInventory::BeginPlay ()
{
Super::BeginPlay ();
ChangeStatNum (STAT_INVENTORY);
flags |= MF_DROPPED; // [RH] Items are dropped by default
}
@ -822,6 +821,7 @@ void AInventory::BecomeItem ()
}
RemoveFromHash ();
flags &= ~MF_SPECIAL;
ChangeStatNum(STAT_INVENTORY);
SetState (FindState("Held"));
}
@ -848,6 +848,7 @@ void AInventory::BecomePickup ()
}
flags = (GetDefault()->flags | MF_DROPPED) & ~MF_COUNTITEM;
renderflags &= ~RF_INVISIBLE;
ChangeStatNum(STAT_DEFAULT);
SetState (SpawnState);
}

View file

@ -161,7 +161,7 @@ double DEarthquake::GetModWave(double waveMultiplier) const
//
//==========================================================================
double DEarthquake::GetModIntensity(double intensity) const
double DEarthquake::GetModIntensity(double intensity, bool fake) const
{
assert(m_CountdownStart >= m_Countdown);
@ -195,7 +195,7 @@ double DEarthquake::GetModIntensity(double intensity) const
}
scalar = (scalar > divider) ? divider : scalar;
if (m_Flags & QF_FULLINTENSITY)
if (!fake && (m_Flags & QF_FULLINTENSITY))
{
scalar *= 2;
}
@ -273,64 +273,67 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger
DEarthquake *quake;
int count = 0;
while ( (quake = iterator.Next()) != NULL)
while ( (quake = iterator.Next()) != nullptr)
{
if (quake->m_Spot != NULL)
if (quake->m_Spot != nullptr)
{
double dist = quake->m_Spot->Distance2D (victim, true);
const double dist = quake->m_Spot->Distance2D(victim, true);
if (dist < quake->m_TremorRadius)
{
const double falloff = quake->GetFalloff(dist);
const double rfalloff = (quake->m_RollIntensity != 0) ? falloff : 0.;
++count;
double x = quake->GetModIntensity(quake->m_Intensity.X);
double y = quake->GetModIntensity(quake->m_Intensity.Y);
double z = quake->GetModIntensity(quake->m_Intensity.Z);
double r = quake->GetModIntensity(quake->m_RollIntensity);
const double falloff = quake->GetFalloff(dist);
const double r = quake->GetModIntensity(quake->m_RollIntensity);
const double strength = quake->GetModIntensity(1.0, true);
DVector3 intensity;
intensity.X = quake->GetModIntensity(quake->m_Intensity.X);
intensity.Y = quake->GetModIntensity(quake->m_Intensity.Y);
intensity.Z = quake->GetModIntensity(quake->m_Intensity.Z);
if (!(quake->m_Flags & QF_WAVE))
{
jiggers.Falloff = MAX(falloff, jiggers.Falloff);
jiggers.RFalloff = MAX(rfalloff, jiggers.RFalloff);
jiggers.RollIntensity = MAX(r, jiggers.RollIntensity);
jiggers.RollIntensity = MAX(r, jiggers.RollIntensity) * falloff;
intensity *= falloff;
if (quake->m_Flags & QF_RELATIVE)
{
jiggers.RelIntensity.X = MAX(x, jiggers.RelIntensity.X);
jiggers.RelIntensity.Y = MAX(y, jiggers.RelIntensity.Y);
jiggers.RelIntensity.Z = MAX(z, jiggers.RelIntensity.Z);
jiggers.RelIntensity.X = MAX(intensity.X, jiggers.RelIntensity.X);
jiggers.RelIntensity.Y = MAX(intensity.Y, jiggers.RelIntensity.Y);
jiggers.RelIntensity.Z = MAX(intensity.Z, jiggers.RelIntensity.Z);
}
else
{
jiggers.Intensity.X = MAX(x, jiggers.Intensity.X);
jiggers.Intensity.Y = MAX(y, jiggers.Intensity.Y);
jiggers.Intensity.Z = MAX(z, jiggers.Intensity.Z);
jiggers.Intensity.X = MAX(intensity.X, jiggers.Intensity.X);
jiggers.Intensity.Y = MAX(intensity.Y, jiggers.Intensity.Y);
jiggers.Intensity.Z = MAX(intensity.Z, jiggers.Intensity.Z);
}
}
else
{
jiggers.WFalloff = MAX(falloff, jiggers.WFalloff);
jiggers.RWFalloff = MAX(rfalloff, jiggers.RWFalloff);
jiggers.RollWave = r * quake->GetModWave(quake->m_RollWave);
double mx = x * quake->GetModWave(quake->m_WaveSpeed.X);
double my = y * quake->GetModWave(quake->m_WaveSpeed.Y);
double mz = z * quake->GetModWave(quake->m_WaveSpeed.Z);
jiggers.RollWave = r * quake->GetModWave(quake->m_RollWave) * falloff * strength;
intensity.X *= quake->GetModWave(quake->m_WaveSpeed.X);
intensity.Y *= quake->GetModWave(quake->m_WaveSpeed.Y);
intensity.Z *= quake->GetModWave(quake->m_WaveSpeed.Z);
intensity *= strength * falloff;
// [RH] This only gives effect to the last sine quake. I would
// prefer if some way was found to make multiples coexist
// peacefully, but just summing them together is undesirable
// because they could cancel each other out depending on their
// relative phases.
// [MC] Now does so. And they stack rather well. I'm a little
// surprised at how easy it was.
if (quake->m_Flags & QF_RELATIVE)
{
jiggers.RelOffset.X = mx;
jiggers.RelOffset.Y = my;
jiggers.RelOffset.Z = mz;
jiggers.RelOffset += intensity;
}
else
{
jiggers.Offset.X = mx;
jiggers.Offset.Y = my;
jiggers.Offset.Z = mz;
jiggers.Offset += intensity;
}
}
}

View file

@ -153,7 +153,6 @@ struct FQuakeJiggers
DVector3 RelIntensity;
DVector3 Offset;
DVector3 RelOffset;
double Falloff, WFalloff, RFalloff, RWFalloff;
double RollIntensity, RollWave;
};
@ -180,8 +179,7 @@ public:
int m_Highpoint, m_MiniCount;
double m_RollIntensity, m_RollWave;
double GetModIntensity(double intensity) const;
double GetModIntensity(double intensity, bool fake = false) const;
double GetModWave(double waveMultiplier) const;
double GetFalloff(double dist) const;

View file

@ -41,7 +41,8 @@
#include "doomstat.h"
#include "farchive.h"
EXTERN_CVAR (Int, con_scaletext)
EXTERN_CVAR(Int, con_scaletext)
int active_con_scaletext();
IMPLEMENT_POINTY_CLASS (DHUDMessage)
DECLARE_POINTER(Next)
@ -260,13 +261,10 @@ void DHUDMessage::ResetText (const char *text)
}
else
{
switch (con_scaletext)
switch (active_con_scaletext())
{
default:
case 0: width = SCREENWIDTH; break;
case 1: width = SCREENWIDTH / CleanXfac; break;
case 2: width = SCREENWIDTH / 2; break;
case 3: width = SCREENWIDTH / 4; break;
case 0: width = SCREENWIDTH / CleanXfac; break;
default: width = SCREENWIDTH / active_con_scaletext(); break;
}
}
@ -332,7 +330,7 @@ void DHUDMessage::Draw (int bottom, int visibility)
int screen_width = SCREENWIDTH;
int screen_height = SCREENHEIGHT;
if (HUDWidth == 0 && con_scaletext==1)
if (HUDWidth == 0 && active_con_scaletext() == 0)
{
clean = true;
xscale = CleanXfac;
@ -341,17 +339,11 @@ void DHUDMessage::Draw (int bottom, int visibility)
else
{
xscale = yscale = 1;
if (HUDWidth==0 && con_scaletext==2)
if (HUDWidth == 0)
{
screen_width/=2;
screen_height/=2;
bottom/=2;
}
else if (HUDWidth==0 && con_scaletext==3)
{
screen_width/=4;
screen_height/=4;
bottom/=4;
screen_width /= active_con_scaletext();
screen_height /= active_con_scaletext();
bottom /= active_con_scaletext();
}
}
@ -453,7 +445,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
{
if (hudheight == 0)
{
if (con_scaletext <= 1)
if (active_con_scaletext() <= 1)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
@ -461,21 +453,11 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
DTA_RenderStyle, Style,
TAG_DONE);
}
else if (con_scaletext == 3)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/4,
DTA_VirtualHeight, SCREENHEIGHT/4,
DTA_AlphaF, Alpha,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
TAG_DONE);
}
else
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/2,
DTA_VirtualHeight, SCREENHEIGHT/2,
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_AlphaF, Alpha,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
@ -566,7 +548,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
float trans = float(Alpha * -(Tics - FadeOutTics) / FadeOutTics);
if (hudheight == 0)
{
if (con_scaletext <= 1)
if (active_con_scaletext() <= 1)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
@ -574,21 +556,11 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
DTA_RenderStyle, Style,
TAG_DONE);
}
else if (con_scaletext == 3)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/4,
DTA_VirtualHeight, SCREENHEIGHT/4,
DTA_AlphaF, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
TAG_DONE);
}
else
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/2,
DTA_VirtualHeight, SCREENHEIGHT/2,
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_AlphaF, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
@ -676,7 +648,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
float trans = float(Alpha * Tics / FadeInTics);
if (hudheight == 0)
{
if (con_scaletext <= 1)
if (active_con_scaletext() <= 1)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
@ -684,21 +656,11 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
DTA_RenderStyle, Style,
TAG_DONE);
}
else if (con_scaletext == 3)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/4,
DTA_VirtualHeight, SCREENHEIGHT/4,
DTA_AlphaF, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
TAG_DONE);
}
else
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/2,
DTA_VirtualHeight, SCREENHEIGHT/2,
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_AlphaF, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
@ -864,7 +826,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
{
if (hudheight == 0)
{
if (con_scaletext <= 1)
if (active_con_scaletext() <= 1)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
@ -873,22 +835,11 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
DTA_RenderStyle, Style,
TAG_DONE);
}
else if (con_scaletext == 3)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/4,
DTA_VirtualHeight, SCREENHEIGHT/4,
DTA_KeepRatio, true,
DTA_TextLen, LineVisible,
DTA_AlphaF, Alpha,
DTA_RenderStyle, Style,
TAG_DONE);
}
else
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/2,
DTA_VirtualHeight, SCREENHEIGHT/2,
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_KeepRatio, true,
DTA_TextLen, LineVisible,
DTA_AlphaF, Alpha,

View file

@ -1013,8 +1013,16 @@ public:
void ScreenSizeChanged()
{
Super::ScreenSizeChanged();
if (uiscale > 0)
{
script->cleanX = uiscale;
script->cleanY = uiscale;
}
else
{
V_CalcCleanFacs(script->resW, script->resH, SCREENWIDTH, SCREENHEIGHT, &script->cleanX, &script->cleanY);
}
}
void Draw (EHudState state)
{

View file

@ -1914,7 +1914,7 @@ class CommandAspectRatio : public SBarInfoCommandFlowControl
{
SBarInfoCommandFlowControl::Tick(block, statusBar, hudChanged);
SetTruth(ratioMap[CheckRatio(screen->GetWidth(), screen->GetHeight())] == ratio, block, statusBar);
SetTruth(ratioMap[FindRatio()] == ratio, block, statusBar);
}
protected:
enum Ratio
@ -1931,6 +1931,37 @@ class CommandAspectRatio : public SBarInfoCommandFlowControl
static Ratio ratioMap[5];
Ratio ratio;
private:
int FindRatio()
{
float aspect = ActiveRatio(screen->GetWidth(), screen->GetHeight());
static std::pair<float, int> ratioTypes[] =
{
{ 21 / 9.0f , ASPECTRATIO_16_9 },
{ 16 / 9.0f , ASPECTRATIO_16_9 },
{ 17 / 10.0f , ASPECTRATIO_17_10 },
{ 16 / 10.0f , ASPECTRATIO_16_10 },
{ 4 / 3.0f , ASPECTRATIO_4_3 },
{ 5 / 4.0f , ASPECTRATIO_5_4 },
{ 0.0f, 0 }
};
int ratio = ratioTypes[0].second;
float distance = fabs(ratioTypes[0].first - aspect);
for (int i = 1; ratioTypes[i].first != 0.0f; i++)
{
float d = fabs(ratioTypes[i].first - aspect);
if (d < distance)
{
ratio = ratioTypes[i].second;
distance = d;
}
}
return ratio;
}
};
CommandAspectRatio::Ratio CommandAspectRatio::ratioMap[5] = {ASPECTRATIO_4_3,ASPECTRATIO_16_9,ASPECTRATIO_16_10,ASPECTRATIO_16_10,ASPECTRATIO_5_4};
@ -3464,6 +3495,78 @@ class CommandIfWaterLevel : public SBarInfoNegatableFlowControl
////////////////////////////////////////////////////////////////////////////////
class CommandIfCVarInt : public SBarInfoNegatableFlowControl
{
public:
CommandIfCVarInt(SBarInfo *script) : SBarInfoNegatableFlowControl(script),
equalcomp(false)
{
}
void ParseNegatable(FScanner &sc, bool fullScreenOffsets)
{
if(!sc.CheckToken(TK_StringConst))
{
sc.MustGetToken(TK_Identifier);
}
cvarname = sc.String;
cvar = FindCVar(cvarname, nullptr);
if (cvar != nullptr)
{
ECVarType cvartype = cvar->GetRealType();
if (cvartype == CVAR_Bool || cvartype == CVAR_Int)
{
sc.MustGetToken(',');
sc.MustGetToken(TK_IntConst);
value = sc.Number;
if (sc.CheckToken(','))
{
sc.MustGetToken(TK_Identifier);
if(sc.Compare("equal"))
{
equalcomp = true;
}
}
}
else
{
sc.ScriptError("Type mismatch: console variable '%s' is not of type 'bool' or 'int'.", cvarname.GetChars());
}
}
else
{
sc.ScriptError("Unknown console variable '%s'.", cvarname.GetChars());
}
}
void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged)
{
SBarInfoNegatableFlowControl::Tick(block, statusBar, hudChanged);
bool result = false;
cvar = GetCVar(statusBar->CPlayer->mo, cvarname);
if (cvar != nullptr)
{
int cvarvalue = cvar->GetGenericRep(CVAR_Int).Int;
result = equalcomp ? cvarvalue == value : cvarvalue >= value;
}
SetTruth(result, block, statusBar);
}
protected:
FString cvarname;
FBaseCVar *cvar;
int value;
bool equalcomp;
};
////////////////////////////////////////////////////////////////////////////////
static const char *SBarInfoCommandNames[] =
{
"drawimage", "drawnumber", "drawswitchableimage",
@ -3474,7 +3577,7 @@ static const char *SBarInfoCommandNames[] =
"isselected", "usesammo", "usessecondaryammo",
"hasweaponpiece", "inventorybarnotvisible",
"weaponammo", "ininventory", "alpha", "ifhealth",
"ifinvulnerable", "ifwaterlevel",
"ifinvulnerable", "ifwaterlevel", "ifcvarint",
NULL
};
@ -3488,7 +3591,7 @@ enum SBarInfoCommands
SBARINFO_ISSELECTED, SBARINFO_USESAMMO, SBARINFO_USESSECONDARYAMMO,
SBARINFO_HASWEAPONPIECE, SBARINFO_INVENTORYBARNOTVISIBLE,
SBARINFO_WEAPONAMMO, SBARINFO_ININVENTORY, SBARINFO_ALPHA, SBARINFO_IFHEALTH,
SBARINFO_IFINVULNERABLE, SBARINFO_IFWATERLEVEL,
SBARINFO_IFINVULNERABLE, SBARINFO_IFWATERLEVEL, SBARINFO_IFCVARINT,
};
SBarInfoCommand *SBarInfoCommandFlowControl::NextCommand(FScanner &sc)
@ -3524,6 +3627,7 @@ SBarInfoCommand *SBarInfoCommandFlowControl::NextCommand(FScanner &sc)
case SBARINFO_IFHEALTH: return new CommandIfHealth(script);
case SBARINFO_IFINVULNERABLE: return new CommandIfInvulnerable(script);
case SBARINFO_IFWATERLEVEL: return new CommandIfWaterLevel(script);
case SBARINFO_IFCVARINT: return new CommandIfCVarInt(script);
}
sc.ScriptError("Unknown command '%s'.\n", sc.String);

View file

@ -66,7 +66,7 @@ EXTERN_CVAR (Int, screenblocks)
EXTERN_CVAR (Bool, am_showtime)
EXTERN_CVAR (Bool, am_showtotaltime)
CVAR(Int,hud_althudscale, 2, CVAR_ARCHIVE) // Scale the hud to 640x400?
CVAR(Int,hud_althudscale, 4, CVAR_ARCHIVE) // Scale the hud to 640x400?
CVAR(Bool,hud_althud, false, CVAR_ARCHIVE) // Enable/Disable the alternate HUD
// These are intentionally not the same as in the automap!
@ -118,7 +118,7 @@ static int hudwidth, hudheight; // current width/height for HUD display
static int statspace;
DVector2 AM_GetPosition();
int active_con_scaletext();
FTextureID GetHUDIcon(PClassInventory *cls)
{
@ -886,22 +886,15 @@ static void DrawCoordinates(player_t * CPlayer)
}
int vwidth, vheight;
switch (con_scaletext)
if (active_con_scaletext() == 0)
{
default:
case 0:
vwidth = SCREENWIDTH;
vheight = SCREENWIDTH;
break;
case 1:
case 2:
vwidth = SCREENWIDTH/2;
vheight = SCREENWIDTH/2;
break;
case 3:
vwidth = SCREENWIDTH/4;
vheight = SCREENWIDTH/4;
break;
vwidth = SCREENWIDTH / 2;
vheight = SCREENHEIGHT / 2;
}
else
{
vwidth = SCREENWIDTH / active_con_scaletext();
vheight = SCREENHEIGHT / active_con_scaletext();
}
int xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
@ -1090,7 +1083,20 @@ void DrawHUD()
if (hud_althudscale && SCREENWIDTH>640)
{
hudwidth=SCREENWIDTH/2;
if (hud_althudscale == 3)
if (hud_althudscale == 4)
{
if (uiscale == 0)
{
hudwidth = CleanWidth;
hudheight = CleanHeight;
}
else
{
hudwidth = SCREENWIDTH / uiscale;
hudheight = SCREENHEIGHT / uiscale;
}
}
else if (hud_althudscale == 3)
{
hudwidth = SCREENWIDTH / 4;
hudheight = SCREENHEIGHT / 4;
@ -1102,13 +1108,13 @@ void DrawHUD()
}
else
{
if (WidescreenRatio == 4)
if (AspectTallerThanWide(WidescreenRatio))
{
hudheight = hudwidth * 30 / BaseRatioSizes[WidescreenRatio][3]; // BaseRatioSizes is inverted for this mode
hudheight = hudwidth * 30 / AspectMultiplier(WidescreenRatio); // BaseRatioSizes is inverted for this mode
}
else
{
hudheight = hudwidth * 30 / (48*48/BaseRatioSizes[WidescreenRatio][3]);
hudheight = hudwidth * 30 / (48*48/AspectMultiplier(WidescreenRatio));
}
}
}

View file

@ -74,6 +74,8 @@ EXTERN_CVAR (Bool, am_showtotaltime)
EXTERN_CVAR (Bool, noisedebug)
EXTERN_CVAR (Int, con_scaletext)
int active_con_scaletext();
DBaseStatusBar *StatusBar;
extern int setblocks;
@ -297,14 +299,15 @@ void DBaseStatusBar::SetScaled (bool scale, bool force)
{
ST_X = 0;
ST_Y = VirticalResolution - RelTop;
if (CheckRatio(SCREENWIDTH, SCREENHEIGHT) != 4)
float aspect = ActiveRatio(SCREENWIDTH, SCREENHEIGHT);
if (!AspectTallerThanWide(aspect))
{ // Normal resolution
::ST_Y = Scale (ST_Y, SCREENHEIGHT, VirticalResolution);
}
else
{ // 5:4 resolution
::ST_Y = Scale(ST_Y - VirticalResolution/2, SCREENHEIGHT*3, Scale(VirticalResolution, BaseRatioSizes[4][1], 200)) + SCREENHEIGHT/2
+ (SCREENHEIGHT - SCREENHEIGHT * BaseRatioSizes[4][3] / 48) / 2;
::ST_Y = Scale(ST_Y - VirticalResolution/2, SCREENHEIGHT*3, Scale(VirticalResolution, AspectBaseHeight(aspect), 200)) + SCREENHEIGHT/2
+ (SCREENHEIGHT - SCREENHEIGHT * AspectMultiplier(aspect) / 48) / 2;
}
Displacement = 0;
}
@ -1033,10 +1036,10 @@ void DBaseStatusBar::DrSmallNumberOuter (int val, int x, int y, bool center) con
void DBaseStatusBar::RefreshBackground () const
{
int x, x2, y, ratio;
int x, x2, y;
ratio = CheckRatio (SCREENWIDTH, SCREENHEIGHT);
x = (!IsRatioWidescreen(ratio) || !Scaled) ? ST_X : SCREENWIDTH*(48-BaseRatioSizes[ratio][3])/(48*2);
float ratio = ActiveRatio (SCREENWIDTH, SCREENHEIGHT);
x = (ratio < 1.5f || !Scaled) ? ST_X : SCREENWIDTH*(48-AspectMultiplier(ratio))/(48*2);
y = x == ST_X && x > 0 ? ST_Y : ::ST_Y;
if(!CompleteBorder)
@ -1056,8 +1059,8 @@ void DBaseStatusBar::RefreshBackground () const
{
if(!CompleteBorder)
{
x2 = !IsRatioWidescreen(ratio) || !Scaled ? ST_X+HorizontalResolution :
SCREENWIDTH - (SCREENWIDTH*(48-BaseRatioSizes[ratio][3])+48*2-1)/(48*2);
x2 = ratio < 1.5f || !Scaled ? ST_X+HorizontalResolution :
SCREENWIDTH - (SCREENWIDTH*(48-AspectMultiplier(ratio))+48*2-1)/(48*2);
}
else
{
@ -1240,17 +1243,17 @@ void DBaseStatusBar::Draw (EHudState state)
int xpos;
int y;
if (con_scaletext == 0)
if (active_con_scaletext() == 1)
{
vwidth = SCREENWIDTH;
vheight = SCREENHEIGHT;
xpos = vwidth - 80;
y = ::ST_Y - height;
}
else if (con_scaletext == 3)
else if (active_con_scaletext() > 1)
{
vwidth = SCREENWIDTH/4;
vheight = SCREENHEIGHT/4;
vwidth = SCREENWIDTH / active_con_scaletext();
vheight = SCREENHEIGHT / active_con_scaletext();
xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
y = ::ST_Y/4 - height;
}
@ -1264,9 +1267,9 @@ void DBaseStatusBar::Draw (EHudState state)
if (gameinfo.gametype == GAME_Strife)
{
if (con_scaletext == 0)
if (active_con_scaletext() == 1)
y -= height * 4;
else if (con_scaletext == 3)
else if (active_con_scaletext() > 3)
y -= height;
else
y -= height * 2;
@ -1400,27 +1403,15 @@ void DBaseStatusBar::DrawLog ()
if (CPlayer->LogText.IsNotEmpty())
{
// This uses the same scaling as regular HUD messages
switch (con_scaletext)
if (active_con_scaletext() == 0)
{
default:
hudwidth = SCREENWIDTH;
hudheight = SCREENHEIGHT;
break;
case 1:
hudwidth = SCREENWIDTH / CleanXfac;
hudheight = SCREENHEIGHT / CleanYfac;
break;
case 2:
hudwidth = SCREENWIDTH / 2;
hudheight = SCREENHEIGHT / 2;
break;
case 3:
hudwidth = SCREENWIDTH / 4;
hudheight = SCREENHEIGHT / 4;
break;
}
else
{
hudwidth = SCREENWIDTH / active_con_scaletext();
hudheight = SCREENHEIGHT / active_con_scaletext();
}
int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560;

View file

@ -552,7 +552,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
// If the torpedo hit the ceiling, it should still spawn the wave
savedz = self->Z();
if (wavedef && self->ceilingz < wavedef->Top())
if (wavedef && self->ceilingz < self->Z() + wavedef->Height)
{
self->SetZ(self->ceilingz - wavedef->Height);
}

View file

@ -322,7 +322,7 @@ void PacketGet (void)
// Don't show the message for disconnect notifications.
if (c != 2 || TransmitBuffer[0] != PRE_FAKE || TransmitBuffer[1] != PRE_DISCONNECT)
{
DPrintf("Dropped packet: Unknown host (%s:%d)\n", inet_ntoa(fromaddress.sin_addr), fromaddress.sin_port);
DPrintf(DMSG_WARNING, "Dropped packet: Unknown host (%s:%d)\n", inet_ntoa(fromaddress.sin_addr), fromaddress.sin_port);
}
doomcom.remotenode = -1;
return;

View file

@ -344,7 +344,7 @@ size_t PClassActor::PropagateMark()
// Mark damage function
if (Defaults != NULL)
{
GC::Mark(((AActor *)Defaults)->Damage);
GC::Mark(((AActor *)Defaults)->DamageFunc);
}
// marked += ActorInfo->NumOwnedStates * sizeof(FState);

View file

@ -95,7 +95,7 @@ CUSTOM_CVAR (Int, menu_screenratios, -1, CVAR_ARCHIVE)
}
else
{
BuildModesList (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
BuildModesList (screen->VideoWidth, screen->VideoHeight, DisplayBits);
}
}
@ -139,7 +139,7 @@ public:
DVideoModeMenu()
{
SetModesMenu (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
SetModesMenu (screen->VideoWidth, screen->VideoHeight, DisplayBits);
}
bool MenuEvent(int mkey, bool fromcontroller)
@ -163,13 +163,13 @@ public:
{
if (!GetSelectedSize (&NewWidth, &NewHeight))
{
NewWidth = SCREENWIDTH;
NewHeight = SCREENHEIGHT;
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
}
else
{
OldWidth = SCREENWIDTH;
OldHeight = SCREENHEIGHT;
OldWidth = screen->VideoWidth;
OldHeight = screen->VideoHeight;
OldBits = DisplayBits;
NewBits = BitTranslate[DummyDepthCvar];
setmodeneeded = true;
@ -297,11 +297,11 @@ void M_RestoreMode ()
void M_SetDefaultMode ()
{
// Make current resolution the default
vid_defwidth = SCREENWIDTH;
vid_defheight = SCREENHEIGHT;
vid_defwidth = screen->VideoWidth;
vid_defheight = screen->VideoHeight;
vid_defbits = DisplayBits;
testingmode = 0;
SetModesMenu (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
SetModesMenu (screen->VideoWidth, screen->VideoHeight, DisplayBits);
}
@ -314,7 +314,7 @@ void M_SetDefaultMode ()
void M_RefreshModesList ()
{
BuildModesList (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
BuildModesList (screen->VideoWidth, screen->VideoHeight, DisplayBits);
}
void M_InitVideoModesMenu ()
@ -385,8 +385,8 @@ void M_SetVideoMode()
{
if (!GetSelectedSize (&NewWidth, &NewHeight))
{
NewWidth = SCREENWIDTH;
NewHeight = SCREENHEIGHT;
NewWidth = screen->VideoWidth;
NewHeight = screen->VideoHeight;
}
else
{

View file

@ -35,6 +35,7 @@
#include <string.h>
#include "name.h"
#include "c_dispatch.h"
#include "c_console.h"
// MACROS ------------------------------------------------------------------
@ -268,6 +269,8 @@ FName::NameManager::~NameManager()
{
NameBlock *block, *next;
C_ClearTabCommands();
for (block = Blocks; block != NULL; block = next)
{
next = block->NextBlock;

View file

@ -654,6 +654,7 @@ xx(DecoCallLineSpecial)
xx(DecoNameToClass)
xx(DecoFindMultiNameState)
xx(DecoFindSingleNameState)
xx(DecoHandleRuntimeState)
xx(Damage)
// basic type names

View file

@ -1331,12 +1331,12 @@ static int CheckInventory (AActor *activator, const char *type, bool max)
if (info == NULL)
{
Printf ("ACS: I don't know what '%s' is.\n", type);
DPrintf (DMSG_ERROR, "ACS: '%s': Unknown actor class.\n", type);
return 0;
}
else if (!info->IsDescendantOf(RUNTIME_CLASS(AInventory)))
{
Printf ("ACS: '%s' is not an inventory item.\n", type);
DPrintf(DMSG_ERROR, "ACS: '%s' is not an inventory item.\n", type);
return 0;
}
@ -2237,7 +2237,7 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len)
}
}
DPrintf ("Loaded %d scripts, %d functions\n", NumScripts, NumFunctions);
DPrintf (DMSG_NOTIFY, "Loaded %d scripts, %d functions\n", NumScripts, NumFunctions);
return true;
}
@ -2824,7 +2824,7 @@ void FBehavior::StaticStartTypedScripts (WORD type, AActor *activator, bool alwa
"Disconnect",
"Return"
};
DPrintf("Starting all scripts of type %d (%s)\n", type,
DPrintf(DMSG_NOTIFY, "Starting all scripts of type %d (%s)\n", type,
type < countof(TypeNames) ? TypeNames[type] : TypeNames[SCRIPT_Lightning - 1]);
for (unsigned int i = 0; i < StaticModules.Size(); ++i)
{
@ -3791,7 +3791,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
break;
case APROP_Damage:
actor->Damage = CreateDamageFunction(value);
actor->SetDamage(value);
break;
case APROP_Alpha:
@ -4438,8 +4438,7 @@ enum EACSFunctions
ACSF_SpawnParticle,
ACSF_SetMusicVolume,
ACSF_CheckProximity,
// 1 more left...
ACSF_CheckActorState, // 99
/* Zandronum's - these must be skipped when we reach 99!
-100:ResetMap(0),
-101 : PlayerIsSpectator(1),
@ -4450,6 +4449,10 @@ enum EACSFunctions
-106 : KickFromGame(2),
*/
ACSF_CheckClass = 200,
ACSF_DamageActor, // [arookas]
ACSF_SetActorFlag,
// ZDaemon
ACSF_GetTeamScore = 19620, // (int team)
ACSF_SetTeamScore, // (int team, int value)
@ -6017,6 +6020,61 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
return P_Thing_CheckProximity(actor, classname, distance, count, flags, ptr);
}
case ACSF_CheckActorState:
{
actor = SingleActorFromTID(args[0], activator);
const char *statename = FBehavior::StaticLookupString(args[1]);
bool exact = (argCount > 2) ? !!args[2] : false;
if (actor && statename)
{
return (actor->GetClass()->FindStateByString(statename, exact) != nullptr);
}
return false;
}
case ACSF_CheckClass:
{
const char *clsname = FBehavior::StaticLookupString(args[0]);
return !!PClass::FindActor(clsname);
}
case ACSF_DamageActor: // [arookas] wrapper around P_DamageMobj
{
// (target, ptr_select1, inflictor, ptr_select2, amount, damagetype)
AActor* target = COPY_AAPTR(SingleActorFromTID(args[0], activator), args[1]);
AActor* inflictor = COPY_AAPTR(SingleActorFromTID(args[2], activator), args[3]);
FName damagetype(FBehavior::StaticLookupString(args[5]));
return P_DamageMobj(target, inflictor, inflictor, args[4], damagetype);
}
case ACSF_SetActorFlag:
{
int tid = args[0];
FString flagname = FBehavior::StaticLookupString(args[1]);
bool flagvalue = !!args[2];
int count = 0; // Return value; number of actors affected
if (tid == 0)
{
if (ModActorFlag(activator, flagname, flagvalue))
{
++count;
}
}
else
{
FActorIterator it(tid);
while ((actor = it.Next()) != nullptr)
{
// Don't log errors when affecting many actors because things might share a TID but not share the flag
if (ModActorFlag(actor, flagname, flagvalue, false))
{
++count;
}
}
}
return count;
}
default:
break;
}
@ -6198,7 +6256,7 @@ int DLevelScript::RunScript ()
activeBehavior = savedActiveBehavior;
// fall through
case PCD_TERMINATE:
DPrintf ("%s finished\n", ScriptPresentation(script).GetChars());
DPrintf (DMSG_NOTIFY, "%s finished\n", ScriptPresentation(script).GetChars());
state = SCRIPT_PleaseRemove;
break;
@ -7635,7 +7693,7 @@ scriptwait:
if (activationline != NULL)
{
activationline->special = 0;
DPrintf("Cleared line special on line %d\n", (int)(activationline - lines));
DPrintf(DMSG_SPAMMY, "Cleared line special on line %d\n", (int)(activationline - lines));
}
break;
@ -8274,7 +8332,7 @@ scriptwait:
line->args[2] = STACK(3);
line->args[3] = STACK(2);
line->args[4] = STACK(1);
DPrintf("Set special on line %d (id %d) to %d(%d,%d,%d,%d,%d)\n",
DPrintf(DMSG_SPAMMY, "Set special on line %d (id %d) to %d(%d,%d,%d,%d,%d)\n",
linenum, STACK(7), specnum, arg0, STACK(4), STACK(3), STACK(2), STACK(1));
}
sp -= 7;
@ -9652,7 +9710,7 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr
PutLast();
}
DPrintf("%s started.\n", ScriptPresentation(num).GetChars());
DPrintf(DMSG_SPAMMY, "%s started.\n", ScriptPresentation(num).GetChars());
}
static void SetScriptState (int script, DLevelScript::EScriptState state)
@ -9699,12 +9757,12 @@ void P_DoDeferedScripts ()
case acsdefered_t::defsuspend:
SetScriptState (def->script, DLevelScript::SCRIPT_Suspended);
DPrintf ("Deferred suspend of %s\n", ScriptPresentation(def->script).GetChars());
DPrintf (DMSG_SPAMMY, "Deferred suspend of %s\n", ScriptPresentation(def->script).GetChars());
break;
case acsdefered_t::defterminate:
SetScriptState (def->script, DLevelScript::SCRIPT_PleaseRemove);
DPrintf ("Deferred terminate of %s\n", ScriptPresentation(def->script).GetChars());
DPrintf (DMSG_SPAMMY, "Deferred terminate of %s\n", ScriptPresentation(def->script).GetChars());
break;
}
delete def;
@ -9740,7 +9798,7 @@ static void addDefered (level_info_t *i, acsdefered_t::EType type, int script, c
def->playernum = -1;
}
i->defered = def;
DPrintf ("%s on map %s deferred\n", ScriptPresentation(script).GetChars(), i->MapName.GetChars());
DPrintf (DMSG_SPAMMY, "%s on map %s deferred\n", ScriptPresentation(script).GetChars(), i->MapName.GetChars());
}
}

View file

@ -552,21 +552,31 @@ void P_ActivateInStasisCeiling (int tag)
//
//============================================================================
bool EV_CeilingCrushStop (int tag)
bool EV_CeilingCrushStop (int tag, bool remove)
{
bool rtn = false;
DCeiling *scan;
TThinkerIterator<DCeiling> iterator;
while ( (scan = iterator.Next ()) )
scan = iterator.Next();
while (scan != nullptr)
{
DCeiling *next = iterator.Next();
if (scan->m_Tag == tag && scan->m_Direction != 0)
{
SN_StopSequence (scan->m_Sector, CHAN_CEILING);
if (!remove)
{
SN_StopSequence(scan->m_Sector, CHAN_CEILING);
scan->m_OldDirection = scan->m_Direction;
scan->m_Direction = 0; // in-stasis;
}
else
{
scan->Destroy();
}
rtn = true;
}
scan = next;
}
return rtn;

View file

@ -253,7 +253,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc
if ((type == 1 && !isbinary) || (type == 2 && isbinary))
{
DPrintf("Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum));
DPrintf(DMSG_ERROR, "Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum));
return false;
}
@ -273,7 +273,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc
// is exactly 1516 bytes long.
if (numnodes % 1516 != 0)
{
DPrintf("Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum));
DPrintf(DMSG_ERROR, "Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum));
return false;
}
numnodes /= 1516;
@ -283,7 +283,7 @@ static bool LoadScriptFile(int lumpnum, FileReader *lump, int numnodes, bool inc
// And the teaser version has 1488-byte entries.
if (numnodes % 1488 != 0)
{
DPrintf("Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum));
DPrintf(DMSG_ERROR, "Incorrect data format for %s.", Wads.GetLumpFullName(lumpnum));
return false;
}
numnodes /= 1488;

View file

@ -1013,7 +1013,7 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
subsectors, numsubsectors,
vertexes, numvertexes);
endTime = I_FPSTime ();
DPrintf ("BSP generation took %.3f sec (%d segs)\n", (endTime - startTime) * 0.001, numsegs);
DPrintf (DMSG_NOTIFY, "BSP generation took %.3f sec (%d segs)\n", (endTime - startTime) * 0.001, numsegs);
buildtime = endTime - startTime;
}
}
@ -1026,12 +1026,12 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
#endif
if (level.maptype != MAPTYPE_BUILD && gl_cachenodes && buildtime/1000.f >= gl_cachetime)
{
DPrintf("Caching nodes\n");
DPrintf(DMSG_NOTIFY, "Caching nodes\n");
CreateCachedNodes(map);
}
else
{
DPrintf("Not caching nodes (time = %f)\n", buildtime/1000.f);
DPrintf(DMSG_NOTIFY, "Not caching nodes (time = %f)\n", buildtime/1000.f);
}
}

View file

@ -949,6 +949,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
int fakeDamage = 0;
int holdDamage = 0;
const int rawdamage = damage;
const bool telefragDamage = (rawdamage >= TELEFRAG_DAMAGE);
if (damage < 0) damage = 0;
@ -962,7 +963,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
forcedPain = (MustForcePain(target, inflictor));
// Spectral targets only take damage from spectral projectiles.
if (target->flags4 & MF4_SPECTRAL && damage < TELEFRAG_DAMAGE)
if (target->flags4 & MF4_SPECTRAL && !telefragDamage)
{
if (inflictor == NULL || !(inflictor->flags4 & MF4_SPECTRAL))
{
@ -987,7 +988,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
// different here. At any rate, invulnerable is being checked before type factoring, which is then being
// checked by player cheats/invul/buddha followed by monster buddha. This is inconsistent. Don't let the
// original telefrag damage CHECK (rawdamage) be influenced by outside factors when looking at cheats/invul.
if ((target->flags2 & MF2_INVULNERABLE) && (rawdamage < TELEFRAG_DAMAGE) && (!(flags & DMG_FORCED)))
if ((target->flags2 & MF2_INVULNERABLE) && !telefragDamage && (!(flags & DMG_FORCED)))
{ // actor is invulnerable
if (target->player == NULL)
{
@ -1046,7 +1047,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
return -1;
}
if ((rawdamage < TELEFRAG_DAMAGE) || (target->flags7 & MF7_LAXTELEFRAGDMG)) // TELEFRAG_DAMAGE may only be reduced with LAXTELEFRAGDMG or it may not guarantee its effect.
if (!telefragDamage || (target->flags7 & MF7_LAXTELEFRAGDMG)) // TELEFRAG_DAMAGE may only be reduced with LAXTELEFRAGDMG or it may not guarantee its effect.
{
if (player && damage > 1)
{
@ -1214,7 +1215,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
target->IsTeammate (source))
{
//Use the original damage to check for telefrag amount. Don't let the now-amplified damagetypes do it.
if (rawdamage < TELEFRAG_DAMAGE || (target->flags7 & MF7_LAXTELEFRAGDMG))
if (!telefragDamage || (target->flags7 & MF7_LAXTELEFRAGDMG))
{ // Still allow telefragging :-(
damage = (int)(damage * level.teamdamage);
if (damage < 0)
@ -1256,7 +1257,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
if (!(flags & DMG_FORCED))
{
// check the real player, not a voodoo doll here for invulnerability effects
if ((rawdamage < TELEFRAG_DAMAGE && ((player->mo->flags2 & MF2_INVULNERABLE) ||
if ((!telefragDamage && ((player->mo->flags2 & MF2_INVULNERABLE) ||
(player->cheats & CF_GODMODE))) ||
(player->cheats & CF_GODMODE2) || (player->mo->flags5 & MF5_NODAMAGE))
//Absolutely no hurting if NODAMAGE is involved. Same for GODMODE2.
@ -1281,7 +1282,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
{
player->mo->Inventory->AbsorbDamage(damage, mod, newdam);
}
if ((rawdamage < TELEFRAG_DAMAGE) || (player->mo->flags7 & MF7_LAXTELEFRAGDMG)) //rawdamage is never modified.
if (!telefragDamage || (player->mo->flags7 & MF7_LAXTELEFRAGDMG)) //rawdamage is never modified.
{
// if we are telefragging don't let the damage value go below that magic value. Some further checks would fail otherwise.
damage = newdam;
@ -1306,7 +1307,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
}
}
if (damage >= player->health && rawdamage < TELEFRAG_DAMAGE
if (damage >= player->health && !telefragDamage
&& (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch)
&& !player->morphTics)
{ // Try to use some inventory health
@ -1330,7 +1331,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
// but telefragging should still do enough damage to kill the player)
// Ignore players that are already dead.
// [MC]Buddha2 absorbs telefrag damage, and anything else thrown their way.
if (!(flags & DMG_FORCED) && (((player->cheats & CF_BUDDHA2) || (((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA)) && (rawdamage < TELEFRAG_DAMAGE))) && (player->playerstate != PST_DEAD)))
if (!(flags & DMG_FORCED) && (((player->cheats & CF_BUDDHA2) || (((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA)) && !telefragDamage)) && (player->playerstate != PST_DEAD)))
{
// If this is a voodoo doll we need to handle the real player as well.
player->mo->health = target->health = player->health = 1;
@ -1395,7 +1396,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
if (target->health <= 0)
{
//[MC]Buddha flag for monsters.
if (!(flags & DMG_FORCED) && ((target->flags7 & MF7_BUDDHA) && (rawdamage < TELEFRAG_DAMAGE) && ((inflictor == NULL || !(inflictor->flags7 & MF7_FOILBUDDHA)) && !(flags & DMG_FOILBUDDHA))))
if (!(flags & DMG_FORCED) && ((target->flags7 & MF7_BUDDHA) && !telefragDamage && ((inflictor == NULL || !(inflictor->flags7 & MF7_FOILBUDDHA)) && !(flags & DMG_FOILBUDDHA))))
{ //FOILBUDDHA or Telefrag damage must kill it.
target->health = 1;
}

View file

@ -686,9 +686,22 @@ FUNC(LS_Ceiling_LowerAndCrushDist)
}
FUNC(LS_Ceiling_CrushStop)
// Ceiling_CrushStop (tag)
// Ceiling_CrushStop (tag, remove)
{
return EV_CeilingCrushStop (arg0);
bool remove;
switch (arg3)
{
case 1:
remove = false;
break;
case 2:
remove = true;
break;
default:
remove = gameinfo.gametype == GAME_Hexen;
break;
}
return EV_CeilingCrushStop (arg0, remove);
}
FUNC(LS_Ceiling_CrushRaiseAndStay)
@ -890,9 +903,22 @@ FUNC(LS_Plat_PerpetualRaiseLip)
}
FUNC(LS_Plat_Stop)
// Plat_Stop (tag)
// Plat_Stop (tag, remove?)
{
EV_StopPlat (arg0);
bool remove;
switch (arg3)
{
case 1:
remove = false;
break;
case 2:
remove = true;
break;
default:
remove = gameinfo.gametype == GAME_Hexen;
break;
}
EV_StopPlat(arg0, remove);
return true;
}

View file

@ -392,7 +392,7 @@ enum
RADF_NODAMAGE = 8,
RADF_THRUSTZ = 16,
};
void P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance,
int P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance,
FName damageType, int flags, int fulldamagedistance=0);
void P_DelSector_List();

View file

@ -434,7 +434,8 @@ bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modi
// If this teleport was caused by a move, P_TryMove() will handle the
// sector transition messages better than we can here.
if (!(thing->flags6 & MF6_INTRYMOVE))
// This needs to be compatibility optioned because some older maps exploited this missing feature.
if (!(thing->flags6 & MF6_INTRYMOVE) && !(i_compatflags2 & COMPATF2_TELEPORT))
{
thing->CheckSectorTransition(oldsec);
}
@ -1319,7 +1320,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
// [RH] What is the point of this check, again? In Hexen, it is unconditional,
// but here we only do it if the missile's damage is 0.
// MBF bouncer might have a non-0 damage value, but they must not deal damage on impact either.
if ((tm.thing->BounceFlags & BOUNCE_Actors) && (tm.thing->Damage == 0 || !(tm.thing->flags & MF_MISSILE)))
if ((tm.thing->BounceFlags & BOUNCE_Actors) && (tm.thing->IsZeroDamage() || !(tm.thing->flags & MF_MISSILE)))
{
return (tm.thing->target == thing || !(thing->flags & MF_SOLID));
}
@ -1911,7 +1912,7 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, DVector2 *
{
if (line->special && !(mobj->flags6 & MF6_NOTRIGGER))
{
if (posforwindowcheck && !(ib_compatflags & BCOMPATF_NOWINDOWCHECK) && line->backsector != NULL)
if (posforwindowcheck && !(i_compatflags2 & COMPATF2_PUSHWINDOW) && line->backsector != NULL)
{ // Make sure this line actually blocks us and is not a window
// or similar construct we are standing inside of.
DVector3 pos = mobj->PosRelative(line);
@ -4438,6 +4439,9 @@ AActor *P_LinePickActor(AActor *t1, DAngle angle, double distance, DAngle pitch,
TData.Caller = t1;
TData.hitGhosts = true;
TData.MThruSpecies = false;
TData.ThruActors = false;
TData.ThruSpecies = false;
if (Trace(t1->PosAtZ(shootz), t1->Sector, direction, distance,
actorMask, wallMask, t1, trace, TRACE_NoSky | TRACE_PortalRestrict, CheckForActor, &TData))
@ -5241,11 +5245,11 @@ CUSTOM_CVAR(Float, splashfactor, 1.f, CVAR_SERVERINFO)
//
//==========================================================================
void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bombdistance, FName bombmod,
int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bombdistance, FName bombmod,
int flags, int fulldamagedistance)
{
if (bombdistance <= 0)
return;
return 0;
fulldamagedistance = clamp<int>(fulldamagedistance, 0, bombdistance - 1);
double bombdistancefloat = 1. / (double)(bombdistance - fulldamagedistance);
@ -5260,6 +5264,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo
bombsource = bombspot;
}
int count = 0;
while ((it.Next(&cres)))
{
AActor *thing = cres.thing;
@ -5355,7 +5360,12 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo
int newdam = damage;
if (!(flags & RADF_NODAMAGE))
{
//[MC] Don't count actors saved by buddha if already at 1 health.
int prehealth = thing->health;
newdam = P_DamageMobj(thing, bombspot, bombsource, damage, bombmod);
if (thing->health < prehealth) count++;
}
else if (thing->player == NULL && (!(flags & RADF_NOIMPACTDAMAGE) && !(thing->flags7 & MF7_DONTTHRUST)))
thing->flags2 |= MF2_BLASTED;
@ -5421,12 +5431,16 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo
damage = int(damage * factor);
if (damage > 0)
{
//[MC] Don't count actors saved by buddha if already at 1 health.
int prehealth = thing->health;
int newdam = P_DamageMobj(thing, bombspot, bombsource, damage, bombmod);
P_TraceBleed(newdam > 0 ? newdam : damage, thing, bombspot);
if (thing->health < prehealth) count++;
}
}
}
}
return count;
}
//==========================================================================

View file

@ -361,7 +361,7 @@ bool AActor::FixMapthingPos()
if (distance < radius)
{
DPrintf("%s at (%f,%f) lies on %s line %td, distance = %f\n",
DPrintf(DMSG_NOTIFY, "%s at (%f,%f) lies on %s line %td, distance = %f\n",
this->GetClass()->TypeName.GetChars(), X(), Y(),
ldef->Delta().X == 0 ? "vertical" : ldef->Delta().Y == 0 ? "horizontal" : "diagonal",
ldef - lines, distance);

View file

@ -139,7 +139,8 @@ IMPLEMENT_POINTY_CLASS (AActor)
DECLARE_POINTER (LastHeard)
DECLARE_POINTER (master)
DECLARE_POINTER (Poisoner)
DECLARE_POINTER (Damage)
DECLARE_POINTER (DamageFunc)
DECLARE_POINTER (alternative)
END_POINTERS
AActor::~AActor ()
@ -148,73 +149,6 @@ AActor::~AActor ()
// Use Destroy() instead.
}
//==========================================================================
//
// CalcDamageValue
//
// Given a script function, returns an integer to represent it in a
// savegame. This encoding is compatible with previous incarnations
// where damage was an integer.
//
// 0 : use null function
// 0x40000000 : use default function
// anything else : use function that returns this number
//
//==========================================================================
static int CalcDamageValue(VMFunction *func)
{
if (func == NULL)
{
return 0;
}
VMScriptFunction *sfunc = dyn_cast<VMScriptFunction>(func);
if (sfunc == NULL)
{
return 0x40000000;
}
VMOP *op = sfunc->Code;
// If the function was created by CreateDamageFunction(), extract
// the value used to create it and return that. Otherwise, return
// indicating to use the default function.
if (op->op == OP_RETI && op->a == 0)
{
return op->i16;
}
if (op->op == OP_RET && op->a == 0 && op->b == (REGT_INT | REGT_KONST))
{
return sfunc->KonstD[op->c];
}
return 0x40000000;
}
//==========================================================================
//
// UncalcDamageValue
//
// Given a damage integer, returns a script function for it.
//
//==========================================================================
static VMFunction *UncalcDamageValue(int dmg, VMFunction *def)
{
if (dmg == 0)
{
return NULL;
}
if ((dmg & 0xC0000000) == 0x40000000)
{
return def;
}
// Does the default version return this? If so, use it. Otherwise,
// create a new function.
if (CalcDamageValue(def) == dmg)
{
return def;
}
return CreateDamageFunction(dmg);
}
//==========================================================================
//
// AActor :: Serialize
@ -262,18 +196,16 @@ void AActor::Serialize(FArchive &arc)
<< projectilepassheight
<< Vel
<< tics
<< state;
if (arc.IsStoring())
<< state
<< DamageVal;
if (DamageVal == 0x40000000 || DamageVal == -1)
{
int dmg;
dmg = CalcDamageValue(Damage);
arc << dmg;
DamageVal = -1;
DamageFunc = GetDefault()->DamageFunc;
}
else
{
int dmg;
arc << dmg;
Damage = UncalcDamageValue(dmg, GetDefault()->Damage);
DamageFunc = nullptr;
}
P_SerializeTerrain(arc, floorterrain);
arc << projectileKickback
@ -389,6 +321,11 @@ void AActor::Serialize(FArchive &arc)
arc << SpriteRotation;
}
if (SaveVersion >= 4550)
{
arc << alternative;
}
{
FString tagstr;
if (arc.IsStoring() && Tag != NULL && Tag->Len() > 0) tagstr = *Tag;
@ -1806,6 +1743,11 @@ double P_XYMovement (AActor *mo, DVector2 scroll)
mo->Vel.X *= fac;
mo->Vel.Y *= fac;
}
const double VELOCITY_THRESHOLD = 5000; // don't let it move faster than this. Fixed point overflowed at 32768 but that's too much to make this safe.
if (mo->Vel.LengthSquared() >= VELOCITY_THRESHOLD*VELOCITY_THRESHOLD)
{
mo->Vel.MakeResize(VELOCITY_THRESHOLD);
}
move = mo->Vel;
// [RH] Carrying sectors didn't work with low speeds in BOOM. This is
// because BOOM relied on the speed being fast enough to accumulate
@ -2964,8 +2906,21 @@ CCMD(utid)
int AActor::GetMissileDamage (int mask, int add)
{
if (Damage == NULL)
if (DamageVal >= 0)
{
if (mask == 0)
{
return add * DamageVal;
}
else
{
return ((pr_missiledamage() & mask) + add) * DamageVal;
}
}
if (DamageFunc == nullptr)
{
// This should never happen
assert(false && "No damage function found");
return 0;
}
VMFrameStack stack;
@ -2977,22 +2932,11 @@ int AActor::GetMissileDamage (int mask, int add)
results[0].IntAt(&amount);
results[1].IntAt(&calculated);
if (stack.Call(Damage, &param, 1, results, 2) < 1)
if (stack.Call(DamageFunc, &param, 1, results, 2) < 1)
{ // No results
return 0;
}
if (calculated)
{
return amount;
}
else if (mask == 0)
{
return add * amount;
}
else
{
return ((pr_missiledamage() & mask) + add) * amount;
}
}
void AActor::Howl ()
@ -3684,7 +3628,7 @@ void AActor::Tick ()
// still have missiles that go straight up and down through actors without
// damaging anything.
// (for backwards compatibility this must check for lack of damage function, not for zero damage!)
if ((flags & MF_MISSILE) && Vel.X == 0 && Vel.Y == 0 && Damage != NULL)
if ((flags & MF_MISSILE) && Vel.X == 0 && Vel.Y == 0 && !IsZeroDamage())
{
Vel.X = MinVel;
}

View file

@ -429,15 +429,21 @@ void DPlat::Stop ()
m_Status = in_stasis;
}
void EV_StopPlat (int tag)
void EV_StopPlat (int tag, bool remove)
{
DPlat *scan;
TThinkerIterator<DPlat> iterator;
while ( (scan = iterator.Next ()) )
scan = iterator.Next();
while (scan != nullptr)
{
DPlat *next = iterator.Next();
if (scan->m_Status != DPlat::in_stasis && scan->m_Tag == tag)
scan->Stop ();
{
if (!remove) scan->Stop();
else scan->Destroy();
}
scan = next;
}
}

View file

@ -147,8 +147,8 @@ static void RotationComp(const sector_t *sec, int which, double dx, double dy, d
}
else
{
double ca = an.Cos();
double sa = an.Sin();
double ca = -an.Cos();
double sa = -an.Sin();
tdx = dx*ca - dy*sa;
tdy = dy*ca + dx*sa;
}
@ -349,8 +349,8 @@ DScroller::DScroller (double dx, double dy, const line_t *l,
if (y > x) d = x, x = y, y = d;
d = x / g_sin(g_atan2(y, x) + M_PI / 2);
x = (-dy * l->Delta().Y + dx * l->Delta().X) / d;
y = (-dx * l->Delta().Y - dy * l->Delta().Y) / d;
x = -(dy * l->Delta().Y + dx * l->Delta().X) / d;
y = -(dx * l->Delta().Y - dy * l->Delta().X) / d;
m_Type = EScroll::sc_side;
m_dx = x;

View file

@ -1689,7 +1689,7 @@ static void SetMapThingUserData(AActor *actor, unsigned udi)
if (var == NULL || (var->Flags & VARF_Native) || !var->Type->IsKindOf(RUNTIME_CLASS(PBasicType)))
{
DPrintf("%s is not a user variable in class %s\n", varname.GetChars(),
DPrintf(DMSG_WARNING, "%s is not a user variable in class %s\n", varname.GetChars(),
actor->GetClass()->TypeName.GetChars());
}
else
@ -1959,7 +1959,7 @@ void P_SetLineID (int i, line_t *ld)
break;
case Plane_Align:
setid = ld->args[2];
if (!(ib_compatflags & BCOMPATF_NOSLOPEID)) setid = ld->args[2];
break;
case Static_Init:
@ -2477,7 +2477,7 @@ int P_DetermineTranslucency (int lumpnum)
if (newcolor2.r == 255) // if black on white results in white it's either
// fully transparent or additive
{
if (developer)
if (developer >= DMSG_NOTIFY)
{
char lumpname[9];
lumpname[8] = 0;
@ -2488,7 +2488,7 @@ int P_DetermineTranslucency (int lumpnum)
return -newcolor.r;
}
if (developer)
if (developer >= DMSG_NOTIFY)
{
char lumpname[9];
lumpname[8] = 0;
@ -3028,7 +3028,7 @@ void P_LoadBlockMap (MapData * map)
Args->CheckParm("-blockmap")
)
{
DPrintf ("Generating BLOCKMAP\n");
DPrintf (DMSG_SPAMMY, "Generating BLOCKMAP\n");
P_CreateBlockMap ();
}
else
@ -3060,7 +3060,7 @@ void P_LoadBlockMap (MapData * map)
if (!P_VerifyBlockMap(count))
{
DPrintf ("Generating BLOCKMAP\n");
DPrintf (DMSG_SPAMMY, "Generating BLOCKMAP\n");
P_CreateBlockMap();
}
@ -3957,7 +3957,7 @@ void P_SetupLevel (const char *lumpname, int position)
subsectors, numsubsectors,
vertexes, numvertexes);
endTime = I_FPSTime ();
DPrintf ("BSP generation took %.3f sec (%d segs)\n", (endTime - startTime) * 0.001, numsegs);
DPrintf (DMSG_NOTIFY, "BSP generation took %.3f sec (%d segs)\n", (endTime - startTime) * 0.001, numsegs);
oldvertextable = builder.GetOldVertexTable();
reloop = true;
}

View file

@ -186,7 +186,7 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVe
line->special = 0;
}
// end of changed code
if (developer && buttonSuccess)
if (developer >= DMSG_SPAMMY && buttonSuccess)
{
Printf ("Line special %d activated on line %i\n", special, int(line - lines));
}
@ -358,7 +358,7 @@ bool P_PredictLine(line_t *line, AActor *mo, int side, int activationType)
special = line->special;
// end of changed code
if (developer && buttonSuccess)
if (developer >= DMSG_SPAMMY && buttonSuccess)
{
Printf("Line special %d predicted on line %i\n", special, int(line - lines));
}

View file

@ -212,13 +212,13 @@ private:
friend bool EV_DoPlat (int tag, line_t *line, EPlatType type,
double height, double speed, int delay, int lip, int change);
friend void EV_StopPlat (int tag);
friend void EV_StopPlat (int tag, bool remove);
friend void P_ActivateInStasis (int tag);
};
bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type,
double height, double speed, int delay, int lip, int change);
void EV_StopPlat (int tag);
void EV_StopPlat (int tag, bool remove);
void P_ActivateInStasis (int tag);
//
@ -434,14 +434,14 @@ private:
DCeiling ();
friend bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush);
friend bool EV_CeilingCrushStop (int tag);
friend bool EV_CeilingCrushStop (int tag, bool remove);
friend void P_ActivateInStasisCeiling (int tag);
};
bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush);
bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush = DCeiling::ECrushMode::crushDoom);
bool EV_CeilingCrushStop (int tag);
bool EV_CeilingCrushStop (int tag, bool remove);
void P_ActivateInStasisCeiling (int tag);

View file

@ -42,7 +42,7 @@ extern gamestate_t wipegamestate;
//
// P_CheckTickerPaused
//
// Returns true if the ticker should be paused. In that cause, it also
// Returns true if the ticker should be paused. In that case, it also
// pauses sound effects and possibly music. If the ticker should not be
// paused, then it returns false but does not unpause anything.
//

View file

@ -302,12 +302,16 @@ void FTraceInfo::Setup3DFloors()
if (rover->flags&FF_SWIMMABLE && Results->Crossed3DWater == NULL)
{
if (Check3DFloorPlane(rover, false))
{
// only consider if the plane is above the actual floor.
if (rover->top.plane->ZatPoint(Results->HitPos) > bf)
{
Results->Crossed3DWater = rover;
Results->Crossed3DWaterPos = Results->HitPos;
Results->Distance = 0;
}
}
}
if (!(rover->flags&FF_SHOOTTHROUGH))
{
@ -765,6 +769,9 @@ bool FTraceInfo::TraceTraverse (int ptflags)
if ((rover->flags & FF_EXISTS) && (rover->flags&FF_SWIMMABLE))
{
if (Check3DFloorPlane(rover, false))
{
// only consider if the plane is above the actual floor.
if (rover->top.plane->ZatPoint(Results->HitPos) > CurSector->floorplane.ZatPoint(Results->HitPos))
{
Results->Crossed3DWater = rover;
Results->Crossed3DWaterPos = Results->HitPos;
@ -772,6 +779,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
}
}
}
}
lastsplashsector = CurSector->sectornum;
}

View file

@ -147,7 +147,7 @@ extern TArray<int> linemap;
void UDMFParserBase::Skip()
{
if (developer) sc.ScriptMessage("Ignoring unknown key \"%s\".", sc.String);
if (developer >= DMSG_WARNING) sc.ScriptMessage("Ignoring unknown UDMF key \"%s\".", sc.String);
if(sc.CheckToken('{'))
{
int level = 1;
@ -309,6 +309,11 @@ void FUDMFKeys::Sort()
FUDMFKey *FUDMFKeys::Find(FName key)
{
if (!mSorted)
{
mSorted = true;
Sort();
}
int min = 0, max = Size()-1;
while (min <= max)

View file

@ -2441,7 +2441,7 @@ void P_PlayerThink (player_t *player)
S_ChangeMusic("*");
}
}
DPrintf("MUSINFO change for player %d to %d\n", (int)(player - players), player->MUSINFOactor->args[0]);
DPrintf(DMSG_NOTIFY, "MUSINFO change for player %d to %d\n", (int)(player - players), player->MUSINFOactor->args[0]);
}
}
@ -2828,9 +2828,9 @@ void P_PredictPlayer (player_t *player)
DoLerp = (int)PredictionLast.pos.X != (int)player->mo->X() || (int)PredictionLast.pos.Y != (int)player->mo->Y();
// Aditional Debug information
if (developer && DoLerp)
if (developer >= DMSG_NOTIFY && DoLerp)
{
DPrintf("Lerp! Ltic (%d) && Ptic (%d) | Lx (%f) && Px (%f) | Ly (%f) && Py (%f)\n",
DPrintf(DMSG_NOTIFY, "Lerp! Ltic (%d) && Ptic (%d) | Lx (%f) && Px (%f) | Ly (%f) && Py (%f)\n",
PredictionLast.gametic, i,
(PredictionLast.pos.X), (player->mo->X()),
(PredictionLast.pos.Y), (player->mo->Y()));

View file

@ -1327,6 +1327,17 @@ void FPolyObj::RecalcActorFloorCeil(FBoundingBox bounds) const
while ((actor = it.Next()) != NULL)
{
// skip everything outside the bounding box.
if (actor->X() + actor->radius <= bounds.Left() ||
actor->X() - actor->radius >= bounds.Right() ||
actor->Y() + actor->radius <= bounds.Bottom() ||
actor->Y() - actor->radius >= bounds.Top())
{
continue;
}
// Todo: Be a little more thorough with what gets altered here
// because this can dislocate a lot of items that were spawned on
// the lower side of a sector boundary.
P_FindFloorCeiling(actor);
}
}

View file

@ -294,7 +294,8 @@ static void SetRotation(FLinePortal *port)
else
{
// Linked portals have no angular difference.
port->mSinRot = port->mCosRot = 0.;
port->mSinRot = 0.;
port->mCosRot = 1.;
port->mAngleDiff = 0.;
}
}

View file

@ -0,0 +1,187 @@
/*
** i_specialpaths.mm
** Gets special system folders where data should be stored. (macOS version)
**
**---------------------------------------------------------------------------
** Copyright 2013-2016 Randy Heit
** Copyright 2016 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. 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.
** 3. 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 AUTHOR ``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 AUTHOR 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.
**---------------------------------------------------------------------------
**
*/
#include <CoreServices/CoreServices.h>
#include "cmdlib.h"
#include "m_misc.h"
#include "version.h" // for GAMENAME
//===========================================================================
//
// M_GetCachePath macOS
//
// Returns the path for cache GL nodes.
//
//===========================================================================
FString M_GetCachePath(bool create)
{
FString path;
char pathstr[PATH_MAX];
FSRef folder;
if (noErr == FSFindFolder(kUserDomain, kApplicationSupportFolderType, create ? kCreateFolder : 0, &folder) &&
noErr == FSRefMakePath(&folder, (UInt8*)pathstr, PATH_MAX))
{
path = pathstr;
}
else
{
path = progdir;
}
path += "/zdoom/cache";
return path;
}
//===========================================================================
//
// M_GetAutoexecPath macOS
//
// Returns the expected location of autoexec.cfg.
//
//===========================================================================
FString M_GetAutoexecPath()
{
FString path;
char cpath[PATH_MAX];
FSRef folder;
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
{
path << cpath << "/" GAME_DIR "/autoexec.cfg";
}
return path;
}
//===========================================================================
//
// M_GetCajunPath macOS
//
// Returns the location of the Cajun Bot definitions.
//
//===========================================================================
FString M_GetCajunPath(const char *botfilename)
{
FString path;
// Just copies the Windows code. Should this be more Mac-specific?
path << progdir << "zcajun/" << botfilename;
if (!FileExists(path))
{
path = "";
}
return path;
}
//===========================================================================
//
// M_GetConfigPath macOS
//
// Returns the path to the config file. On Windows, this can vary for reading
// vs writing. i.e. If $PROGDIR/zdoom-<user>.ini does not exist, it will try
// to read from $PROGDIR/zdoom.ini, but it will never write to zdoom.ini.
//
//===========================================================================
FString M_GetConfigPath(bool for_reading)
{
char cpath[PATH_MAX];
FSRef folder;
if (noErr == FSFindFolder(kUserDomain, kPreferencesFolderType, kCreateFolder, &folder) &&
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
{
FString path;
path << cpath << "/" GAMENAMELOWERCASE ".ini";
return path;
}
// Ungh.
return GAMENAMELOWERCASE ".ini";
}
//===========================================================================
//
// M_GetScreenshotsPath macOS
//
// Returns the path to the default screenshots directory.
//
//===========================================================================
FString M_GetScreenshotsPath()
{
FString path;
char cpath[PATH_MAX];
FSRef folder;
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
{
path << cpath << "/" GAME_DIR "/Screenshots/";
}
else
{
path = "~/";
}
return path;
}
//===========================================================================
//
// M_GetSavegamesPath macOS
//
// Returns the path to the default save games directory.
//
//===========================================================================
FString M_GetSavegamesPath()
{
FString path;
char cpath[PATH_MAX];
FSRef folder;
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
{
path << cpath << "/" GAME_DIR "/Savegames/";
}
return path;
}

View file

@ -243,18 +243,18 @@ void I_SetFPSLimit(int limit)
}
if (limit == 0)
{ // no limit
DPrintf("FPS timer disabled\n");
DPrintf(DMSG_NOTIFY, "FPS timer disabled\n");
}
else
{
FPSLimitTimerEnabled = true;
if(timer_create(CLOCK_REALTIME, &FPSLimitEvent, &FPSLimitTimer) == -1)
Printf("Failed to create FPS limitter event\n");
Printf(DMSG_WARNING, "Failed to create FPS limitter event\n");
itimerspec period = { {0, 0}, {0, 0} };
period.it_value.tv_nsec = period.it_interval.tv_nsec = 1000000000 / limit;
if(timer_settime(FPSLimitTimer, 0, &period, NULL) == -1)
Printf("Failed to set FPS limitter timer\n");
DPrintf("FPS timer set to %u ms\n", (unsigned int) period.it_interval.tv_nsec / 1000000);
Printf(DMSG_WARNING, "Failed to set FPS limitter timer\n");
DPrintf(DMSG_NOTIFY, "FPS timer set to %u ms\n", (unsigned int) period.it_interval.tv_nsec / 1000000);
}
}
#else

View file

@ -0,0 +1,200 @@
/*
** i_specialpaths.cpp
** Gets special system folders where data should be stored. (Unix version)
**
**---------------------------------------------------------------------------
** Copyright 2013-2016 Randy Heit
** Copyright 2016 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. 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.
** 3. 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 AUTHOR ``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 AUTHOR 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.
**---------------------------------------------------------------------------
**
*/
#include <sys/stat.h>
#include <sys/types.h>
#include "i_system.h"
#include "cmdlib.h"
#include "version.h" // for GAMENAME
FString GetUserFile (const char *file)
{
FString path;
struct stat info;
path = NicePath("~/" GAME_DIR "/");
if (stat (path, &info) == -1)
{
struct stat extrainfo;
// Sanity check for ~/.config
FString configPath = NicePath("~/.config/");
if (stat (configPath, &extrainfo) == -1)
{
if (mkdir (configPath, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
{
I_FatalError ("Failed to create ~/.config directory:\n%s", strerror(errno));
}
}
else if (!S_ISDIR(extrainfo.st_mode))
{
I_FatalError ("~/.config must be a directory");
}
// This can be removed after a release or two
// Transfer the old zdoom directory to the new location
bool moved = false;
FString oldpath = NicePath("~/." GAMENAMELOWERCASE "/");
if (stat (oldpath, &extrainfo) != -1)
{
if (rename(oldpath, path) == -1)
{
I_Error ("Failed to move old " GAMENAMELOWERCASE " directory (%s) to new location (%s).",
oldpath.GetChars(), path.GetChars());
}
else
moved = true;
}
if (!moved && mkdir (path, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
{
I_FatalError ("Failed to create %s directory:\n%s",
path.GetChars(), strerror (errno));
}
}
else
{
if (!S_ISDIR(info.st_mode))
{
I_FatalError ("%s must be a directory", path.GetChars());
}
}
path += file;
return path;
}
//===========================================================================
//
// M_GetCachePath Unix
//
// Returns the path for cache GL nodes.
//
//===========================================================================
FString M_GetCachePath(bool create)
{
// Don't use GAME_DIR and such so that ZDoom and its child ports can
// share the node cache.
FString path = NicePath("~/.config/zdoom/cache");
if (create)
{
CreatePath(path);
}
return path;
}
//===========================================================================
//
// M_GetAutoexecPath Unix
//
// Returns the expected location of autoexec.cfg.
//
//===========================================================================
FString M_GetAutoexecPath()
{
return GetUserFile("autoexec.cfg");
}
//===========================================================================
//
// M_GetCajunPath Unix
//
// Returns the location of the Cajun Bot definitions.
//
//===========================================================================
FString M_GetCajunPath(const char *botfilename)
{
FString path;
// Check first in ~/.config/zdoom/botfilename.
path = GetUserFile(botfilename);
if (!FileExists(path))
{
// Then check in SHARE_DIR/botfilename.
path = SHARE_DIR;
path << botfilename;
if (!FileExists(path))
{
path = "";
}
}
return path;
}
//===========================================================================
//
// M_GetConfigPath Unix
//
// Returns the path to the config file. On Windows, this can vary for reading
// vs writing. i.e. If $PROGDIR/zdoom-<user>.ini does not exist, it will try
// to read from $PROGDIR/zdoom.ini, but it will never write to zdoom.ini.
//
//===========================================================================
FString M_GetConfigPath(bool for_reading)
{
return GetUserFile(GAMENAMELOWERCASE ".ini");
}
//===========================================================================
//
// M_GetScreenshotsPath Unix
//
// Returns the path to the default screenshots directory.
//
//===========================================================================
FString M_GetScreenshotsPath()
{
return NicePath("~/" GAME_DIR "/screenshots/");
}
//===========================================================================
//
// M_GetSavegamesPath Unix
//
// Returns the path to the default save games directory.
//
//===========================================================================
FString M_GetSavegamesPath()
{
return NicePath("~/" GAME_DIR);
}

View file

@ -220,6 +220,7 @@ struct FUDMFKey
class FUDMFKeys : public TArray<FUDMFKey>
{
bool mSorted = false;
public:
void Sort();
FUDMFKey *Find(FName key);

View file

@ -235,7 +235,7 @@ void R_SetVisibility(double vis)
else
r_WallVisibility = r_BaseVisibility;
r_WallVisibility = (InvZtoScale * SCREENWIDTH*BaseRatioSizes[WidescreenRatio][1] /
r_WallVisibility = (InvZtoScale * SCREENWIDTH*AspectBaseHeight(WidescreenRatio) /
(viewwidth*SCREENHEIGHT*3)) * (r_WallVisibility * FocalTangent);
// Prevent overflow on floors/ceilings. Note that the calculation of
@ -298,7 +298,7 @@ CCMD (r_visibility)
//
//==========================================================================
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, int trueratio)
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio)
{
int virtheight, virtwidth, virtwidth2, virtheight2;
@ -321,22 +321,22 @@ void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight,
virtwidth = virtwidth2 = fullWidth;
virtheight = virtheight2 = fullHeight;
if (Is54Aspect(trueratio))
if (AspectTallerThanWide(trueratio))
{
virtheight2 = virtheight2 * BaseRatioSizes[trueratio][3] / 48;
virtheight2 = virtheight2 * AspectMultiplier(trueratio) / 48;
}
else
{
virtwidth2 = virtwidth2 * BaseRatioSizes[trueratio][3] / 48;
virtwidth2 = virtwidth2 * AspectMultiplier(trueratio) / 48;
}
if (Is54Aspect(WidescreenRatio))
if (AspectTallerThanWide(WidescreenRatio))
{
virtheight = virtheight * BaseRatioSizes[WidescreenRatio][3] / 48;
virtheight = virtheight * AspectMultiplier(WidescreenRatio) / 48;
}
else
{
virtwidth = virtwidth * BaseRatioSizes[WidescreenRatio][3] / 48;
virtwidth = virtwidth * AspectMultiplier(WidescreenRatio) / 48;
}
BaseYaspectMul = 320.0 * virtheight2 / (r_Yaspect * virtwidth2);
@ -688,7 +688,7 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
ViewPos.X = (x1 + r * dx)*2 - x;
ViewPos.Y = (y1 + r * dy)*2 - y;
}
ViewAngle = pds->src->Delta().Angle() - startang;
ViewAngle = pds->src->Delta().Angle() * 2 - startang;
}
else
{
@ -968,7 +968,7 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas,
RenderTarget = canvas;
bRenderingToCanvas = true;
R_SetWindow (12, width, height, height);
R_SetWindow (12, width, height, height, true);
viewwindowx = x;
viewwindowy = y;
viewactive = true;

View file

@ -55,7 +55,7 @@ struct FRenderer
virtual void ErrorCleanup () {}
virtual void ClearBuffer(int color) = 0;
virtual void Init() = 0;
virtual void SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, int trueratio) {}
virtual void SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio) {}
virtual void SetupFrame(player_t *player) {}
virtual void CopyStackedViewParameters() {}
virtual void RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov) = 0;

View file

@ -2311,7 +2311,7 @@ void R_CheckDrawSegs ()
firstdrawseg = drawsegs + firstofs;
ds_p = drawsegs + MaxDrawSegs;
MaxDrawSegs = newdrawsegs;
DPrintf ("MaxDrawSegs increased to %zu\n", MaxDrawSegs);
DPrintf (DMSG_NOTIFY, "MaxDrawSegs increased to %zu\n", MaxDrawSegs);
}
}
@ -2330,7 +2330,7 @@ ptrdiff_t R_NewOpening (ptrdiff_t len)
maxopenings = maxopenings ? maxopenings*2 : 16384;
while ((size_t)lastopening > maxopenings);
openings = (short *)M_Realloc (openings, maxopenings * sizeof(*openings));
DPrintf ("MaxOpenings increased to %zu\n", maxopenings);
DPrintf (DMSG_NOTIFY, "MaxOpenings increased to %zu\n", maxopenings);
}
return res;
}

View file

@ -47,7 +47,7 @@
EXTERN_CVAR(Bool, r_shadercolormaps)
class FArchive;
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, int trueratio);
void R_SWRSetWindow(int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio);
void R_SetupColormap(player_t *);
void R_SetupFreelook();
void R_InitRenderer();
@ -299,7 +299,7 @@ void FSoftwareRenderer::ClearBuffer(int color)
//
//===========================================================================
void FSoftwareRenderer::SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, int trueratio)
void FSoftwareRenderer::SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio)
{
R_SWRSetWindow(windowSize, fullWidth, fullHeight, stHeight, trueratio);
}

View file

@ -30,7 +30,7 @@ struct FSoftwareRenderer : public FRenderer
void ErrorCleanup ();
void ClearBuffer(int color);
void Init();
void SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, int trueratio);
void SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio);
void SetupFrame(player_t *player);
void CopyStackedViewParameters();
void RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov);

View file

@ -223,7 +223,7 @@ vissprite_t *R_NewVisSprite (void)
lastvissprite = &vissprites[MaxVisSprites];
firstvissprite = &vissprites[firstvisspritenum];
vissprite_p = &vissprites[prevvisspritenum];
DPrintf ("MaxVisSprites increased to %d\n", MaxVisSprites);
DPrintf (DMSG_NOTIFY, "MaxVisSprites increased to %d\n", MaxVisSprites);
// Allocate sprites from the new pile
for (vissprite_t **p = vissprite_p; p < lastvissprite; ++p)
@ -832,13 +832,11 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
else
{
// decide which texture to use for the sprite
#ifdef RANGECHECK
if (spritenum >= (signed)sprites.Size () || spritenum < 0)
if ((unsigned)spritenum >= sprites.Size ())
{
DPrintf ("R_ProjectSprite: invalid sprite number %u\n", spritenum);
DPrintf (DMSG_ERROR, "R_ProjectSprite: invalid sprite number %u\n", spritenum);
return;
}
#endif
spritedef_t *sprdef = &sprites[spritenum];
if (thing->frame >= sprdef->numframes)
{
@ -1314,13 +1312,13 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
// decide which patch to use
if ((unsigned)pspr->GetSprite() >= (unsigned)sprites.Size())
{
DPrintf("R_DrawPSprite: invalid sprite number %i\n", pspr->GetSprite());
DPrintf(DMSG_ERROR, "R_DrawPSprite: invalid sprite number %i\n", pspr->GetSprite());
return;
}
sprdef = &sprites[pspr->GetSprite()];
if (pspr->GetFrame() >= sprdef->numframes)
{
DPrintf("R_DrawPSprite: invalid sprite frame %i : %i\n", pspr->GetSprite(), pspr->GetFrame());
DPrintf(DMSG_ERROR, "R_DrawPSprite: invalid sprite frame %i : %i\n", pspr->GetSprite(), pspr->GetFrame());
return;
}
sprframe = &SpriteFrames[sprdef->spriteframes + pspr->GetFrame()];
@ -1397,7 +1395,7 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
}
if (pspr->GetID() < PSP_TARGETCENTER)
{ // Move the weapon down for 1280x1024.
vis->texturemid -= BaseRatioSizes[WidescreenRatio][2];
vis->texturemid -= AspectPspriteOffset(WidescreenRatio);
}
vis->x1 = x1 < 0 ? 0 : x1;
vis->x2 = x2 >= viewwidth ? viewwidth : x2;

View file

@ -138,7 +138,7 @@ angle_t LocalViewAngle;
int LocalViewPitch;
bool LocalKeyboardTurner;
int WidescreenRatio;
float WidescreenRatio;
int setblocks;
int extralight;
bool setsizeneeded;
@ -198,9 +198,9 @@ void R_SetViewSize (int blocks)
//
//==========================================================================
void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, bool renderingToCanvas)
{
int trueratio;
float trueratio;
if (windowSize >= 11)
{
@ -220,8 +220,15 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
freelookviewheight = ((setblocks*fullHeight)/10)&~7;
}
// If the screen is approximately 16:9 or 16:10, consider it widescreen.
WidescreenRatio = CheckRatio (fullWidth, fullHeight, &trueratio);
if (renderingToCanvas)
{
WidescreenRatio = fullWidth / (float)fullHeight;
trueratio = WidescreenRatio;
}
else
{
WidescreenRatio = ActiveRatio(fullWidth, fullHeight, &trueratio);
}
DrawFSHUD = (windowSize == 11);
@ -230,13 +237,13 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
centery = viewheight/2;
centerx = viewwidth/2;
if (Is54Aspect(WidescreenRatio))
if (AspectTallerThanWide(WidescreenRatio))
{
centerxwide = centerx;
}
else
{
centerxwide = centerx * BaseRatioSizes[WidescreenRatio][3] / 48;
centerxwide = centerx * AspectMultiplier(WidescreenRatio) / 48;
}
@ -656,7 +663,7 @@ void R_AddInterpolationPoint(const DVector3a &vec)
//
//==========================================================================
static double QuakePower(double factor, double intensity, double offset, double falloff, double wfalloff)
static double QuakePower(double factor, double intensity, double offset)
{
double randumb;
if (intensity == 0)
@ -667,7 +674,7 @@ static double QuakePower(double factor, double intensity, double offset, double
{
randumb = pr_torchflicker.GenRand_Real2() * (intensity * 2) - intensity;
}
return factor * (wfalloff * offset + falloff * randumb);
return factor * (offset + randumb);
}
//==========================================================================
@ -797,36 +804,36 @@ void R_SetupFrame (AActor *actor)
if (jiggers.RollIntensity != 0 || jiggers.RollWave != 0)
{
ViewRoll += QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave, jiggers.RFalloff, jiggers.RWFalloff);
ViewRoll += QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave);
}
if (jiggers.RelIntensity.X != 0 || jiggers.RelOffset.X != 0)
{
an = camera->Angles.Yaw;
double power = QuakePower(quakefactor, jiggers.RelIntensity.X, jiggers.RelOffset.X, jiggers.Falloff, jiggers.WFalloff);
double power = QuakePower(quakefactor, jiggers.RelIntensity.X, jiggers.RelOffset.X);
ViewPos += an.ToVector(power);
}
if (jiggers.RelIntensity.Y != 0 || jiggers.RelOffset.Y != 0)
{
an = camera->Angles.Yaw + 90;
double power = QuakePower(quakefactor, jiggers.RelIntensity.Y, jiggers.RelOffset.Y, jiggers.Falloff, jiggers.WFalloff);
double power = QuakePower(quakefactor, jiggers.RelIntensity.Y, jiggers.RelOffset.Y);
ViewPos += an.ToVector(power);
}
// FIXME: Relative Z is not relative
if (jiggers.RelIntensity.Z != 0 || jiggers.RelOffset.Z != 0)
{
ViewPos.Z += QuakePower(quakefactor, jiggers.RelIntensity.Z, jiggers.RelOffset.Z, jiggers.Falloff, jiggers.WFalloff);
ViewPos.Z += QuakePower(quakefactor, jiggers.RelIntensity.Z, jiggers.RelOffset.Z);
}
if (jiggers.Intensity.X != 0 || jiggers.Offset.X != 0)
{
ViewPos.X += QuakePower(quakefactor, jiggers.Intensity.X, jiggers.Offset.X, jiggers.Falloff, jiggers.WFalloff);
ViewPos.X += QuakePower(quakefactor, jiggers.Intensity.X, jiggers.Offset.X);
}
if (jiggers.Intensity.Y != 0 || jiggers.Offset.Y != 0)
{
ViewPos.Y += QuakePower(quakefactor, jiggers.Intensity.Y, jiggers.Offset.Y, jiggers.Falloff, jiggers.WFalloff);
ViewPos.Y += QuakePower(quakefactor, jiggers.Intensity.Y, jiggers.Offset.Y);
}
if (jiggers.Intensity.Z != 0 || jiggers.Offset.Z != 0)
{
ViewPos.Z += QuakePower(quakefactor, jiggers.Intensity.Z, jiggers.Offset.Z, jiggers.Falloff, jiggers.WFalloff);
ViewPos.Z += QuakePower(quakefactor, jiggers.Intensity.Z, jiggers.Offset.Z);
}
}
}

View file

@ -33,7 +33,7 @@ extern int validcount;
extern angle_t LocalViewAngle; // [RH] Added to consoleplayer's angle
extern int LocalViewPitch; // [RH] Used directly instead of consoleplayer's pitch
extern bool LocalKeyboardTurner; // [RH] The local player used the keyboard to turn, so interpolate
extern int WidescreenRatio;
extern float WidescreenRatio;
extern double r_TicFracF;
extern DWORD r_FrameTime;
@ -95,7 +95,7 @@ void R_ExecuteSetViewSize (void);
// Called by M_Responder.
void R_SetViewSize (int blocks);
void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight);
void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, bool renderingToCanvas = false);
extern void R_FreePastViewers ();

View file

@ -471,7 +471,7 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
{
// We can't add this to the flats namespace but
// it needs to be flagged for the texture manager.
DPrintf("Marking %s as potential flat\n", Lumps[i].Name);
DPrintf(DMSG_NOTIFY, "Marking %s as potential flat\n", Lumps[i].Name);
Lumps[i].Flags |= LUMPF_MAYBEFLAT;
}
}
@ -517,7 +517,7 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
}
// we found a marked block
DPrintf("Found %s block at (%d-%d)\n", startmarker, markers[start].index, end);
DPrintf(DMSG_NOTIFY, "Found %s block at (%d-%d)\n", startmarker, markers[start].index, end);
for(int j = markers[start].index + 1; j < end; j++)
{
if (Lumps[j].Namespace != ns_global)
@ -534,7 +534,7 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
// ignore sprite lumps smaller than 8 bytes (the smallest possible)
// in size -- this was used by some dmadds wads
// as an 'empty' graphics resource
DPrintf(" Skipped empty sprite %s (lump %d)\n", Lumps[j].Name, j);
DPrintf(DMSG_WARNING, " Skipped empty sprite %s (lump %d)\n", Lumps[j].Name, j);
}
else
{

View file

@ -182,7 +182,7 @@ int FPlayList::SetPosition (int position)
{
Position = position;
}
DPrintf ("Playlist position set to %d\n", Position);
DPrintf (DMSG_NOTIFY, "Playlist position set to %d\n", Position);
return Position;
}
@ -197,7 +197,7 @@ int FPlayList::Advance ()
{
Position = 0;
}
DPrintf ("Playlist advanced to song %d\n", Position);
DPrintf (DMSG_NOTIFY, "Playlist advanced to song %d\n", Position);
return Position;
}
@ -207,7 +207,7 @@ int FPlayList::Backup ()
{
Position = Songs.Size() - 1;
}
DPrintf ("Playlist backed up to song %d\n", Position);
DPrintf (DMSG_NOTIFY, "Playlist backed up to song %d\n", Position);
return Position;
}

View file

@ -552,7 +552,7 @@ void S_UnloadSound (sfxinfo_t *sfx)
GSnd->UnloadSound(sfx->data);
sfx->data.Clear();
sfx->data3d.Clear();
DPrintf("Unloaded sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
DPrintf(DMSG_NOTIFY, "Unloaded sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
}
}
@ -1327,7 +1327,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
{
if (S_sfx[i].data.isValid() && S_sfx[i].link == sfxinfo_t::NO_LINK && S_sfx[i].lumpnum == sfx->lumpnum)
{
DPrintf ("Linked %s to %s (%d)\n", sfx->name.GetChars(), S_sfx[i].name.GetChars(), i);
DPrintf (DMSG_NOTIFY, "Linked %s to %s (%d)\n", sfx->name.GetChars(), S_sfx[i].name.GetChars(), i);
sfx->link = i;
// This is necessary to avoid using the rolloff settings of the linked sound if its
// settings are different.
@ -1336,7 +1336,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
}
}
DPrintf("Loading sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
DPrintf(DMSG_NOTIFY, "Loading sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
int size = Wads.LumpLength(sfx->lumpnum);
if (size > 0)
@ -1396,7 +1396,7 @@ static void S_LoadSound3D(sfxinfo_t *sfx)
if(sfx->data3d.isValid())
return;
DPrintf("Loading monoized sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
DPrintf(DMSG_NOTIFY, "Loading monoized sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
int size = Wads.LumpLength(sfx->lumpnum);
if(size <= 0) return;

View file

@ -1044,7 +1044,7 @@ void FScriptPosition::Message (int severity, const char *message, ...) const
{
FString composed;
if ((severity == MSG_DEBUG || severity == MSG_DEBUGLOG) && !developer) return;
if ((severity == MSG_DEBUG || severity == MSG_DEBUGLOG) && developer < DMSG_NOTIFY) return;
if (severity == MSG_OPTERROR)
{
severity = strictdecorate ? MSG_ERROR : MSG_WARNING;

View file

@ -611,5 +611,14 @@ namespace FMOD
}
#endif
// FMOD Ex vs FMOD Studio
#if FMOD_VERSION >= 0x00040000 && FMOD_VERSION <= 0x0004FFFF
#define FMOD_STUDIO 0
#else
#define FMOD_STUDIO 1
#define FMOD_SOFTWARE 0
#endif
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -76,8 +76,13 @@ private:
QWORD_UNION DSPClock;
int OutputRate;
#if FMOD_STUDIO
static FMOD_RESULT F_CALLBACK ChannelCallback(FMOD_CHANNELCONTROL *channel, FMOD_CHANNELCONTROL_TYPE controltype, FMOD_CHANNELCONTROL_CALLBACK_TYPE type, void *data1, void *data2);
static float F_CALLBACK RolloffCallback(FMOD_CHANNELCONTROL *channel, float distance);
#else
static FMOD_RESULT F_CALLBACK ChannelCallback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *data1, void *data2);
static float F_CALLBACK RolloffCallback(FMOD_CHANNEL *channel, float distance);
#endif
bool HandleChannelDelay(FMOD::Channel *chan, FISoundChannel *reuse_chan, int flags, float freq) const;
FISoundChannel *CommonChannelSetup(FMOD::Channel *chan, FISoundChannel *reuse_chan) const;
@ -89,7 +94,9 @@ private:
bool Init ();
void Shutdown ();
#if !FMOD_STUDIO
void DumpDriverCaps(FMOD_CAPS caps, int minfrequency, int maxfrequency);
#endif
int DrawChannelGroupOutput(FMOD::ChannelGroup *group, float *wavearray, int width, int height, int y, int mode);
int DrawSystemOutput(float *wavearray, int width, int height, int y, int mode);
@ -121,7 +128,9 @@ private:
// Just for snd_status display
int Driver_MinFrequency;
int Driver_MaxFrequency;
#if !FMOD_STUDIO
FMOD_CAPS Driver_Caps;
#endif
friend class FMODStreamCapsule;
};

View file

@ -417,7 +417,7 @@ short *SoundRenderer::DecodeSample(int outlen, const void *coded, int sizebytes,
decoder->getInfo(&srate, &chans, &type);
if(chans != ChannelConfig_Mono || type != SampleType_Int16)
{
DPrintf("Sample is not 16-bit mono\n");
DPrintf(DMSG_WARNING, "Sample is not 16-bit mono\n");
delete decoder;
return samples;
}
@ -553,7 +553,7 @@ std::pair<SoundHandle,bool> SoundRenderer::LoadSoundVoc(BYTE *sfxdata, int lengt
break;
default: // Unknown block type
okay = false;
DPrintf ("Unknown VOC block type %i\n", blocktype);
DPrintf (DMSG_ERROR, "Unknown VOC block type %i\n", blocktype);
break;
}
// Move to next block

View file

@ -498,12 +498,12 @@ int FluidSynthMIDIDevice::LoadPatchSets(const char *patches)
}
if (FLUID_FAILED != fluid_synth_sfload(FluidSynth, path, count == 0))
{
DPrintf("Loaded patch set %s.\n", tok);
DPrintf(DMSG_NOTIFY, "Loaded patch set %s.\n", tok);
count++;
}
else
{
DPrintf("Failed to load patch set %s.\n", tok);
DPrintf(DMSG_ERROR, "Failed to load patch set %s.\n", tok);
}
tok = strtok(NULL, delim);
}

View file

@ -376,7 +376,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity ()
return false;
}
DPrintf ("cmd: \x1cG%s\n", CommandLine.GetChars());
DPrintf (DMSG_NOTIFY, "cmd: \x1cG%s\n", CommandLine.GetChars());
#ifdef _WIN32
STARTUPINFO startup = { sizeof(startup), };

View file

@ -143,7 +143,7 @@ XMISong::XMISong (FileReader &reader, EMidiDevice type, const char *args)
memset(Songs, 0, sizeof(*Songs) * NumSongs);
FindXMIDforms(MusHeader, SongLen, Songs);
CurrSong = Songs;
DPrintf("XMI song count: %d\n", NumSongs);
DPrintf(DMSG_SPAMMY, "XMI song count: %d\n", NumSongs);
}
//==========================================================================

View file

@ -747,8 +747,8 @@ OpenALSoundRenderer::OpenALSoundRenderer()
ALCint major=0, minor=0;
alcGetIntegerv(Device, ALC_MAJOR_VERSION, 1, &major);
alcGetIntegerv(Device, ALC_MINOR_VERSION, 1, &minor);
DPrintf(" ALC Version: " TEXTCOLOR_BLUE"%d.%d\n", major, minor);
DPrintf(" ALC Extensions: " TEXTCOLOR_ORANGE"%s\n", alcGetString(Device, ALC_EXTENSIONS));
DPrintf(DMSG_SPAMMY, " ALC Version: " TEXTCOLOR_BLUE"%d.%d\n", major, minor);
DPrintf(DMSG_SPAMMY, " ALC Extensions: " TEXTCOLOR_ORANGE"%s\n", alcGetString(Device, ALC_EXTENSIONS));
TArray<ALCint> attribs;
if(*snd_samplerate > 0)
@ -778,10 +778,10 @@ OpenALSoundRenderer::OpenALSoundRenderer()
}
attribs.Clear();
DPrintf(" Vendor: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VENDOR));
DPrintf(" Renderer: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_RENDERER));
DPrintf(" Version: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VERSION));
DPrintf(" Extensions: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS));
DPrintf(DMSG_SPAMMY, " Vendor: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VENDOR));
DPrintf(DMSG_SPAMMY, " Renderer: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_RENDERER));
DPrintf(DMSG_SPAMMY, " Version: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VERSION));
DPrintf(DMSG_SPAMMY, " Extensions: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS));
ALC.EXT_EFX = !!alcIsExtensionPresent(Device, "ALC_EXT_EFX");
ALC.EXT_disconnect = !!alcIsExtensionPresent(Device, "ALC_EXT_disconnect");
@ -864,7 +864,7 @@ OpenALSoundRenderer::OpenALSoundRenderer()
return;
}
FreeSfx = Sources;
DPrintf(" Allocated " TEXTCOLOR_BLUE"%u" TEXTCOLOR_NORMAL" sources\n", Sources.Size());
DPrintf(DMSG_NOTIFY, " Allocated " TEXTCOLOR_BLUE"%u" TEXTCOLOR_NORMAL" sources\n", Sources.Size());
WasInWater = false;
if(*snd_efx && ALC.EXT_EFX)
@ -913,10 +913,10 @@ OpenALSoundRenderer::OpenALSoundRenderer()
{
alEffecti(envReverb, AL_EFFECT_TYPE, AL_EFFECT_EAXREVERB);
if(alGetError() == AL_NO_ERROR)
DPrintf(" EAX Reverb found\n");
DPrintf(DMSG_SPAMMY, " EAX Reverb found\n");
alEffecti(envReverb, AL_EFFECT_TYPE, AL_EFFECT_REVERB);
if(alGetError() == AL_NO_ERROR)
DPrintf(" Standard Reverb found\n");
DPrintf(DMSG_SPAMMY, " Standard Reverb found\n");
alDeleteEffects(1, &envReverb);
getALError();
@ -929,7 +929,7 @@ OpenALSoundRenderer::OpenALSoundRenderer()
alFilteri(EnvFilters[0], AL_FILTER_TYPE, AL_FILTER_LOWPASS);
alFilteri(EnvFilters[1], AL_FILTER_TYPE, AL_FILTER_LOWPASS);
if(getALError() == AL_NO_ERROR)
DPrintf(" Lowpass found\n");
DPrintf(DMSG_SPAMMY, " Lowpass found\n");
else
{
alDeleteFilters(2, EnvFilters);
@ -1194,7 +1194,7 @@ std::pair<SoundHandle,bool> OpenALSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int
loopend = length / (channels*bits/8);
ALint loops[2] = { loopstart, loopend };
DPrintf("Setting loop points %d -> %d\n", loops[0], loops[1]);
DPrintf(DMSG_NOTIFY, "Setting loop points %d -> %d\n", loops[0], loops[1]);
alBufferiv(buffer, AL_LOOP_POINTS_SOFT, loops);
getALError();
}
@ -1202,7 +1202,7 @@ std::pair<SoundHandle,bool> OpenALSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int
{
static bool warned = false;
if(!warned)
Printf("Loop points not supported!\n");
Printf(DMSG_WARNING, "Loop points not supported!\n");
warned = true;
}
@ -1867,7 +1867,7 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
if(env != PrevEnvironment || env->Modified)
{
PrevEnvironment = env;
DPrintf("Reverb Environment %s\n", env->Name);
DPrintf(DMSG_NOTIFY, "Reverb Environment %s\n", env->Name);
if(EnvSlot != 0)
LoadReverb(env);

View file

@ -496,8 +496,7 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
else if (def == DEF_Projectile && sc.Compare ("Damage"))
{
sc.MustGetNumber ();
FxDamageValue *x = new FxDamageValue(new FxConstant(sc.Number, sc), false);
defaults->Damage = (VMFunction *)(uintptr_t)(ActorDamageFuncs.Push(x) + 1);
defaults->SetDamage(sc.Number);
}
else if (def == DEF_Projectile && sc.Compare ("DamageType"))
{

View file

@ -270,23 +270,28 @@ static void FinishThingdef()
for (i = 0; i < StateTempCalls.Size(); ++i)
{
FStateTempCall *tcall = StateTempCalls[i];
VMFunction *func;
VMFunction *func = nullptr;
assert(tcall->Code != NULL);
// We don't know the return type in advance for anonymous functions.
FCompileContext ctx(tcall->ActorClass, nullptr);
tcall->Code = tcall->Code->Resolve(ctx);
tcall->Proto = ctx.ReturnProto;
// Make sure resolving it didn't obliterate it.
if (tcall->Code != nullptr)
{
// Can we call this function directly without wrapping it in an
// anonymous function? e.g. Are we passing any parameters to it?
func = tcall->Code->GetDirectFunction();
if (func == NULL)
{
FCompileContext ctx(tcall->ActorClass);
tcall->Code = tcall->Code->Resolve(ctx);
// Make sure resolving it didn't obliterate it.
if (tcall->Code != NULL)
if (func == nullptr)
{
VMFunctionBuilder buildit;
assert(tcall->Proto != nullptr);
// Allocate registers used to pass parameters in.
// self, stateowner, state (all are pointers)
buildit.Registers[REGT_POINTER].Get(3);
@ -300,15 +305,7 @@ static void FinishThingdef()
// Generate prototype for this anonymous function
TArray<PType *> args(3);
SetImplicitArgs(&args, NULL, tcall->ActorClass, VARF_Method | VARF_Action);
if (tcall->Proto != NULL)
{
sfunc->Proto = NewPrototype(tcall->Proto->ReturnTypes, args);
}
else
{
TArray<PType *> norets(0);
sfunc->Proto = NewPrototype(norets, args);
}
func = sfunc;
@ -321,11 +318,9 @@ static void FinishThingdef()
codesize += sfunc->CodeSize;
}
}
}
if (tcall->Code != NULL)
{
delete tcall->Code;
tcall->Code = NULL;
tcall->Code = nullptr;
for (int k = 0; k < tcall->NumStates; ++k)
{
tcall->ActorClass->OwnedStates[tcall->FirstState + k].SetAction(func);
@ -348,17 +343,17 @@ static void FinishThingdef()
if (!def)
{
Printf("No ActorInfo defined for class '%s'\n", ti->TypeName.GetChars());
Printf(TEXTCOLOR_RED "No ActorInfo defined for class '%s'\n", ti->TypeName.GetChars());
errorcount++;
continue;
}
if (def->Damage != NULL)
if (def->DamageFunc != nullptr)
{
FxDamageValue *dmg = (FxDamageValue *)ActorDamageFuncs[(uintptr_t)def->Damage - 1];
FxDamageValue *dmg = (FxDamageValue *)ActorDamageFuncs[(uintptr_t)def->DamageFunc - 1];
VMScriptFunction *sfunc;
sfunc = dmg->GetFunction();
if (sfunc == NULL)
if (sfunc == nullptr)
{
FCompileContext ctx(ti);
dmg = static_cast<FxDamageValue *>(dmg->Resolve(ctx));
@ -370,15 +365,15 @@ static void FinishThingdef()
dmg->Emit(&buildit);
sfunc = buildit.MakeFunction();
sfunc->NumArgs = 1;
sfunc->Proto = NULL; ///FIXME: Need a proper prototype here
sfunc->Proto = nullptr; ///FIXME: Need a proper prototype here
// Save this function in case this damage value was reused
// (which happens quite easily with inheritance).
dmg->SetFunction(sfunc);
}
}
def->Damage = sfunc;
def->DamageFunc = sfunc;
if (dump != NULL && sfunc != NULL)
if (dump != nullptr && sfunc != nullptr)
{
char label[64];
int labellen = mysnprintf(label, countof(label), "Function %s.Damage",

Some files were not shown because too many files have changed in this diff Show more