From 1d86d7080defdf398ba1b49bcdf17b55ee8babb4 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 8 Aug 2024 00:17:29 -0400 Subject: [PATCH] - beginning levelmeshupdater work --- src/gamedata/r_defs.h | 6 ++++++ src/levelmeshhelper.h | 15 +++++++++++++++ src/playsim/p_map.cpp | 1 + 3 files changed, 22 insertions(+) create mode 100644 src/levelmeshhelper.h diff --git a/src/gamedata/r_defs.h b/src/gamedata/r_defs.h index 54295a12b..babb940a5 100644 --- a/src/gamedata/r_defs.h +++ b/src/gamedata/r_defs.h @@ -30,6 +30,7 @@ #ifndef __R_DEFS_H__ #define __R_DEFS_H__ +#include "levelmeshhelper.h" #include "doomdef.h" #include "m_bbox.h" @@ -978,6 +979,7 @@ public: FTextureID old = planes[pos].Texture; planes[pos].Texture = tex; if (floorclip && pos == floor && tex != old) AdjustFloorClip(); + if (tex != old) LevelMeshUpdater->SectorChanged((void*)this); } double GetPlaneTexZ(int pos) const @@ -987,7 +989,9 @@ public: void SetPlaneTexZQuick(int pos, double val) // For the *FakeFlat functions which do not need to have the overlap checked. { + auto old = planes[pos].TexZ; planes[pos].TexZ = val; + if (val != old) LevelMeshUpdater->SectorChanged((void*)this); } void SetPlaneTexZ(int pos, double val, bool dirtify = false) // This mainly gets used by init code. The only place where it must set the vertex to dirty is the interpolation code. @@ -1289,7 +1293,9 @@ struct side_t } void SetTexture(int which, FTextureID tex) { + auto old = textures[which].texture; textures[which].texture = tex; + if (old != tex) LevelMeshUpdater->SideChanged((void*)this); } void SetTextureXOffset(int which, double offset) diff --git a/src/levelmeshhelper.h b/src/levelmeshhelper.h new file mode 100644 index 000000000..616c4eac0 --- /dev/null +++ b/src/levelmeshhelper.h @@ -0,0 +1,15 @@ +// level mesh helper +// this is a minimal include to keep the other source files a little bit leaner + +struct UpdateLevelMesh +{ + void SectorChanged(void *sector) + { + } + + void SideChanged(void *side) + { + } +}; + +UpdateLevelMesh* LevelMeshUpdater; diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index af8df92a7..2a5cc02a4 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -7058,6 +7058,7 @@ bool P_ChangeSector(sector_t *sector, int crunch, double amt, int floorOrCeil, b } + LevelMeshUpdater->SectorChanged((void*)sector); // update levelmesh return cpos.nofit; }