diff --git a/Makefile b/Makefile index ace2647..b901c1f 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,8 @@ endif ifeq ($(OSTYPE), Windows) # At this time only i386 is supported on Windows ARCH := i386 +# seems like mingw doesn't set CC by default +CC := gcc else # Some platforms call it "amd64" and some "x86_64" ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/amd64/x86_64/) @@ -66,10 +68,10 @@ endif # -MMD to generate header dependencies. ifeq ($(OSTYPE), Darwin) CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \ - -Wall -pipe -g -arch i386 -arch x86_64 + -Wall -pipe -g -fwrapv -arch i386 -arch x86_64 else CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \ - -Wall -pipe -g -MMD + -Wall -pipe -g -MMD -fwrapv endif # ---------- diff --git a/src/g_save.c b/src/g_save.c index aeeb86c..b2f4bd6 100644 --- a/src/g_save.c +++ b/src/g_save.c @@ -141,7 +141,7 @@ void InitGame(void) { gi.dprintf("Game is starting up.\n"); - gi.dprintf("Game is ctf.\n"); + gi.dprintf("Game is ctf built on %s.\n", GAMEVERSION, __DATE__); gun_x = gi.cvar("gun_x", "0", 0); gun_y = gi.cvar("gun_y", "0", 0); diff --git a/src/player/client.c b/src/player/client.c index f972f80..c80f280 100644 --- a/src/player/client.c +++ b/src/player/client.c @@ -1620,7 +1620,10 @@ ClientThink(edict_t *ent, usercmd_t *ucmd) for (i = 0; i < 3; i++) { pm.s.origin[i] = ent->s.origin[i] * 8; - pm.s.velocity[i] = ent->velocity[i] * 8; + /* save to an int first, in case the short overflows + * so we get defined behavior (at least with -fwrapv) */ + int tmpVel = ent->velocity[i] * 8; + pm.s.velocity[i] = tmpVel; } if (memcmp(&client->old_pmove, &pm.s, sizeof(pm.s)))