Add MEGA Ocean Liner, split decks, and detailed ship materials

This commit is contained in:
josh
2026-11-28 21:02:42 -05:00
parent ce0d38c8de
commit 46624bf5ba
47 changed files with 2042 additions and 382 deletions

View File

@@ -12,7 +12,8 @@ namespace BigShipTycoon
internal enum Paint
{
Navy, Ivory, Pearl, Gold, Teak, TeakSeam, Steel, Black, Glass, BlueGlass, LitGlass, Lounge,
Lifeboat, Pool, Antifouling, DeckCanvas, PortLight, StarboardLight, Turf, Fringe
Lifeboat, Pool, Antifouling, DeckCanvas, PortLight, StarboardLight, Turf, Fringe,
MegaHull, AtriumGlass, DeckTrack, FritGlass
}
private readonly Dictionary<Paint, HarborMesh> batches = new Dictionary<Paint, HarborMesh>();
@@ -25,7 +26,7 @@ namespace BigShipTycoon
this.ship = ship;
this.length = length;
this.beam = beam;
balconies = 21 + ship.HullIndex * 6;
balconies = ship.HullIndex == Market.Mega ? 66 : 21 + ship.HullIndex * 6;
}
public IReadOnlyDictionary<Paint, HarborMesh> Meshes()
@@ -33,8 +34,16 @@ namespace BigShipTycoon
BuildHull();
for (int deck = 0; deck < ship.Decks.Count; deck++)
BuildPassengerDeck(deck);
BuildBridgeAndRoof();
BuildLifeboats();
if (ship.HullIndex == Market.Mega)
{
BuildMegaRoof();
BuildMegaLifeboats();
}
else
{
BuildBridgeAndRoof();
BuildLifeboats();
}
return batches;
}
@@ -47,21 +56,33 @@ namespace BigShipTycoon
private void BuildHull()
{
Vector2[] outline = Outline(length, beam, 0, HullStations);
bool mega = ship.HullIndex == Market.Mega;
int samples = ExteriorHullStations;
Vector2[] outline = Outline(length, beam, 0, samples);
Vector2 center = Vector2.zero;
Coat(Paint.Antifouling).Loft(outline, center, false, new Vector3(.875f, -2.65f, .53f),
new Vector3(.936f, -1.78f, .73f), new Vector3(.967f, -.83f, .87f),
new Vector3(.984f, -.13f, .933f));
Coat(Paint.Black).Loft(outline, center, false, new Vector3(.984f, -.13f, .933f),
new Vector3(.991f, .27f, .969f));
Coat(Paint.Navy).Loft(outline, center, false, new Vector3(.991f, .27f, .969f),
new Vector3(.996f, 1.22f, .988f), new Vector3(1, 2.39f, 1),
new Vector3(1.01f, 4.65f, 1.03f));
Coat(Paint.Gold).Loft(outline, center, false, new Vector3(1.013f, 3.54f, 1.025f),
new Vector3(1.013f, 3.61f, 1.026f));
if (mega)
{
Coat(Paint.Navy).Loft(outline, center, false, new Vector3(.991f, .27f, .969f), new Vector3(.996f, 1.22f, .988f));
Coat(Paint.MegaHull).Loft(outline, center, false, new Vector3(.996f, 1.22f, .988f),
new Vector3(1, 2.39f, 1), new Vector3(1.01f, 4.65f, 1.03f));
Coat(Paint.AtriumGlass).Loft(outline, center, false, new Vector3(1.013f, 4.24f, 1.030f),
new Vector3(1.013f, 4.40f, 1.033f));
}
else
{
Coat(Paint.Navy).Loft(outline, center, false, new Vector3(.991f, .27f, .969f),
new Vector3(.996f, 1.22f, .988f), new Vector3(1, 2.39f, 1), new Vector3(1.01f, 4.65f, 1.03f));
Coat(Paint.Gold).Loft(outline, center, false, new Vector3(1.013f, 3.54f, 1.025f),
new Vector3(1.013f, 3.61f, 1.026f));
}
Coat(Paint.Ivory).Loft(outline, center, true, new Vector3(.998f, 4.47f, 1.015f),
new Vector3(1.013f, 5.14f, 1.027f), new Vector3(1.003f, 5.32f, 1.015f));
Vector2[] promenade = Outline(length * .971f, beam * .979f, 0, HullStations);
Vector2[] promenade = Outline(length * .971f, beam * .979f, 0, samples);
Coat(Paint.Teak).Loft(promenade, center, true, new Vector3(.997f, 5.32f, 1),
new Vector3(1, DeckBase, 1));
Rails(promenade, DeckBase, DeckBase + .77f, 2.1f);
@@ -69,12 +90,12 @@ namespace BigShipTycoon
for (int side = -1; side <= 1; side += 2)
{
BuildHullFittings(side);
int portholes = 25 + ship.HullIndex * 7;
int portholes = mega ? 76 : 25 + ship.HullIndex * 7;
for (int i = 0; i < portholes; i++)
{
float station = Mathf.Lerp(.105f, .837f, i / (float)(portholes - 1));
var (at, along, outward) = SideFrame(station, 2.76f, length * 1.002f,
beam * 1.006f, 0, side, HullStations);
beam * 1.006f, 0, side, samples);
Coat(Paint.Steel).Disc(at + outward * .043f, along * (side * .22f), Vector3.up * .238f, 12);
Coat(Paint.Black).Disc(at + outward * .048f, along * (side * .178f), Vector3.up * .194f, 12);
Paint pane = (i + 5 * side) % 7 == 0 ? Paint.Lounge : Paint.Glass;
@@ -82,13 +103,15 @@ namespace BigShipTycoon
}
var (door, hinge, face) = SideFrame(.56f, 3.22f, length * 1.004f, beam * 1.016f, 0, side,
HullStations);
samples);
SidePanel(Coat(Paint.Black), door + face * .027f, hinge, side, 2.22f, 1.66f);
SidePanel(Coat(Paint.Navy), door + face * .032f, hinge, side, 2.10f, 1.53f);
SidePanel(Coat(Paint.Steel), door + face * .04f + hinge * .82f, hinge, side, .21f, .08f);
}
BuildForecastle();
if (mega)
BuildMegaHullDetail();
}
private void BuildForecastle()
@@ -127,6 +150,11 @@ namespace BigShipTycoon
private void BuildPassengerDeck(int deck)
{
if (ship.HullIndex == Market.Mega)
{
BuildMegaPassengerDeck(deck);
return;
}
float y = DeckBase + deck * DeckSpacing;
float roof = y + DeckSpacing;
var (deckLength, deckBeam, offset) = DeckFootprint(deck);
@@ -338,7 +366,7 @@ namespace BigShipTycoon
private void BuildSunDeck(SunDeckLayout plan, float top)
{
var starts = new int[(int)Paint.Fringe + 1];
var starts = new int[(int)Paint.FritGlass + 1];
foreach (SunDeckVenue venue in plan.Venues)
{
System.Array.Clear(starts, 0, starts.Length);
@@ -510,26 +538,32 @@ namespace BigShipTycoon
internal readonly SunDeckVenue[] Venues;
internal readonly SunDeckVenue Pool;
internal SunDeckLayout(Ship ship)
internal SunDeckLayout(Ship ship, SunDeckZone zone)
{
int deck = ship.Decks.Count - 1;
Length = DeckLength(ship.Hull.Length, deck);
Offset = DeckOffset(ship.Hull.Length, deck);
HalfBeam = DeckHalfBeam(ship.Hull.Beam * .5f, deck);
if (zone == SunDeckZone.AftTerrace)
{
Rect area = MegaDeckGeometry.TerraceArea(ship.Hull.Length, ship.Hull.Beam * .5f, ship.Decks.Count);
Length = area.width;
Offset = area.center.x;
HalfBeam = area.height * .5f;
}
else
(Length, HalfBeam, Offset) = MegaDeckGeometry.ForShip(ship, deck, ship.Decks.Count);
Facility[] cells = ship.Decks[deck].Cells;
SunDeckPlan design = ship.SunDeckPlan;
Custom = design.CustomLayout;
SunDeckPlan design = ship.SunDeckFor(zone);
Custom = design.CustomLayout || zone == SunDeckZone.AftTerrace;
OvalPool = design.Shape == SunPoolShape.Oval;
Shade = !design.NoShade;
ExtraLoungers = design.ExtraLoungers;
if (Custom)
{
var grid = new SunDeckGrid(ship);
var grid = new SunDeckGrid(ship, zone: zone);
SunDeckPlacement[] placements = design.Placements ?? System.Array.Empty<SunDeckPlacement>();
Venues = new SunDeckVenue[placements.Length];
Pool = new SunDeckVenue(SunAttraction.None, new Vector2(Offset, 0), Vector2.zero);
HasPool = false;
Resort = design.Pool == SunPoolStyle.Resort;
Resort = design.Pool is SunPoolStyle.Resort or SunPoolStyle.Lagoon;
PoolHalfSize = grid.PoolBasinHalfSize(design.Pool);
for (int i = 0; i < placements.Length; i++)
{
@@ -559,7 +593,7 @@ namespace BigShipTycoon
SunPoolPosition.Aft => -.09f, SunPoolPosition.Forward => .11f, _ => Resort ? .033f : .01f
});
float poolCenter = Mathf.Clamp(desired, Offset - Length * .24f + PoolHalfSize.x + 4.1f,
BridgeCenter(ship.Hull.Length, ship.Decks.Count) - PoolHalfSize.x - 6.1f);
MegaDeckGeometry.BridgeCenter(ship, ship.Decks.Count) - PoolHalfSize.x - 6.1f);
Pool = new SunDeckVenue(HasPool ? SunAttraction.Pool : SunAttraction.None, new Vector2(poolCenter, 0), PoolHalfSize);
SunAttraction attraction = design.Attraction == SunAttraction.Automatic
@@ -577,7 +611,7 @@ namespace BigShipTycoon
internal bool Theater => System.Array.Exists(Venues, venue => venue.Kind == SunAttraction.Theater);
internal float PoolCenter => Pool.Center.x;
internal int Loungers => Custom && !HasPool ? 0 : (Resort ? 10 : 8) + (ExtraLoungers ? 2 : 0);
internal int Loungers => Custom && !HasPool ? 0 : (PoolHalfSize.x > 10f ? 16 : Resort ? 10 : 8) + (ExtraLoungers ? 2 : 0);
internal float LoungerDistance => Custom ? PoolHalfSize.y + .86f : HalfBeam * LoungerBeamFraction;
internal float ParasolX => PoolHalfSize.x + (Custom ? .68f : 1.25f);
internal float ParasolDistance => Custom ? Pool.HalfSize.y - 1.27f : HalfBeam * .55f;
@@ -591,7 +625,7 @@ namespace BigShipTycoon
}
}
internal static SunDeckLayout SunDeck(Ship ship) => new SunDeckLayout(ship);
internal static SunDeckLayout SunDeck(Ship ship, SunDeckZone zone = SunDeckZone.Sky) => new SunDeckLayout(ship, zone);
private void BuildLounger(float x, float top, float sideDistance, int side)
{
@@ -703,6 +737,8 @@ namespace BigShipTycoon
internal static float DeckOffset(float hullLength, int deck) => -hullLength * (.034f + .0065f * deck);
internal static float DeckHalfBeam(float halfBeam, int deck) => halfBeam * (.85f - .024f * deck);
private int ExteriorHullStations => ship.HullIndex == Market.Mega ? 72 : HullStations;
private (float Length, float Beam, float Offset) DeckFootprint(int deck) =>
(DeckLength(length, deck), DeckHalfBeam(beam, deck), DeckOffset(length, deck));