raze/source/build/include/build.h

146 lines
3.2 KiB
C
Raw Normal View History

// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info.
//
// This file has been modified from Ken Silverman's original release
// by Jonathon Fowler (jf@jonof.id.au)
// by the EDuke32 team (development@voidpoint.com)
#pragma once
#ifndef build_h_
#define build_h_
2020-05-28 06:31:08 +00:00
#define TRANSPARENT_INDEX 0
2020-04-11 22:04:02 +00:00
static_assert('\xff' == 255, "Char must be unsigned!");
#include "printf.h"
#include "palette.h"
2020-05-24 05:58:56 +00:00
#include "buildtiles.h"
2019-10-23 19:11:37 +00:00
#include "c_cvars.h"
2020-04-11 21:39:40 +00:00
#include "cmdlib.h"
typedef int64_t coord_t;
2020-10-15 15:02:35 +00:00
enum
{
MAXWALLSB = 6144,
2020-10-15 15:02:35 +00:00
// Maximum number of component tiles in a multi-psky:
MAXUNIQHUDID = 256, //Extra slots so HUD models can store animation state without messing game sprites
2020-10-15 15:02:35 +00:00
TSPR_TEMP = 99,
CLIPMASK0 = (1 << 16) + 1,
CLIPMASK1 = (256 << 16) + 64
2020-10-15 15:02:35 +00:00
};
#define POINT2(i) (wall[wall[i].point2])
// rotatesprite 'orientation' (actually much more) bits
enum {
RS_TRANS1 = 1,
RS_AUTO = 2,
RS_YFLIP = 4,
RS_NOCLIP = 8,
RS_TOPLEFT = 16,
RS_TRANS2 = 32,
RS_NOMASK = 64,
RS_PERM = 128,
RS_ALIGN_L = 256,
RS_ALIGN_R = 512,
RS_ALIGN_MASK = 768,
RS_STRETCH = 1024,
RS_MODELSUBST= 4096,
// ROTATESPRITE_MAX-1 is the mask of all externally available orientation bits
ROTATESPRITE_MAX = 8192,
RS_XFLIPHUD = RS_YFLIP,
RS_YFLIPHUD = 16384, // this is for hud_drawsprite which uses RS_YFLIP for x-flipping but needs both flags
RS_CENTER = (1<<29), // proper center align.
RS_CENTERORIGIN = (1<<30),
};
#include "maptypes.h"
#include "clip.h"
int32_t getwalldist(vec2_t const in, int const wallnum, vec2_t * const out);
struct usermaphack_t
{
FString mhkfile;
FString title;
uint8_t md4[16]{};
};
enum {
PALETTE_MAIN = 1<<0,
PALETTE_SHADE = 1<<1,
PALETTE_TRANSLUC = 1<<2,
};
enum {
ENGINECOMPATIBILITY_NONE = 0,
ENGINECOMPATIBILITY_19950829, // Powerslave/Exhumed
ENGINECOMPATIBILITY_19960925, // Blood v1.21
ENGINECOMPATIBILITY_19961112, // Duke 3d v1.5, Redneck Rampage
};
inline int leveltimer;
inline int32_t Numsprites;
inline int32_t display_mirror;
inline int32_t randomseed;
inline uint8_t paletteloaded;
inline int32_t g_visibility = 512, g_relvisibility = 0;
inline int32_t enginecompatibility_mode;
2021-02-25 11:16:21 +00:00
void setVideoMode();
class F2DDrawer;
2020-08-23 12:59:34 +00:00
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;
}
2021-05-11 23:29:18 +00:00
inline int32_t ksqrt(uint64_t num)
{
2021-05-11 23:29:18 +00:00
return int(sqrt(double(num)));
}
inline constexpr uint32_t uhypsq(int32_t const dx, int32_t const dy)
{
return (uint32_t)dx*dx + (uint32_t)dy*dy;
}
2019-10-23 19:11:37 +00:00
EXTERN_CVAR(Bool, hw_hightile)
EXTERN_CVAR(Bool, hw_models)
2020-05-28 21:48:50 +00:00
EXTERN_CVAR(Float, gl_texture_filter_anisotropic)
EXTERN_CVAR(Int, gl_texture_filter)
extern bool hw_int_useindexedcolortextures;
2019-10-23 19:11:37 +00:00
EXTERN_CVAR(Bool, hw_useindexedcolortextures)
EXTERN_CVAR(Bool, r_voxels)
static inline int64_t compat_maybe_truncate_to_int32(int64_t val)
{
return enginecompatibility_mode != ENGINECOMPATIBILITY_NONE ? (int32_t)val : val;
}
#endif // build_h_