trackeditor: add generating acc files

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9457 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: f836bbb3da002a35baba5ba85d478219af4d57ab
Former-commit-id: 8897919dd7435fd004a00f30e29a62f3f8cb33a5
This commit is contained in:
iobyte 2024-06-26 23:25:59 +00:00
parent 18ab5f1222
commit a22c00e42a
3 changed files with 194 additions and 28 deletions

View file

@ -131,7 +131,11 @@ public class EditorFrame extends JFrame
HelpAction helpAction = null;
ImportAction importAction = null;
ExportAction exportAction = null;
ExportACCAction accAction = null;
ExportACCWithRacelineAction accWithRacelineAction = null;
ExportAllAction allAction = null;
ExportAllACCAction allAccAction = null;
ExportAllACCWithRacelineAction allAccWithRacelineAction = null;
ExportAC3Action ac3Action = null;
ExportAC3E0Action ac3E0Action = null;
ExportAC3E1Action ac3E1Action = null;
@ -222,7 +226,11 @@ public class EditorFrame extends JFrame
private JMenu exportMenu = null;
private JMenuItem exportMenuItem = null;
private JMenuItem exportAllMenuItem = null;
private JMenuItem exportAllACCMenuItem = null;
private JMenuItem exportAllACCWithRacelineMenuItem = null;
private JMenuItem exportAC3MenuItem = null;
private JMenuItem exportACCMenuItem = null;
private JMenuItem exportACCWithRacelineMenuItem = null;
private JMenuItem exportAC3E0MenuItem = null;
private JMenuItem exportAC3E1MenuItem = null;
private JMenuItem exportAC3E2MenuItem = null;
@ -1543,6 +1551,11 @@ public class EditorFrame extends JFrame
exportMenu = new JMenu();
exportMenu.setText("Export");
exportMenu.add(getExportAllMenuItem());
exportMenu.add(getExportAllACCMenuItem());
exportMenu.add(getExportAllACCWithRacelineMenuItem());
exportMenu.addSeparator();
exportMenu.add(getExportACCMenuItem());
exportMenu.add(getExportACCWithRacelineMenuItem());
exportMenu.addSeparator();
exportMenu.add(getExportMenuItem());
exportMenu.add(getExportAC3MenuItem());
@ -1585,6 +1598,66 @@ public class EditorFrame extends JFrame
}
return exportAllMenuItem;
}
/**
* This method initializes exportAllACCMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getExportAllACCMenuItem()
{
if (exportAllACCMenuItem == null)
{
exportAllACCMenuItem = new JMenuItem();
exportAllACCMenuItem.setAction(allAccAction);
exportAllACCMenuItem.setIcon(null);
}
return exportAllACCMenuItem;
}
/**
* This method initializes exportAllACCWithRacelineMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getExportAllACCWithRacelineMenuItem()
{
if (exportAllACCWithRacelineMenuItem == null)
{
exportAllACCWithRacelineMenuItem = new JMenuItem();
exportAllACCWithRacelineMenuItem.setAction(allAccWithRacelineAction);
exportAllACCWithRacelineMenuItem.setIcon(null);
}
return exportAllACCWithRacelineMenuItem;
}
/**
* This method initializes exportAC3MenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getExportACCMenuItem()
{
if (exportACCMenuItem == null)
{
exportACCMenuItem = new JMenuItem();
exportACCMenuItem.setAction(accAction);
exportACCMenuItem.setIcon(null);
}
return exportACCMenuItem;
}
/**
* This method initializes exportACCWithRacelineMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getExportACCWithRacelineMenuItem()
{
if (exportACCWithRacelineMenuItem == null)
{
exportACCWithRacelineMenuItem = new JMenuItem();
exportACCWithRacelineMenuItem.setAction(accWithRacelineAction);
exportACCWithRacelineMenuItem.setIcon(null);
}
return exportACCWithRacelineMenuItem;
}
/**
* This method initializes exportAC3MenuItem
*
@ -2380,7 +2453,7 @@ public class EditorFrame extends JFrame
return jToolBar;
}
private void exportAc3d(String additionalArgs)
private void exportAc3d(String additionalArgs, boolean acc)
{
//check for graphic objects with same name
Vector<GraphicObject> graphicObjects = trackData.getGraphicObjects();
@ -2405,10 +2478,11 @@ public class EditorFrame extends JFrame
else
newArgs += " -B";
}
TrackgenPanel tg = new TrackgenPanel(this, newArgs);
TrackgenPanel tg = new TrackgenPanel(this, newArgs, acc);
tg.setModal(true);
tg.setVisible(true);
}
/**
*
*/
@ -2475,14 +2549,18 @@ public class EditorFrame extends JFrame
finishLineAction = new FinishLineAction("Finish Line", createNavigationIcon("Finish24"), "Finish Line.", KeyEvent.VK_S);
helpAction = new HelpAction("Help", createNavigationIcon("Help24"), "Help.", KeyEvent.VK_S);
/** ******************************************************************* */
allAction = new ExportAllAction("All", null, "Export both XML file and AC3 file.", null);
ac3Action = new ExportAC3Action("AC3", null, "Create AC3 file.", null);
ac3E0Action = new ExportAC3E0Action("AC3 with all elevation maps", null, "Create AC3 file and all elevation maps.", null);
ac3E1Action = new ExportAC3E1Action("AC3 with terrain and track elevation map", null, "Create AC3 file and terrain and track elevation map.", null);
ac3E2Action = new ExportAC3E2Action("AC3 with terrain and white track elevation map", null, "Create AC3 file and terrain and white track elevation map.", null);
ac3E3Action = new ExportAC3E3Action("AC3 with track elevation map", null, "Create AC3 file and track elevation map.", null);
ac3E4Action = new ExportAC3E4Action("AC3 with track with height steps elevation map", null, "Create AC3 file and track with height steps elevation map.", null);
ac3RacelineAction = new ExportAC3RacelineAction("AC3 race line", null, "Create AC3 race line file.", null);
allAction = new ExportAllAction("All", null, "Export both XML file and AC file.", null);
allAccAction = new ExportAllACCAction("All ACC", null, "Export both XML file and ACC file.", null);
allAccWithRacelineAction = new ExportAllACCWithRacelineAction("All ACC raceline", null, "Export both XML file and ACC file with raceline.", null);
ac3Action = new ExportAC3Action("AC", null, "Create AC file.", null);
accAction = new ExportACCAction("ACC", null, "Create ACC file.", null);
accWithRacelineAction = new ExportACCWithRacelineAction("ACC with raceline", null, "Create ACC file with raceline.", null);
ac3E0Action = new ExportAC3E0Action("AC with all elevation maps", null, "Create AC file and all elevation maps.", null);
ac3E1Action = new ExportAC3E1Action("AC with terrain and track elevation map", null, "Create AC file and terrain and track elevation map.", null);
ac3E2Action = new ExportAC3E2Action("AC with terrain and white track elevation map", null, "Create AC file and terrain and white track elevation map.", null);
ac3E3Action = new ExportAC3E3Action("AC with track elevation map", null, "Create AC file and track elevation map.", null);
ac3E4Action = new ExportAC3E4Action("AC with track with height steps elevation map", null, "Create AC file and track with height steps elevation map.", null);
ac3RacelineAction = new ExportAC3RacelineAction("AC race line", null, "Create AC race line file.", null);
calcDeltaAction = new CalcDeltaAction("Delta's", createNavigationIcon("Calc24"), "Calculate Delta's for x,y,z and angle.", KeyEvent.VK_S);
importAction = new ImportAction("Speed Dreams", null, "Speed Dreams xml file", null);
exportAction = new ExportAction("Speed Dreams", null, "Speed Dreams xml file", null);
@ -2910,7 +2988,45 @@ public class EditorFrame extends JFrame
return;
}
exportTrack();
exportAc3d(null);
exportAc3d(null, false);
}
}
public class ExportAllACCAction extends AbstractAction
{
public ExportAllACCAction(String text, ImageIcon icon, String desc, Integer mnemonic)
{
super(text, icon);
putValue(SHORT_DESCRIPTION, desc);
putValue(MNEMONIC_KEY, mnemonic);
}
public void actionPerformed(ActionEvent e)
{
if (trackData == null)
{
message("No track", "Nothing to export");
return;
}
exportTrack();
exportAc3d(null, true);
}
}
public class ExportAllACCWithRacelineAction extends AbstractAction
{
public ExportAllACCWithRacelineAction(String text, ImageIcon icon, String desc, Integer mnemonic)
{
super(text, icon);
putValue(SHORT_DESCRIPTION, desc);
putValue(MNEMONIC_KEY, mnemonic);
}
public void actionPerformed(ActionEvent e)
{
if (trackData == null)
{
message("No track", "Nothing to export");
return;
}
exportTrack();
exportAc3d(" -r", true);
}
}
public class ExportAC3Action extends AbstractAction
@ -2928,9 +3044,46 @@ public class EditorFrame extends JFrame
message("No track", "Nothing to export");
return;
}
exportAc3d(null);
exportAc3d(null, false);
}
}
public class ExportACCAction extends AbstractAction
{
public ExportACCAction(String text, ImageIcon icon, String desc, Integer mnemonic)
{
super(text, icon);
putValue(SHORT_DESCRIPTION, desc);
putValue(MNEMONIC_KEY, mnemonic);
}
public void actionPerformed(ActionEvent e)
{
if (trackData == null)
{
message("No track", "Nothing to export");
return;
}
exportAc3d(null, true);
}
}
public class ExportACCWithRacelineAction extends AbstractAction
{
public ExportACCWithRacelineAction(String text, ImageIcon icon, String desc, Integer mnemonic)
{
super(text, icon);
putValue(SHORT_DESCRIPTION, desc);
putValue(MNEMONIC_KEY, mnemonic);
}
public void actionPerformed(ActionEvent e)
{
if (trackData == null)
{
message("No track", "Nothing to export");
return;
}
exportAc3d(" -r", true);
}
}
public class ExportAC3E0Action extends AbstractAction
{
public ExportAC3E0Action(String text, ImageIcon icon, String desc, Integer mnemonic)
@ -2946,7 +3099,7 @@ public class EditorFrame extends JFrame
message("No track", "Nothing to export");
return;
}
exportAc3d(" -E 0");
exportAc3d(" -E 0", false);
}
}
public class ExportAC3E1Action extends AbstractAction
@ -2964,7 +3117,7 @@ public class EditorFrame extends JFrame
message("No track", "Nothing to export");
return;
}
exportAc3d(" -E 1");
exportAc3d(" -E 1", false);
}
}
public class ExportAC3E2Action extends AbstractAction
@ -2982,7 +3135,7 @@ public class EditorFrame extends JFrame
message("No track", "Nothing to export");
return;
}
exportAc3d(" -E 2");
exportAc3d(" -E 2", false);
}
}
public class ExportAC3E3Action extends AbstractAction
@ -3000,7 +3153,7 @@ public class EditorFrame extends JFrame
message("No track", "Nothing to export");
return;
}
exportAc3d(" -E 3");
exportAc3d(" -E 3", false);
}
}
public class ExportAC3E4Action extends AbstractAction
@ -3018,7 +3171,7 @@ public class EditorFrame extends JFrame
message("No track", "Nothing to export");
return;
}
exportAc3d(" -E 4");
exportAc3d(" -E 4", false);
}
}
public class ExportAC3RacelineAction extends AbstractAction
@ -3036,7 +3189,7 @@ public class EditorFrame extends JFrame
message("No track", "Nothing to export");
return;
}
exportAc3d(" -r");
exportAc3d(" -r", false);
}
}
public class PropertiesAction extends AbstractAction

View file

@ -65,12 +65,14 @@ public class TrackgenPanel extends JDialog implements Runnable
private JLabel waitLabel = null;
private JScrollPane errorsScrollPane = null;
private JTextArea errorsTextArea = null;
private boolean acc = false;
public TrackgenPanel(EditorFrame editorFrame, String additionalArgs)
public TrackgenPanel(EditorFrame editorFrame, String additionalArgs, boolean acc)
{
super();
this.editorFrame = editorFrame;
this.additionalArgs = additionalArgs;
this.acc = acc;
initialize();
ac3d.start();
}
@ -101,19 +103,30 @@ public class TrackgenPanel extends JDialog implements Runnable
String name = " -n " + trackName;
String args = category + name;
if (additionalArgs != null)
if (acc)
{
args = args + additionalArgs;
// don't create everything for race line
if (!args.contains("-r"))
if (additionalArgs != null)
{
args += " -a";
args = args + additionalArgs;
}
args += " --acc";
}
else
{
args += " -a";
if (additionalArgs != null)
{
args = args + additionalArgs;
// don't create everything for race line
if (!args.contains("-r"))
{
args += " -a";
}
}
else
{
args += " -a";
}
}
System.out.println(args);

View file

@ -34,7 +34,7 @@ public class Properties
private static Properties instance = new Properties();
private Vector<ActionListener> propertiesListeners = new Vector<ActionListener>();
public final String title = "sd2-trackeditor";
public final String version = "1.5.0";
public final String version = "1.5.1";
private String path;
private double imageScale = 1;