This was introduced with r2771, which fixed e.g. AMC TC city_si's mirrors,
but instructed the base drawrooms inside yax_drawrooms to not correct the
passed sectnum. Therefore, stuff would get drawn wrongly when passing
sector boundaries, like from the platform to the rails in trueror1.map.
git-svn-id: https://svn.eduke32.com/eduke32@2810 1a8010ca-5511-0410-912e-c29ae57300e0
The latter is commented out, since it has to be *compiled* with
script_expertmode enabled.
git-svn-id: https://svn.eduke32.com/eduke32@2808 1a8010ca-5511-0410-912e-c29ae57300e0
Related to that, it looks like out-of-bounds accesses when drawing such walls/
maskwalls or *sprites* are fixed, too. Sprites still show a stray lines on some
occasions, but Valgrind doesn't complain then.
git-svn-id: https://svn.eduke32.com/eduke32@2805 1a8010ca-5511-0410-912e-c29ae57300e0
Most notably, -Wdeclaration-after-statement. This and -Wpointer-arith
give some warning on linux, but this is "harmless" as it's assumed that
we'll be always compiling with GCC or Clang there.
Also, erratum in the "Make ksqrt take uint32_t ..." commit:
hypotenuse -> squared length of the hypotenuse
git-svn-id: https://svn.eduke32.com/eduke32@2797 1a8010ca-5511-0410-912e-c29ae57300e0
-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
Most differences are handled with function parameters, except that one instance
checked SpriteProjectile[i].spawns for being >0 instead of >=0. The factored
function always checks for >=0.
git-svn-id: https://svn.eduke32.com/eduke32@2794 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
The latter shows that "int32_t ksqrt(int32_t)" also copes with values in the
range INT32_MIN..-1, effectively interpreting them as uint32_t (i.e. adding
2**32). However, this should not be relied on from CON.
git-svn-id: https://svn.eduke32.com/eduke32@2790 1a8010ca-5511-0410-912e-c29ae57300e0
The bug was introduced with SAMESIZE_ACTOR_T enabling in r2208.
This fixes being unable to read the messages in A.Dream* by zykov eddy.
git-svn-id: https://svn.eduke32.com/eduke32@2788 1a8010ca-5511-0410-912e-c29ae57300e0
Arrays inside structs must not be accessible, since they're not bound-checked
by the FFI. Therefore, we flatten them into repeated scalar fields and need
to write accessor functions later.
git-svn-id: https://svn.eduke32.com/eduke32@2786 1a8010ca-5511-0410-912e-c29ae57300e0
This fixes an integer overflow when a distance is calculated later.
git-svn-id: https://svn.eduke32.com/eduke32@2785 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
- hitscan & related types and constants
- profiling with gethitickms
- translator: eval the opening parts of block commands early
- fix getbunch
git-svn-id: https://svn.eduke32.com/eduke32@2779 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
This is to the cvar of the same name as samples/aspect.map is to r_usenewaspect.
git-svn-id: https://svn.eduke32.com/eduke32@2769 1a8010ca-5511-0410-912e-c29ae57300e0
This exposes some problems in the default/in-the-wild CONs. As usual,
we'll have to retrofit sensible semantics :rolleyes:.
git-svn-id: https://svn.eduke32.com/eduke32@2765 1a8010ca-5511-0410-912e-c29ae57300e0
The latter is only for development, since the embedded version already has a
undeclared-var-reference handling similar to that. Also fix parm2memberpat.
git-svn-id: https://svn.eduke32.com/eduke32@2762 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