Rework MapValidator + add human readable format

This commit is contained in:
Beu
2024-02-18 18:00:52 +01:00
parent 652bd5fe1a
commit 55c5952258
6 changed files with 185 additions and 114 deletions

View File

@ -0,0 +1,30 @@
#if MP4
CGameCtnEditorFree@ getEditor() {
return cast<CGameCtnEditorFree>(GetApp().Editor);
}
CGameCtnChallenge@ getMap() {
return cast<CGameCtnChallenge>(GetApp().RootMap);;
}
uint getAuthorTime(CGameCtnChallenge@ _Map) {
return _Map.TMObjective_AuthorTime;
}
void setAuthorTime(CGameCtnChallenge@ _Map, uint _AuthorTime) {
_Map.TMObjective_AuthorTime = _AuthorTime;
// Remove the map UID, the game will generate it again when saving
_Map.IdName = "";
}
void setValidationStatus(CGameCtnEditorFree@ _Editor) {
CGameEditorPluginMapMapType@ pluginmaptype = cast<CGameEditorPluginMapMapType>(_Editor.PluginMapType);
if (pluginmaptype is null) return;
pluginmaptype.ValidationStatus = CGameEditorPluginMapMapType::EValidationStatus::Validated;
}
string GetWarning() {
return "";
}
#endif

View File

@ -0,0 +1,27 @@
#if TMNEXT
CGameCtnEditorFree@ getEditor() {
return cast<CGameCtnEditorFree>(GetApp().Editor);
}
CGameCtnChallenge@ getMap() {
return cast<CGameCtnChallenge>(GetApp().RootMap);;
}
uint getAuthorTime(CGameCtnChallenge@ _Map) {
return _Map.TMObjective_AuthorTime;
}
void setAuthorTime(CGameCtnChallenge@ _Map, uint _AuthorTime) {
_Map.TMObjective_AuthorTime = _AuthorTime;
}
void setValidationStatus(CGameCtnEditorFree@ _Editor) {
CGameEditorPluginMapMapType@ pluginmaptype = cast<CGameEditorPluginMapMapType>(_Editor.PluginMapType);
if (pluginmaptype is null) return;
pluginmaptype.ValidationStatus = CGameEditorPluginMapMapType::EValidationStatus::Validated;
}
string GetWarning() {
return "";
}
#endif

View File

@ -0,0 +1,30 @@
#if TURBO
CGameCtnEditorFree@ getEditor() {
return cast<CGameCtnEditorFree>(GetApp().Editor);
}
CGameCtnChallenge@ getMap() {
return cast<CGameCtnChallenge>(GetApp().Challenge);
}
uint getAuthorTime(CGameCtnChallenge@ _Map) {
return _Map.TMObjective_AuthorTime;
}
void setAuthorTime(CGameCtnChallenge@ _Map, uint _AuthorTime) {
_Map.TMObjective_AuthorTime = _AuthorTime;
// Remove the map UID, the game will generate it again when saving
_Map.IdName = "";
}
void setValidationStatus(CGameCtnEditorFree@ _Editor) {
CGameCtnEditorPluginMapType@ pluginmaptype = cast<CGameCtnEditorPluginMapType>(_Editor.EditorMapType);
if (pluginmaptype is null) return;
pluginmaptype.ValidationStatus = CGameCtnEditorPluginMapType::EValidationStatus::Validated;
}
string GetWarning() {
return "Note: your map must have a start and a finish\n(or a multilap + 1CP) to be validated with the plugin";
}
#endif

View File

@ -0,0 +1,32 @@
#if UNITED
CTrackManiaEditor@ getEditor() {
return cast<CTrackManiaEditor>(cast<CTrackMania>(GetApp()).Editor);
}
CGameCtnChallenge@ getMap() {
return cast<CGameCtnChallenge>(GetApp().Challenge);
}
uint getAuthorTime(CGameCtnChallenge@ _Map) {
return _Map.ChallengeParameters.AuthorTime;
}
void setAuthorTime(CGameCtnChallenge@ _Map, uint _AuthorTime) {
_Map.ChallengeParameters.AuthorTime = _AuthorTime;
_Map.ChallengeParameters.AuthorScore = _AuthorTime;
_Map.ChallengeParameters.GoldTime = Math::Floor((1000 + _AuthorTime + _AuthorTime * 0.06)/1000)*1000;
_Map.ChallengeParameters.SilverTime = Math::Floor((1000 + _AuthorTime + _AuthorTime * 0.2)/1000)*1000;
_Map.ChallengeParameters.BronzeTime = Math::Floor((1000 + _AuthorTime + _AuthorTime * 0.5)/1000)*1000;
// Remove the map UID, the game will generate it again when saving
_Map.IdName = "";
}
void setValidationStatus(CTrackManiaEditor@ _Editor) {
return; // doesn't exists in UNITED
}
string GetWarning() {
return "Note: for an unknown reason, it happens that the times of\nthe medals are not updated, I invite you to check by yourself";
}
#endif