From 05a7fe8f36cc70b17e72becdd8a90db298e9ff74 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 30 Aug 2022 23:05:03 +0200 Subject: [PATCH] - renamed walltype::fdelta and fcenter --- source/core/gamefuncs.h | 2 +- source/core/maptypes.h | 11 +++++------ source/core/vmexports.cpp | 8 ++++---- source/games/blood/src/actor.cpp | 2 +- source/games/duke/src/player_d.cpp | 2 +- source/games/exhumed/src/object.cpp | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 5edabea06..b34305152 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -480,7 +480,7 @@ inline int I_GetBuildTime() inline int32_t getangle(walltype* wal) { - return getangle(wal->fdelta()); + return getangle(wal->delta()); } inline TArrayView wallsofsector(const sectortype* sec) diff --git a/source/core/maptypes.h b/source/core/maptypes.h index e66a7e71b..72144c97d 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -379,6 +379,9 @@ struct walltype DVector2 pos; vec2_t wall_int_pos() const { return vec2_t(pos.X * worldtoint, pos.Y * worldtoint); }; + vec2_t int_delta() const { return point2Wall()->wall_int_pos() - wall_int_pos(); } + vec2_t int_center() const { return(point2Wall()->wall_int_pos() + wall_int_pos()) / 2; } + void setPosFromMap(int x, int y) { pos = { x * maptoworld, y * maptoworld }; } int32_t point2; @@ -425,12 +428,8 @@ struct walltype walltype* nextWall() const; walltype* lastWall(bool fast = true) const; walltype* point2Wall() const; - vec2_t int_delta() const { return point2Wall()->wall_int_pos() - wall_int_pos(); } - DVector2 fdelta() const { return point2Wall()->pos - pos; } - vec2_t int_center() const { return(point2Wall()->wall_int_pos() + wall_int_pos()) / 2; } - DVector2 fcenter() const { return(point2Wall()->pos + pos) / 2; } - int deltax() const { return point2Wall()->wall_int_pos().X - wall_int_pos().X; } - int deltay() const { return point2Wall()->wall_int_pos().Y - wall_int_pos().Y; } + DVector2 delta() const { return point2Wall()->pos - pos; } + DVector2 center() const { return(point2Wall()->pos + pos) / 2; } bool twoSided() const { return nextsector >= 0; } int Length(); void calcLength(); // this is deliberately not inlined and stored in a file where it can't be found at compile time. diff --git a/source/core/vmexports.cpp b/source/core/vmexports.cpp index f8bea2a45..57b0090b6 100644 --- a/source/core/vmexports.cpp +++ b/source/core/vmexports.cpp @@ -449,25 +449,25 @@ DEFINE_ACTION_FUNCTION_NATIVE(_walltype, point2wall, wall_point2wall) double wall_deltax(walltype* wal) { if (!wal) ThrowAbortException(X_READ_NIL, nullptr); - return wal->deltax(); + return wal->delta().X; } DEFINE_ACTION_FUNCTION_NATIVE(_walltype, deltax, wall_point2wall) { PARAM_SELF_STRUCT_PROLOGUE(walltype); - ACTION_RETURN_FLOAT(self->deltax()); + ACTION_RETURN_FLOAT(self->delta().X); } double wall_deltay(walltype* wal) { if (!wal) ThrowAbortException(X_READ_NIL, nullptr); - return wal->deltay(); + return wal->delta().Y; } DEFINE_ACTION_FUNCTION_NATIVE(_walltype, deltay, wall_point2wall) { PARAM_SELF_STRUCT_PROLOGUE(walltype); - ACTION_RETURN_FLOAT(self->deltay()); + ACTION_RETURN_FLOAT(self->delta().Y); } double wall_length(walltype* wal) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 942076cf0..5f6fa7b43 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2617,7 +2617,7 @@ int actFloorBounceVector(int* x, int* y, int* z, sectortype* pSector, int a5) } walltype* pWall = pSector->firstWall(); - int angle = getangle(pWall->fdelta()) + 512; + int angle = getangle(pWall->delta()) + 512; int t2 = pSector->floorheinum << 4; int t3 = approxDist(-0x10000, t2); int t4 = DivScale(-0x10000, t3, 16); diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index b07f846ee..8deded2de 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -889,7 +889,7 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) bomb->spr.xvel = -20; ssp(bomb, CLIPMASK0); bomb->spr.cstat = CSTAT_SPRITE_ALIGNMENT_WALL; - auto delta = hit.hitWall->fdelta(); + auto delta = hit.hitWall->delta(); bomb->spr.angle = VecToAngle(-delta.X, -delta.Y) - DAngle90; bomb->temp_angle = bomb->spr.angle; diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 8e2f9a0e4..41141b119 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -393,7 +393,7 @@ DExhumedActor* BuildWallSprite(sectortype* pSector) auto pActor = insertActor(pSector, 401); - pActor->spr.pos = DVector3(wal->fcenter(), (pSector->floorz + pSector->ceilingz) * 0.5); + pActor->spr.pos = DVector3(wal->center(), (pSector->floorz + pSector->ceilingz) * 0.5); pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE; return pActor;