Spinner Test 3
Clean up
This commit is contained in:
parent
038a5d5779
commit
3675a25c44
|
@ -695,7 +695,7 @@ public class Options {
|
|||
private static Skin skin;
|
||||
|
||||
/** Frame limiters. */
|
||||
private static final int[] targetFPS = { 60, 120, 240, 30, 20, 15, 12 };
|
||||
private static final int[] targetFPS = { 60, 120, 240 };
|
||||
|
||||
/** Index in targetFPS[] array. */
|
||||
private static int targetFPSindex = 0;
|
||||
|
@ -1084,6 +1084,7 @@ public class Options {
|
|||
replayImportDir.mkdir();
|
||||
return replayImportDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the screenshot directory.
|
||||
* If invalid, this will return a "Screenshot" directory.
|
||||
|
|
|
@ -38,6 +38,7 @@ public class Circle implements GameObject {
|
|||
/** The amount of time, in milliseconds, to fade in the circle. */
|
||||
private static final int FADE_IN_TIME = 375;
|
||||
|
||||
/** The diameter of Circle Hitobjects */
|
||||
private static float diameter;
|
||||
|
||||
/** The associated HitObject. */
|
||||
|
@ -58,7 +59,6 @@ public class Circle implements GameObject {
|
|||
/** Whether or not the circle result ends the combo streak. */
|
||||
private boolean comboEnd;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the Circle data type with map modifiers, images, and dimensions.
|
||||
* @param container the game container
|
||||
|
@ -71,11 +71,6 @@ public class Circle implements GameObject {
|
|||
GameImage.HITCIRCLE.setImage(GameImage.HITCIRCLE.getImage().getScaledCopy(diameterInt, diameterInt));
|
||||
GameImage.HITCIRCLE_OVERLAY.setImage(GameImage.HITCIRCLE_OVERLAY.getImage().getScaledCopy(diameterInt, diameterInt));
|
||||
GameImage.APPROACHCIRCLE.setImage(GameImage.APPROACHCIRCLE.getImage().getScaledCopy(diameterInt, diameterInt));
|
||||
/*int diameter = (int) (104 - (circleSize * 8));
|
||||
diameter = (int) (diameter * HitObject.getXMultiplier()); // convert from Osupixels (640x480)
|
||||
GameImage.HITCIRCLE.setImage(GameImage.HITCIRCLE.getImage().getScaledCopy(diameter, diameter));
|
||||
GameImage.HITCIRCLE_OVERLAY.setImage(GameImage.HITCIRCLE_OVERLAY.getImage().getScaledCopy(diameter, diameter));
|
||||
GameImage.APPROACHCIRCLE.setImage(GameImage.APPROACHCIRCLE.getImage().getScaledCopy(diameter, diameter));*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,4 +74,6 @@ public interface GameObject {
|
|||
* Resets the hit object so that it can be reused.
|
||||
*/
|
||||
public void reset();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -122,7 +122,6 @@ public class Slider implements GameObject {
|
|||
int diameterInt = (int)diameter;
|
||||
|
||||
followRadius = diameter / 2 * 3f;
|
||||
//TODO conflict
|
||||
/*
|
||||
int diameter = (int) (104 - (circleSize * 8));
|
||||
diameter = (int) (diameter * HitObject.getXMultiplier()); // convert from Osupixels (640x480)
|
||||
|
@ -345,7 +344,7 @@ public class Slider implements GameObject {
|
|||
result = GameData.HIT_50;
|
||||
else
|
||||
result = GameData.HIT_MISS;
|
||||
|
||||
|
||||
float cx, cy;
|
||||
HitObjectType type;
|
||||
if (currentRepeats % 2 == 0) { // last circle
|
||||
|
@ -433,7 +432,7 @@ public class Slider implements GameObject {
|
|||
if (keyPressed || GameMod.RELAX.isActive()) {
|
||||
float[] c = curve.pointAt(getT(trackPosition, false));
|
||||
double distance = Math.hypot(c[0] - mouseX, c[1] - mouseY);
|
||||
if (distance < followRadius) //TODO IDK Magic numbers
|
||||
if (distance < followRadius)
|
||||
sliderClickedFinal = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,13 +42,11 @@ public class Spinner implements GameObject {
|
|||
private static int width, height;
|
||||
|
||||
/** The number of rotation velocities to store. */
|
||||
// note: currently takes about 200ms to spin up (1000/60 * 12)
|
||||
private static final int MAX_ROTATION_VELOCITIES = 12;
|
||||
private int maxStoredDeltaAngles;
|
||||
|
||||
/** The amount of time, in milliseconds, before another velocity is stored. */
|
||||
private static final float DELTA_UPDATE_TIME = 1000 / 60f;
|
||||
|
||||
|
||||
/** The amount of time, in milliseconds, to fade in the spinner. */
|
||||
private static final int FADE_IN_TIME = 500;
|
||||
|
||||
|
@ -62,7 +60,7 @@ public class Spinner implements GameObject {
|
|||
TWO_PI = (float) (Math.PI * 2),
|
||||
HALF_PI = (float) (Math.PI / 2);
|
||||
|
||||
private static final float MAX_ANG_DIFF = DELTA_UPDATE_TIME * 477 / 60 / 1000 * TWO_PI; // ~95.3
|
||||
private static final float MAX_ANG_DIFF = DELTA_UPDATE_TIME * AUTO_MULTIPLIER; // ~95.3
|
||||
|
||||
/** The associated HitObject. */
|
||||
private HitObject hitObject;
|
||||
|
@ -89,7 +87,7 @@ public class Spinner implements GameObject {
|
|||
private float sumDeltaAngle = 0f;
|
||||
|
||||
/** Array holding the most recent rotation velocities. */
|
||||
private float[] storedDeltaAngle = new float[MAX_ROTATION_VELOCITIES];
|
||||
private float[] storedDeltaAngle;
|
||||
|
||||
/** True if the mouse cursor is pressed. */
|
||||
private boolean isSpinning;
|
||||
|
@ -97,8 +95,10 @@ public class Spinner implements GameObject {
|
|||
/** Current index of the stored velocities in rotations/second. */
|
||||
private int deltaAngleIndex = 0;
|
||||
|
||||
/** The remaining amount of the angle that was not used. */
|
||||
private float deltaAngleOverflow = 0;
|
||||
|
||||
/** The RPM that is drawn to the screen. */
|
||||
private int drawnRPM = 0;
|
||||
|
||||
/**
|
||||
|
@ -119,11 +119,49 @@ public class Spinner implements GameObject {
|
|||
public Spinner(HitObject hitObject, Game game, GameData data) {
|
||||
this.hitObject = hitObject;
|
||||
this.data = data;
|
||||
|
||||
/*
|
||||
1 beat = 731.707317073171ms
|
||||
RPM at frame X with spinner Y beats long
|
||||
10 20 30 40 50 60 <frame#
|
||||
1.00 306 418 457 470
|
||||
1.25 323 424 459 471 475
|
||||
1.5 305 417 456 470 475 477
|
||||
1.75 322 417 456 471 475
|
||||
2.00 304 410 454 469 474 476
|
||||
2.25 303 410 451 467 474 476
|
||||
2.50 303 417 456 470 475 476
|
||||
2.75 302 416 456 470 475 476
|
||||
3.00 301 416 456 470 475 <-- ~2sec
|
||||
4.00 274 414 453 470 475
|
||||
5.00 281 409 454 469 475
|
||||
6.00 232 392 451 467 472 476
|
||||
6.25 193 378 443 465
|
||||
6.50 133 344 431 461
|
||||
6.75 85 228 378 435 463 472 <-- ~5sec
|
||||
7.00 53 154 272 391 447
|
||||
8.00 53 154 272 391 447
|
||||
9.00 53 154 272 400 450
|
||||
10.00 53 154 272 400 450
|
||||
15.00 53 154 272 391 444 466
|
||||
20.00 61 154 272 400 447
|
||||
25.00 53 154 272 391 447 466
|
||||
^beats
|
||||
*/
|
||||
//TODO not correct at all, but close enough?
|
||||
//<2sec ~ 12 ~ 200ms
|
||||
//>5sec ~ 48 ~ 800ms
|
||||
final int minVel = 12;
|
||||
final int maxVel = 48;
|
||||
final int minTime = 2000;
|
||||
final int maxTime = 5000;
|
||||
maxStoredDeltaAngles = (int) Utils.clamp(
|
||||
(hitObject.getEndTime() - hitObject.getTime() - minTime) * (maxVel-minVel)/(maxTime-minTime) + minVel
|
||||
, minVel, maxVel);
|
||||
storedDeltaAngle = new float[maxStoredDeltaAngles];
|
||||
|
||||
// calculate rotations needed
|
||||
float spinsPerMinute = 94 + (data.getDifficulty() * 15);
|
||||
float spinsPerMinute = 100 + (data.getDifficulty() * 15);
|
||||
rotationsNeeded = spinsPerMinute * (hitObject.getEndTime() - hitObject.getTime()) / 60000f;
|
||||
System.out.println("rotationsNeeded "+rotationsNeeded);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -209,7 +247,6 @@ public class Spinner implements GameObject {
|
|||
@Override
|
||||
public boolean mousePressed(int x, int y, int trackPosition) {
|
||||
lastAngle = (float) Math.atan2(x - (height / 2), y - (width / 2));
|
||||
System.out.println("lastAngle:"+lastAngle);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -230,44 +267,45 @@ public class Spinner implements GameObject {
|
|||
// spin automatically
|
||||
// http://osu.ppy.sh/wiki/FAQ#Spinners
|
||||
|
||||
|
||||
deltaOverflow += delta;
|
||||
|
||||
float angle = 0;
|
||||
if (deltaOverflow >= DELTA_UPDATE_TIME){
|
||||
if (GameMod.AUTO.isActive()) {
|
||||
lastAngle = 0;
|
||||
angle = deltaOverflow * AUTO_MULTIPLIER;
|
||||
float angleDiff = 0;
|
||||
if (GameMod.AUTO.isActive()) {
|
||||
angleDiff = delta * AUTO_MULTIPLIER;
|
||||
isSpinning = true;
|
||||
} else if (GameMod.SPUN_OUT.isActive() || GameMod.AUTOPILOT.isActive()) {
|
||||
angleDiff = delta * SPUN_OUT_MULTIPLIER;
|
||||
isSpinning = true;
|
||||
} else {
|
||||
float angle = (float) Math.atan2(mouseY - (height / 2), mouseX - (width / 2));
|
||||
|
||||
// set initial angle to current mouse position to skip first click
|
||||
if (!isSpinning && (keyPressed || GameMod.RELAX.isActive())) {
|
||||
lastAngle = angle;
|
||||
isSpinning = true;
|
||||
} else if (GameMod.SPUN_OUT.isActive() || GameMod.AUTOPILOT.isActive()) {
|
||||
lastAngle = 0;
|
||||
angle = deltaOverflow * SPUN_OUT_MULTIPLIER;
|
||||
isSpinning = true;
|
||||
} else {
|
||||
angle = (float) Math.atan2(mouseY - (height / 2), mouseX - (width / 2));
|
||||
// set initial angle to current mouse position to skip first click
|
||||
if (!isSpinning && (keyPressed || GameMod.RELAX.isActive())) {
|
||||
lastAngle = angle;
|
||||
isSpinning = true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
angleDiff = angle - lastAngle;
|
||||
if(Math.abs(angleDiff) > 0.01f){
|
||||
lastAngle = angle;
|
||||
}else{
|
||||
angleDiff = 0;
|
||||
}
|
||||
// make angleDiff the smallest angle change possible
|
||||
// (i.e. 1/4 rotation instead of 3/4 rotation)
|
||||
float angleDiff = angle - lastAngle;
|
||||
lastAngle = angle;
|
||||
|
||||
if (angleDiff < -Math.PI)
|
||||
angleDiff += TWO_PI;
|
||||
else if (angleDiff > Math.PI)
|
||||
angleDiff -= TWO_PI;
|
||||
if (isSpinning)
|
||||
deltaAngleOverflow += angleDiff;
|
||||
}
|
||||
|
||||
// make angleDiff the smallest angle change possible
|
||||
// (i.e. 1/4 rotation instead of 3/4 rotation)
|
||||
if (angleDiff < -Math.PI)
|
||||
angleDiff += TWO_PI;
|
||||
else if (angleDiff > Math.PI)
|
||||
angleDiff -= TWO_PI;
|
||||
|
||||
//may be a problem at higher frame rate due to float point round off
|
||||
if (isSpinning)
|
||||
deltaAngleOverflow += angleDiff;
|
||||
|
||||
while (deltaOverflow >= DELTA_UPDATE_TIME) {
|
||||
System.out.println("Spinner update2 "+mouseX+" "+mouseY+" "+deltaAngleOverflow+" "+deltaOverflow);
|
||||
|
||||
// spin caused by the cursor
|
||||
float deltaAngle = 0;
|
||||
if (isSpinning){
|
||||
|
@ -281,17 +319,18 @@ public class Spinner implements GameObject {
|
|||
deltaAngleIndex %= storedDeltaAngle.length;
|
||||
deltaOverflow -= DELTA_UPDATE_TIME;
|
||||
|
||||
float rotationAngle = sumDeltaAngle / MAX_ROTATION_VELOCITIES;
|
||||
rotationAngle = Utils.clamp(rotationAngle, -MAX_ANG_DIFF, MAX_ANG_DIFF);//*0.9650f;
|
||||
float rotationAngle = sumDeltaAngle / maxStoredDeltaAngles;
|
||||
rotationAngle = Utils.clamp(rotationAngle, -MAX_ANG_DIFF, MAX_ANG_DIFF);
|
||||
float rotationPerSec = rotationAngle * (1000/DELTA_UPDATE_TIME) / TWO_PI;
|
||||
|
||||
drawnRPM = (int)(Math.abs(rotationPerSec * 60));
|
||||
System.out.println("Ang DIFF:"+deltaAngle+" "+rotations+" "+angle+" "+lastAngle+" "+rotationAngle+" "+sumDeltaAngle+" "+MAX_ANG_DIFF);
|
||||
|
||||
rotate(rotationAngle);
|
||||
if (Math.abs(rotationAngle) > 0.00001f)
|
||||
data.changeHealth(DELTA_UPDATE_TIME * GameData.HP_DRAIN_MULTIPLIER);
|
||||
|
||||
}
|
||||
//TODO may need to update 1 more time when the spinner ends?
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -344,7 +383,8 @@ public class Spinner implements GameObject {
|
|||
SoundController.playSound(SoundEffect.SPINNERSPIN);
|
||||
|
||||
}
|
||||
//*
|
||||
/*
|
||||
//The extra 100 for some spinners (mostly wrong)
|
||||
if (Math.floor(newRotations + 0.5f) > rotations + 0.5f) {
|
||||
if (newRotations + 0.5f > rotationsNeeded) { // extra rotations
|
||||
data.changeScore(100);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package itdelatrisu.opsu.replay;
|
||||
|
||||
import itdelatrisu.opsu.ErrorHandler;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.ScoreData;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
|
@ -373,8 +372,8 @@ public class Replay {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
final int LINE_SPLIT = 1;
|
||||
final int MAX_LINES = LINE_SPLIT * 99999999;
|
||||
final int LINE_SPLIT = 5;
|
||||
final int MAX_LINES = LINE_SPLIT * 10;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("File: "); sb.append(file.getName()); sb.append('\n');
|
||||
|
|
|
@ -625,7 +625,7 @@ public class Game extends BasicGameState {
|
|||
// reset game data
|
||||
resetGameData();
|
||||
|
||||
// load the first timingPoint for stacking
|
||||
// load the first timingPoint
|
||||
if (!beatmap.timingPoints.isEmpty()) {
|
||||
TimingPoint timingPoint = beatmap.timingPoints.get(0);
|
||||
if (!timingPoint.isInherited()) {
|
||||
|
@ -922,7 +922,7 @@ public class Game extends BasicGameState {
|
|||
MusicController.setPitch(GameMod.getSpeedMultiplier() * playbackSpeed.getModifier());
|
||||
}
|
||||
|
||||
if(y < 50){
|
||||
if(!GameMod.AUTO.isActive() && y < 50){
|
||||
float pos = (float)x / width * beatmap.endTime;
|
||||
System.out.println("Seek to"+pos);
|
||||
MusicController.setPosition((int)pos);
|
||||
|
@ -1086,7 +1086,7 @@ public class Game extends BasicGameState {
|
|||
timingPointIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// initialize object maps
|
||||
Color[] combo = beatmap.getComboColors();
|
||||
for (int i = 0; i < beatmap.objects.length; i++) {
|
||||
|
@ -1094,7 +1094,7 @@ public class Game extends BasicGameState {
|
|||
|
||||
// is this the last note in the combo?
|
||||
boolean comboEnd = false;
|
||||
if (i + 1 < beatmap.objects.length && beatmap.objects[i + 1].isNewCombo())
|
||||
if (i + 1 >= beatmap.objects.length || beatmap.objects[i + 1].isNewCombo())
|
||||
comboEnd = true;
|
||||
|
||||
Color color = combo[hitObject.getComboIndex()];
|
||||
|
@ -1435,7 +1435,7 @@ public class Game extends BasicGameState {
|
|||
|
||||
// overallDifficulty (hit result time offsets)
|
||||
hitResultOffset = new int[GameData.HIT_MAX];
|
||||
//*
|
||||
/*
|
||||
float mult = 0.608f;
|
||||
hitResultOffset[GameData.HIT_300] = (int) ((128 - (overallDifficulty * 9.6))*mult);
|
||||
hitResultOffset[GameData.HIT_100] = (int) ((224 - (overallDifficulty * 12.8))*mult);
|
||||
|
@ -1571,7 +1571,6 @@ public class Game extends BasicGameState {
|
|||
* @param keys the keys that are pressed
|
||||
*/
|
||||
private void sendGameKeyPress(int keys, int x, int y, int trackPosition) {
|
||||
System.out.println("Game Key Pressed"+keys+" "+x+" "+y+" "+objectIndex);
|
||||
if (objectIndex >= gameObjects.length) // nothing to do here
|
||||
return;
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import itdelatrisu.opsu.Utils;
|
|||
import itdelatrisu.opsu.audio.MusicController;
|
||||
import itdelatrisu.opsu.audio.SoundController;
|
||||
import itdelatrisu.opsu.replay.ReplayImporter;
|
||||
//conflict
|
||||
import itdelatrisu.opsu.beatmap.BeatmapSetList;
|
||||
import itdelatrisu.opsu.beatmap.BeatmapParser;
|
||||
import itdelatrisu.opsu.ui.UI;
|
||||
|
|
Loading…
Reference in New Issue
Block a user