Skip to content

Commit c2c367b

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 298d503 + da332b3 commit c2c367b

25 files changed

+1786
-469
lines changed

src/TSMapEditor/Config/Default/UI/Windows/FindWaypointWindow.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ $Text=translate(Waypoint:)
2222
$X=getRight(lblWaypoint) + HORIZONTAL_SPACING
2323
$Width=getWidth(FindWaypointWindow) - getX(tbWaypoint) - EMPTY_SPACE_SIDES
2424
$Y=getY(lblWaypoint) - 1
25+
EnterPressControl=btnFind
2526

2627
[btnFind]
2728
$Width=100

src/TSMapEditor/Config/Default/UI/Windows/ScriptsWindow.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $CC10=tbName:EditorTextBox
1515
$CC11=lblScriptColor:XNALabel
1616
$CC12=ddScriptColor:XNADropDown
1717
$CC13=lblActions:XNALabel
18-
$CC14=lbActions:EditorListBox
18+
$CC14=lbActions:ScriptActionListBox
1919
$CC15=btnAddAction:EditorButton
2020
$CC16=btnMoveUp:EditorButton
2121
$CC17=btnMoveDown:EditorButton

src/TSMapEditor/Config/Default/UI/Windows/SettingsPanel.ini

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ $CC11=chkBorderless:XNACheckBox
1616
$CC12=chkUseBoldFont:XNACheckBox
1717
$CC13=chkGraphicsLevel:XNACheckBox
1818
$CC14=chkSmartScriptActionCloning:XNACheckBox
19-
$CC15=lblTextEditorPath:XNALabel
20-
$CC16=tbTextEditorPath:EditorTextBox
19+
$CC15=chkSmartScriptDefaultValues:XNACheckBox
20+
$CC16=chkQuickTriggerParameterSelection:XNACheckBox
21+
$CC17=lblTextEditorPath:XNALabel
22+
$CC18=tbTextEditorPath:EditorTextBox
2123
; $Height=getBottom(tbTextEditorPath) + EMPTY_SPACE_BOTTOM
2224

2325
[lblHeader]
@@ -96,9 +98,19 @@ $X=EMPTY_SPACE_SIDES
9698
$Y=getBottom(chkGraphicsLevel) + VERTICAL_SPACING
9799
$Text=translate(Smart Script Action Cloning)
98100

101+
[chkSmartScriptDefaultValues]
102+
$X=EMPTY_SPACE_SIDES
103+
$Y=getBottom(chkSmartScriptActionCloning) + VERTICAL_SPACING
104+
$Text=translate(Smart Script Default Values)
105+
106+
[chkQuickTriggerParameterSelection]
107+
$X=EMPTY_SPACE_SIDES
108+
$Y=getBottom(chkSmartScriptDefaultValues) + VERTICAL_SPACING
109+
$Text=translate(Quick Trigger Parameter Selection)
110+
99111
[lblTextEditorPath]
100112
$X=EMPTY_SPACE_SIDES
101-
$Y=getBottom(chkSmartScriptActionCloning) + EMPTY_SPACE_TOP
113+
$Y=getBottom(chkQuickTriggerParameterSelection) + EMPTY_SPACE_TOP
102114
$Text=translate(Text Editor Path:)
103115

104116
[tbTextEditorPath]
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
// Script for listing unused scripting elements
2+
3+
// Using clauses.
4+
// Unless you know what's in the WAE code-base, you want to always include
5+
// these "standard usings".
6+
using System;
7+
using System.Globalization;
8+
using System.Text;
9+
using TSMapEditor.CCEngine;
10+
using TSMapEditor.Models;
11+
using TSMapEditor.Models.Enums;
12+
13+
namespace WAEScript
14+
{
15+
public class ListUnusedScriptingElements
16+
{
17+
/// <summary>
18+
/// Returns the description of this script.
19+
/// All scripts must contain this function.
20+
/// </summary>
21+
public string GetDescription() => "This script lists unused scripting elements." + Environment.NewLine + Environment.NewLine +
22+
"Unintentionally unused scripting elements might point to the map's scripting having a bug." + Environment.NewLine + Environment.NewLine +
23+
"Do you want to continue?";
24+
25+
/// <summary>
26+
/// Returns the message that is presented to the user if running this script succeeded.
27+
/// All scripts must contain this function.
28+
/// </summary>
29+
public string GetSuccessMessage()
30+
{
31+
if (sb.Length == 0)
32+
{
33+
return "The map has no unused scripting elements.";
34+
}
35+
36+
return "The map has the following unused scripting elements: " + Environment.NewLine + Environment.NewLine + sb.ToString();
37+
}
38+
39+
private StringBuilder sb;
40+
41+
private bool TriggerReferencesTeamType(Map map, TeamType teamType, Trigger trigger)
42+
{
43+
foreach (var action in trigger.Actions)
44+
{
45+
TriggerActionType triggerActionType = map.EditorConfig.TriggerActionTypes[action.ActionIndex];
46+
47+
for (int i = 0; i < triggerActionType.Parameters.Length; i++)
48+
{
49+
if (triggerActionType.Parameters[i].TriggerParamType == TriggerParamType.TeamType && action.Parameters[i] == teamType.ININame)
50+
{
51+
return true;
52+
}
53+
}
54+
}
55+
56+
return false;
57+
}
58+
59+
private bool TriggerReferencesLocalVariable(Map map, LocalVariable localVariable, Trigger trigger)
60+
{
61+
foreach (var action in trigger.Actions)
62+
{
63+
TriggerActionType triggerActionType = map.EditorConfig.TriggerActionTypes[action.ActionIndex];
64+
65+
for (int i = 0; i < triggerActionType.Parameters.Length; i++)
66+
{
67+
if (triggerActionType.Parameters[i].TriggerParamType == TriggerParamType.LocalVariable &&
68+
action.Parameters[i] == localVariable.Index.ToString(CultureInfo.InvariantCulture))
69+
{
70+
return true;
71+
}
72+
}
73+
}
74+
75+
return false;
76+
}
77+
78+
private bool ScriptReferencesLocalVariable(Map map, LocalVariable localVariable, Script script)
79+
{
80+
foreach (var scriptActionEntry in script.Actions)
81+
{
82+
ScriptAction scriptAction = map.EditorConfig.ScriptActions[scriptActionEntry.Action];
83+
84+
if (scriptAction.ParamType == TriggerParamType.LocalVariable)
85+
{
86+
if (scriptActionEntry.Argument == localVariable.Index)
87+
{
88+
return true;
89+
}
90+
}
91+
}
92+
93+
return false;
94+
}
95+
96+
/// <summary>
97+
/// The function that actually does the magic.
98+
/// </summary>
99+
/// <param name="map">Map argument that allows us to access map data.</param>
100+
public void Perform(Map map)
101+
{
102+
sb = new StringBuilder();
103+
104+
foreach (var taskforce in map.TaskForces)
105+
{
106+
if (!map.TeamTypes.Exists(tt => tt.TaskForce == taskforce))
107+
sb.Append($"- TaskForce \"{taskforce.Name}\"" + Environment.NewLine);
108+
}
109+
110+
foreach (var script in map.Scripts)
111+
{
112+
if (!map.TeamTypes.Exists(tt => tt.Script == script))
113+
sb.Append($"- Script \"{script.Name}\"" + Environment.NewLine);
114+
}
115+
116+
foreach (var teamtype in map.TeamTypes)
117+
{
118+
if (!map.AITriggerTypes.Exists(aitt => aitt.PrimaryTeam == teamtype || aitt.SecondaryTeam == teamtype) &&
119+
!map.Triggers.Exists(trigger => TriggerReferencesTeamType(map, teamtype, trigger)))
120+
{
121+
sb.Append($"- TeamType \"{teamtype.Name}\"" + Environment.NewLine);
122+
}
123+
}
124+
125+
foreach (var localVariable in map.LocalVariables)
126+
{
127+
if (!map.Triggers.Exists(trigger => TriggerReferencesLocalVariable(map, localVariable, trigger)) &&
128+
!map.Scripts.Exists(script => ScriptReferencesLocalVariable(map, localVariable, script)))
129+
{
130+
sb.Append($"- Local variable \"{localVariable.Name}\"" + Environment.NewLine);
131+
}
132+
}
133+
}
134+
}
135+
}

src/TSMapEditor/Config/Translations/en/Translation_en.ini

Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ SettingsPanel.chkBorderless.Text=Start In Borderless Mode
4848
SettingsPanel.chkUseBoldFont.Text=Use Bold Font
4949
SettingsPanel.chkGraphicsLevel.Text=Enhanced Graphical Quality
5050
SettingsPanel.chkSmartScriptActionCloning.Text=Smart Script Action Cloning
51+
SettingsPanel.chkSmartScriptDefaultValues.Text=Smart Script Default Values
52+
SettingsPanel.chkQuickTriggerParameterSelection.Text=Quick Trigger Parameter Selection
5153
SettingsPanel.lblTextEditorPath.Text=Text Editor Path:
5254
SettingsPanel.ScrollRateFastest=Fastest
5355
SettingsPanel.ScrollRateFaster=Faster
@@ -113,27 +115,38 @@ Map.CheckForIssues.DuplicateHouseININame=The map has multiple houses named "{0}"
113115
Map.CheckForIssues.TeamTypeWithoutTaskForce=TeamType "{0}" has no TaskForce set!
114116
Map.CheckForIssues.TeamTypeWithoutScript=TeamType "{0}" has no Script set!
115117
Map.CheckForIssues.ScriptTooManyActions="Script '{0}' has more than {1} actions, which is not supported by the game. Consider organizing your script actions or splitting it to multiple scripts."
116-
CheckForIssues.TriggerDisabled=Trigger "{0}" ({1}) is disabled and never enabled by another trigger.@Did you forget to enable it? If the trigger exists for debugging purposes, add DEBUG or OBSOLETE to its name to skip this warning.
117-
CheckForIssues.TriggerEnabledByOtherTriggers=Trigger "{0}" ({1}) is enabled by another trigger, but it is never in a disabled state@(it is neither disabled by default nor disabled by other triggers). Did you forget to disable it?
118-
CheckForIssues.TriggerEnableSelf=Trigger "{0}" ({1}) has an action for enabling itself. Is it supposed to enable something else instead?
119-
CheckForIssues.PlayerHouseNotFound=A nonexistent house has been specified in [Basic] Player= .
120-
CheckForIssues.PlayerHouseNotPlayerControlled=The human player's house does not have the "Player-Controlled" flag checked.
121-
CheckForIssues.MaxTubesExceeded=The map has more than {0} tunnel tubes. This might cause issues when units cross the tunnels.
122-
CheckForIssues.UnitFollowsMultipleUnits=Multiple units are configured to make unit {0} at {1} to follow them!@This can cause strange behaviour in the game. {2} at {3} is one of the followed units.
123-
CheckForIssues.NegativeFollowerID=Unit {0} at {1} has a follower ID below -1. It is unknown how the game reacts to this.
124-
CheckForIssues.UnitFollowSelf=Unit {0} at {1} follows itself! This can cause the game to crash or freeze!
125-
CheckForIssues.NoTriggerConditions=Trigger '{0}' has 0 events specified. It will never be fired. Did you forget to give it events?
126-
CheckForIssues.NoTriggerActions=Trigger '{0}' has 0 actions specified. It will not do anything. Did you forget to give it actions?
127-
CheckForIssues.TriggerEnteredByNoObjects=Trigger '{0}' is using the "Entered by..." event without being attached to any object, cell, or team. Did you forget to attach it?
128-
CheckForIssues.TriggerBridgeDestroyedNoCellTags=Trigger '{0}' is using the "Bridge destroyed" event, but it is not attached to any CellTag. Did you forget to place a celltag for it?
129-
CheckForIssues.TriggerEventNoObjectAttached=Trigger '{0}' is using the {1} event without being attached to any object or team. Did you forget to attach it?
130-
CheckForIssues.TriggerAttachedToSelf=Trigger '{0}' is attached to itself (potentially through other triggers). This will cause the game to crash!
131-
CheckForIssues.InvalidTriggerActionTeamType=Trigger '{0}' has a nonexistent TeamType specified as a parameter for one or more of its actions.
132-
CheckForIssues.InvalidTriggerActionHouse=Trigger '{0}' has a nonexistent HouseType specified as a parameter for one or more of its actions.
133-
CheckForIssues.InvalidTriggerOwner=Trigger '{0}' has a nonexistent HouseType '{1}' specified as its owner.
134-
CheckForIssues.TriggerTooManyActions=Trigger '{0}' has more than {1} actions! This can cause the game to crash! Consider splitting it up to multiple triggers.
135-
CheckForIssues.SpecialWaypointUsed=The map makes use of waypoint #{0}. In Tiberian Sun, this waypoint is reserved for special use cases (WAYPT_SPECIAL). Using it as a normal waypoint may cause issues as it may be dynamically moved by game events.
136-
CheckForAITriggerTeamWithMaxZeroIssue.TeamTypeMax=Team '{0}', linked to AITrigger '{1}', has Max=0. This prevents the AI from building the team.
118+
Map.CheckForIssues.TriggerDisabled=Trigger "{0}" ({1}) is disabled and never enabled by another trigger.@Did you forget to enable it? If the trigger exists for debugging purposes, add DEBUG or OBSOLETE to its name to skip this warning.
119+
Map.CheckForIssues.TriggerEnabledByOtherTriggers=Trigger "{0}" ({1}) is enabled by another trigger, but it is never in a disabled state@(it is neither disabled by default nor disabled by other triggers). Did you forget to disable it?
120+
Map.CheckForIssues.TriggerEnableSelf=Trigger "{0}" ({1}) has an action for enabling itself. Is it supposed to enable something else instead?
121+
Map.CheckForIssues.PlayerHouseNotFound=A nonexistent house has been specified in [Basic] Player= .
122+
Map.CheckForIssues.PlayerHouseNotPlayerControlled=The human player's house does not have the "Player-Controlled" flag checked.
123+
Map.CheckForIssues.MaxTubesExceeded=The map has more than {0} tunnel tubes. This might cause issues when units cross the tunnels.
124+
Map.CheckForIssues.UnitFollowsMultipleUnits=Multiple units are configured to make unit {0} at {1} to follow them!@This can cause strange behaviour in the game. {2} at {3} is one of the followed units.
125+
Map.CheckForIssues.NegativeFollowerID=Unit {0} at {1} has a follower ID below -1. It is unknown how the game reacts to this.
126+
Map.CheckForIssues.UnitFollowSelf=Unit {0} at {1} follows itself! This can cause the game to crash or freeze!
127+
Map.CheckForIssues.NoTriggerConditions=Trigger '{0}' has 0 events specified. It will never be fired. Did you forget to give it events?
128+
Map.CheckForIssues.NoTriggerActions=Trigger '{0}' has 0 actions specified. It will not do anything. Did you forget to give it actions?
129+
Map.CheckForIssues.TriggerEnteredByNoObjects=Trigger '{0}' is using the "Entered by..." event without being attached to any object, cell, or team. Did you forget to attach it?
130+
Map.CheckForIssues.TriggerBridgeDestroyedNoCellTags=Trigger '{0}' is using the "Bridge destroyed" event, but it is not attached to any CellTag. Did you forget to place a celltag for it?
131+
Map.CheckForIssues.TriggerEventNoObjectAttached=Trigger '{0}' is using the {1} event without being attached to any object or team. Did you forget to attach it?
132+
Map.CheckForIssues.TriggerAttachedToSelf=Trigger '{0}' is attached to itself (potentially through other triggers). This will cause the game to crash!
133+
Map.CheckForIssues.InvalidTriggerActionTeamType=Trigger '{0}' has a nonexistent TeamType specified as a parameter for one or more of its actions.
134+
Map.CheckForIssues.InvalidTriggerActionHouse=Trigger '{0}' has a nonexistent HouseType specified as a parameter for one or more of its actions.
135+
Map.CheckForIssues.InvalidTriggerOwner=Trigger '{0}' has a nonexistent HouseType '{1}' specified as its owner.
136+
Map.CheckForIssues.TriggerTooManyActions=Trigger '{0}' has more than {1} actions! This can cause the game to crash! Consider splitting it up to multiple triggers.
137+
Map.CheckForIssues.SpecialWaypointUsed=The map makes use of waypoint #{0}. In Tiberian Sun, this waypoint is reserved for special use cases (WAYPT_SPECIAL). Using it as a normal waypoint may cause issues as it may be dynamically moved by game events.
138+
Map.CheckForAITriggerTeamWithMaxZeroIssue.TeamTypeMax=Team '{0}', linked to AITrigger '{1}', has Max=0. This prevents the AI from building the team.
139+
Map.CheckForIssues.MismatchedDifficultyForEnableTrigger=The trigger "{0}" has "{1}" as its difficulty level, but it enables a trigger "{2}" which has "{3}" as its difficulty.
140+
Map.CheckForIssues.MismatchedDifficultyForDisableTrigger=The trigger "{0}" has "{1}" as its difficulty level, but it disables a trigger "{2}" which has "{3}" as its difficulty.
141+
142+
; *************************************************
143+
; Difficulty
144+
; *************************************************
145+
146+
Difficulty.None=None
147+
Difficulty.Easy=Easy
148+
Difficulty.Medium=Medium
149+
Difficulty.Hard=Hard
137150

138151
; *************************************************
139152
; EditorMessageBox
@@ -313,9 +326,13 @@ MapView.DrawOnTileUnderCursor.NullTile=Null tile
313326
MapView.ExtractMegamapTo.Failure.Title=Failed to extract megamap
314327
MapView.ExtractMegamapTo.Failure.Description=Error encountered while attempting to extract megamap. Returned operating system error message: {0}
315328
MapUI.HotkeyHelp.Title=Hotkey Help
329+
UIManager.Loading.Title=Loading
330+
UIManager.Loading.Description=Please wait, loading map...
316331
UIManager.IssuesFound.Title=Issues Found
317332
UIManager.IssuesFound.Description=The map has been saved, but one or more issues have been found in the map. Please consider resolving them.@@{0}
318333
UIManager.LoadMapFailure.Title=Failed to open map
334+
UIManager.MapSaved=Map saved.
335+
UIManager.MapAutoSaved=Map auto-saved.
319336
WindowController.NoTriggerAttached.Title=No trigger attached
320337
WindowController.NoTriggerAttached.Description=The specified Tag has no attached Trigger!
321338
ListExtensions.TaskForceParseError=Failed to load TaskForce {0}. It might be missing a section or be otherwise invalid.
@@ -350,6 +367,14 @@ TileInfoDisplay.TerrainObjectInfo={0} ({1})
350367
TileInfoDisplay.Structure=Structure:\s
351368
TileInfoDisplay.TechnoInformation={0} ({1}), Owner:
352369
TileInfoDisplay.TechnoTag=Tag:
370+
TileInfoDisplay.Vehicle=Vehicle:\s
371+
TileInfoDisplay.TechnoMission=Mission: {0}
372+
TileInfoDisplay.TechnoFacing=Facing: {0}
373+
TileInfoDisplay.Infantry=Infantry:\s
374+
TileInfoDisplay.CellTag=CellTag:\s
375+
TileInfoDisplay.UsagesOfWaypoint=Usages of waypoint {0}:
376+
TileInfoDisplay.TriggerInWaypoint=trigger '{0}',\s
377+
TileInfoDisplay.ScriptInWaypoint=script '{0}',\s
353378

354379
; *************************************************
355380
; TopBarMenu
@@ -479,6 +504,12 @@ AITriggersWindow.lblMaximum.Text=Max.:
479504
AITriggersWindow.chkEnabledOnEasy.Text=Available on Easy
480505
AITriggersWindow.chkEnabledOnMedium.Text=Available on Medium
481506
AITriggersWindow.chkEnabledOnHard.Text=Available on Hard
507+
AITriggersWindow.tbFilter.Suggestion=Search AI trigger...
508+
AITriggersWindow.chkEnabled.Text=Enabled
509+
AITriggersWindow.SortByID=Sort by ID
510+
AITriggersWindow.SortByName=Sort by Name
511+
AITriggersWindow.SortByColor=Sort by Color
512+
AITriggersWindow.SortByColorName=Sort by Color, then by Name
482513
AITriggersWindow.Actions.Advanced=Advanced...
483514
AITriggersWindow.Actions.CloneForEasierDiffs=Clone for Easier Difficulties
484515
AITriggersWindow.CloneForEasierDiffs.Title=Are you sure?
@@ -999,6 +1030,7 @@ SelectTileSetWindow.btnSelect.Text=Select
9991030
SelectTriggerWindow.lblDescription.Text=Select Trigger:
10001031
SelectTriggerWindow.tbSearch.Suggestion=Search Trigger...
10011032
SelectTriggerWindow.btnSelect.Text=Select
1033+
SelectTriggerWindow.None=None
10021034

10031035
SelectTutorialLineWindow.lblDescription.Text=Select Text Line:
10041036
SelectTutorialLineWindow.tbSearch.Suggestion=Search Text Line...
@@ -1172,6 +1204,12 @@ TriggersWindow.CloneEvent=Clone Event
11721204
TriggersWindow.DeleteEvent=Delete Event
11731205
TriggersWindow.CloneAction=Clone Action
11741206
TriggersWindow.DeleteAction=Delete Action
1207+
TriggersWindow.CopyTrigger=Copy Trigger
1208+
TriggersWindow.PasteTrigger=Paste Trigger
1209+
TriggersWindow.CopyEvent=Copy Event
1210+
TriggersWindow.PasteEvent=Paste Event
1211+
TriggersWindow.CopyAction=Copy Action
1212+
TriggersWindow.PasteAction=Paste Action
11751213
TriggersWindow.SortByID=Sort by ID
11761214
TriggersWindow.SortByName=Sort by Name
11771215
TriggersWindow.SortByColor=Sort by Color
@@ -2283,4 +2321,14 @@ TriggerActionType.Enable Templated Text (Vinifera).Name=Enable Templated Text (V
22832321
TriggerActionType.Enable Templated Text (Vinifera).Description=Displays a line of text with variable substitution. Placeholders like {{g_variableName}} or {{l_variableName}} are replaced with global or local variable values. Color -1 uses the player's house color.
22842322
TriggerActionType.Disable Templated Text (Vinifera).Name=Disable Templated Text (Vinifera)
22852323
TriggerActionType.Disable Templated Text (Vinifera).Description=Removes the currently active templated text from the screen.
2324+
TriggerActionType.Adjust House Modifier (Vinifera).Name=Adjust House Modifier (Vinifera)
2325+
TriggerActionType.Adjust House Modifier (Vinifera).Description=Adjusts a house's stat modifier by given percentage.
2326+
TriggerActionType.Adjust House Modifier (Vinifera).Parameter1.NameOverride=Modifier
2327+
TriggerActionType.Adjust House Modifier (Vinifera).Parameter1.PresentOption0=0 Firepower
2328+
TriggerActionType.Adjust House Modifier (Vinifera).Parameter1.PresentOption1=1 Armor
2329+
TriggerActionType.Adjust House Modifier (Vinifera).Parameter1.PresentOption2=2 Groundspeed
2330+
TriggerActionType.Adjust House Modifier (Vinifera).Parameter1.PresentOption3=3 Airspeed
2331+
TriggerActionType.Adjust House Modifier (Vinifera).Parameter1.PresentOption4=4 Rate of Fire
2332+
TriggerActionType.Adjust House Modifier (Vinifera).Parameter1.PresentOption5=5 Cost
2333+
TriggerActionType.Adjust House Modifier (Vinifera).Parameter1.PresentOption6=6 Build Time
22862334

src/TSMapEditor/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace TSMapEditor
44
{
55
public static class Constants
66
{
7-
public const string ReleaseVersion = "1.7.5";
7+
public const string ReleaseVersion = "1.7.7";
88

99
public static int CellSizeX = 48;
1010
public static int CellSizeY = 24;

0 commit comments

Comments
 (0)