diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..84c048a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/Makefile b/Makefile index 8c9992c..13e9655 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,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/) @@ -58,10 +60,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/player/client.c b/src/player/client.c index 56a71cd..b173d3f 100644 --- a/src/player/client.c +++ b/src/player/client.c @@ -1560,7 +1560,10 @@ void 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))) diff --git a/src/savegame/savegame.c b/src/savegame/savegame.c index 4030126..da63720 100644 --- a/src/savegame/savegame.c +++ b/src/savegame/savegame.c @@ -171,7 +171,7 @@ void InitGame(void) { gi.dprintf("Game is starting up.\n"); - gi.dprintf("Game is %s.\n", GAMEVERSION); + gi.dprintf("Game is %s built on %s.\n", GAMEVERSION, __DATE__); gun_x = gi.cvar ("gun_x", "0", 0); gun_y = gi.cvar ("gun_y", "0", 0);