2007-09-05 21:56:58 +00:00
|
|
|
// "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
|
2012-03-12 04:47:04 +00:00
|
|
|
// by Jonathon Fowler (jf@jonof.id.au)
|
2018-11-05 07:28:01 +00:00
|
|
|
// by the EDuke32 team (development@voidpoint.com)
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2016-03-14 00:07:44 +00:00
|
|
|
#pragma once
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef build_h_
|
|
|
|
#define build_h_
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2020-05-28 06:31:08 +00:00
|
|
|
#define TRANSPARENT_INDEX 0
|
2020-04-11 22:04:02 +00:00
|
|
|
|
2019-10-16 21:09:02 +00:00
|
|
|
static_assert('\xff' == 255, "Char must be unsigned!");
|
|
|
|
|
2021-05-03 17:16:26 +00:00
|
|
|
#include "printf.h"
|
2016-06-21 00:33:06 +00:00
|
|
|
#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"
|
2019-03-01 08:51:50 +00:00
|
|
|
|
2020-03-29 12:55:09 +00:00
|
|
|
typedef int64_t coord_t;
|
|
|
|
|
2020-10-15 15:02:35 +00:00
|
|
|
enum
|
|
|
|
{
|
2021-12-06 19:54:21 +00:00
|
|
|
MAXWALLSB = 6144,
|
2007-09-05 21:56:58 +00:00
|
|
|
|
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
|
2008-07-22 09:05:34 +00:00
|
|
|
|
2020-10-15 15:02:35 +00:00
|
|
|
TSPR_TEMP = 99,
|
2009-04-29 19:43:51 +00:00
|
|
|
|
2021-07-04 11:05:33 +00:00
|
|
|
CLIPMASK0 = (1 << 16) + 1,
|
|
|
|
CLIPMASK1 = (256 << 16) + 64
|
2020-10-15 15:02:35 +00:00
|
|
|
};
|
2012-05-29 20:01:48 +00:00
|
|
|
|
|
|
|
|
2007-09-05 21:56:58 +00:00
|
|
|
|
2019-04-18 17:24:26 +00:00
|
|
|
#define POINT2(i) (wall[wall[i].point2])
|
|
|
|
|
2011-02-15 21:02:43 +00:00
|
|
|
|
2013-11-22 19:26:52 +00:00
|
|
|
// rotatesprite 'orientation' (actually much more) bits
|
2012-08-19 13:02:37 +00:00
|
|
|
enum {
|
2013-11-22 19:26:52 +00:00
|
|
|
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,
|
|
|
|
|
2020-05-19 22:35:52 +00:00
|
|
|
RS_MODELSUBST= 4096,
|
2012-08-19 13:02:37 +00:00
|
|
|
// ROTATESPRITE_MAX-1 is the mask of all externally available orientation bits
|
2020-05-19 22:35:52 +00:00
|
|
|
ROTATESPRITE_MAX = 8192,
|
2020-08-14 19:01:27 +00:00
|
|
|
RS_XFLIPHUD = RS_YFLIP,
|
|
|
|
RS_YFLIPHUD = 16384, // this is for hud_drawsprite which uses RS_YFLIP for x-flipping but needs both flags
|
2012-08-19 13:02:37 +00:00
|
|
|
|
2020-05-27 21:30:36 +00:00
|
|
|
RS_CENTER = (1<<29), // proper center align.
|
2012-08-19 13:02:37 +00:00
|
|
|
RS_CENTERORIGIN = (1<<30),
|
|
|
|
};
|
2012-08-19 12:57:57 +00:00
|
|
|
|
2021-12-17 19:24:48 +00:00
|
|
|
#include "maptypes.h"
|
2017-01-05 05:29:11 +00:00
|
|
|
#include "clip.h"
|
|
|
|
|
2019-08-27 06:52:42 +00:00
|
|
|
int32_t getwalldist(vec2_t const in, int const wallnum, vec2_t * const out);
|
2019-08-04 02:51:59 +00:00
|
|
|
|
2020-09-13 11:01:44 +00:00
|
|
|
struct usermaphack_t
|
|
|
|
{
|
|
|
|
FString mhkfile;
|
|
|
|
FString title;
|
|
|
|
uint8_t md4[16]{};
|
|
|
|
};
|
2015-01-18 20:31:37 +00:00
|
|
|
|
2015-09-23 17:54:50 +00:00
|
|
|
enum {
|
|
|
|
PALETTE_MAIN = 1<<0,
|
|
|
|
PALETTE_SHADE = 1<<1,
|
|
|
|
PALETTE_TRANSLUC = 1<<2,
|
|
|
|
};
|
|
|
|
|
2019-09-22 19:26:07 +00:00
|
|
|
enum {
|
|
|
|
ENGINECOMPATIBILITY_NONE = 0,
|
|
|
|
ENGINECOMPATIBILITY_19950829, // Powerslave/Exhumed
|
|
|
|
ENGINECOMPATIBILITY_19960925, // Blood v1.21
|
|
|
|
ENGINECOMPATIBILITY_19961112, // Duke 3d v1.5, Redneck Rampage
|
|
|
|
};
|
|
|
|
|
2022-09-25 10:26:37 +00:00
|
|
|
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;
|
2009-07-24 02:31:34 +00:00
|
|
|
|
2015-09-23 17:54:50 +00:00
|
|
|
|
2021-02-25 11:16:21 +00:00
|
|
|
void setVideoMode();
|
2009-01-09 09:29:17 +00:00
|
|
|
|
2020-05-19 22:35:52 +00:00
|
|
|
class F2DDrawer;
|
2020-08-23 12:59:34 +00:00
|
|
|
|
2012-02-04 21:35:00 +00:00
|
|
|
|
2021-12-03 23:38:11 +00:00
|
|
|
struct HitInfoBase;
|
2022-08-20 13:46:52 +00:00
|
|
|
|
2021-03-24 20:43:36 +00:00
|
|
|
inline int32_t krand(void)
|
2014-11-22 12:28:52 +00:00
|
|
|
{
|
2021-10-26 16:48:54 +00:00
|
|
|
randomseed = (randomseed * 27584621) + 1;
|
2020-09-06 06:37:04 +00:00
|
|
|
return ((uint32_t) randomseed)>>16;
|
2014-11-22 12:28:52 +00:00
|
|
|
}
|
|
|
|
|
2022-09-03 15:43:39 +00:00
|
|
|
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-03-14 22:38:39 +00:00
|
|
|
{
|
2021-05-11 23:29:18 +00:00
|
|
|
return int(sqrt(double(num)));
|
2021-03-14 22:38:39 +00:00
|
|
|
}
|
|
|
|
|
2021-03-24 20:43:36 +00:00
|
|
|
inline constexpr uint32_t uhypsq(int32_t const dx, int32_t const dy)
|
2012-07-01 22:11:14 +00:00
|
|
|
{
|
|
|
|
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)
|
2020-02-04 19:40:10 +00:00
|
|
|
extern bool hw_int_useindexedcolortextures;
|
2019-10-23 19:11:37 +00:00
|
|
|
EXTERN_CVAR(Bool, hw_useindexedcolortextures)
|
|
|
|
EXTERN_CVAR(Bool, r_voxels)
|
2015-02-11 05:23:04 +00:00
|
|
|
|
2019-09-22 19:26:07 +00:00
|
|
|
static inline int64_t compat_maybe_truncate_to_int32(int64_t val)
|
2019-07-29 15:43:16 +00:00
|
|
|
{
|
2019-09-22 19:26:07 +00:00
|
|
|
return enginecompatibility_mode != ENGINECOMPATIBILITY_NONE ? (int32_t)val : val;
|
2019-07-29 15:43:16 +00:00
|
|
|
}
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#endif // build_h_
|