-Wwrite-strings is useful to detect code where string literals and e.g. alloc'd
strings are used side-by-side, potentially creating dangerous situations, or to
find uses of old, non-constified APIs. However, enabling it would still flood
the log with too many warnings. Also, GCC wrongly warns for initializations of
char arrays.
git-svn-id: https://svn.eduke32.com/eduke32@2796 1a8010ca-5511-0410-912e-c29ae57300e0
uhypsq calculates the hypotenuse using unsigned multiplication. This is
permissible since for arbitrary int32s a and b, the following holds in
two's complement arithmetic:
(int32_t)((uint32_t)a * b) == (int32_t)((int64_t)a * b)
("Signed and unsigned multiplication is the same on the bit level.")
This fixes various overflows where wall lengths for walls of length > 46340
are calculated, but does not rid us of other overflows in the same vein
(usually dot products between vectors where one point is a wall vertex and
the other a position in a sector).
git-svn-id: https://svn.eduke32.com/eduke32@2791 1a8010ca-5511-0410-912e-c29ae57300e0
That is, "clang -ftrapv" builds don't abort almost immediately after entering
a level.
There are various classes of overflow bugs, needing different handling:
- Some texture mapping code was written with signed integer wrapping semantics
in mind. In some places, we're able to get away with unsigned casts.
- sometimes, we really need a wider range, like when calculating distances or
dot products
- negating INT_MIN. Here, we cast to int64_t temporarily. Note that if the
result is 32-bit wide, no 64-bit code may actually need to be generated.
- shifting into a signed integer's sign bit. We cast to uint32 here.
- in hitscan(), at the "abyss crash prevention code" comment, it's clearly
the other code that is better...
This is not merely done for pedantry, but rather makes it easier to track down
overflow bugs having a real impact on the game.
git-svn-id: https://svn.eduke32.com/eduke32@2784 1a8010ca-5511-0410-912e-c29ae57300e0
For SDL 1.2 and when building on linux, the code using
clock_gettime(CLOCK_MONOTINIC, ...) is taken over from SDL HG.
gethitickms() is a convenience function that return milliseconds as
doubles and isn't exposed in any header file, yet.
git-svn-id: https://svn.eduke32.com/eduke32@2778 1a8010ca-5511-0410-912e-c29ae57300e0
Doesn't work: indexed-color modes, gamma (at least for X11), mouse wheel,
special keys like ENTER or BACKSPACE in the OSD, probably more...
In build/Makefile.shared, we now have logic to autodetect an SDL2 installed
in /usr/local, however OS X and Wii builds follow other Makefile code paths,
it seems. Note that the matching SDL2_mixer must be used then, too.
In source/jaudiolib/src/driver_sdl.c, change the #includes from <SDL/SDL_xxx.h>
to "SDL_xxx.h". SDL wiki says this is the most portable way, hopefully this
doesn't break builds for anyone.
git-svn-id: https://svn.eduke32.com/eduke32@2777 1a8010ca-5511-0410-912e-c29ae57300e0
This was actually broken all the time except when ALL sectors were selected
(which was what I tested incidentally when I wrote the first "fix"). D'oh!
git-svn-id: https://svn.eduke32.com/eduke32@2773 1a8010ca-5511-0410-912e-c29ae57300e0
It's time to replace some int32s with 64-bit ints in core engine functions.
The problem is that for example, the dot product is taken between vectors that
may be the difference between two arbitrary points in a sector, so even if one
sticks to the "no blue walls" rule, that doesn't guarantee freedom from
overflows.
git-svn-id: https://svn.eduke32.com/eduke32@2761 1a8010ca-5511-0410-912e-c29ae57300e0
This is to not slow down the core drawing functions too much in debugging builds
and mimics the way things are on x86.
git-svn-id: https://svn.eduke32.com/eduke32@2755 1a8010ca-5511-0410-912e-c29ae57300e0
Bang! One more invalid internals exposure squashed. Maybe one day we'll be able
to call EDuke32 "stable"...
Actually the offending sprite IS drawn as face sprite with shade 32 and xrepeat
and yrepeat 255 for the convenience of the CON coder who will have to debug it.
git-svn-id: https://svn.eduke32.com/eduke32@2744 1a8010ca-5511-0410-912e-c29ae57300e0
Those were happening when wall drawing in an upper/lower layer "closed" too
much of the "curtain" (umost/dmost) for subsequent drawing in that portal.
Example: looking down the sewer manhole at the beginning of Retaliation will
now render without HOM.
git-svn-id: https://svn.eduke32.com/eduke32@2739 1a8010ca-5511-0410-912e-c29ae57300e0
New Wii control defaults for the Wii Remote + Nunchuk and the Classic Controller. This includes new code added just so that the Home key brings up the menu in-game, reducing the need for a USB keyboard.
On the technical side, raw joystick access (comparable to what is available for keyboard and mouse) is now present in jmact, on the game side. (added: joystick.[ch])
Using this new raw joystick access, I replaced tueidj's hack to map A and B to LMB/RMB and D-Pad Up/Down to the scrollwheel.
I made the menus more friendly to mouse and joystick browsing by adding and unifying checks and clears for various buttons and gamefuncs. In fact, the majority of the time spent on this commit was tracking down problems that appeared with the factoring and trying to understand the menu system and the way input checks are precariously executed.
In addition, "Press any key or button to continue" now truly means what it says.
As a result of incorporating proper raw access into control.c instead of it directly accessing the implementaiton, the program *may* no longer be affected by joystick input when it is out of focus. This follows the pattern set by the mouse, and I think this is a positive change.
A small bonus: In the classic/old keyboard preset, the key for Show_Console has been changed from '`' to 'C' because '`' is taken by Quick_Kick.
git-svn-id: https://svn.eduke32.com/eduke32@2728 1a8010ca-5511-0410-912e-c29ae57300e0
NAM and Napalm can now share their con, def, and rts files if the one for their respective game is not present because the con and rts files are identical.
Also, decapitalize two string literals missed in r2540.
git-svn-id: https://svn.eduke32.com/eduke32@2726 1a8010ca-5511-0410-912e-c29ae57300e0
This introduces a Makefile variable EDUKE32_MY_DEVELOPER_ID, which is
expected to come from the environment, so that minor disagreements/
preferences can be handled -- don't let it go overboard though! -- to keep
the working directory clean of stuff that one doesn't actually work on.
My ID is 805120924, i.e. "helix".
git-svn-id: https://svn.eduke32.com/eduke32@2718 1a8010ca-5511-0410-912e-c29ae57300e0
Usage is from 3D mode only. When a sector (or wall) is committed to the
clipboard, it (or the wall's sector) is saved, and is subsequently used
when auto-aligning [;-ENTER] another sector's ceiling or floor against the
reference one's. This temp. sector is reset on any structurally modifying
operation except setting first walls; also, aligning extended ceilings or
floors is impossible as they use .*xrepeat internally.
The auto-alignment does not change picnums (this can be accomplished with
the ['+ENTER] combination), but copies the orientation bits 2^{2..6} to the
alignee. Afterwards, if the reference is relative-aligned, it tweaks them,
so that every case where the two firstwalls are either parallel or perpendi-
cular is handled correctly.
It does not yet calculate the panning values.
git-svn-id: https://svn.eduke32.com/eduke32@2715 1a8010ca-5511-0410-912e-c29ae57300e0
This is so that people know where to enable it. One day, all these
debugging switches ought to go into the Makefiles in one form or
another.
git-svn-id: https://svn.eduke32.com/eduke32@2714 1a8010ca-5511-0410-912e-c29ae57300e0
It works perfectly fine without it for me, and including it for no reason
is just an annoyance to other people building from source.
git-svn-id: https://svn.eduke32.com/eduke32@2708 1a8010ca-5511-0410-912e-c29ae57300e0
Defines SPRITES_OF(Statnum, Iter) and SPRITES_OF_SECT(Sectnum, Iter)
[The first is so that STAT_* can be substituted for Iter and it reads nicely.]
Usage should be self-explanatory, but one thing to keep in mind is that
the sprites that are iterated over MUST NOT be deleted.
git-svn-id: https://svn.eduke32.com/eduke32@2707 1a8010ca-5511-0410-912e-c29ae57300e0
vbit was being accessed with an int32 e.g. at address 3200 when only 3203 were
allocated. We simply alloc +1 byte.
git-svn-id: https://svn.eduke32.com/eduke32@2705 1a8010ca-5511-0410-912e-c29ae57300e0
The first means that the expensive (~0.5 ms) SHGetFileInfo() calls won't inter-
fere with smooth gameplay, but files that are opened only at game-time like
sounds won't be checked. The second means that there are now less false
positives, i.e. warnings about files that would be found due to the
check-all-{upper,lower} hack.
git-svn-id: https://svn.eduke32.com/eduke32@2702 1a8010ca-5511-0410-912e-c29ae57300e0
Also, correct the loadboard() return value checks in premap.c to be
aware of a returned -2 ("wrong map version").
git-svn-id: https://svn.eduke32.com/eduke32@2694 1a8010ca-5511-0410-912e-c29ae57300e0
Most of the time, Windows file name lookup is case-insensitive. Reading the
docs (see MSDN's CreateFile help, for example), it seems like case-sensitivity
can be controlled on a per-file basis where applicable (NTFS), but people
should be concerned about matching case in the DEFs/on disk *especially* in
that case.
Also, note that this hack will not always help on systems with case-sensitive
lookup.
git-svn-id: https://svn.eduke32.com/eduke32@2693 1a8010ca-5511-0410-912e-c29ae57300e0
When a file from the local file system is opened, its real file name is gotten
with SHGetFileInfo() and compared against the one that was passed. In the case
they're not identical, a warning is issued.
This is one step towards eliminating mismatched file names in DEFs etc., which
cause trouble on systems that look them up case-sensitively. However, it's not
perfect because the issue is trickier than it appears on first sight.
For one thing, this will only check the last (i.e. file) part in the path,
falsely accepting mismatched directory names. However for these, it reports
them ruthlessly, even for those names where the try-other-case hack (try all
uppercase, all lowercase) would find the correctly-cased file.
git-svn-id: https://svn.eduke32.com/eduke32@2692 1a8010ca-5511-0410-912e-c29ae57300e0
Note: You may encounter a crash if you try to test your map and Mapster32 is running fullscreen.
git-svn-id: https://svn.eduke32.com/eduke32@2684 1a8010ca-5511-0410-912e-c29ae57300e0