map algorithm and analysis page progress
This commit is contained in:
@@ -16,15 +16,23 @@ public class RhythmMapAlgorithm implements Runnable {
|
||||
private MersenneTwister rand;
|
||||
private GamePlayMap map;
|
||||
private float avgBPS;
|
||||
private float second;
|
||||
public RhythmMapAlgorithm(AudioAnalyzer analyzer) {
|
||||
|
||||
private float speedMod, healthMod;
|
||||
|
||||
private float windowPerSecond;
|
||||
|
||||
private volatile int progress;
|
||||
public RhythmMapAlgorithm(AudioAnalyzer analyzer, float speedMod, float healthMod) {
|
||||
bassPeaks = analyzer.getBassPeaks();
|
||||
UMPeaks = analyzer.getUMPeaks();
|
||||
overlappedPeaks = analyzer.getOverlappedPeaks();
|
||||
map = new GamePlayMap(analyzer.getAudioData());
|
||||
rand = new MersenneTwister(analyzer.getPUID());
|
||||
avgBPS = analyzer.getAvgBPS();
|
||||
second = analyzer.getsecondsPerFrame();
|
||||
windowPerSecond = 1/analyzer.getsecondsPerWindow();
|
||||
|
||||
this.speedMod = speedMod;
|
||||
this.healthMod = healthMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,22 +40,23 @@ public class RhythmMapAlgorithm implements Runnable {
|
||||
map.beginBuild();
|
||||
for (int index = 0; index < bassPeaks.size; index++) {
|
||||
if (bassPeaks.get(index) != 0 || UMPeaks.get(index) != 0) {
|
||||
if (overlappedPeaks.get(index+3) != 0) {
|
||||
int warningTime = (int) ((3/speedMod)*windowPerSecond);
|
||||
if (overlappedPeaks.get(index + warningTime) != 0) {
|
||||
//TODO basic void circle spawning
|
||||
float endRadius = rand.nextFloat()*Polyjet.GAME_AREA_WIDTH;
|
||||
float endRadius = overlappedPeaks.get(index+3)*Polyjet.GAME_AREA_WIDTH;
|
||||
|
||||
map.addToMap(Entities.VOID_CIRCLE,
|
||||
endRadius,
|
||||
rand.nextFloat()*Polyjet.GAME_AREA_WIDTH,
|
||||
rand.nextFloat()*Polyjet.GAME_AREA_HEIGHT,
|
||||
avgBPS,
|
||||
3f*second
|
||||
endRadius/avgBPS,
|
||||
warningTime
|
||||
);
|
||||
}
|
||||
if (bassPeaks.get(index) != 0) {
|
||||
map.addToMap(Entities.BAR,
|
||||
MathUtils.round(rand.nextFloat()*Polyjet.GAME_AREA_WIDTH),
|
||||
bassPeaks.get(index)*Polyjet.GAME_AREA_HEIGHT/avgBPS);
|
||||
((Polyjet.GAME_AREA_HEIGHT-bassPeaks.get(index)*Polyjet.GAME_AREA_HEIGHT)/avgBPS)*speedMod);
|
||||
} else {
|
||||
if (UMPeaks.get(index) != 0) {
|
||||
//TODO basic pellet scatter spawn
|
||||
@@ -57,6 +66,8 @@ public class RhythmMapAlgorithm implements Runnable {
|
||||
} else {
|
||||
map.addRestToMap();
|
||||
}
|
||||
|
||||
progress = (int) (100f*index/bassPeaks.size);
|
||||
}
|
||||
map.endBuild();
|
||||
}
|
||||
@@ -64,4 +75,8 @@ public class RhythmMapAlgorithm implements Runnable {
|
||||
public synchronized GamePlayMap getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public synchronized int getProgress() {
|
||||
return progress;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user