mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-01 13:30:50 +00:00
- renamed walltype::fdelta and fcenter
This commit is contained in:
parent
6ce01e24d2
commit
05a7fe8f36
6 changed files with 13 additions and 14 deletions
|
@ -480,7 +480,7 @@ inline int I_GetBuildTime()
|
||||||
|
|
||||||
inline int32_t getangle(walltype* wal)
|
inline int32_t getangle(walltype* wal)
|
||||||
{
|
{
|
||||||
return getangle(wal->fdelta());
|
return getangle(wal->delta());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline TArrayView<walltype> wallsofsector(const sectortype* sec)
|
inline TArrayView<walltype> wallsofsector(const sectortype* sec)
|
||||||
|
|
|
@ -379,6 +379,9 @@ struct walltype
|
||||||
DVector2 pos;
|
DVector2 pos;
|
||||||
|
|
||||||
vec2_t wall_int_pos() const { return vec2_t(pos.X * worldtoint, pos.Y * worldtoint); };
|
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 }; }
|
void setPosFromMap(int x, int y) { pos = { x * maptoworld, y * maptoworld }; }
|
||||||
|
|
||||||
int32_t point2;
|
int32_t point2;
|
||||||
|
@ -425,12 +428,8 @@ struct walltype
|
||||||
walltype* nextWall() const;
|
walltype* nextWall() const;
|
||||||
walltype* lastWall(bool fast = true) const;
|
walltype* lastWall(bool fast = true) const;
|
||||||
walltype* point2Wall() const;
|
walltype* point2Wall() const;
|
||||||
vec2_t int_delta() const { return point2Wall()->wall_int_pos() - wall_int_pos(); }
|
DVector2 delta() const { return point2Wall()->pos - pos; }
|
||||||
DVector2 fdelta() const { return point2Wall()->pos - pos; }
|
DVector2 center() const { return(point2Wall()->pos + pos) / 2; }
|
||||||
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; }
|
|
||||||
bool twoSided() const { return nextsector >= 0; }
|
bool twoSided() const { return nextsector >= 0; }
|
||||||
int Length();
|
int Length();
|
||||||
void calcLength(); // this is deliberately not inlined and stored in a file where it can't be found at compile time.
|
void calcLength(); // this is deliberately not inlined and stored in a file where it can't be found at compile time.
|
||||||
|
|
|
@ -449,25 +449,25 @@ DEFINE_ACTION_FUNCTION_NATIVE(_walltype, point2wall, wall_point2wall)
|
||||||
double wall_deltax(walltype* wal)
|
double wall_deltax(walltype* wal)
|
||||||
{
|
{
|
||||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||||
return wal->deltax();
|
return wal->delta().X;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, deltax, wall_point2wall)
|
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, deltax, wall_point2wall)
|
||||||
{
|
{
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||||
ACTION_RETURN_FLOAT(self->deltax());
|
ACTION_RETURN_FLOAT(self->delta().X);
|
||||||
}
|
}
|
||||||
|
|
||||||
double wall_deltay(walltype* wal)
|
double wall_deltay(walltype* wal)
|
||||||
{
|
{
|
||||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||||
return wal->deltay();
|
return wal->delta().Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, deltay, wall_point2wall)
|
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, deltay, wall_point2wall)
|
||||||
{
|
{
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||||
ACTION_RETURN_FLOAT(self->deltay());
|
ACTION_RETURN_FLOAT(self->delta().Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
double wall_length(walltype* wal)
|
double wall_length(walltype* wal)
|
||||||
|
|
|
@ -2617,7 +2617,7 @@ int actFloorBounceVector(int* x, int* y, int* z, sectortype* pSector, int a5)
|
||||||
}
|
}
|
||||||
|
|
||||||
walltype* pWall = pSector->firstWall();
|
walltype* pWall = pSector->firstWall();
|
||||||
int angle = getangle(pWall->fdelta()) + 512;
|
int angle = getangle(pWall->delta()) + 512;
|
||||||
int t2 = pSector->floorheinum << 4;
|
int t2 = pSector->floorheinum << 4;
|
||||||
int t3 = approxDist(-0x10000, t2);
|
int t3 = approxDist(-0x10000, t2);
|
||||||
int t4 = DivScale(-0x10000, t3, 16);
|
int t4 = DivScale(-0x10000, t3, 16);
|
||||||
|
|
|
@ -889,7 +889,7 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
|
||||||
bomb->spr.xvel = -20;
|
bomb->spr.xvel = -20;
|
||||||
ssp(bomb, CLIPMASK0);
|
ssp(bomb, CLIPMASK0);
|
||||||
bomb->spr.cstat = CSTAT_SPRITE_ALIGNMENT_WALL;
|
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->spr.angle = VecToAngle(-delta.X, -delta.Y) - DAngle90;
|
||||||
bomb->temp_angle = bomb->spr.angle;
|
bomb->temp_angle = bomb->spr.angle;
|
||||||
|
|
||||||
|
|
|
@ -393,7 +393,7 @@ DExhumedActor* BuildWallSprite(sectortype* pSector)
|
||||||
|
|
||||||
auto pActor = insertActor(pSector, 401);
|
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;
|
pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
||||||
|
|
||||||
return pActor;
|
return pActor;
|
||||||
|
|
Loading…
Reference in a new issue