@@ -447,7 +447,7 @@ let make = (
447447let isInVisionCone = (guard : t , ~targetX : float , ~targetY : float ): bool => {
448448 let dx = targetX -. guard .x
449449 let dy = targetY -. guard .y
450- let distance = Js . Math .sqrt (dx *. dx +. dy *. dy )
450+ let distance = Math .sqrt (dx *. dx +. dy *. dy )
451451
452452 let facingRight = guard .facing == Right
453453 let isBehind = (facingRight && dx < 0.0 ) || (! facingRight && dx > 0.0 )
@@ -459,15 +459,15 @@ let isInVisionCone = (guard: t, ~targetX: float, ~targetY: float): bool => {
459459 let guardAngle = if facingRight {
460460 0.0
461461 } else {
462- Js . Math ._PI
462+ Math .Constants . pi
463463 }
464464 // SafeAngle.fromAtan2 guards against non-finite dy/dx inputs
465465 // (NaN/Infinity from degenerate positions would poison the entire
466466 // vision cone calculation and cause guards to never/always detect).
467467 let targetAngle = SafeAngle .fromAtan2 (~y = dy , ~x = dx )
468468 let angleDiff = absFloat (targetAngle -. guardAngle )
469- let normalised = if angleDiff > Js . Math ._PI {
470- 2.0 *. Js . Math ._PI -. angleDiff
469+ let normalised = if angleDiff > Math .Constants . pi {
470+ 2.0 *. Math .Constants . pi -. angleDiff
471471 } else {
472472 angleDiff
473473 }
@@ -491,7 +491,7 @@ let detectPlayer = (
491491 } else {
492492 let dx = playerX -. guard .x
493493 let dy = playerY -. guard .y
494- let distance = Js . Math .sqrt (dx *. dx +. dy *. dy )
494+ let distance = Math .sqrt (dx *. dx +. dy *. dy )
495495
496496 let effectiveRange = if playerCrouching {
497497 guard .vision .range *. 0.6
@@ -700,9 +700,9 @@ let updateAntiHacker = (guard: t, ~dt: float, ~playerX: float, ~alertLevel: int)
700700 } else {
701701 0.0
702702 }
703- psych .courage = Js . Math .max_float (
703+ psych .courage = Math .max (
704704 0.0 ,
705- Js . Math .min_float (1.0 , baseCourage +. backupBonus +. alertPenalty +. proximityPenalty ),
705+ Math .min (1.0 , baseCourage +. backupBonus +. alertPenalty +. proximityPenalty ),
706706 )
707707
708708 switch guard .state {
@@ -899,9 +899,9 @@ let updateRival = (guard: t, ~dt: float, ~playerX: float): unit => {
899899 // Track player awareness
900900 let playerDist = distanceTo (guard , ~x = playerX )
901901 if playerDist < 200.0 {
902- rival .awareness = Js . Math .min_float (1.0 , rival .awareness +. dt *. 0.3 )
902+ rival .awareness = Math .min (1.0 , rival .awareness +. dt *. 0.3 )
903903 } else {
904- rival .awareness = Js . Math .max_float (0.0 , rival .awareness -. dt *. 0.1 )
904+ rival .awareness = Math .max (0.0 , rival .awareness -. dt *. 0.1 )
905905 }
906906
907907 switch guard .state {
@@ -1089,7 +1089,7 @@ let updateAssassin = (guard: t, ~dt: float, ~playerX: float): unit => {
10891089 }
10901090 | None => {
10911091 // No waypoints just fade and reposition randomly
1092- ai .visibility = Js . Math .max_float (0.0 , ai .visibility -. dt *. 0.3 )
1092+ ai .visibility = Math .max (0.0 , ai .visibility -. dt *. 0.3 )
10931093 if ai .visibility <= 0.05 {
10941094 guard .state = Hiding
10951095 }
@@ -1330,7 +1330,7 @@ let renderGuard = (guard: t): unit => {
13301330 let baseAngle = if guard .facing == Right {
13311331 0.0
13321332 } else {
1333- Js . Math ._PI
1333+ Math .Constants . pi
13341334 }
13351335 let startAngle = baseAngle -. guard .vision .halfAngle
13361336 let endAngle = baseAngle +. guard .vision .halfAngle
@@ -1339,12 +1339,12 @@ let renderGuard = (guard: t): unit => {
13391339 guard .coneGraphic
13401340 -> Graphics .moveTo (0.0 , -. h /. 2.0 -. 14.0 )
13411341 -> Graphics .lineTo (
1342- Js . Math .cos (startAngle ) *. guard .vision .range ,
1343- -. h /. 2.0 -. 14.0 +. Js . Math .sin (startAngle ) *. guard .vision .range ,
1342+ Math .cos (startAngle ) *. guard .vision .range ,
1343+ -. h /. 2.0 -. 14.0 +. Math .sin (startAngle ) *. guard .vision .range ,
13441344 )
13451345 -> Graphics .lineTo (
1346- Js . Math .cos (endAngle ) *. guard .vision .range ,
1347- -. h /. 2.0 -. 14.0 +. Js . Math .sin (endAngle ) *. guard .vision .range ,
1346+ Math .cos (endAngle ) *. guard .vision .range ,
1347+ -. h /. 2.0 -. 14.0 +. Math .sin (endAngle ) *. guard .vision .range ,
13481348 )
13491349 -> Graphics .lineTo (0.0 , -. h /. 2.0 -. 14.0 )
13501350 -> Graphics .fill ({"color" : coneColor , "alpha" : coneAlpha })
@@ -1520,7 +1520,7 @@ let update = (
15201520 }
15211521 }
15221522 | Peripheral (amount ) => {
1523- guard .suspicion = Js . Math .min_float (1.0 , guard .suspicion +. amount *. dt *. 0.5 )
1523+ guard .suspicion = Math .min (1.0 , guard .suspicion +. amount *. dt *. 0.5 )
15241524 let threshold = switch guard .rank {
15251525 | BasicGuard => 0.85 // Very slow to notice
15261526 | SecurityGuard => 0.65
@@ -1540,7 +1540,7 @@ let update = (
15401540 | EliteGuard => 0.1 // Slow to forget
15411541 | _ => 0.2
15421542 }
1543- guard .suspicion = Js . Math .max_float (0.0 , guard .suspicion -. dt *. decayRate )
1543+ guard .suspicion = Math .max (0.0 , guard .suspicion -. dt *. decayRate )
15441544 }
15451545 }
15461546
0 commit comments