Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions CalPlayer/CalamityPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,6 @@ public enum FishingMinigames

#endregion

#region Speedrun Timer
// The Calamity Speedrun Timer uses the highest precision timing available to .NET and thus to the system hardware.
// Current session time is maintained by CalamityMod.SpeedrunTimer, which is a C# Stopwatch running constantly while a player is loaded.
// Total time is calculated on demand by adding the current stopwatch time to the previous session total.
// This allows time to be tracked accurately through multiple save and quits.
internal TimeSpan previousSessionTotal;
internal int lastSplitType = -1;
internal TimeSpan lastSplit;
#endregion

#region Tile Entity Trackers
public int CurrentlyViewedFactoryID = -1;
public int CurrentlyViewedChargerID = -1;
Expand Down Expand Up @@ -1928,10 +1918,6 @@ public override void SaveData(TagCompound tag)
boost.AddWithCondition("HasTalkedAtCodebreaker", HasTalkedAtCodebreaker);
boost.AddWithCondition("HasCraftedDraedonsForge", HasCraftedDraedonsForge);

// Calculate the new total time of all sessions at the instant of this player save.
TimeSpan newSessionTotal = previousSessionTotal.Add(SpeedrunTimerSystem.Elapsed);
long totalTicks = newSessionTotal.Ticks;

// Save all cooldowns which are marked as persisting through save/load.
TagCompound cooldownsTag = new TagCompound();
var cdIterator = cooldowns.GetEnumerator();
Expand Down Expand Up @@ -1959,9 +1945,6 @@ public override void SaveData(TagCompound tag)
tag["moveSpeedBonus"] = moveSpeedBonus;
tag["defenseDamage"] = totalDefenseDamage;
tag["defenseDamageRecoveryFrames"] = defenseDamageRecoveryFrames;
tag["totalSpeedrunTicks"] = totalTicks;
tag["lastSplitType"] = lastSplitType;
tag["lastSplitTicks"] = lastSplit.Ticks;
tag["cooldowns"] = cooldownsTag;
tag["SeenDraedonDialogs"] = SeenDraedonDialogs;
}
Expand Down Expand Up @@ -2050,13 +2033,6 @@ public override void LoadData(TagCompound tag)
if (totalDefenseDamageRecoveryFrames <= 0)
totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime;

// Load the previous total elapsed time to know where to start the timer when it starts.
long ticks = tag.GetLong("totalSpeedrunTicks");
previousSessionTotal = new TimeSpan(ticks);
// Also load the last split, so it will show up.
lastSplitType = tag.GetInt("lastSplitType");
ticks = tag.GetLong("lastSplitTicks");
lastSplit = new TimeSpan(ticks);
SeenDraedonDialogs = tag.GetList<ulong>("SeenDraedonDialogs").ToList();

// Clear the player's cooldowns in preparation for loading.
Expand Down Expand Up @@ -6135,7 +6111,6 @@ internal void rollBabSpears(int randAmt, bool chaseable)
private static int startMessageDisplayDelay = -1;

// Triggers effects that must occur when the player enters the world. This sends a bunch of packets in multiplayer.
// It also starts the speedrun timer if applicable.
public override void OnEnterWorld()
{
if (CalamityClientConfig.Instance.StutterFix)
Expand All @@ -6144,11 +6119,6 @@ public override void OnEnterWorld()
if (Main.netMode == NetmodeID.MultiplayerClient)
EnterWorldSync();

// Enabling the config while a player is loaded will show the timer immediately.
// But it won't start running until you save and quit and re-enter a world.
if (CalamityClientConfig.Instance.SpeedrunTimer)
SpeedrunTimerSystem.Restart();

bool showWikiMessage = CalamityClientConfig.Instance.WikiStatusMessage;
bool showVCMMMessage = CalamityClientConfig.Instance.VCMMStatusMessage && !ExternalMods.VCMMAvailable;
bool showStartupMessages = showWikiMessage || showVCMMMessage;
Expand Down
16 changes: 0 additions & 16 deletions CalamityConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ internal void ClampValues(StreamingContext context)
[DefaultValue(2f)]
public float RipperMeterShake { get; set; }

[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(false)]
public bool SpeedrunTimer { get; set; }

[BackgroundColor(192, 54, 64, 192)]
[DefaultValue(true)]
public bool FlightBar { get; set; }
Expand Down Expand Up @@ -215,18 +211,6 @@ internal void ClampValues(StreamingContext context)
[DefaultValue(RipperUI.DefaultAdrenPosY)]
public float AdrenalineMeterPosY { get; set; }

[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 100f)]
[DefaultValue(SpeedrunTimerUI.DefaultTimerPosX)]
public float SpeedrunTimerPosX { get; set; }

[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 100f)]
[DefaultValue(SpeedrunTimerUI.DefaultTimerPosY)]
public float SpeedrunTimerPosY { get; set; }

[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0f, 100f)]
Expand Down
28 changes: 0 additions & 28 deletions Localization/en-US/Mods.CalamityMod.Configs.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -256,34 +256,6 @@ CalamityClientConfig: {
Tooltip: Adds an icon that appears over Town NPCs when they have new items in their shops.
}

SpeedrunTimer: {
Label: "[i:Stopwatch] Display Speedrun Timer"
Tooltip:
'''
Enables an in-game speedrun timer which shows in-game time down to the millisecond.
A second line displays the time of your most recent boss kill.
The time is tracked per player and only counts time while loaded into a world.
'''
}

SpeedrunTimerPosX: {
Label: "[i:LaserRuler] Speedrun Timer X Position"
Tooltip:
'''
The X position of the Speedrun Timer, measured as a % of your screen width.
The meter can be dragged with the mouse if Lock Meter Positions is disabled.
'''
}

SpeedrunTimerPosY: {
Label: "[i:LaserRuler] Speedrun Timer Y Position"
Tooltip:
'''
The Y position of the Speedrun Timer, measured as a % of your screen height.
The meter can be dragged with the mouse if Lock Meter Positions is disabled.
'''
}

StealthInvisibility: {
Label: "[i:CalamityMod/StealthHairDye] Stealth Invisibility"
Tooltip:
Expand Down
39 changes: 39 additions & 0 deletions Localization/en-US/Mods.CalamityMod.Misc.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,42 @@ GFBRougeUppercase: Rouge
GFBRogueLowercase: rogue
GFBRougeLowercase: rouge
HotkeyNotBound: "[None]"

SpeedrunDisplay: {
DesertScourge: DS
Crabulon: Crab
HiveMind: Hive
Perforators: Perfs
SlimeGod: SG
Cryogen: Cryogen
AquaticScourge: AS
BrimstoneElemental: Brimmy
CalamitasClone: CalClone
Leviathan: Levi
AstrumAureus: Aureus
PlaguebringerGoliath: PBG
Ravager: Rav
AstrumDeus: Deus
ProfanedGuardians: PG
Dragonfolly: Folly
Providence: Provi
CeaselessVoid: CV
StormWeaver: SW
Signus: Signus
Polterghast: Polter
OldDuke: OD
DevourerOfGods: DoG
Yharon: Yharon
SupremeCalamitas: SCal
ExoMechs: Exos
PrimordialWyrm: Wyrm
Cynosure: Cynosure
AllCalamityBosses: All Bosses

DoGPumpkinMoon: PumpMoon2
DoGFrostMoon: FrostMoon2
DoGEclipse: Eclipse2

CalamityCynosure: Calamity: Cynosure
CalamityAllBosses: Calamity: All Bosses
}
4 changes: 4 additions & 0 deletions ModSupport/ExternalMods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public sealed class ExternalMods : ModSystem
internal static Mod redemption = null;
internal static Mod remnants = null;
internal static Mod soa = null;
internal static Mod speedrunDisplay = null;
internal static Mod subworldLibrary = null;
internal static Mod summonersAssociation = null;
internal static Mod thorium = null;
Expand Down Expand Up @@ -66,6 +67,8 @@ public override void Load()
ModLoader.TryGetMod("Remnants", out remnants);
soa = null;
ModLoader.TryGetMod("SacredTools", out soa);
speedrunDisplay = null;
ModLoader.TryGetMod("SpeedrunDisplay", out speedrunDisplay);
subworldLibrary = null;
ModLoader.TryGetMod("SubworldLibrary", out subworldLibrary);
summonersAssociation = null;
Expand Down Expand Up @@ -96,6 +99,7 @@ public override void Unload()
redemption = null;
remnants = null;
soa = null;
speedrunDisplay = null;
subworldLibrary = null;
summonersAssociation = null;
thorium = null;
Expand Down
Loading