Files
itgmania212121/stepmania/src/ScreenEdit.cpp
T

983 lines
28 KiB
C++
Raw Normal View History

2002-05-20 08:59:37 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
2002-06-29 11:59:09 +00:00
Class: ScreenEdit
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
Desc: See header.
2002-05-20 08:59:37 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
2002-06-29 11:59:09 +00:00
Chris Danford
2002-05-20 08:59:37 +00:00
-----------------------------------------------------------------------------
*/
#include "ScreenEdit.h"
#include "PrefsManager.h"
#include "SongManager.h"
#include "ScreenManager.h"
#include "ScreenSelectMusic.h"
2002-06-24 22:04:31 +00:00
#include "ScreenEvaluation.h"
2002-05-20 08:59:37 +00:00
#include "GameConstantsAndTypes.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2002-05-20 08:59:37 +00:00
#include "GameManager.h"
#include "ScreenEditMenu.h"
#include "GameConstantsAndTypes.h"
#include "RageLog.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
#include "GameState.h"
2002-05-20 08:59:37 +00:00
//
// Defines specific to GameScreenTitleMenu
//
const float MAX_SECONDS_CAN_BE_OFF_BY = 0.20f;
const float GRAY_ARROW_Y = ARROW_SIZE * 1.5;
const float DEBUG_X = SCREEN_LEFT + 10;
const float DEBUG_Y = CENTER_Y-100;
2002-06-29 11:59:09 +00:00
const float HELP_X = SCREEN_LEFT + 10;
const float HELP_Y = CENTER_Y; // top aligned
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
const float INFO_X = SCREEN_RIGHT - 10 ;
const float INFO_Y = SCREEN_BOTTOM - 10; // bottom aligned
2002-05-20 08:59:37 +00:00
const float MENU_WIDTH = 110;
2002-07-02 00:27:58 +00:00
const float EDIT_X = CENTER_X + 100;
2002-05-20 08:59:37 +00:00
const float EDIT_GRAY_Y = CENTER_Y - 2.0f * (float)ARROW_SIZE;
2002-07-02 00:27:58 +00:00
const float PLAYER_X = EDIT_X;
const float PLAYER_Y = SCREEN_TOP;
2002-06-29 11:59:09 +00:00
const CString HELP_TEXT =
"Esc: exit\n"
"S: save changes\n"
"Up/Down: change beat\n"
"Left/Right: change snap\n"
"PgUp/PgDn: jump 1 measure\n"
"Home/End: jump to first/last beat\n"
"Number keys: add or remove tap note\n"
"To create a hold note, hold a number key\n"
" while changing the beat pressing Up/Down\n"
"Enter/Space: set begin/end selection markers\n"
"G/H/J/K/L: Snap selected notes to nearest\n"
" 4th / 8th / 12th / 16th / 12th or 16th\n"
"P: Play selected area\n"
"R: Record in selected area\n"
2002-08-01 13:42:56 +00:00
"T: Toggle Play/Record rate\n"
2002-06-29 11:59:09 +00:00
"X: Cut selected area\n"
"C: Copy selected area\n"
"V: Paste at current beat\n"
"D: Toggle difficulty\n"
"Ins: Insert blank beat\n"
"Del: Delete current beat and shift\n"
2002-07-02 00:27:58 +00:00
" Hold F keys for faster change:\n"
"F7/F8: Decrease/increase BPM at cur beat\n"
"F9/F10: Dec/inc freeze secs at cur beat\n"
"F11/F12: Decrease/increase music offset\n"
"F1/F2 : Dec/inc sample music start\n"
"NumPad -/+: Dec/inc sample music length\n"
"M: Play sample music\n";
2002-06-29 11:59:09 +00:00
2002-05-20 08:59:37 +00:00
const ScreenMessage SM_GoToPrevState = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User+2);
ScreenEdit::ScreenEdit()
{
LOG->Trace( "ScreenEdit::ScreenEdit()" );
2002-05-20 08:59:37 +00:00
2002-07-23 01:41:40 +00:00
m_pSong = GAMESTATE->m_pCurSong;
2002-07-02 00:27:58 +00:00
2002-07-23 01:41:40 +00:00
m_pNotes = GAMESTATE->m_pCurNotes[PLAYER_1];
2002-07-02 00:27:58 +00:00
if( m_pNotes == NULL )
{
m_pNotes = new Notes;
m_pNotes->m_DifficultyClass = CLASS_MEDIUM;
m_pNotes->m_NotesType = GAMESTATE->GetCurrentStyleDef()->m_NotesType;
m_pNotes->m_sDescription = "Untitled";
// Dro Kulix: If m_pNotes->m_NotesType is not changed here,
// the edit mode is somehow stuck only being able to edit
// the first four columns of a (NEW) sequence.
// I've determined that this is because m_NotesType is
// initialized in the constructor as
// NOTES_TYPE_DANCE_SINGLE. For minimal impact, I am
// changing m_NotesType here, but at some point we
// may want to consider changing it in the Notes
// constructor, if another reason to do so pops up...
// In ScreenEditMenu, the screen preceding this one,
// GAMEMAN->m_CurStyle is set to the target game style
// of the current edit. Naturally, this is where we'll
// want to extract the NotesType for a (NEW) sequence.
2002-07-11 19:02:26 +00:00
m_pSong->m_apNotes.Add( m_pNotes );
2002-07-02 00:27:58 +00:00
}
2002-05-20 08:59:37 +00:00
2002-07-03 03:13:13 +00:00
NoteData noteData;
m_pNotes->GetNoteData( &noteData );
2002-07-28 20:28:37 +00:00
m_EditMode = MODE_EDITING;
GAMESTATE->m_bEditing = true;
2002-05-20 08:59:37 +00:00
GAMESTATE->m_fSongBeat = 0;
m_fTrailingBeat = GAMESTATE->m_fSongBeat;
2002-08-01 13:42:56 +00:00
GAMESTATE->m_SongOptions.m_fMusicRate = 1;
2002-05-20 08:59:37 +00:00
2002-07-28 20:28:37 +00:00
GAMESTATE->m_PlayerOptions[PLAYER_1].m_fArrowScrollSpeed = 1;
GAMESTATE->m_PlayerOptions[PLAYER_1].m_ColorType = PlayerOptions::COLOR_NOTE;
2002-05-20 08:59:37 +00:00
m_sprBackground.Load( THEME->GetPathTo("Graphics","edit background") );
2002-05-20 08:59:37 +00:00
m_sprBackground.StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
m_SnapDisplay.SetXY( EDIT_X, EDIT_GRAY_Y );
m_SnapDisplay.Load();
m_SnapDisplay.SetZoom( 0.5f );
2002-05-20 08:59:37 +00:00
2002-07-02 00:27:58 +00:00
m_GrayArrowRowEdit.SetXY( EDIT_X, EDIT_GRAY_Y );
2002-07-28 20:28:37 +00:00
m_GrayArrowRowEdit.Load( PLAYER_1 );
2002-05-20 08:59:37 +00:00
m_GrayArrowRowEdit.SetZoom( 0.5f );
2002-07-02 00:27:58 +00:00
m_NoteFieldEdit.SetXY( EDIT_X, EDIT_GRAY_Y );
2002-05-20 08:59:37 +00:00
m_NoteFieldEdit.SetZoom( 0.5f );
2002-07-28 20:28:37 +00:00
m_NoteFieldEdit.Load( &noteData, PLAYER_1, 200, 800 );
2002-05-20 08:59:37 +00:00
m_rectRecordBack.StretchTo( CRect(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
m_rectRecordBack.SetDiffuseColor( D3DXCOLOR(0,0,0,0) );
2002-07-02 00:27:58 +00:00
m_GrayArrowRowRecord.SetXY( EDIT_X, EDIT_GRAY_Y );
2002-07-28 20:28:37 +00:00
m_GrayArrowRowRecord.Load( PLAYER_1 );
2002-05-20 08:59:37 +00:00
m_GrayArrowRowRecord.SetZoom( 1.0f );
2002-07-02 00:27:58 +00:00
m_NoteFieldRecord.SetXY( EDIT_X, EDIT_GRAY_Y );
2002-05-20 08:59:37 +00:00
m_NoteFieldRecord.SetZoom( 1.0f );
2002-07-28 20:28:37 +00:00
m_NoteFieldRecord.Load( &noteData, PLAYER_1, 60, 300 );
2002-07-02 00:27:58 +00:00
m_Clipboard.m_iNumTracks = m_NoteFieldEdit.m_iNumTracks;
2002-05-20 08:59:37 +00:00
2002-07-28 20:28:37 +00:00
m_Player.Load( PLAYER_1, &noteData, NULL, NULL );
2002-07-02 00:27:58 +00:00
m_Player.SetXY( PLAYER_X, PLAYER_Y );
2002-05-20 08:59:37 +00:00
m_Fade.SetClosed();
m_textInfo.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
2002-05-20 08:59:37 +00:00
m_textInfo.SetXY( INFO_X, INFO_Y );
2002-06-29 11:59:09 +00:00
m_textInfo.SetHorizAlign( Actor::align_right );
m_textInfo.SetVertAlign( Actor::align_top );
2002-05-20 08:59:37 +00:00
m_textInfo.SetZoom( 0.5f );
2002-06-29 11:59:09 +00:00
m_textInfo.SetShadowLength( 2 );
2002-05-20 08:59:37 +00:00
//m_textInfo.SetText(); // set this below every frame
m_textHelp.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
2002-06-29 11:59:09 +00:00
m_textHelp.SetXY( HELP_X, HELP_Y );
m_textHelp.SetHorizAlign( Actor::align_left );
m_textHelp.SetZoom( 0.5f );
m_textHelp.SetShadowLength( 2 );
m_textHelp.SetText( HELP_TEXT );
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
m_soundChangeLine.Load( THEME->GetPathTo("Sounds","edit change line"), 10 );
m_soundChangeSnap.Load( THEME->GetPathTo("Sounds","edit change snap") );
m_soundMarker.Load( THEME->GetPathTo("Sounds","edit marker") );
m_soundInvalid.Load( THEME->GetPathTo("Sounds","menu invalid") );
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
2002-07-11 19:02:26 +00:00
m_soundMusic.Load( m_pSong->GetMusicPath(), true ); // enable accurate sync
2002-05-20 08:59:37 +00:00
m_Fade.OpenWipingRight();
}
ScreenEdit::~ScreenEdit()
{
LOG->Trace( "ScreenEdit::~ScreenEdit()" );
2002-05-20 08:59:37 +00:00
m_soundMusic.Stop();
}
void ScreenEdit::Update( float fDeltaTime )
{
float fPositionSeconds = m_soundMusic.GetPositionSeconds();
2002-06-30 23:19:33 +00:00
float fSongBeat, fBPS;
bool bFreeze;
m_pSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS, bFreeze );
2002-05-20 08:59:37 +00:00
// update the global music statistics for other classes to access
GAMESTATE->m_fMusicSeconds = fPositionSeconds;
// GAMESTATE->m_fSongBeat = fSongBeat;
GAMESTATE->m_fCurBPS = fBPS;
GAMESTATE->m_bFreeze = bFreeze;
2002-07-28 20:28:37 +00:00
if( m_EditMode == MODE_RECORDING || m_EditMode == MODE_PLAYING )
2002-05-20 08:59:37 +00:00
{
GAMESTATE->m_fSongBeat = fSongBeat;
2002-05-20 08:59:37 +00:00
if( GAMESTATE->m_fSongBeat > m_NoteFieldEdit.m_fEndMarker )
2002-05-20 08:59:37 +00:00
{
2002-07-28 20:28:37 +00:00
if( m_EditMode == MODE_RECORDING )
2002-05-20 08:59:37 +00:00
{
TransitionToEditFromRecord();
}
2002-07-28 20:28:37 +00:00
else if( m_EditMode == MODE_PLAYING )
2002-05-20 08:59:37 +00:00
{
m_soundMusic.Stop();
2002-07-28 20:28:37 +00:00
m_EditMode = MODE_EDITING;
2002-05-20 08:59:37 +00:00
}
}
}
m_sprBackground.Update( fDeltaTime );
m_SnapDisplay.Update( fDeltaTime );
2002-07-28 20:28:37 +00:00
m_GrayArrowRowEdit.Update( fDeltaTime );
m_NoteFieldEdit.Update( fDeltaTime );
2002-05-20 08:59:37 +00:00
m_Fade.Update( fDeltaTime );
2002-06-29 11:59:09 +00:00
m_textHelp.Update( fDeltaTime );
2002-05-20 08:59:37 +00:00
m_textInfo.Update( fDeltaTime );
2002-07-28 20:28:37 +00:00
if( m_EditMode == MODE_RECORDING || m_EditMode == MODE_PLAYING )
2002-05-20 08:59:37 +00:00
{
m_rectRecordBack.Update( fDeltaTime );
}
2002-07-28 20:28:37 +00:00
if( m_EditMode == MODE_RECORDING )
2002-05-20 08:59:37 +00:00
{
2002-07-28 20:28:37 +00:00
m_GrayArrowRowRecord.Update( fDeltaTime );
m_NoteFieldRecord.Update( fDeltaTime );
2002-05-20 08:59:37 +00:00
}
2002-07-28 20:28:37 +00:00
if( m_EditMode == MODE_PLAYING )
2002-05-20 08:59:37 +00:00
{
2002-07-28 20:28:37 +00:00
m_Player.Update( fDeltaTime );
2002-05-20 08:59:37 +00:00
}
//LOG->Trace( "ScreenEdit::Update(%f)", fDeltaTime );
2002-05-20 08:59:37 +00:00
Screen::Update( fDeltaTime );
2002-06-29 11:59:09 +00:00
// Update trailing beat
float fDelta = GAMESTATE->m_fSongBeat - m_fTrailingBeat;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
if( fabsf(fDelta) < 0.01 )
{
m_fTrailingBeat = GAMESTATE->m_fSongBeat; // snap
2002-06-29 11:59:09 +00:00
}
else
{
float fSign = fDelta / fabsf(fDelta);
float fMoveDelta = fSign*fDeltaTime*40;
if( fabsf(fMoveDelta) > fabsf(fDelta) )
fMoveDelta = fDelta;
m_fTrailingBeat += fMoveDelta;
2002-06-29 11:59:09 +00:00
if( fabsf(fDelta) > 10 )
m_fTrailingBeat += fDelta * fDeltaTime*5;
2002-05-20 08:59:37 +00:00
}
2002-06-29 11:59:09 +00:00
2002-05-20 08:59:37 +00:00
// float fSongBeat, fBPS;
/// float fPositionSeconds = m_soundMusic.GetPositionSeconds();
// fPositionSeconds += 0.08f; // HACK: The assist ticks are playing too late, so make them play a tiny bit earlier
// m_pSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS );
// LOG->Trace( "fPositionSeconds = %f, fSongBeat = %f, fBPS = %f", fPositionSeconds, fSongBeat, fBPS );
2002-05-20 08:59:37 +00:00
2002-07-28 20:28:37 +00:00
m_NoteFieldEdit.Update( fDeltaTime );
2002-05-20 08:59:37 +00:00
int iIndexNow = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat );
2002-05-20 08:59:37 +00:00
CString sNoteType;
switch( m_SnapDisplay.GetSnapMode() )
2002-05-20 08:59:37 +00:00
{
case NOTE_4TH: sNoteType = "quarter notes"; break;
case NOTE_8TH: sNoteType = "eighth notes"; break;
case NOTE_12TH: sNoteType = "triplets"; break;
case NOTE_16TH: sNoteType = "sixteenth notes"; break;
default: ASSERT( false );
}
2002-06-29 11:59:09 +00:00
static int iNumTapNotes = 0, iNumHoldNotes = 0;
static int iCounter = 0;
iCounter++;
if( iCounter % 30 == 0 )
{
iNumTapNotes = m_NoteFieldEdit.GetNumTapNotes();
iNumHoldNotes = m_NoteFieldEdit.GetNumHoldNotes();
}
m_textInfo.SetText( ssprintf(
"Snap = %s\n"
"Beat = %.2f\n"
"Selection = begin: %.2f, end: %.2f\n"
2002-08-01 13:42:56 +00:00
"Play/Record rate: %.1f\n"
2002-06-29 11:59:09 +00:00
"Difficulty = %s\n"
"Description = %s\n"
"Num notes tap: %d, hold: %d\n"
2002-07-02 00:27:58 +00:00
"MusicOffsetSeconds: %.2f\n"
2002-06-29 11:59:09 +00:00
"Preview start: %.2f, length = %.2f\n",
sNoteType,
GAMESTATE->m_fSongBeat,
2002-06-29 11:59:09 +00:00
m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker,
GAMESTATE->m_SongOptions.m_fMusicRate,
2002-07-02 00:27:58 +00:00
DifficultyClassToString( m_pNotes->m_DifficultyClass ),
2002-07-23 01:41:40 +00:00
GAMESTATE->m_pCurNotes[PLAYER_1] ? GAMESTATE->m_pCurNotes[PLAYER_1]->m_sDescription : "no description",
2002-06-29 11:59:09 +00:00
iNumTapNotes, iNumHoldNotes,
2002-07-03 21:27:26 +00:00
m_pSong->m_fBeat0OffsetInSeconds,
2002-06-29 11:59:09 +00:00
m_pSong->m_fMusicSampleStartSeconds, m_pSong->m_fMusicSampleLengthSeconds
) );
2002-05-20 08:59:37 +00:00
}
void ScreenEdit::DrawPrimitives()
{
m_sprBackground.Draw();
m_SnapDisplay.Draw();
2002-05-20 08:59:37 +00:00
m_GrayArrowRowEdit.Draw();
2002-06-29 11:59:09 +00:00
m_textHelp.Draw();
// HACK: Make NoteFieldEdit draw using the trailing beat
float fSongBeat = GAMESTATE->m_fSongBeat; // save song beat
GAMESTATE->m_fSongBeat = m_fTrailingBeat; // put trailing beat in effect
2002-05-20 08:59:37 +00:00
m_NoteFieldEdit.Draw();
GAMESTATE->m_fSongBeat = fSongBeat; // restore real song beat
2002-05-20 08:59:37 +00:00
m_textInfo.Draw();
2002-06-29 11:59:09 +00:00
m_Fade.Draw();
2002-05-20 08:59:37 +00:00
2002-07-28 20:28:37 +00:00
if( m_EditMode == MODE_RECORDING || m_EditMode == MODE_PLAYING )
2002-05-20 08:59:37 +00:00
{
m_rectRecordBack.Draw();
}
2002-07-28 20:28:37 +00:00
if( m_EditMode == MODE_RECORDING )
2002-05-20 08:59:37 +00:00
{
m_GrayArrowRowRecord.Draw();
m_NoteFieldRecord.Draw();
}
2002-07-28 20:28:37 +00:00
if( m_EditMode == MODE_PLAYING )
2002-05-20 08:59:37 +00:00
{
m_Player.Draw();
}
if( m_EditMode == MODE_RECORDING )
{
/*
for( int t=0; t<GAMESTATE->GetCurrentStyleDef()->m_iColsPerPlayer; t++ )
{
if( m_bLayingAHold[t] )
{
bool bHoldingButton = false;
for( int p=0; p<NUM_PLAYERS; p++ )
bHoldingButton |= INPUTMAPPER->IsButtonDown( StyleInput(PlayerInput(p), t) );
if( bHoldingButton
}
}
*/
}
2002-05-20 08:59:37 +00:00
Screen::DrawPrimitives();
}
void ScreenEdit::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
//LOG->Trace( "ScreenEdit::Input()" );
2002-05-20 08:59:37 +00:00
2002-07-28 20:28:37 +00:00
switch( m_EditMode )
2002-05-20 08:59:37 +00:00
{
2002-07-28 20:28:37 +00:00
case MODE_EDITING: InputEdit( DeviceI, type, GameI, MenuI, StyleI ); break;
case MODE_RECORDING: InputRecord( DeviceI, type, GameI, MenuI, StyleI ); break;
case MODE_PLAYING: InputPlay( DeviceI, type, GameI, MenuI, StyleI ); break;
2002-05-20 08:59:37 +00:00
}
}
void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
///////////////////////////
// handle pad inputs
///////////////////////////
if( DeviceI.device == DEVICE_KEYBOARD )
{
switch( DeviceI.button )
{
case DIK_1:
case DIK_2:
case DIK_3:
case DIK_4:
case DIK_5:
case DIK_6:
case DIK_7:
case DIK_8:
case DIK_9:
2002-06-29 11:59:09 +00:00
case DIK_0:
2002-05-20 08:59:37 +00:00
{
2002-06-29 11:59:09 +00:00
if( type != IET_FIRST_PRESS )
break; // We only care about first presses
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
int iCol = DeviceI.button - DIK_1;
const float fSongBeat = GAMESTATE->m_fSongBeat;
const int iSongIndex = BeatToNoteRow( fSongBeat );
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
if( iCol >= m_NoteFieldEdit.m_iNumTracks ) // this button is not in the range of columns for this StyleDef
break;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
// check for to see if the user intended to remove a HoldNote
bool bRemovedAHoldNote = false;
for( int i=0; i<m_NoteFieldEdit.m_iNumHoldNotes; i++ ) // for each HoldNote
2002-05-20 08:59:37 +00:00
{
2002-06-29 11:59:09 +00:00
HoldNote &hn = m_NoteFieldEdit.m_HoldNotes[i];
if( iCol == hn.m_iTrack && // the notes correspond
fSongBeat >= hn.m_fStartBeat && fSongBeat <= hn.m_fEndBeat ) // the cursor lies within this HoldNote
2002-06-29 11:59:09 +00:00
{
m_NoteFieldEdit.RemoveHoldNote( i );
bRemovedAHoldNote = true;
break; // stop iterating over all HoldNotes
}
2002-05-20 08:59:37 +00:00
}
2002-06-29 11:59:09 +00:00
if( !bRemovedAHoldNote )
{
// We didn't remove a HoldNote, so the user wants to add or delete a TapNote
if( m_NoteFieldEdit.m_TapNotes[iCol][iSongIndex] == '0' )
m_NoteFieldEdit.m_TapNotes[iCol][iSongIndex] = '1';
2002-06-29 11:59:09 +00:00
else
m_NoteFieldEdit.m_TapNotes[iCol][iSongIndex] = '0';
2002-06-29 11:59:09 +00:00
}
2002-05-20 08:59:37 +00:00
}
break;
case DIK_ESCAPE:
SCREENMAN->SetNewScreen( new ScreenEditMenu );
break;
case DIK_S:
{
2002-06-29 11:59:09 +00:00
// copy edit into current Notes
2002-07-23 01:41:40 +00:00
Song* pSong = GAMESTATE->m_pCurSong;
Notes* pNotes = GAMESTATE->m_pCurNotes[PLAYER_1];
2002-06-29 11:59:09 +00:00
if( pNotes == NULL )
{
// allocate a new Notes
2002-07-11 19:02:26 +00:00
pNotes = new Notes;
pSong->m_apNotes.Add( pNotes );
2002-07-23 01:41:40 +00:00
pNotes->m_NotesType = GAMEMAN->GetStyleDefForStyle( GAMESTATE->m_CurStyle )->m_NotesType;
2002-06-29 11:59:09 +00:00
pNotes->m_sDescription = "Untitled";
pNotes->m_iMeter = 1;
}
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
pNotes->SetNoteData( (NoteData*)&m_NoteFieldEdit );
2002-07-23 01:41:40 +00:00
GAMESTATE->m_pCurSong->SaveToSMFile();
SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","edit save") );
2002-06-29 11:59:09 +00:00
}
2002-05-20 08:59:37 +00:00
break;
case DIK_UP:
case DIK_DOWN:
case DIK_PGUP:
case DIK_PGDN:
{
2002-06-29 11:59:09 +00:00
float fBeatsToMove;
switch( DeviceI.button )
{
case DIK_UP:
case DIK_DOWN:
fBeatsToMove = NoteTypeToBeat( m_SnapDisplay.GetSnapMode() );
2002-06-29 11:59:09 +00:00
if( DeviceI.button == DIK_UP )
fBeatsToMove *= -1;
break;
case DIK_PGUP:
case DIK_PGDN:
fBeatsToMove = BEATS_PER_MEASURE;
if( DeviceI.button == DIK_PGUP )
fBeatsToMove *= -1;
}
2002-05-20 08:59:37 +00:00
const float fStartBeat = GAMESTATE->m_fSongBeat;
const float fEndBeat = GAMESTATE->m_fSongBeat + fBeatsToMove;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
// check to see if they're holding a button
for( int col=0; col<m_NoteFieldEdit.m_iNumTracks && col<=10; col++ )
2002-05-20 08:59:37 +00:00
{
2002-06-29 11:59:09 +00:00
const DeviceInput di(DEVICE_KEYBOARD, DIK_1+col);
BOOL bIsBeingHeld = INPUTMAN->IsBeingPressed(di);
if( bIsBeingHeld )
{
// create a new hold note
HoldNote newHN;
newHN.m_iTrack = col;
newHN.m_fStartBeat = min(fStartBeat, fEndBeat);
newHN.m_fEndBeat = max(fStartBeat, fEndBeat);
2002-06-29 11:59:09 +00:00
m_NoteFieldEdit.AddHoldNote( newHN );
}
2002-05-20 08:59:37 +00:00
}
GAMESTATE->m_fSongBeat += fBeatsToMove;
GAMESTATE->m_fSongBeat = clamp( GAMESTATE->m_fSongBeat, 0, MAX_BEATS-1 );
GAMESTATE->m_fSongBeat = froundf( GAMESTATE->m_fSongBeat, NoteTypeToBeat(m_SnapDisplay.GetSnapMode()) );
2002-06-29 11:59:09 +00:00
m_soundChangeLine.Play();
2002-05-20 08:59:37 +00:00
}
break;
2002-06-29 11:59:09 +00:00
case DIK_HOME:
GAMESTATE->m_fSongBeat = 0;
2002-06-29 11:59:09 +00:00
m_soundChangeLine.Play();
break;
case DIK_END:
GAMESTATE->m_fSongBeat = m_NoteFieldEdit.GetLastBeat();
2002-06-29 11:59:09 +00:00
m_soundChangeLine.Play();
break;
2002-05-20 08:59:37 +00:00
case DIK_RIGHT:
m_SnapDisplay.PrevSnapMode();
2002-05-20 08:59:37 +00:00
OnSnapModeChange();
break;
case DIK_LEFT:
m_SnapDisplay.NextSnapMode();
2002-05-20 08:59:37 +00:00
OnSnapModeChange();
break;
2002-06-29 11:59:09 +00:00
case DIK_RETURN:
if( m_NoteFieldEdit.m_fEndMarker != -1 && GAMESTATE->m_fSongBeat > m_NoteFieldEdit.m_fEndMarker )
2002-05-20 08:59:37 +00:00
{
// invalid! The begin maker must be placed before the end marker
2002-06-29 11:59:09 +00:00
m_soundInvalid.Play();
2002-05-20 08:59:37 +00:00
}
else
{
m_NoteFieldEdit.m_fBeginMarker = GAMESTATE->m_fSongBeat;
2002-06-29 11:59:09 +00:00
m_soundMarker.Play();
2002-05-20 08:59:37 +00:00
}
break;
2002-06-29 11:59:09 +00:00
case DIK_SPACE:
if( m_NoteFieldEdit.m_fBeginMarker != -1 && GAMESTATE->m_fSongBeat < m_NoteFieldEdit.m_fBeginMarker )
2002-05-20 08:59:37 +00:00
{
// invalid! The end maker must be placed after the begin marker
2002-06-29 11:59:09 +00:00
m_soundInvalid.Play();
2002-05-20 08:59:37 +00:00
}
else
{
m_NoteFieldEdit.m_fEndMarker = GAMESTATE->m_fSongBeat;
2002-06-29 11:59:09 +00:00
m_soundMarker.Play();
2002-05-20 08:59:37 +00:00
}
break;
2002-06-29 11:59:09 +00:00
case DIK_G:
case DIK_H:
case DIK_J:
case DIK_K:
case DIK_L:
2002-05-20 08:59:37 +00:00
{
2002-06-29 11:59:09 +00:00
if( m_NoteFieldEdit.m_fBeginMarker == -1 || m_NoteFieldEdit.m_fEndMarker == -1 )
{
m_soundInvalid.Play();
}
else
{
NoteType noteType1;
NoteType noteType2;
switch( DeviceI.button )
{
case DIK_G: noteType1 = NOTE_4TH; noteType2 = NOTE_4TH; break;
case DIK_H: noteType1 = NOTE_8TH; noteType2 = NOTE_8TH; break;
case DIK_J: noteType1 = NOTE_12TH; noteType2 = NOTE_12TH; break;
case DIK_K: noteType1 = NOTE_16TH; noteType2 = NOTE_16TH; break;
case DIK_L: noteType1 = NOTE_12TH; noteType2 = NOTE_16TH; break;
default: ASSERT( false );
}
m_NoteFieldEdit.SnapToNearestNoteType( noteType1, noteType2, m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker );
}
2002-05-20 08:59:37 +00:00
}
2002-06-29 11:59:09 +00:00
break;
case DIK_P:
2002-05-20 08:59:37 +00:00
{
2002-06-29 11:59:09 +00:00
if( m_NoteFieldEdit.m_fBeginMarker == -1 || m_NoteFieldEdit.m_fEndMarker == -1 )
2002-05-20 08:59:37 +00:00
{
2002-06-29 11:59:09 +00:00
m_soundInvalid.Play();
break;
2002-05-20 08:59:37 +00:00
}
2002-07-28 20:28:37 +00:00
m_EditMode = MODE_PLAYING;
2002-06-29 11:59:09 +00:00
2002-07-28 20:28:37 +00:00
m_Player.Load( PLAYER_1, (NoteData*)&m_NoteFieldEdit, NULL, NULL );
2002-06-29 11:59:09 +00:00
m_rectRecordBack.BeginTweening( 0.5f );
m_rectRecordBack.SetTweenDiffuseColor( D3DXCOLOR(0,0,0,0.5f) );
GAMESTATE->m_fSongBeat = m_NoteFieldEdit.m_fBeginMarker;
float fElapsedSeconds = max( 0, m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) );
2002-06-29 11:59:09 +00:00
m_soundMusic.SetPositionSeconds( fElapsedSeconds );
m_soundMusic.Play();
m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate );
2002-05-20 08:59:37 +00:00
}
2002-06-29 11:59:09 +00:00
break;
case DIK_R:
{
if( m_NoteFieldEdit.m_fBeginMarker == -1 || m_NoteFieldEdit.m_fEndMarker == -1 )
{
m_soundInvalid.Play();
break;
}
// initialize m_NoteFieldRecord
m_NoteFieldRecord.ClearAll();
m_NoteFieldRecord.m_iNumTracks = m_NoteFieldEdit.m_iNumTracks;
m_NoteFieldRecord.m_fBeginMarker = m_NoteFieldEdit.m_fBeginMarker;
m_NoteFieldRecord.m_fEndMarker = m_NoteFieldEdit.m_fEndMarker;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
2002-07-28 20:28:37 +00:00
m_EditMode = MODE_RECORDING;
2002-06-29 11:59:09 +00:00
m_rectRecordBack.BeginTweening( 0.5f );
m_rectRecordBack.SetTweenDiffuseColor( D3DXCOLOR(0,0,0,0.5f) );
GAMESTATE->m_fSongBeat = m_NoteFieldEdit.m_fBeginMarker;
float fElapsedSeconds = max( 0, m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) );
2002-06-29 11:59:09 +00:00
m_soundMusic.SetPositionSeconds( fElapsedSeconds );
m_soundMusic.Play();
m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate );
for( int i=0; i<MAX_NOTE_TRACKS; i++ )
m_bLayingAHold[i] = false;
2002-05-20 08:59:37 +00:00
}
break;
2002-08-01 13:42:56 +00:00
case DIK_T:
if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.0f ) GAMESTATE->m_SongOptions.m_fMusicRate = 0.9f;
else if( GAMESTATE->m_SongOptions.m_fMusicRate == 0.9f ) GAMESTATE->m_SongOptions.m_fMusicRate = 0.8f;
else if( GAMESTATE->m_SongOptions.m_fMusicRate == 0.8f ) GAMESTATE->m_SongOptions.m_fMusicRate = 0.7f;
else if( GAMESTATE->m_SongOptions.m_fMusicRate == 0.7f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.5f;
else if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.5f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.4f;
else if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.4f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.3f;
else if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.3f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.2f;
else if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.2f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.1f;
else if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.1f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.0f;
2002-08-01 13:42:56 +00:00
break;
2002-06-29 11:59:09 +00:00
case DIK_INSERT:
case DIK_DELETE:
2002-05-20 08:59:37 +00:00
{
2002-06-29 11:59:09 +00:00
NoteData temp;
2002-07-02 00:27:58 +00:00
temp.m_iNumTracks = m_NoteFieldEdit.m_iNumTracks;
2002-06-29 11:59:09 +00:00
int iTakeFromRow;
int iPasteAtRow;
switch( DeviceI.button )
{
case DIK_INSERT:
iTakeFromRow = BeatToNoteRow( GAMESTATE->m_fSongBeat );
iPasteAtRow = BeatToNoteRow( GAMESTATE->m_fSongBeat+1 );
2002-06-29 11:59:09 +00:00
break;
case DIK_DELETE:
iTakeFromRow = BeatToNoteRow( GAMESTATE->m_fSongBeat+1 );
iPasteAtRow = BeatToNoteRow( GAMESTATE->m_fSongBeat );
2002-06-29 11:59:09 +00:00
break;
}
temp.CopyRange( &m_NoteFieldEdit, iTakeFromRow, MAX_TAP_NOTE_ROWS );
m_NoteFieldEdit.ClearRange( min(iTakeFromRow,iPasteAtRow), MAX_TAP_NOTE_ROWS );
m_NoteFieldEdit.CopyRange( &temp, 0, MAX_TAP_NOTE_ROWS-iTakeFromRow, iPasteAtRow );
}
break;
case DIK_X:
2002-05-20 08:59:37 +00:00
if( m_NoteFieldEdit.m_fBeginMarker == -1 || m_NoteFieldEdit.m_fEndMarker == -1 )
{
2002-06-29 11:59:09 +00:00
m_soundInvalid.Play();
2002-05-20 08:59:37 +00:00
}
2002-06-29 11:59:09 +00:00
else
{
int iFirstRow = BeatToNoteRow( m_NoteFieldEdit.m_fBeginMarker );
int iLastRow = BeatToNoteRow( m_NoteFieldEdit.m_fEndMarker );
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
m_Clipboard.CopyRange( &m_NoteFieldEdit, iFirstRow, iLastRow );
m_NoteFieldEdit.ClearRange( iFirstRow, iLastRow );
}
break;
case DIK_C:
if( m_NoteFieldEdit.m_fBeginMarker == -1 || m_NoteFieldEdit.m_fEndMarker == -1 )
{
m_soundInvalid.Play();
}
else
{
int iFirstRow = BeatToNoteRow( m_NoteFieldEdit.m_fBeginMarker );
int iLastRow = BeatToNoteRow( m_NoteFieldEdit.m_fEndMarker );
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
m_Clipboard.CopyRange( &m_NoteFieldEdit, iFirstRow, iLastRow );
}
break;
case DIK_V:
{
2002-07-02 00:27:58 +00:00
int iSrcFirstRow = 0;
int iSrcLastRow = BeatToNoteRow( m_Clipboard.GetLastBeat() );
int iDestFirstRow = BeatToNoteRow( GAMESTATE->m_fSongBeat );
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
m_NoteFieldEdit.CopyRange( &m_Clipboard, iSrcFirstRow, iSrcLastRow, iDestFirstRow );
2002-05-20 08:59:37 +00:00
}
break;
2002-06-29 11:59:09 +00:00
case DIK_D:
2002-05-20 08:59:37 +00:00
{
2002-07-02 00:27:58 +00:00
DifficultyClass &dc = m_pNotes->m_DifficultyClass;
dc = DifficultyClass( (dc+1)%NUM_DIFFICULTY_CLASSES );
2002-05-20 08:59:37 +00:00
}
2002-06-29 11:59:09 +00:00
break;
2002-05-20 08:59:37 +00:00
2002-07-02 00:27:58 +00:00
case DIK_F7:
case DIK_F8:
2002-06-29 11:59:09 +00:00
{
float fBPM = m_pSong->GetBPMAtBeat( GAMESTATE->m_fSongBeat );
2002-07-02 00:27:58 +00:00
float fDeltaBPM;
2002-06-29 11:59:09 +00:00
switch( DeviceI.button )
{
2002-07-11 19:02:26 +00:00
case DIK_F7: fDeltaBPM = - 0.020f; break;
case DIK_F8: fDeltaBPM = + 0.020f; break;
2002-06-29 11:59:09 +00:00
default: ASSERT(0);
}
2002-07-11 19:02:26 +00:00
switch( type )
{
case IET_SLOW_REPEAT: fDeltaBPM *= 10; break;
case IET_FAST_REPEAT: fDeltaBPM *= 40; break;
}
2002-07-02 00:27:58 +00:00
float fNewBPM = fBPM + fDeltaBPM;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
for( int i=0; i<m_pSong->m_BPMSegments.GetSize(); i++ )
if( m_pSong->m_BPMSegments[i].m_fStartBeat == GAMESTATE->m_fSongBeat )
2002-06-29 11:59:09 +00:00
break;
2002-05-20 08:59:37 +00:00
2002-06-29 11:59:09 +00:00
if( i == m_pSong->m_BPMSegments.GetSize() ) // there is no BPMSegment at the current beat
{
// create a new BPMSegment
m_pSong->AddBPMSegment( BPMSegment(GAMESTATE->m_fSongBeat, fNewBPM) );
2002-06-29 11:59:09 +00:00
}
else // BPMSegment being modified is m_BPMSegments[i]
{
2002-07-02 00:27:58 +00:00
if( i > 0 && fabsf(m_pSong->m_BPMSegments[i-1].m_fBPM - fNewBPM) < 0.025f )
2002-06-29 11:59:09 +00:00
m_pSong->m_BPMSegments.RemoveAt( i );
else
m_pSong->m_BPMSegments[i].m_fBPM = fNewBPM;
}
}
break;
2002-07-02 00:27:58 +00:00
case DIK_F9:
case DIK_F10:
2002-06-29 11:59:09 +00:00
{
float fFreezeDelta;
switch( DeviceI.button )
{
2002-07-11 19:02:26 +00:00
case DIK_F9: fFreezeDelta = -0.020f; break;
case DIK_F10: fFreezeDelta = +0.020f; break;
2002-06-29 11:59:09 +00:00
default: ASSERT(0);
}
2002-07-11 19:02:26 +00:00
switch( type )
{
case IET_SLOW_REPEAT: fFreezeDelta *= 10; break;
case IET_FAST_REPEAT: fFreezeDelta *= 40; break;
}
2002-05-20 08:59:37 +00:00
2002-07-11 19:02:26 +00:00
for( int i=0; i<m_pSong->m_StopSegments.GetSize(); i++ )
2002-06-29 11:59:09 +00:00
{
if( m_pSong->m_StopSegments[i].m_fStartBeat == GAMESTATE->m_fSongBeat )
2002-06-29 11:59:09 +00:00
break;
}
2002-05-20 08:59:37 +00:00
2002-07-11 19:02:26 +00:00
if( i == m_pSong->m_StopSegments.GetSize() ) // there is no BPMSegment at the current beat
2002-06-29 11:59:09 +00:00
{
2002-07-11 19:02:26 +00:00
// create a new StopSegment
2002-06-29 11:59:09 +00:00
if( fFreezeDelta > 0 )
m_pSong->AddStopSegment( StopSegment(GAMESTATE->m_fSongBeat, fFreezeDelta) );
2002-06-29 11:59:09 +00:00
}
2002-07-11 19:02:26 +00:00
else // StopSegment being modified is m_StopSegments[i]
2002-06-29 11:59:09 +00:00
{
2002-07-11 19:02:26 +00:00
m_pSong->m_StopSegments[i].m_fStopSeconds += fFreezeDelta;
if( m_pSong->m_StopSegments[i].m_fStopSeconds <= 0 )
m_pSong->m_StopSegments.RemoveAt( i );
2002-06-29 11:59:09 +00:00
}
}
2002-05-20 08:59:37 +00:00
break;
2002-07-02 00:27:58 +00:00
case DIK_F11:
case DIK_F12:
{
float fOffsetDelta;
switch( DeviceI.button )
{
2002-07-11 19:02:26 +00:00
case DIK_F11: fOffsetDelta = -0.020f; break;
case DIK_F12: fOffsetDelta = +0.020f; break;
2002-07-02 00:27:58 +00:00
default: ASSERT(0);
}
2002-07-11 19:02:26 +00:00
switch( type )
{
case IET_SLOW_REPEAT: fOffsetDelta *= 10; break;
case IET_FAST_REPEAT: fOffsetDelta *= 40; break;
}
2002-07-02 00:27:58 +00:00
2002-07-03 21:27:26 +00:00
m_pSong->m_fBeat0OffsetInSeconds += fOffsetDelta;
2002-07-02 00:27:58 +00:00
}
break;
2002-06-29 11:59:09 +00:00
case DIK_M:
MUSIC->Load( m_pSong->GetMusicPath() );
MUSIC->Play( false, m_pSong->m_fMusicSampleStartSeconds, m_pSong->m_fMusicSampleLengthSeconds );
break;
2002-07-02 00:27:58 +00:00
case DIK_F1:
case DIK_F2:
{
float fOffsetDelta;
switch( DeviceI.button )
{
case DIK_F1: fOffsetDelta = -0.025f; break;
case DIK_F2: fOffsetDelta = +0.025f; break;
default: ASSERT(0);
}
2002-07-11 19:02:26 +00:00
switch( type )
{
case IET_SLOW_REPEAT: fOffsetDelta *= 10; break;
case IET_FAST_REPEAT: fOffsetDelta *= 40; break;
}
2002-06-29 11:59:09 +00:00
2002-07-02 00:27:58 +00:00
m_pSong->m_fMusicSampleStartSeconds += fOffsetDelta;
}
break;
case DIK_SUBTRACT:
case DIK_ADD:
{
float fDelta;
switch( DeviceI.button )
{
case DIK_SUBTRACT: fDelta = -0.025f; break;
case DIK_ADD: fDelta = +0.025f; break;
default: ASSERT(0);
}
2002-07-11 19:02:26 +00:00
switch( type )
{
case IET_SLOW_REPEAT: fDelta *= 10; break;
case IET_FAST_REPEAT: fDelta *= 40; break;
}
2002-07-02 00:27:58 +00:00
m_pSong->m_fMusicSampleLengthSeconds += fDelta;
}
break;
}
2002-05-20 08:59:37 +00:00
}
}
void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
if( DeviceI.device == DEVICE_KEYBOARD )
{
switch( DeviceI.button )
{
case DIK_ESCAPE:
TransitionToEditFromRecord();
break;
}
}
switch( StyleI.player )
{
case PLAYER_1:
int iCol;
iCol = StyleI.col;
int iNoteIndex;
iNoteIndex = BeatToNoteRow( GAMESTATE->m_fSongBeat );
2002-05-20 08:59:37 +00:00
if( type == IET_FIRST_PRESS )
{
m_NoteFieldRecord.m_TapNotes[iCol][iNoteIndex] = '1';
m_NoteFieldRecord.SnapToNearestNoteType( NOTE_12TH, NOTE_16TH, max(0,GAMESTATE->m_fSongBeat-1), GAMESTATE->m_fSongBeat+1);
2002-05-20 08:59:37 +00:00
m_GrayArrowRowRecord.Step( iCol );
}
else
{
const float fHoldEndSeconds = m_soundMusic.GetPositionSeconds();
const float fHoldStartSeconds = m_soundMusic.GetPositionSeconds() - TIME_BEFORE_SLOW_REPEATS * m_soundMusic.GetPlaybackRate();
float fStartBeat, fEndBeat, fThrowAway;
2002-06-30 23:19:33 +00:00
bool bFreeze;
m_pSong->GetBeatAndBPSFromElapsedTime( fHoldStartSeconds, fStartBeat, fThrowAway, bFreeze );
m_pSong->GetBeatAndBPSFromElapsedTime( fHoldEndSeconds, fEndBeat, fThrowAway, bFreeze );
2002-05-20 08:59:37 +00:00
// create a new hold note
HoldNote newHN;
newHN.m_iTrack = iCol;
newHN.m_fStartBeat = fStartBeat;
newHN.m_fEndBeat = fEndBeat;
2002-05-20 08:59:37 +00:00
m_NoteFieldRecord.AddHoldNote( newHN );
m_NoteFieldRecord.SnapToNearestNoteType( NOTE_12TH, NOTE_16TH, max(0,GAMESTATE->m_fSongBeat-2), GAMESTATE->m_fSongBeat+2);
2002-05-20 08:59:37 +00:00
}
break;
}
}
void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
if( type != IET_FIRST_PRESS )
return;
if( DeviceI.device == DEVICE_KEYBOARD )
{
switch( DeviceI.button )
{
case DIK_ESCAPE:
2002-07-28 20:28:37 +00:00
m_EditMode = MODE_EDITING;
2002-05-20 08:59:37 +00:00
m_soundMusic.Stop();
GAMESTATE->m_fSongBeat = froundf( GAMESTATE->m_fSongBeat, NoteTypeToBeat(m_SnapDisplay.GetSnapMode()) );
2002-05-20 08:59:37 +00:00
break;
}
}
switch( StyleI.player )
{
case PLAYER_1:
2002-07-28 20:28:37 +00:00
m_Player.Step( StyleI.col );
2002-05-20 08:59:37 +00:00
return;
}
}
void ScreenEdit::TransitionToEditFromRecord()
{
2002-07-28 20:28:37 +00:00
m_EditMode = MODE_EDITING;
2002-05-20 08:59:37 +00:00
m_soundMusic.Stop();
int iNoteIndexBegin = BeatToNoteRow( m_NoteFieldEdit.m_fBeginMarker );
int iNoteIndexEnd = BeatToNoteRow( m_NoteFieldEdit.m_fEndMarker );
// delete old TapNotes in the range
m_NoteFieldEdit.ClearRange( iNoteIndexBegin, iNoteIndexEnd );
m_NoteFieldEdit.CopyRange( (NoteData*)&m_NoteFieldRecord, iNoteIndexBegin, iNoteIndexEnd, iNoteIndexBegin );
2002-05-20 08:59:37 +00:00
GAMESTATE->m_fSongBeat = froundf( GAMESTATE->m_fSongBeat, NoteTypeToBeat(m_SnapDisplay.GetSnapMode()) );
2002-05-20 08:59:37 +00:00
}
void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
case SM_GoToPrevState:
SCREENMAN->SetNewScreen( new ScreenEditMenu );
break;
case SM_GoToNextState:
SCREENMAN->SetNewScreen( new ScreenEditMenu );
break;
}
}
void ScreenEdit::OnSnapModeChange()
{
2002-06-29 11:59:09 +00:00
m_soundChangeSnap.Play();
2002-05-20 08:59:37 +00:00
NoteType nt = m_SnapDisplay.GetSnapMode();
int iStepIndex = BeatToNoteRow( GAMESTATE->m_fSongBeat );
2002-05-20 08:59:37 +00:00
int iElementsPerNoteType = BeatToNoteRow( NoteTypeToBeat(nt) );
int iStepIndexHangover = iStepIndex % iElementsPerNoteType;
GAMESTATE->m_fSongBeat -= NoteRowToBeat( iStepIndexHangover );
2002-05-20 08:59:37 +00:00
}