From 14378c4b8681cbd2976f2ca09d5e236a0b095b41 Mon Sep 17 00:00:00 2001 From: Beu Date: Thu, 24 Feb 2022 16:28:44 +0100 Subject: [PATCH] add united support --- MapValidator/Source/MapValidator.as | 40 +++++++++++++++++++++-------- MapValidator/info.toml | 4 +-- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/MapValidator/Source/MapValidator.as b/MapValidator/Source/MapValidator.as index 69a840f..f7b9089 100644 --- a/MapValidator/Source/MapValidator.as +++ b/MapValidator/Source/MapValidator.as @@ -6,31 +6,45 @@ int author_time; void Main() {} void validate(int author_time) { +#if UNITED + CTrackManiaEditor@ editor = cast(cast(GetApp()).Editor); +#else CGameCtnEditorFree@ editor = cast(GetApp().Editor); +#endif + #if TMNEXT || MP4 CGameCtnChallenge@ map = cast(GetApp().RootMap); CGameEditorPluginMapMapType@ pluginmaptype = cast(editor.PluginMapType); #elif TURBO CGameCtnChallenge@ map = cast(GetApp().Challenge); CGameCtnEditorPluginMapType@ pluginmaptype = cast(editor.EditorMapType); +#elif UNITED + CGameCtnChallenge@ map = cast(GetApp().Challenge); #endif if (editor is null) { return; } - if (pluginmaptype !is null) { #if TMNEXT || MP4 - pluginmaptype.ValidationStatus = CGameEditorPluginMapMapType::EValidationStatus::Validated; + pluginmaptype.ValidationStatus = CGameEditorPluginMapMapType::EValidationStatus::Validated; #elif TURBO - pluginmaptype.ValidationStatus = CGameCtnEditorPluginMapType::EValidationStatus::Validated; + pluginmaptype.ValidationStatus = CGameCtnEditorPluginMapType::EValidationStatus::Validated; #endif - - } + if (map !is null) { +#if UNITED + map.ChallengeParameters.AuthorTime = author_time; + map.ChallengeParameters.AuthorScore = author_time; + map.ChallengeParameters.GoldTime = Math::Floor((1000 + author_time + author_time * 0.06)/1000)*1000; + map.ChallengeParameters.SilverTime = Math::Floor((1000 + author_time + author_time * 0.2)/1000)*1000; + map.ChallengeParameters.BronzeTime = Math::Floor((1000 + author_time + author_time * 0.5)/1000)*1000; +#else map.TMObjective_AuthorTime = author_time; -#if MP4 || TURBO - map.IdName = ""; +#endif + +#if MP4 || TURBO || UNITED + map.IdName = ""; // Remove the map UID, the game will generate it again when saving #endif } } @@ -39,14 +53,16 @@ void Render() { if (!menu_visibility) { return; } - +#if UNITED + CTrackManiaEditor@ editor = cast(cast(GetApp()).Editor); +#else CGameCtnEditorFree@ editor = cast(GetApp().Editor); +#endif + #if TMNEXT || MP4 CGameCtnChallenge@ map = cast(GetApp().RootMap); - CGameEditorPluginMapMapType@ pluginmaptype = cast(editor.PluginMapType); -#elif TURBO +#elif TURBO || UNITED CGameCtnChallenge@ map = cast(GetApp().Challenge); - CGameCtnEditorPluginMapType@ pluginmaptype = cast(editor.EditorMapType); #endif UI::Begin("\\$cf9" + Icons::Flag + "\\$z Map Validator###MapValidator", menu_visibility, UI::WindowFlags::NoResize | UI::WindowFlags::AlwaysAutoResize | UI::WindowFlags::NoCollapse); @@ -70,6 +86,8 @@ void Render() { #if TURBO UI::Text("Note: your map must have a start and a finish\n(or a multilap + 1CP) to be validated with the plugin"); +#elif UNITED + UI::Text("Note: for an unknown reason, it happens that the times of\nthe medals are not updated, I invite you to check by yourself"); #endif } else { UI::Text("Open this plugin in the map editor"); diff --git a/MapValidator/info.toml b/MapValidator/info.toml index 49f2e22..54c2c78 100644 --- a/MapValidator/info.toml +++ b/MapValidator/info.toml @@ -4,9 +4,9 @@ author = "Beu" category = "Map Editor" siteid = 91 -version = "1.3" +version = "1.5" blocks = [ "Plugin_MapValidator" ] [script] -imports = [ "Icons.as" ] \ No newline at end of file +imports = [ "Icons.as" ]