- build.h cleanup

* moved krand and krandf into the games/duke folder because no other game uses them
* moved CVARS to gamefuncs.h.
This commit is contained in:
Christoph Oelckers 2022-09-30 19:06:44 +02:00
parent 679e029c6d
commit 94b91f6ec3
7 changed files with 25 additions and 20 deletions

View file

@ -108,17 +108,6 @@ class F2DDrawer;
struct HitInfoBase; struct HitInfoBase;
inline int32_t krand(void)
{
randomseed = (randomseed * 27584621) + 1;
return ((uint32_t) randomseed)>>16;
}
inline double krandf(double span)
{
return (krand() & 0x7fff) * span / 32767;
}
inline int32_t ksqrt(uint64_t num) inline int32_t ksqrt(uint64_t num)
{ {
return int(sqrt(double(num))); return int(sqrt(double(num)));
@ -129,14 +118,6 @@ inline constexpr uint32_t uhypsq(int32_t const dx, int32_t const dy)
return (uint32_t)dx*dx + (uint32_t)dy*dy; return (uint32_t)dx*dx + (uint32_t)dy*dy;
} }
EXTERN_CVAR(Bool, hw_hightile)
EXTERN_CVAR(Bool, hw_models)
EXTERN_CVAR(Float, gl_texture_filter_anisotropic)
EXTERN_CVAR(Int, gl_texture_filter)
extern bool hw_int_useindexedcolortextures;
EXTERN_CVAR(Bool, hw_useindexedcolortextures)
EXTERN_CVAR(Bool, r_voxels)
static inline int64_t compat_maybe_truncate_to_int32(int64_t val) static inline int64_t compat_maybe_truncate_to_int32(int64_t val)
{ {
return enginecompatibility_mode != ENGINECOMPATIBILITY_NONE ? (int32_t)val : val; return enginecompatibility_mode != ENGINECOMPATIBILITY_NONE ? (int32_t)val : val;

View file

@ -6,9 +6,19 @@
#include "coreactor.h" #include "coreactor.h"
#include "intrect.h" #include "intrect.h"
#include "geometry.h" #include "geometry.h"
#include "c_cvars.h"
extern IntRect viewport3d; extern IntRect viewport3d;
EXTERN_CVAR(Bool, hw_hightile)
EXTERN_CVAR(Bool, hw_models)
EXTERN_CVAR(Float, gl_texture_filter_anisotropic)
EXTERN_CVAR(Int, gl_texture_filter)
extern bool hw_int_useindexedcolortextures;
EXTERN_CVAR(Bool, hw_useindexedcolortextures)
EXTERN_CVAR(Bool, r_voxels)
constexpr int SLOPEVAL_FACTOR = 4096; constexpr int SLOPEVAL_FACTOR = 4096;
//========================================================================== //==========================================================================

View file

@ -3,6 +3,7 @@
#include "modeldata.h" #include "modeldata.h"
#include "texturemanager.h" #include "texturemanager.h"
#include "hw_voxels.h" #include "hw_voxels.h"
#include "gamefuncs.h"
#include "build.h" #include "build.h"

View file

@ -44,6 +44,7 @@
#include "hw_voxels.h" #include "hw_voxels.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "models/modeldata.h" #include "models/modeldata.h"
#include "gamefuncs.h"
BEGIN_BLD_NS BEGIN_BLD_NS
extern short voxelIndex[MAXTILES]; extern short voxelIndex[MAXTILES];

View file

@ -8,7 +8,7 @@
#include "v_video.h" #include "v_video.h"
#include "hw_drawlist.h" #include "hw_drawlist.h"
#include "hw_bunchdrawer.h" #include "hw_bunchdrawer.h"
//#include "r_viewpoint.h" #include "gamefuncs.h"
EXTERN_CVAR(Int, hw_lightmode) EXTERN_CVAR(Int, hw_lightmode)

View file

@ -49,6 +49,7 @@
#include "gamestruct.h" #include "gamestruct.h"
#include "hw_renderstate.h" #include "hw_renderstate.h"
#include "skyboxtexture.h" #include "skyboxtexture.h"
#include "gamefuncs.h"
CVARD(Bool, hw_shadeinterpolate, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable shade interpolation") CVARD(Bool, hw_shadeinterpolate, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable shade interpolation")

View file

@ -241,6 +241,17 @@ void loadcons();
void recordoldspritepos(); void recordoldspritepos();
void DrawStatusBar(); void DrawStatusBar();
inline int32_t krand(void)
{
randomseed = (randomseed * 27584621) + 1;
return ((uint32_t)randomseed) >> 16;
}
inline double krandf(double span)
{
return (krand() & 0x7fff) * span / 32767;
}
[[deprecated]] [[deprecated]]
inline double zrand(int spread, int ofs) inline double zrand(int spread, int ofs)
{ {