diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index dae89de67..e546a6c79 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -870,7 +870,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) case SE_9_DOWN_OPEN_DOOR_LIGHTS: 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 [[fallthrough]]; case SE_8_UP_OPEN_DOOR_LIGHTS: diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 6c8b77f61..79a968f17 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -488,7 +488,7 @@ void DoStarView(tspritetype* tsp, DSWActor* tActor, int viewz) extern STATE s_StarStuck[], s_StarDownStuck[]; int zdiff = viewz - tsp->int_pos().Z; - if (labs(zdiff) > Z(24)) + if (abs(zdiff) > Z(24)) { if (tActor->user.StateStart == s_StarStuck) 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.); 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); - 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); else if (actor->int_pos().X - *tx != 0) zvect = Scale(xvect, zdiff, actor->int_pos().X - *tx); diff --git a/source/games/sw/src/input.cpp b/source/games/sw/src/input.cpp index a386d9cec..fbfd1f141 100644 --- a/source/games/sw/src/input.cpp +++ b/source/games/sw/src/input.cpp @@ -186,7 +186,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju 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)) diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 41bcaf73a..8cd4f322b 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -254,7 +254,7 @@ void PlayerUpdateHealth(PLAYER* pp, short value) if (pp->Armor && !NoArmor) { int armor_damage, player_damage; - ArmorCalc(labs(value), &armor_damage, &player_damage); + ArmorCalc(abs(value), &armor_damage, &player_damage); PlayerUpdateArmor(pp, -armor_damage); value = -player_damage; } @@ -6317,7 +6317,7 @@ void pWeaponBob(PANEL_SPRITE* psp, short condition) } else { - if (labs((psp->sin_ndx & 1023) - 0) < 70) + if (abs((psp->sin_ndx & 1023) - 0) < 70) { psp->flags &= ~(PANF_BOB); psp->sin_ndx = (RANDOM_P2(1024) < 512) ? 1024 : 0; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 21867768a..2ae962d49 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -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)); // 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()))); @@ -1855,7 +1855,7 @@ void DoPlayerSlide(PLAYER* pp) 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); - 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; 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; } - 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; actor->set_int_xvel(FindDistance2D(pp->vect.X,pp->vect.Y)>>14); @@ -2468,9 +2468,9 @@ void DoPlayerMoveVehicle(PLAYER* pp) 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); - 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); } @@ -2506,7 +2506,7 @@ void DoPlayerMoveVehicle(PLAYER* pp) 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->lastcursector = pp->cursector; @@ -2540,7 +2540,7 @@ void DoPlayerMoveVehicle(PLAYER* pp) OperateSectorObject(pp->sop, pp->angle.ang.Buildang(), { MAXSO, MAXSO }); 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) @@ -3099,7 +3099,7 @@ void DoPlayerClimb(PLAYER* pp) pp->vect.Y += ((pp->input.svel*synctics*2)<<6); pp->vect.X = MulScale(pp->vect.X, 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; climbvel = FindDistance2D(pp->vect.X, pp->vect.Y)>>9; @@ -3333,7 +3333,7 @@ int DoPlayerWadeSuperJump(PLAYER* pp) { 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)) 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 (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 == pp->lastcursector) { diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index bb8642d5f..436ab47a4 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -205,7 +205,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect, 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)) { @@ -273,7 +273,7 @@ bool FAFcansee_(int32_t xs, int32_t ys, int32_t zs, sectortype* sects, if (hit.hitWall == nullptr && hit.actor() == nullptr) { 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)) { @@ -281,7 +281,7 @@ bool FAFcansee_(int32_t xs, int32_t ys, int32_t zs, sectortype* sects, 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)) { diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index 0dff082fe..1e4da295d 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -301,7 +301,7 @@ int DoRotator(DSWActor* actor) // new tgt is OPEN (open) r->tgt = r->open_dest; r->speed = r->orig_speed; - r->vel = labs(r->vel); + r->vel = abs(r->vel); SetRotatorInactive(actor); diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index 234032473..708ce86e2 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -470,7 +470,7 @@ int DoSlidor(DSWActor* actor) // new tgt is OPEN (open) r->speed = r->orig_speed; - r->vel = labs(r->vel); + r->vel = abs(r->vel); r->tgt = r->open_dest; SetSlidorInactive(actor); diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index 9f164e5ca..80bad59b7 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -166,7 +166,7 @@ FRolloffInfo GetRolloff(int basedist) if (basedist < 0) // if basedist is negative { double decayshift = 2; - int decay = labs(basedist) / DECAY_CONST; + int decay = abs(basedist) / DECAY_CONST; for (int i = 0; i < decay; i++) decayshift *= 2; diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 734f8fa71..824fd8d6b 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1508,7 +1508,7 @@ void SpriteSetupPost(void) continue; 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; SpawnUser(jActor, 0, nullptr); diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index c4cafc48a..f7bf2d86e 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -2964,7 +2964,7 @@ bool ActorTrackDecide(TRACK_POINT* tpoint, DSWActor* actor) if (!hit.hitWall->twoSided()) 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); } diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 5e61ce053..54d93c42a 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -4145,7 +4145,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, DAngle hit_angle, const DVe UpdateChangeXY(actorNew); // 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); 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)); // don't adjust for strafing - if (labs(dot) > 10000) + if (abs(dot) > 10000) { // adjust xvel according to player velocity actorNew->user.add_int_change_x(pp->vect.X>>13);