Skip to content

Commit a6129d4

Browse files
authored
Initial release bugfix 2 (#87)
* Fix note generation using the wrong snaps * Prevent entering zero BPM
1 parent 99079d1 commit a6129d4

File tree

5 files changed

+15
-24
lines changed

5 files changed

+15
-24
lines changed

src/Dialogs/AdjustSync.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ void DialogAdjustSync::onAction(int id)
192192
gTempo->setOffset(myOffset);
193193
} break;
194194
case ACT_SET_BPM: {
195-
gTempo->addSegment(BpmChange(0, myInitialBPM));
195+
if (myInitialBPM != 0.0)
196+
{
197+
gTempo->addSegment(BpmChange(0, myInitialBPM));
198+
}
196199
} break;
197200
case ACT_TWEAK_BPM: {
198201
gTempo->startTweakingBpm(0);

src/Dialogs/AdjustTempo.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ void DialogAdjustTempo::onAction(int id)
165165
switch(id)
166166
{
167167
case ACT_BPM_SET: {
168-
gTempo->addSegment(BpmChange(row, myBPM));
168+
if (myBPM != 0.0)
169+
{
170+
gTempo->addSegment(BpmChange(row, myBPM));
171+
}
169172
} break;
170173
case ACT_BPM_HALVE:
171174
case ACT_BPM_DOUBLE: {

src/Editor/StreamGenerator.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ enum Foot
2828
FOOT_R = 1
2929
};
3030

31-
static const int RowSnapTypes[NUM_SNAP_TYPES] =
32-
{
33-
1, 48, 24, 16, 12, 10, 8, 6, 4, 3, 2, 1
34-
};
35-
3631
static float GetPadDist(vec2i* pad, int colA, int colB)
3732
{
3833
float dx = (float)(pad[colA].x - pad[colB].x);
@@ -280,7 +275,7 @@ void StreamGenerator::generate(int row, int endRow, SnapType spacing)
280275

281276
int facingLeft = 0;
282277
int facingRight = 0;
283-
int rowDelta = RowSnapTypes[spacing];
278+
int rowDelta = sRowSnapTypes[spacing];
284279
int rowDeltaIndex = 0;
285280
while(row < endRow)
286281
{
@@ -294,17 +289,7 @@ void StreamGenerator::generate(int row, int endRow, SnapType spacing)
294289
facingLeft += yl < yr;
295290
facingRight += yr < yl;
296291

297-
// Advance to the next row position.
298-
if(rowDelta == 10)
299-
{
300-
static const int deltas[5] = {10, 9, 10, 9, 10};
301-
row += deltas[rowDeltaIndex];
302-
if(++rowDeltaIndex == 5) rowDeltaIndex = 0;
303-
}
304-
else
305-
{
306-
row += rowDelta;
307-
}
292+
row += rowDelta;
308293
}
309294

310295
// Some debug statistics.

src/Editor/View.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
3131
namespace Vortex {
3232
namespace {
3333

34-
static const int sRowSnapTypes[NUM_SNAP_TYPES] =
35-
{
36-
1, 48, 24, 16, 12, 8, 6, 4, 3, 2, 1, 0
37-
};
38-
3934
}; // anonymous namespace
4035

4136
// ================================================================================================

src/Editor/View.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
namespace Vortex {
66

7+
static const int sRowSnapTypes[NUM_SNAP_TYPES] =
8+
{
9+
1, 48, 24, 16, 12, 8, 6, 4, 3, 2, 1, 0
10+
};
11+
712
// Represents a time stamp in time-based mode, and a row in row-based mode.
813
typedef double ChartOffset;
914

0 commit comments

Comments
 (0)