#pragma name "Map of DOM control points" #pragma description "Normally the HUD in Domination shows all control point (state)s in a single row. This mutator instead displays them in a minimap based on their positions relative to each other." bool ShowCustomHUD = false; bool GenerateCustomHUD = true; array ControlPointX, ControlPointY; void onLevelLoad() { if (!GenerateCustomHUD) //PublicClass::CustomMap already called return; uint controlPointCount = 0; for (int x = jjLayerWidth[4]; --x >= 0;) for (int y = jjLayerHeight[4]; --y >= 0;) { const auto difficulty = jjParameterGet(x,y, -4, 2); if (difficulty == 1 || difficulty == 2 || jjEventGet(x,y) == OBJECT::CTFBASE) controlPointCount += 1; } if (ShowCustomHUD = controlPointCount > 1) { float minX = 1024 * 32, minY = 1024 * 32, maxX = 0, maxY = 0; for (uint i = 0; i < controlPointCount; ++i) { const jjCONTROLPOINT@ point = jjControlPoints[i]; if (point.xPos < minX) minX = point.xPos; if (point.yPos < minY) minY = point.yPos; if (point.xPos > maxX) maxX = point.xPos; if (point.yPos > maxY) maxY = point.yPos; } maxX -= minX; maxY -= minY; const auto maxMax = maxX > maxY ? maxX : maxY; const float pixelSize = float(controlPointCount * 5); for (uint i = 0; i < controlPointCount; ++i) { const jjCONTROLPOINT@ point = jjControlPoints[i]; ControlPointX.insertLast(45 + int((point.xPos - minX) * pixelSize / maxMax)); ControlPointY.insertLast(75 + int((point.yPos - minY) * pixelSize / maxMax)); } } } #include "DomMapShared.asc" class PublicClass : DomMapInterface { string getVersion() const { return "1.0"; } void CustomMapOff() { ShowCustomHUD = false; GenerateCustomHUD = false; } void CustomMap(const array& x, const array& y) { ShowCustomHUD = true; GenerateCustomHUD = false; ControlPointX.resize(0); ControlPointY.resize(0); for (uint i = 0; i < x.length; ++i) { ControlPointX.insertLast(45 + x[i]); ControlPointY.insertLast(75 + y[i]); } } } PublicClass PublicInstance; PublicClass@ onGetPublicInterface() { return PublicInstance; } const array Pipes = {"|||", "||", "|", "||||"}; bool onDrawGameModeHUD(jjPLAYER@, jjCANVAS@ canvas) { if (ShowCustomHUD && jjGameCustom == GAME::DOM) { int y = 12; int x = 4; for (uint i = 0, numberOfTeamScoresDrawn = 0; i < 4; i++) { if (jjEnabledTeams[i]) { canvas.drawString(x, y, Pipes[i] + jjTeamScore[TEAM::Color(i)] + "/" + jjMaxScore, STRING::MEDIUM); if(++numberOfTeamScoresDrawn != 2) { y += 24; } else { x += 100; y = 12; } } } canvas.drawString(4, 75, "§1CPs: "); for (uint i = 0; i < ControlPointX.length; ++i) { const int teamID = jjControlPoints[i].controlTeam; if (teamID == TEAM::NEUTRAL) canvas.drawString(ControlPointX[i], ControlPointY[i], "x", STRING::SMALL, STRING::DARK); else canvas.drawString(ControlPointX[i], ControlPointY[i], Pipes[teamID] + "o"); } return true; } return false; }