diff --git a/Makefile b/Makefile index d554ca68..e71fc79c 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,7 @@ CFLAGS_OPENGL += -DBROKEN_GL -fPIC -Werror # Game CFLAGS_GAME = $(CFLAGS_BASE) -CFLAGS_GAME += -fPIC +CFLAGS_GAME += -fPIC -Werror # ---------- @@ -99,7 +99,7 @@ endif SDLLDFLAGS=$(shell sdl-config --libs) # OpenGL -OPENGLLDFLAGS = -L/usr/lib -L/usr/local/lib -shared +OPENGLLDFLAGS = -shared # Game GAMELDFLAGS = -shared diff --git a/src/game/quake2/g_local.h b/src/game/quake2/g_local.h index c94ec85d..0ca19740 100644 --- a/src/game/quake2/g_local.h +++ b/src/game/quake2/g_local.h @@ -501,10 +501,10 @@ extern int meansOfDeath; extern edict_t *g_edicts; -#define FOFS(x) (int)&(((edict_t *)0)->x) -#define STOFS(x) (int)&(((spawn_temp_t *)0)->x) -#define LLOFS(x) (int)&(((level_locals_t *)0)->x) -#define CLOFS(x) (int)&(((gclient_t *)0)->x) +#define FOFS(x) (size_t)&(((edict_t *)NULL)->x) +#define STOFS(x) (size_t)&(((spawn_temp_t *)NULL)->x) +#define LLOFS(x) (size_t)&(((level_locals_t *)NULL)->x) +#define CLOFS(x) (size_t)&(((gclient_t *)NULL)->x) #define random() ((rand () & 0x7fff) / ((float)0x7fff)) #define crandom() (2.0 * (random() - 0.5)) diff --git a/src/game/quake2/q_shared.c b/src/game/quake2/q_shared.c index 4d793958..86bfde33 100644 --- a/src/game/quake2/q_shared.c +++ b/src/game/quake2/q_shared.c @@ -374,6 +374,12 @@ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p) return sides; } +void ClearBounds (vec3_t mins, vec3_t maxs) + { + mins[0] = mins[1] = mins[2] = 99999; + maxs[0] = maxs[1] = maxs[2] = -99999; + } + void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs) { int i; @@ -437,6 +443,13 @@ vec_t VectorNormalize2 (vec3_t v, vec3_t out) } +void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc) +{ + vecc[0] = veca[0] + scale*vecb[0]; + vecc[1] = veca[1] + scale*vecb[1]; + vecc[2] = veca[2] + scale*vecb[2]; +} + vec_t _DotProduct (vec3_t v1, vec3_t v2) { return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; @@ -463,6 +476,13 @@ void _VectorCopy (vec3_t in, vec3_t out) out[2] = in[2]; } +void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross) +{ + cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; + cross[1] = v1[2]*v2[0] - v1[0]*v2[2]; + cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; +} + double sqrt(double x); vec_t VectorLength(vec3_t v) @@ -478,6 +498,13 @@ vec_t VectorLength(vec3_t v) return length; } +void VectorInverse (vec3_t v) +{ + v[0] = -v[0]; + v[1] = -v[1]; + v[2] = -v[2]; +} + void VectorScale (vec3_t in, vec_t scale, vec3_t out) { out[0] = in[0]*scale; @@ -485,7 +512,6 @@ void VectorScale (vec3_t in, vec_t scale, vec3_t out) out[2] = in[2]*scale; } - int Q_log2(int val) { int answer=0; @@ -768,7 +794,7 @@ COM_Parse Parse a token out of a string ============== */ -const char *COM_Parse (char **data_p) +char *COM_Parse (char **data_p) { int c; int len; diff --git a/src/game/quake2/q_shared.h b/src/game/quake2/q_shared.h index 595ffecc..4b1518f6 100644 --- a/src/game/quake2/q_shared.h +++ b/src/game/quake2/q_shared.h @@ -188,7 +188,7 @@ void COM_FileBase (char *in, char *out); void COM_FilePath (const char *in, char *out); void COM_DefaultExtension (char *path, const char *extension); -const char *COM_Parse (char **data_p); +char *COM_Parse (char **data_p); // data is an in/out parm, returns a parsed out token void Com_sprintf (char *dest, int size, char *fmt, ...);