Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
Conflicts:
	src/itdelatrisu/opsu/ErrorHandler.java
	src/itdelatrisu/opsu/Opsu.java
	src/itdelatrisu/opsu/Options.java
	src/itdelatrisu/opsu/objects/curves/Curve.java
	src/itdelatrisu/opsu/render/CurveRenderState.java
	src/itdelatrisu/opsu/render/Rendertarget.java
	src/itdelatrisu/opsu/states/GamePauseMenu.java
	src/itdelatrisu/opsu/states/OptionsMenu.java
  • Loading branch information
fd committed Sep 1, 2015
2 parents 950dddd + 8efcc1f commit da9065b
Show file tree
Hide file tree
Showing 43 changed files with 1,602 additions and 532 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
.metadata
.classpath
.project
.externalToolBuilders/

# IntelliJ
.idea/
Expand Down
17 changes: 11 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>itdelatrisu</groupId>
<artifactId>opsu</artifactId>
<version>0.10.0</version>
<version>0.10.1</version>
<properties>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
Expand Down Expand Up @@ -142,12 +142,12 @@
<dependency>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>lwjgl</artifactId>
<version>2.9.1</version>
<version>2.9.3</version>
</dependency>
<dependency>
<groupId>org.slick2d</groupId>
<artifactId>slick2d-core</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.jcraft</groupId>
Expand Down Expand Up @@ -197,17 +197,22 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.0.3</version>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.8</version>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.tukaani</groupId>
<artifactId>xz</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>com.github.jponge</groupId>
<artifactId>lzma-java</artifactId>
<version>1.2</version>
<version>1.3</version>
</dependency>
</dependencies>
</project>
Binary file removed res/bang.png
Binary file not shown.
Binary file added res/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/options-background.jpg
Binary file not shown.
Binary file added res/options-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/update.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/fluddokt/opsu/fake/AudioDevicePlayer2.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public void run() {
len = Math.min(rbuf.length, -samplePos);
for (int i=0; i<len; i++)
rbuf[i] = 0;
System.out.println("Len :" + len);
} else
len = currentStream.read(rbuf);
if (!initedAD) {
Expand Down
78 changes: 44 additions & 34 deletions src/fluddokt/opsu/fake/Desktop.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,44 @@
package fluddokt.opsu.fake;

import java.io.IOException;
import java.net.URI;

import com.badlogic.gdx.Gdx;

public class Desktop {

public static boolean isDesktopSupported() {
// if(Gdx.app.getType() == ApplicationType.Desktop){
// return java.awt.Desktop.isDesktopSupported();
// }
// else
return true;
}

static Desktop single;

public static Desktop getDesktop() {
if (single == null)
single = new Desktop();
return single;
}

public void browse(URI uri) throws IOException {
// if(Gdx.app.getType() == ApplicationType.Desktop){
// java.awt.Desktop.getDesktop().browse(uri);
// } else {
Gdx.net.openURI(uri.toString());
// }
}

}
package fluddokt.opsu.fake;

import java.io.IOException;
import java.net.URI;

import com.badlogic.gdx.Gdx;

import fluddokt.opsu.fake.Desktop.Action;

public class Desktop {

public enum Action {
BROWSE
}

public static boolean isDesktopSupported() {
// if(Gdx.app.getType() == ApplicationType.Desktop){
// return java.awt.Desktop.isDesktopSupported();
// }
// else
return true;
}

static Desktop single;

public static Desktop getDesktop() {
if (single == null)
single = new Desktop();
return single;
}

public void browse(URI uri) throws IOException {
// if(Gdx.app.getType() == ApplicationType.Desktop){
// java.awt.Desktop.getDesktop().browse(uri);
// } else {
Gdx.net.openURI(uri.toString());
// }
}

public boolean isSupported(Action browse) {
return true;
}

}
106 changes: 73 additions & 33 deletions src/itdelatrisu/opsu/ErrorHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
/*
import java.awt.Cursor;
import java.awt.Desktop;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLEncoder;
import java.util.Properties;
Expand All @@ -49,12 +51,13 @@ public class ErrorHandler {
/** Error popup description text. */
private static final String
desc = "opsu! has encountered an error.",
descR = "opsu! has encountered an error. Please report this!";
descReport = "opsu! has encountered an error. Please report this!";

/** Error popup button options. */
private static final String[]
options = {"View Error Log", "Close"},
optionsR = {"Send Report", "View Error Log", "Close"};
optionsLog = {"View Error Log", "Close"},
optionsReport = {"Send Report", "Close"},
optionsLogReport = {"Send Report", "View Error Log", "Close"};

/** Text area for Exception. */
/* private static final JTextArea textArea = new JTextArea(7, 30);
Expand All @@ -64,6 +67,7 @@ public class ErrorHandler {
textArea.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
textArea.setTabSize(2);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
}
*/
/** Scroll pane holding JTextArea. */
Expand Down Expand Up @@ -112,17 +116,62 @@ else if (e == null)
// display popup
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Desktop desktop = null;
boolean isBrowseSupported = false, isOpenSupported = false;
if (Desktop.isDesktopSupported()) {
// try to open the log file and/or issues webpage
if (report) {
// ask to report the error
int n = JOptionPane.showOptionDialog(null, messageR, title,
desktop = Desktop.getDesktop();
isBrowseSupported = desktop.isSupported(Desktop.Action.BROWSE);
isOpenSupported = desktop.isSupported(Desktop.Action.OPEN);
}
if (desktop != null && (isOpenSupported || (report && isBrowseSupported))) { // try to open the log file and/or issues webpage
if (report && isBrowseSupported) { // ask to report the error
if (isOpenSupported) { // also ask to open the log
int n = JOptionPane.showOptionDialog(null, messageReport, title,
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
null, optionsLogReport, optionsLogReport[2]);
if (n == 0)
desktop.browse(getIssueURI(error, e, trace));
else if (n == 1)
desktop.open(Options.LOG_FILE);
} else { // only ask to report the error
int n = JOptionPane.showOptionDialog(null, message, title,
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
null, optionsReport, optionsReport[1]);
if (n == 0)
desktop.browse(getIssueURI(error, e, trace));
}
} else { // don't report the error
int n = JOptionPane.showOptionDialog(null, message, title,
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
null, optionsR, optionsR[2]);
if (n == 0) {
// auto-fill debug information
null, optionsLog, optionsLog[1]);
if (n == 0)
desktop.open(Options.LOG_FILE);
}
} else { // display error only
JOptionPane.showMessageDialog(null, report ? messageReport : message,
title, JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e1) {
Log.error("An error occurred in the crash popup.", e1);
}*/
}

/**
* Returns the issue reporting URI.
* This will auto-fill the report with the relevant information if possible.
* @param error a description of the error
* @param e the exception causing the error
* @param trace the stack trace
* @return the created URI
*/
/*
private static URI getIssueURI(String error, Throwable e, String trace) {
// generate report information
String issueTitle = (error != null) ? error : e.getMessage();
StringBuilder sb = new StringBuilder();
try {
// read version and build date from version file, if possible
Properties props = new Properties();
props.load(ResourceLoader.getResourceAsStream(Options.VERSION_FILE));
String version = props.getProperty("version");
Expand All @@ -138,6 +187,9 @@ else if (e == null)
sb.append(timestamp);
sb.append('\n');
}
} catch (IOException e1) {
Log.warn("Could not read version file.", e1);
}
sb.append("**OS:** ");
sb.append(System.getProperty("os.name"));
sb.append(" (");
Expand All @@ -157,28 +209,16 @@ else if (e == null)
sb.append(trace);
sb.append("```");
}
URI uri = URI.create(String.format(Options.ISSUES_URL,
URLEncoder.encode(issueTitle, "UTF-8"),
URLEncoder.encode(sb.toString(), "UTF-8")));
Desktop.getDesktop().browse(uri);
} else if (n == 1)
Desktop.getDesktop().open(Options.LOG_FILE.getIOFile());
} else {
// don't report the error
int n = JOptionPane.showOptionDialog(null, message, title,
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE,
null, options, options[1]);
if (n == 0)
Desktop.getDesktop().open(Options.LOG_FILE.getIOFile());
}
} else {
// display error only
JOptionPane.showMessageDialog(null, report ? messageR : message,
title, JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e1) {
Log.error("Error opening crash popup.", e1);
// return auto-filled URI
try {
return URI.create(String.format(Options.ISSUES_URL,
URLEncoder.encode(issueTitle, "UTF-8"),
URLEncoder.encode(sb.toString(), "UTF-8")));
} catch (UnsupportedEncodingException e1) {
Log.warn("URLEncoder failed to encode the auto-filled issue report URL.");
return URI.create(String.format(Options.ISSUES_URL, "", ""));
}
*/
}
}*/
}
5 changes: 4 additions & 1 deletion src/itdelatrisu/opsu/GameData.java
Original file line number Diff line number Diff line change
Expand Up @@ -1043,10 +1043,13 @@ else if (hit300ratio >= 60f)
* or {@code Grade.NULL} if no objects have been processed.
*/
private Grade getGrade() {
boolean silver = (scoreData == null) ?
(GameMod.HIDDEN.isActive() || GameMod.FLASHLIGHT.isActive()) :
(scoreData.mods & (GameMod.HIDDEN.getBit() | GameMod.FLASHLIGHT.getBit())) != 0;
return getGrade(
hitResultCount[HIT_300], hitResultCount[HIT_100],
hitResultCount[HIT_50], hitResultCount[HIT_MISS],
(GameMod.HIDDEN.isActive() || GameMod.FLASHLIGHT.isActive())
silver
);
}

Expand Down
10 changes: 8 additions & 2 deletions src/itdelatrisu/opsu/GameImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,16 @@ protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy((h / 17f) / img.getHeight());
}
},
BANG ("bang", "png", false, false) {
DOWNLOAD ("download", "png", false, false) {
@Override
protected Image process_sub(Image img, int w, int h) {
return REPOSITORY.process_sub(img, w, h);
return img.getScaledCopy((h / 14f) / img.getHeight());
}
},
UPDATE ("update", "png", false, false) {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy((h / 14f) / img.getHeight());
}
},
OPTIONS_BG ("options-background", "png|jpg", false, true) {
Expand Down
9 changes: 6 additions & 3 deletions src/itdelatrisu/opsu/GameMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import fluddokt.opsu.fake.*;

import itdelatrisu.opsu.ui.MenuButton;
import itdelatrisu.opsu.ui.animations.AnimationEquation;

import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -50,17 +51,17 @@ public enum GameMod {
"DoubleTime", "Zoooooooooom."),
// NIGHTCORE (Category.HARD, 2, GameImage.MOD_NIGHTCORE, "NT", 64, Input.KEY_D, 1.12f,
// "Nightcore", "uguuuuuuuu"),
HIDDEN (Category.HARD, 3, GameImage.MOD_HIDDEN, "HD", 8, Input.KEY_F, 1.06f, false,
HIDDEN (Category.HARD, 3, GameImage.MOD_HIDDEN, "HD", 8, Input.KEY_F, 1.06f,
"Hidden", "Play with no approach circles and fading notes for a slight score advantage."),
FLASHLIGHT (Category.HARD, 4, GameImage.MOD_FLASHLIGHT, "FL", 1024, Input.KEY_G, 1.12f,
"Flashlight", "Restricted view area."),
RELAX (Category.SPECIAL, 0, GameImage.MOD_RELAX, "RL", 128, Input.KEY_Z, 0f,
"Relax", "You don't need to click.\nGive your clicking/tapping finger a break from the heat of things.\n**UNRANKED**"),
AUTOPILOT (Category.SPECIAL, 1, GameImage.MOD_AUTOPILOT, "AP", 8192, Input.KEY_X, 0f,
"Relax2", "Automatic cursor movement - just follow the rhythm.\n**UNRANKED**"),
SPUN_OUT (Category.SPECIAL, 2, GameImage.MOD_SPUN_OUT, "SO", 4096, Input.KEY_V, 0.9f,
SPUN_OUT (Category.SPECIAL, 2, GameImage.MOD_SPUN_OUT, "SO", 4096, Input.KEY_C, 0.9f,
"SpunOut", "Spinners will be automatically completed."),
AUTO (Category.SPECIAL, 3, GameImage.MOD_AUTO, "", 2048, Input.KEY_B, 1f,
AUTO (Category.SPECIAL, 3, GameImage.MOD_AUTO, "", 2048, Input.KEY_V, 1f,
"Autoplay", "Watch a perfect automated play through the song.");

/** Mod categories. */
Expand Down Expand Up @@ -203,6 +204,8 @@ public static void init(int width, int height) {
mod.button = new MenuButton(img,
baseX + (offsetX * mod.categoryIndex) + img.getWidth() / 2f,
mod.category.getY());
mod.button.setHoverAnimationDuration(300);
mod.button.setHoverAnimationEquation(AnimationEquation.IN_OUT_BACK);
mod.button.setHoverExpand(1.2f);
mod.button.setHoverRotate(10f);

Expand Down
Loading

0 comments on commit da9065b

Please sign in to comment.