Mostly stylistic changes

This commit is contained in:
teejusb
2025-02-11 19:39:03 -08:00
parent 53ebe4cce1
commit 49263f3c3e
12 changed files with 172 additions and 194 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ RString MeasureInfo::ToString() const
return join(",", asMeasureInfo);
}
void MeasureInfo::FromString(RString sValues)
void MeasureInfo::FromString(const RString& sValues)
{
std::vector<RString> asValues;
split( sValues, ",", asValues, true );
+2 -2
View File
@@ -2,7 +2,7 @@
#define MEASURE_INFO_H
#include "GameConstantsAndTypes.h"
class NoteData;
#include "NoteData.h"
/** This is a container for per-measure stats of a stepchart.
This data is calculated and saved to the song cache files as the #MEASUREINFO tag.
@@ -30,7 +30,7 @@ struct MeasureInfo
}
RString ToString() const;
void FromString( RString sValues );
void FromString(const RString& sValues );
static void CalculateMeasureInfo(const NoteData &in, MeasureInfo &out);
};
+1 -1
View File
@@ -311,7 +311,7 @@ public:
int GetNumTapNotesNoTiming( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const;
int GetNumTapNotesInRow( int iRow ) const;
int GetNumMinesInRow( int iRow ) const;
int GetNumMines( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const;
int GetNumMines( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const;
int GetNumRowsWithTap( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const;
int GetNumRowsWithTapOrHoldHead( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const;
/* Optimization: for the default of start to end, use the second (faster). XXX: Second what? -- Steve */
-1
View File
@@ -419,7 +419,6 @@ void SetMeasureInfo(StepsTagInfo& info)
FOREACH_PlayerNumber(pn)
{
v[pn].FromString(values[pn]);
}
info.steps->SetCachedMeasureInfo(v);
}
+1 -1
View File
@@ -448,7 +448,7 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa
}
lines.push_back(ssprintf("#MEASUREINFO:%s;", join("|", asMeasureInfo).c_str()));
// MV: #STEPFILENAME has to be at the end of the cache tags,
// NOTE(MV): #STEPFILENAME has to be at the end of the cache tags,
// because it's used in SSCLoader::LoadFromSimfile to determine when
// to switch the state back to GETTING_SONG_INFO, which means any tags
// after it will be ignored.
+7 -11
View File
@@ -6,8 +6,6 @@
namespace StepParity
{
const int DOUBLESTEP= 850;
const int BRACKETJACK= 20;
const int JACK= 30;
@@ -23,15 +21,14 @@ namespace StepParity
const int DISTANCE= 6;
const int SPIN= 1000;
const int SIDESWITCH= 130;
const int CROWDED_BRACKET = 0;
const int OTHER = 0;
const int CROWDED_BRACKET = 0;
const int OTHER = 0;
// 0.1 = 1/16th note at 150bpm. Jacks quicker than this are harder.
// Above this speed, footswitches should be prioritized
const float JACK_THRESHOLD = 0.1;
// 0.15 = 1/8th at 200bpm, or 3/16th at 150bpm. Below this speed, jumps should be prioritized
const float SLOW_BRACKET_THRESHOLD = 0.15;
// 0.2 = 1/8th at 150bpm. Footswitches slower than this are harder.
// Below this speed, jacks should be prioritized
const float SLOW_FOOTSWITCH_THRESHOLD = 0.2;
@@ -45,8 +42,7 @@ namespace StepParity
StageLayout layout;
public:
StepParityCost(const StageLayout& _layout): layout(_layout){
}
StepParityCost(const StageLayout& _layout): layout(_layout) {}
/// @brief Computes and returns a cost value for the player moving from initialState to resultState.
/// @param initialState The starting position of the player
@@ -63,18 +59,18 @@ namespace StepParity
float calcBracketTapCost(State * initialState, State * resultState, Row &row, int leftHeel, int leftToe, int rightHeel, int rightToe, float elapsedTime, int columnCount);
float calcMovingFootWhileOtherIsntOnPadCost(State * initialState, State * resultState, int columnCount);
float calcBracketJackCost(State * initialState, State * resultState, std::vector<Row> &rows, int rowIndex, bool movedLeft, bool movedRight, bool jackedLeft, bool jackedRight, bool didJump, int columnCount);
float calcDoublestepCost(State * initialState, State * resultState, std::vector<Row> & rows, int rowIndex, bool movedLeft, bool movedRight, bool jackedLeft, bool jackedRight, bool didJump, int columnCount);
float calcDoublestepCost(State * initialState, State * resultState, std::vector<Row> & rows, int rowIndex, bool movedLeft, bool movedRight, bool jackedLeft, bool jackedRight, bool didJump, int columnCount);
float calcJumpCost(Row &row, bool movedLeft, bool movedRight, float elapsedTime, int columnCount);
float calcSlowBracketCost(Row & row, bool movedLeft, bool movedRight, float elapsedTime);
float calcTwistedFootCost(State * resultState);
float calcMissedFootswitchCost(Row &row, bool jackedLeft, bool jackedRight, int columnCount);
float calcFacingCosts(State * initialState, State * resultState, std::vector<StepParity::Foot> &combinedColumns, int columnCount);
float calcSpinCosts(State * initialState, State * resultState, std::vector<StepParity::Foot> & combinedColumns, int columnCount);
float calcSpinCosts(State * initialState, State * resultState, std::vector<StepParity::Foot> & combinedColumns, int columnCount);
float caclFootswitchCost(State * initialState, State * resultState, Row &row, std::vector<StepParity::Foot> &combinedColumns, float elapsedTime, int columnCount);
float calcSideswitchCost(State * initialState, State * resultState, int columnCount);
float calcJackCost(bool movedLeft, bool movedRight, bool jackedLeft, bool jackedRight, float elapsedTime, int columnCount);
float calcBigMovementsQuicklyCost(State * initialState, State * resultState, float elapsedTime, int columnCount);
float calcCrowdedBracketCost(State * initialState, State * resultState, float elapsedTime, int columnCount);
float calcCrowdedBracketCost(State * initialState, State * resultState, float elapsedTime, int columnCount);
bool didDoubleStep(State * initialState, State * resultState, std::vector<Row> &rows, int rowIndex, bool movedLeft, bool jackedLeft, bool movedRight, bool jackedRight, int columnCount);
bool didJackLeft(State * initialState, State * resultState, int leftHeel, int leftToe, bool movedLeft, bool didJump, int columnCount);
+22 -38
View File
@@ -3,10 +3,7 @@
using namespace StepParity;
//
// Graph/Node methods
//
int calculateVectorHash(const std::vector<Foot> &vec)
{
int value = 0;
@@ -53,7 +50,7 @@ void State::calculateHashes()
StepParityNode * StepParityGraph::addOrGetExistingNode(const State &state)
{
// this is silly, but the start node has a rowIndex of -1
// This is silly, but the start node has a rowIndex of -1
// which doesn't work as an array index.
int rowIndex = state.rowIndex + 1;
while (static_cast<int>(stateNodeMap.size()) <= rowIndex)
@@ -74,10 +71,7 @@ StepParityNode * StepParityGraph::addOrGetExistingNode(const State &state)
return stateNodeMap[rowIndex][state];
}
//
// StageLayout
//
bool StageLayout::bracketCheck(int column1, int column2)
{
StagePoint p1 = columns[column1];
@@ -169,10 +163,7 @@ float StageLayout::getPlayerAngle(StepParity::StagePoint left, StepParity::Stage
return atan2f(det, dot);
}
//
// Row
//
void Row::setFootPlacement(const std::vector<Foot> & footPlacement)
{
for (int c = 0; c < columnCount; c++) {
@@ -185,12 +176,7 @@ void Row::setFootPlacement(const std::vector<Foot> & footPlacement)
}
}
//
// Json methods
//
template<typename Container>
Json::Value FeetToJson(const Container& feets, bool useStrings)
{
@@ -215,9 +201,9 @@ Json::Value State::ToJson(bool useStrings)
Json::Value jsonColumns = FeetToJson(columns, useStrings);
Json::Value jsonMovedFeet = FeetToJson(movedFeet, useStrings);
Json::Value jsonHoldFeet = FeetToJson(holdFeet, useStrings);
root["idx"] = idx;
root["columns"] = jsonColumns;
root["idx"] = idx;
root["columns"] = jsonColumns;
root["movedFeet"] = jsonMovedFeet;
root["holdFeet"] = jsonHoldFeet;
root["second"] = second;
@@ -286,22 +272,21 @@ Json::Value StepParityNode::ToJson()
{
Json::Value n;
n["id"] = it->first->id;
Json::Value jsonCosts;
float * costs = it->second;
for(int i = 0; i < NUM_Cost; i++)
{
jsonCosts[COST_LABELS[i]] = costs[i];
}
n["costs"] = jsonCosts;
Json::Value jsonCosts;
float * costs = it->second;
for(int i = 0; i < NUM_Cost; i++)
{
jsonCosts[COST_LABELS[i]] = costs[i];
}
n["costs"] = jsonCosts;
jsonNeighbors.append(n);
}
root["id"] = id;
root["stateIdx"] = state.idx;
root["stateIdx"] = state.idx;
root["neighbors"] = jsonNeighbors;
return root;
}
Json::Value Row::ToJsonRows(const std::vector<Row> & rows, bool useStrings)
{
Json::Value root;
@@ -327,23 +312,22 @@ Json::Value Row::ParityRowsJson(const std::vector<Row> & rows)
return root;
}
Json::Value StepParityGraph::ToJson()
{
Json::Value jsonNodes;
for(auto node: nodes)
{
jsonNodes.append(node->ToJson());
jsonNodes.append(node->ToJson());
}
Json::Value jsonStates;
for(auto state: states)
{
jsonStates.append(state->ToJson(false));
}
Json::Value root;
root["nodes"] = jsonNodes;
root["states"] = jsonStates;
Json::Value jsonStates;
for(auto state: states)
{
jsonStates.append(state->ToJson(false));
}
Json::Value root;
root["nodes"] = jsonNodes;
root["states"] = jsonStates;
return root;
}
+92 -83
View File
@@ -8,7 +8,6 @@
#include <queue>
#include <unordered_map>
namespace StepParity {
const float CLM_SECOND_INVALID = -1;
@@ -33,48 +32,48 @@ namespace StepParity {
const RString TapNoteTypeShortNames[] = { "Empty", "Tap", "Mine", "Attack", "AutoKeySound", "Fake", "", "" };
const RString TapNoteSubTypeShortNames[] = { "Hold", "Roll", "", "" };
enum Cost
{
COST_DOUBLESTEP = 0,
COST_BRACKETJACK,
COST_JACK,
COST_JUMP,
enum Cost
{
COST_DOUBLESTEP = 0,
COST_BRACKETJACK,
COST_JACK,
COST_JUMP,
COST_SLOW_BRACKET,
COST_TWISTED_FOOT,
COST_BRACKETTAP,
COST_HOLDSWITCH,
COST_MINE,
COST_FOOTSWITCH,
COST_MISSED_FOOTSWITCH,
COST_FACING,
COST_DISTANCE,
COST_SPIN,
COST_SIDESWITCH,
COST_CROWDED_BRACKET ,
COST_OTHER,
COST_TOTAL,
NUM_Cost
};
const RString COST_LABELS[] = {
"DOUBLESTEP",
"BRACKETJACK",
"JACK",
"JUMP",
COST_BRACKETTAP,
COST_HOLDSWITCH,
COST_MINE,
COST_FOOTSWITCH,
COST_MISSED_FOOTSWITCH,
COST_FACING,
COST_DISTANCE,
COST_SPIN,
COST_SIDESWITCH,
COST_CROWDED_BRACKET ,
COST_OTHER,
COST_TOTAL,
NUM_Cost
};
const RString COST_LABELS[] = {
"DOUBLESTEP",
"BRACKETJACK",
"JACK",
"JUMP",
"SLOW_BRACKET",
"TWISTED_FOOT",
"BRACKETTAP",
"HOLDSWITCH",
"MINE",
"FOOTSWITCH",
"MISSED_FOOTSWITCH",
"FACING",
"DISTANCE",
"SPIN",
"SIDESWITCH",
"CROWDED_BRACKET",
"OTHER",
"TOTAL"
};
"BRACKETTAP",
"HOLDSWITCH",
"MINE",
"FOOTSWITCH",
"MISSED_FOOTSWITCH",
"FACING",
"DISTANCE",
"SPIN",
"SIDESWITCH",
"CROWDED_BRACKET",
"OTHER",
"TOTAL"
};
struct StagePoint {
float x;
@@ -91,12 +90,11 @@ namespace StepParity {
std::vector<int> downArrows;
std::vector<int> sideArrows;
StageLayout(StepsType t,
const std::vector<StagePoint>& c,
const std::vector<int> & u,
const std::vector<int> & d,
const std::vector<int> & s) :type(t), columns(c), upArrows(u), downArrows(d), sideArrows(s) {
const std::vector<int> & s) : type(t), columns(c), upArrows(u), downArrows(d), sideArrows(s) {
this->columnCount = static_cast<int>(this->columns.size());
}
@@ -126,11 +124,11 @@ namespace StepParity {
FootPlacement holdFeet; // Any feet that stayed in place due to a hold/roll note.
float second; // The time of the song represented by this state
int rowIndex; // The index of the row represented by this state
int idx;
int whereTheFeetAre[NUM_Foot]; // the inverse of columns
bool didTheFootMove[NUM_Foot]; // the inverse of movedFeet
bool isTheFootHolding[NUM_Foot]; //inverse of holdFeet
int idx;
int whereTheFeetAre[NUM_Foot]; // the inverse of columns
bool didTheFootMove[NUM_Foot]; // the inverse of movedFeet
bool isTheFootHolding[NUM_Foot]; //inverse of holdFeet
// These hashes are used in operator<() to speed up the comparison of the vectors.
// Their values are computed by calculateHashes(), which is used in StepParityGenerator::buildStateGraph().
int columnsHash = 0;
@@ -149,13 +147,13 @@ namespace StepParity {
holdFeet = FootPlacement(columnCount, NONE);
second = 0;
rowIndex = 0;
idx = -1;
for(int i = 0; i < NUM_Foot; i++)
{
whereTheFeetAre[i] = -1;
didTheFootMove[i] = false;
isTheFootHolding[i] = false;
}
idx = -1;
for(int i = 0; i < NUM_Foot; i++)
{
whereTheFeetAre[i] = -1;
didTheFootMove[i] = false;
isTheFootHolding[i] = false;
}
}
Json::Value ToJson(bool useStrings);
@@ -191,14 +189,17 @@ namespace StepParity {
/// This shouldn't be confused with the idea of "rows" elsewhere in SM. Here, we only use
/// these Rows to represent a row that isn't empty.
struct Row {
std::vector<IntermediateNoteData> notes; // notes for the given row
std::vector<IntermediateNoteData> holds; // Any active hold notes, including ones that started before this row
std::set<int> holdTails; // Column index of any holds that end on this row
std::vector<float> mines; // If a mine occurred either on this row, or on a row on its own immediately
// preceding this one, the time of when that mine occurred, indexed by column.
std::vector<float> fakeMines; // The same thing, but for fake mines
// notes for the given row
std::vector<IntermediateNoteData> notes;
// Any active hold notes, including ones that started before this row
std::vector<IntermediateNoteData> holds;
// Column index of any holds that end on this row
std::set<int> holdTails;
// If a mine occurred either on this row, or on a row on its own immediately
// preceding this one, the time of when that mine occurred, indexed by column.
std::vector<float> mines;
// The same thing, but for fake mines
std::vector<float> fakeMines;
FootPlacement columns;
std::vector<int> whereTheFeetAre;
@@ -235,24 +236,30 @@ namespace StepParity {
/// @brief A counter used while creating rows
struct RowCounter
{
std::vector<IntermediateNoteData> notes; // Notes for the "current" row being generated
std::vector<IntermediateNoteData> activeHolds; // Any holds that are active for the current row
// Notes for the "current" row being generated
std::vector<IntermediateNoteData> notes;
// Any holds that are active for the current row
std::vector<IntermediateNoteData> activeHolds;
float lastColumnSecond = CLM_SECOND_INVALID;
float lastColumnBeat = CLM_SECOND_INVALID;
std::vector<float> mines; // The time at which a mine occurred for the current row,
// indexed by column
std::vector<float> fakeMines; // The time at which a fake mine occurred for the current row,
// indexed by column
std::vector<float> nextMines; // The time at which a mine occurred in the _previous_ row,
// indexed by column
std::vector<float> nextFakeMines; // The time at which a fake mine occurred in the _previous_ row,
// indexed by column
int noteCount = 0; // number of "notes" added to the counter for the current row.
// The time at which a mine occurred for the current row,
// indexed by column
std::vector<float> mines;
// The time at which a fake mine occurred for the current row,
// indexed by column
std::vector<float> fakeMines;
// The time at which a mine occurred in the _previous_ row,
// indexed by column
std::vector<float> nextMines;
// The time at which a fake mine occurred in the _previous_ row,
// indexed by column
std::vector<float> nextFakeMines;
// number of "notes" added to the counter for the current row.
int noteCount = 0;
RowCounter(int columnCount)
{
notes = std::vector<IntermediateNoteData>(columnCount);
activeHolds = std::vector<IntermediateNoteData>(columnCount);
mines = std::vector<float>(columnCount, 0);
@@ -270,10 +277,12 @@ namespace StepParity {
/// following row of the step chart.
struct StepParityNode
{
int id = 0; // The index of this node in its graph
// The index of this node in its graph
int id = 0;
State state;
std::unordered_map<StepParityNode *, float*> neighbors; // Connections to, and the cost of moving to, the connected nodes
// Connections to, and the cost of moving to, the connected nodes
std::unordered_map<StepParityNode *, float*> neighbors;
~StepParityNode()
{
@@ -313,17 +322,18 @@ namespace StepParity {
std::vector<std::map<State, StepParityNode *, StateComparator>> stateNodeMap;
public:
StepParityNode * startNode; // This represents the very start of the song, before any notes
StepParityNode *endNode; // This represents the end of the song, after all of the notes
// This represents the very start of the song, before any notes
StepParityNode * startNode;
// This represents the end of the song, after all of the notes
StepParityNode *endNode;
~StepParityGraph()
{
states.clear();
states.clear();
for(StepParityNode * node: nodes)
{
delete node;
}
}
/// @brief Returns a pointer to a StepParityNode that represents the given state within the graph.
@@ -332,7 +342,8 @@ namespace StepParity {
/// @return
StepParityNode *addOrGetExistingNode(const State &state);
void addEdge(StepParityNode* from, StepParityNode* to, float* costs) {
void addEdge(StepParityNode* from, StepParityNode* to, float* costs)
{
from->neighbors[to] = costs;
}
@@ -348,8 +359,6 @@ namespace StepParity {
return nodes[index];
}
};
};
#endif
+32 -30
View File
@@ -5,11 +5,8 @@
#include "TechCounts.h"
#include "GameState.h"
using namespace StepParity;
void StepParityGenerator::analyzeNoteData(const NoteData &in)
{
columnCount = in.GetNumTracks();
@@ -25,7 +22,6 @@ void StepParityGenerator::analyzeNoteData(const NoteData &in)
analyzeGraph();
}
void StepParityGenerator::analyzeGraph() {
nodes_for_rows = computeCheapestPath();
ASSERT_M(nodes_for_rows.size() == rows.size(), "nodes_for_rows should be the same length as rows!");
@@ -37,7 +33,6 @@ void StepParityGenerator::analyzeGraph() {
}
}
void StepParityGenerator::buildStateGraph()
{
// The first node of the graph is beginningState, which represents the time before
@@ -95,17 +90,16 @@ void StepParityGenerator::buildStateGraph()
{
State state = previousStates.front();
StepParityNode *node = graph.addOrGetExistingNode(state);
float * emptyCosts = new float[NUM_Cost];
for(int i = 0; i < NUM_Cost; i++)
{
emptyCosts[i] = 0;
}
float * emptyCosts = new float[NUM_Cost];
for(int i = 0; i < NUM_Cost; i++)
{
emptyCosts[i] = 0;
}
graph.addEdge(node, endNode, emptyCosts);
previousStates.pop();
}
}
State StepParityGenerator::initResultState(State &initialState, Row &row, const FootPlacement &columns)
{
State resultState(row.columnCount);
@@ -117,18 +111,18 @@ State StepParityGenerator::initResultState(State &initialState, Row &row, const
if(columns[i] == NONE) {
continue;
}
resultState.whereTheFeetAre[columns[i]] = i;
resultState.whereTheFeetAre[columns[i]] = i;
if(row.holds[i].type == TapNoteType_Empty)
{
resultState.movedFeet[i] = columns[i];
resultState.didTheFootMove[columns[i]] = true;
resultState.didTheFootMove[columns[i]] = true;
continue;
}
if(initialState.columns[i] != columns[i])
{
resultState.movedFeet[i] = columns[i];
resultState.didTheFootMove[columns[i]] = true;
resultState.didTheFootMove[columns[i]] = true;
}
}
@@ -141,14 +135,13 @@ State StepParityGenerator::initResultState(State &initialState, Row &row, const
if(row.holds[i].type != TapNoteType_Empty)
{
resultState.holdFeet[i] = columns[i];
resultState.isTheFootHolding[columns[i]] = true;
resultState.isTheFootHolding[columns[i]] = true;
}
}
resultState.second = row.second;
return resultState;
}
std::vector<FootPlacement>* StepParityGenerator::getFootPlacementPermutations(const Row &row)
{
int cacheKey = getPermuteCacheKey(row);
@@ -175,15 +168,25 @@ std::vector<FootPlacement> StepParityGenerator::PermuteFootPlacements(const Row
for (unsigned long i = 0; i < columns.size(); i++)
{
if (columns[i] == NONE)
{
continue;
}
if (columns[i] == LEFT_HEEL)
{
leftHeelIndex = i;
}
if (columns[i] == LEFT_TOE)
{
leftToeIndex = i;
}
if (columns[i] == RIGHT_HEEL)
{
rightHeelIndex = i;
}
if (columns[i] == RIGHT_TOE)
{
rightToeIndex = i;
}
}
if (
(leftHeelIndex == -1 && leftToeIndex != -1) ||
@@ -194,19 +197,24 @@ std::vector<FootPlacement> StepParityGenerator::PermuteFootPlacements(const Row
if (leftHeelIndex != -1 && leftToeIndex != -1)
{
if (!layout.bracketCheck(leftHeelIndex, leftToeIndex))
{
return std::vector<FootPlacement>();
}
}
if (rightHeelIndex != -1 && rightToeIndex != -1)
{
if (!layout.bracketCheck(rightHeelIndex, rightToeIndex))
{
return std::vector<FootPlacement>();
}
}
return {columns};
}
std::vector<FootPlacement> permutations;
if (row.notes[column].type != TapNoteType_Empty || row.holds[column].type != TapNoteType_Empty) {
if (row.notes[column].type != TapNoteType_Empty ||
row.holds[column].type != TapNoteType_Empty)
{
for (StepParity::Foot foot: FEET) {
if(std::find(columns.begin(), columns.end(), foot) != columns.end())
{
@@ -224,7 +232,6 @@ std::vector<FootPlacement> StepParityGenerator::PermuteFootPlacements(const Row
return PermuteFootPlacements(row, columns, column + 1);
}
std::vector<int> StepParityGenerator::computeCheapestPath()
{
int start = graph.startNode->id;
@@ -241,7 +248,6 @@ std::vector<int> StepParityGenerator::computeCheapestPath()
{
int neighbor_id = neighbor.first->id;
float weight = neighbor.second[COST_TOTAL];
// printf("computeCheapestPath:: weight = %f", weight);
if(cost[i] + weight < cost[neighbor_id])
{
cost[neighbor_id] = cost[i] + weight;
@@ -264,8 +270,8 @@ std::vector<int> StepParityGenerator::computeCheapestPath()
return shortest_path;
}
void StepParityGenerator::CreateIntermediateNoteData(const NoteData &in, std::vector<IntermediateNoteData> &out)
void StepParityGenerator::CreateIntermediateNoteData(
const NoteData &in, std::vector<IntermediateNoteData> &out)
{
TimingData *timing = GAMESTATE->GetProcessedTimingData();
int columnCount = in.GetNumTracks();
@@ -302,7 +308,6 @@ void StepParityGenerator::CreateIntermediateNoteData(const NoteData &in, std::ve
out.assign(notes.begin(), notes.end());
}
void StepParityGenerator::CreateRows(const NoteData &in)
{
TimingData *timing = GAMESTATE->GetProcessedTimingData();
@@ -332,7 +337,6 @@ void StepParityGenerator::CreateRows(const NoteData &in)
// before checking whether or not this note represens a new row.
// But we only want to create a new Row if it has at least one note.
// So probably something like
/*
for(note of notes)
@@ -349,7 +353,6 @@ void StepParityGenerator::CreateRows(const NoteData &in)
check if note is a mine or fake mine
if note is fake continue
put note into counter.notes
}
*/
if (note.second == counter.lastColumnSecond && rows.size() > 0)
@@ -384,14 +387,13 @@ void StepParityGenerator::CreateRows(const NoteData &in)
if (counter.lastColumnSecond != note.second)
{
// we're past the previous row, so save all of the previous row's data
// We're past the previous row, so save all of the previous row's data.
if (counter.lastColumnSecond != CLM_SECOND_INVALID)
{
AddRow(counter);
}
// Move mines and fakeMines to "next", and reset counters
// Move mines and fakeMines to "next", and reset counters.
counter.lastColumnSecond = note.second;
counter.lastColumnBeat = note.beat;
counter.nextMines.assign(counter.mines.begin(), counter.mines.end());
@@ -400,7 +402,7 @@ void StepParityGenerator::CreateRows(const NoteData &in)
counter.mines = std::vector<float>(columnCount);
counter.fakeMines = std::vector<float>(columnCount);
// reset any now-inactive holds to empty values
// Reset any now-inactive holds to empty values.
for (int c = 0; c < columnCount; c++)
{
if (counter.activeHolds[c].type == TapNoteType_Empty || note.beat > counter.activeHolds[c].beat + counter.activeHolds[c].hold_length)
+4 -5
View File
@@ -332,8 +332,7 @@ void Steps::CalculateRadarValues( float fMusicLengthSeconds )
this->GetNoteData( tempNoteData );
FOREACH_PlayerNumber(pn)
m_CachedRadarValues[pn]
.Zero();
m_CachedRadarValues[pn].Zero();
GAMESTATE->SetProcessedTimingData(this->GetTimingData());
if( tempNoteData.IsComposite() )
@@ -389,7 +388,7 @@ void Steps::CalculateTechCounts()
m_CachedTechCounts[pn]
.Zero();
// If we don't have a valid layout for this StepsType, then don't even bother
if(StepParity::Layouts.find(this->m_StepsType) == StepParity::Layouts.end())
{
@@ -1045,8 +1044,8 @@ public:
ADD_METHOD( HasAttacks );
ADD_METHOD( GetRadarValues );
ADD_METHOD( GetTechCounts );
ADD_METHOD(CalculateTechCounts);
ADD_METHOD(GetTimingData);
ADD_METHOD( CalculateTechCounts );
ADD_METHOD( GetTimingData );
ADD_METHOD( GetChartName );
//ADD_METHOD( GetSMNoteData );
ADD_METHOD( GetStepsType );
+9 -19
View File
@@ -8,7 +8,6 @@
#include "GameState.h"
#include "RageTimer.h"
static const char *TechCountsCategoryNames[] = {
"Crossovers",
"HalfCrossovers",
@@ -27,7 +26,6 @@ XToLocalizedString( TechCountsCategory );
LuaFunction(TechCountsCategoryToLocalizedString, TechCountsCategoryToLocalizedString(Enum::Check<TechCountsCategory>(L, 1)) );
LuaXType( TechCountsCategory );
// 0.176 ~= 1/8th at 175bpm
// Anything slower isn't counted as a jack
const float JACK_CUTOFF = 0.176;
@@ -90,10 +88,8 @@ void TechCounts::FromString( RString sTechCounts )
{
(*this)[rc] = StringToFloat(saValues[rc]);
}
}
void TechCounts::CalculateTechCountsFromRows(const std::vector<StepParity::Row> &rows, StepParity::StageLayout & layout, TechCounts &out)
{
for (unsigned long i = 1; i < rows.size(); i++)
@@ -103,17 +99,15 @@ void TechCounts::CalculateTechCountsFromRows(const std::vector<StepParity::Row>
float elapsedTime = currentRow.second - previousRow.second;
/*
Jacks are same arrow same foot
Doublestep is same foot on successive arrows
Brackets are jumps with one foot
// Jacks are same arrow same foot
// Doublestep is same foot on successive arrows
// Brackets are jumps with one foot
Footswitch is different foot on the up or down arrow
Sideswitch is footswitch on left or right arrow
Crossovers are left foot on right arrow or vice versa
*/
// Footswitch is different foot on the up or down arrow
// Sideswitch is footswitch on left or right arrow
// Crossovers are left foot on right arrow or vice versa
// check for jacks and doublesteps
// Check for jacks and doublesteps
if(currentRow.noteCount == 1 && previousRow.noteCount == 1)
{
for (StepParity::Foot foot: StepParity::FEET)
@@ -140,7 +134,7 @@ void TechCounts::CalculateTechCountsFromRows(const std::vector<StepParity::Row>
}
}
// check for brackets
// Check for brackets
if(currentRow.noteCount >= 2)
{
if(currentRow.whereTheFeetAre[StepParity::LEFT_HEEL] != -1 && currentRow.whereTheFeetAre[StepParity::LEFT_TOE] != -1)
@@ -183,7 +177,6 @@ void TechCounts::CalculateTechCountsFromRows(const std::vector<StepParity::Row>
}
// Check for crossovers
int leftHeel = currentRow.whereTheFeetAre[StepParity::LEFT_HEEL];
int leftToe = currentRow.whereTheFeetAre[StepParity::LEFT_TOE];
int rightHeel = currentRow.whereTheFeetAre[StepParity::RIGHT_HEEL];
@@ -235,7 +228,7 @@ void TechCounts::CalculateTechCountsFromRows(const std::vector<StepParity::Row>
}
}
}
// and check the same thing, starting with left foot
// And check the same thing, starting with left foot
else if(leftHeel != -1 && previousRightHeel != -1 && previousLeftHeel == -1)
{
StepParity::StagePoint leftPos = layout.averagePoint(leftHeel, leftToe);
@@ -287,12 +280,9 @@ bool TechCounts::isFootswitch(int c, const StepParity::Row & currentRow, const S
}
// lua start
class LunaTechCounts: public Luna<TechCounts>
{
public:
static int GetValue( T* p, lua_State *L ) { lua_pushnumber( L, (*p)[Enum::Check<TechCountsCategory>(L, 1)] ); return 1; }
LunaTechCounts()
+1 -2
View File
@@ -3,8 +3,7 @@
#include "GameConstantsAndTypes.h"
#include "StepParityGenerator.h"
class NoteData;
#include "NoteData.h"
/** @brief Unknown radar values are given a default value. */
#define TECHCOUNTS_VAL_UNKNOWN -1