From 0a1172b75f571685c264a8b9d8ee224bbf11381f Mon Sep 17 00:00:00 2001 From: xolatile Date: Wed, 6 Aug 2025 22:54:55 +0200 Subject: Please do not hate me, it makes sense... --- src/shared/iengine.h | 79 +++++++++++++++------------------------------------- 1 file changed, 22 insertions(+), 57 deletions(-) (limited to 'src/shared/iengine.h') 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=0 && o.y=0 && o.z