Skip to content

Commit

Permalink
make sure all texZ functions update the levelmesh
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 authored and dpjudas committed Aug 11, 2024
1 parent 7456c76 commit 8f79753
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/common/rendering/hwrenderer/data/hw_meshbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ struct NullLevelMeshUpdater : UpdateLevelMesh
virtual void FloorTextureChanged(struct sector_t *sector) {};
virtual void CeilingTextureChanged(struct sector_t *sector) {};

virtual void SectorChangedOther(struct sector_t *sector) {};

virtual void SideTextureChanged(struct side_t *side, int section) {};
};

Expand Down
9 changes: 5 additions & 4 deletions src/gamedata/r_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1004,27 +1004,28 @@ struct sector_t

if (val != old)
{
//not sure actually what TexZ does, so changing passing this as "Other"
if(pos)
{
LevelMeshUpdater->FloorHeightChanged(this);
LevelMeshUpdater->SectorChangedOther(this);
}
else
{
LevelMeshUpdater->CeilingHeightChanged(this);
LevelMeshUpdater->SectorChangedOther(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.
{
planes[pos].TexZ = val;
SetPlaneTexZQuick(pos, val);
if (dirtify) SetAllVerticesDirty();
CheckOverlap();
}

void ChangePlaneTexZ(int pos, double val)
{
planes[pos].TexZ += val;
SetPlaneTexZQuick(pos, planes[pos].TexZ + val);
SetAllVerticesDirty();
CheckOverlap();
}
Expand Down
2 changes: 2 additions & 0 deletions src/levelmeshhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ struct UpdateLevelMesh
virtual void FloorTextureChanged(struct sector_t *sector) = 0;
virtual void CeilingTextureChanged(struct sector_t *sector) = 0;

virtual void SectorChangedOther(struct sector_t *sector) = 0;

virtual void SideTextureChanged(struct side_t *side, int section) = 0;
};

Expand Down
13 changes: 0 additions & 13 deletions src/scripting/vmthunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1806,19 +1806,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Secplane, isEqual, isPlaneEqual)
ACTION_RETURN_BOOL(*self == *other);
}

static void ChangeHeight(secplane_t *self, double hdiff)
{
self->ChangeHeight(hdiff);
}

DEFINE_ACTION_FUNCTION_NATIVE(_Secplane, ChangeHeight, ChangeHeight)
{
PARAM_SELF_STRUCT_PROLOGUE(secplane_t);
PARAM_FLOAT(hdiff);
self->ChangeHeight(hdiff);
return 0;
}

static double GetChangedHeight(const secplane_t *self, double hdiff)
{
return self->GetChangedHeight(hdiff);
Expand Down

0 comments on commit 8f79753

Please sign in to comment.