add saving/loading/editing of rolls

This commit is contained in:
Chris Danford
2005-04-18 01:23:57 +00:00
parent abac6af93b
commit 6f588aa7d8
5 changed files with 37 additions and 18 deletions
+11 -3
View File
@@ -104,7 +104,13 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData
case '0': tn = TAP_EMPTY; break; case '0': tn = TAP_EMPTY; break;
case '1': tn = TAP_ORIGINAL_TAP; break; case '1': tn = TAP_ORIGINAL_TAP; break;
case '2': case '2':
tn = TAP_ORIGINAL_HOLD_HEAD; case '4':
switch( ch )
{
case '2': tn = TAP_ORIGINAL_HOLD_HEAD; break;
case '4': tn = TAP_ORIGINAL_ROLL_HEAD; break;
default: ASSERT(0);
}
/* Set the hold note to have infinite length. We'll clamp it when /* Set the hold note to have infinite length. We'll clamp it when
* we hit the tail. */ * we hit the tail. */
@@ -295,7 +301,7 @@ void NoteDataUtil::GetSMNoteDataString( const NoteData &in_, CString &notes_out
{ {
case TapNote::empty: c = '0'; break; case TapNote::empty: c = '0'; break;
case TapNote::tap: c = '1'; break; case TapNote::tap: c = '1'; break;
case TapNote::hold_head: c = '2'; break; case TapNote::hold_head: c = tn.bIsRoll ? '2':'4'; break;
case TapNote::hold_tail: c = '3'; break; case TapNote::hold_tail: c = '3'; break;
case TapNote::mine: c = 'M'; break; case TapNote::mine: c = 'M'; break;
case TapNote::attack: c = 'A'; break; case TapNote::attack: c = 'A'; break;
@@ -1734,7 +1740,9 @@ void NoteDataUtil::AddTapAttacks( NoteData &nd, Song* pSong )
int iBeat = (int)fBeat; int iBeat = (int)fBeat;
int iTrack = iBeat % nd.GetNumTracks(); // deterministically calculates track int iTrack = iBeat % nd.GetNumTracks(); // deterministically calculates track
TapNote tn( TapNote tn(
TapNote::attack, TapNote::original, TapNote::attack,
false,
TapNote::original,
szAttacks[rand()%ARRAYSIZE(szAttacks)], szAttacks[rand()%ARRAYSIZE(szAttacks)],
15.0f, 15.0f,
false, false,
+9 -8
View File
@@ -2,14 +2,15 @@
#include "NoteTypes.h" #include "NoteTypes.h"
#include "RageUtil.h" #include "RageUtil.h"
TapNote TAP_EMPTY ( TapNote::empty, TapNote::original, "", 0, false, 0 ); TapNote TAP_EMPTY ( TapNote::empty, false, TapNote::original, "", 0, false, 0 );
TapNote TAP_ORIGINAL_TAP ( TapNote::tap, TapNote::original, "", 0, false, 0 ); TapNote TAP_ORIGINAL_TAP ( TapNote::tap, false, TapNote::original, "", 0, false, 0 );
TapNote TAP_ORIGINAL_HOLD_HEAD ( TapNote::hold_head, TapNote::original, "", 0, false, 0 ); TapNote TAP_ORIGINAL_HOLD_HEAD ( TapNote::hold_head, false, TapNote::original, "", 0, false, 0 );
TapNote TAP_ORIGINAL_MINE ( TapNote::mine, TapNote::original, "", 0, false, 0 ); TapNote TAP_ORIGINAL_ROLL_HEAD ( TapNote::hold_head, true, TapNote::original, "", 0, false, 0 );
TapNote TAP_ORIGINAL_ATTACK ( TapNote::attack, TapNote::original, "", 0, false, 0 ); TapNote TAP_ORIGINAL_MINE ( TapNote::mine, false, TapNote::original, "", 0, false, 0 );
TapNote TAP_ORIGINAL_AUTO_KEYSOUND ( TapNote::autoKeysound,TapNote::original, "", 0, false, 0 ); TapNote TAP_ORIGINAL_ATTACK ( TapNote::attack, false, TapNote::original, "", 0, false, 0 );
TapNote TAP_ADDITION_TAP ( TapNote::tap, TapNote::addition, "", 0, false, 0 ); TapNote TAP_ORIGINAL_AUTO_KEYSOUND ( TapNote::autoKeysound,false, TapNote::original, "", 0, false, 0 );
TapNote TAP_ADDITION_MINE ( TapNote::mine, TapNote::addition, "", 0, false, 0 ); TapNote TAP_ADDITION_TAP ( TapNote::tap, false, TapNote::addition, "", 0, false, 0 );
TapNote TAP_ADDITION_MINE ( TapNote::mine, false, TapNote::addition, "", 0, false, 0 );
static const CString NoteTypeNames[NUM_NOTE_TYPES] = { static const CString NoteTypeNames[NUM_NOTE_TYPES] = {
"4th", "4th",
+6 -1
View File
@@ -57,12 +57,13 @@ struct TapNote
enum Type { enum Type {
empty, // no note here empty, // no note here
tap, tap,
hold_head, // graded like a TAP_TAP hold_head, // graded like a TAP_TAP if
hold_tail, /* In 2sand3s mode, holds are deleted and TAP_HOLD_END is added: */ hold_tail, /* In 2sand3s mode, holds are deleted and TAP_HOLD_END is added: */
mine, // don't step! mine, // don't step!
attack, attack,
autoKeysound, autoKeysound,
} type; } type;
bool bIsRoll; // only possibly true if type == hold_head
enum Source { enum Source {
original, // part of the original NoteData original, // part of the original NoteData
addition, // additional note added by a transform addition, // additional note added by a transform
@@ -100,6 +101,7 @@ struct TapNote
TapNote() {} TapNote() {}
TapNote( TapNote(
Type type_, Type type_,
bool bIsRoll_,
Source source_, Source source_,
CString sAttackModifiers_, CString sAttackModifiers_,
float fAttackDurationSeconds_, float fAttackDurationSeconds_,
@@ -107,6 +109,7 @@ struct TapNote
int iKeysoundIndex_ ) int iKeysoundIndex_ )
{ {
type = type_; type = type_;
bIsRoll = bIsRoll_;
source = source_; source = source_;
sAttackModifiers = sAttackModifiers_; sAttackModifiers = sAttackModifiers_;
fAttackDurationSeconds = fAttackDurationSeconds_; fAttackDurationSeconds = fAttackDurationSeconds_;
@@ -118,6 +121,7 @@ struct TapNote
{ {
#define COMPARE(x) if(x!=other.x) return false; #define COMPARE(x) if(x!=other.x) return false;
COMPARE(type); COMPARE(type);
COMPARE(bIsRoll);
COMPARE(source); COMPARE(source);
COMPARE(sAttackModifiers); COMPARE(sAttackModifiers);
COMPARE(fAttackDurationSeconds); COMPARE(fAttackDurationSeconds);
@@ -132,6 +136,7 @@ struct TapNote
extern TapNote TAP_EMPTY; // '0' extern TapNote TAP_EMPTY; // '0'
extern TapNote TAP_ORIGINAL_TAP; // '1' extern TapNote TAP_ORIGINAL_TAP; // '1'
extern TapNote TAP_ORIGINAL_HOLD_HEAD; // '2' extern TapNote TAP_ORIGINAL_HOLD_HEAD; // '2'
extern TapNote TAP_ORIGINAL_ROLL_HEAD; // '4'
extern TapNote TAP_ORIGINAL_MINE; // 'M' extern TapNote TAP_ORIGINAL_MINE; // 'M'
extern TapNote TAP_ORIGINAL_ATTACK; // 'A' extern TapNote TAP_ORIGINAL_ATTACK; // 'A'
extern TapNote TAP_ORIGINAL_AUTO_KEYSOUND; // 'K' extern TapNote TAP_ORIGINAL_AUTO_KEYSOUND; // 'K'
+8 -3
View File
@@ -113,7 +113,7 @@ void ScreenEdit::InitEditMappings()
g_EditMappings.button[EDIT_BUTTON_RIGHT_SIDE][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LALT); g_EditMappings.button[EDIT_BUTTON_RIGHT_SIDE][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LALT);
g_EditMappings.button[EDIT_BUTTON_RIGHT_SIDE][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RALT); g_EditMappings.button[EDIT_BUTTON_RIGHT_SIDE][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RALT);
g_EditMappings.button[EDIT_BUTTON_LAY_MINE][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT); g_EditMappings.button[EDIT_BUTTON_LAY_MINE_OR_ROLL][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT);
g_EditMappings.button[EDIT_BUTTON_LAY_ATTACK][0] = DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT); g_EditMappings.button[EDIT_BUTTON_LAY_ATTACK][0] = DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT);
@@ -890,7 +890,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
m_NoteDataEdit.SetTapNote( iCol, iSongIndex, TAP_EMPTY ); m_NoteDataEdit.SetTapNote( iCol, iSongIndex, TAP_EMPTY );
// Don't CheckNumberOfNotesAndUndo. We don't want to revert any change that removes notes. // Don't CheckNumberOfNotesAndUndo. We don't want to revert any change that removes notes.
} }
else if( EditIsBeingPressed(EDIT_BUTTON_LAY_MINE) ) else if( EditIsBeingPressed(EDIT_BUTTON_LAY_MINE_OR_ROLL) )
{ {
m_soundAddNote.Play(); m_soundAddNote.Play();
SaveUndo(); SaveUndo();
@@ -1005,7 +1005,10 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
// Don't SaveUndo. We want to undo the whole hold, not just the last segment // Don't SaveUndo. We want to undo the whole hold, not just the last segment
// that the user made. Dragging the hold bigger can only absorb and remove // that the user made. Dragging the hold bigger can only absorb and remove
// other taps, so dragging won't cause us to exceed the note limit. // other taps, so dragging won't cause us to exceed the note limit.
if( EditIsBeingPressed(EDIT_BUTTON_LAY_MINE_OR_ROLL) )
m_NoteDataEdit.AddHoldNote( iCol, iStartRow, iEndRow, TAP_ORIGINAL_HOLD_HEAD ); m_NoteDataEdit.AddHoldNote( iCol, iStartRow, iEndRow, TAP_ORIGINAL_HOLD_HEAD );
else
m_NoteDataEdit.AddHoldNote( iCol, iStartRow, iEndRow, TAP_ORIGINAL_ROLL_HEAD );
} }
if( EditIsBeingPressed(EDIT_BUTTON_SCROLL_SELECT) ) if( EditIsBeingPressed(EDIT_BUTTON_SCROLL_SELECT) )
@@ -1605,7 +1608,9 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
const int row = BeatToNoteRow( GAMESTATE->m_fSongBeat ); const int row = BeatToNoteRow( GAMESTATE->m_fSongBeat );
TapNote tn( TapNote tn(
TapNote::attack, TapNote::original, TapNote::attack,
false,
TapNote::original,
sMods, sMods,
g_fLastInsertAttackDurationSeconds, g_fLastInsertAttackDurationSeconds,
false, false,
+1 -1
View File
@@ -36,7 +36,7 @@ enum EditButton
/* These are modifiers to EDIT_BUTTON_COLUMN_*. */ /* These are modifiers to EDIT_BUTTON_COLUMN_*. */
EDIT_BUTTON_RIGHT_SIDE, EDIT_BUTTON_RIGHT_SIDE,
EDIT_BUTTON_LAY_MINE, EDIT_BUTTON_LAY_MINE_OR_ROLL,
EDIT_BUTTON_LAY_ATTACK, EDIT_BUTTON_LAY_ATTACK,
EDIT_BUTTON_SCROLL_UP_LINE, EDIT_BUTTON_SCROLL_UP_LINE,