merge
This commit is contained in:
commit
2fd62fb578
6 files changed
+72
-37
No files matched your search
+7
-5
@@ -3391,6 +3391,13 @@ namespace CalamityMod
|
||||
StealthUI.Draw(Main.spriteBatch, Main.LocalPlayer);
|
||||
return true;
|
||||
}, InterfaceScaleType.None));
|
||||
|
||||
// Popup GUIs.
|
||||
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Popup GUIs", () =>
|
||||
{
|
||||
PopupGUIManager.UpdateAndDraw(Main.spriteBatch);
|
||||
return true;
|
||||
}, InterfaceScaleType.None));
|
||||
}
|
||||
|
||||
// Invasion UI (used for Acid Rain)
|
||||
@@ -3406,11 +3413,6 @@ namespace CalamityMod
|
||||
return true;
|
||||
}, InterfaceScaleType.None));
|
||||
}
|
||||
layers.Add(new LegacyGameInterfaceLayer("Popup GUIs", () =>
|
||||
{
|
||||
PopupGUIManager.UpdateAndDraw(Main.spriteBatch);
|
||||
return true;
|
||||
}, InterfaceScaleType.None));
|
||||
}
|
||||
|
||||
public static Color GetNPCColor(NPC npc, Vector2? position = null, bool effects = true, float shadowOverride = 0f)
|
||||
|
||||
@@ -95,7 +95,6 @@ namespace CalamityMod.Localization
|
||||
new [] { "AureusBossText2", "A faint ethereal click can be heard from the dungeon." },
|
||||
new [] { "AstralBossText", "The seal of the stars has been broken! You can now mine Astral Ore." },
|
||||
new [] { "DeusText", "A star-spawned horror tunnels through the astral infection." },
|
||||
new [] { "DeusAltarRejectText", "The god of the stars rejects your offering. You must unleash the power of the lunar Cultist to perform the ritual." },
|
||||
new [] { "DeusAltarRejectNightText", "The god of the stars rejects your offering. The ritual can only be performed at night." },
|
||||
|
||||
new [] { "CalamitasBossText", "You underestimate my power..." },
|
||||
|
||||
@@ -49,6 +49,20 @@ namespace CalamityMod.Schematics
|
||||
yOffset += tiles.GetLength(1);
|
||||
break;
|
||||
}
|
||||
ushort[,] oldWalls = new ushort[tiles.GetLength(0), tiles.GetLength(1)];
|
||||
for (int x = 0; x < tiles.GetLength(0); x++)
|
||||
{
|
||||
for (int y = 0; y < tiles.GetLength(1); y++)
|
||||
{
|
||||
Tile tile = Main.tile[x + xOffset, y + yOffset];
|
||||
oldWalls[x, y] = tile.wall;
|
||||
|
||||
// Attempting to break chests causes the game to attempt to infinitely recurse in an attempt to break the tile, resulting in a stack overflow.
|
||||
if (tile.type == TileID.Containers)
|
||||
continue;
|
||||
WorldGen.KillTile(x + xOffset, y + yOffset);
|
||||
}
|
||||
}
|
||||
for (int x = 0; x < tiles.GetLength(0); x++)
|
||||
{
|
||||
for (int y = 0; y < tiles.GetLength(1); y++)
|
||||
@@ -68,13 +82,12 @@ namespace CalamityMod.Schematics
|
||||
}
|
||||
}
|
||||
|
||||
ushort oldWall = Main.tile[x + xOffset, y + yOffset].wall;
|
||||
Main.tile[x + xOffset, y + yOffset] = (Tile)tiles[x, y].Clone();
|
||||
|
||||
// If specified, preserve walls if they're not not being overrided and there's no active tile in its place.
|
||||
if (preserveWalls && Main.tile[x + xOffset, y + yOffset].wall == 0 && !Main.tile[x + xOffset, y + yOffset].active())
|
||||
if (preserveWalls && oldWalls[x, y] != 0)
|
||||
{
|
||||
Main.tile[x + xOffset, y + yOffset].wall = oldWall;
|
||||
Main.tile[x + xOffset, y + yOffset].wall = oldWalls[x, y];
|
||||
}
|
||||
|
||||
Rectangle placeInArea = new Rectangle(x, y, tiles.GetLength(0), tiles.GetLength(1));
|
||||
|
||||
@@ -64,16 +64,6 @@ namespace CalamityMod.Tiles.Astral
|
||||
|
||||
bool usingStarcore = Main.LocalPlayer.HasItem(ModContent.ItemType<Starcore>());
|
||||
|
||||
if (!NPC.downedAncientCultist)
|
||||
{
|
||||
string localizationKey = "Mods.CalamityMod.DeusAltarRejectText";
|
||||
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||
Main.NewText(Language.GetTextValue(localizationKey), FailColor);
|
||||
else if (Main.netMode == NetmodeID.Server)
|
||||
NetMessage.BroadcastChatMessage(NetworkText.FromKey(localizationKey), FailColor);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Main.dayTime)
|
||||
{
|
||||
string localizationKey = "Mods.CalamityMod.DeusAltarRejectNightText";
|
||||
|
||||
+32
-12
@@ -13,7 +13,7 @@ namespace CalamityMod.UI
|
||||
public int Page = 0;
|
||||
public int ArrowClickCooldown;
|
||||
public bool HoveringOverBook = false;
|
||||
public const int TotalLinesPerPage = 16;
|
||||
public int TotalLinesPerPage => (int)Math.Ceiling(16 * Main.screenHeight / 1440f - 1);
|
||||
public const int TextStartOffsetX = 40;
|
||||
public override void Update()
|
||||
{
|
||||
@@ -44,6 +44,8 @@ namespace CalamityMod.UI
|
||||
Vector2 scale = new Vector2(xScale, 1f) * new Vector2(Main.screenWidth, Main.screenHeight) / pageTexture.Size();
|
||||
scale *= 0.5f;
|
||||
|
||||
float xResolutionScale = Main.screenWidth / 2560f;
|
||||
float yResolutionScale = Main.screenHeight / 1440f;
|
||||
float bookScale = 0.75f;
|
||||
|
||||
scale *= bookScale;
|
||||
@@ -69,24 +71,38 @@ namespace CalamityMod.UI
|
||||
}
|
||||
}
|
||||
|
||||
string placeholderText = "This is placeholder text. Yell at the lore writers to make something for this that pertains to Draedon and Co.";
|
||||
string placeholderText = "A GOD DOES NOT FEAR DEATH ";
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
placeholderText += placeholderText;
|
||||
}
|
||||
|
||||
// Create text and arrows.
|
||||
if (FadeTime >= FadeTimeMax - 4 && Active)
|
||||
{
|
||||
int textWidth = (int)(xScale * 2 * pageTexture.Width) - TextStartOffsetX;
|
||||
textWidth = (int)(textWidth * Main.screenWidth / 2560f);
|
||||
textWidth = (int)(textWidth * xResolutionScale);
|
||||
List<string> dialogLines = Utils.WordwrapString(placeholderText, Main.fontMouseText, textWidth, 250, out _).ToList();
|
||||
dialogLines.RemoveAll(text => string.IsNullOrEmpty(text));
|
||||
|
||||
int totalPages = dialogLines.Count / (TotalLinesPerPage * 2 + 2);
|
||||
|
||||
// Ensure the page number doesn't become nonsensical as a result of a resolution change (such as by resizing the game).
|
||||
if (Page < 0)
|
||||
Page = 0;
|
||||
if (Page > totalPages)
|
||||
Page = totalPages;
|
||||
|
||||
// Draw arrows.
|
||||
if (Page > 0)
|
||||
{
|
||||
Texture2D pageArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrow");
|
||||
Vector2 bottomLeft = new Vector2(Main.screenWidth / 2 - pageTexture.Width * 2 - 36, yPageTop + pageTexture.Height + 32);
|
||||
Vector2 offset = new Vector2(-(int)(pageTexture.Width * xResolutionScale) * 2 - (int)(36 * xResolutionScale), (int)(pageTexture.Height * yResolutionScale) + (int)(52 * yResolutionScale));
|
||||
Vector2 bottomLeft = new Vector2(Main.screenWidth / 2, yPageTop);
|
||||
bottomLeft += offset;
|
||||
Rectangle arrowRectangle = new Rectangle((int)bottomLeft.X, (int)bottomLeft.Y, pageArrowTexture.Width, pageArrowTexture.Height);
|
||||
arrowRectangle.Width = (int)(arrowRectangle.Width * xResolutionScale);
|
||||
arrowRectangle.Height = (int)(arrowRectangle.Height * yResolutionScale);
|
||||
if (mouseRectangle.Intersects(arrowRectangle))
|
||||
{
|
||||
pageArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrowHover");
|
||||
@@ -104,15 +120,19 @@ namespace CalamityMod.UI
|
||||
Color.White,
|
||||
0f,
|
||||
Vector2.Zero,
|
||||
1f,
|
||||
new Vector2(xResolutionScale, yResolutionScale),
|
||||
SpriteEffects.FlipHorizontally,
|
||||
0f);
|
||||
}
|
||||
if (Page < totalPages)
|
||||
{
|
||||
Texture2D pageArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrow");
|
||||
Vector2 bottomRight = new Vector2(Main.screenWidth / 2 + pageTexture.Width * 2 + 10, yPageTop + pageTexture.Height + 32);
|
||||
Rectangle arrowRectangle = new Rectangle((int)bottomRight.X, (int)bottomRight.Y, pageArrowTexture.Width, pageArrowTexture.Height);
|
||||
Vector2 offset = new Vector2((int)(pageTexture.Width * xResolutionScale) * 2 + (int)(10 * xResolutionScale), (int)(pageTexture.Height * yResolutionScale) + (int)(52 * yResolutionScale));
|
||||
Vector2 bottomRight = new Vector2(Main.screenWidth / 2, yPageTop);
|
||||
bottomRight += offset;
|
||||
Rectangle arrowRectangle = new Rectangle((int)bottomRight.X, (int)bottomRight.Y, pageArrowTexture.Width, pageArrowTexture.Height); ;
|
||||
arrowRectangle.Width = (int)(arrowRectangle.Width * xResolutionScale);
|
||||
arrowRectangle.Height = (int)(arrowRectangle.Height * yResolutionScale);
|
||||
if (mouseRectangle.Intersects(arrowRectangle))
|
||||
{
|
||||
pageArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrowHover");
|
||||
@@ -130,7 +150,7 @@ namespace CalamityMod.UI
|
||||
Color.White,
|
||||
0f,
|
||||
Vector2.Zero,
|
||||
1f,
|
||||
new Vector2(xResolutionScale, yResolutionScale),
|
||||
SpriteEffects.None,
|
||||
0f);
|
||||
}
|
||||
@@ -144,12 +164,12 @@ namespace CalamityMod.UI
|
||||
bool onNextPage = i - startingLine > TotalLinesPerPage;
|
||||
if (dialogLines[i] != null)
|
||||
{
|
||||
int textDrawPositionX = Main.screenWidth / 2 - (int)((pageTexture.Width * 2) * Main.screenWidth / 2560f);
|
||||
int textDrawPositionY = (int)(50 + (i - startingLine) * 24 * Main.screenHeight / 1440f) + (int)yPageTop;
|
||||
int textDrawPositionX = (int)(Main.screenWidth / 2 - 50 * xResolutionScale) - (int)(pageTexture.Width * 2 * xResolutionScale);
|
||||
int textDrawPositionY = (int)(50 * yResolutionScale) + (i - startingLine) * 24 + (int)yPageTop;
|
||||
if (onNextPage)
|
||||
{
|
||||
textDrawPositionX = Main.screenWidth / 2 + (int)(TextStartOffsetX * 1.5 * Main.screenWidth / 2560f);
|
||||
textDrawPositionY = (int)(50 + (i - startingLine - (TotalLinesPerPage + 1)) * 24 * Main.screenHeight / 1440f) + (int)yPageTop;
|
||||
textDrawPositionX = (int)(Main.screenWidth / 2 + 16 * xResolutionScale) + (int)(TextStartOffsetX * 1.5 * xResolutionScale);
|
||||
textDrawPositionY = (int)(50 * yResolutionScale) + (i - startingLine - (TotalLinesPerPage + 1)) * 24 + (int)yPageTop;
|
||||
}
|
||||
|
||||
Color drawColor = Color.Lerp(Color.Cyan, Color.DarkCyan, (float)Math.Cos(i * 0.4) * 0.5f + 0.5f);
|
||||
|
||||
@@ -1606,18 +1606,29 @@ namespace CalamityMod.World
|
||||
if (CanAstralBiomeSpawn())
|
||||
{
|
||||
DoAstralConversion(new Point(i, j));
|
||||
int checkWidth = 70;
|
||||
float height = 9000;
|
||||
int checkWidth = 180;
|
||||
float averageHeight = 0f;
|
||||
float lowestHeight = 0f;
|
||||
for (int x = i - checkWidth / 2; x < i + checkWidth / 2; x++)
|
||||
{
|
||||
int y = j - 100;
|
||||
while (!CalamityUtils.ParanoidTileRetrieval(x, y).active())
|
||||
int y = j - 200;
|
||||
while (!CalamityUtils.ParanoidTileRetrieval(x, y).active() || CalamityUtils.ParanoidTileRetrieval(x, y).type == TileID.Trees)
|
||||
{
|
||||
y++;
|
||||
if (y > j - 10)
|
||||
break;
|
||||
}
|
||||
height = (int)MathHelper.Min(height, y);
|
||||
lowestHeight = (int)MathHelper.Max(lowestHeight, y);
|
||||
averageHeight += y;
|
||||
}
|
||||
SchematicPlacementHelpers.PlaceStructure("Astral Beacon", new Point(i, (int)height - 30), SchematicPlacementHelpers.PlacementAnchorType.Center);
|
||||
lowestHeight -= 36f;
|
||||
averageHeight /= checkWidth;
|
||||
float height = lowestHeight;
|
||||
|
||||
// If there's a sudden change between the average and lowest height (which is indicative of holes/chasms), go with the average.
|
||||
if (Math.Abs(lowestHeight - averageHeight) > 50f)
|
||||
height = averageHeight;
|
||||
SchematicPlacementHelpers.PlaceStructure("Astral Beacon", new Point(i, (int)height - 20), SchematicPlacementHelpers.PlacementAnchorType.Center);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user