From be8d986d89e9ac7408134d9570ec398e535536e8 Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Mon, 29 Oct 2001 06:30:27 +0000 Subject: [PATCH 1/1] moved ixtable definition and initialization code to mathlib (and added Mathlib_Init call to common.c), fixes bugs in dedicated server (previously ixtable was being initialized in the renderer) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@967 d7cf8633-e32d-0410-b094-e92efae38249 --- common.c | 4 ++++ gl_rmain.c | 7 ------- mathlib.c | 12 ++++++++++++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/common.c b/common.c index 22f2885b..4258945e 100644 --- a/common.c +++ b/common.c @@ -1181,6 +1181,8 @@ void COM_Memstats_f(void) } +extern void Mathlib_Init(void); + /* ================ COM_Init @@ -1217,6 +1219,8 @@ void COM_Init (char *basedir) Cmd_AddCommand ("path", COM_Path_f); Cmd_AddCommand ("memstats", COM_Memstats_f); + Mathlib_Init(); + COM_InitFilesystem (); COM_CheckRegistered (); } diff --git a/gl_rmain.c b/gl_rmain.c index 2de875f7..f11072eb 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -58,8 +58,6 @@ mleaf_t *r_viewleaf, *r_oldviewleaf; unsigned short d_lightstylevalue[256]; // 8.8 fraction of base light value -float ixtable[4096]; - void R_MarkLeaves (void); //cvar_t r_norefresh = {0, "r_norefresh","0"}; @@ -267,12 +265,7 @@ void gl_main_newmap(void) void GL_Main_Init(void) { - int a; FOG_registercvars(); - // LordHavoc: setup 1.0f / N table for quick recipricols of integers - ixtable[0] = 0; - for (a = 1;a < 4096;a++) - ixtable[a] = 1.0f / a; Cvar_RegisterVariable (&r_drawentities); Cvar_RegisterVariable (&r_drawviewmodel); Cvar_RegisterVariable (&r_speeds); diff --git a/mathlib.c b/mathlib.c index 371bfa86..7fdda6b3 100644 --- a/mathlib.c +++ b/mathlib.c @@ -26,6 +26,7 @@ void Sys_Error (char *error, ...); vec3_t vec3_origin = {0,0,0}; int nanmask = 255<<23; +float ixtable[4096]; /*-----------------------------------------------------------------*/ @@ -888,3 +889,14 @@ int GreatestCommonDivisor (int i1, int i2) return GreatestCommonDivisor (i1, i2 % i1); } } + + +void Mathlib_Init(void) +{ + int a; + + // LordHavoc: setup 1.0f / N table for quick recipricols of integers + ixtable[0] = 0; + for (a = 1;a < 4096;a++) + ixtable[a] = 1.0f / a; +} \ No newline at end of file -- 2.39.2