From 0c216499c6d4d4a92bb99f581f22bf71904c97ea Mon Sep 17 00:00:00 2001 From: Fate-JH Date: Sun, 17 May 2026 15:03:44 -0400 Subject: [PATCH] modified the killplanes in the shooting and driving vr zones so that they reflect the wrapped nature of the map's repeating instances; modified the map scale to make the blockmap properly accommodate --- .../net/psforever/objects/zones/MapInfo.scala | 101 ++++++++++++++---- 1 file changed, 83 insertions(+), 18 deletions(-) diff --git a/src/main/scala/net/psforever/objects/zones/MapInfo.scala b/src/main/scala/net/psforever/objects/zones/MapInfo.scala index 7100d1f14..c2f2d9a1f 100644 --- a/src/main/scala/net/psforever/objects/zones/MapInfo.scala +++ b/src/main/scala/net/psforever/objects/zones/MapInfo.scala @@ -310,20 +310,20 @@ case object MapInfo extends StringEnum[MapInfo] { extends MapInfo( value = "map14", checksum = 4276645952L, - scale = MapScale.Dim1024, + scale = MapScale.Dim8192, //Dim1024, hotSpotSpan = 0, environment = List(SeaLevel(EnvironmentAttribute.Water, 10)) ++ - MapEnvironment.dim1024MapEdgeKillPlanes + MapEnvironment.dim1024MapEdgeKillPlanesWrap ) case object Map15 extends MapInfo( value = "map15", checksum = 3628825458L, - scale = MapScale.Dim4096, + scale = MapScale.Dim8192, //Dim4096, hotSpotSpan = 0, environment = List(SeaLevel(EnvironmentAttribute.Water, 8)) ++ - MapEnvironment.dim4096MapEdgeKillPlanes + MapEnvironment.dim4096MapEdgeKillPlanesWrap ) case object Map16 @@ -588,21 +588,25 @@ object MapEnvironment { * @param killField the region defined as an "absolute death barrier" to any player or vehicle that enters it * @param warnFields consecutive inset perimeters * that indicate the bounded regions of warning before the `killField` region + * @param offsets pair of coordinates that indicates the lower left frame of reference; + * defaults to `(0, 0)` as the world origin point on standard map * @return a list of environmental representations */ def zoneMapEdgeKillPlane( scale: MapScale, killField: (Float,Float,Float,Float), - warnFields: List[(Float,Float,Float,Float,Int)] + warnFields: List[(Float,Float,Float,Float,Int)], + offsets: (Float, Float) = (0, 0) ): List[PieceOfEnvironment] = { - val height = scale.height - val width = scale.width + val (offsetX, offsetY) = offsets + val height = scale.height + offsetY + val width = scale.width + offsetX val (kbn, kbe, kbs, kbw) = killField val killFields = List( - Pool(EnvironmentAttribute.Death, 1024, height, width, height - kbn, 0), //N - Pool(EnvironmentAttribute.Death, 1024, height, width, 0, width - kbe), //E - Pool(EnvironmentAttribute.Death, 1024, kbs, width, 0, 0), //S - Pool(EnvironmentAttribute.Death, 1024, height, kbw, 0, 0) //W + Pool(EnvironmentAttribute.Death, 1024, height, width, height - kbn, offsetX), //N + Pool(EnvironmentAttribute.Death, 1024, height, width, offsetY, width - kbe), //E + Pool(EnvironmentAttribute.Death, 1024, kbs + offsetY, width, offsetY, offsetX), //S + Pool(EnvironmentAttribute.Death, 1024, height, kbw + offsetX, offsetY, offsetX) //W ) if (warnFields.nonEmpty) { val msgs = 0 +: warnFields.map(_._5) @@ -616,11 +620,11 @@ object MapEnvironment { List( GeneralMovementField( warnCloseToEdgeOfMap(List(Vector3(0,1,0),Vector3(-1,0,0)), thisMsg), - DeepSquare(1024, height - mns(old), mws(index), height - mns(index), mws(old)) + DeepSquare(1024, height - mns(old), mws(index) + offsetX, height - mns(index), mws(old) + offsetX) ), //NW GeneralMovementField( warnCloseToEdgeOfMap(List(Vector3(0,1,0)), thisMsg), - DeepSquare(1024, height - mns(old), width - mes(index), height - mns(index), mws(index)) + DeepSquare(1024, height - mns(old), width - mes(index), height - mns(index), mws(index) + offsetX) ), //N GeneralMovementField( warnCloseToEdgeOfMap(List(Vector3(0,1,0),Vector3(1,0,0)), thisMsg), @@ -628,23 +632,23 @@ object MapEnvironment { ), //NE GeneralMovementField( warnCloseToEdgeOfMap(List(Vector3(1,0,0)), thisMsg), - DeepSquare(1024, height - mns(index), width - mes(old), mss(index), width - mes(index)) + DeepSquare(1024, height - mns(index), width - mes(old), mss(index) + offsetY, width - mes(index)) ), //E GeneralMovementField( warnCloseToEdgeOfMap(List(Vector3(0,-1,0),Vector3(1,0,0)), thisMsg), - DeepSquare(1024, mss(index), width - mes(old), mss(old), width - mes(index)) + DeepSquare(1024, mss(index) + offsetY, width - mes(old), mss(old) + offsetY, width - mes(index)) ), //SE GeneralMovementField( warnCloseToEdgeOfMap(List(Vector3(0,-1,0)), thisMsg), - DeepSquare(1024, mss(index), width - mes(index), mss(old), mws(index)) + DeepSquare(1024, mss(index) + offsetY, width - mes(index), mss(old) + offsetY, mws(index) + offsetX) ), //S GeneralMovementField( warnCloseToEdgeOfMap(List(Vector3(0,-1,0),Vector3(-1,0,0)), thisMsg), - DeepSquare(1024, mss(index), mws(index), mss(old), mws(old)) + DeepSquare(1024, mss(index) + offsetY, mws(index) + offsetX, mss(old) + offsetY, mws(old) + offsetX) ), //SW GeneralMovementField( warnCloseToEdgeOfMap(List(Vector3(-1,0,0)), thisMsg), - DeepSquare(1024, height - mns(index), mws(index), mss(index), mws(old)) + DeepSquare(1024, height - mns(index), mws(index) + offsetX, mss(index) + offsetY, mws(old) + offsetX) ) //W ) } @@ -736,4 +740,65 @@ object MapEnvironment { } ns ++ ew } + + /** + * Instances where the zone contains regular redundancies of the map layout. + * These redundant maps are housed as smaller map instances within the bounds of the greater map instance size, + * flush against one another on the borders. + * @see `MapInfo.zoneMapEdgeKillPlane` + * @param scale dimensions of a single map instance + * @param kplanes single instance offsets for the kill planes; + * framed as the world origin map instance + * @param wplanes single instance offsets for the warning fields; + * framed as the world origin map instance + * @return list of environmental representations + */ + private def mapEdgeKillPlanesWrap( + scale: MapScale, + kplanes: (Float, Float, Float, Float), + wplanes: List[(Float, Float, Float, Float, Int)] + ): List[PieceOfEnvironment] = { + // kill planes on the borders are repeated per instance + // two are adjacent along an edge internally + // eight meet at an internal corner, four meet along the outside edge of the whole map + val rows = 0 until MapScale.Dim8192.width.toInt by scale.width.toInt + val cols = 0 until MapScale.Dim8192.height.toInt by scale.height.toInt + rows.flatMap(row => + cols.flatMap(col => + MapEnvironment.zoneMapEdgeKillPlane(scale, kplanes, wplanes, (row.toFloat, col.toFloat)) + ) + ).toList + } + + /** + * The kill planes and warning fields for a wrapped virtual reality shooting range map. + * @return list of environmental representations + */ + def dim1024MapEdgeKillPlanesWrap: List[PieceOfEnvironment] = { + mapEdgeKillPlanesWrap( + MapScale.Dim1024, + (102, 102, 102, 102), + List( + (125, 125, 125, 125, 3), + (156, 156, 156, 156, 2), + (204, 204, 204, 204, 1) + ) + ) + } + + /** + * The kill planes and warning fields for a wrapped virtual reality driving range map. + * @return list of environmental representations + */ + def dim4096MapEdgeKillPlanesWrap: List[PieceOfEnvironment] = { + mapEdgeKillPlanesWrap( + MapScale.Dim4096, + (204, 204, 204, 204), + List( + (255, 255, 255, 255, 3), + (306, 306, 306, 306, 2), + (408, 408, 408, 408, 1) + ) + ) + } }