From dcb2f74c8da15250aed3a0cee72eca8075112659 Mon Sep 17 00:00:00 2001 From: Rhythm Lunatic Date: Thu, 28 Mar 2019 16:49:46 -0500 Subject: [PATCH 1/2] Add More OptionsList functionality (#1810) * Add More OptionsList functionality * Remove Size parameter because it's broken * Make OptionsList inputs remappable * Change Next/Prev OptionsList to CodeDetector --- Themes/_fallback/Scripts/03 Gameplay.lua | 25 ++++++++++ Themes/_fallback/metrics.ini | 60 ++++++++++++++++++++++++ src/CodeDetector.cpp | 11 +++++ src/CodeDetector.h | 4 ++ src/OptionRowHandler.cpp | 2 +- src/OptionRowHandler.h | 2 +- src/OptionsList.cpp | 60 +++++++++++++++--------- src/OptionsList.h | 5 +- 8 files changed, 144 insertions(+), 25 deletions(-) diff --git a/Themes/_fallback/Scripts/03 Gameplay.lua b/Themes/_fallback/Scripts/03 Gameplay.lua index fb284cb076..84a1ef1218 100644 --- a/Themes/_fallback/Scripts/03 Gameplay.lua +++ b/Themes/_fallback/Scripts/03 Gameplay.lua @@ -331,6 +331,13 @@ local CodeDetectorCodes = { CloseCurrentFolder = { default = "MenuUp-MenuDown", }, + -- OptionsList + PrevOptionsList = { + default = "@MenuUp-MenuDown", + }, + NextOptionsList = { + default = "@MenuDown-MenuUp", + }, -- sorts NextSort1 = { default = "@MenuLeft-@MenuRight-Start", @@ -461,6 +468,24 @@ function GetCodeForGame(codeName) return inputCode[gameName] or inputCode["default"] end +local OptionsListKeys = { + PrevItem = { + pump="MenuLeft", + default="MenuUp" + }, + NextItem = { + pump="MenuRight", + default="MenuDown" + } +}; + +function GetOptionsListMapping(name) + local sGame = string.lower(GAMESTATE:GetCurrentGame():GetName()) + local map = OptionsListKeys[name] + return map[sGame] or map["default"] +end + + function oitg_zoom_mode_actor() return Def.Actor{ OnCommand= function(self) diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 882a70f748..0eb954bbaa 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -368,6 +368,10 @@ PrevGroup=GetCodeForGame("PrevGroup") CloseCurrentFolder=GetCodeForGame("CloseCurrentFolder") Hidden=GetCodeForGame("Hidden") RandomVanish=GetCodeForGame("RandomVanish") +# OptionsList (if enabled) +PrevOptionsList=GetCodeForGame("PrevOptionsList") +NextOptionsList=GetCodeForGame("NextOptionsList") +# Evaluation screen SaveScreenshot1=GetCodeForGame("SaveScreenshot1") SaveScreenshot2=GetCodeForGame("SaveScreenshot2") # on the player options menu. @@ -2875,6 +2879,62 @@ ExplanationTogetherOffCommand=stoptweening [ScreenOptionsServiceExtendedChild] Fallback="ScreenOptionsServiceChild" +[OptionsList] +Fallback="ScreenWithMenuElements" + +PrevMenuButton=GetOptionsListMapping("PrevMenu") +NextMenuButton=GetOptionsListMapping("NextMenu") +PrevItemButton=GetOptionsListMapping("PrevItem") +NextItemButton=GetOptionsListMapping("NextItem") +CodeNames="" + +#It takes from ScreenOptionsMaster. +#This is the equivalent to LineNames +TopMenus="" +TopMenu="" + +DirectLines="" +ItemsSpacingY= +MaxItemsBeforeSplit= +ItemsSplitWidth= + +TextOnCommand= +TextOffCommand= +TextTweenOffCommand= +TextTweenOnCommand= +TextResetCommand= + +UnderlineOnCommand= +UnderlineOffCommand= +UnderlineSetTwoRowsCommand= +UnderlineSetOneRowCommand= +UnderlineShowCommand= +UnderlineHideCommand= +UnderlineTweenOnCommand= +UnderlineTweenOffCommand= +UnderlineResetCommand= + +CursorOnCommand= +CursorPositionTwoRowsCommand= +CursorPositionOneRowCommand= +CursorTweenOnCommand= +CursorTweenOffCommand= +CursorResetCommand= + +OptionsListOnCommand= +OptionsListOffCommand= +OptionsListTweenOffCommand= +OptionsListTweenOnCommand= +OptionsListResetCommand= + +OptionsListTweenOutForwardCommand= +OptionsListTweenOutBackwardCommand= +OptionsListTweenInForwardCommand= +OptionsListTweenInBackwardCommand= + +OptionsListFadeOffCommand= +OptionsListFadeOnCommand= + [ScreenMiniMenu] Class="ScreenMiniMenu" Fallback="ScreenOptions" diff --git a/src/CodeDetector.cpp b/src/CodeDetector.cpp index d35a3a00c2..42780e0805 100644 --- a/src/CodeDetector.cpp +++ b/src/CodeDetector.cpp @@ -53,6 +53,8 @@ const char *CodeNames[] = { "CancelAllPlayerOptions", "BackInEventMode", "CloseCurrentFolder", + "PrevOptionsList", + "NextOptionsList" }; XToString( Code ); @@ -116,6 +118,15 @@ bool CodeDetector::EnteredModeMenu( GameController controller ) return EnteredCode(controller,CODE_MODE_MENU1) || EnteredCode(controller,CODE_MODE_MENU2); } +bool CodeDetector::EnteredPrevOpList( GameController controller ) +{ + return EnteredCode(controller,CODE_PREV_OPLIST); +} +bool CodeDetector::EnteredNextOpList( GameController controller ) +{ + return EnteredCode(controller,CODE_NEXT_OPLIST); +} + #define TOGGLE(v,a,b) if(v!=a) v=a; else v=b; #define FLOAT_TOGGLE(v) if(v!=1.f) v=1.f; else v=0.f; // XXX: Read the metrics file instead! diff --git a/src/CodeDetector.h b/src/CodeDetector.h index d9b6089fbb..f54616af8c 100644 --- a/src/CodeDetector.h +++ b/src/CodeDetector.h @@ -47,6 +47,8 @@ enum Code { CODE_CANCEL_ALL_PLAYER_OPTIONS, CODE_BACK_IN_EVENT_MODE, CODE_CLOSE_CURRENT_FOLDER, + CODE_NEXT_OPLIST, + CODE_PREV_OPLIST, NUM_Code // leave this at the end }; @@ -63,6 +65,8 @@ public: static bool EnteredPrevGroup( GameController controller ); static bool EnteredNextGroup( GameController controller ); static bool EnteredCloseFolder( GameController controller ); + static bool EnteredPrevOpList( GameController controller ); + static bool EnteredNextOpList( GameController controller ); // todo: move to PlayerOptions.h -aj void ChangeScrollSpeed( GameController controller, bool bIncrement ); diff --git a/src/OptionRowHandler.cpp b/src/OptionRowHandler.cpp index cb92d6a4cc..1810e0d04d 100644 --- a/src/OptionRowHandler.cpp +++ b/src/OptionRowHandler.cpp @@ -1326,7 +1326,7 @@ public: LUA->Release(L); return changed; } - virtual bool GoToFirstOnStart() + virtual bool GoToFirstOnStart() const { return m_GoToFirstOnStart; } diff --git a/src/OptionRowHandler.h b/src/OptionRowHandler.h index d115ca8676..b126634114 100644 --- a/src/OptionRowHandler.h +++ b/src/OptionRowHandler.h @@ -186,7 +186,7 @@ public: virtual RString GetScreen( int /* iChoice */ ) const { return RString(); } // Exists so that a lua function can act on the selection. Returns true if the choices should be reloaded. virtual bool NotifyOfSelection(PlayerNumber pn, int choice) { return false; } - virtual bool GoToFirstOnStart() { return true; } + virtual bool GoToFirstOnStart() const { return true; } }; /** @brief Utilities for the OptionRowHandlers. */ diff --git a/src/OptionsList.cpp b/src/OptionsList.cpp index 80f2410217..109cfecbad 100644 --- a/src/OptionsList.cpp +++ b/src/OptionsList.cpp @@ -181,13 +181,16 @@ OptionsList::~OptionsList() delete hand->second; } +//This is the initialization function. void OptionsList::Load( RString sType, PlayerNumber pn ) { TOP_MENU.Load( sType, "TopMenu" ); m_pn = pn; m_bStartIsDown = false; - + m_GameButtonPreviousItem = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric( m_sName,"PrevItemButton" ) ); + m_GameButtonNextItem = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric( m_sName,"NextItemButton" ) ); + m_Codes.Load( sType ); m_Cursor.Load( THEME->GetPathG(sType, "cursor") ); @@ -290,7 +293,8 @@ RString OptionsList::GetCurrentRow() const return m_asMenuStack.back(); } -const OptionRowHandler *OptionsList::GetCurrentHandler() +//This can't be const because OptionRowHandler->NotifyOfSelection() will modify the OptionRow. +OptionRowHandler *OptionsList::GetCurrentHandler() { RString sCurrentRow = GetCurrentRow(); return m_Rows[sCurrentRow]; @@ -414,18 +418,11 @@ bool OptionsList::Input( const InputEventPlus &input ) } } - if( input.MenuI == GAME_BUTTON_LEFT ) + if( input.MenuI == m_GameButtonPreviousItem ) { if( input.type == IET_RELEASE ) return false; - if( INPUTMAPPER->IsBeingPressed(GAME_BUTTON_RIGHT, pn) ) - { - if( input.type == IET_FIRST_PRESS ) - SwitchMenu( -1 ); - return true; - } - --m_iMenuStackSelection; wrap( m_iMenuStackSelection, pHandler->m_Def.m_vsChoices.size()+1 ); // +1 for exit row PositionCursor(); @@ -436,18 +433,11 @@ bool OptionsList::Input( const InputEventPlus &input ) MESSAGEMAN->Broadcast( lMsg ); return true; } - else if( input.MenuI == GAME_BUTTON_RIGHT ) + else if( input.MenuI == m_GameButtonNextItem ) { if( input.type == IET_RELEASE ) return false; - if( INPUTMAPPER->IsBeingPressed(GAME_BUTTON_LEFT, pn) ) - { - if( input.type == IET_FIRST_PRESS ) - SwitchMenu( +1 ); - return true; - } - ++m_iMenuStackSelection; wrap( m_iMenuStackSelection, pHandler->m_Def.m_vsChoices.size()+1 ); // +1 for exit row PositionCursor(); @@ -458,6 +448,18 @@ bool OptionsList::Input( const InputEventPlus &input ) MESSAGEMAN->Broadcast( lMsg ); return true; } + else if ( CodeDetector::EnteredPrevOpList(input.GameI.controller) ) + { + if( input.type == IET_FIRST_PRESS ) + SwitchMenu( -1 ); + return true; + } + else if ( CodeDetector::EnteredNextOpList(input.GameI.controller) ) + { + if( input.type == IET_FIRST_PRESS ) + SwitchMenu( +1 ); + return true; + } else if( input.MenuI == GAME_BUTTON_START ) { if( input.type == IET_FIRST_PRESS ) @@ -662,7 +664,7 @@ void OptionsList::UpdateMenuFromSelections() bool OptionsList::Start() { - const OptionRowHandler *pHandler = GetCurrentHandler(); + OptionRowHandler *pHandler = GetCurrentHandler(); const RString &sCurrentRow = m_asMenuStack.back(); vector &bSelections = m_bSelections[sCurrentRow]; if( m_iMenuStackSelection == (int)bSelections.size() ) @@ -717,12 +719,26 @@ bool OptionsList::Start() SelectItem( GetCurrentRow(), m_iMenuStackSelection ); - /* Move to the exit row. */ - m_iMenuStackSelection = (int)bSelections.size(); - PositionCursor(); + /* Move to the exit row, but only if it's SelectOne. */ + if (pHandler->m_Def.m_selectType == SELECT_ONE) + { + m_iMenuStackSelection = (int)bSelections.size(); + PositionCursor(); + } + if (pHandler->NotifyOfSelection(m_pn, m_iMenuStackSelection)) + { + /* The current selections are irrelevant when we're getting them + * from NotifyOfSelection. Re import them from the OptionRow. */ + ImportRow(sCurrentRow); + UpdateMenuFromSelections(); + } + /* Better to include Selection as a parameter since + * the index may or may not change depending on if SelectType + * is SELECT_ONE or SELECT_MULTIPLE. */ Message msg("OptionsListStart"); msg.SetParam( "Player", m_pn ); + msg.SetParam( "Selection", m_iMenuStackSelection ); MESSAGEMAN->Broadcast( msg ); return false; diff --git a/src/OptionsList.h b/src/OptionsList.h index 6a03f166fb..783e1d77c2 100644 --- a/src/OptionsList.h +++ b/src/OptionsList.h @@ -70,7 +70,7 @@ private: void SelectionsChanged( const RString &sRowName ); void UpdateMenuFromSelections(); RString GetCurrentRow() const; - const OptionRowHandler *GetCurrentHandler(); + OptionRowHandler *GetCurrentHandler(); int GetOneSelection( RString sRow, bool bAllowFail=false ) const; void SwitchToCurrentRow(); void TweenOnCurrentRow( bool bForward ); @@ -101,6 +101,9 @@ private: vector m_asMenuStack; int m_iMenuStackSelection; +protected: + GameButton m_GameButtonPreviousItem; + GameButton m_GameButtonNextItem; }; From 4977f29fe3818fb4d15b8b7c249afd50df3dcbca Mon Sep 17 00:00:00 2001 From: Colby Klein Date: Thu, 28 Mar 2019 15:05:07 -0700 Subject: [PATCH 2/2] silence a bunch of msvc warnings --- src/Background.cpp | 2 +- src/Course.cpp | 2 +- src/CourseContentsList.cpp | 2 +- src/GameSoundManager.cpp | 2 +- src/GrooveRadar.cpp | 2 +- src/LifeMeterBattery.cpp | 2 +- src/OptionRowHandler.cpp | 6 +++--- src/RageDisplay.cpp | 2 +- src/ScreenEvaluation.cpp | 24 ++++++++++++------------ src/ScreenOptionsEditCourse.cpp | 2 +- src/StepMania.cpp | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Background.cpp b/src/Background.cpp index 364ec9616b..7e996c5820 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -447,7 +447,7 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac int time_signature_start= max(ts->GetRow(),iStartRow); for(int j= time_signature_start; jGetNoteRowsPerMeasure()) + j+= int(RAND_BG_CHANGE_MEASURES * ts->GetNoteRowsPerMeasure())) { // Don't fade. It causes frame rate dip, especially on slower machines. BackgroundDef bd = m_Layer[0].CreateRandomBGA(m_pSong, diff --git a/src/Course.cpp b/src/Course.cpp index f902717195..9a58f853bb 100644 --- a/src/Course.cpp +++ b/src/Course.cpp @@ -713,7 +713,7 @@ void Course::GetTrailUnsortedEndless( const vector &entries, Trail ASSERT( e->iChooseIndex >= 0 ); if( e->iChooseIndex < int( vSongAndSteps.size() ) ) { - if( songIndex >= vpSongs.size() ) { + if( songIndex >= int(vpSongs.size()) ) { songIndex = 0; } resolved.pSong = vpSongs[ songIndex ]; diff --git a/src/CourseContentsList.cpp b/src/CourseContentsList.cpp index b320f1f282..f5aa87fc3c 100644 --- a/src/CourseContentsList.cpp +++ b/src/CourseContentsList.cpp @@ -70,7 +70,7 @@ void CourseContentsList::SetFromGameState() if( bLoop ) { SetPauseCountdownSeconds( 1.5f ); - this->SetDestinationItem( m_vpDisplay.size()+1 ); // loop forever + this->SetDestinationItem( (float)m_vpDisplay.size()+1 ); // loop forever } } diff --git a/src/GameSoundManager.cpp b/src/GameSoundManager.cpp index 170b1f954c..0c9a9ef5ee 100644 --- a/src/GameSoundManager.cpp +++ b/src/GameSoundManager.cpp @@ -314,7 +314,7 @@ static void DoPlayOnceFromDir( RString sPath ) // If order is exhausted, repopulate and reshuffle if (order.size() == 0) { - for (int i = 0; i < arraySoundFiles.size(); ++i) + for (int i = 0; i < (int)arraySoundFiles.size(); ++i) { order.push_back(i); } diff --git a/src/GrooveRadar.cpp b/src/GrooveRadar.cpp index 93deafef8a..efada8c834 100644 --- a/src/GrooveRadar.cpp +++ b/src/GrooveRadar.cpp @@ -107,7 +107,7 @@ void GrooveRadar::GrooveRadarValueMap::SetFromSteps( const RadarValues &rv ) { const float fValueCurrent = m_fValuesOld[c] * (1-m_PercentTowardNew) + m_fValuesNew[c] * m_PercentTowardNew; m_fValuesOld[c] = fValueCurrent; - m_fValuesNew[c] = clamp(rv[c], 0.0, 1.0); + m_fValuesNew[c] = (int)clamp(rv[c], 0.0, 1.0); } if( !m_bValuesVisible ) // the values WERE invisible diff --git a/src/LifeMeterBattery.cpp b/src/LifeMeterBattery.cpp index f02216adff..85d044d2bd 100644 --- a/src/LifeMeterBattery.cpp +++ b/src/LifeMeterBattery.cpp @@ -100,7 +100,7 @@ void LifeMeterBattery::OnSongEnded() LuaHelpers::Push(L, pn); RString error= "Error running CourseSongRewardLives callback: "; LuaHelpers::RunScriptOnStack(L, error, 2, 1, true); - m_iLivesLeft += luaL_optnumber(L, -1, 0); + m_iLivesLeft += (int)luaL_optnumber(L, -1, 0); lua_settop(L, 0); LUA->Release(L); } diff --git a/src/OptionRowHandler.cpp b/src/OptionRowHandler.cpp index 1810e0d04d..0821f7057d 100644 --- a/src/OptionRowHandler.cpp +++ b/src/OptionRowHandler.cpp @@ -1063,15 +1063,15 @@ public: lua_pop( L, 1 ); lua_getfield(L, -1, "GoToFirstOnStart"); - m_GoToFirstOnStart= lua_toboolean(L, -1); + m_GoToFirstOnStart = lua_toboolean(L, -1) > 0; lua_pop(L, 1); lua_getfield(L, -1, "OneChoiceForAllPlayers"); - m_Def.m_bOneChoiceForAllPlayers = lua_toboolean( L, -1 ); + m_Def.m_bOneChoiceForAllPlayers = lua_toboolean( L, -1 ) > 0; lua_pop( L, 1 ); lua_getfield(L, -1, "ExportOnChange"); - m_Def.m_bExportOnChange = lua_toboolean( L, -1 ); + m_Def.m_bExportOnChange = lua_toboolean( L, -1 ) > 0; lua_pop( L, 1 ); // TODO: Change these to use the proper enum strings like everything diff --git a/src/RageDisplay.cpp b/src/RageDisplay.cpp index e9b3838592..c41ef56d16 100644 --- a/src/RageDisplay.cpp +++ b/src/RageDisplay.cpp @@ -1081,7 +1081,7 @@ public: ADD_METHOD( GetCumFPS ); ADD_METHOD( GetDisplaySpecs ); ADD_METHOD( SupportsRenderToTexture ); - ADD_METHOD( SupportsFullscreenBorderlessWindow); + ADD_METHOD( SupportsFullscreenBorderlessWindow ); } }; diff --git a/src/ScreenEvaluation.cpp b/src/ScreenEvaluation.cpp index 3df390e395..79ab877702 100644 --- a/src/ScreenEvaluation.cpp +++ b/src/ScreenEvaluation.cpp @@ -209,8 +209,8 @@ void ScreenEvaluation::Init() case RadarCategory_Rolls: case RadarCategory_Lifts: case RadarCategory_Fakes: - ss.m_player[p].m_radarPossible[rc] = 1 + (rand() % 200); - ss.m_player[p].m_radarActual[rc] = rand() % (int)(ss.m_player[p].m_radarPossible[rc]); + ss.m_player[p].m_radarPossible[rc] = float(1 + (rand() % 200)); + ss.m_player[p].m_radarActual[rc] = float(rand() % (int)(ss.m_player[p].m_radarPossible[rc])); break; default: break; } @@ -270,13 +270,13 @@ void ScreenEvaluation::Init() m_SmallBanner[i].LoadFromSong( pSong ); m_SmallBanner[i].ScaleToClipped( BANNER_WIDTH, BANNER_HEIGHT ); - m_SmallBanner[i].SetName( ssprintf("SmallBanner%zu",i+1) ); + m_SmallBanner[i].SetName( ssprintf("SmallBanner%u",(unsigned)i+1) ); ActorUtil::LoadAllCommands( m_SmallBanner[i], m_sName ); SET_XY( m_SmallBanner[i] ); this->AddChild( &m_SmallBanner[i] ); m_sprSmallBannerFrame[i].Load( THEME->GetPathG(m_sName,"BannerFrame") ); - m_sprSmallBannerFrame[i]->SetName( ssprintf("SmallBanner%zu",i+1) ); + m_sprSmallBannerFrame[i]->SetName( ssprintf("SmallBanner%u",(unsigned)i+1) ); ActorUtil::LoadAllCommands( *m_sprSmallBannerFrame[i], m_sName ); SET_XY( m_sprSmallBannerFrame[i] ); this->AddChild( m_sprSmallBannerFrame[i] ); @@ -548,7 +548,7 @@ void ScreenEvaluation::Init() DEFAULT_FAIL( l ); } - m_textJudgmentLineNumber[l][p].SetTargetNumber( iValue ); + m_textJudgmentLineNumber[l][p].SetTargetNumber( float(iValue) ); } } } @@ -577,7 +577,7 @@ void ScreenEvaluation::Init() static const int indices[NUM_DetailLine] = { - RadarCategory_TapsAndHolds, RadarCategory_Jumps, RadarCategory_Holds, RadarCategory_Mines, + RadarCategory_TapsAndHolds, RadarCategory_Jumps, RadarCategory_Holds, RadarCategory_Mines, RadarCategory_Hands, RadarCategory_Rolls, RadarCategory_Lifts, RadarCategory_Fakes }; const int ind = indices[l]; @@ -607,7 +607,7 @@ void ScreenEvaluation::Init() m_textScore[p].Load( "RollingNumbersEvaluation" ); ActorUtil::LoadAllCommands( m_textScore[p], m_sName ); SET_XY( m_textScore[p] ); - m_textScore[p].SetTargetNumber( m_pStageStats->m_player[p].m_iScore ); + m_textScore[p].SetTargetNumber( float(m_pStageStats->m_player[p].m_iScore) ); this->AddChild( &m_textScore[p] ); } } @@ -639,7 +639,7 @@ void ScreenEvaluation::Init() bool bOneHasFullW2Combo = false; bool bOneHasFullW3Combo = false; bool bOneHasFullW4Combo = false; - + FOREACH_PlayerNumber( p ) { if(GAMESTATE->IsPlayerEnabled(p)) @@ -666,7 +666,7 @@ void ScreenEvaluation::Init() Grade best_grade = Grade_NoData; FOREACH_PlayerNumber( p ) - best_grade = min( best_grade, grade[p] ); + best_grade = min( best_grade, grade[p] ); if( m_pStageStats->m_EarnedExtraStage != EarnedExtraStage_No ) { @@ -799,7 +799,7 @@ void ScreenEvaluation::HandleMenuStart() // lua start #include "LuaBinding.h" -/** @brief Allow Lua to have access to the ScreenEvaluation. */ +/** @brief Allow Lua to have access to the ScreenEvaluation. */ class LunaScreenEvaluation: public Luna { public: @@ -817,7 +817,7 @@ LUA_REGISTER_DERIVED_CLASS( ScreenEvaluation, ScreenWithMenuElements ) /* * (c) 2001-2004 Chris Danford * All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -827,7 +827,7 @@ LUA_REGISTER_DERIVED_CLASS( ScreenEvaluation, ScreenWithMenuElements ) * copyright notice(s) and this permission notice appear in all copies of * the Software and that both the above copyright notice(s) and this * permission notice appear in supporting documentation. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF diff --git a/src/ScreenOptionsEditCourse.cpp b/src/ScreenOptionsEditCourse.cpp index 599f4a88f3..d7ad5eb665 100644 --- a/src/ScreenOptionsEditCourse.cpp +++ b/src/ScreenOptionsEditCourse.cpp @@ -311,7 +311,7 @@ void ScreenOptionsEditCourse::ExportOptions( int iRow, const vectorm_pCurCourse->m_fGoalSeconds = 0; int mins; if( sscanf( sValue, "%d", &mins ) == 1 ) - GAMESTATE->m_pCurCourse->m_fGoalSeconds = mins * 60; + GAMESTATE->m_pCurCourse->m_fGoalSeconds = float(mins * 60); break; } } diff --git a/src/StepMania.cpp b/src/StepMania.cpp index 018ab7923c..926dcea122 100644 --- a/src/StepMania.cpp +++ b/src/StepMania.cpp @@ -1628,8 +1628,8 @@ int LuaFunc_SaveScreenshot(lua_State *L) // If pn is provided, save to that player's profile. // Otherwise, save to the machine. PlayerNumber pn= Enum::Check(L, 1, true); - bool compress= lua_toboolean(L, 2); - bool sign= lua_toboolean(L, 3); + bool compress= lua_toboolean(L, 2) > 0; + bool sign= lua_toboolean(L, 3) > 0; RString prefix= luaL_optstring(L, 4, ""); RString suffix= luaL_optstring(L, 5, ""); RString dir;