------------------------------------------------------------------------ r2798 | Plagman | 2012-07-01 20:44:54 -0700 (Sun, 01 Jul 2012) | 1 line Fix MinGW build. ------------------------------------------------------------------------ r2797 | helixhorned | 2012-07-01 15:11:35 -0700 (Sun, 01 Jul 2012) | 8 lines Makefile.common: add a couple of C warning flags. 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 ------------------------------------------------------------------------ r2796 | helixhorned | 2012-07-01 15:11:33 -0700 (Sun, 01 Jul 2012) | 7 lines Constify various char* vars, parameters, etc. for more -Wwrite-strings cleanness -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. ------------------------------------------------------------------------ r2795 | helixhorned | 2012-07-01 15:11:25 -0700 (Sun, 01 Jul 2012) | 1 line editor: const char *scripthist -> char *, since it's alloc'd/freed ------------------------------------------------------------------------ r2794 | helixhorned | 2012-07-01 15:11:22 -0700 (Sun, 01 Jul 2012) | 5 lines actors.c: factor out 4 almost identical code instances into proj_spawn_and_sound 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. ------------------------------------------------------------------------ r2793 | helixhorned | 2012-07-01 15:11:20 -0700 (Sun, 01 Jul 2012) | 1 line Make nsqrtasm return int32_t (instead of uint32_t) when compiled with GCC/x86. ------------------------------------------------------------------------ r2792 | helixhorned | 2012-07-01 15:11:17 -0700 (Sun, 01 Jul 2012) | 1 line Lunatic translator: a first codegen ansatz. ------------------------------------------------------------------------ r2791 | helixhorned | 2012-07-01 15:11:14 -0700 (Sun, 01 Jul 2012) | 12 lines Make ksqrt take uint32_t, add helper function uint32_t uhypsq(int32_t,int32_t). 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). ------------------------------------------------------------------------ r2790 | helixhorned | 2012-07-01 15:11:07 -0700 (Sun, 01 Jul 2012) | 5 lines Lunatic: ksqrt, with timing and value test. 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. ------------------------------------------------------------------------