- renamed walltype::fdelta and fcenter

This commit is contained in:
Christoph Oelckers 2022-08-30 23:05:03 +02:00
parent 6ce01e24d2
commit 05a7fe8f36
6 changed files with 13 additions and 14 deletions

View file

@ -480,7 +480,7 @@ inline int I_GetBuildTime()
inline int32_t getangle(walltype* wal)
{
return getangle(wal->fdelta());
return getangle(wal->delta());
}
inline TArrayView<walltype> wallsofsector(const sectortype* sec)

View file

@ -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.

View file

@ -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)

View file

@ -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);

View file

@ -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;

View file

@ -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;