From fdc5e8760fb7ac0af8e7ebb98a2076db15e31082 Mon Sep 17 00:00:00 2001 From: aura Date: Mon, 16 Mar 2026 10:15:01 +0100 Subject: giga refactor, fix ALL the leaks --- src/game/world/map.h | 75 +++++++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 33 deletions(-) (limited to 'src/game/world/map.h') diff --git a/src/game/world/map.h b/src/game/world/map.h index 2b8a7a5..89c467c 100644 --- a/src/game/world/map.h +++ b/src/game/world/map.h @@ -6,23 +6,21 @@ #include "../../util/fnv.h" #include "../../editor/properties.h" -#include - enum MapPropId_t { MAPPROP_SKYBOX = -1, MAPPROP_CLIPBRUSH = -2, }; struct SURF_PROPS : public EOBJECT { - struct GL_TEX2D* tex; - CLR clr; + EPROP( GL_TEX2D*, tex, {}, "texture" ); + EPROP( CLR, clr, {}, "color" ); }; struct MAP_VERTEX : public EOBJECT { - VEC3 pos; - VEC3 normal; - VEC2 uv; - CLR clr; + EPROP( VEC3, pos, {}, "position" ); + EPROP( VEC3, normal, {}, "normal" ); + EPROP( VEC2, uv, {}, "uv" ); + EPROP( CLR, clr, {}, "color" ); }; enum MapPolygonType_t { @@ -30,23 +28,33 @@ enum MapPolygonType_t { MPT_CEILING }; +struct MAP_PROPREF { + operator I32&() { return id; } + operator I32() const { return id; } + + MAP_PROPREF() {} + MAP_PROPREF( U32 id ) : id( id ) {} + + I32 id; +}; + struct MAP_POLYGON : public EOBJECT { - LIST vertices; + EPROP( LIST, vertices, {}, "vertices" ); VEC3 mins; VEC3 maxs; U8 type; - I32 propid; + EPROP( MAP_PROPREF, propid, {}, "prop id" ); }; struct MAP_WALL : public EOBJECT { - VEC3 start; - VEC3 end; + EPROP( VEC3, start, {}, "start pos" ); + EPROP( VEC3, end, {}, "end pos" ); - VEC2 uvstart; - VEC2 uvend; + EPROP( VEC2, uvstart, {}, "uv start offset" ); + EPROP( VEC2, uvend, {}, "uv end offset" ); - I32 propid; + EPROP( MAP_PROPREF, propid, {}, "prop id" ); }; struct MAP_TEXTURE_ENTRY { @@ -56,40 +64,41 @@ struct MAP_TEXTURE_ENTRY { }; struct MAP_SPRITE : public EOBJECT { - VEC3 pos; - VEC2 size; - CLR clr; - GL_TEX2D* tex; + EPROP( VEC3, pos, {}, "position" ); + EPROP( VEC2, size, {}, "size" ); + EPROP( CLR, clr, {}, "color" ); + EPROP( GL_TEX2D*, tex, {}, "texture" ); }; -struct MAP_ENTITY { - VEC3 pos; - U32 classid; - LIST props; +struct MAP_ENTITY : public EOBJECT { + EPROP( VEC3, pos, {}, "position" ); + EPROP( U32, classid, {}, "entity class" ); + + EPROP( LIST, props, {}, "entity properties" ); }; struct MAP_SKYBOX : public EOBJECT { - SURF_PROPS props; + EPROP( SURF_PROPS, props, {}, "skybox surface properties" ); MAP_WALL walls[4]; MAP_POLYGON polygons[2]; }; struct WORLD_MAP : public EOBJECT { - LIST walls; - LIST polygons; - LIST sprites; - LIST entities; - LIST props; - MAP_SKYBOX skybox; + EPROP( LIST , walls, {}, "walls" ); + EPROP( LIST, polygons, {}, "polygons" ); + EPROP( LIST , sprites, {}, "sprites" ); + EPROP( LIST , entities, {}, "entities" ); + EPROP( LIST , props, {}, "surface properties" ); + EPROP( MAP_SKYBOX, skybox, {}, "skybox" ); F32 w; F32 h; VEC3 mins; VEC3 maxs; - char name[256]; + EPROP( STR, name, {}, "name" ); - VEC3 startpos; - F32 startang; + EPROP( VEC3, startpos, {}, "spawn position" ); + EPROP( F32, startang, {}, "spawn angle" ); struct BSP* bsp{}; -- cgit v1.2.3 From e59a032fb9afac6496acf3fba51a2a329bd0f992 Mon Sep 17 00:00:00 2001 From: aura Date: Mon, 16 Mar 2026 13:35:33 +0100 Subject: more editor work --- src/game/world/map.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/game/world/map.h') diff --git a/src/game/world/map.h b/src/game/world/map.h index 89c467c..8e6444e 100644 --- a/src/game/world/map.h +++ b/src/game/world/map.h @@ -39,22 +39,22 @@ struct MAP_PROPREF { }; struct MAP_POLYGON : public EOBJECT { + EPROP( MAP_PROPREF, propid, {}, "prop id" ); EPROP( LIST, vertices, {}, "vertices" ); VEC3 mins; VEC3 maxs; U8 type; - EPROP( MAP_PROPREF, propid, {}, "prop id" ); }; struct MAP_WALL : public EOBJECT { + EPROP( MAP_PROPREF, propid, {}, "prop id" ); + EPROP( VEC3, start, {}, "start pos" ); EPROP( VEC3, end, {}, "end pos" ); EPROP( VEC2, uvstart, {}, "uv start offset" ); EPROP( VEC2, uvend, {}, "uv end offset" ); - - EPROP( MAP_PROPREF, propid, {}, "prop id" ); }; struct MAP_TEXTURE_ENTRY { @@ -64,10 +64,10 @@ struct MAP_TEXTURE_ENTRY { }; struct MAP_SPRITE : public EOBJECT { + EPROP( GL_TEX2D*, tex, {}, "texture" ); EPROP( VEC3, pos, {}, "position" ); EPROP( VEC2, size, {}, "size" ); EPROP( CLR, clr, {}, "color" ); - EPROP( GL_TEX2D*, tex, {}, "texture" ); }; struct MAP_ENTITY : public EOBJECT { -- cgit v1.2.3 From 991352b0d2767e6bd1a46f554db4ac9d208c13ad Mon Sep 17 00:00:00 2001 From: aura Date: Mon, 16 Mar 2026 15:40:03 +0100 Subject: finish prop rewrite --- src/game/world/map.h | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src/game/world/map.h') diff --git a/src/game/world/map.h b/src/game/world/map.h index 8e6444e..21bfa1f 100644 --- a/src/game/world/map.h +++ b/src/game/world/map.h @@ -17,10 +17,11 @@ struct SURF_PROPS : public EOBJECT { }; struct MAP_VERTEX : public EOBJECT { - EPROP( VEC3, pos, {}, "position" ); - EPROP( VEC3, normal, {}, "normal" ); - EPROP( VEC2, uv, {}, "uv" ); - EPROP( CLR, clr, {}, "color" ); + EPROP( VEC3, pos, {}, "position" ); + EPROP_RANGED_STEP( VEC2, uv, {}, "uv", 0.f, 1.f, 0.025f ); + EPROP( CLR, clr, {}, "color" ); + + EPROP_RO( VEC3, normal, {}, "normal" ); }; enum MapPolygonType_t { @@ -42,8 +43,8 @@ struct MAP_POLYGON : public EOBJECT { EPROP( MAP_PROPREF, propid, {}, "prop id" ); EPROP( LIST, vertices, {}, "vertices" ); - VEC3 mins; - VEC3 maxs; + EPROP_RO( VEC3, mins, {}, "mins" ); + EPROP_RO( VEC3, maxs, {}, "maxs" ); U8 type; }; @@ -53,8 +54,8 @@ struct MAP_WALL : public EOBJECT { EPROP( VEC3, start, {}, "start pos" ); EPROP( VEC3, end, {}, "end pos" ); - EPROP( VEC2, uvstart, {}, "uv start offset" ); - EPROP( VEC2, uvend, {}, "uv end offset" ); + EPROP_RANGED_STEP( VEC2, uvstart, {}, "uv start offset", 0.f, 1.f, 0.025f ); + EPROP_RANGED_STEP( VEC2, uvend, {}, "uv end offset", 0.f, 1.f, 0.025f ); }; struct MAP_TEXTURE_ENTRY { @@ -64,10 +65,10 @@ struct MAP_TEXTURE_ENTRY { }; struct MAP_SPRITE : public EOBJECT { - EPROP( GL_TEX2D*, tex, {}, "texture" ); - EPROP( VEC3, pos, {}, "position" ); - EPROP( VEC2, size, {}, "size" ); - EPROP( CLR, clr, {}, "color" ); + EPROP( GL_TEX2D*, tex, {}, "texture" ); + EPROP( VEC3, pos, {}, "position" ); + EPROP_RANGED( VEC2, size, {}, "size", 0.25f, INFINITY ); + EPROP( CLR, clr, {}, "color" ); }; struct MAP_ENTITY : public EOBJECT { @@ -84,21 +85,22 @@ struct MAP_SKYBOX : public EOBJECT { }; struct WORLD_MAP : public EOBJECT { + EPROP_RO( STR, name, {}, "name" ); + EPROP( VEC3, startpos, {}, "spawn position" ); + EPROP( F32, startang, {}, "spawn angle" ); + EPROP( LIST , walls, {}, "walls" ); EPROP( LIST, polygons, {}, "polygons" ); EPROP( LIST , sprites, {}, "sprites" ); EPROP( LIST , entities, {}, "entities" ); EPROP( LIST , props, {}, "surface properties" ); + EPROP( MAP_SKYBOX, skybox, {}, "skybox" ); F32 w; F32 h; - VEC3 mins; - VEC3 maxs; - EPROP( STR, name, {}, "name" ); - - EPROP( VEC3, startpos, {}, "spawn position" ); - EPROP( F32, startang, {}, "spawn angle" ); + EPROP_RO( VEC3, mins, {}, "mins" ); + EPROP_RO( VEC3, maxs, {}, "maxs" ); struct BSP* bsp{}; -- cgit v1.2.3