Fix port cinematics and expand ship attractions
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Soundings
|
||||
internal enum Paint
|
||||
{
|
||||
Navy, Ivory, Pearl, Gold, Teak, TeakSeam, Steel, Black, Glass, BlueGlass, LitGlass, Lounge,
|
||||
Lifeboat, Pool, Antifouling, DeckCanvas, PortLight, StarboardLight
|
||||
Lifeboat, Pool, Antifouling, DeckCanvas, PortLight, StarboardLight, Turf, Fringe
|
||||
}
|
||||
|
||||
private readonly Dictionary<Paint, HarborMesh> batches = new Dictionary<Paint, HarborMesh>();
|
||||
@@ -176,6 +176,9 @@ namespace Soundings
|
||||
case Facility.ShoppingArcade:
|
||||
case Facility.Spa:
|
||||
case Facility.WaterPark:
|
||||
case Facility.Casino:
|
||||
case Facility.CasinoLounge:
|
||||
case Facility.GrandCasino:
|
||||
BuildWindow(floor, along, outward, side, width * .88f, 1.35f, 1.23f, 3,
|
||||
(i + deck * 2) % 6 == 0 ? Paint.Lounge : Paint.Glass);
|
||||
break;
|
||||
@@ -339,19 +342,22 @@ namespace Soundings
|
||||
if (plan.HasPool)
|
||||
{
|
||||
PoolBasin(Coat(Paint.Pearl), Coat(Paint.BlueGlass), Coat(Paint.Pool), new Vector3(pool, top, 0),
|
||||
plan.PoolHalfSize, .37f, PoolWaterHeight);
|
||||
plan.PoolHalfSize, .37f, PoolWaterHeight, plan.OvalPool);
|
||||
BuildPoolDeckFittings(plan, top);
|
||||
}
|
||||
|
||||
for (int side = -1; side <= 1; side += 2)
|
||||
{
|
||||
if (plan.HasPool)
|
||||
PoolRails(Coat(Paint.Steel), new Vector3(pool - plan.PoolHalfSize.x + .53f, top, side * plan.PoolHalfSize.y), side);
|
||||
{
|
||||
float railX = plan.OvalPool ? pool - .38f : pool - plan.PoolHalfSize.x + .53f;
|
||||
PoolRails(Coat(Paint.Steel), new Vector3(railX, top, side * plan.PoolHalfSize.y), side);
|
||||
}
|
||||
for (int i = 0; i < plan.Loungers; i++)
|
||||
BuildLounger(plan.LoungerX(i), top, plan.LoungerDistance, side);
|
||||
float shadeX = plan.Resort ? pool + plan.PoolHalfSize.x + 1.32f : pool + 3.81f;
|
||||
BuildParasol(new Vector3(shadeX, top, side * plan.HalfBeam * .55f), side > 0);
|
||||
if (!plan.Resort)
|
||||
if (plan.Shade)
|
||||
BuildParasol(new Vector3(pool + plan.PoolHalfSize.x + 1.25f, top, side * plan.HalfBeam * .55f), side > 0);
|
||||
if (!plan.Resort || plan.OvalPool)
|
||||
continue;
|
||||
|
||||
// Floating dividers leave three clear routes through the long basin.
|
||||
@@ -367,6 +373,8 @@ namespace Soundings
|
||||
|
||||
if (plan.Theater)
|
||||
BuildOpenAirStage(plan, top);
|
||||
else
|
||||
BuildSunAttraction(plan, top);
|
||||
}
|
||||
|
||||
private void BuildOpenAirStage(SunDeckLayout plan, float top)
|
||||
@@ -402,14 +410,14 @@ namespace Soundings
|
||||
}
|
||||
|
||||
internal static void PoolBasin(HarborMesh coping, HarborMesh tile, HarborMesh water, Vector3 foot,
|
||||
Vector2 halfSize, float rimHeight, float waterHeight)
|
||||
Vector2 halfSize, float rimHeight, float waterHeight, bool oval = false)
|
||||
{
|
||||
Vector2 center = new Vector2(foot.x, foot.z);
|
||||
float radius = Mathf.Min(.31f, halfSize.y * .45f);
|
||||
const float surround = .23f;
|
||||
Vector2[] inner = RoundedRectangle(center, halfSize.x, halfSize.y, radius);
|
||||
Vector2[] edging = RoundedRectangle(center, halfSize.x + .036f, halfSize.y + .036f, radius + .036f);
|
||||
Vector2[] outer = RoundedRectangle(center, halfSize.x + surround, halfSize.y + surround, radius + surround);
|
||||
Vector2[] inner = BasinOutline(0);
|
||||
Vector2[] edging = BasinOutline(.036f);
|
||||
Vector2[] outer = BasinOutline(surround);
|
||||
float rim = foot.y + rimHeight;
|
||||
float surface = foot.y + waterHeight;
|
||||
coping.Loft(outer, center, false, new Vector3(1f, foot.y, 1f), new Vector3(1f, rim, 1f));
|
||||
@@ -424,6 +432,19 @@ namespace Soundings
|
||||
tile.Quad(HarborMesh.Point(inner[i], surface), HarborMesh.Point(inner[next], surface),
|
||||
HarborMesh.Point(inner[next], rim), HarborMesh.Point(inner[i], rim));
|
||||
}
|
||||
|
||||
Vector2[] BasinOutline(float extra)
|
||||
{
|
||||
if (!oval)
|
||||
return RoundedRectangle(center, halfSize.x + extra, halfSize.y + extra, radius + extra);
|
||||
var ellipse = new Vector2[32];
|
||||
for (int i = 0; i < ellipse.Length; i++)
|
||||
{
|
||||
float angle = i * Mathf.PI * 2 / ellipse.Length;
|
||||
ellipse[i] = center + new Vector2(Mathf.Cos(angle) * (halfSize.x + extra), Mathf.Sin(angle) * (halfSize.y + extra));
|
||||
}
|
||||
return ellipse;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void PoolRails(HarborMesh steel, Vector3 edge, int side)
|
||||
@@ -445,9 +466,10 @@ namespace Soundings
|
||||
|
||||
internal readonly struct SunDeckLayout
|
||||
{
|
||||
internal readonly float Length, Offset, HalfBeam, PoolCenter, StageCenter, StageHalfWidth;
|
||||
internal readonly bool HasPool, Resort, Theater;
|
||||
internal readonly Vector2 PoolHalfSize;
|
||||
internal readonly float Length, Offset, HalfBeam, PoolCenter, StageCenter, StageHalfWidth, AttractionCenter;
|
||||
internal readonly bool HasPool, Resort, OvalPool, Shade, ExtraLoungers;
|
||||
internal readonly Vector2 PoolHalfSize, AttractionHalfSize;
|
||||
internal readonly SunAttraction Attraction;
|
||||
|
||||
internal SunDeckLayout(Ship ship)
|
||||
{
|
||||
@@ -456,24 +478,45 @@ namespace Soundings
|
||||
Offset = DeckOffset(ship.Hull.Length, deck);
|
||||
HalfBeam = DeckHalfBeam(ship.Hull.Beam * .5f, deck);
|
||||
Facility[] cells = ship.Decks[deck].Cells;
|
||||
bool waterPark = System.Array.IndexOf(cells, Facility.WaterPark) >= 0;
|
||||
Resort = waterPark || System.Array.IndexOf(cells, Facility.ResortPool) >= 0;
|
||||
Theater = System.Array.IndexOf(cells, Facility.GrandTheater) >= 0;
|
||||
HasPool = Resort || ship.Count(Facility.Amenity) > 0;
|
||||
PoolCenter = Offset + Length * (Resort ? .033f : .01f);
|
||||
PoolHalfSize = waterPark
|
||||
? new Vector2(Mathf.Min(8.95f, Length * .105f), Mathf.Min(3f, HalfBeam * .40f))
|
||||
SunDeckPlan design = ship.SunDeckPlan;
|
||||
bool automatic = design.Pool == SunPoolStyle.Automatic;
|
||||
bool waterPark = automatic && System.Array.IndexOf(cells, Facility.WaterPark) >= 0;
|
||||
Resort = waterPark || (automatic && System.Array.IndexOf(cells, Facility.ResortPool) >= 0)
|
||||
|| design.Pool == SunPoolStyle.Resort;
|
||||
HasPool = automatic ? Resort || ship.Count(Facility.Amenity) > 0 : design.Pool != SunPoolStyle.None;
|
||||
OvalPool = design.Shape == SunPoolShape.Oval;
|
||||
Shade = !design.NoShade;
|
||||
ExtraLoungers = design.ExtraLoungers;
|
||||
PoolHalfSize = waterPark ? new Vector2(Mathf.Min(8.95f, Length * .105f), Mathf.Min(3f, HalfBeam * .40f))
|
||||
: Resort ? new Vector2(Mathf.Min(7.15f, Length * .089f), Mathf.Min(2.77f, HalfBeam * .39f))
|
||||
: new Vector2(PoolHalfLength, PoolHalfWidth);
|
||||
StageCenter = Offset - Length * .376f;
|
||||
: design.Pool == SunPoolStyle.Family ? new Vector2(Mathf.Min(4.48f, Length * .085f), Mathf.Min(2.18f, HalfBeam * .38f))
|
||||
: new Vector2(PoolHalfLength, PoolHalfWidth);
|
||||
float desired = Offset + Length * (design.Position switch
|
||||
{
|
||||
SunPoolPosition.Aft => -.09f, SunPoolPosition.Forward => .11f, _ => Resort ? .033f : .01f
|
||||
});
|
||||
PoolCenter = Mathf.Clamp(desired, Offset - Length * .24f + PoolHalfSize.x + 4.1f,
|
||||
BridgeCenter(ship.Hull.Length, ship.Decks.Count) - PoolHalfSize.x - 6.1f);
|
||||
|
||||
Attraction = design.Attraction == SunAttraction.Automatic
|
||||
? System.Array.IndexOf(cells, Facility.GrandTheater) >= 0 ? SunAttraction.Theater : SunAttraction.None
|
||||
: design.Attraction;
|
||||
AttractionCenter = Offset - Length * .367f;
|
||||
AttractionHalfSize = new Vector2(Length * .085f, HalfBeam * .62f);
|
||||
StageCenter = design.Attraction == SunAttraction.Automatic ? Offset - Length * .376f : AttractionCenter;
|
||||
StageHalfWidth = Mathf.Min(2.85f, HalfBeam * .39f);
|
||||
}
|
||||
|
||||
internal int Loungers => Resort ? 10 : 8;
|
||||
internal bool Theater => Attraction == SunAttraction.Theater;
|
||||
internal int Loungers => (Resort ? 10 : 8) + (ExtraLoungers ? 2 : 0);
|
||||
internal float LoungerDistance => HalfBeam * LoungerBeamFraction;
|
||||
internal float LoungerX(int index) => Resort
|
||||
? PoolCenter + Mathf.Lerp(-PoolHalfSize.x + .44f, PoolHalfSize.x - .44f, (float)index / (Loungers - 1))
|
||||
: PoolCenter - 3f + index * .94f;
|
||||
internal float LoungerX(int index)
|
||||
{
|
||||
if (!Resort && !ExtraLoungers && PoolHalfSize.x < 3f)
|
||||
return PoolCenter - 3f + index * .94f;
|
||||
float span = Mathf.Max(PoolHalfSize.x - .44f, (Loungers - 1) * .45f);
|
||||
return PoolCenter + Mathf.Lerp(-span, span, (float)index / (Loungers - 1));
|
||||
}
|
||||
internal float StageSeatX(int row) => StageCenter + 3.04f + row * 1.04f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user