summaryrefslogtreecommitdiff
path: root/src/shared/iengine.h
diff options
context:
space:
mode:
authorxolatile2025-08-06 22:54:55 +0200
committerxolatile2025-08-06 22:54:55 +0200
commit0a1172b75f571685c264a8b9d8ee224bbf11381f (patch)
treed041fdc68a60f0ebb48a3852bbcce6d9432f83d5 /src/shared/iengine.h
parentaffde05dc07a94643f1fd2751b2b441f57f73d7d (diff)
downloadxolatile-badassbug-0a1172b75f571685c264a8b9d8ee224bbf11381f.tar.xz
xolatile-badassbug-0a1172b75f571685c264a8b9d8ee224bbf11381f.tar.zst
Please do not hate me, it makes sense...
Diffstat (limited to 'src/shared/iengine.h')
-rw-r--r--src/shared/iengine.h79
1 files changed, 22 insertions, 57 deletions
diff --git a/src/shared/iengine.h b/src/shared/iengine.h
index 74a6634..f4e822d 100644
--- a/src/shared/iengine.h
+++ b/src/shared/iengine.h
@@ -7,25 +7,20 @@ extern int totalmillis; // total elapsed time
extern uint totalsecs;
extern int gamespeed, paused;
-enum
-{
+enum {
MATF_INDEX_SHIFT = 0,
MATF_CLIP_SHIFT = 5,
MATF_FLAG_SHIFT = 8,
-
MATF_INDEX = 3 << MATF_INDEX_SHIFT,
MATF_CLIP = 7 << MATF_CLIP_SHIFT,
MATF_FLAGS = 0xFF << MATF_FLAG_SHIFT
};
-enum // cube empty-space materials
-{
+enum { // cube empty-space materials {
MAT_AIR = 0, // the default, fill the empty space with air
-
MAT_NOCLIP = 1 << MATF_CLIP_SHIFT, // collisions always treat cube as empty
MAT_CLIP = 2 << MATF_CLIP_SHIFT, // collisions always treat cube as solid
MAT_GAMECLIP = 3 << MATF_CLIP_SHIFT, // game specific clip material
-
MAT_DEATH = 1 << MATF_FLAG_SHIFT, // force player suicide
MAT_ALPHA = 4 << MATF_FLAG_SHIFT // alpha blended
};
@@ -50,8 +45,7 @@ extern bool settexture(const char *name, int clamp = 0);
enum { EDIT_FACE = 0, EDIT_TEX, EDIT_MAT, EDIT_FLIP, EDIT_COPY, EDIT_PASTE, EDIT_ROTATE, EDIT_REPLACE, EDIT_DELCUBE, EDIT_REMIP, EDIT_VSLOT, EDIT_UNDO, EDIT_REDO };
-struct selinfo
-{
+struct selinfo {
int corner;
int cx, cxs, cy, cys;
ivec o, s;
@@ -60,8 +54,7 @@ struct selinfo
int size() const { return s.x*s.y*s.z; }
int us(int d) const { return s[d]*grid; }
bool operator==(const selinfo &sel) const { return o==sel.o && s==sel.s && grid==sel.grid && orient==sel.orient; }
- bool validate()
- {
+ bool validate() {
extern int worldsize;
if(grid <= 0 || grid >= worldsize) return false;
if(o.x >= worldsize || o.y >= worldsize || o.z >= worldsize) return false;
@@ -176,15 +169,13 @@ static inline void loopiter(ident *id, identstack &stack, const char *s) { tagva
// console
-enum
-{
+enum {
CON_INFO = 1<<0,
CON_WARN = 1<<1,
CON_ERROR = 1<<2,
CON_DEBUG = 1<<3,
CON_INIT = 1<<4,
CON_ECHO = 1<<5,
-
CON_FLAGS = 0xFFFF,
CON_TAG_SHIFT = 16,
CON_TAG_MASK = (0x7FFF << CON_TAG_SHIFT)
@@ -210,14 +201,12 @@ extern int cleargui(int n = 0);
// octa
extern int lookupmaterial(const vec &o);
-static inline bool insideworld(const vec &o)
-{
+static inline bool insideworld(const vec &o) {
extern int worldsize;
return o.x>=0 && o.x<worldsize && o.y>=0 && o.y<worldsize && o.z>=0 && o.z<worldsize;
}
-static inline bool insideworld(const ivec &o)
-{
+static inline bool insideworld(const ivec &o) {
extern int worldsize;
return uint(o.x)<uint(worldsize) && uint(o.y)<uint(worldsize) && uint(o.z)<uint(worldsize);
}
@@ -252,21 +241,18 @@ extern void text_boundsf(const char *str, float &width, float &height, int maxwi
extern int text_visible(const char *str, float hitx, float hity, int maxwidth);
extern void text_posf(const char *str, int cursor, float &cx, float &cy, int maxwidth);
-static inline int text_width(const char *str)
-{
+static inline int text_width(const char *str) {
return int(ceil(text_widthf(str)));
}
-static inline void text_bounds(const char *str, int &width, int &height, int maxwidth = -1)
-{
+static inline void text_bounds(const char *str, int &width, int &height, int maxwidth = -1) {
float widthf, heightf;
text_boundsf(str, widthf, heightf, maxwidth);
width = int(ceil(widthf));
height = int(ceil(heightf));
}
-static inline void text_pos(const char *str, int cursor, int &cx, int &cy, int maxwidth)
-{
+static inline void text_pos(const char *str, int cursor, int &cx, int &cy, int maxwidth) {
float cxf, cyf;
text_posf(str, cursor, cxf, cyf, maxwidth);
cx = int(cxf);
@@ -274,8 +260,7 @@ static inline void text_pos(const char *str, int cursor, int &cx, int &cy, int m
}
// renderva
-enum
-{
+enum {
DL_SHRINK = 1<<0,
DL_EXPAND = 1<<1,
DL_FLASH = 1<<2
@@ -305,16 +290,13 @@ extern void pushhudscale(float sx, float sy = 0);
extern void pushhudtranslate(float tx, float ty, float sx = 0, float sy = 0);
// renderparticles
-enum
-{
+enum {
PART_BLOOD = 0,
PART_WATER,
PART_SMOKE,
PART_STEAM,
PART_FLAME,
- PART_FIREBALL1, PART_FIREBALL2, PART_FIREBALL3,
- PART_STREAK, PART_LIGHTNING,
- PART_EXPLOSION, PART_EXPLOSION_BLUE,
+ PART_STREAK,
PART_SPARK, PART_EDIT,
PART_SNOW,
PART_MUZZLE_FLASH1, PART_MUZZLE_FLASH2, PART_MUZZLE_FLASH3,
@@ -337,12 +319,10 @@ extern void particle_texticon(const vec &s, int ix, int iy, float offset, int ty
extern void particle_icon(const vec &s, int ix, int iy, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
extern void particle_meter(const vec &s, float val, int type, int fade = 1, int color = 0xFFFFFF, int color2 = 0xFFFFF, float size = 2.0f);
extern void particle_flare(const vec &p, const vec &dest, int fade, int type, int color = 0xFFFFFF, float size = 0.28f, physent *owner = NULL);
-extern void particle_fireball(const vec &dest, float max, int type, int fade = -1, int color = 0xFFFFFF, float size = 4.0f);
extern void removetrackedparticles(physent *owner = NULL);
// decal
-enum
-{
+enum {
DECAL_SCORCH = 0,
DECAL_BLOOD,
DECAL_BULLET
@@ -384,8 +364,7 @@ extern bool entinmap(dynent *d, bool avoidplayers = false);
extern void findplayerspawn(dynent *d, int forceent = -1, int tag = 0);
// sound
-enum
-{
+enum {
SND_MAP = 1<<0,
SND_NO_ALT = 1<<1,
SND_USE_ALT = 1<<2
@@ -403,13 +382,11 @@ extern void initsound();
enum { MDL_CULL_VFC = 1<<0, MDL_CULL_DIST = 1<<1, MDL_CULL_OCCLUDED = 1<<2, MDL_CULL_QUERY = 1<<3, MDL_SHADOW = 1<<4, MDL_DYNSHADOW = 1<<5, MDL_LIGHT = 1<<6, MDL_DYNLIGHT = 1<<7, MDL_FULLBRIGHT = 1<<8, MDL_NORENDER = 1<<9, MDL_LIGHT_FAST = 1<<10, MDL_HUD = 1<<11, MDL_GHOST = 1<<12 };
struct model;
-struct modelattach
-{
+struct modelattach {
const char *tag, *name;
int anim, basetime;
vec *pos;
model *m;
-
modelattach() : tag(NULL), name(NULL), anim(-1), basetime(0), pos(NULL), m(NULL) {}
modelattach(const char *tag, const char *name, int anim = -1, int basetime = 0) : tag(tag), name(name), anim(anim), basetime(basetime), pos(NULL), m(NULL) {}
modelattach(const char *tag, vec *pos) : tag(tag), name(NULL), anim(-1), basetime(0), pos(pos), m(NULL) {}
@@ -491,36 +468,28 @@ enum { G3D_DOWN = 1, G3D_UP = 2, G3D_PRESSED = 4, G3D_ROLLOVER = 8, G3D_DRAGGED
enum { EDITORFOCUSED = 1, EDITORUSED, EDITORFOREVER };
-struct g3d_gui
-{
+struct g3d_gui {
virtual ~g3d_gui() {}
-
virtual void start(int starttime, float basescale, int *tab = NULL, bool allowinput = true) = 0;
virtual void end() = 0;
-
virtual int text(const char *text, int color, const char *icon = NULL) = 0;
- int textf(const char *fmt, int color, const char *icon = NULL, ...) PRINTFARGS(2, 5)
- {
+ int textf(const char *fmt, int color, const char *icon = NULL, ...) PRINTFARGS(2, 5) {
defvformatstring(str, icon, fmt);
return text(str, color, icon);
}
virtual int button(const char *text, int color, const char *icon = NULL) = 0;
- int buttonf(const char *fmt, int color, const char *icon = NULL, ...) PRINTFARGS(2, 5)
- {
+ int buttonf(const char *fmt, int color, const char *icon = NULL, ...) PRINTFARGS(2, 5) {
defvformatstring(str, icon, fmt);
return button(str, color, icon);
}
virtual int title(const char *text, int color, const char *icon = NULL) = 0;
- int titlef(const char *fmt, int color, const char *icon = NULL, ...) PRINTFARGS(2, 5)
- {
+ int titlef(const char *fmt, int color, const char *icon = NULL, ...) PRINTFARGS(2, 5) {
defvformatstring(str, icon, fmt);
return title(str, color, icon);
}
virtual void background(int color, int parentw = 0, int parenth = 0) = 0;
-
virtual void pushlist() {}
virtual void poplist() {}
-
virtual bool allowautotab(bool on) = 0;
virtual bool shouldtab() = 0;
virtual void tab(const char *name = NULL, int color = 0) = 0;
@@ -542,17 +511,13 @@ struct g3d_gui
virtual bool mergehits(bool on) = 0;
};
-struct g3d_callback
-{
+struct g3d_callback {
virtual ~g3d_callback() {}
-
int starttime() { return totalmillis; }
-
virtual void gui(g3d_gui &g, bool firstpass) = 0;
};
-enum
-{
+enum {
GUI_2D = 1<<0,
GUI_FOLLOW = 1<<1,
GUI_FORCE_2D = 1<<2,