this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fixes from star rod classic

clover 54e4a463 aa95fb38

+746 -497
+10
.gitignore
··· 19 19 database/include/** 20 20 logs/** 21 21 22 + # Eclipse settings 23 + .settings/* 24 + !.settings/org.eclipse.buildship.core.prefs 25 + !.settings/org.eclipse.core.resources.prefs 26 + !.settings/org.eclipse.jdt.core.prefs 27 + !.settings/org.eclipse.jdt.ui.prefs 28 + 29 + # Vscode settings 30 + .vscode/* 31 + !.vscode/settings.json
+4 -4
.settings/org.eclipse.jdt.core.prefs
··· 192 192 org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line 193 193 org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow=end_of_line 194 194 org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line 195 - org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line 195 + org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line_on_wrap 196 196 org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line 197 197 org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line 198 198 org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line ··· 202 202 org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line 203 203 org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true 204 204 org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false 205 - org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false 205 + org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true 206 206 org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false 207 207 org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true 208 208 org.eclipse.jdt.core.formatter.comment.format_block_comments=false ··· 414 414 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert 415 415 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert 416 416 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert 417 - org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert 417 + org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=insert 418 418 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert 419 419 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert 420 420 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert ··· 468 468 org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false 469 469 org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false 470 470 org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line=one_line_never 471 - org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line=one_line_never 471 + org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line=one_line_if_empty 472 472 org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false 473 473 org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_if_empty 474 474 org.eclipse.jdt.core.formatter.lineSplit=160
+1 -1
build.gradle.kts
··· 15 15 plugins { 16 16 id("java") 17 17 id("com.github.johnrengelman.shadow") version "8.1.1" 18 - id("net.nemerosa.versioning") version "2.8.2" 18 + id("net.nemerosa.versioning") version "3.1.0" 19 19 id("com.jaredsburrows.license") version "0.9.7" 20 20 } 21 21
+44
exec/StarRod.bat
··· 1 1 @echo off 2 + setlocal enabledelayedexpansion 3 + 4 + echo Checking for Java... 5 + 6 + @rem Check if Java is installed 7 + java -version 2>nul >nul 8 + if %errorlevel% neq 0 ( 9 + echo. 10 + echo ERROR: Java is not installed or not in PATH. 11 + echo You must install Java ^(version ^>= 17^) to run Star Rod: 12 + echo https://www.oracle.com/java/technologies/downloads/ 13 + pause >nul 14 + exit /b 1 15 + ) 16 + 17 + @rem Extract the Java version string 18 + for /f "tokens=3 delims= " %%A in ('java -version 2^>^&1 ^| findstr /i "version"') do ( 19 + set "java_version=%%~A" 20 + ) 21 + 22 + @rem Extract the major version number 23 + for /f "tokens=1 delims=." %%A in ("%java_version%") do set "java_major=%%A" 24 + 25 + echo Detected Java version: %java_version% 26 + 27 + @rem Check if the major version is >= 17 28 + if %java_major% lss 17 ( 29 + echo. 30 + echo ERROR: Star Rod requires Java version 17 or greater. 31 + echo Install a more recent version of Java to run Star Rod: 32 + echo https://www.oracle.com/java/technologies/downloads/ 33 + pause >nul 34 + exit /b 1 35 + ) 36 + 37 + if not exist "StarRod.jar" ( 38 + echo. 39 + echo ERROR: StarRod.jar not found in the current directory. 40 + echo Please ensure that StarRod.jar is located in the same folder as this script. 41 + pause >nul 42 + exit /b 1 43 + ) 44 + 45 + @rem Valid Java version detected, launch Star Rod 2 46 start "" javaw -jar -mx2G StarRod.jar
+1 -2
src/main/java/app/Environment.java
··· 310 310 File db = Directories.DATABASE.toFile(); 311 311 312 312 if (!db.exists() || !db.isDirectory()) { 313 - SwingUtils.getMessageDialog() 313 + SwingUtils.getErrorDialog() 314 314 .setTitle("Missing Directory") 315 315 .setMessage("Could not find required directory: " + db.getName(), 316 316 "It should be in the same directory as the jar.") 317 - .setMessageType(JOptionPane.ERROR_MESSAGE) 318 317 .show(); 319 318 320 319 exit();
+5 -10
src/main/java/app/RomValidator.java
··· 39 39 public static File validateROM(File f) throws IOException 40 40 { 41 41 if (f.length() != LENGTH) { 42 - SwingUtils.getMessageDialog() 42 + SwingUtils.getErrorDialog() 43 43 .setTitle("ROM Validation Error") 44 44 .setMessage("Selected file is not the correct size.") 45 - .setMessageType(JOptionPane.ERROR_MESSAGE) 46 45 .show(); 47 46 48 47 return null; ··· 118 117 else { 119 118 pleaseWait.setVisible(false); 120 119 121 - SwingUtils.getMessageDialog() 120 + SwingUtils.getErrorDialog() 122 121 .setTitle("ROM Validation Failure") 123 122 .setMessage("Incorrect ROM or version, CRC does not match.") 124 - .setMessageType(JOptionPane.ERROR_MESSAGE) 125 123 .show(); 126 124 127 125 raf.close(); ··· 136 134 if (!verifyCRCs(raf)) { 137 135 pleaseWait.setVisible(false); 138 136 139 - SwingUtils.getMessageDialog() 137 + SwingUtils.getErrorDialog() 140 138 .setTitle("ROM Validation Failure") 141 139 .setMessage("ROM data does not match CRC values!") 142 - .setMessageType(JOptionPane.ERROR_MESSAGE) 143 140 .show(); 144 141 145 142 return null; ··· 148 145 else { 149 146 pleaseWait.setVisible(false); 150 147 151 - SwingUtils.getMessageDialog() 148 + SwingUtils.getErrorDialog() 152 149 .setTitle("ROM Validation Failure") 153 150 .setMessage("Incorrect ROM or version, CRC does not match.") 154 - .setMessageType(JOptionPane.ERROR_MESSAGE) 155 151 .show(); 156 152 157 153 raf.close(); ··· 175 171 if (!fileMD5.equals(MD5)) { 176 172 pleaseWait.setVisible(false); 177 173 178 - SwingUtils.getMessageDialog() 174 + SwingUtils.getErrorDialog() 179 175 .setTitle("ROM Validation Failure") 180 176 .setMessage("MD5 hash does not match!") 181 - .setMessageType(JOptionPane.ERROR_MESSAGE) 182 177 .show(); 183 178 184 179 return null;
+2 -5
src/main/java/app/StackTraceDialog.java
··· 79 79 80 80 StringBuilder msgBuilder = new StringBuilder(); 81 81 82 - if (e instanceof InputFileException) { 83 - InputFileException ifx = (InputFileException) e; 82 + if (e instanceof InputFileException ifx) { 84 83 msgBuilder.append(ifx.getOrigin()); 85 84 msgBuilder.append(System.lineSeparator()); 86 85 inputFile = ifx.getSourceFile(); ··· 146 145 JScrollPane detailScrollPane = new JScrollPane(textArea); 147 146 detailScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); 148 147 149 - int choice = SwingUtils.getOptionDialog() 148 + int choice = SwingUtils.getErrorDialog() 150 149 .setTitle("Exception Details") 151 150 .setMessage(detailScrollPane) 152 - .setMessageType(JOptionPane.ERROR_MESSAGE) 153 151 .setOptionsType(JOptionPane.YES_NO_CANCEL_OPTION) 154 - .setIcon(Environment.ICON_ERROR) 155 152 .setOptions("OK", "Copy to Clipboard") 156 153 .choose(); 157 154
+1 -1
src/main/java/app/StarRodMain.java
··· 43 43 import assets.AssetHandle; 44 44 import assets.AssetManager; 45 45 import assets.ExpectedAsset; 46 + import common.BaseEditor; 46 47 import game.globals.editor.GlobalsEditor; 47 48 import game.map.Map; 48 49 import game.map.compiler.BuildException; 49 50 import game.map.compiler.CollisionCompiler; 50 51 import game.map.compiler.GeometryCompiler; 51 52 import game.map.editor.MapEditor; 52 - import game.map.editor.common.BaseEditor; 53 53 import game.map.scripts.ScriptGenerator; 54 54 import game.map.scripts.extract.Extractor; 55 55 import game.message.editor.MessageEditor;
+12 -10
src/main/java/app/Themes.java
··· 1 1 package app; 2 2 3 + import java.io.BufferedInputStream; 3 4 import java.io.File; 4 5 import java.io.FileInputStream; 5 6 import java.io.FileNotFoundException; ··· 18 19 public abstract class Themes 19 20 { 20 21 private static final List<Theme> THEMES = new ArrayList<>(); 21 - private static Theme SYSTEM_THEME; 22 + private static Theme DEFAULT_THEME; 22 23 private static Theme currentTheme = null; 23 24 24 25 public static class Theme ··· 63 64 private static void setTheme(Theme theme) 64 65 { 65 66 if (theme == null) 66 - theme = SYSTEM_THEME; 67 + theme = DEFAULT_THEME; 67 68 else if (theme == currentTheme) 68 69 return; 69 70 70 71 if (theme.custom) { 71 72 try { 72 - IntelliJTheme.setup(new FileInputStream(new File(theme.className))); 73 + IntelliJTheme.setup(new BufferedInputStream(new FileInputStream(new File(theme.className)))); 73 74 currentTheme = theme; 74 75 return; 75 76 } ··· 77 78 Logger.logError("Could not find file for theme: " + theme.name); 78 79 } 79 80 // if error, reset to system 80 - theme = SYSTEM_THEME; 81 + theme = DEFAULT_THEME; 81 82 } 82 83 83 84 try { ··· 93 94 public static void setThemeByKey(String themeKey) 94 95 { 95 96 if (themeKey == null || themeKey.isEmpty()) 96 - themeKey = SYSTEM_THEME.key; 97 + themeKey = DEFAULT_THEME.key; 97 98 98 99 if (currentTheme != null && themeKey.equalsIgnoreCase(currentTheme.key)) 99 100 return; ··· 112 113 public static void setThemeByName(String themeName) 113 114 { 114 115 if (themeName == null || themeName.isEmpty()) 115 - themeName = SYSTEM_THEME.name; 116 + themeName = DEFAULT_THEME.name; 116 117 117 118 if (currentTheme != null && themeName.equalsIgnoreCase(currentTheme.name)) 118 119 return; ··· 130 131 131 132 static { 132 133 if (!Environment.isCommandLine()) { 133 - SYSTEM_THEME = new Theme("System", UIManager.getSystemLookAndFeelClassName()); 134 - THEMES.add(SYSTEM_THEME); 134 + // SYSTEM_THEME = new Theme("System", UIManager.getSystemLookAndFeelClassName()); 135 135 136 136 try { 137 137 for (File f : IOUtils.getFilesWithExtension(Directories.DATABASE_THEMES.toFile(), "theme.json", true)) { ··· 144 144 } 145 145 146 146 // @formatter:off 147 - THEMES.add(new Theme("Flat Light", "com.formdev.flatlaf.FlatLightLaf")); 148 - THEMES.add(new Theme("Flat Dark", "com.formdev.flatlaf.FlatDarkLaf")); 147 + DEFAULT_THEME = new Theme("Flat Light", "com.formdev.flatlaf.FlatLightLaf"); 148 + THEMES.add(DEFAULT_THEME); 149 + 150 + THEMES.add(new Theme("Flat Dark", "com.formdev.flatlaf.FlatDarkLaf")); 149 151 THEMES.add(new Theme("Arc Light", "com.formdev.flatlaf.intellijthemes.FlatArcIJTheme")); 150 152 THEMES.add(new Theme("Arc Light Orange", "com.formdev.flatlaf.intellijthemes.FlatArcOrangeIJTheme")); 151 153 THEMES.add(new Theme("Arc Dark", "com.formdev.flatlaf.intellijthemes.FlatArcDarkIJTheme"));
+1 -2
src/main/java/game/entity/EntityInfo.java
··· 12 12 import java.util.Collection; 13 13 import java.util.HashMap; 14 14 15 - import game.map.editor.geometry.Vector3f; 16 - 17 15 import app.Environment; 18 16 import app.Resource; 19 17 import app.Resource.ResourceType; 20 18 import app.input.InvalidInputException; 19 + import common.Vector3f; 21 20 import game.DataUtils; 22 21 import game.entity.EntityModel.RenderablePart; 23 22 import game.map.Axis;
+2 -2
src/main/java/game/entity/EntityModel.java
··· 17 17 import java.util.Objects; 18 18 19 19 import org.apache.commons.io.FileUtils; 20 - import game.map.editor.geometry.Vector3f; 21 20 22 21 import app.StarRodException; 23 22 import app.StarRodMain; 24 23 import app.input.IOUtils; 24 + import common.BaseCamera; 25 + import common.Vector3f; 25 26 import game.entity.EntityInfo.EntityType; 26 27 import game.map.Axis; 27 28 import game.map.BoundingBox; 28 - import game.map.editor.common.BaseCamera; 29 29 import game.map.editor.render.RenderMode; 30 30 import game.map.editor.render.RenderingOptions; 31 31 import game.map.editor.render.SortedRenderable;
+1 -1
src/main/java/game/map/BoundingBox.java
··· 2 2 3 3 import static game.map.MapKey.*; 4 4 5 - import game.map.editor.geometry.Vector3f; 6 5 import org.w3c.dom.Element; 7 6 7 + import common.Vector3f; 8 8 import game.map.editor.geometry.GUVertex; 9 9 import game.map.editor.selection.SelectablePoint; 10 10 import game.map.mesh.AbstractMesh;
+16 -13
src/main/java/game/map/Map.java
··· 25 25 import org.w3c.dom.Element; 26 26 27 27 import app.Directories; 28 + import app.SwingUtils; 28 29 import app.input.IOUtils; 29 30 import assets.AssetManager; 30 31 import assets.AssetSubdir; ··· 1281 1282 { 1282 1283 String ext = FilenameUtils.getExtension(f.getName()); 1283 1284 1284 - if (ext.equalsIgnoreCase("prefab")) { 1285 - try { 1285 + try { 1286 + if (ext.equalsIgnoreCase("prefab")) { 1286 1287 exportPrefab(f, false); 1287 1288 } 1288 - catch (IOException e) { 1289 - Logger.log("IOException when saving objects to " + f.getName(), Priority.WARNING); 1290 - return; 1291 - } 1292 - } 1293 - 1294 - if (ext.equalsIgnoreCase("obj")) { 1295 - try { 1289 + else if (ext.equalsIgnoreCase("obj")) { 1296 1290 exportOBJ(f); 1297 1291 } 1298 - catch (IOException e) { 1299 - Logger.log("IOException when saving objects to " + f.getName(), Priority.WARNING); 1300 - return; 1292 + else if (ext.equalsIgnoreCase("fbx")) { 1293 + //TODO exportFBX(f); 1301 1294 } 1295 + else { 1296 + SwingUtils.getWarningDialog() 1297 + .setTitle("Export Failed") 1298 + .setMessage("Unsupported export format: " + ext) 1299 + .show(); 1300 + } 1301 + } 1302 + catch (IOException e) { 1303 + Logger.log("IOException when saving objects to " + f.getName(), Priority.WARNING); 1304 + return; 1302 1305 } 1303 1306 } 1304 1307
+1 -2
src/main/java/game/map/MutablePoint.java
··· 2 2 3 3 import java.util.Objects; 4 4 5 - import game.map.editor.geometry.Vector3f; 6 - 5 + import common.Vector3f; 7 6 import game.map.editor.commands.AbstractCommand; 8 7 9 8 public class MutablePoint
+1 -2
src/main/java/game/map/compiler/CollisionCompiler.java
··· 8 8 import java.util.HashMap; 9 9 import java.util.Objects; 10 10 11 - import game.map.editor.geometry.Vector3f; 12 - 13 11 import app.Directories; 14 12 import app.input.IOUtils; 15 13 import assets.AssetManager; 14 + import common.Vector3f; 16 15 import game.map.BoundingBox; 17 16 import game.map.Map; 18 17 import game.map.hit.Collider;
+3 -2
src/main/java/game/map/editor/CommandManager.java
··· 36 36 } 37 37 38 38 /** 39 - * Certain actions only use commands for undo/redo maintainence, and not for the initial execution. Those commands are 40 - * sent here. However, this practice should be avoided wherever possible because it may lead to subtle errors involving 39 + * Certain actions only use commands for undo/redo maintainence, and not for the 40 + * initial execution. Those commands are sent here. However, this practice should 41 + * be avoided wherever possible because it may lead to subtle errors involving 41 42 * undo/redo state integrity. 42 43 */ 43 44 public void pushCommand(AbstractCommand cmd)
+3 -3
src/main/java/game/map/editor/CursorObject.java
··· 14 14 import com.google.gson.Gson; 15 15 import com.google.gson.stream.JsonReader; 16 16 17 + import common.BaseCamera; 18 + import common.KeyboardInput; 19 + import common.Vector3f; 17 20 import game.map.Axis; 18 21 import game.map.BoundingBox; 19 22 import game.map.Map; ··· 26 29 import game.map.editor.camera.MapEditViewport; 27 30 import game.map.editor.camera.OrthographicViewport; 28 31 import game.map.editor.commands.AbstractCommand; 29 - import game.map.editor.common.BaseCamera; 30 - import game.map.editor.common.KeyboardInput; 31 - import game.map.editor.geometry.Vector3f; 32 32 import game.map.editor.render.RenderMode; 33 33 import game.map.editor.render.Renderer; 34 34 import game.map.editor.render.RenderingOptions;
+1 -1
src/main/java/game/map/editor/DrawTrianglesManager.java
··· 5 5 import java.util.Collections; 6 6 import java.util.List; 7 7 8 + import common.Vector3f; 8 9 import game.map.Axis; 9 10 import game.map.MapObject; 10 11 import game.map.MapObject.MapObjectType; ··· 13 14 import game.map.editor.camera.OrthographicViewport; 14 15 import game.map.editor.commands.CreateObject; 15 16 import game.map.editor.geometry.GeometryUtils; 16 - import game.map.editor.geometry.Vector3f; 17 17 import game.map.editor.render.PreviewDrawMode; 18 18 import game.map.editor.render.PreviewGeometry; 19 19 import game.map.hit.Collider;
+2 -7
src/main/java/game/map/editor/EditorCanvas.java
··· 1 1 package game.map.editor; 2 2 3 3 import static org.lwjgl.opengl.GL.createCapabilities; 4 - import static org.lwjgl.opengl.GL11.*; 4 + import static org.lwjgl.opengl.GL11.GL_VERSION; 5 + import static org.lwjgl.opengl.GL11.glGetString; 5 6 6 7 import org.lwjgl.Version; 7 8 import org.lwjgl.opengl.awt.AWTGLCanvas; ··· 44 45 createCapabilities(); 45 46 46 47 Logger.logf("Using driver: %s", glGetString(GL_VERSION)); 47 - 48 - glEnable(GL_POINT_SMOOTH); 49 - glHint(GL_POINT_SMOOTH, GL_NICEST); 50 - 51 - glEnable(GL_LINE_SMOOTH); 52 - glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); 53 48 54 49 RenderState.init(); 55 50 editor.glInit();
+14 -14
src/main/java/game/map/editor/MapEditor.java
··· 52 52 import assets.AssetManager; 53 53 import assets.ui.SelectMapDialog; 54 54 import assets.ui.SelectTexDialog; 55 + import common.FrameLimiter; 56 + import common.KeyboardInput; 57 + import common.KeyboardInput.KeyInputEvent; 58 + import common.KeyboardInput.KeyboardInputListener; 59 + import common.MouseInput; 60 + import common.MouseInput.MouseManagerListener; 61 + import common.Vector3f; 55 62 import game.ProjectDatabase; 56 63 import game.map.Axis; 57 64 import game.map.BoundingBox; ··· 101 108 import game.map.editor.commands.SplitModel; 102 109 import game.map.editor.commands.ToggleDoubleSided; 103 110 import game.map.editor.commands.fields.EditableField; 104 - import game.map.editor.common.FrameLimiter; 105 - import game.map.editor.common.KeyboardInput; 106 - import game.map.editor.common.KeyboardInput.KeyInputEvent; 107 - import game.map.editor.common.KeyboardInput.KeyboardInputListener; 108 - import game.map.editor.common.MouseInput; 109 - import game.map.editor.common.MouseInput.MouseManagerListener; 110 - import game.map.editor.geometry.Vector3f; 111 111 import game.map.editor.render.Color4d; 112 112 import game.map.editor.render.PreviewGeneratorFromPaths; 113 113 import game.map.editor.render.PreviewGeneratorFromTriangles; ··· 216 216 217 217 public static enum EditorMode 218 218 { 219 - Modify("Modify"), 220 - Texture("Apply Textures"), 221 - EditUVs("Edit UVs"), 222 - VertexPaint("Paint Vertices"), 223 - Scripts("Edit Scripts"); 219 + Modify ("Modify"), 220 + Texture ("Apply Textures"), 221 + EditUVs ("Edit UVs"), 222 + VertexPaint ("Paint Vertices"), 223 + Scripts ("Edit Scripts"); 224 224 225 225 private final String name; 226 226 ··· 783 783 784 784 for (Options opt : opts) { 785 785 String mapName = editorConfig.getString(opt); 786 - if (mapName.isBlank()) { 786 + if (mapName == null || mapName.isBlank()) { 787 787 continue; 788 788 } 789 789 ··· 927 927 928 928 if (editorConfig != null) { 929 929 String lastMapName = editorConfig.getString(Options.RecentMap0); 930 - if (!lastMapName.isBlank()) { 930 + if (lastMapName != null && !lastMapName.isBlank()) { 931 931 AssetHandle ah = AssetManager.getMap(lastMapName); 932 932 if (ah.exists()) { 933 933 options = new String[] { "Browse Maps", "Reopen " + lastMapName };
+1 -2
src/main/java/game/map/editor/PaintManager.java
··· 28 28 import javax.swing.border.Border; 29 29 import javax.swing.border.EtchedBorder; 30 30 31 - import game.map.editor.geometry.Vector3f; 32 - 33 31 import app.SwingUtils; 32 + import common.Vector3f; 34 33 import game.map.editor.render.RenderingOptions.SurfaceMode; 35 34 import game.map.editor.render.TextureManager; 36 35 import game.map.editor.ui.GuiCommand;
+1 -2
src/main/java/game/map/editor/PointObject.java
··· 1 1 package game.map.editor; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 3 + import common.Vector3f; 5 4 import game.map.BoundingBox; 6 5 import game.map.MutablePoint; 7 6 import game.map.MutablePoint.PointBackup;
+1 -1
src/main/java/game/map/editor/TriangleCutter.java
··· 4 4 import java.util.LinkedList; 5 5 import java.util.List; 6 6 7 + import common.Vector3f; 7 8 import game.map.MapObject; 8 9 import game.map.editor.commands.AbstractCommand; 9 10 import game.map.editor.commands.CommandBatch; 10 11 import game.map.editor.commands.CreateObject; 11 12 import game.map.editor.geometry.GeometryUtils; 12 - import game.map.editor.geometry.Vector3f; 13 13 import game.map.hit.Collider; 14 14 import game.map.hit.Zone; 15 15 import game.map.mesh.AbstractMesh;
+1 -1
src/main/java/game/map/editor/camera/CameraController.java
··· 1 1 package game.map.editor.camera; 2 2 3 - import game.map.editor.geometry.Vector3f; 3 + import common.Vector3f; 4 4 import game.map.hit.CameraZoneData; 5 5 import game.map.hit.ControlType; 6 6 import util.MathUtil;
+5 -5
src/main/java/game/map/editor/camera/MapEditCamera.java
··· 1 1 package game.map.editor.camera; 2 2 3 + import common.BaseCamera; 4 + import common.KeyboardInput; 5 + import common.MouseInput; 6 + import common.MousePixelRead; 7 + import common.Vector3f; 3 8 import game.map.Axis; 4 9 import game.map.BoundingBox; 5 10 import game.map.editor.MapEditor; 6 - import game.map.editor.common.BaseCamera; 7 - import game.map.editor.common.KeyboardInput; 8 - import game.map.editor.common.MouseInput; 9 - import game.map.editor.common.MousePixelRead; 10 - import game.map.editor.geometry.Vector3f; 11 11 import game.map.editor.selection.PickRay; 12 12 import game.map.editor.selection.PickRay.Channel; 13 13
+1 -2
src/main/java/game/map/editor/camera/MapEditViewport.java
··· 1 1 package game.map.editor.camera; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 3 + import common.Vector3f; 5 4 import game.map.BoundingBox; 6 5 import game.map.editor.MapEditor; 7 6 import game.map.editor.render.PresetColor;
+4 -5
src/main/java/game/map/editor/camera/OrthographicCamera.java
··· 2 2 3 3 import java.awt.event.KeyEvent; 4 4 5 - import game.map.editor.geometry.Vector3f; 6 - 5 + import common.KeyboardInput; 6 + import common.MouseInput; 7 + import common.MousePixelRead; 8 + import common.Vector3f; 7 9 import game.map.Axis; 8 10 import game.map.BoundingBox; 9 - import game.map.editor.common.KeyboardInput; 10 - import game.map.editor.common.MouseInput; 11 - import game.map.editor.common.MousePixelRead; 12 11 import game.map.editor.render.PresetColor; 13 12 import game.map.editor.selection.PickRay; 14 13 import game.map.editor.selection.PickRay.Channel;
+1 -2
src/main/java/game/map/editor/camera/OrthographicViewport.java
··· 4 4 5 5 import java.util.List; 6 6 7 - import game.map.editor.geometry.Vector3f; 8 - 7 + import common.Vector3f; 9 8 import game.map.BoundingBox; 10 9 import game.map.Map; 11 10 import game.map.MapObject;
+1 -2
src/main/java/game/map/editor/camera/PerspBaseCamera.java
··· 1 1 package game.map.editor.camera; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 3 + import common.Vector3f; 5 4 import game.map.Axis; 6 5 import game.map.editor.render.TextureManager; 7 6 import game.map.scripts.ScriptData;
+3 -4
src/main/java/game/map/editor/camera/PerspBattleCamera.java
··· 1 1 package game.map.editor.camera; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 3 + import common.KeyboardInput; 4 + import common.MouseInput; 5 + import common.Vector3f; 5 6 import game.map.BoundingBox; 6 - import game.map.editor.common.KeyboardInput; 7 - import game.map.editor.common.MouseInput; 8 7 9 8 public class PerspBattleCamera extends PerspBaseCamera 10 9 {
+3 -4
src/main/java/game/map/editor/camera/PerspFreeCamera.java
··· 4 4 5 5 import java.awt.event.KeyEvent; 6 6 7 - import game.map.editor.geometry.Vector3f; 8 - 7 + import common.KeyboardInput; 8 + import common.MouseInput; 9 + import common.Vector3f; 9 10 import game.map.BoundingBox; 10 - import game.map.editor.common.KeyboardInput; 11 - import game.map.editor.common.MouseInput; 12 11 13 12 public class PerspFreeCamera extends PerspBaseCamera 14 13 {
+2 -2
src/main/java/game/map/editor/camera/PerspTargetCamera.java
··· 2 2 3 3 import java.awt.event.KeyEvent; 4 4 5 + import common.KeyboardInput; 6 + import common.MouseInput; 5 7 import game.map.BoundingBox; 6 8 import game.map.editor.MapEditor; 7 - import game.map.editor.common.KeyboardInput; 8 - import game.map.editor.common.MouseInput; 9 9 import game.map.marker.Marker; 10 10 11 11 public class PerspTargetCamera extends PerspBaseCamera
+3 -4
src/main/java/game/map/editor/camera/PerspZoneCamera.java
··· 1 1 package game.map.editor.camera; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 3 + import common.KeyboardInput; 4 + import common.MouseInput; 5 + import common.Vector3f; 5 6 import game.map.BoundingBox; 6 7 import game.map.editor.CursorObject; 7 8 import game.map.editor.MapEditor; 8 - import game.map.editor.common.KeyboardInput; 9 - import game.map.editor.common.MouseInput; 10 9 import game.map.hit.CameraZoneData; 11 10 12 11 public class PerspZoneCamera extends PerspBaseCamera
+2 -3
src/main/java/game/map/editor/camera/PerspectiveViewport.java
··· 5 5 6 6 import java.util.List; 7 7 8 - import game.map.editor.geometry.Vector3f; 9 - 8 + import common.Vector3f; 10 9 import game.map.BoundingBox; 11 10 import game.map.Map; 12 11 import game.map.MapObject; ··· 66 65 float dy = camera.pos.y - y; 67 66 float dz = camera.pos.z - z; 68 67 69 - // double fov = ((PerspectiveCamera)camera).getvfov(); 68 + // double fov = ((PerspBaseCamera)camera).getvfov(); 70 69 // double fovScale = Math.tan(Math.toRadians(fov / 2)); 71 70 double distance = Math.sqrt(dx * dx + dy * dy + dz * dz); 72 71
+1 -2
src/main/java/game/map/editor/camera/UVEditorViewport.java
··· 5 5 import java.util.LinkedList; 6 6 import java.util.List; 7 7 8 - import game.map.editor.geometry.Vector3f; 9 - 8 + import common.Vector3f; 10 9 import game.map.BoundingBox; 11 10 import game.map.editor.MapEditor; 12 11 import game.map.editor.MapEditor.EditorMode;
+1 -2
src/main/java/game/map/editor/commands/CreateBVH.java
··· 5 5 import java.util.IdentityHashMap; 6 6 import java.util.List; 7 7 8 - import game.map.editor.geometry.Vector3f; 9 - 8 + import common.Vector3f; 10 9 import game.map.BoundingBox; 11 10 import game.map.MapObject; 12 11 import game.map.MapObject.HitType;
+1 -2
src/main/java/game/map/editor/common/BaseCamera.java src/main/java/common/BaseCamera.java
··· 1 - package game.map.editor.common; 1 + package common; 2 2 3 3 import static org.lwjgl.opengl.GL11.*; 4 4 ··· 8 8 import org.lwjgl.BufferUtils; 9 9 10 10 import game.map.Axis; 11 - import game.map.editor.geometry.Vector3f; 12 11 import game.map.shape.TransformMatrix; 13 12 import renderer.GLUtils; 14 13 import renderer.shaders.RenderState;
+4 -6
src/main/java/game/map/editor/common/BaseEditor.java src/main/java/common/BaseEditor.java
··· 1 - package game.map.editor.common; 1 + package common; 2 2 3 3 import static app.Directories.PROJ_CFG; 4 4 ··· 49 49 import app.config.Config; 50 50 import app.config.Options; 51 51 import app.config.Options.Scope; 52 + import common.KeyboardInput.KeyboardInputListener; 53 + import common.MouseInput.MouseManagerListener; 52 54 import game.map.editor.CommandManager; 53 55 import game.map.editor.GLEditor; 54 56 import game.map.editor.Tickable; 55 57 import game.map.editor.commands.AbstractCommand; 56 - import game.map.editor.common.KeyboardInput.KeyboardInputListener; 57 - import game.map.editor.common.MouseInput.MouseManagerListener; 58 58 import net.miginfocom.swing.MigLayout; 59 59 import util.LogFile; 60 60 import util.Logger; ··· 494 494 private final boolean promptForSave() 495 495 { 496 496 openDialogs.increment(); 497 - 498 497 int choice = SwingUtils.getConfirmDialog() 499 498 .setTitle("Warning") 500 499 .setMessage("Unsaved changes will be lost!", "Would you like to save now?") 501 500 .setOptionsType(JOptionPane.YES_NO_CANCEL_OPTION) 502 501 .choose(); 503 - 504 502 openDialogs.decrement(); 505 503 506 504 switch (choice) { ··· 607 605 frame.revalidate(); 608 606 } 609 607 610 - protected final void showErrorDialog(String title, String msg) 608 + protected final void showErrorDialog(String title, String ... msg) 611 609 { 612 610 SwingUtils.getErrorDialog() 613 611 .setParent(frame)
+1 -1
src/main/java/game/map/editor/common/BaseEditorSettings.java src/main/java/common/BaseEditorSettings.java
··· 1 - package game.map.editor.common; 1 + package common; 2 2 3 3 import app.config.Options.Scope; 4 4
+1 -2
src/main/java/game/map/editor/common/BasicCamera.java src/main/java/common/BasicCamera.java
··· 1 - package game.map.editor.common; 1 + package common; 2 2 3 3 import static org.lwjgl.opengl.GL11.*; 4 4 ··· 8 8 9 9 import org.lwjgl.BufferUtils; 10 10 11 - import game.map.editor.geometry.Vector3f; 12 11 import game.map.shape.TransformMatrix; 13 12 import renderer.GLUtils; 14 13 import renderer.shaders.RenderState;
+1 -1
src/main/java/game/map/editor/common/BasicCommandManager.java src/main/java/common/BasicCommandManager.java
··· 1 - package game.map.editor.common; 1 + package common; 2 2 3 3 import java.util.Stack; 4 4
+1 -1
src/main/java/game/map/editor/common/BasicEditorCommand.java src/main/java/common/BasicEditorCommand.java
··· 1 - package game.map.editor.common; 1 + package common; 2 2 3 3 import util.Logger; 4 4
+1 -1
src/main/java/game/map/editor/common/FrameLimiter.java src/main/java/common/FrameLimiter.java
··· 1 - package game.map.editor.common; 1 + package common; 2 2 3 3 /* 4 4 * Copyright (c) 2002-2012 LWJGL Project
+1 -1
src/main/java/game/map/editor/common/InfoPanel.java src/main/java/common/InfoPanel.java
··· 1 - package game.map.editor.common; 1 + package common; 2 2 3 3 import javax.swing.JPanel; 4 4
+1 -1
src/main/java/game/map/editor/common/KeyboardInput.java src/main/java/common/KeyboardInput.java
··· 1 - package game.map.editor.common; 1 + package common; 2 2 3 3 import java.awt.Component; 4 4 import java.awt.event.KeyEvent;
+1 -1
src/main/java/game/map/editor/common/MouseInput.java src/main/java/common/MouseInput.java
··· 1 - package game.map.editor.common; 1 + package common; 2 2 3 3 import java.awt.AWTException; 4 4 import java.awt.Component;
+1 -3
src/main/java/game/map/editor/common/MousePixelRead.java src/main/java/common/MousePixelRead.java
··· 1 - package game.map.editor.common; 2 - 3 - import game.map.editor.geometry.Vector3f; 1 + package common; 4 2 5 3 public class MousePixelRead 6 4 {
+1
src/main/java/game/map/editor/geometry/FromPathsGenerator.java
··· 1 1 package game.map.editor.geometry; 2 2 3 + import common.Vector3f; 3 4 import game.map.editor.MapEditor; 4 5 import game.map.marker.PathPoint; 5 6 import game.map.mesh.Triangle;
+1
src/main/java/game/map/editor/geometry/FromTrianglesGenerator.java
··· 2 2 3 3 import java.util.List; 4 4 5 + import common.Vector3f; 5 6 import game.map.Axis; 6 7 import game.map.mesh.Triangle; 7 8 import game.map.shape.TriangleBatch;
+1 -1
src/main/java/game/map/editor/geometry/GUTriangle.java
··· 1 1 package game.map.editor.geometry; 2 2 3 - import game.map.editor.geometry.Vector3f; 3 + import common.Vector3f; 4 4 5 5 public class GUTriangle 6 6 {
+1 -2
src/main/java/game/map/editor/geometry/GUVertex.java
··· 2 2 3 3 import java.util.Objects; 4 4 5 - import game.map.editor.geometry.Vector3f; 6 - 5 + import common.Vector3f; 7 6 import game.map.mesh.Vertex; 8 7 9 8 public class GUVertex
+1
src/main/java/game/map/editor/geometry/GeometryUtils.java
··· 10 10 import java.util.PriorityQueue; 11 11 import java.util.Set; 12 12 13 + import common.Vector3f; 13 14 import game.map.Axis; 14 15 import game.map.BoundingBox; 15 16 import game.map.editor.MapEditor;
+1 -1
src/main/java/game/map/editor/geometry/Vector3f.java src/main/java/common/Vector3f.java
··· 1 - package game.map.editor.geometry; 1 + package common; 2 2 3 3 public class Vector3f 4 4 {
+1 -2
src/main/java/game/map/editor/geometry/primitive/ShapeGenerator.java
··· 1 1 package game.map.editor.geometry.primitive; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 3 + import common.Vector3f; 5 4 import game.map.editor.ui.dialogs.GeneratePrimitiveOptionsDialog; 6 5 import game.map.shape.TriangleBatch; 7 6
+1 -2
src/main/java/game/map/editor/render/PreviewGeneratorPrimitive.java
··· 1 1 package game.map.editor.render; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 3 + import common.Vector3f; 5 4 import game.map.shape.TriangleBatch; 6 5 import game.map.tree.MapObjectNode; 7 6
+1 -2
src/main/java/game/map/editor/render/PreviewGeometry.java
··· 3 3 import java.util.ArrayList; 4 4 import java.util.List; 5 5 6 - import game.map.editor.geometry.Vector3f; 7 - 6 + import common.Vector3f; 8 7 import game.map.shape.TriangleBatch; 9 8 10 9 public class PreviewGeometry
+158 -104
src/main/java/game/map/editor/render/RenderMode.java
··· 14 14 import net.miginfocom.swing.MigLayout; 15 15 import renderer.shaders.RenderState; 16 16 17 - //@formatter:off 18 17 public enum RenderMode 19 18 { 19 + //@formatter:off 20 20 NONE ( 0, 0, "None"), 21 21 22 22 // SURF_SOLID_AA_ZB_L0 ( 0x00, -100000, "Surf_Solid_AA_ZB_Layer0"), ··· 43 43 SURF_CLOUD ( 0x2F, 700000, "Cloud_No_ZB"), 44 44 45 45 SHADOW ( true, 0x20, 6500000, "Shadow"); 46 + //@formatter:on 46 47 47 48 public final boolean hidden; 48 49 public final boolean translucent; ··· 80 81 81 82 private static boolean isTranslucent(int id) 82 83 { 83 - switch(id) 84 - { 84 + switch (id) { 85 85 case 0x11: 86 86 case 0x16: 87 87 case 0x22: ··· 98 98 99 99 private static final RenderMode[] EDITOR_MODE_LIST; 100 100 101 - static 102 - { 101 + static { 103 102 List<RenderMode> visibleList = new ArrayList<>(); 104 - for(RenderMode mode : RenderMode.values()) 105 - { 106 - if(!mode.hidden) 103 + for (RenderMode mode : RenderMode.values()) { 104 + if (!mode.hidden) 107 105 visibleList.add(mode); 108 106 } 109 107 EDITOR_MODE_LIST = new RenderMode[visibleList.size()]; ··· 125 123 JLabel idLabel = new JLabel(); 126 124 127 125 if (value != null) { 128 - if(value instanceof RenderMode renderMode) { 126 + if (value instanceof RenderMode renderMode) { 129 127 nameLabel.setText(renderMode.name); 130 128 131 129 if (value != NONE) ··· 141 139 if (isSelected) { 142 140 panel.setBackground(list.getSelectionBackground()); 143 141 panel.setForeground(list.getSelectionForeground()); 144 - } else { 142 + } 143 + else { 145 144 panel.setBackground(list.getBackground()); 146 145 panel.setForeground(list.getForeground()); 147 146 } ··· 152 151 153 152 public static RenderMode getModeForID(int id) 154 153 { 155 - for(RenderMode mode : RenderMode.values()) { 156 - if(id == mode.id) 154 + for (RenderMode mode : RenderMode.values()) { 155 + if (id == mode.id) 157 156 return mode; 158 157 } 159 158 return null; ··· 161 160 162 161 public static int getRenderIndex(int category, int mode) 163 162 { 164 - switch(category) 165 - { 163 + switch (category) { 166 164 default: 167 165 case 1: // missing texure 168 - switch(mode) { 169 - default: return 0; 170 - case 3: return 1; 171 - case 4: return 0x2E; 172 - case 5: return 2; 173 - case 7: return 3; 174 - case 9: return 4; 175 - case 0x0D: return 6; 176 - case 0x0F: return 7; 177 - case 0x10: return 0x2F; 166 + switch (mode) { 167 + default: 168 + return 0; 169 + case 3: 170 + return 1; 171 + case 4: 172 + return 0x2E; 173 + case 5: 174 + return 2; 175 + case 7: 176 + return 3; 177 + case 9: 178 + return 4; 179 + case 0x0D: 180 + return 6; 181 + case 0x0F: 182 + return 7; 183 + case 0x10: 184 + return 0x2F; 178 185 case 0x11: 179 186 case 0x16: 180 - case 0x22: return 8; 181 - case 0x13: return 0x0A; 182 - case 0x14: return 0x30; 183 - case 0x15: return 0x0B; 184 - case 0x1A: return 0x0C; 185 - case 0x1C: return 0x0D; 186 - case 0x26: return 0x0E; 187 - case 0x29: return 9; 188 - case 0x2E: return 0x37; 189 - case 0x2F: return 0x38; 187 + case 0x22: 188 + return 8; 189 + case 0x13: 190 + return 0x0A; 191 + case 0x14: 192 + return 0x30; 193 + case 0x15: 194 + return 0x0B; 195 + case 0x1A: 196 + return 0x0C; 197 + case 0x1C: 198 + return 0x0D; 199 + case 0x26: 200 + return 0x0E; 201 + case 0x29: 202 + return 9; 203 + case 0x2E: 204 + return 0x37; 205 + case 0x2F: 206 + return 0x38; 190 207 } 191 208 192 209 case 2: // standard 193 - switch(mode) { 194 - default: return 0x10; 195 - case 3: return 0x11; 196 - case 4: return 0x31; 197 - case 5: return 0x12; 198 - case 7: return 0x13; 199 - case 9: return 0x14; 200 - case 0x0D: return 0x16; 201 - case 0x0F: return 0x17; 202 - case 0x10: return 0x32; 210 + switch (mode) { 211 + default: 212 + return 0x10; 213 + case 3: 214 + return 0x11; 215 + case 4: 216 + return 0x31; 217 + case 5: 218 + return 0x12; 219 + case 7: 220 + return 0x13; 221 + case 9: 222 + return 0x14; 223 + case 0x0D: 224 + return 0x16; 225 + case 0x0F: 226 + return 0x17; 227 + case 0x10: 228 + return 0x32; 203 229 case 0x11: 204 230 case 0x16: 205 - case 0x22: return 0x18; 206 - case 0x13: return 0x1A; 207 - case 0x14: return 0x33; 208 - case 0x1A: return 0x1B; 209 - case 0x1C: return 0x1C; 210 - case 0x26: return 0x1D; 211 - case 0x29: return 0x19; 212 - case 0x2E: return 0x39; 213 - case 0x2F: return 0x3A; 231 + case 0x22: 232 + return 0x18; 233 + case 0x13: 234 + return 0x1A; 235 + case 0x14: 236 + return 0x33; 237 + case 0x1A: 238 + return 0x1B; 239 + case 0x1C: 240 + return 0x1C; 241 + case 0x26: 242 + return 0x1D; 243 + case 0x29: 244 + return 0x19; 245 + case 0x2E: 246 + return 0x39; 247 + case 0x2F: 248 + return 0x3A; 214 249 } 215 250 case 3: // fog enabled 216 251 case 6: // identical to category 3, except has fog color multiplier 217 - switch(mode) { 218 - default: return 0x1F; 219 - case 3: return 0x20; 220 - case 4: return 0x34; 221 - case 5: return 0x21; 222 - case 7: return 0x22; 223 - case 9: return 0x23; 224 - case 0x0D: return 0x25; 225 - case 0x0F: return 0x26; 226 - case 0x10: return 0x35; 252 + switch (mode) { 253 + default: 254 + return 0x1F; 255 + case 3: 256 + return 0x20; 257 + case 4: 258 + return 0x34; 259 + case 5: 260 + return 0x21; 261 + case 7: 262 + return 0x22; 263 + case 9: 264 + return 0x23; 265 + case 0x0D: 266 + return 0x25; 267 + case 0x0F: 268 + return 0x26; 269 + case 0x10: 270 + return 0x35; 227 271 case 0x11: 228 272 case 0x16: 229 - case 0x22: return 0x27; 230 - case 0x13: return 0x29; 231 - case 0x14: return 0x36; 232 - case 0x1A: return 0x2A; 233 - case 0x1C: return 0x2B; 234 - case 0x26: return 0x2C; 235 - case 0x29: return 0x28; 236 - case 0x2E: return 0x3B; 237 - case 0x2F: return 0x3C; 273 + case 0x22: 274 + return 0x27; 275 + case 0x13: 276 + return 0x29; 277 + case 0x14: 278 + return 0x36; 279 + case 0x1A: 280 + return 0x2A; 281 + case 0x1C: 282 + return 0x2B; 283 + case 0x26: 284 + return 0x2C; 285 + case 0x29: 286 + return 0x28; 287 + case 0x2E: 288 + return 0x3B; 289 + case 0x2F: 290 + return 0x3C; 238 291 } 239 292 case 10: 240 293 case 11: // subset of category 3 241 - switch(mode) { 242 - default: return 0x1F; 243 - case 0x5: return 0x21; 244 - case 0x9: return 0x23; 245 - case 0xD: return 0x25; 246 - case 0x2E: return 0x3B; 247 - case 0x2F: return 0x3C; 294 + switch (mode) { 295 + default: 296 + return 0x1F; 297 + case 0x5: 298 + return 0x21; 299 + case 0x9: 300 + return 0x23; 301 + case 0xD: 302 + return 0x25; 303 + case 0x2E: 304 + return 0x3B; 305 + case 0x2F: 306 + return 0x3C; 248 307 } 249 308 } 250 309 } ··· 266 325 displayListTable[0x0C] = new RenderModeDisplayList(0x0C, 0x000A09BB, 0x003F0604, 0x00220005); 267 326 displayListTable[0x0D] = new RenderModeDisplayList(0x0D, 0x000A09EA, 0x003F0604, 0x00220005); 268 327 displayListTable[0x0E] = new RenderModeDisplayList(0x0E, 0x000A08BB, 0x003F0604, 0x00220005); 269 - displayListTable[0x0F] = new RenderModeDisplayList(0x0F, null, 0x003F0604, 0x00220005); 328 + displayListTable[0x0F] = new RenderModeDisplayList(0x0F, null, 0x003F0604, 0x00220005); 270 329 displayListTable[0x10] = new RenderModeDisplayList(0x10, 0x0183240F, 0x003F0604, 0x00220405); 271 330 displayListTable[0x11] = new RenderModeDisplayList(0x11, 0x01832446, 0x003F0604, 0x00220405); 272 331 displayListTable[0x12] = new RenderModeDisplayList(0x12, 0x018325AB, 0x003F0604, 0x00220405); ··· 274 333 displayListTable[0x14] = new RenderModeDisplayList(0x14, 0x0183248F, 0x003F0604, 0x00220405); 275 334 displayListTable[0x15] = new RenderModeDisplayList(0x15, 0x0183248F, 0x003F0604, 0x00220405); 276 335 displayListTable[0x16] = new RenderModeDisplayList(0x16, 0x0183260F, 0x003F0604, 0x00220005); 277 - displayListTable[0x17] = new RenderModeDisplayList(0x17, 0x0183260F, 0x003F0604, null); 336 + displayListTable[0x17] = new RenderModeDisplayList(0x17, 0x0183260F, 0x003F0604, null); 278 337 displayListTable[0x18] = new RenderModeDisplayList(0x18, 0x0183093B, 0x003F0604, 0x00220005); 279 338 displayListTable[0x19] = new RenderModeDisplayList(0x19, 0x0183093B, 0x003F0604, 0x00220005); 280 339 displayListTable[0x1A] = new RenderModeDisplayList(0x1A, 0x0183094A, 0x003F0604, 0x00220005); 281 340 displayListTable[0x1B] = new RenderModeDisplayList(0x1B, 0x018309BB, 0x003F0604, 0x00220005); 282 341 displayListTable[0x1C] = new RenderModeDisplayList(0x1C, 0x018309CA, 0x003F0604, 0x00220005); 283 342 displayListTable[0x1D] = new RenderModeDisplayList(0x1D, 0x018308BB, 0x003F0604, 0x00220005); 284 - displayListTable[0x1E] = new RenderModeDisplayList(0x1E, null, 0x003F0604, 0x00220005); 343 + displayListTable[0x1E] = new RenderModeDisplayList(0x1E, null, 0x003F0604, 0x00220005); 285 344 displayListTable[0x1F] = new RenderModeDisplayList(0x1F, 0xF902240F, 0x003F0604, 0x00230405); 286 345 displayListTable[0x20] = new RenderModeDisplayList(0x20, 0xF9022446, 0x003F0604, 0x00230405); 287 346 displayListTable[0x21] = new RenderModeDisplayList(0x21, 0xF90225AB, 0x003F0604, 0x00230405); ··· 289 348 displayListTable[0x23] = new RenderModeDisplayList(0x23, 0xF902248F, 0x003F0604, 0x00230405); 290 349 displayListTable[0x24] = new RenderModeDisplayList(0x24, 0xF902248F, 0x003F0604, 0x00230405); 291 350 displayListTable[0x25] = new RenderModeDisplayList(0x25, 0xF902260F, 0x003F0604, 0x00230005); 292 - displayListTable[0x26] = new RenderModeDisplayList(0x26, 0xF902260F, 0x003F0604, null); 351 + displayListTable[0x26] = new RenderModeDisplayList(0x26, 0xF902260F, 0x003F0604, null); 293 352 displayListTable[0x27] = new RenderModeDisplayList(0x27, 0xF902093B, 0x003F0604, 0x00230005); 294 353 displayListTable[0x28] = new RenderModeDisplayList(0x28, 0xF902093B, 0x003F0604, 0x00230005); 295 354 displayListTable[0x29] = new RenderModeDisplayList(0x29, 0xF902094A, 0x003F0604, 0x00230005); 296 355 displayListTable[0x2A] = new RenderModeDisplayList(0x2A, 0xF90209BB, 0x003F0604, 0x00230005); 297 356 displayListTable[0x2B] = new RenderModeDisplayList(0x2B, 0xF90209CA, 0x003F0604, 0x00230005); 298 357 displayListTable[0x2C] = new RenderModeDisplayList(0x2C, 0xF90208BB, 0x003F0604, 0x00230005); 299 - displayListTable[0x2D] = new RenderModeDisplayList(0x2D, null, 0x003F0604, 0x00230005); 358 + displayListTable[0x2D] = new RenderModeDisplayList(0x2D, null, 0x003F0604, 0x00230005); 300 359 displayListTable[0x2E] = new RenderModeDisplayList(0x2E, 0x000AA409, 0x003F0605, 0x00220404); 301 360 displayListTable[0x2F] = new RenderModeDisplayList(0x2F, 0x000AA609, 0x003F0605, 0x00220004); 302 361 displayListTable[0x30] = new RenderModeDisplayList(0x30, 0x000A0839, 0x003F0605, 0x00220004); ··· 365 424 { 366 425 this.index = index; 367 426 368 - if(setOtherModeL != null) 369 - { 427 + if (setOtherModeL != null) { 370 428 int cycInd = setOtherModeL & 0x1FFF; 371 429 int cycDep = (setOtherModeL >> 13) & 0xFFFF; 372 430 ··· 377 435 378 436 CVG_DST = (cycInd >> 5) & 3; 379 437 380 - CLR_ON_CVG = ((cycInd & 0x10) != 0); 381 - CVG_X_ALPHA = ((cycInd & 0x200) != 0); 438 + CLR_ON_CVG = ((cycInd & 0x10) != 0); 439 + CVG_X_ALPHA = ((cycInd & 0x200) != 0); 382 440 ALPHA_CVG_SEL = ((cycInd & 0x400) != 0); 383 - FORCE_BL = ((cycInd & 0x800) != 0); 441 + FORCE_BL = ((cycInd & 0x800) != 0); 384 442 385 443 ZMODE = (cycInd >> 7) & 3; 386 444 ··· 400 458 401 459 public void load() 402 460 { 403 - switch(index) 404 - { 461 + switch (index) { 405 462 /* 406 - case 0x8: 407 - case 0x18: 408 - case 0x30: 409 - case 0x33: 463 + case 0x8: 464 + case 0x18: 465 + case 0x30: 466 + case 0x33: 410 467 */ 411 468 // may also want 26, 2E, 2F for all XLU and CLD modes 412 469 case 0x08: // modes 11,16,22 ··· 427 484 428 485 // RenderState.setDepthWrite(Z_UPD); 429 486 430 - if(Z_CMP) 431 - { 487 + if (Z_CMP) { 432 488 if (ZMODE == ZMODE_DEC) 433 489 RenderState.setDepthFunc(GL_LEQUAL); 434 490 else 435 491 RenderState.setDepthFunc(GL_LESS); 436 492 } 437 493 438 - if(ZMODE == ZMODE_DEC) { 439 - glPolygonOffset(-1,-1); 494 + if (ZMODE == ZMODE_DEC) { 495 + glPolygonOffset(-1, -1); 440 496 glEnable(GL_POLYGON_OFFSET_FILL); 441 497 } 442 498 else { ··· 449 505 // fog: G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA 450 506 // hmm... 451 507 452 - if(FORCE_BL && BL_M[1] == G_BL_CLR_MEM) { 508 + if (FORCE_BL && BL_M[1] == G_BL_CLR_MEM) { 453 509 if (BL_A[1] == G_BL_0) 454 510 blendSrcFactor = GL_ZERO; 455 511 else if (ALPHA_CVG_SEL && !CVG_X_ALPHA) ··· 457 513 else 458 514 blendSrcFactor = GL_SRC_ALPHA; 459 515 460 - switch(BL_B[1]) { 516 + switch (BL_B[1]) { 461 517 case G_BL_1MA: 462 518 if (blendSrcFactor == GL_SRC_ALPHA) 463 519 blendDestFactor = GL_ONE_MINUS_SRC_ALPHA; ··· 498 554 499 555 public static int getFromOtherModelL(int value) 500 556 { 501 - switch(value) 502 - { 557 + switch (value) { 503 558 case 0x000AA40F: 504 559 case 0x0183240F: 505 560 case 0xF902240F: ··· 569 624 } 570 625 } 571 626 } 572 - //@formatter:on
+8 -15
src/main/java/game/map/editor/render/Renderer.java
··· 10 10 import java.util.Comparator; 11 11 import java.util.List; 12 12 13 + import common.BaseCamera; 14 + import common.Vector3f; 13 15 import game.entity.EntityInfo; 14 16 import game.map.editor.MapEditor; 15 17 import game.map.editor.MapEditor.IShutdownListener; 16 18 import game.map.editor.PaintManager; 17 19 import game.map.editor.camera.MapEditViewport; 18 - import game.map.editor.common.BaseCamera; 19 - import game.map.editor.geometry.Vector3f; 20 20 import game.map.editor.selection.PickRay.PickHit; 21 21 import game.map.hit.Collider; 22 22 import game.map.hit.Zone; ··· 80 80 throw new IllegalStateException("There can be only one Renderer"); 81 81 instance = this; 82 82 editor.registerOnShutdown(this); 83 - 84 - glEnable(GL_POINT_SMOOTH); 85 - glHint(GL_POINT_SMOOTH, GL_NICEST); 86 - 87 - glEnable(GL_LINE_SMOOTH); 88 - glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); 89 - 90 - glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); 91 - 92 - glEnable(GL_TEXTURE_2D); 93 83 94 84 glCullFace(GL_BACK); 95 85 ··· 606 596 607 597 for (Triangle t : preview.batch.triangles) { 608 598 TriangleRenderQueue.addTriangle( 609 - TriangleRenderQueue.addVertex().setPosition(t.vert[0].getCurrentX(), t.vert[0].getCurrentY(), t.vert[0].getCurrentZ()) 599 + TriangleRenderQueue.addVertex() 600 + .setPosition(t.vert[0].getCurrentX(), t.vert[0].getCurrentY(), t.vert[0].getCurrentZ()) 610 601 .getIndex(), 611 - TriangleRenderQueue.addVertex().setPosition(t.vert[1].getCurrentX(), t.vert[1].getCurrentY(), t.vert[1].getCurrentZ()) 602 + TriangleRenderQueue.addVertex() 603 + .setPosition(t.vert[1].getCurrentX(), t.vert[1].getCurrentY(), t.vert[1].getCurrentZ()) 612 604 .getIndex(), 613 - TriangleRenderQueue.addVertex().setPosition(t.vert[2].getCurrentX(), t.vert[2].getCurrentY(), t.vert[2].getCurrentZ()) 605 + TriangleRenderQueue.addVertex() 606 + .setPosition(t.vert[2].getCurrentX(), t.vert[2].getCurrentY(), t.vert[2].getCurrentZ()) 614 607 .getIndex()); 615 608 } 616 609
+2 -3
src/main/java/game/map/editor/render/ShadowRenderer.java
··· 12 12 13 13 import javax.imageio.ImageIO; 14 14 15 - import game.map.editor.geometry.Vector3f; 16 - 17 15 import assets.ExpectedAsset; 18 - import game.map.editor.common.BaseCamera; 16 + import common.BaseCamera; 17 + import common.Vector3f; 19 18 import game.map.shape.TransformMatrix; 20 19 import renderer.buffers.BufferedMesh; 21 20 import renderer.shaders.RenderState;
+2 -3
src/main/java/game/map/editor/render/SortedRenderable.java
··· 1 1 package game.map.editor.render; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 5 - import game.map.editor.common.BaseCamera; 3 + import common.BaseCamera; 4 + import common.Vector3f; 6 5 7 6 public interface SortedRenderable 8 7 {
+1 -1
src/main/java/game/map/editor/render/UtilityModel.java
··· 10 10 11 11 import app.Resource; 12 12 import app.Resource.ResourceType; 13 - import game.map.editor.geometry.Vector3f; 13 + import common.Vector3f; 14 14 import renderer.buffers.TriangleRenderQueue; 15 15 import util.Logger; 16 16 import util.Priority;
+1 -1
src/main/java/game/map/editor/selection/PickRay.java
··· 1 1 package game.map.editor.selection; 2 2 3 + import common.Vector3f; 3 4 import game.map.BoundingBox; 4 5 import game.map.editor.camera.MapEditViewport; 5 - import game.map.editor.geometry.Vector3f; 6 6 import game.map.mesh.Triangle; 7 7 import game.map.shape.UV; 8 8
+1 -2
src/main/java/game/map/editor/selection/SelectablePoint.java
··· 1 1 package game.map.editor.selection; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 3 + import common.Vector3f; 5 4 import game.map.Axis; 6 5 import game.map.BoundingBox; 7 6 import game.map.MutablePoint;
+1 -1
src/main/java/game/map/editor/selection/Selection.java
··· 3 3 import java.util.ArrayList; 4 4 import java.util.LinkedList; 5 5 6 + import common.Vector3f; 6 7 import game.map.Axis; 7 8 import game.map.BoundingBox; 8 9 import game.map.MutableAngle; ··· 15 16 import game.map.editor.commands.AbstractCommand; 16 17 import game.map.editor.commands.CommandBatch; 17 18 import game.map.editor.commands.TransformSelection; 18 - import game.map.editor.geometry.Vector3f; 19 19 import game.map.editor.render.PresetColor; 20 20 import game.map.editor.render.Renderer; 21 21 import game.map.editor.selection.PickRay.PickHit;
+1 -2
src/main/java/game/map/editor/selection/Trace.java
··· 1 1 package game.map.editor.selection; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 3 + import common.Vector3f; 5 4 import game.map.editor.render.PresetColor; 6 5 import game.map.editor.selection.PickRay.PickHit; 7 6 import renderer.buffers.LineRenderQueue;
+1 -1
src/main/java/game/map/editor/selection/TransformGizmo.java
··· 6 6 import java.util.Arrays; 7 7 import java.util.List; 8 8 9 + import common.Vector3f; 9 10 import game.map.Axis; 10 11 import game.map.BoundingBox; 11 12 import game.map.MutablePoint; 12 13 import game.map.PointListBackup; 13 14 import game.map.editor.MapEditor; 14 15 import game.map.editor.camera.MapEditViewport; 15 - import game.map.editor.geometry.Vector3f; 16 16 import game.map.editor.render.UtilityModel; 17 17 import game.map.editor.render.UtilityModel.UtilityTriangle; 18 18 import game.map.editor.selection.PickRay.PickHit;
+4 -2
src/main/java/game/map/editor/ui/GuiCommand.java
··· 11 11 SAVE_AS, 12 12 13 13 // import/export 14 - SAVE_OBJECTS, 15 - LOAD_OBJECTS, 14 + PROMPT_EXPORT, 15 + PROMPT_IMPORT, 16 + 17 + SAVE_PREFAB, 16 18 17 19 // 'Compile' menu items 18 20 COMPILE_SHAPE,
+102
src/main/java/game/map/editor/ui/MapObjectTreeCellRenderer.java
··· 1 + package game.map.editor.ui; 2 + 3 + import java.awt.Component; 4 + import java.awt.Dimension; 5 + import java.awt.Font; 6 + 7 + import javax.swing.BorderFactory; 8 + import javax.swing.Icon; 9 + import javax.swing.JLabel; 10 + import javax.swing.JPanel; 11 + import javax.swing.JTree; 12 + import javax.swing.SwingConstants; 13 + import javax.swing.UIManager; 14 + import javax.swing.plaf.UIResource; 15 + import javax.swing.tree.DefaultMutableTreeNode; 16 + import javax.swing.tree.TreeCellRenderer; 17 + 18 + import app.Environment; 19 + import game.map.MapObject; 20 + import net.miginfocom.swing.MigLayout; 21 + import util.ui.CircleIcon; 22 + 23 + public class MapObjectTreeCellRenderer extends JPanel implements TreeCellRenderer 24 + { 25 + private JLabel iconLabel; 26 + private JLabel nameLabel; 27 + 28 + private transient Icon closedIcon; 29 + private transient Icon leafIcon; 30 + private transient Icon openIcon; 31 + 32 + private boolean hasInit; 33 + 34 + //XXX BUG: have to explicitly set a size or children with long names will be truncated by parent 35 + // being renamed. comment out getPreferredSize and use the red border visualization below to see. 36 + private static final Dimension DEFAULT_SIZE = new Dimension(180, 20); 37 + 38 + @Override 39 + public Dimension getPreferredSize() 40 + { 41 + return DEFAULT_SIZE; 42 + } 43 + 44 + public MapObjectTreeCellRenderer() 45 + { 46 + super(); 47 + iconLabel = new JLabel(Environment.ICON_ERROR, SwingConstants.CENTER); 48 + nameLabel = new JLabel("placeholder"); 49 + 50 + setLayout(new MigLayout("ins 0, fillx")); 51 + add(iconLabel, "growx"); 52 + add(nameLabel, "growx, pushx"); 53 + 54 + //setBorder(BorderFactory.createLineBorder(Color.red)); 55 + setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); 56 + 57 + setOpaque(false); 58 + } 59 + 60 + @Override 61 + public void updateUI() 62 + { 63 + super.updateUI(); 64 + 65 + if (!hasInit || (leafIcon instanceof UIResource)) { 66 + leafIcon = CircleIcon.instance(); 67 + } 68 + if (!hasInit || (closedIcon instanceof UIResource)) { 69 + closedIcon = UIManager.getIcon("Tree.closedIcon"); 70 + } 71 + if (!hasInit || (openIcon instanceof UIManager)) { 72 + openIcon = UIManager.getIcon("Tree.openIcon"); 73 + } 74 + } 75 + 76 + @Override 77 + public Component getTreeCellRendererComponent(JTree tree, Object obj, 78 + boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) 79 + { 80 + DefaultMutableTreeNode node = (DefaultMutableTreeNode) obj; 81 + 82 + if (node.getUserObject() instanceof MapObject mobj) { 83 + if (mobj.allowsChildren()) 84 + iconLabel.setIcon(expanded ? openIcon : closedIcon); 85 + else 86 + iconLabel.setIcon(leafIcon); 87 + 88 + if (mobj.hidden) 89 + nameLabel.setFont(getFont().deriveFont(Font.ITALIC)); 90 + else 91 + nameLabel.setFont(getFont().deriveFont(Font.PLAIN)); 92 + 93 + nameLabel.setText(mobj.toString()); 94 + nameLabel.setForeground(null); 95 + } 96 + else { 97 + iconLabel.setIcon(Environment.ICON_ERROR); 98 + } 99 + 100 + return this; 101 + } 102 + }
+1 -1
src/main/java/game/map/editor/ui/ScriptManager.java
··· 131 131 { 132 132 generalTab.updateFields(data); 133 133 } 134 - 134 + 135 135 public void updateCameraFields(ScriptData data) 136 136 { 137 137 cameraTab.updateFields(data);
+85 -55
src/main/java/game/map/editor/ui/SwingGUI.java
··· 91 91 import game.map.editor.ui.info.DisplayListPanel.AddTriangles; 92 92 import game.map.hit.Collider; 93 93 import game.map.hit.Zone; 94 + import game.map.impex.ExportDialog; 95 + import game.map.impex.ImportDialog; 94 96 import game.map.marker.Marker; 95 97 import game.map.shape.Model; 96 98 import game.map.shape.TexturePanner; ··· 173 175 private GenerateFromTrianglesDialog generateFromTrianglesDialog; 174 176 private GenerateFromPathsDialog generateFromPathsDialog; 175 177 private EditPannerDialog editTexPannerDialog; 178 + private ExportDialog exportDialog; 179 + private ImportDialog importDialog; 176 180 177 181 private TransformSelectionPanel transformSelectionPanel; 178 182 ··· 216 220 closeRequested = (!editor.map.modified || promptForSave()) && (!ProjectDatabase.SpriteShading.modified || promptSaveShading()); 217 221 if (!closeRequested) 218 222 openDialogCount.decrement(); 219 - ; 220 223 } 221 224 }); 222 225 ··· 224 227 File mapDir = Environment.getProjectDirectory(); 225 228 226 229 importFileChooser = new OpenFileChooser(mapDir, "Import Geometry", "Importables", "obj", "fbx", "prefab"); 227 - exportFileChooser = new SaveFileChooser(mapDir, "Export Geometry", "Exportables", "obj", "fbx", "prefab"); 230 + exportFileChooser = new SaveFileChooser(mapDir, "Export Geometry", null, "obj", "fbx"); 228 231 229 232 commandMap = new HashMap<>(); 230 233 for (GuiCommand cmd : GuiCommand.values()) ··· 515 518 516 519 menu.addSeparator(); 517 520 518 - JMenu importMenu = new JMenu("Import"); 519 - importMenu.getPopupMenu().setLightWeightPopupEnabled(false); 520 - menu.add(importMenu); 521 + item = new JMenuItem("Export"); 522 + addButtonCommand(item, GuiCommand.PROMPT_EXPORT); 523 + menu.add(item); 521 524 522 - item = new JMenuItem("Prefab"); 523 - addButtonCommand(item, GuiCommand.LOAD_OBJECTS); 524 - importMenu.add(item); 525 - item.setPreferredSize(menuItemDimension); 525 + item = new JMenuItem("Import"); 526 + addButtonCommand(item, GuiCommand.PROMPT_IMPORT); 527 + menu.add(item); 526 528 527 529 menu.addSeparator(); 528 530 ··· 533 535 item = new JMenuItem("Exit"); 534 536 EditorShortcut.QUIT.bindMenuItem(editor, item); 535 537 menu.add(item); 538 + 539 + item.setPreferredSize(menuItemDimension); 536 540 } 537 541 538 542 private void addEditorMenu(JMenuBar menuBar) ··· 622 626 menu.add(item); 623 627 } 624 628 625 - private JMenu getTransformMenu() 626 - { 627 - JMenuItem item; 628 - 629 - JMenu transformMenu = new JMenu("Transform"); 630 - transformMenu.getPopupMenu().setLightWeightPopupEnabled(false); 631 - 632 - item = new JMenuItem("Translate"); 633 - addButtonCommand(item, GuiCommand.SHOW_TRANSLATE_SELECTION_DIALOG); 634 - transformMenu.add(item); 635 - item.setPreferredSize(menuItemDimension); 636 - 637 - item = new JMenuItem("Rotate"); 638 - addButtonCommand(item, GuiCommand.SHOW_ROTATE_SELECTION_DIALOG); 639 - transformMenu.add(item); 640 - 641 - item = new JMenuItem("Scale"); 642 - addButtonCommand(item, GuiCommand.SHOW_SCALE_SELECTION_DIALOG); 643 - transformMenu.add(item); 644 - 645 - item = new JMenuItem("Resize"); 646 - addButtonCommand(item, GuiCommand.SHOW_RESIZE_SELECTION_DIALOG); 647 - transformMenu.add(item); 648 - 649 - item = new JMenuItem("Flip"); 650 - addButtonCommand(item, GuiCommand.SHOW_FLIP_SELECTION_DIALOG); 651 - transformMenu.add(item); 652 - 653 - return transformMenu; 654 - } 655 - 656 629 private void addMapMenu(JMenuBar menuBar) 657 630 { 658 631 JMenu menu = new JMenu(MENU_BAR_SPACING + "Map" + MENU_BAR_SPACING); ··· 719 692 menuBar.add(menu); 720 693 JMenuItem item; 721 694 722 - menu.add(getTransformMenu()); 695 + item = new JMenuItem("Translate"); 696 + addButtonCommand(item, GuiCommand.SHOW_TRANSLATE_SELECTION_DIALOG); 697 + menu.add(item); 698 + 699 + item = new JMenuItem("Rotate"); 700 + addButtonCommand(item, GuiCommand.SHOW_ROTATE_SELECTION_DIALOG); 701 + menu.add(item); 702 + 703 + item = new JMenuItem("Scale"); 704 + addButtonCommand(item, GuiCommand.SHOW_SCALE_SELECTION_DIALOG); 705 + menu.add(item); 706 + 707 + item = new JMenuItem("Resize"); 708 + addButtonCommand(item, GuiCommand.SHOW_RESIZE_SELECTION_DIALOG); 709 + menu.add(item); 710 + 711 + item = new JMenuItem("Flip"); 712 + addButtonCommand(item, GuiCommand.SHOW_FLIP_SELECTION_DIALOG); 713 + menu.add(item); 723 714 724 715 menu.addSeparator(); 725 716 726 - item = new JMenuItem("Export"); 727 - addButtonCommand(item, GuiCommand.SAVE_OBJECTS); 717 + item = new JMenuItem("Save as Prefab"); 718 + addButtonCommand(item, GuiCommand.SAVE_PREFAB); 728 719 menu.add(item); 729 720 730 721 menu.addSeparator(); ··· 1163 1154 prompt_SaveMapAs(); 1164 1155 break; 1165 1156 1166 - case LOAD_OBJECTS: 1167 - prompt_ImportObjects(null); 1157 + case PROMPT_EXPORT: 1158 + prompt_Import(); 1159 + break; 1160 + case PROMPT_IMPORT: 1161 + prompt_Export(); 1168 1162 break; 1169 - case SAVE_OBJECTS: 1170 - prompt_ExportObjects(); 1163 + case SAVE_PREFAB: 1164 + prompt_Prefab(); 1171 1165 break; 1172 1166 1173 1167 case SHOW_TRANSLATE_SELECTION_DIALOG: ··· 1250 1244 // following commands are forwarded directly to the editor 1251 1245 /* 1252 1246 case SAVE_MAP: 1253 - 1247 + 1254 1248 case COMPILE_SHAPE: 1255 1249 case COMPILE_COLLISION: 1256 - 1250 + 1257 1251 case SHOW_MODELS: 1258 1252 case SHOW_COLLIDERS: 1259 1253 case SHOW_ZONES: 1260 1254 case SHOW_MARKERS: 1261 - 1255 + 1262 1256 case RESET_CAMERAS: 1263 1257 case RESET_LAYOUT: 1264 - 1258 + 1265 1259 case SEPARATE_VERTS: 1266 1260 case FUSE_VERTS: 1267 1261 case JOIN_MODELS: 1268 1262 case SPLIT_MODEL: 1269 - 1263 + 1270 1264 case CONVERT_COLLIDER_TO_ZONE: 1271 1265 case CONVERT_ZONE_TO_COLLIDER: 1272 - 1266 + 1273 1267 case CREATE_COLLIDER_GROUP: 1274 1268 case CREATE_ZONE_GROUP: 1275 - 1269 + 1276 1270 case DEBUG_RECOMPUTE_BOUNDING_BOXES: 1277 1271 */ 1278 1272 default: ··· 1365 1359 } 1366 1360 } 1367 1361 1362 + //XXX 1368 1363 public void prompt_ImportObjects(MapObjectNode<? extends MapObject> node) 1369 1364 { 1370 1365 openDialogCount.increment(); ··· 1375 1370 openDialogCount.decrement(); 1376 1371 } 1377 1372 1378 - private void prompt_ExportObjects() 1373 + public void prompt_Import() 1374 + { 1375 + //TODO if needed 1376 + /* 1377 + if (importDialog == null) 1378 + importDialog = new ImportDialog(this); 1379 + 1380 + importDialog.pack(); 1381 + importDialog.setVisible(true); 1382 + */ 1383 + } 1384 + 1385 + public void prompt_Export() 1386 + { 1387 + exportFileChooser.setFilters(null, "obj", "fbx"); 1388 + 1389 + openDialogCount.increment(); 1390 + if (exportFileChooser.prompt() == ChooseDialogResult.APPROVE) { 1391 + File f = exportFileChooser.getSelectedFile(); 1392 + editor.map.exportToFile(f); 1393 + } 1394 + openDialogCount.decrement(); 1395 + 1396 + //TODO if needed 1397 + /* 1398 + if (exportDialog == null) 1399 + exportDialog = new ExportDialog(this); 1400 + 1401 + exportDialog.pack(); 1402 + exportDialog.setVisible(true); 1403 + */ 1404 + } 1405 + 1406 + public void prompt_Prefab() 1379 1407 { 1380 1408 Selection<?> selection = editor.selectionManager.currentSelection; 1381 1409 1382 1410 if (selection.isEmpty()) 1383 1411 return; 1412 + 1413 + exportFileChooser.setFilters("Prefabs", "prefab"); 1384 1414 1385 1415 openDialogCount.increment(); 1386 1416 if (exportFileChooser.prompt() == ChooseDialogResult.APPROVE) {
+1 -1
src/main/java/game/map/editor/ui/dialogs/GeneratePrimitiveOptionsDialog.java
··· 18 18 import javax.swing.WindowConstants; 19 19 20 20 import app.SwingUtils; 21 + import common.Vector3f; 21 22 import game.map.editor.MapEditor; 22 - import game.map.editor.geometry.Vector3f; 23 23 import game.map.editor.geometry.primitive.BeveledCubeGenerator; 24 24 import game.map.editor.geometry.primitive.ConeGenerator; 25 25 import game.map.editor.geometry.primitive.CubeGenerator;
+8 -2
src/main/java/game/map/editor/ui/dialogs/SaveFileChooser.java
··· 13 13 public class SaveFileChooser 14 14 { 15 15 private final String title; 16 - private final String filterName; 17 - private final String[] filterExts; 16 + private String filterName; 17 + private String[] filterExts; 18 18 19 19 private File currentDirectory = null; 20 20 private File selected = null; ··· 36 36 { 37 37 currentDirectory = dir; 38 38 return prompt(); 39 + } 40 + 41 + public void setFilters(String filterName, String ... filterExts) 42 + { 43 + this.filterName = filterName; 44 + this.filterExts = filterExts; 39 45 } 40 46 41 47 public ChooseDialogResult prompt()
+1 -2
src/main/java/game/map/editor/ui/dialogs/TransformSelectionPanel.java
··· 12 12 import javax.swing.SwingConstants; 13 13 import javax.swing.SwingUtilities; 14 14 15 - import game.map.editor.geometry.Vector3f; 16 - 15 + import common.Vector3f; 17 16 import game.map.Axis; 18 17 import game.map.editor.selection.Selection; 19 18 import game.map.shape.TransformMatrix;
+1 -1
src/main/java/game/map/editor/ui/info/ModelInfoPanel.java
··· 223 223 224 224 hasMeshCheckbox.setSelected(mdl.hasMesh()); 225 225 226 - // leaf properies 226 + // leaf properties 227 227 228 228 previewScrollUnitBox.setSelectedIndex(mdl.pannerID.get() + 1); 229 229
+1 -2
src/main/java/game/map/editor/ui/info/marker/CamTargetSubpanel.java
··· 6 6 import javax.swing.JPanel; 7 7 import javax.swing.SwingConstants; 8 8 9 - import game.map.editor.geometry.Vector3f; 10 - 11 9 import app.SwingUtils; 10 + import common.Vector3f; 12 11 import game.map.MutablePoint.SetPosition; 13 12 import game.map.editor.MapEditor; 14 13 import game.map.editor.ui.info.CameraInfoPanel;
+1 -1
src/main/java/game/map/hit/CameraZoneData.java
··· 8 8 9 9 import org.w3c.dom.Element; 10 10 11 + import common.Vector3f; 11 12 import game.map.MapObject; 12 13 import game.map.MutablePoint; 13 14 import game.map.editor.MapEditor; ··· 17 18 import game.map.editor.commands.fields.EditableField; 18 19 import game.map.editor.commands.fields.EditableField.EditableFieldFactory; 19 20 import game.map.editor.geometry.GeometryUtils; 20 - import game.map.editor.geometry.Vector3f; 21 21 import game.map.editor.render.PresetColor; 22 22 import game.map.editor.render.Renderer; 23 23 import game.map.editor.selection.SelectablePoint;
+1 -1
src/main/java/game/map/impex/ObjExporter.java
··· 7 7 import java.util.IdentityHashMap; 8 8 9 9 import app.input.IOUtils; 10 - import game.map.editor.geometry.Vector3f; 10 + import common.Vector3f; 11 11 import game.map.hit.Collider; 12 12 import game.map.hit.Zone; 13 13 import game.map.mesh.BasicMesh;
+1 -1
src/main/java/game/map/impex/ObjImporter.java
··· 7 7 import java.util.ArrayList; 8 8 import java.util.List; 9 9 10 + import common.Vector3f; 10 11 import game.map.MapObject; 11 12 import game.map.MapObject.HitType; 12 - import game.map.editor.geometry.Vector3f; 13 13 import game.map.hit.Collider; 14 14 import game.map.hit.Zone; 15 15 import game.map.mesh.Triangle;
+1 -1
src/main/java/game/map/marker/CamTargetComponent.java
··· 7 7 8 8 import org.w3c.dom.Element; 9 9 10 + import common.Vector3f; 10 11 import game.map.Map; 11 12 import game.map.MutablePoint; 12 13 import game.map.MutablePoint.PointBackup; ··· 15 16 import game.map.editor.commands.fields.EditableField; 16 17 import game.map.editor.commands.fields.EditableField.EditableFieldFactory; 17 18 import game.map.editor.commands.fields.EditableField.StandardBoolName; 18 - import game.map.editor.geometry.Vector3f; 19 19 import game.map.editor.render.PresetColor; 20 20 import game.map.editor.render.Renderer; 21 21 import game.map.editor.render.RenderingOptions;
+1 -1
src/main/java/game/map/marker/Marker.java
··· 6 6 import java.util.Collection; 7 7 import java.util.List; 8 8 9 - import game.map.editor.geometry.Vector3f; 10 9 import org.w3c.dom.Element; 11 10 11 + import common.Vector3f; 12 12 import game.map.Axis; 13 13 import game.map.BoundingBox; 14 14 import game.map.Map;
+2 -2
src/main/java/game/map/marker/NpcComponent.java
··· 10 10 import org.w3c.dom.Element; 11 11 12 12 import app.StarRodException; 13 + import common.BaseCamera; 14 + import common.Vector3f; 13 15 import game.map.Axis; 14 16 import game.map.MutablePoint; 15 17 import game.map.MutablePoint.PointBackup; ··· 18 20 import game.map.editor.commands.fields.EditableField; 19 21 import game.map.editor.commands.fields.EditableField.EditableFieldFactory; 20 22 import game.map.editor.commands.fields.EditableField.StandardBoolName; 21 - import game.map.editor.common.BaseCamera; 22 - import game.map.editor.geometry.Vector3f; 23 23 import game.map.editor.render.PresetColor; 24 24 import game.map.editor.render.RenderMode; 25 25 import game.map.editor.render.Renderer;
+1 -1
src/main/java/game/map/marker/PathComponent.java
··· 9 9 10 10 import org.w3c.dom.Element; 11 11 12 + import common.Vector3f; 12 13 import game.map.MutablePoint; 13 14 import game.map.MutablePoint.PointBackup; 14 15 import game.map.editor.camera.MapEditViewport; ··· 16 17 import game.map.editor.commands.fields.EditableField; 17 18 import game.map.editor.commands.fields.EditableField.EditableFieldFactory; 18 19 import game.map.editor.commands.fields.EditableField.StandardBoolName; 19 - import game.map.editor.geometry.Vector3f; 20 20 import game.map.editor.render.PresetColor; 21 21 import game.map.editor.render.Renderer; 22 22 import game.map.editor.render.RenderingOptions;
+1 -2
src/main/java/game/map/marker/PathData.java
··· 3 3 import java.util.LinkedList; 4 4 import java.util.List; 5 5 6 - import game.map.editor.geometry.Vector3f; 7 - 6 + import common.Vector3f; 8 7 import game.map.editor.MapEditor; 9 8 import game.map.editor.commands.AbstractCommand; 10 9 import game.map.editor.geometry.GeometryUtils;
+1 -1
src/main/java/game/map/mesh/Triangle.java
··· 6 6 7 7 import org.w3c.dom.Element; 8 8 9 + import common.Vector3f; 9 10 import game.map.Axis; 10 11 import game.map.BoundingBox; 11 12 import game.map.MutablePoint; 12 13 import game.map.PointListBackup; 13 14 import game.map.ReversibleTransform; 14 15 import game.map.editor.geometry.GeometryUtils; 15 - import game.map.editor.geometry.Vector3f; 16 16 import game.map.editor.selection.Selectable; 17 17 import game.map.shape.TransformMatrix; 18 18 import game.map.shape.TriangleBatch;
+1 -1
src/main/java/game/map/mesh/Vertex.java
··· 6 6 7 7 import org.w3c.dom.Element; 8 8 9 + import common.Vector3f; 9 10 import game.map.Axis; 10 11 import game.map.BoundingBox; 11 12 import game.map.MutablePoint; 12 13 import game.map.MutablePoint.PointBackup; 13 14 import game.map.ReversibleTransform; 14 - import game.map.editor.geometry.Vector3f; 15 15 import game.map.editor.selection.Selectable; 16 16 import game.map.shape.Model; 17 17 import game.map.shape.TransformMatrix;
+1 -2
src/main/java/game/map/scripts/ScriptGenerator.java
··· 7 7 import java.util.LinkedList; 8 8 import java.util.List; 9 9 10 - import game.map.editor.geometry.Vector3f; 11 - 12 10 import app.input.InvalidInputException; 11 + import common.Vector3f; 13 12 import game.DataUtils; 14 13 import game.ScriptVariable; 15 14 import game.entity.EntityInfo.EntityType;
+20 -5
src/main/java/game/map/shading/ShadingLightSource.java
··· 7 7 8 8 import org.w3c.dom.Element; 9 9 10 + import common.Vector3f; 10 11 import game.ProjectDatabase; 11 12 import game.map.Axis; 12 13 import game.map.MutablePoint; ··· 17 18 import game.map.editor.commands.fields.EditableField; 18 19 import game.map.editor.commands.fields.EditableField.EditableFieldFactory; 19 20 import game.map.editor.commands.fields.EditableField.StandardBoolName; 20 - import game.map.editor.geometry.Vector3f; 21 21 import game.map.editor.render.Renderer; 22 22 import game.map.editor.render.RenderingOptions; 23 23 import game.map.editor.render.TextureManager; ··· 276 276 texShader.multiplyBaseColor.set(true); 277 277 texShader.selected.set(selected); 278 278 279 - Vector3f deltaPos = Vector3f.sub(cameraPos, position.getVector()); 280 - double R = Math.sqrt(deltaPos.x * deltaPos.x + deltaPos.z * deltaPos.z); 281 - float renderYaw = -(float) Math.toDegrees(Math.atan2(deltaPos.x, deltaPos.z)); 282 - float renderPitch = (float) Math.toDegrees(Math.atan2(deltaPos.y, R)); 279 + float renderYaw = 0; 280 + float renderPitch = 0; 281 + 282 + switch (viewport.type) { 283 + case PERSPECTIVE: 284 + Vector3f deltaPos = Vector3f.sub(cameraPos, position.getVector()); 285 + double R = Math.sqrt(deltaPos.x * deltaPos.x + deltaPos.z * deltaPos.z); 286 + renderYaw = -(float) Math.toDegrees(Math.atan2(deltaPos.x, deltaPos.z)); 287 + renderPitch = (float) Math.toDegrees(Math.atan2(deltaPos.y, R)); 288 + break; 289 + case FRONT: 290 + break; 291 + case SIDE: 292 + renderYaw = 90.0f; 293 + break; 294 + case TOP: 295 + renderPitch = 90.0f; 296 + break; 297 + } 283 298 284 299 TransformMatrix mtx = TransformMatrix.identity(); 285 300 mtx.rotate(Axis.X, -renderPitch);
+2 -2
src/main/java/game/map/shading/ShadingProfile.java
··· 12 12 import javax.swing.JLabel; 13 13 import javax.swing.JList; 14 14 15 - import game.map.editor.geometry.Vector3f; 16 15 import org.w3c.dom.Element; 17 16 18 17 import app.SwingUtils; 18 + import common.BaseCamera; 19 + import common.Vector3f; 19 20 import game.ProjectDatabase; 20 21 import game.map.Axis; 21 22 import game.map.editor.MapEditor; ··· 24 25 import game.map.editor.commands.AbstractCommand; 25 26 import game.map.editor.commands.fields.EditableField; 26 27 import game.map.editor.commands.fields.EditableField.EditableFieldFactory; 27 - import game.map.editor.common.BaseCamera; 28 28 import game.map.editor.render.RenderingOptions; 29 29 import game.map.shading.ShadingLightSource.FalloffType; 30 30 import game.map.shading.SpriteShadingEditor.JsonShadingLight;
+2 -2
src/main/java/game/map/shape/ModelRenderer.java
··· 3 3 import static org.lwjgl.opengl.GL11.*; 4 4 import static renderer.shaders.scene.ModelShader.*; 5 5 6 - import game.map.editor.common.BaseCamera; 7 - import game.map.editor.geometry.Vector3f; 6 + import common.BaseCamera; 7 + import common.Vector3f; 8 8 import game.map.editor.render.RenderMode; 9 9 import game.map.editor.render.Renderer; 10 10 import game.map.editor.render.RenderingOptions;
+1 -1
src/main/java/game/map/shape/SynchronizedUV.java
··· 1 1 package game.map.shape; 2 2 3 + import common.Vector3f; 3 4 import game.map.editor.geometry.GeometryUtils; 4 - import game.map.editor.geometry.Vector3f; 5 5 import game.map.mesh.Triangle; 6 6 import game.map.mesh.Vertex; 7 7 import util.MathUtil;
+1 -1
src/main/java/game/map/shape/TransformMatrix.java
··· 11 11 import org.lwjgl.BufferUtils; 12 12 import org.w3c.dom.Element; 13 13 14 + import common.Vector3f; 14 15 import game.map.Axis; 15 16 import game.map.MutableAngle; 16 17 import game.map.MutablePoint; 17 - import game.map.editor.geometry.Vector3f; 18 18 import util.Logger; 19 19 import util.MathUtil; 20 20 import util.xml.XmlWrapper.XmlReader;
+1 -2
src/main/java/game/map/shape/UV.java
··· 2 2 3 3 import java.util.Objects; 4 4 5 - import game.map.editor.geometry.Vector3f; 6 - 5 + import common.Vector3f; 7 6 import game.map.Axis; 8 7 import game.map.BoundingBox; 9 8 import game.map.MutablePoint;
+1 -1
src/main/java/game/map/shape/UVGenerator.java
··· 2 2 3 3 import java.util.Collection; 4 4 5 + import common.Vector3f; 5 6 import game.map.Axis; 6 7 import game.map.BoundingBox; 7 8 import game.map.editor.MapEditor; 8 - import game.map.editor.geometry.Vector3f; 9 9 import game.map.editor.selection.Selection; 10 10 import game.map.mesh.Triangle; 11 11 import game.map.mesh.Vertex;
+1 -1
src/main/java/game/map/shape/UVUnwrapper.java
··· 4 4 import java.util.HashMap; 5 5 import java.util.List; 6 6 7 + import common.Vector3f; 7 8 import game.map.editor.MapEditor; 8 - import game.map.editor.geometry.Vector3f; 9 9 import game.map.editor.selection.Selection; 10 10 import game.map.mesh.Triangle; 11 11 import game.map.mesh.Vertex;
+1 -45
src/main/java/game/map/tree/MapObjectJTree.java
··· 1 1 package game.map.tree; 2 2 3 - import java.awt.Component; 4 - import java.awt.Font; 5 3 import java.awt.Rectangle; 6 4 import java.awt.datatransfer.DataFlavor; 7 5 import java.awt.datatransfer.Transferable; ··· 26 24 import javax.swing.KeyStroke; 27 25 import javax.swing.SwingUtilities; 28 26 import javax.swing.TransferHandler; 29 - import javax.swing.tree.DefaultMutableTreeNode; 30 - import javax.swing.tree.DefaultTreeCellRenderer; 31 27 import javax.swing.tree.DefaultTreeSelectionModel; 32 - import javax.swing.tree.TreeCellRenderer; 33 28 import javax.swing.tree.TreePath; 34 29 import javax.swing.tree.TreeSelectionModel; 35 30 ··· 39 34 import game.map.editor.commands.AbstractCommand; 40 35 import game.map.editor.ui.GuiCommand; 41 36 import game.map.editor.ui.MapObjectPanel; 37 + import game.map.editor.ui.MapObjectTreeCellRenderer; 42 38 import game.map.editor.ui.SwingGUI; 43 39 import util.BasicNode; 44 40 import util.Logger; ··· 69 65 70 66 public MapObjectNode<T> dropDestination = null; 71 67 public int dropChildIndex = 0; 72 - 73 - private static class MapObjectTreeCellRenderer extends DefaultTreeCellRenderer implements TreeCellRenderer 74 - { 75 - /* 76 - private static final Dimension DEFAULT_SIZE = new Dimension(300,20); 77 - 78 - @Override 79 - public Dimension getPreferredSize() 80 - { 81 - return DEFAULT_SIZE; 82 - } 83 - */ 84 - 85 - @Override 86 - public Component getTreeCellRendererComponent(JTree tree, Object obj, 87 - boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) 88 - { 89 - super.getTreeCellRendererComponent(tree, obj, selected, expanded, leaf, row, hasFocus); 90 - DefaultMutableTreeNode node = (DefaultMutableTreeNode) obj; 91 - if (node.getAllowsChildren()) 92 - if (expanded) 93 - setIcon(openIcon); 94 - else 95 - setIcon(closedIcon); 96 - else 97 - setIcon(leafIcon); 98 - 99 - if (node.getUserObject() instanceof MapObject mobj) { 100 - if (mobj.hidden) 101 - setFont(getFont().deriveFont(Font.ITALIC)); 102 - else 103 - setFont(getFont().deriveFont(Font.PLAIN)); 104 - setText(mobj.toString()); 105 - 106 - setForeground(null); 107 - } 108 - 109 - return this; 110 - } 111 - } 112 68 113 69 /** 114 70 * The JTree implementation does not include a mechanism for TreeSelectionListeners
+2 -3
src/main/java/game/message/editor/MessageEditor.java
··· 76 76 import assets.AssetHandle; 77 77 import assets.AssetManager; 78 78 import assets.AssetSubdir; 79 - import game.map.editor.common.BaseEditor; 80 - import game.map.editor.common.BaseEditorSettings; 79 + import common.BaseEditor; 80 + import common.BaseEditorSettings; 81 81 import game.map.editor.ui.dialogs.ChooseDialogResult; 82 82 import game.map.editor.ui.dialogs.OpenFileChooser; 83 83 import game.message.Message; ··· 1135 1135 .setMessage(detailScrollPane) 1136 1136 .setMessageType(JOptionPane.PLAIN_MESSAGE) 1137 1137 .setOptionsType(JOptionPane.YES_NO_CANCEL_OPTION) 1138 - .setIcon(Environment.ICON_DEFAULT) 1139 1138 .setOptions("Copy to Clipboard") 1140 1139 .choose(); 1141 1140 super.decrementDialogsOpen();
+2 -2
src/main/java/game/message/editor/MessageRenderer.java
··· 16 16 import org.lwjgl.BufferUtils; 17 17 18 18 import assets.ExpectedAsset; 19 + import common.MouseInput; 20 + import common.Vector3f; 19 21 import game.SimpleItem; 20 22 import game.map.Axis; 21 - import game.map.editor.common.MouseInput; 22 - import game.map.editor.geometry.Vector3f; 23 23 import game.map.editor.render.PresetColor; 24 24 import game.map.editor.render.TextureManager; 25 25 import game.map.shape.TransformMatrix;
+1 -1
src/main/java/game/sprite/Sprite.java
··· 12 12 import java.util.Queue; 13 13 14 14 import org.apache.commons.io.FilenameUtils; 15 - import game.map.editor.geometry.Vector3f; 16 15 import org.w3c.dom.Element; 17 16 18 17 import app.input.InputFileException; 18 + import common.Vector3f; 19 19 import game.map.BoundingBox; 20 20 import game.map.shading.ShadingProfile; 21 21 import game.sprite.SpriteLoader.SpriteSet;
+1 -1
src/main/java/game/sprite/SpriteComponent.java
··· 12 12 import org.w3c.dom.Element; 13 13 import org.w3c.dom.Node; 14 14 15 + import common.Vector3f; 15 16 import game.map.Axis; 16 17 import game.map.BoundingBox; 17 - import game.map.editor.geometry.Vector3f; 18 18 import game.map.editor.render.PresetColor; 19 19 import game.map.shading.ShadingProfile; 20 20 import game.map.shape.TransformMatrix;
+5 -5
src/main/java/game/sprite/editor/SpriteCamera.java
··· 2 2 3 3 import java.awt.event.KeyEvent; 4 4 5 - import game.map.editor.common.BaseCamera; 6 - import game.map.editor.common.KeyboardInput; 7 - import game.map.editor.common.MouseInput; 8 - import game.map.editor.common.MousePixelRead; 9 - import game.map.editor.geometry.Vector3f; 5 + import common.BaseCamera; 6 + import common.KeyboardInput; 7 + import common.MouseInput; 8 + import common.MousePixelRead; 9 + import common.Vector3f; 10 10 import game.map.editor.render.TextureManager; 11 11 import renderer.shaders.RenderState; 12 12 import renderer.shaders.ShaderManager;
+8 -7
src/main/java/game/sprite/editor/SpriteEditor.java
··· 46 46 import app.config.Config; 47 47 import app.config.Options; 48 48 import app.config.Options.Scope; 49 - import game.map.editor.common.BaseEditor; 50 - import game.map.editor.common.BaseEditorSettings; 51 - import game.map.editor.common.KeyboardInput.KeyInputEvent; 49 + import common.BaseEditor; 50 + import common.BaseEditorSettings; 51 + import common.KeyboardInput.KeyInputEvent; 52 52 import game.map.editor.render.PresetColor; 53 53 import game.map.editor.render.TextureManager; 54 54 import game.map.shape.TransformMatrix; ··· 971 971 try { 972 972 int id = SpriteLoader.getMaximumID(spriteSet) + 1; 973 973 SpriteLoader.create(spriteSet, id); 974 - 974 + 975 975 if(spriteSet == SpriteSet.Npc) 976 976 useNpcFiles(id); 977 977 else 978 978 usePlayerFiles(id); 979 - 979 + 980 980 } catch (Throwable t) { 981 981 Logger.logError("Failed to create new sprite."); 982 982 incrementDialogsOpen(); ··· 986 986 }); 987 987 }); 988 988 menu.add(item); 989 - 989 + 990 990 menu.addSeparator(); 991 991 */ 992 992 ··· 1568 1568 if (!xmlFile.exists()) { 1569 1569 super.showErrorDialog( 1570 1570 "Missing XML File", 1571 - String.format("Could not find XML file: %n%s", xmlFile.getAbsolutePath())); 1571 + "Could not find XML file:", 1572 + xmlFile.getAbsolutePath()); 1572 1573 return; 1573 1574 } 1574 1575
+1 -1
src/main/java/game/sprite/editor/animators/CommandAnimator.java
··· 310 310 311 311 for (int i = 0; i < commandListModel.size(); i++) { 312 312 AnimCommand cmd = commandListModel.get(i); 313 - if (cmd instanceof Label lbl) 313 + if (cmd instanceof Label) 314 314 continue; 315 315 cmd.addTo(rawAnim); 316 316 }
+10 -4
src/main/java/game/sprite/editor/animators/CommandAnimatorEditor.java
··· 205 205 palItem.addActionListener((e) -> create(animator.new SetPalette())); 206 206 createMenu.add(palItem); 207 207 208 - JMenuItem parentItem = new JMenuItem("Set Parent"); 209 - parentItem.addActionListener((e) -> create(animator.new SetParent())); 210 - createMenu.add(parentItem); 211 - 212 208 createMenu.addSeparator(); 213 209 214 210 JMenuItem labelItem = new JMenuItem("Label"); ··· 236 232 JMenuItem scaleItem = new JMenuItem("Set Scale"); 237 233 scaleItem.addActionListener((e) -> create(animator.new SetScale())); 238 234 createMenu.add(scaleItem); 235 + 236 + createMenu.addSeparator(); 237 + 238 + JMenuItem parentItem = new JMenuItem("Set Parent"); 239 + parentItem.addActionListener((e) -> create(animator.new SetParent())); 240 + createMenu.add(parentItem); 241 + 242 + JMenuItem notifyItem = new JMenuItem("Set Notify"); 243 + notifyItem.addActionListener((e) -> create(animator.new SetNotify())); 244 + createMenu.add(notifyItem); 239 245 240 246 JScrollPane listScrollPane = new JScrollPane(commandList); 241 247 listScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+1 -1
src/main/java/game/texture/editor/EditorImage.java
··· 10 10 import java.io.File; 11 11 import java.nio.ByteBuffer; 12 12 13 - import game.map.editor.common.BasicEditorCommand; 13 + import common.BasicEditorCommand; 14 14 import game.texture.ImageConverter; 15 15 import game.texture.Palette; 16 16 import game.texture.Tile;
+1 -1
src/main/java/game/texture/editor/FileTransferHandler.java
··· 9 9 10 10 import javax.swing.TransferHandler; 11 11 12 - import game.map.editor.common.BaseEditor; 12 + import common.BaseEditor; 13 13 14 14 public class FileTransferHandler extends TransferHandler 15 15 {
+19 -28
src/main/java/game/texture/editor/ImageEditor.java
··· 1 1 package game.texture.editor; 2 2 3 3 import static org.lwjgl.opengl.GL11.*; 4 - import static org.lwjgl.opengl.GL13.GL_TEXTURE0; 5 - import static org.lwjgl.opengl.GL13.glActiveTexture; 6 4 7 5 import java.awt.Canvas; 8 6 import java.awt.Color; ··· 27 25 28 26 import app.Environment; 29 27 import app.SwingUtils; 30 - import game.map.editor.common.BaseEditor; 31 - import game.map.editor.common.BaseEditorSettings; 32 - import game.map.editor.common.BasicCamera; 33 - import game.map.editor.common.BasicCommandManager; 34 - import game.map.editor.common.BasicEditorCommand; 35 - import game.map.editor.common.KeyboardInput.KeyInputEvent; 36 - import game.map.editor.common.MouseInput.MouseManagerListener; 37 - import game.map.editor.common.MousePixelRead; 28 + import common.BaseEditor; 29 + import common.BaseEditorSettings; 30 + import common.BasicCamera; 31 + import common.BasicCommandManager; 32 + import common.BasicEditorCommand; 33 + import common.KeyboardInput.KeyInputEvent; 34 + import common.MouseInput.MouseManagerListener; 35 + import common.MousePixelRead; 38 36 import game.map.editor.render.PresetColor; 39 37 import game.map.editor.render.TextureManager; 40 38 import game.map.editor.ui.SwatchPanel; ··· 210 208 211 209 glClearStencil(0); 212 210 glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); 213 - 214 - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 215 - 216 - glActiveTexture(GL_TEXTURE0); 217 - glEnable(GL_TEXTURE_2D); 218 - 219 - glEnable(GL_BLEND); 220 - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 221 211 222 212 TextRenderer.init(); 223 213 ··· 904 894 assert (SwingUtilities.isEventDispatchThread()); 905 895 906 896 CreateOptionsPanel createOptions = new CreateOptionsPanel(); 907 - int choice = ImageEditor.super.getConfirmDialog("New Image Options", createOptions).choose(); 897 + int choice = getConfirmDialog("New Image Options", createOptions).choose(); 908 898 if (choice != JOptionPane.OK_OPTION) 909 899 return; 910 900 ··· 967 957 assert (SwingUtilities.isEventDispatchThread()); 968 958 969 959 ImportOptionsPanel importOptions = new ImportOptionsPanel(); 970 - int choice = ImageEditor.super.getConfirmDialog("Import Options", importOptions).choose(); 960 + int choice = getConfirmDialog("Import Options", importOptions).choose(); 971 961 if (choice != JOptionPane.OK_OPTION) 972 962 return; 973 963 ··· 979 969 } 980 970 catch (ImageFormatException e) { 981 971 if (importOptions.getFormat().type == TileFormat.TYPE_CI) { 982 - choice = ImageEditor.super.getConfirmDialog( 983 - "Incorrect Image Format", "Image file is not color-indexed. \nWould you like to convert it?").choose(); 972 + choice = getConfirmDialog("Incorrect Image Format", 973 + "Image file is not color-indexed. \nWould you like to convert it?").choose(); 984 974 if (choice != JOptionPane.OK_OPTION) 985 975 return; 986 976 ··· 1015 1005 assert (SwingUtilities.isEventDispatchThread()); 1016 1006 1017 1007 ImportOptionsPanel importOptions = new ImportOptionsPanel(); 1018 - int choice = ImageEditor.super.getConfirmDialog("Import Options", importOptions).choose(); 1008 + int choice = getConfirmDialog("Import Options", importOptions).choose(); 1019 1009 if (choice != JOptionPane.OK_OPTION) 1020 1010 return null; 1021 1011 ··· 1030 1020 } 1031 1021 catch (ImageFormatException e) { 1032 1022 if (importOptions.getFormat().type == TileFormat.TYPE_CI) { 1033 - ImageEditor.super.showErrorDialog("Incorrect Image Format", 1034 - "Image file is not color-indexed. \nCannot be used for palette."); 1023 + showErrorDialog("Incorrect Image Format", 1024 + "Image file is not color-indexed.", 1025 + "Cannot be used for palette."); 1035 1026 } 1036 1027 else 1037 1028 throw e; ··· 1061 1052 importFileChooser.setDirectoryContaining(image.source.getParentFile()); 1062 1053 if (importFileChooser.prompt() == ChooseDialogResult.APPROVE) { 1063 1054 ImportOptionsPanel importOptions = new ImportOptionsPanel(); 1064 - int choice = ImageEditor.super.getConfirmDialog("Import Options", importOptions).choose(); 1055 + int choice = getConfirmDialog("Import Options", importOptions).choose(); 1065 1056 if (choice != JOptionPane.OK_OPTION) 1066 1057 return; 1067 1058 ··· 1087 1078 return; 1088 1079 1089 1080 ResizeOptionsPanel resizeOptionsPanel = new ResizeOptionsPanel(); 1090 - int choice = ImageEditor.super.getConfirmDialog("Resize Image Options", resizeOptionsPanel).choose(); 1081 + int choice = getConfirmDialog("Resize Image Options", resizeOptionsPanel).choose(); 1091 1082 if (choice != JOptionPane.OK_OPTION) 1092 1083 return; 1093 1084 ··· 1106 1097 return; 1107 1098 1108 1099 ConvertOptionsPanel convertOptionsPanel = new ConvertOptionsPanel(); 1109 - int choice = ImageEditor.super.getConfirmDialog("Convert Image Options", convertOptionsPanel).choose(); 1100 + int choice = getConfirmDialog("Convert Image Options", convertOptionsPanel).choose(); 1110 1101 if (choice != JOptionPane.OK_OPTION) 1111 1102 return; 1112 1103
+8 -8
src/main/java/game/worldmap/WorldMapEditor.java
··· 27 27 import app.Environment; 28 28 import app.SwingUtils; 29 29 import assets.ExpectedAsset; 30 + import common.BaseEditor; 31 + import common.BaseEditorSettings; 32 + import common.BasicCamera; 33 + import common.BasicCommandManager; 34 + import common.BasicEditorCommand; 35 + import common.MousePixelRead; 36 + import common.KeyboardInput.KeyInputEvent; 37 + import common.MouseInput.MouseManagerListener; 30 38 import game.ProjectDatabase; 31 - import game.map.editor.common.BaseEditor; 32 - import game.map.editor.common.BaseEditorSettings; 33 - import game.map.editor.common.BasicCamera; 34 - import game.map.editor.common.BasicCommandManager; 35 - import game.map.editor.common.BasicEditorCommand; 36 - import game.map.editor.common.KeyboardInput.KeyInputEvent; 37 - import game.map.editor.common.MouseInput.MouseManagerListener; 38 - import game.map.editor.common.MousePixelRead; 39 39 import game.map.editor.render.PresetColor; 40 40 import game.map.editor.render.TextureManager; 41 41 import game.worldmap.WorldMapModder.WorldLocation;
+14
src/main/java/renderer/shaders/RenderState.java
··· 1 1 package renderer.shaders; 2 2 3 3 import static org.lwjgl.opengl.GL11.*; 4 + import static org.lwjgl.opengl.GL13.GL_TEXTURE0; 5 + import static org.lwjgl.opengl.GL13.glActiveTexture; 4 6 import static org.lwjgl.opengl.GL15.*; 5 7 import static org.lwjgl.opengl.GL20.glUseProgram; 6 8 import static org.lwjgl.opengl.GL30.glBindVertexArray; ··· 26 28 { 27 29 rec = new StateRecord(); 28 30 stack = new Stack<>(); 31 + 32 + glEnable(GL_POINT_SMOOTH); 33 + glHint(GL_POINT_SMOOTH, GL_NICEST); 34 + 35 + glEnable(GL_LINE_SMOOTH); 36 + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); 37 + 38 + // glEnable(GL_POLYGON_SMOOTH); 39 + // glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); 40 + 41 + glActiveTexture(GL_TEXTURE0); 42 + glEnable(GL_TEXTURE_2D); 29 43 30 44 initProgram(); 31 45 initVAO();
+1 -1
src/main/java/renderer/shaders/postprocess/DOFShader.java
··· 1 1 package renderer.shaders.postprocess; 2 2 3 + import common.BaseCamera; 3 4 import game.map.editor.MapEditor; 4 - import game.map.editor.common.BaseCamera; 5 5 import game.map.scripts.ScriptData; 6 6 import renderer.shaders.components.UniformFloat; 7 7
+1 -1
src/main/java/renderer/shaders/postprocess/DepthShader.java
··· 1 1 package renderer.shaders.postprocess; 2 2 3 + import common.BaseCamera; 3 4 import game.map.editor.MapEditor; 4 - import game.map.editor.common.BaseCamera; 5 5 import game.map.scripts.ScriptData; 6 6 import renderer.shaders.components.UniformFloat; 7 7
+1 -2
src/main/java/renderer/text/DrawableString.java
··· 2 2 3 3 import static renderer.buffers.BufferedMesh.*; 4 4 5 - import game.map.editor.geometry.Vector3f; 6 - 5 + import common.Vector3f; 7 6 import game.map.shape.TransformMatrix; 8 7 import renderer.buffers.BufferedMesh; 9 8 import renderer.shaders.ShaderManager;
+1 -2
src/main/java/renderer/text/TextStyle.java
··· 1 1 package renderer.text; 2 2 3 - import game.map.editor.geometry.Vector3f; 4 - 3 + import common.Vector3f; 5 4 import game.map.editor.render.PresetColor; 6 5 import renderer.shaders.scene.BasicSolidShader; 7 6 import renderer.shaders.scene.TextShader;
+1 -1
src/main/java/util/MathUtil.java
··· 1 1 package util; 2 2 3 - import game.map.editor.geometry.Vector3f; 3 + import common.Vector3f; 4 4 5 5 public abstract class MathUtil 6 6 {
+45
src/main/java/util/ui/CircleIcon.java
··· 1 + package util.ui; 2 + 3 + import java.awt.BasicStroke; 4 + import java.awt.Component; 5 + import java.awt.Graphics2D; 6 + import java.awt.RenderingHints; 7 + import java.awt.Shape; 8 + import java.awt.geom.Ellipse2D; 9 + 10 + import javax.swing.UIManager; 11 + 12 + import com.formdev.flatlaf.icons.FlatAbstractIcon; 13 + 14 + public class CircleIcon extends FlatAbstractIcon 15 + { 16 + private static CircleIcon instance; 17 + 18 + public static CircleIcon instance() 19 + { 20 + if (instance == null) 21 + instance = new CircleIcon(); 22 + return instance; 23 + } 24 + 25 + private Shape circle; 26 + 27 + private CircleIcon() 28 + { 29 + super(12, 16, UIManager.getColor("Tree.icon.openColor")); 30 + 31 + double centerX = 6; 32 + double centerY = 8; 33 + double radius = 4; 34 + circle = new Ellipse2D.Double(centerX - radius, centerY - radius, 2.0 * radius, 2.0 * radius); 35 + } 36 + 37 + @Override 38 + protected void paintIcon(Component c, Graphics2D g) 39 + { 40 + g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); 41 + g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 42 + 43 + g.draw(circle); 44 + } 45 + }
+22
src/main/java/util/ui/EnumComboBox.java
··· 1 + package util.ui; 2 + 3 + import java.util.LinkedHashMap; 4 + 5 + import javax.swing.JComboBox; 6 + 7 + public class EnumComboBox extends JComboBox<String> 8 + { 9 + private final LinkedHashMap<String, Integer> itemMap; 10 + 11 + public EnumComboBox(LinkedHashMap<String, Integer> itemMap) 12 + { 13 + super(itemMap.keySet().toArray(new String[0])); 14 + this.itemMap = itemMap; 15 + } 16 + 17 + public Integer getSelectedValue() 18 + { 19 + String selectedKey = (String) getSelectedItem(); 20 + return itemMap.get(selectedKey); 21 + } 22 + }