mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- replace all ‚labs‘ with ‚abs‘
This commit is contained in:
parent
4acce612cd
commit
fca2f8c683
12 changed files with 27 additions and 27 deletions
|
@ -870,7 +870,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
|
||||||
|
|
||||||
case SE_9_DOWN_OPEN_DOOR_LIGHTS:
|
case SE_9_DOWN_OPEN_DOOR_LIGHTS:
|
||||||
if (sectp->lotag &&
|
if (sectp->lotag &&
|
||||||
labs(sectp->int_ceilingz() - actor->int_pos().Z) > 1024)
|
abs(sectp->ceilingz - actor->spr.pos.Z) > 4)
|
||||||
sectp->lotag |= 32768; //If its open
|
sectp->lotag |= 32768; //If its open
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case SE_8_UP_OPEN_DOOR_LIGHTS:
|
case SE_8_UP_OPEN_DOOR_LIGHTS:
|
||||||
|
|
|
@ -488,7 +488,7 @@ void DoStarView(tspritetype* tsp, DSWActor* tActor, int viewz)
|
||||||
extern STATE s_StarStuck[], s_StarDownStuck[];
|
extern STATE s_StarStuck[], s_StarDownStuck[];
|
||||||
int zdiff = viewz - tsp->int_pos().Z;
|
int zdiff = viewz - tsp->int_pos().Z;
|
||||||
|
|
||||||
if (labs(zdiff) > Z(24))
|
if (abs(zdiff) > Z(24))
|
||||||
{
|
{
|
||||||
if (tActor->user.StateStart == s_StarStuck)
|
if (tActor->user.StateStart == s_StarStuck)
|
||||||
tsp->picnum = s_StarDownStuck[tActor->user.State - s_StarStuck].Pic;
|
tsp->picnum = s_StarDownStuck[tActor->user.State - s_StarStuck].Pic;
|
||||||
|
@ -1127,9 +1127,9 @@ void CameraView(PLAYER* pp, int *tx, int *ty, int *tz, sectortype** tsect, DAngl
|
||||||
yvect = int(ang.Sin() * 2048.);
|
yvect = int(ang.Sin() * 2048.);
|
||||||
|
|
||||||
zdiff = actor->int_pos().Z - *tz;
|
zdiff = actor->int_pos().Z - *tz;
|
||||||
if (labs(actor->int_pos().X - *tx) > 1000)
|
if (abs(actor->int_pos().X - *tx) > 1000)
|
||||||
zvect = Scale(xvect, zdiff, actor->int_pos().X - *tx);
|
zvect = Scale(xvect, zdiff, actor->int_pos().X - *tx);
|
||||||
else if (labs(actor->int_pos().Y - *ty) > 1000)
|
else if (abs(actor->int_pos().Y - *ty) > 1000)
|
||||||
zvect = Scale(yvect, zdiff, actor->int_pos().Y - *ty);
|
zvect = Scale(yvect, zdiff, actor->int_pos().Y - *ty);
|
||||||
else if (actor->int_pos().X - *tx != 0)
|
else if (actor->int_pos().X - *tx != 0)
|
||||||
zvect = Scale(xvect, zdiff, actor->int_pos().X - *tx);
|
zvect = Scale(xvect, zdiff, actor->int_pos().X - *tx);
|
||||||
|
|
|
@ -186,7 +186,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
|
||||||
|
|
||||||
if ((pp->Flags2 & PF2_INPUT_CAN_TURN_VEHICLE))
|
if ((pp->Flags2 & PF2_INPUT_CAN_TURN_VEHICLE))
|
||||||
{
|
{
|
||||||
DoPlayerTurnVehicle(pp, input.avel, pp->int_ppos().Z + Z(10), labs(pp->int_ppos().Z + Z(10) - pp->sop->floor_loz));
|
DoPlayerTurnVehicle(pp, input.avel, pp->int_ppos().Z + Z(10), abs(pp->int_ppos().Z + Z(10) - pp->sop->floor_loz));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pp->Flags2 & PF2_INPUT_CAN_TURN_TURRET))
|
if ((pp->Flags2 & PF2_INPUT_CAN_TURN_TURRET))
|
||||||
|
|
|
@ -254,7 +254,7 @@ void PlayerUpdateHealth(PLAYER* pp, short value)
|
||||||
if (pp->Armor && !NoArmor)
|
if (pp->Armor && !NoArmor)
|
||||||
{
|
{
|
||||||
int armor_damage, player_damage;
|
int armor_damage, player_damage;
|
||||||
ArmorCalc(labs(value), &armor_damage, &player_damage);
|
ArmorCalc(abs(value), &armor_damage, &player_damage);
|
||||||
PlayerUpdateArmor(pp, -armor_damage);
|
PlayerUpdateArmor(pp, -armor_damage);
|
||||||
value = -player_damage;
|
value = -player_damage;
|
||||||
}
|
}
|
||||||
|
@ -6317,7 +6317,7 @@ void pWeaponBob(PANEL_SPRITE* psp, short condition)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (labs((psp->sin_ndx & 1023) - 0) < 70)
|
if (abs((psp->sin_ndx & 1023) - 0) < 70)
|
||||||
{
|
{
|
||||||
psp->flags &= ~(PANF_BOB);
|
psp->flags &= ~(PANF_BOB);
|
||||||
psp->sin_ndx = (RANDOM_P2(1024) < 512) ? 1024 : 0;
|
psp->sin_ndx = (RANDOM_P2(1024) < 512) ? 1024 : 0;
|
||||||
|
|
|
@ -1175,7 +1175,7 @@ DSWActor* DoPickTarget(DSWActor* actor, uint32_t max_delta_ang, int skip_targets
|
||||||
angle2 = NORM_ANGLE(getangle(itActor->int_pos().X - actor->int_pos().X, itActor->int_pos().Y - actor->int_pos().Y));
|
angle2 = NORM_ANGLE(getangle(itActor->int_pos().X - actor->int_pos().X, itActor->int_pos().Y - actor->int_pos().Y));
|
||||||
|
|
||||||
// Get the angle difference
|
// Get the angle difference
|
||||||
// delta_ang = labs(pp->angle.ang.Buildang() - angle2);
|
// delta_ang = abs(pp->angle.ang.Buildang() - angle2);
|
||||||
|
|
||||||
delta_ang = short(abs(getincangle(angle2, actor->int_ang())));
|
delta_ang = short(abs(getincangle(angle2, actor->int_ang())));
|
||||||
|
|
||||||
|
@ -1855,7 +1855,7 @@ void DoPlayerSlide(PLAYER* pp)
|
||||||
pp->slide_vect.X = MulScale(pp->slide_vect.X, PLAYER_SLIDE_FRICTION, 16);
|
pp->slide_vect.X = MulScale(pp->slide_vect.X, PLAYER_SLIDE_FRICTION, 16);
|
||||||
pp->slide_vect.Y = MulScale(pp->slide_vect.Y, PLAYER_SLIDE_FRICTION, 16);
|
pp->slide_vect.Y = MulScale(pp->slide_vect.Y, PLAYER_SLIDE_FRICTION, 16);
|
||||||
|
|
||||||
if (labs(pp->slide_vect.X) < 12800 && labs(pp->slide_vect.Y) < 12800)
|
if (abs(pp->slide_vect.X) < 12800 && abs(pp->slide_vect.Y) < 12800)
|
||||||
pp->slide_vect.X = pp->slide_vect.Y = 0;
|
pp->slide_vect.X = pp->slide_vect.Y = 0;
|
||||||
|
|
||||||
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
|
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
|
||||||
|
@ -1988,7 +1988,7 @@ void DoPlayerMove(PLAYER* pp)
|
||||||
pp->vect.Y = (pp->vect.Y + (pp->ovect.Y*2))/3;
|
pp->vect.Y = (pp->vect.Y + (pp->ovect.Y*2))/3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labs(pp->vect.X) < 12800 && labs(pp->vect.Y) < 12800)
|
if (abs(pp->vect.X) < 12800 && abs(pp->vect.Y) < 12800)
|
||||||
pp->vect.X = pp->vect.Y = 0;
|
pp->vect.X = pp->vect.Y = 0;
|
||||||
|
|
||||||
actor->set_int_xvel(FindDistance2D(pp->vect.X,pp->vect.Y)>>14);
|
actor->set_int_xvel(FindDistance2D(pp->vect.X,pp->vect.Y)>>14);
|
||||||
|
@ -2468,9 +2468,9 @@ void DoPlayerMoveVehicle(PLAYER* pp)
|
||||||
|
|
||||||
if (!Prediction)
|
if (!Prediction)
|
||||||
{
|
{
|
||||||
if (labs(pp->input.fvel|pp->input.svel) && !labs(pp->lastinput.fvel| pp->lastinput.svel))
|
if (abs(pp->input.fvel|pp->input.svel) && !abs(pp->lastinput.fvel| pp->lastinput.svel))
|
||||||
PlaySOsound(pp->sop->mid_sector,SO_DRIVE_SOUND);
|
PlaySOsound(pp->sop->mid_sector,SO_DRIVE_SOUND);
|
||||||
else if (!labs(pp->input.fvel|pp->input.svel) && labs(pp->lastinput.fvel| pp->lastinput.svel))
|
else if (!abs(pp->input.fvel|pp->input.svel) && abs(pp->lastinput.fvel| pp->lastinput.svel))
|
||||||
PlaySOsound(pp->sop->mid_sector,SO_IDLE_SOUND);
|
PlaySOsound(pp->sop->mid_sector,SO_IDLE_SOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2506,7 +2506,7 @@ void DoPlayerMoveVehicle(PLAYER* pp)
|
||||||
pp->vect.Y = (pp->vect.Y + (pp->ovect.Y*1))/2;
|
pp->vect.Y = (pp->vect.Y + (pp->ovect.Y*1))/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (labs(pp->vect.X) < 12800 && labs(pp->vect.Y) < 12800)
|
if (abs(pp->vect.X) < 12800 && abs(pp->vect.Y) < 12800)
|
||||||
pp->vect.X = pp->vect.Y = 0;
|
pp->vect.X = pp->vect.Y = 0;
|
||||||
|
|
||||||
pp->lastcursector = pp->cursector;
|
pp->lastcursector = pp->cursector;
|
||||||
|
@ -2540,7 +2540,7 @@ void DoPlayerMoveVehicle(PLAYER* pp)
|
||||||
OperateSectorObject(pp->sop, pp->angle.ang.Buildang(), { MAXSO, MAXSO });
|
OperateSectorObject(pp->sop, pp->angle.ang.Buildang(), { MAXSO, MAXSO });
|
||||||
pp->setcursector(pp->sop->op_main_sector); // for speed
|
pp->setcursector(pp->sop->op_main_sector); // for speed
|
||||||
|
|
||||||
floor_dist = labs(z - pp->sop->floor_loz);
|
floor_dist = abs(z - pp->sop->floor_loz);
|
||||||
|
|
||||||
|
|
||||||
if (RectClip)
|
if (RectClip)
|
||||||
|
@ -3099,7 +3099,7 @@ void DoPlayerClimb(PLAYER* pp)
|
||||||
pp->vect.Y += ((pp->input.svel*synctics*2)<<6);
|
pp->vect.Y += ((pp->input.svel*synctics*2)<<6);
|
||||||
pp->vect.X = MulScale(pp->vect.X, PLAYER_CLIMB_FRICTION, 16);
|
pp->vect.X = MulScale(pp->vect.X, PLAYER_CLIMB_FRICTION, 16);
|
||||||
pp->vect.Y = MulScale(pp->vect.Y, PLAYER_CLIMB_FRICTION, 16);
|
pp->vect.Y = MulScale(pp->vect.Y, PLAYER_CLIMB_FRICTION, 16);
|
||||||
if (labs(pp->vect.X) < 12800 && labs(pp->vect.Y) < 12800)
|
if (abs(pp->vect.X) < 12800 && abs(pp->vect.Y) < 12800)
|
||||||
pp->vect.X = pp->vect.Y = 0;
|
pp->vect.X = pp->vect.Y = 0;
|
||||||
|
|
||||||
climbvel = FindDistance2D(pp->vect.X, pp->vect.Y)>>9;
|
climbvel = FindDistance2D(pp->vect.X, pp->vect.Y)>>9;
|
||||||
|
@ -3333,7 +3333,7 @@ int DoPlayerWadeSuperJump(PLAYER* pp)
|
||||||
{
|
{
|
||||||
hit.hitSector = hit.hitWall->nextSector();
|
hit.hitSector = hit.hitWall->nextSector();
|
||||||
|
|
||||||
if (hit.hitSector != nullptr && labs(hit.hitSector->int_floorz() - pp->int_ppos().Z) < Z(50))
|
if (hit.hitSector != nullptr && abs(hit.hitSector->int_floorz() - pp->int_ppos().Z) < Z(50))
|
||||||
{
|
{
|
||||||
if (Distance(pp->int_ppos().X, pp->int_ppos().Y, hit.int_hitpos().X, hit.int_hitpos().Y) < ((((int)pp->actor->spr.clipdist)<<2) + 256))
|
if (Distance(pp->int_ppos().X, pp->int_ppos().Y, hit.int_hitpos().X, hit.int_hitpos().Y) < ((((int)pp->actor->spr.clipdist)<<2) + 256))
|
||||||
return true;
|
return true;
|
||||||
|
@ -3381,7 +3381,7 @@ bool PlayerFallTest(PLAYER* pp, double player_height)
|
||||||
{
|
{
|
||||||
// if on a STEEP slope sector and you have not moved off of the sector
|
// if on a STEEP slope sector and you have not moved off of the sector
|
||||||
if (pp->lo_sectp &&
|
if (pp->lo_sectp &&
|
||||||
labs(pp->lo_sectp->floorheinum) > 3000 &&
|
abs(pp->lo_sectp->floorheinum) > 3000 &&
|
||||||
(pp->lo_sectp->floorstat & CSTAT_SECTOR_SLOPE) &&
|
(pp->lo_sectp->floorstat & CSTAT_SECTOR_SLOPE) &&
|
||||||
pp->lo_sectp == pp->lastcursector)
|
pp->lo_sectp == pp->lastcursector)
|
||||||
{
|
{
|
||||||
|
|
|
@ -205,7 +205,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect,
|
||||||
plax_found = true;
|
plax_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (labs(hit.int_hitpos().Z - hiz) < Z(4))
|
else if (abs(hit.int_hitpos().Z - hiz) < Z(4))
|
||||||
{
|
{
|
||||||
if (FAF_ConnectCeiling(hit.hitSector) && !(hit.hitSector->floorstat & CSTAT_SECTOR_FAF_BLOCK_HITSCAN))
|
if (FAF_ConnectCeiling(hit.hitSector) && !(hit.hitSector->floorstat & CSTAT_SECTOR_FAF_BLOCK_HITSCAN))
|
||||||
{
|
{
|
||||||
|
@ -273,7 +273,7 @@ bool FAFcansee_(int32_t xs, int32_t ys, int32_t zs, sectortype* sects,
|
||||||
if (hit.hitWall == nullptr && hit.actor() == nullptr)
|
if (hit.hitWall == nullptr && hit.actor() == nullptr)
|
||||||
{
|
{
|
||||||
getzsofslopeptr(hit.hitSector, hit.int_hitpos().X, hit.int_hitpos().Y, &hiz, &loz);
|
getzsofslopeptr(hit.hitSector, hit.int_hitpos().X, hit.int_hitpos().Y, &hiz, &loz);
|
||||||
if (labs(hit.int_hitpos().Z - loz) < Z(4))
|
if (abs(hit.int_hitpos().Z - loz) < Z(4))
|
||||||
{
|
{
|
||||||
if (FAF_ConnectFloor(hit.hitSector))
|
if (FAF_ConnectFloor(hit.hitSector))
|
||||||
{
|
{
|
||||||
|
@ -281,7 +281,7 @@ bool FAFcansee_(int32_t xs, int32_t ys, int32_t zs, sectortype* sects,
|
||||||
plax_found = true;
|
plax_found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (labs(hit.int_hitpos().Z - hiz) < Z(4))
|
else if (abs(hit.int_hitpos().Z - hiz) < Z(4))
|
||||||
{
|
{
|
||||||
if (FAF_ConnectCeiling(hit.hitSector))
|
if (FAF_ConnectCeiling(hit.hitSector))
|
||||||
{
|
{
|
||||||
|
|
|
@ -301,7 +301,7 @@ int DoRotator(DSWActor* actor)
|
||||||
// new tgt is OPEN (open)
|
// new tgt is OPEN (open)
|
||||||
r->tgt = r->open_dest;
|
r->tgt = r->open_dest;
|
||||||
r->speed = r->orig_speed;
|
r->speed = r->orig_speed;
|
||||||
r->vel = labs(r->vel);
|
r->vel = abs(r->vel);
|
||||||
|
|
||||||
SetRotatorInactive(actor);
|
SetRotatorInactive(actor);
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,7 @@ int DoSlidor(DSWActor* actor)
|
||||||
|
|
||||||
// new tgt is OPEN (open)
|
// new tgt is OPEN (open)
|
||||||
r->speed = r->orig_speed;
|
r->speed = r->orig_speed;
|
||||||
r->vel = labs(r->vel);
|
r->vel = abs(r->vel);
|
||||||
|
|
||||||
r->tgt = r->open_dest;
|
r->tgt = r->open_dest;
|
||||||
SetSlidorInactive(actor);
|
SetSlidorInactive(actor);
|
||||||
|
|
|
@ -166,7 +166,7 @@ FRolloffInfo GetRolloff(int basedist)
|
||||||
if (basedist < 0) // if basedist is negative
|
if (basedist < 0) // if basedist is negative
|
||||||
{
|
{
|
||||||
double decayshift = 2;
|
double decayshift = 2;
|
||||||
int decay = labs(basedist) / DECAY_CONST;
|
int decay = abs(basedist) / DECAY_CONST;
|
||||||
|
|
||||||
for (int i = 0; i < decay; i++)
|
for (int i = 0; i < decay; i++)
|
||||||
decayshift *= 2;
|
decayshift *= 2;
|
||||||
|
|
|
@ -1508,7 +1508,7 @@ void SpriteSetupPost(void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
getzsofslopeptr(jActor->sector(), jActor->int_pos().X, jActor->int_pos().Y, &cz, &fz);
|
getzsofslopeptr(jActor->sector(), jActor->int_pos().X, jActor->int_pos().Y, &cz, &fz);
|
||||||
if (labs(jActor->int_pos().Z - fz) > Z(4))
|
if (abs(jActor->int_pos().Z - fz) > Z(4))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SpawnUser(jActor, 0, nullptr);
|
SpawnUser(jActor, 0, nullptr);
|
||||||
|
|
|
@ -2964,7 +2964,7 @@ bool ActorTrackDecide(TRACK_POINT* tpoint, DSWActor* actor)
|
||||||
if (!hit.hitWall->twoSided())
|
if (!hit.hitWall->twoSided())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
zdiff = labs(actor->int_pos().Z - hit.hitWall->nextSector()->int_floorz()) >> 8;
|
zdiff = abs(actor->int_pos().Z - hit.hitWall->nextSector()->int_floorz()) >> 8;
|
||||||
|
|
||||||
actor->user.jump_speed = PickJumpSpeed(actor, zdiff);
|
actor->user.jump_speed = PickJumpSpeed(actor, zdiff);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4145,7 +4145,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, DAngle hit_angle, const DVe
|
||||||
UpdateChangeXY(actorNew);
|
UpdateChangeXY(actorNew);
|
||||||
|
|
||||||
// for FastShrap
|
// for FastShrap
|
||||||
actorNew->user.set_int_change_z(abs(actorNew->user.jump_speed*4) - RandomRange(labs(actorNew->user.jump_speed)*8));
|
actorNew->user.set_int_change_z(abs(actorNew->user.jump_speed*4) - RandomRange(abs(actorNew->user.jump_speed)*8));
|
||||||
actorNew->user.WaitTics = 64 + RANDOM_P2(32);
|
actorNew->user.WaitTics = 64 + RANDOM_P2(32);
|
||||||
|
|
||||||
actor->user.Flags |= (SPR_BOUNCE);
|
actor->user.Flags |= (SPR_BOUNCE);
|
||||||
|
@ -15986,7 +15986,7 @@ int InitMine(PLAYER* pp)
|
||||||
dot = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.Cos() * (1 << 14), pp->angle.ang.Sin() * (1 << 14));
|
dot = DOT_PRODUCT_2D(pp->vect.X, pp->vect.Y, pp->angle.ang.Cos() * (1 << 14), pp->angle.ang.Sin() * (1 << 14));
|
||||||
|
|
||||||
// don't adjust for strafing
|
// don't adjust for strafing
|
||||||
if (labs(dot) > 10000)
|
if (abs(dot) > 10000)
|
||||||
{
|
{
|
||||||
// adjust xvel according to player velocity
|
// adjust xvel according to player velocity
|
||||||
actorNew->user.add_int_change_x(pp->vect.X>>13);
|
actorNew->user.add_int_change_x(pp->vect.X>>13);
|
||||||
|
|
Loading…
Reference in a new issue