Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ScreenEdit.h

Go to the documentation of this file.
00001 /* ScreenEdit - Edit, record, playback, and synchronize notes. */ 00002 00003 #ifndef SCREEN_EDIT_H 00004 #define SCREEN_EDIT_H 00005 00006 #include "Screen.h" 00007 #include "Sprite.h" 00008 #include "Transition.h" 00009 #include "BitmapText.h" 00010 #include "Player.h" 00011 #include "RageSound.h" 00012 #include "SnapDisplay.h" 00013 #include "Background.h" 00014 #include "Foreground.h" 00015 #include "Course.h" 00016 #include "NoteField.h" 00017 00018 const int NUM_ACTION_MENU_ITEMS = 23; 00019 const int NUM_NAMING_MENU_ITEMS = 6; 00020 00021 enum EditButton 00022 { 00023 EDIT_BUTTON_COLUMN_0, 00024 EDIT_BUTTON_COLUMN_1, 00025 EDIT_BUTTON_COLUMN_2, 00026 EDIT_BUTTON_COLUMN_3, 00027 EDIT_BUTTON_COLUMN_4, 00028 EDIT_BUTTON_COLUMN_5, 00029 EDIT_BUTTON_COLUMN_6, 00030 EDIT_BUTTON_COLUMN_7, 00031 EDIT_BUTTON_COLUMN_8, 00032 EDIT_BUTTON_COLUMN_9, 00033 00034 /* These are modifiers to EDIT_BUTTON_COLUMN_*. */ 00035 EDIT_BUTTON_RIGHT_SIDE, 00036 EDIT_BUTTON_LAY_MINE, 00037 EDIT_BUTTON_LAY_ATTACK, 00038 00039 EDIT_BUTTON_SCROLL_UP_LINE, 00040 EDIT_BUTTON_SCROLL_UP_PAGE, 00041 EDIT_BUTTON_SCROLL_DOWN_LINE, 00042 EDIT_BUTTON_SCROLL_DOWN_PAGE, 00043 EDIT_BUTTON_SCROLL_HOME, 00044 EDIT_BUTTON_SCROLL_END, 00045 00046 /* These are modifiers to EDIT_BUTTON_SCROLL_*. */ 00047 EDIT_BUTTON_SCROLL_SELECT, 00048 00049 EDIT_BUTTON_LAY_SELECT, 00050 00051 EDIT_BUTTON_SCROLL_SPEED_UP, 00052 EDIT_BUTTON_SCROLL_SPEED_DOWN, 00053 00054 EDIT_BUTTON_SNAP_NEXT, 00055 EDIT_BUTTON_SNAP_PREV, 00056 00057 EDIT_BUTTON_OPEN_EDIT_MENU, 00058 EDIT_BUTTON_OPEN_AREA_MENU, 00059 EDIT_BUTTON_OPEN_BGA_MENU, 00060 EDIT_BUTTON_OPEN_COURSE_MENU, 00061 EDIT_BUTTON_OPEN_INPUT_HELP, 00062 00063 EDIT_BUTTON_PLAY_FROM_START, 00064 EDIT_BUTTON_PLAY_FROM_CURSOR, 00065 EDIT_BUTTON_PLAY_SELECTION, 00066 EDIT_BUTTON_RECORD, 00067 00068 EDIT_BUTTON_RETURN_TO_EDIT, 00069 00070 EDIT_BUTTON_INSERT, 00071 EDIT_BUTTON_DELETE, 00072 EDIT_BUTTON_INSERT_SHIFT_PAUSES, 00073 EDIT_BUTTON_DELETE_SHIFT_PAUSES, 00074 00075 EDIT_BUTTON_OPEN_NEXT_STEPS, 00076 EDIT_BUTTON_OPEN_PREV_STEPS, 00077 EDIT_BUTTON_TOGGLE_ASSIST_TICK, 00078 EDIT_BUTTON_TOGGLE_AUTOPLAY, 00079 EDIT_BUTTON_PLAY_SAMPLE_MUSIC, 00080 00081 EDIT_BUTTON_BPM_UP, 00082 EDIT_BUTTON_BPM_DOWN, 00083 EDIT_BUTTON_STOP_UP, 00084 EDIT_BUTTON_STOP_DOWN, 00085 EDIT_BUTTON_OFFSET_UP, 00086 EDIT_BUTTON_OFFSET_DOWN, 00087 EDIT_BUTTON_SAMPLE_START_UP, 00088 EDIT_BUTTON_SAMPLE_START_DOWN, 00089 EDIT_BUTTON_SAMPLE_LENGTH_UP, 00090 EDIT_BUTTON_SAMPLE_LENGTH_DOWN, 00091 00092 /* This modifies offset, BPM, and stop segment changes. */ 00093 EDIT_BUTTON_ADJUST_FINE, 00094 00095 NUM_EDIT_BUTTONS, // leave this at the end 00096 EDIT_BUTTON_INVALID 00097 }; 00098 #define FOREACH_EditButton( e ) FOREACH_ENUM( EditButton, NUM_EDIT_BUTTONS, e ) 00099 #define NUM_EDIT_TO_DEVICE_SLOTS 2 00100 00101 /* 00102 * g_MapEditToDI is a simple mapping: edit functions map to DeviceInputs. 00103 * If g_MapEditToDIHold for a given edit function is valid, then at least one 00104 * input in g_MapEditToDIHold must be held when pressing any key in g_MapEditToDI 00105 * for the input to occur. 00106 */ 00107 struct MapEditToDI 00108 { 00109 DeviceInput button[NUM_EDIT_BUTTONS][NUM_EDIT_TO_DEVICE_SLOTS]; 00110 DeviceInput hold[NUM_EDIT_BUTTONS][NUM_EDIT_TO_DEVICE_SLOTS]; 00111 void Clear() 00112 { 00113 FOREACH_EditButton(e) 00114 for( int slot = 0; slot < NUM_EDIT_TO_DEVICE_SLOTS; ++slot ) 00115 { 00116 button[e][slot].MakeInvalid(); 00117 hold[e][slot].MakeInvalid(); 00118 } 00119 } 00120 }; 00121 00122 class ScreenEdit : public Screen 00123 { 00124 public: 00125 ScreenEdit( CString sName ); 00126 virtual ~ScreenEdit(); 00127 virtual void Update( float fDeltaTime ); 00128 virtual void DrawPrimitives(); 00129 virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); 00130 void InputEdit( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB ); 00131 void InputRecord( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB ); 00132 void InputPlay( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, EditButton EditB ); 00133 virtual void HandleScreenMessage( const ScreenMessage SM ); 00134 00135 protected: 00136 void TransitionFromRecordToEdit(); 00137 void TransitionToEdit(); 00138 void PlayTicks(); 00139 void PlayPreviewMusic(); 00140 void UpdateTextInfo(); 00141 00142 void OnSnapModeChange(); 00143 void MenuItemGainFocus( BitmapText* menuitem ); 00144 void MenuItemLoseFocus( BitmapText* menuitem ); 00145 00146 00147 enum EditMode { MODE_EDITING, MODE_RECORDING, MODE_PLAYING }; 00148 EditMode m_EditMode; 00149 00150 Song* m_pSong; 00151 Steps* m_pSteps; 00152 00153 NoteField m_NoteFieldEdit; 00154 NoteData m_NoteDataEdit; 00155 SnapDisplay m_SnapDisplay; 00156 00157 AutoActor m_sprOverlay; 00158 BitmapText m_textHelp; 00159 BitmapText m_textInfo; // status information that changes 00160 00161 // keep track of where we are and what we're doing 00162 float m_fTrailingBeat; // this approaches GAMESTATE->m_fSongBeat, which is the actual beat 00163 /* The location we were at when shift was pressed, or 00164 * -1 when shift isn't pressed: */ 00165 int g_iShiftAnchor; 00166 00167 NoteData m_Clipboard; 00168 00169 RageSound m_soundChangeLine; 00170 RageSound m_soundChangeSnap; 00171 RageSound m_soundMarker; 00172 00173 Transition m_In; 00174 Transition m_Out; 00175 00176 00177 // for MODE_RECORD 00178 00179 NoteField m_NoteFieldRecord; 00180 NoteData m_NoteDataRecord; 00181 00182 // for MODE_PLAY 00183 void SetupCourseAttacks(); 00184 Player m_Player; 00185 Background m_Background; 00186 Foreground m_Foreground; 00187 Course *m_pAttacksFromCourse; 00188 00189 // for MODE_RECORD and MODE_PLAY 00190 00191 Quad m_rectRecordBack; 00192 RageSound m_soundMusic; 00193 00194 RageSound m_soundAssistTick; 00195 00196 00197 public: 00198 enum MainMenuChoice { 00199 edit_notes_statistics, 00200 play_whole_song, 00201 play_current_beat_to_end, 00202 save, 00203 reload, 00204 player_options, 00205 song_options, 00206 edit_song_info, 00207 edit_bpm, 00208 edit_stop, 00209 edit_bg_change, 00210 play_preview_music, 00211 preferences, 00212 exit, 00213 NUM_MAIN_MENU_CHOICES 00214 }; 00215 void HandleMainMenuChoice( MainMenuChoice c, int* iAnswers ); 00216 00217 enum AreaMenuChoice { 00218 cut, 00219 copy, 00220 paste_at_current_beat, 00221 paste_at_begin_marker, 00222 clear, 00223 quantize, 00224 turn, 00225 transform, 00226 alter, 00227 tempo, 00228 play, 00229 record, 00230 insert_and_shift, 00231 delete_and_shift, 00232 shift_pauses_forward, 00233 shift_pauses_backward, 00234 convert_beat_to_pause, 00235 convert_pause_to_beat, 00236 NUM_AREA_MENU_CHOICES 00237 }; 00238 void HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers ); 00239 enum TurnType { left, right, mirror, shuffle, super_shuffle, NUM_TURN_TYPES }; 00240 enum TransformType { noholds, nomines, little, wide, big, quick, bmrize, skippy, mines, echo, stomp, planted, floored, twister, nojumps, nohands, noquads, NUM_TRANSFORM_TYPES }; 00241 enum AlterType { backwards, swap_sides, copy_left_to_right, copy_right_to_left, clear_left, clear_right, collapse_to_one, collapse_left, shift_left, shift_right, NUM_ALTER_TYPES }; 00242 enum TempoType { compress_2x, compress_3_2, compress_4_3, expand_4_3, expand_3_2, expand_2x, NUM_TEMPO_TYPES }; 00243 00244 enum EditNotesStatisticsChoice { 00245 difficulty, 00246 meter, 00247 description, 00248 predict_meter, 00249 tap_notes, 00250 hold_notes, 00251 stream, 00252 voltage, 00253 air, 00254 freeze, 00255 chaos, 00256 NUM_EDIT_NOTES_STATISTICS_CHOICES 00257 }; 00258 void HandleEditNotesStatisticsChoice( EditNotesStatisticsChoice c, int* iAnswers ); 00259 00260 enum EditSongInfoChoice { 00261 main_title, 00262 sub_title, 00263 artist, 00264 credit, 00265 main_title_transliteration, 00266 sub_title_transliteration, 00267 artist_transliteration, 00268 NUM_EDIT_SONG_INFO_CHOICES 00269 }; 00270 void HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers ); 00271 00272 enum BGChangeChoice { 00273 rate, 00274 fade_last, 00275 rewind_movie, 00276 loop, 00277 add_random, 00278 add_song_bganimation, 00279 add_song_movie, 00280 add_song_still, 00281 add_global_random_movie, 00282 add_global_bganimation, 00283 add_global_visualization, 00284 delete_change, 00285 NUM_BGCHANGE_CHOICES 00286 }; 00287 00288 enum PrefsChoice { 00289 pref_show_bgs_play, 00290 NUM_PREFS_CHOICES 00291 }; 00292 void HandleBGChangeChoice( BGChangeChoice c, int* iAnswers ); 00293 00294 void InitEditMappings(); 00295 bool DeviceToEdit( DeviceInput DeviceI, EditButton &button ) const; 00296 bool EditToDevice( EditButton button, int iSlotNum, DeviceInput &DeviceI ) const; 00297 bool EditPressed( EditButton button, const DeviceInput &DeviceI ); 00298 bool EditIsBeingPressed( EditButton button ) const; 00299 const MapEditToDI *GetCurrentMap() const; 00300 MapEditToDI g_EditMappings, g_PlayMappings, g_RecordMappings; 00301 }; 00302 00303 #endif 00304 00305 /* 00306 * (c) 2001-2004 Chris Danford 00307 * All rights reserved. 00308 * 00309 * Permission is hereby granted, free of charge, to any person obtaining a 00310 * copy of this software and associated documentation files (the 00311 * "Software"), to deal in the Software without restriction, including 00312 * without limitation the rights to use, copy, modify, merge, publish, 00313 * distribute, and/or sell copies of the Software, and to permit persons to 00314 * whom the Software is furnished to do so, provided that the above 00315 * copyright notice(s) and this permission notice appear in all copies of 00316 * the Software and that both the above copyright notice(s) and this 00317 * permission notice appear in supporting documentation. 00318 * 00319 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00320 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00321 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00322 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00323 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00324 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00325 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00326 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00327 * PERFORMANCE OF THIS SOFTWARE. 00328 */

Generated on Thu Jan 27 20:57:31 2005 for StepMania by doxygen 1.3.7