tuning and void safety prediction better functioning
This commit is contained in:
@@ -64,7 +64,7 @@ public class AudioAnalyzer {
|
||||
int tasksDone = 0;
|
||||
int totalTasks = audioData.getSampleCount()/audioData.getReadWindowSize();
|
||||
|
||||
bassThresholdMultiplier = 1.7f;
|
||||
bassThresholdMultiplier = 1.5f;
|
||||
umThresholdMultiplier = 1.5f;
|
||||
|
||||
bassBinBegin = 1;
|
||||
|
@@ -5,12 +5,10 @@ import zero1hd.polyjet.entity.Entities;
|
||||
public class EntitySpawnInfo {
|
||||
private Entities entityType;
|
||||
private float[] parameters;
|
||||
private int spawnWindowID;
|
||||
|
||||
public EntitySpawnInfo(Entities entityType, int spawnWindowID, float... parameters) {
|
||||
public EntitySpawnInfo(Entities entityType, float... parameters) {
|
||||
this.entityType = entityType;
|
||||
this.parameters = parameters;
|
||||
this.spawnWindowID = spawnWindowID;
|
||||
}
|
||||
|
||||
public Entities getEntityType() {
|
||||
@@ -25,8 +23,4 @@ public class EntitySpawnInfo {
|
||||
public float[] getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public int getSpawnWindowID() {
|
||||
return spawnWindowID;
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,6 @@ public class GamePlayMap {
|
||||
private Array<MapWindowData> spawnList;
|
||||
private boolean building;
|
||||
private int index;
|
||||
private int absoluteIndex;
|
||||
/**
|
||||
* GamePlayMap is what the game area will use to generate entities and judge current audio data
|
||||
* @param audioData audio data
|
||||
@@ -46,7 +45,6 @@ public class GamePlayMap {
|
||||
spawnList.clear();
|
||||
spawnList.add(new MapWindowData());
|
||||
index = 0;
|
||||
absoluteIndex = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +53,6 @@ public class GamePlayMap {
|
||||
public void endBuild() {
|
||||
building = false;
|
||||
index = 0;
|
||||
absoluteIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +65,9 @@ public class GamePlayMap {
|
||||
|
||||
public void addToMap(Entities entityType, float... parameters) {
|
||||
if (building && entityType != null && parameters != null) {
|
||||
if (spawnList.get(index) == null) {
|
||||
spawnList.set(index, new MapWindowData());
|
||||
}
|
||||
spawnList.get(index).addEntity(new EntitySpawnInfo(entityType, parameters));
|
||||
}
|
||||
}
|
||||
@@ -76,10 +76,9 @@ public class GamePlayMap {
|
||||
* Moves onto the next window of the map for the song
|
||||
*/
|
||||
public void nextWindow() {
|
||||
absoluteIndex++;
|
||||
resetIndex();
|
||||
if (building) {
|
||||
spawnList.add(new MapWindowData());
|
||||
resetIndex();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +86,26 @@ public class GamePlayMap {
|
||||
* moves to the previous window to make edits to that frame.
|
||||
*/
|
||||
public void previousWindow() {
|
||||
absoluteIndex--;
|
||||
resetIndex();
|
||||
if (building) {
|
||||
index--;
|
||||
}
|
||||
}
|
||||
|
||||
public int goBack(int amount) {
|
||||
if (index-amount < 0) {
|
||||
int howMuchLess = -(index - amount);
|
||||
index = 0;
|
||||
return howMuchLess;
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void goForward(int amount) {
|
||||
if (index+amount > spawnList.size-1) {
|
||||
index += amount;
|
||||
} else {
|
||||
index += amount;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* use this to add rest for current index position
|
||||
@@ -98,11 +115,9 @@ public class GamePlayMap {
|
||||
spawnList.set(index, null);
|
||||
}
|
||||
}
|
||||
|
||||
public MapWindowData nextWindowData() {
|
||||
if (index != musicData.getReadIndex()) {
|
||||
absoluteIndex = musicData.getReadIndex();
|
||||
resetIndex();
|
||||
index = musicData.getReadIndex();
|
||||
return spawnList.get(index);
|
||||
}
|
||||
return null;
|
||||
@@ -120,7 +135,12 @@ public class GamePlayMap {
|
||||
return spawnList.get(index) == null ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the current index to the end of the array
|
||||
*/
|
||||
public void resetIndex() {
|
||||
index = absoluteIndex;
|
||||
if (building) {
|
||||
index = spawnList.size-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -56,18 +56,20 @@ public class RhythmMapAlgorithm implements Runnable {
|
||||
map.beginBuild();
|
||||
for (int index = 0; index < bassPeaks.size; index++) {
|
||||
if (bassPeaks.get(index) != 0 || UMPeaks.get(index) != 0) {
|
||||
int warningTime = (int) ((3/speedMod)*windowPerSecond);
|
||||
if ((index+warningTime < bassPeaks.size) && bassPeaks.get(index + warningTime) != 0) {
|
||||
if (bassPeaks.get(index) >= avgBass) {
|
||||
//TODO basic void circle spawning
|
||||
float endRadius = (bassPeaks.get(index + warningTime)/bassMax)*(Polyjet.GAME_AREA_HEIGHT/2f);
|
||||
|
||||
int warningTime = (int) (map.goBack((int) (windowPerSecond*1.5f))/windowPerSecond);
|
||||
|
||||
float endRadius = (bassPeaks.get(index)/bassMax)*(Polyjet.GAME_AREA_HEIGHT/2f);
|
||||
map.addToMap(Entities.VOID_CIRCLE,
|
||||
endRadius,
|
||||
rand.nextFloat()*Polyjet.GAME_AREA_WIDTH,
|
||||
rand.nextFloat()*Polyjet.GAME_AREA_HEIGHT,
|
||||
endRadius/(avgSPB*0.6f),
|
||||
3f/speedMod
|
||||
endRadius/(avgSPB*0.7f),
|
||||
warningTime
|
||||
);
|
||||
|
||||
map.resetIndex();
|
||||
}
|
||||
if (bassPeaks.get(index) != 0) {
|
||||
map.addToMap(Entities.BAR,
|
||||
|
Reference in New Issue
Block a user