Skip to content

Commit

Permalink
Merge branch 'kairusds-testing:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Likver authored Nov 21, 2021
2 parents b0aa81c + b30893e commit 7062ac8
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 44 deletions.
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ While the prerequisites above must be satisfied prior to having your pull reques
* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* When only changing documentation or non-code files, include [ci skip] in the commit title

### Issues
* Must be written in English or Chinese
Expand Down
14 changes: 0 additions & 14 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,4 @@ We must be able to understand the design of your change from this description.
If we can't get a good idea of what the code will be doing from the description here,
the pull request may be stalled or closed at the maintainers' discretion.
-->

### Release Notes
<!--
Please describe the changes in a single line that explains this improvement in
terms that a user can understand. This text will be used in osu!droid's release notes.
Examples:
- The GitHub package now allows you to save failed replays locally.
- Fixed an issue where the game crashes when a 2b map is loaded.
- Increased the performance of gameplay when there's too much notes on a map.
-->
1 change: 1 addition & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.1'
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
3 changes: 1 addition & 2 deletions src/ru/nsu/ccfit/zuev/osu/SkinManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ public void loadBeatmapSkin(final String beatmapFolder) {
if (Config.isUseCustomSounds()
&& (f.getName().toLowerCase().matches(".*[.]wav")
|| f.getName().toLowerCase().matches(".*[.]mp3")
|| f.getName().toLowerCase().matches(".*[.]ogg"))
&& f.length() >= 1024) {
|| f.getName().toLowerCase().matches(".*[.]ogg"))) {
ResourceManager.getInstance().loadCustomSound(f);
} else if (Config.isUseCustomSkins()
&& (f.getName().toLowerCase().matches(".*[.]png")
Expand Down
58 changes: 32 additions & 26 deletions src/ru/nsu/ccfit/zuev/osu/scoring/Replay.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ public void addPress(final float time, final PointF pos, final int pid) {
if (pid > GameScene.CursorCount) return;

int itime = Math.max(0, (int) (time * 1000));
cursorMoves.get(pid).pushBack(itime, (short) pos.x, (short) pos.y, ID_DOWN);
cursorMoves.get(pid).pushBack(itime, pos.x, pos.y, ID_DOWN);
}

public void addMove(final float time, final PointF pos, final int pid) {
if (pid > GameScene.CursorCount) return;

int itime = Math.max(0, (int) (time * 1000));
cursorMoves.get(pid).pushBack(itime, (short) pos.x, (short) pos.y, ID_MOVE);
cursorMoves.get(pid).pushBack(itime, pos.x, pos.y, ID_MOVE);
}

public void addUp(final float time, final int pid) {
Expand Down Expand Up @@ -265,6 +265,7 @@ public boolean loadInfo(final String filename) {

} catch (EOFException e) {
Debug.e("O_o eof...");
Debug.e("Replay.loadInfo: " + e.getMessage(), e);
ToastLogger.showTextId(R.string.replay_corrupted, true);
return false;

Expand Down Expand Up @@ -366,11 +367,11 @@ public boolean load(final String filename) {
objectData[i] = data;
}
} catch (EOFException e) {
Debug.e("O_o eof...");
Debug.e("Replay.load: " + e.getMessage(), e);
ToastLogger.showTextId(R.string.replay_corrupted, true);
return false;

} catch (Exception e) {
}
catch (Exception e) {
ToastLogger.showTextId(R.string.replay_corrupted, true);
Debug.e("Cannot load replay: " + e.getMessage(), e);
return false;
Expand Down Expand Up @@ -407,8 +408,9 @@ public String getMapname() {

public static class ReplayVersion implements Serializable {
private static final long serialVersionUID = 4643121693566795335L;
int version = 4;
int version = 5;
// version 4: Add ExtraModString's save and load in save()/load()/loadInfo()
// version 5: changed gamePoints to be a float type
}

public static class ReplayObjectData {
Expand All @@ -419,8 +421,8 @@ public static class ReplayObjectData {

public static class MoveArray {
public int[] time;
public short[] x;
public short[] y;
public float[] x;
public float[] y;
public byte[] id;

public int size;
Expand All @@ -430,8 +432,8 @@ public MoveArray(int startSize) {
allocated = startSize;
size = 0;
time = new int[allocated];
x = new short[allocated];
y = new short[allocated];
x = new float[allocated];
y = new float[allocated];
id = new byte[allocated];
}

Expand All @@ -444,20 +446,24 @@ public static MoveArray readFrom(ObjectInputStream is, Replay replay) throws IOE
array.id[i] = (byte) (array.time[i] & 3);
array.time[i] >>= 2;
if (array.id[i] != ID_UP) {
PointF gamePoint = new PointF((short) (is.readShort() / Config.getTextureQuality()),
(short) (is.readShort() / Config.getTextureQuality()));
/*if (GameHelper.isHardrock())
{
array.y[i] = Utils.flipY(array.y[i]);
}*/
PointF gamePoint;

if(replay.replayVersion >= 5) {
gamePoint = new PointF((float) (Math.round(is.readFloat()) / Config.getTextureQuality()),
(float) (Math.round(is.readFloat()) / Config.getTextureQuality()));
}else {
gamePoint = new PointF((float) (is.readShort() / Config.getTextureQuality()),
(float) (is.readShort() / Config.getTextureQuality()));
}

if (replay.replayVersion == 1) {
PointF realPoint = Utils.trackToRealCoords(Utils.realToTrackCoords(gamePoint, 1024, 600, true));
array.x[i] = (short) realPoint.x;
array.y[i] = (short) realPoint.y;
array.x[i] = realPoint.x;
array.y[i] = realPoint.y;
} else if (replay.replayVersion > 1) {
PointF realPoint = Utils.trackToRealCoords(gamePoint);
array.x[i] = (short) realPoint.x;
array.y[i] = (short) realPoint.y;
array.x[i] = realPoint.x;
array.y[i] = realPoint.y;
}
}
array.size = size;
Expand All @@ -469,8 +475,8 @@ public static MoveArray readFrom(ObjectInputStream is, Replay replay) throws IOE
public void reallocate(int newSize) {
if (newSize <= allocated) return;
int[] newTime = new int[newSize];
short[] newX = new short[newSize];
short[] newY = new short[newSize];
float[] newX = new float[newSize];
float[] newY = new float[newSize];
byte[] newId = new byte[newSize];

System.arraycopy(time, 0, newTime, 0, size);
Expand All @@ -486,15 +492,15 @@ public void reallocate(int newSize) {
allocated = newSize;
}

public boolean checkNewPoint(short px, short py) {
public boolean checkNewPoint(float px, float py) {
if (size < 2) return false;
float tx = (px + x[size - 2]) * 0.5f;
float ty = (py + y[size - 2]) * 0.5f;

return (Utils.sqr(x[size - 1] - tx) + Utils.sqr(y[size - 1] - ty)) <= 25;
}

public void pushBack(int time, short x, short y, byte id) {
public void pushBack(int time, float x, float y, byte id) {
int idx = size;
if (id == ID_MOVE && checkNewPoint(x, y)) {
idx = size - 1;
Expand Down Expand Up @@ -523,8 +529,8 @@ public void writeTo(ObjectOutputStream os) throws IOException {
for (int i = 0; i < size; i++) {
os.writeInt((time[i] << 2) + id[i]);
if (id[i] != ID_UP) {
os.writeShort(x[i] * Config.getTextureQuality());
os.writeShort(y[i] * Config.getTextureQuality());
os.writeFloat(x[i] * Config.getTextureQuality());
os.writeFloat(y[i] * Config.getTextureQuality());
}
}
}
Expand Down

0 comments on commit 7062ac8

Please sign in to comment.