Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/stepmania/stepmania
Browse files Browse the repository at this point in the history
  • Loading branch information
Midiman committed Jan 30, 2016
2 parents 6fe50c3 + cfca85c commit 2f9b248
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 41 deletions.
4 changes: 4 additions & 0 deletions Docs/Changelog_language.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Example:
This means that three strings were added to the "ScreenDebugOverlay" section,
"Mute actions", "Mute actions on", and "Mute actions off".

2016/01/18
----------
* [ScreenEdit] Clear timing in region

2015/10/02
----------
* [ScreenEdit] save_success_no_sm_split_timing
Expand Down
40 changes: 40 additions & 0 deletions Docs/Changelog_sm5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,41 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes
from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt.
________________________________________________________________________________

2016/01/18
----------
* [Edit Mode] Added "Clear timing in region" to timing menu. [kyzentun]
Fixed crash that occurs when "Paste timing data" is used after copying a
region of timing data that only contains stops. [kyzentun]

2016/01/14
----------
* [Gameplay] Added pause menu to default theme. Activated by pressing
Select, or Back twice without pressing something else. Has options for
restarting or forfeiting the current song in normal play. Course mode has
options for skipping the current song or ending the course or forfeiting.
[kyzentun]
* [Graphics] When fetching the list of resolutions, only 32bpp modes are
tested because less than 32bpp is not supported on Windows 8 and newer, and
because the bpp doesn't matter when fetching a list of resolutions. This
speeds up the load time of the Graphics/Sound option screen. [kyzentun]

2016/01/10
----------
* [RageFile] Lua functions for RageFile should now emit an error when the
file was not opened correctly instead of crashing. [kyzentun]

2016/01/05
----------
* [Linux] Disable DPMS on startup and restore setting on exit. [kyzentun]

2015/12/27
----------
* [RageFileManager] Ignore OS X special files in GetDirListing. [kyzentun]

2015/12/20
----------
* [Fonts] Fixed crash bug in Texture Font Generator. [drewbarbs]

2015/12/16
----------
* [Player] ChangeLife and SetLife functions added. [kyzentun]
Expand Down Expand Up @@ -31,6 +66,11 @@ ________________________________________________________________________________
* [ScreenSelectMusic] Using lua music files for the section music and similar
things works now. [kyzentun]

2015/11/05
----------
* [PlayerOptions] Fixed bug that was clearing the noteskin back to default.
[kyzentun]

================================================================================
StepMania 5.0.10 | 20151031
--------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ Clear Machine Stats=Clear Machine Scores
Clear USB edits=Clear USB edits
Clear area=Clear area
Clear clipboard=Clear clipboard
Clear timing in region=Clear timing in region
CoinMode=Coin Mode
CoinModeNoHome=Coin Mode
CoinsPerCredit=Coins Per Credit
Expand Down
49 changes: 35 additions & 14 deletions Themes/default/Graphics/pause_menu.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
gameplay_pause_count= 0
course_stopped_by_pause_menu= false

local pause_buttons= {Start= true, Select= true, Back= true}
local pause_buttons= {Start= false, Select= true, Back= true}
local pause_double_tap_time= 1
local tap_debounce_time= .1
local pause_press_times= {}
Expand Down Expand Up @@ -155,42 +155,63 @@ menu_actions.MenuRight= menu_actions.Right
menu_actions.MenuUp= menu_actions.Up
menu_actions.MenuDown= menu_actions.Down

local down_status= {}

local function detect_lr_press()
return down_status.MenuLeft and down_status.MenuRight
end

local function pause_and_show(pn)
gameplay_pause_count= gameplay_pause_count + 1
screen_gameplay:PauseGame(true)
local fg= screen_gameplay:GetChild("SongForeground")
if fg then
old_fg_visible= fg:GetVisible()
fg:visible(false)
end
local prompt_text= screen_gameplay:GetChild("Debug")
if prompt_text then
prompt_text:playcommand("TweenOff")
end
show_menu(pn)
end

local function input(event)
local pn= event.PlayerNumber
if not enabled_players[pn] then return end
local button= event.GameButton
if not button then return end
if event.type == "InputEventType_Release" then return end
if event.type == "InputEventType_Release" then
down_status[event.button]= false
return
end
down_status[event.button]= true
if screen_gameplay:GetName() == "ScreenGameplaySyncMachine" then return end
local is_paused= screen_gameplay:IsPaused()
if is_paused then
if menu_is_showing[pn] then
if menu_actions[button] then
menu_actions[button](pn)
return true
return
end
else
if pause_buttons[button] then
if pause_buttons[button] or detect_lr_press() then
show_menu(pn)
return true
return
end
end
else
button= event.button
if event.type ~= "InputEventType_FirstPress" then return end
if pause_buttons[button] then
if detect_lr_press() then
pause_and_show(pn)
elseif pause_buttons[button] then
if GAMESTATE:GetCoinMode() == "CoinMode_Pay" then return end
if pause_press_times[pn] then
local time_since_press= GetTimeSinceStart() - pause_press_times[pn]
if time_since_press > tap_debounce_time then
if time_since_press <= pause_double_tap_time then
gameplay_pause_count= gameplay_pause_count + 1
screen_gameplay:PauseGame(true)
local fg= screen_gameplay:GetChild("SongForeground")
if fg then
old_fg_visible= fg:GetVisible()
fg:visible(false)
end
show_menu(pn)
pause_and_show(pn)
else
pause_press_times[pn]= GetTimeSinceStart()
end
Expand Down
14 changes: 1 addition & 13 deletions src/RageFileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,7 @@ void RageFileManager::GetDirListing( const RString &sPath_, vector<RString> &Add

// Remove files that start with ._ from the list because these are special
// OS X files that cause interference on other platforms. -Kyz
for(size_t i= iOldSize; i < AddTo.size(); ++i)
{
size_t last_slash= AddTo[i].rfind('/');
last_slash= (last_slash == string::npos) ? 0 : (last_slash+1);
if(last_slash < AddTo[i].size() - 1)
{
if(AddTo[i][last_slash] == '.' && AddTo[i][last_slash+1] == '_')
{
AddTo.erase(AddTo.begin() + i);
--i;
}
}
}
StripMacResourceForks(AddTo);

if( iDriversThatReturnedFiles > 1 )
{
Expand Down
47 changes: 34 additions & 13 deletions src/ScreenEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,15 @@ static MenuDef g_SongInformation(
true, EditMode_Full, true, true, 0, NULL )
);


// Ugh, I don't like making this global pointer to clipboardFullTiming, but
// it's the only way to make it visible to EnabledIfClipboardTimingIsSafe for
// making sure it's safe to paste as the timing data for the Steps/Song. -Kyz
static TimingData* clipboard_full_timing= NULL;
static bool EnabledIfClipboardTimingIsSafe();
static bool EnabledIfClipboardTimingIsSafe()
{
return clipboard_full_timing != NULL && clipboard_full_timing->IsSafeFullTiming();
}
static MenuDef g_TimingDataInformation(
"ScreenMiniMenuTimingDataInformation",
MenuRowDef(ScreenEdit::beat_0_offset,
Expand Down Expand Up @@ -1102,6 +1110,9 @@ static MenuDef g_TimingDataInformation(
MenuRowDef(ScreenEdit::copy_timing_in_region,
"Copy timing in region",
true, EditMode_Full, true, true, 0, NULL),
MenuRowDef(ScreenEdit::clear_timing_in_region,
"Clear timing in region",
true, EditMode_Full, true, true, 0, NULL),
MenuRowDef(ScreenEdit::paste_timing_from_clip,
"Paste timing from clipboard",
true, EditMode_Full, true, true, 0, NULL),
Expand All @@ -1110,7 +1121,7 @@ static MenuDef g_TimingDataInformation(
true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef(ScreenEdit::paste_full_timing,
"Paste timing data",
true, EditMode_Full, true, true, 0, NULL ),
EnabledIfClipboardTimingIsSafe, EditMode_Full, true, true, 0, NULL ),
MenuRowDef(ScreenEdit::erase_step_timing,
"Erase step timing",
true, EditMode_Full, true, true, 0, NULL )
Expand Down Expand Up @@ -1502,6 +1513,7 @@ void ScreenEdit::Init()
m_Clipboard.SetNumTracks( m_NoteDataEdit.GetNumTracks() );

clipboardFullTiming = GAMESTATE->m_pCurSong->m_SongTiming; // always have a backup.
clipboard_full_timing= &clipboardFullTiming;

m_bHasUndo = false;
m_Undo.SetNumTracks( m_NoteDataEdit.GetNumTracks() );
Expand Down Expand Up @@ -5877,17 +5889,21 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
break;
}
case shift_timing_in_region_down:
m_timing_is_being_copied= false;
m_timing_change_menu_purpose= menu_is_for_shifting;
m_timing_rows_being_shitted= GetRowsFromAnswers(c, iAnswers);
DisplayTimingChangeMenu();
break;
case shift_timing_in_region_up:
m_timing_is_being_copied= false;
m_timing_change_menu_purpose= menu_is_for_shifting;
m_timing_rows_being_shitted= -GetRowsFromAnswers(c, iAnswers);
DisplayTimingChangeMenu();
break;
case copy_timing_in_region:
m_timing_is_being_copied= true;
m_timing_change_menu_purpose= menu_is_for_copying;
DisplayTimingChangeMenu();
break;
case clear_timing_in_region:
m_timing_change_menu_purpose= menu_is_for_clearing;
DisplayTimingChangeMenu();
break;
case paste_timing_from_clip:
Expand All @@ -5900,7 +5916,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
}
case paste_full_timing:
{
if (GAMESTATE->m_bIsUsingStepTiming)
if(GAMESTATE->m_bIsUsingStepTiming)
{
GAMESTATE->m_pCurSteps[PLAYER_1]->m_Timing = clipboardFullTiming;
}
Expand Down Expand Up @@ -5972,14 +5988,19 @@ void ScreenEdit::HandleTimingDataChangeChoice(TimingDataChangeChoice choice,
{
end= MAX_NOTE_ROW;
}
if(m_timing_is_being_copied)
switch(m_timing_change_menu_purpose)
{
clipboardFullTiming.Clear();
GetAppropriateTiming().CopyRange(begin, end, change_type, 0, clipboardFullTiming);
}
else
{
GetAppropriateTimingForUpdate().ShiftRange(begin, end, change_type, m_timing_rows_being_shitted);
case menu_is_for_copying:
clipboardFullTiming.Clear();
GetAppropriateTiming().CopyRange(begin, end, change_type, 0, clipboardFullTiming);
break;
case menu_is_for_shifting:
GetAppropriateTimingForUpdate().ShiftRange(begin, end, change_type, m_timing_rows_being_shitted);
break;
case menu_is_for_clearing:
GetAppropriateTimingForUpdate().ClearRange(begin, end, change_type);
break;
default: break;
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/ScreenEdit.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,13 @@ class ScreenEdit : public ScreenWithMenuElements
/** @brief Display the TimingData menu for editing song and step timing. */
void DisplayTimingMenu();

bool m_timing_is_being_copied; // Instead of being shifted.
enum TimingChangeMenuPurpose
{
menu_is_for_copying,
menu_is_for_shifting,
menu_is_for_clearing
};
TimingChangeMenuPurpose m_timing_change_menu_purpose;
int m_timing_rows_being_shitted; // How far the timing is being shitted.
void DisplayTimingChangeMenu();

Expand Down Expand Up @@ -610,6 +616,7 @@ class ScreenEdit : public ScreenWithMenuElements
shift_timing_in_region_down,
shift_timing_in_region_up,
copy_timing_in_region,
clear_timing_in_region,
paste_timing_from_clip,
copy_full_timing,
paste_full_timing,
Expand Down
50 changes: 50 additions & 0 deletions src/TimingData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,30 @@ void TimingData::Clear()
}
}

bool TimingData::IsSafeFullTiming()
{
static vector<TimingSegmentType> needed_segments;
if(needed_segments.empty())
{
needed_segments.push_back(SEGMENT_BPM);
needed_segments.push_back(SEGMENT_TIME_SIG);
needed_segments.push_back(SEGMENT_TICKCOUNT);
needed_segments.push_back(SEGMENT_COMBO);
needed_segments.push_back(SEGMENT_LABEL);
needed_segments.push_back(SEGMENT_SPEED);
needed_segments.push_back(SEGMENT_SCROLL);
}
vector<TimingSegment *> *segs = m_avpTimingSegments;
for(size_t s= 0; s < needed_segments.size(); ++s)
{
if(segs[needed_segments[s]].empty())
{
return false;
}
}
return true;
}

TimingData::~TimingData()
{
Clear();
Expand Down Expand Up @@ -301,6 +325,32 @@ void TimingData::ShiftRange(int start_row, int end_row,
}
}

void TimingData::ClearRange(int start_row, int end_row, TimingSegmentType clear_type)
{
FOREACH_TimingSegmentType(seg_type)
{
if(seg_type == clear_type || clear_type == TimingSegmentType_Invalid)
{
vector<TimingSegment*>& segs= GetTimingSegments(seg_type);
int first_affected= GetSegmentIndexAtRow(seg_type, start_row);
int last_affected= GetSegmentIndexAtRow(seg_type, end_row);
if(first_affected == INVALID_INDEX)
{
continue;
}
for(int index= last_affected; index >= first_affected; --index)
{
int seg_row= segs[index]->GetRow();
if(segs.size() > 1 && seg_row > 0 && seg_row >= start_row &&
seg_row <= end_row)
{
EraseSegment(segs, index, segs[index]);
}
}
}
}
}

void TimingData::GetActualBPM( float &fMinBPMOut, float &fMaxBPMOut, float highest ) const
{
fMinBPMOut = FLT_MAX;
Expand Down
2 changes: 2 additions & 0 deletions src/TimingData.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class TimingData

void Copy( const TimingData &other );
void Clear();
bool IsSafeFullTiming();

TimingData( const TimingData &cpy ) { Copy(cpy); }
TimingData& operator=( const TimingData &cpy ) { Copy(cpy); return *this; }
Expand Down Expand Up @@ -151,6 +152,7 @@ class TimingData

void CopyRange(int start_row, int end_row, TimingSegmentType copy_type, int dest_row, TimingData& dest) const;
void ShiftRange(int start_row, int end_row, TimingSegmentType shift_type, int shift_amount);
void ClearRange(int start_row, int end_row, TimingSegmentType clear_type);
/**
* @brief Gets the actual BPM of the song,
* while respecting a limit.
Expand Down

0 comments on commit 2f9b248

Please sign in to comment.