Enable more compiler warnings and treat them as errors.
This commit is contained in:
@@ -155,14 +155,6 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(TestBigEndian)
|
|
||||||
test_big_endian(BIGENDIAN)
|
|
||||||
if(${BIGENDIAN})
|
|
||||||
set(ENDIAN_BIG 1)
|
|
||||||
else()
|
|
||||||
set(ENDIAN_LITTLE 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_compile_features("${SM_CMAKE_DIR}/TestCode"
|
check_compile_features("${SM_CMAKE_DIR}/TestCode"
|
||||||
"${SM_CMAKE_DIR}/TestCode/test_external.c"
|
"${SM_CMAKE_DIR}/TestCode/test_external.c"
|
||||||
"Checking for external name shortening requirements"
|
"Checking for external name shortening requirements"
|
||||||
|
|||||||
+1
-1
@@ -1118,7 +1118,7 @@ void Actor::SetEffectClockString( const RString &s )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->SetEffectClock(static_cast<EffectClock>(cl + CLOCK_LIGHT_1));
|
this->SetEffectClock(static_cast<EffectClock>(Enum::to_integral(cl) + CLOCK_LIGHT_1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -477,7 +477,7 @@ public:
|
|||||||
float GetAux() const { return m_current.aux; }
|
float GetAux() const { return m_current.aux; }
|
||||||
|
|
||||||
virtual void BeginTweening( float time, ITween *pInterp );
|
virtual void BeginTweening( float time, ITween *pInterp );
|
||||||
void BeginTweening( float time, TweenType tt = TWEEN_LINEAR );
|
virtual void BeginTweening( float time, TweenType tt = TWEEN_LINEAR );
|
||||||
virtual void StopTweening();
|
virtual void StopTweening();
|
||||||
void Sleep( float time );
|
void Sleep( float time );
|
||||||
void QueueCommand( const RString& sCommandName );
|
void QueueCommand( const RString& sCommandName );
|
||||||
|
|||||||
@@ -401,9 +401,9 @@ CubicSplineN* ActorMultiVertex::GetSpline(size_t i)
|
|||||||
return &(_splines[i]);
|
return &(_splines[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActorMultiVertex::SetState(size_t i)
|
void ActorMultiVertex::SetState(int i)
|
||||||
{
|
{
|
||||||
ASSERT(i < _states.size());
|
ASSERT(i >= 0 and static_cast<size_t>(i) < _states.size());
|
||||||
_cur_state= i;
|
_cur_state= i;
|
||||||
_secs_into_state= 0.0f;
|
_secs_into_state= 0.0f;
|
||||||
}
|
}
|
||||||
@@ -1002,7 +1002,7 @@ public:
|
|||||||
static size_t ValidStateIndex(T* p, lua_State *L, int pos)
|
static size_t ValidStateIndex(T* p, lua_State *L, int pos)
|
||||||
{
|
{
|
||||||
int index= IArg(pos)-1;
|
int index= IArg(pos)-1;
|
||||||
if(index < 0 || static_cast<size_t>(index) >= p->GetNumStates())
|
if(index < 0 || index >= p->GetNumStates())
|
||||||
{
|
{
|
||||||
luaL_error(L, "Invalid state index %d.", index+1);
|
luaL_error(L, "Invalid state index %d.", index+1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public:
|
|||||||
{ ASSERT(i < _states.size()); _states[i]= s; }
|
{ ASSERT(i < _states.size()); _states[i]= s; }
|
||||||
void SetStateProperties(const std::vector<State>& new_states)
|
void SetStateProperties(const std::vector<State>& new_states)
|
||||||
{ _states= new_states; SetState(0); }
|
{ _states= new_states; SetState(0); }
|
||||||
void SetState(size_t i);
|
void SetState(int i);
|
||||||
void SetAllStateDelays(float delay);
|
void SetAllStateDelays(float delay);
|
||||||
float GetAnimationLengthSeconds() const;
|
float GetAnimationLengthSeconds() const;
|
||||||
void SetSecondsIntoAnimation(float seconds);
|
void SetSecondsIntoAnimation(float seconds);
|
||||||
|
|||||||
+20
-21
@@ -319,9 +319,8 @@ void ArrowEffects::Update()
|
|||||||
const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pn];
|
const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pn];
|
||||||
const SongPosition &position = GAMESTATE->m_bIsUsingStepTiming
|
const SongPosition &position = GAMESTATE->m_bIsUsingStepTiming
|
||||||
? GAMESTATE->m_pPlayerState[pn]->m_Position : GAMESTATE->m_Position;
|
? GAMESTATE->m_pPlayerState[pn]->m_Position : GAMESTATE->m_Position;
|
||||||
const float field_zoom= GAMESTATE->m_pPlayerState[pn]->m_NotefieldZoom;
|
const auto& effects= GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_fEffects;
|
||||||
const float* effects= GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_fEffects;
|
const auto& accels= GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_fAccels;
|
||||||
const float* accels= GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_fAccels;
|
|
||||||
|
|
||||||
PerPlayerData &data = g_EffectData[pn];
|
PerPlayerData &data = g_EffectData[pn];
|
||||||
|
|
||||||
@@ -515,8 +514,8 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float
|
|||||||
return fYOffset * fScrollSpeed;
|
return fYOffset * fScrollSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float* fAccels = curr_options->m_fAccels;
|
const auto& fAccels = curr_options->m_fAccels;
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
|
|
||||||
// TODO: Don't index by PlayerNumber.
|
// TODO: Don't index by PlayerNumber.
|
||||||
PerPlayerData &data = g_EffectData[pPlayerState->m_PlayerNumber];
|
PerPlayerData &data = g_EffectData[pPlayerState->m_PlayerNumber];
|
||||||
@@ -637,7 +636,7 @@ float ArrowEffects::GetYPos( const PlayerState* pPlayerState, int iCol, float fY
|
|||||||
// TODO: Don't index by PlayerNumber.
|
// TODO: Don't index by PlayerNumber.
|
||||||
const Style* pStyle = GAMESTATE->GetCurrentStyle(pPlayerState->m_PlayerNumber);
|
const Style* pStyle = GAMESTATE->GetCurrentStyle(pPlayerState->m_PlayerNumber);
|
||||||
const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pPlayerState->m_PlayerNumber];
|
const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pPlayerState->m_PlayerNumber];
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
|
|
||||||
// Doing the math with a precalculated result of 0 should be faster than
|
// Doing the math with a precalculated result of 0 should be faster than
|
||||||
// checking whether tipsy is on. -Kyz
|
// checking whether tipsy is on. -Kyz
|
||||||
@@ -670,7 +669,7 @@ float ArrowEffects::GetYOffsetFromYPos(int iCol, float YPos, float fYReverseOffs
|
|||||||
{
|
{
|
||||||
float f = YPos;
|
float f = YPos;
|
||||||
|
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
// Doing the math with a precalculated result of 0 should be faster than
|
// Doing the math with a precalculated result of 0 should be faster than
|
||||||
// checking whether tipsy is on. -Kyz
|
// checking whether tipsy is on. -Kyz
|
||||||
// TODO: Don't index by PlayerNumber.
|
// TODO: Don't index by PlayerNumber.
|
||||||
@@ -695,7 +694,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float
|
|||||||
float fPixelOffsetFromCenter = 0; // fill this in below
|
float fPixelOffsetFromCenter = 0; // fill this in below
|
||||||
|
|
||||||
const Style* pStyle = GAMESTATE->GetCurrentStyle(pPlayerState->m_PlayerNumber);
|
const Style* pStyle = GAMESTATE->GetCurrentStyle(pPlayerState->m_PlayerNumber);
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
|
|
||||||
// TODO: Don't index by PlayerNumber.
|
// TODO: Don't index by PlayerNumber.
|
||||||
const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pPlayerState->m_PlayerNumber];
|
const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pPlayerState->m_PlayerNumber];
|
||||||
@@ -865,7 +864,7 @@ float ArrowEffects::GetXPos( const PlayerState* pPlayerState, int iColNum, float
|
|||||||
|
|
||||||
float ArrowEffects::GetRotationX(const PlayerState* pPlayerState, float fYOffset, bool bIsHoldCap, int iCol)
|
float ArrowEffects::GetRotationX(const PlayerState* pPlayerState, float fYOffset, bool bIsHoldCap, int iCol)
|
||||||
{
|
{
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
float fRotation = 0;
|
float fRotation = 0;
|
||||||
if( fEffects[PlayerOptions::EFFECT_CONFUSION_X] != 0 || fEffects[PlayerOptions::EFFECT_CONFUSION_X_OFFSET] != 0 ||
|
if( fEffects[PlayerOptions::EFFECT_CONFUSION_X] != 0 || fEffects[PlayerOptions::EFFECT_CONFUSION_X_OFFSET] != 0 ||
|
||||||
curr_options->m_fConfusionX[iCol] != 0
|
curr_options->m_fConfusionX[iCol] != 0
|
||||||
@@ -880,7 +879,7 @@ float ArrowEffects::GetRotationX(const PlayerState* pPlayerState, float fYOffset
|
|||||||
|
|
||||||
float ArrowEffects::GetRotationY(const PlayerState* pPlayerState, float fYOffset, int iCol)
|
float ArrowEffects::GetRotationY(const PlayerState* pPlayerState, float fYOffset, int iCol)
|
||||||
{
|
{
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
float fRotation = 0;
|
float fRotation = 0;
|
||||||
if( fEffects[PlayerOptions::EFFECT_CONFUSION_Y] != 0 || fEffects[PlayerOptions::EFFECT_CONFUSION_Y_OFFSET] != 0 ||
|
if( fEffects[PlayerOptions::EFFECT_CONFUSION_Y] != 0 || fEffects[PlayerOptions::EFFECT_CONFUSION_Y_OFFSET] != 0 ||
|
||||||
curr_options->m_fConfusionY[iCol] != 0
|
curr_options->m_fConfusionY[iCol] != 0
|
||||||
@@ -895,7 +894,7 @@ float ArrowEffects::GetRotationY(const PlayerState* pPlayerState, float fYOffset
|
|||||||
|
|
||||||
float ArrowEffects::GetRotationZ( const PlayerState* pPlayerState, float fNoteBeat, bool bIsHoldHead, int iCol )
|
float ArrowEffects::GetRotationZ( const PlayerState* pPlayerState, float fNoteBeat, bool bIsHoldHead, int iCol )
|
||||||
{
|
{
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
float fRotation = 0;
|
float fRotation = 0;
|
||||||
if( fEffects[PlayerOptions::EFFECT_CONFUSION] != 0 || fEffects[PlayerOptions::EFFECT_CONFUSION_OFFSET] != 0 ||
|
if( fEffects[PlayerOptions::EFFECT_CONFUSION] != 0 || fEffects[PlayerOptions::EFFECT_CONFUSION_OFFSET] != 0 ||
|
||||||
curr_options->m_fConfusionZ[iCol] != 0
|
curr_options->m_fConfusionZ[iCol] != 0
|
||||||
@@ -917,7 +916,7 @@ float ArrowEffects::GetRotationZ( const PlayerState* pPlayerState, float fNoteBe
|
|||||||
|
|
||||||
float ArrowEffects::ReceptorGetRotationZ( const PlayerState* pPlayerState, int iCol )
|
float ArrowEffects::ReceptorGetRotationZ( const PlayerState* pPlayerState, int iCol )
|
||||||
{
|
{
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
float fRotation = 0;
|
float fRotation = 0;
|
||||||
|
|
||||||
if( curr_options->m_fConfusionZ[iCol] != 0 )
|
if( curr_options->m_fConfusionZ[iCol] != 0 )
|
||||||
@@ -940,7 +939,7 @@ float ArrowEffects::ReceptorGetRotationZ( const PlayerState* pPlayerState, int i
|
|||||||
|
|
||||||
float ArrowEffects::ReceptorGetRotationX( const PlayerState* pPlayerState, int iCol )
|
float ArrowEffects::ReceptorGetRotationX( const PlayerState* pPlayerState, int iCol )
|
||||||
{
|
{
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
float fRotation = 0;
|
float fRotation = 0;
|
||||||
|
|
||||||
if( curr_options->m_fConfusionX[iCol] != 0 )
|
if( curr_options->m_fConfusionX[iCol] != 0 )
|
||||||
@@ -963,7 +962,7 @@ float ArrowEffects::ReceptorGetRotationX( const PlayerState* pPlayerState, int i
|
|||||||
|
|
||||||
float ArrowEffects::ReceptorGetRotationY( const PlayerState* pPlayerState, int iCol )
|
float ArrowEffects::ReceptorGetRotationY( const PlayerState* pPlayerState, int iCol )
|
||||||
{
|
{
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
float fRotation = 0;
|
float fRotation = 0;
|
||||||
|
|
||||||
if( curr_options->m_fConfusionY[iCol] != 0 )
|
if( curr_options->m_fConfusionY[iCol] != 0 )
|
||||||
@@ -986,7 +985,7 @@ float ArrowEffects::ReceptorGetRotationY( const PlayerState* pPlayerState, int i
|
|||||||
|
|
||||||
float ArrowEffects::GetMoveX(int iCol)
|
float ArrowEffects::GetMoveX(int iCol)
|
||||||
{
|
{
|
||||||
const float* fMoves = curr_options->m_fMovesX;
|
const auto& fMoves = curr_options->m_fMovesX;
|
||||||
float f = 0;
|
float f = 0;
|
||||||
if( fMoves[iCol] != 0 )
|
if( fMoves[iCol] != 0 )
|
||||||
f += ARROW_SIZE * fMoves[iCol];
|
f += ARROW_SIZE * fMoves[iCol];
|
||||||
@@ -995,7 +994,7 @@ float ArrowEffects::GetMoveX(int iCol)
|
|||||||
|
|
||||||
float ArrowEffects::GetMoveY(int iCol)
|
float ArrowEffects::GetMoveY(int iCol)
|
||||||
{
|
{
|
||||||
const float* fMoves = curr_options->m_fMovesY;
|
const auto& fMoves = curr_options->m_fMovesY;
|
||||||
float f = 0;
|
float f = 0;
|
||||||
if( fMoves[iCol] != 0 )
|
if( fMoves[iCol] != 0 )
|
||||||
f += ARROW_SIZE * fMoves[iCol];
|
f += ARROW_SIZE * fMoves[iCol];
|
||||||
@@ -1004,7 +1003,7 @@ float ArrowEffects::GetMoveY(int iCol)
|
|||||||
|
|
||||||
float ArrowEffects::GetMoveZ(int iCol)
|
float ArrowEffects::GetMoveZ(int iCol)
|
||||||
{
|
{
|
||||||
const float* fMoves = curr_options->m_fMovesZ;
|
const auto& fMoves = curr_options->m_fMovesZ;
|
||||||
float f = 0;
|
float f = 0;
|
||||||
if( fMoves[iCol] != 0 )
|
if( fMoves[iCol] != 0 )
|
||||||
f += ARROW_SIZE * fMoves[iCol];
|
f += ARROW_SIZE * fMoves[iCol];
|
||||||
@@ -1025,7 +1024,7 @@ static float GetCenterLine()
|
|||||||
|
|
||||||
static float GetHiddenSudden()
|
static float GetHiddenSudden()
|
||||||
{
|
{
|
||||||
const float* fAppearances = curr_options->m_fAppearances;
|
const auto& fAppearances = curr_options->m_fAppearances;
|
||||||
return fAppearances[PlayerOptions::APPEARANCE_HIDDEN] *
|
return fAppearances[PlayerOptions::APPEARANCE_HIDDEN] *
|
||||||
fAppearances[PlayerOptions::APPEARANCE_SUDDEN];
|
fAppearances[PlayerOptions::APPEARANCE_SUDDEN];
|
||||||
}
|
}
|
||||||
@@ -1085,7 +1084,7 @@ float ArrowGetPercentVisible(float fYPosWithoutReverse, int iCol, float fYOffset
|
|||||||
if( fYPos < 0 && curr_options->m_bStealthPastReceptors == false) // past Gray Arrows
|
if( fYPos < 0 && curr_options->m_bStealthPastReceptors == false) // past Gray Arrows
|
||||||
return 1; // totally visible
|
return 1; // totally visible
|
||||||
|
|
||||||
const float* fAppearances = curr_options->m_fAppearances;
|
const auto& fAppearances = curr_options->m_fAppearances;
|
||||||
|
|
||||||
float fVisibleAdjust = 0;
|
float fVisibleAdjust = 0;
|
||||||
|
|
||||||
@@ -1174,7 +1173,7 @@ float ArrowEffects::GetBrightness( const PlayerState* pPlayerState, float fNoteB
|
|||||||
float ArrowEffects::GetZPos( const PlayerState* pPlayerState, int iCol, float fYOffset)
|
float ArrowEffects::GetZPos( const PlayerState* pPlayerState, int iCol, float fYOffset)
|
||||||
{
|
{
|
||||||
float fZPos=0;
|
float fZPos=0;
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
const Style* pStyle = GAMESTATE->GetCurrentStyle(pPlayerState->m_PlayerNumber);
|
const Style* pStyle = GAMESTATE->GetCurrentStyle(pPlayerState->m_PlayerNumber);
|
||||||
|
|
||||||
// TODO: Don't index by PlayerNumber.
|
// TODO: Don't index by PlayerNumber.
|
||||||
@@ -1296,7 +1295,7 @@ float ArrowEffects::GetZPos( const PlayerState* pPlayerState, int iCol, float fY
|
|||||||
|
|
||||||
bool ArrowEffects::NeedZBuffer()
|
bool ArrowEffects::NeedZBuffer()
|
||||||
{
|
{
|
||||||
const float* fEffects = curr_options->m_fEffects;
|
const auto& fEffects = curr_options->m_fEffects;
|
||||||
// We also need to use the Z buffer if twirl is in play, because of
|
// We also need to use the Z buffer if twirl is in play, because of
|
||||||
// hold modulation. -vyhd (OpenITG r623)
|
// hold modulation. -vyhd (OpenITG r623)
|
||||||
if( fEffects[PlayerOptions::EFFECT_BUMPY] != 0 ||
|
if( fEffects[PlayerOptions::EFFECT_BUMPY] != 0 ||
|
||||||
|
|||||||
+4
-4
@@ -669,11 +669,11 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
|
|||||||
// Look for the random file marker, and replace the segment with LoadFromRandom.
|
// Look for the random file marker, and replace the segment with LoadFromRandom.
|
||||||
for( unsigned i=0; i<mainlayer.m_aBGChanges.size(); i++ )
|
for( unsigned i=0; i<mainlayer.m_aBGChanges.size(); i++ )
|
||||||
{
|
{
|
||||||
const BackgroundChange change = mainlayer.m_aBGChanges[i];
|
const auto bgChange = mainlayer.m_aBGChanges[i];
|
||||||
if( change.m_def.m_sFile1 != RANDOM_BACKGROUND_FILE )
|
if( bgChange.m_def.m_sFile1 != RANDOM_BACKGROUND_FILE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float fStartBeat = change.m_fStartBeat;
|
float fStartBeat = bgChange.m_fStartBeat;
|
||||||
float fEndBeat = pSong->GetLastBeat();
|
float fEndBeat = pSong->GetLastBeat();
|
||||||
if( i+1 < mainlayer.m_aBGChanges.size() )
|
if( i+1 < mainlayer.m_aBGChanges.size() )
|
||||||
fEndBeat = mainlayer.m_aBGChanges[i+1].m_fStartBeat;
|
fEndBeat = mainlayer.m_aBGChanges[i+1].m_fStartBeat;
|
||||||
@@ -681,7 +681,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
|
|||||||
mainlayer.m_aBGChanges.erase( mainlayer.m_aBGChanges.begin()+i );
|
mainlayer.m_aBGChanges.erase( mainlayer.m_aBGChanges.begin()+i );
|
||||||
--i;
|
--i;
|
||||||
|
|
||||||
LoadFromRandom( fStartBeat, fEndBeat, change );
|
LoadFromRandom( fStartBeat, fEndBeat, bgChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, we shouldn't have any BGChanges to "". "" is an invalid name.
|
// At this point, we shouldn't have any BGChanges to "". "" is an invalid name.
|
||||||
|
|||||||
+1
-1
@@ -647,7 +647,7 @@ void BitmapText::CropLineToWidth(size_t l, int width)
|
|||||||
{
|
{
|
||||||
int used_width= width;
|
int used_width= width;
|
||||||
std::wstring& line= m_wTextLines[l];
|
std::wstring& line= m_wTextLines[l];
|
||||||
int fit= m_pFont->GetGlyphsThatFit(line, &used_width);
|
const auto fit= m_pFont->GetGlyphsThatFit(line, &used_width);
|
||||||
if(fit < line.size())
|
if(fit < line.size())
|
||||||
{
|
{
|
||||||
line.erase(line.begin()+fit, line.end());
|
line.erase(line.begin()+fit, line.end());
|
||||||
|
|||||||
@@ -118,6 +118,25 @@ target_compile_definitions("${SM_EXE_NAME}" PRIVATE $<$<CONFIG:MinSizeRel>:MINSI
|
|||||||
target_compile_definitions("${SM_EXE_NAME}" PRIVATE
|
target_compile_definitions("${SM_EXE_NAME}" PRIVATE
|
||||||
$<$<CONFIG:RelWithDebInfo>:RELWITHDEBINFO>)
|
$<$<CONFIG:RelWithDebInfo>:RELWITHDEBINFO>)
|
||||||
|
|
||||||
|
# For Apple Clang, CMAKE_<LANG>_COMPILER_ID will be set to AppleClang instead of Clang.
|
||||||
|
if (POLICY CMP0025)
|
||||||
|
cmake_policy(SET CMP0025 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# COMPILE_WARNING_AS_ERROR is only supported starting with cmake 3.24.
|
||||||
|
# Continue using -Werror and /WX to treat warnings as errors until cmake >= 3.24 is required.
|
||||||
|
set_property(TARGET "${SM_EXE_NAME}" PROPERTY COMPILE_WARNING_AS_ERROR ON)
|
||||||
|
target_compile_options("${SM_EXE_NAME}" PRIVATE
|
||||||
|
$<$<CXX_COMPILER_ID:GNU>:
|
||||||
|
-Werror -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-unknown-pragmas>
|
||||||
|
$<$<CXX_COMPILER_ID:Clang>:
|
||||||
|
-Werror -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-unknown-pragmas -Wno-undefined-var-template>
|
||||||
|
$<$<CXX_COMPILER_ID:AppleClang>:
|
||||||
|
-Werror -Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-unknown-pragmas -Wno-undefined-var-template -Wno-deprecated-declarations -Wno-unused-command-line-argument>
|
||||||
|
$<$<CXX_COMPILER_ID:MSVC>:
|
||||||
|
/WX /W4 /wd4100 /wd4189 /wd4244 /wd4267 /wd4702>
|
||||||
|
)
|
||||||
|
|
||||||
set(SM_COMPILE_FLAGS "")
|
set(SM_COMPILE_FLAGS "")
|
||||||
|
|
||||||
if(WITH_SSE2)
|
if(WITH_SSE2)
|
||||||
@@ -176,7 +195,10 @@ if(WIN32)
|
|||||||
COMMENT "Generating file to allow for easier stack traces.")
|
COMMENT "Generating file to allow for easier stack traces.")
|
||||||
endif()
|
endif()
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
|
# TODO should we set CRASH_HANDLER and other things like LINUX does below? Why is that logic specfic to LINUX?
|
||||||
target_compile_definitions("${SM_EXE_NAME}" PRIVATE BACKTRACE_METHOD_X86_DARWIN)
|
target_compile_definitions("${SM_EXE_NAME}" PRIVATE BACKTRACE_METHOD_X86_DARWIN)
|
||||||
|
target_compile_definitions("${SM_EXE_NAME}" PRIVATE BACKTRACE_LOOKUP_METHOD_TEXT="dladdr")
|
||||||
|
target_compile_definitions("${SM_EXE_NAME}" PRIVATE BACKTRACE_LOOKUP_METHOD_DLADDR)
|
||||||
target_compile_definitions("${SM_EXE_NAME}" PRIVATE MACOSX)
|
target_compile_definitions("${SM_EXE_NAME}" PRIVATE MACOSX)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
"${SM_EXE_NAME}"
|
"${SM_EXE_NAME}"
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ Character* CharacterManager::GetDefaultCharacter()
|
|||||||
|
|
||||||
/* We always have the default character. */
|
/* We always have the default character. */
|
||||||
FAIL_M("There must be a default character available!");
|
FAIL_M("There must be a default character available!");
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterManager::DemandGraphics()
|
void CharacterManager::DemandGraphics()
|
||||||
|
|||||||
+2
-3
@@ -657,7 +657,7 @@ void Course::GetTrailUnsortedEndless( const std::vector<CourseEntry> &entries, T
|
|||||||
typedef std::vector<Steps*> StepsVector;
|
typedef std::vector<Steps*> StepsVector;
|
||||||
|
|
||||||
std::set<Song*> alreadySelected;
|
std::set<Song*> alreadySelected;
|
||||||
Song* lastSongSelected;
|
Song* lastSongSelected = nullptr;
|
||||||
std::vector<SongAndSteps> vSongAndSteps;
|
std::vector<SongAndSteps> vSongAndSteps;
|
||||||
for (auto e = entries.begin(); e != entries.end(); ++e)
|
for (auto e = entries.begin(); e != entries.end(); ++e)
|
||||||
{
|
{
|
||||||
@@ -743,7 +743,7 @@ void Course::GetTrailUnsortedEndless( const std::vector<CourseEntry> &entries, T
|
|||||||
ASSERT(e->iChooseIndex >= 0);
|
ASSERT(e->iChooseIndex >= 0);
|
||||||
// If we're trying to pick BEST100 when only 99 songs exist,
|
// If we're trying to pick BEST100 when only 99 songs exist,
|
||||||
// we have a problem, so bail out
|
// we have a problem, so bail out
|
||||||
if (e->iChooseIndex >= vpSongs.size()) {
|
if (static_cast<size_t>(e->iChooseIndex) >= vpSongs.size()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1029,7 +1029,6 @@ RageColor Course::GetColor() const
|
|||||||
else return SORT_LEVEL4_COLOR;
|
else return SORT_LEVEL4_COLOR;
|
||||||
default:
|
default:
|
||||||
FAIL_M( ssprintf("Invalid course sort %d.", int(PREFSMAN->m_CourseSortOrder)) );
|
FAIL_M( ssprintf("Invalid course sort %d.", int(PREFSMAN->m_CourseSortOrder)) );
|
||||||
return RageColor(1,1,1,1); // white; should never reach here
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -17,8 +17,16 @@ struct Game;
|
|||||||
|
|
||||||
const int MAX_EDIT_COURSE_TITLE_LENGTH = 16;
|
const int MAX_EDIT_COURSE_TITLE_LENGTH = 16;
|
||||||
|
|
||||||
inline PlayMode CourseTypeToPlayMode( CourseType ct ) { return (PlayMode)(PLAY_MODE_NONSTOP+ct); }
|
inline PlayMode CourseTypeToPlayMode( CourseType ct ) {
|
||||||
inline CourseType PlayModeToCourseType( PlayMode pm ) { return (CourseType)(pm-PLAY_MODE_NONSTOP); }
|
switch (ct) {
|
||||||
|
case COURSE_TYPE_NONSTOP: return PLAY_MODE_NONSTOP;
|
||||||
|
case COURSE_TYPE_ONI: return PLAY_MODE_ONI;
|
||||||
|
case COURSE_TYPE_ENDLESS: return PLAY_MODE_ENDLESS;
|
||||||
|
case COURSE_TYPE_SURVIVAL: return PLAY_MODE_BATTLE;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return PlayMode_Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
enum SongSort
|
enum SongSort
|
||||||
{
|
{
|
||||||
|
|||||||
+20
-26
@@ -543,29 +543,25 @@ ulg crc32(ulg crc, const uch *buf, size_t len)
|
|||||||
class TZip
|
class TZip
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TZip() : pfout(nullptr),ooffset(0),oerr(false),writ(0),hasputcen(false),zfis(0),hfin(0)
|
TZip() = default;
|
||||||
{
|
~TZip() = default;
|
||||||
}
|
|
||||||
~TZip()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// These variables say about the file we're writing into
|
// These variables say about the file we're writing into
|
||||||
// We can write to pipe, file-by-handle, file-by-name, memory-to-memmapfile
|
// We can write to pipe, file-by-handle, file-by-name, memory-to-memmapfile
|
||||||
RageFile *pfout; // if valid, we'll write here (for files or pipes)
|
RageFile *pfout{nullptr}; // if valid, we'll write here (for files or pipes)
|
||||||
unsigned ooffset; // for pfout, this is where the pointer was initially
|
unsigned ooffset{0}; // for pfout, this is where the pointer was initially
|
||||||
ZRESULT oerr; // did a write operation give rise to an error?
|
ZRESULT oerr{false}; // did a write operation give rise to an error?
|
||||||
unsigned writ; // how have we written. This is maintained by Add, not write(), to avoid confusion over seeks
|
unsigned writ{0}; // how have we written. This is maintained by Add, not write(), to avoid confusion over seeks
|
||||||
unsigned int opos; // current pos in the mmap
|
unsigned int opos{0}; // current pos in the mmap
|
||||||
unsigned int mapsize; // the size of the map we created
|
unsigned int mapsize{0}; // the size of the map we created
|
||||||
bool hasputcen; // have we yet placed the central directory?
|
bool hasputcen{false}; // have we yet placed the central directory?
|
||||||
//
|
//
|
||||||
TZipFileInfo *zfis; // each file gets added onto this list, for writing the table at the end
|
TZipFileInfo *zfis{nullptr}; // each file gets added onto this list, for writing the table at the end
|
||||||
|
|
||||||
ZRESULT Start(RageFile *f);
|
ZRESULT Start(RageFile *f);
|
||||||
static unsigned sflush(void *param,const char *buf, unsigned *size);
|
static unsigned sflush(void *param,const char *buf, unsigned *size);
|
||||||
static unsigned swrite(void *param,const char *buf, unsigned size);
|
static unsigned swrite(void *param,const char *buf, unsigned size);
|
||||||
unsigned int write(const char *buf,unsigned int size);
|
unsigned int write(const char *srcbuf,unsigned int size);
|
||||||
bool oseek(unsigned int pos);
|
bool oseek(unsigned int pos);
|
||||||
ZRESULT Close();
|
ZRESULT Close();
|
||||||
|
|
||||||
@@ -575,7 +571,7 @@ public:
|
|||||||
ulg attr; iztimes times; ulg timestamp; // all open_* methods set these
|
ulg attr; iztimes times; ulg timestamp; // all open_* methods set these
|
||||||
long isize,ired; // size is not set until close() on pips
|
long isize,ired; // size is not set until close() on pips
|
||||||
ulg crc; // crc is not set until close(). iwrit is cumulative
|
ulg crc; // crc is not set until close(). iwrit is cumulative
|
||||||
RageFile *hfin; // for input files and pipes
|
RageFile *hfin{nullptr}; // for input files and pipes
|
||||||
const char *bufin; unsigned int lenin,posin; // for memory
|
const char *bufin; unsigned int lenin,posin; // for memory
|
||||||
// and a variable for what we've done with the input: (i.e. compressed it!)
|
// and a variable for what we've done with the input: (i.e. compressed it!)
|
||||||
ulg csize; // compressed size, set by the compression routines
|
ulg csize; // compressed size, set by the compression routines
|
||||||
@@ -586,7 +582,7 @@ public:
|
|||||||
ZRESULT open_file(const TCHAR *fn);
|
ZRESULT open_file(const TCHAR *fn);
|
||||||
ZRESULT open_dir();
|
ZRESULT open_dir();
|
||||||
ZRESULT set_times();
|
ZRESULT set_times();
|
||||||
unsigned read(char *buf, unsigned size);
|
unsigned read(char *srcbuf, unsigned size);
|
||||||
ZRESULT iclose();
|
ZRESULT iclose();
|
||||||
|
|
||||||
ZRESULT ideflate(TZipFileInfo *zfi);
|
ZRESULT ideflate(TZipFileInfo *zfi);
|
||||||
@@ -628,13 +624,11 @@ unsigned TZip::swrite(void *param,const char *buf, unsigned size)
|
|||||||
TZip *zip=(TZip*)param;
|
TZip *zip=(TZip*)param;
|
||||||
return zip->write(buf,size);
|
return zip->write(buf,size);
|
||||||
}
|
}
|
||||||
unsigned int TZip::write(const char *buf,unsigned int size)
|
unsigned int TZip::write(const char *srcbuf,unsigned int size)
|
||||||
{
|
{
|
||||||
const char *srcbuf=buf;
|
|
||||||
if (pfout != nullptr)
|
if (pfout != nullptr)
|
||||||
{
|
{
|
||||||
unsigned long writ = pfout->Write( srcbuf, size );
|
return pfout->Write( srcbuf, size );
|
||||||
return writ;
|
|
||||||
}
|
}
|
||||||
oerr=ZR_NOTINITED;
|
oerr=ZR_NOTINITED;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -724,7 +718,7 @@ ZRESULT TZip::set_times()
|
|||||||
return ZR_OK;
|
return ZR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned TZip::read(char *buf, unsigned size)
|
unsigned TZip::read(char *srcbuf, unsigned size)
|
||||||
{
|
{
|
||||||
if (bufin!=0)
|
if (bufin!=0)
|
||||||
{
|
{
|
||||||
@@ -732,19 +726,19 @@ unsigned TZip::read(char *buf, unsigned size)
|
|||||||
ulg red = lenin-posin;
|
ulg red = lenin-posin;
|
||||||
if (red>size)
|
if (red>size)
|
||||||
red=size;
|
red=size;
|
||||||
memcpy(buf, bufin+posin, red);
|
memcpy(srcbuf, bufin+posin, red);
|
||||||
posin += red;
|
posin += red;
|
||||||
ired += red;
|
ired += red;
|
||||||
crc = crc32(crc, (uch*)buf, red);
|
crc = crc32(crc, (uch*)srcbuf, red);
|
||||||
return red;
|
return red;
|
||||||
}
|
}
|
||||||
else if (hfin!=0)
|
else if (hfin!=0)
|
||||||
{
|
{
|
||||||
int red = hfin->Read(buf,size);
|
int red = hfin->Read(srcbuf,size);
|
||||||
if (red <= 0)
|
if (red <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
ired += red;
|
ired += red;
|
||||||
crc = crc32(crc, (uch*)buf, red);
|
crc = crc32(crc, (uch*)srcbuf, red);
|
||||||
return red;
|
return red;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -3,7 +3,11 @@
|
|||||||
|
|
||||||
#if !defined(DISABLE_CRYPTO)
|
#if !defined(DISABLE_CRYPTO)
|
||||||
|
|
||||||
|
// tomcrypt_cfg.h redefines malloc, realloc, calloc
|
||||||
|
#pragma warning( push )
|
||||||
|
#pragma warning( disable : 4565 )
|
||||||
#include <tomcrypt.h>
|
#include <tomcrypt.h>
|
||||||
|
#pragma warning ( pop )
|
||||||
|
|
||||||
class PRNGWrapper
|
class PRNGWrapper
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
|
// tomcrypt_cfg.h redefines malloc, realloc, calloc
|
||||||
|
#pragma warning( push )
|
||||||
|
#pragma warning( disable : 4565 )
|
||||||
#include <tomcrypt.h>
|
#include <tomcrypt.h>
|
||||||
|
#pragma warning ( pop )
|
||||||
|
|
||||||
#include "CryptManager.h"
|
#include "CryptManager.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
|||||||
+3
-3
@@ -226,9 +226,9 @@ float loop_space_difference(float a, float b, float spatial_extent)
|
|||||||
if(spatial_extent == 0.0f) { return norm_diff; }
|
if(spatial_extent == 0.0f) { return norm_diff; }
|
||||||
const float plus_diff= a - (b + spatial_extent);
|
const float plus_diff= a - (b + spatial_extent);
|
||||||
const float minus_diff= a - (b - spatial_extent);
|
const float minus_diff= a - (b - spatial_extent);
|
||||||
const float abs_norm_diff= abs(norm_diff);
|
const float abs_norm_diff= std::abs(norm_diff);
|
||||||
const float abs_plus_diff= abs(plus_diff);
|
const float abs_plus_diff= std::abs(plus_diff);
|
||||||
const float abs_minus_diff= abs(minus_diff);
|
const float abs_minus_diff= std::abs(minus_diff);
|
||||||
if(abs_norm_diff < abs_plus_diff)
|
if(abs_norm_diff < abs_plus_diff)
|
||||||
{
|
{
|
||||||
if(abs_norm_diff < abs_minus_diff)
|
if(abs_norm_diff < abs_minus_diff)
|
||||||
|
|||||||
+12
-12
@@ -14,7 +14,7 @@
|
|||||||
/** @brief Specifies the max number of charts available for a song.
|
/** @brief Specifies the max number of charts available for a song.
|
||||||
*
|
*
|
||||||
* This includes autogenned charts. */
|
* This includes autogenned charts. */
|
||||||
#define MAX_METERS (NUM_Difficulty * NUM_StepsType) + MAX_EDITS_PER_SONG
|
inline constexpr auto MAX_METERS = (Enum::to_integral(NUM_Difficulty) * Enum::to_integral(NUM_StepsType)) + MAX_EDITS_PER_SONG;
|
||||||
|
|
||||||
REGISTER_ACTOR_CLASS( StepsDisplayList );
|
REGISTER_ACTOR_CLASS( StepsDisplayList );
|
||||||
|
|
||||||
@@ -24,8 +24,8 @@ StepsDisplayList::StepsDisplayList()
|
|||||||
|
|
||||||
FOREACH_ENUM( PlayerNumber, pn )
|
FOREACH_ENUM( PlayerNumber, pn )
|
||||||
{
|
{
|
||||||
SubscribeToMessage( (MessageID)(Message_CurrentStepsP1Changed+pn) );
|
SubscribeToMessage( (MessageID)(Message_CurrentStepsP1Changed+Enum::to_integral(pn)) );
|
||||||
SubscribeToMessage( (MessageID)(Message_CurrentTrailP1Changed+pn) );
|
SubscribeToMessage( (MessageID)(Message_CurrentTrailP1Changed+Enum::to_integral(pn)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,13 +213,13 @@ void StepsDisplayList::UpdatePositions()
|
|||||||
|
|
||||||
void StepsDisplayList::PositionItems()
|
void StepsDisplayList::PositionItems()
|
||||||
{
|
{
|
||||||
for( int i = 0; i < MAX_METERS; ++i )
|
for( size_t i = 0; i < MAX_METERS; ++i )
|
||||||
{
|
{
|
||||||
bool bUnused = ( i >= (int)m_Rows.size() );
|
bool bUnused = ( i >= m_Rows.size() );
|
||||||
m_Lines[i].m_Meter.SetVisible( !bUnused );
|
m_Lines[i].m_Meter.SetVisible( !bUnused );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int m = 0; m < (int)m_Rows.size(); ++m )
|
for( size_t m = 0; m < m_Rows.size(); ++m )
|
||||||
{
|
{
|
||||||
Row &row = m_Rows[m];
|
Row &row = m_Rows[m];
|
||||||
bool bHidden = row.m_bHidden;
|
bool bHidden = row.m_bHidden;
|
||||||
@@ -237,10 +237,10 @@ void StepsDisplayList::PositionItems()
|
|||||||
m_Lines[m].m_Meter.SetY( row.m_fY );
|
m_Lines[m].m_Meter.SetY( row.m_fY );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int m=0; m < MAX_METERS; ++m )
|
for( size_t m=0; m < MAX_METERS; ++m )
|
||||||
{
|
{
|
||||||
bool bHidden = true;
|
bool bHidden = true;
|
||||||
if( m_bShown && m < (int)m_Rows.size() )
|
if( m_bShown && m < m_Rows.size() )
|
||||||
bHidden = m_Rows[m].m_bHidden;
|
bHidden = m_Rows[m].m_bHidden;
|
||||||
|
|
||||||
float fDiffuseAlpha = bHidden?0.0f:1.0f;
|
float fDiffuseAlpha = bHidden?0.0f:1.0f;
|
||||||
@@ -303,7 +303,7 @@ void StepsDisplayList::SetFromGameState()
|
|||||||
UpdatePositions();
|
UpdatePositions();
|
||||||
PositionItems();
|
PositionItems();
|
||||||
|
|
||||||
for( int m = 0; m < MAX_METERS; ++m )
|
for( size_t m = 0; m < MAX_METERS; ++m )
|
||||||
m_Lines[m].m_Meter.FinishTweening();
|
m_Lines[m].m_Meter.FinishTweening();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ void StepsDisplayList::TweenOnScreen()
|
|||||||
FOREACH_HumanPlayer( pn )
|
FOREACH_HumanPlayer( pn )
|
||||||
ON_COMMAND( m_Cursors[pn] );
|
ON_COMMAND( m_Cursors[pn] );
|
||||||
|
|
||||||
for( int m = 0; m < MAX_METERS; ++m )
|
for( size_t m = 0; m < MAX_METERS; ++m )
|
||||||
ON_COMMAND( m_Lines[m].m_Meter );
|
ON_COMMAND( m_Lines[m].m_Meter );
|
||||||
|
|
||||||
this->SetHibernate( 0.5f );
|
this->SetHibernate( 0.5f );
|
||||||
@@ -373,8 +373,8 @@ void StepsDisplayList::HandleMessage( const Message &msg )
|
|||||||
{
|
{
|
||||||
FOREACH_ENUM( PlayerNumber, pn )
|
FOREACH_ENUM( PlayerNumber, pn )
|
||||||
{
|
{
|
||||||
if( msg.GetName() == MessageIDToString((MessageID)(Message_CurrentStepsP1Changed+pn)) ||
|
if( msg.GetName() == MessageIDToString((MessageID)(Message_CurrentStepsP1Changed+Enum::to_integral(pn))) ||
|
||||||
msg.GetName() == MessageIDToString((MessageID)(Message_CurrentTrailP1Changed+pn)) )
|
msg.GetName() == MessageIDToString((MessageID)(Message_CurrentTrailP1Changed+Enum::to_integral(pn))) )
|
||||||
SetFromGameState();
|
SetFromGameState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -89,14 +89,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a specification for a display supporting a single (and currently active) mode
|
// Create a specification for a display supporting a single (and currently active) mode
|
||||||
DisplaySpec(std::string id, std::string name, DisplayMode mode) : m_sId( id ), m_sName( name ), m_bIsVirtual( false ),
|
DisplaySpec(std::string id, std::string name, DisplayMode mode) : m_sId( id ), m_sName( name ),
|
||||||
m_bCurModeActive( true ), m_CurMode( mode )
|
m_bCurModeActive( true ), m_CurMode( mode ), m_bIsVirtual( false )
|
||||||
{
|
{
|
||||||
m_sModes.insert( mode );
|
m_sModes.insert( mode );
|
||||||
m_rectBounds = RectI( 0, 0, mode.width, mode.height );
|
m_rectBounds = RectI( 0, 0, mode.width, mode.height );
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplaySpec( const DisplaySpec &other ) = default;
|
DisplaySpec( const DisplaySpec &other ) = default;
|
||||||
|
DisplaySpec& operator=(const DisplaySpec& other) = default;
|
||||||
|
|
||||||
std::string name() const
|
std::string name() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ namespace Enum
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetMetatable( lua_State *L, LuaReference &EnumTable, LuaReference &EnumIndexTable, const char *szName );
|
void SetMetatable( lua_State *L, LuaReference &EnumTable, LuaReference &EnumIndexTable, const char *szName );
|
||||||
|
|
||||||
|
template<typename E>
|
||||||
|
constexpr auto to_integral(E e)
|
||||||
|
{
|
||||||
|
return static_cast<typename std::underlying_type<E>::type>(e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const RString &EnumToString( int iVal, int iMax, const char **szNameArray, std::unique_ptr<RString> *pNameCache ); // XToString helper
|
const RString &EnumToString( int iVal, int iMax, const char **szNameArray, std::unique_ptr<RString> *pNameCache ); // XToString helper
|
||||||
|
|||||||
+5
-5
@@ -254,7 +254,7 @@ int Font::GetLineHeightInSourcePixels( const std::wstring &szLine ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// width is a pointer so that we can return the used width through it.
|
// width is a pointer so that we can return the used width through it.
|
||||||
int Font::GetGlyphsThatFit(const std::wstring& line, int* width) const
|
size_t Font::GetGlyphsThatFit(const std::wstring& line, int* width) const
|
||||||
{
|
{
|
||||||
if(*width == 0)
|
if(*width == 0)
|
||||||
{
|
{
|
||||||
@@ -262,7 +262,7 @@ int Font::GetGlyphsThatFit(const std::wstring& line, int* width) const
|
|||||||
return line.size();
|
return line.size();
|
||||||
}
|
}
|
||||||
int curr_width= 0;
|
int curr_width= 0;
|
||||||
unsigned int i= 0;
|
size_t i= 0;
|
||||||
for(i= 0; i < line.size() && curr_width < *width; ++i)
|
for(i= 0; i < line.size() && curr_width < *width; ++i)
|
||||||
{
|
{
|
||||||
curr_width+= GetGlyph(line[i]).m_iHadvance;
|
curr_width+= GetGlyph(line[i]).m_iHadvance;
|
||||||
@@ -507,7 +507,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
|
|||||||
|
|
||||||
wchar_t c;
|
wchar_t c;
|
||||||
if( sCodepoint.substr(0, 2) == "U+" && IsHexVal(sCodepoint.substr(2)) )
|
if( sCodepoint.substr(0, 2) == "U+" && IsHexVal(sCodepoint.substr(2)) )
|
||||||
sscanf( sCodepoint.substr(2).c_str(), "%x", &c );
|
sscanf( sCodepoint.substr(2).c_str(), "%lc", &c );
|
||||||
else if( sCodepoint.size() > 0 &&
|
else if( sCodepoint.size() > 0 &&
|
||||||
utf8_get_char_len(sCodepoint[0]) == int(sCodepoint.size()) )
|
utf8_get_char_len(sCodepoint[0]) == int(sCodepoint.size()) )
|
||||||
{
|
{
|
||||||
@@ -558,11 +558,11 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
|
|||||||
}
|
}
|
||||||
// We must have either 1 match (just the codeset) or 4 (the whole thing).
|
// We must have either 1 match (just the codeset) or 4 (the whole thing).
|
||||||
int count = -1;
|
int count = -1;
|
||||||
int first = 0;
|
unsigned int first = 0;
|
||||||
if( !asMatches[2].empty() )
|
if( !asMatches[2].empty() )
|
||||||
{
|
{
|
||||||
sscanf( asMatches[2].c_str(), "%x", &first );
|
sscanf( asMatches[2].c_str(), "%x", &first );
|
||||||
int last;
|
unsigned int last;
|
||||||
sscanf( asMatches[3].c_str(), "%x", &last );
|
sscanf( asMatches[3].c_str(), "%x", &last );
|
||||||
if(last < first)
|
if(last < first)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -154,7 +154,7 @@ public:
|
|||||||
|
|
||||||
int GetLineWidthInSourcePixels( const std::wstring &szLine ) const;
|
int GetLineWidthInSourcePixels( const std::wstring &szLine ) const;
|
||||||
int GetLineHeightInSourcePixels( const std::wstring &szLine ) const;
|
int GetLineHeightInSourcePixels( const std::wstring &szLine ) const;
|
||||||
int GetGlyphsThatFit(const std::wstring& line, int* width) const;
|
size_t GetGlyphsThatFit(const std::wstring& line, int* width) const;
|
||||||
|
|
||||||
bool FontCompleteForString( const std::wstring &str ) const;
|
bool FontCompleteForString( const std::wstring &str ) const;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -81,7 +81,7 @@ void FontManager::UnloadFont( Font *fp )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FAIL_M( ssprintf("Unloaded an unknown font (%p)", fp) );
|
FAIL_M( ssprintf("Unloaded an unknown font (%p)", static_cast<void*>(fp)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+3
-1
@@ -543,8 +543,10 @@ static bool AreStyleAndPlayModeCompatible( const Style *style, PlayMode pm )
|
|||||||
if( style->m_StyleType==StyleType_OnePlayerTwoSides ||
|
if( style->m_StyleType==StyleType_OnePlayerTwoSides ||
|
||||||
style->m_StyleType==StyleType_TwoPlayersSharedSides )
|
style->m_StyleType==StyleType_TwoPlayersSharedSides )
|
||||||
return false;
|
return false;
|
||||||
default: return true;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameCommand::IsPlayable( RString *why ) const
|
bool GameCommand::IsPlayable( RString *why ) const
|
||||||
|
|||||||
+1
-2
@@ -98,7 +98,7 @@ static const StepsTypeInfo g_StepsTypeInfos[] = {
|
|||||||
{ "kickbox-insect", 6, true, StepsTypeCategory_Single },
|
{ "kickbox-insect", 6, true, StepsTypeCategory_Single },
|
||||||
{ "kickbox-arachnid", 8, true, StepsTypeCategory_Single },
|
{ "kickbox-arachnid", 8, true, StepsTypeCategory_Single },
|
||||||
};
|
};
|
||||||
|
static_assert( ARRAYLEN(g_StepsTypeInfos) == NUM_StepsType, "ARRAYLEN(g_StepsTypeInfos) != NUM_StepsType" );
|
||||||
|
|
||||||
// Important: Every game must define the buttons: "Start", "Back", "MenuLeft", "Operator" and "MenuRight"
|
// Important: Every game must define the buttons: "Start", "Back", "MenuLeft", "Operator" and "MenuRight"
|
||||||
static const AutoMappings g_AutoKeyMappings_Dance = AutoMappings (
|
static const AutoMappings g_AutoKeyMappings_Dance = AutoMappings (
|
||||||
@@ -3441,7 +3441,6 @@ bool GameManager::IsGameEnabled( const Game *pGame )
|
|||||||
|
|
||||||
const StepsTypeInfo &GameManager::GetStepsTypeInfo( StepsType st )
|
const StepsTypeInfo &GameManager::GetStepsTypeInfo( StepsType st )
|
||||||
{
|
{
|
||||||
ASSERT( ARRAYLEN(g_StepsTypeInfos) == NUM_StepsType );
|
|
||||||
ASSERT_M( st < NUM_StepsType, ssprintf("StepsType %d < NUM_StepsType (%d)", st, NUM_StepsType) );
|
ASSERT_M( st < NUM_StepsType, ssprintf("StepsType %d < NUM_StepsType (%d)", st, NUM_StepsType) );
|
||||||
return g_StepsTypeInfos[st];
|
return g_StepsTypeInfos[st];
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1153,7 +1153,7 @@ void GameState::Update( float fDelta )
|
|||||||
if( !m_bGoalComplete[p] && IsGoalComplete(p) )
|
if( !m_bGoalComplete[p] && IsGoalComplete(p) )
|
||||||
{
|
{
|
||||||
m_bGoalComplete[p] = true;
|
m_bGoalComplete[p] = true;
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_GoalCompleteP1+p) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_GoalCompleteP1+Enum::to_integral(p)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1844,7 +1844,7 @@ StageResult GameState::GetStageResult( PlayerNumber pn ) const
|
|||||||
{
|
{
|
||||||
case PLAYER_1: return (m_fTugLifePercentP1>=0.5f)?RESULT_WIN:RESULT_LOSE;
|
case PLAYER_1: return (m_fTugLifePercentP1>=0.5f)?RESULT_WIN:RESULT_LOSE;
|
||||||
case PLAYER_2: return (m_fTugLifePercentP1<0.5f)?RESULT_WIN:RESULT_LOSE;
|
case PLAYER_2: return (m_fTugLifePercentP1<0.5f)?RESULT_WIN:RESULT_LOSE;
|
||||||
default: FAIL_M("Invalid player for battle! Aborting..."); return RESULT_LOSE;
|
default: FAIL_M("Invalid player for battle! Aborting...");
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ Grade GradeToOldGrade( Grade g )
|
|||||||
// There used to be 7 grades (plus fail) but grades can now be defined by themes.
|
// There used to be 7 grades (plus fail) but grades can now be defined by themes.
|
||||||
// So we need to re-scale the grade bands based on how many actual grades the theme defines.
|
// So we need to re-scale the grade bands based on how many actual grades the theme defines.
|
||||||
if( g < NUM_GRADE_TIERS_USED )
|
if( g < NUM_GRADE_TIERS_USED )
|
||||||
g = (Grade)std::lround((double)g * Grade_Tier07 / (NUM_GRADE_TIERS_USED - 1));
|
g = (Grade)std::lround((double)g * Enum::to_integral(Grade_Tier07) / (NUM_GRADE_TIERS_USED - 1));
|
||||||
|
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ bool IniFile::ReadFile( RageFileBasic &f )
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
keyvalue:
|
keyvalue:
|
||||||
if(keychild == nullptr)
|
if(keychild == nullptr)
|
||||||
|
|||||||
+1
-1
@@ -112,7 +112,7 @@ namespace
|
|||||||
* For pad play, a value of 20ms-50ms seems to result in a better experience.
|
* For pad play, a value of 20ms-50ms seems to result in a better experience.
|
||||||
* For keyboard play, this is often set to 0.
|
* For keyboard play, this is often set to 0.
|
||||||
* */
|
* */
|
||||||
static Preference<float> g_fInputDebounceTime( "InputDebounceTime", 0.02 );
|
static Preference<float> g_fInputDebounceTime( "InputDebounceTime", 0.02f );
|
||||||
|
|
||||||
InputFilter* INPUTFILTER = nullptr; // global and accessible from anywhere in our program
|
InputFilter* INPUTFILTER = nullptr; // global and accessible from anywhere in our program
|
||||||
|
|
||||||
|
|||||||
@@ -362,6 +362,7 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fall through to blink on button presses
|
// fall through to blink on button presses
|
||||||
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
|
|
||||||
case LIGHTSMODE_DEMONSTRATION:
|
case LIGHTSMODE_DEMONSTRATION:
|
||||||
@@ -383,6 +384,7 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fall through to blink on button presses
|
// fall through to blink on button presses
|
||||||
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
|
|
||||||
case LIGHTSMODE_ATTRACT:
|
case LIGHTSMODE_ATTRACT:
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ bool LyricsLoader::LoadFromLRCFile(const RString& sPath, Song& out)
|
|||||||
if( sValueName.EqualsNoCase("COLOUR") || sValueName.EqualsNoCase("COLOR") )
|
if( sValueName.EqualsNoCase("COLOUR") || sValueName.EqualsNoCase("COLOR") )
|
||||||
{
|
{
|
||||||
// set color var here for this segment
|
// set color var here for this segment
|
||||||
int r, g, b;
|
unsigned int r, g, b;
|
||||||
int result = sscanf( sValueData.c_str(), "0x%2x%2x%2x", &r, &g, &b );
|
int result = sscanf( sValueData.c_str(), "0x%2x%2x%2x", &r, &g, &b );
|
||||||
// According to the Dance With Intensity readme, one can set up to
|
// According to the Dance With Intensity readme, one can set up to
|
||||||
// ten colors in a line and access them via "{cX}", where X is 0-9.
|
// ten colors in a line and access them via "{cX}", where X is 0-9.
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ void MemoryCardManager::CheckStateChanges()
|
|||||||
if( LastState == MemoryCardState_Ready )
|
if( LastState == MemoryCardState_Ready )
|
||||||
{
|
{
|
||||||
m_soundDisconnect.Play(true, ¶ms);
|
m_soundDisconnect.Play(true, ¶ms);
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_CardRemovedP1+p) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_CardRemovedP1+Enum::to_integral(p)) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MemoryCardState_Ready:
|
case MemoryCardState_Ready:
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ void ModIcon::Load( RString sMetricsGroup )
|
|||||||
|
|
||||||
// stop words
|
// stop words
|
||||||
STOP_WORDS.Load( sMetricsGroup, "StopWords" );
|
STOP_WORDS.Load( sMetricsGroup, "StopWords" );
|
||||||
m_vStopWords.empty();
|
// TODO should m_vStopWords be cleared?
|
||||||
split(STOP_WORDS, ",", m_vStopWords);
|
split(STOP_WORDS, ",", m_vStopWords);
|
||||||
|
|
||||||
Set("");
|
Set("");
|
||||||
|
|||||||
+1
-4
@@ -152,10 +152,7 @@ void ModIconRow::SetFromGameState()
|
|||||||
{
|
{
|
||||||
RString sOption = vsOptions[i];
|
RString sOption = vsOptions[i];
|
||||||
int iPerferredCol = OptionToPreferredColumn( sOption );
|
int iPerferredCol = OptionToPreferredColumn( sOption );
|
||||||
clamp( iPerferredCol, 0, (int)m_vpModIcon.size()-1 );
|
iPerferredCol = clamp( iPerferredCol, 0, (int)m_vpModIcon.size()-1 );
|
||||||
|
|
||||||
if( iPerferredCol == -1 )
|
|
||||||
continue; // skip
|
|
||||||
|
|
||||||
// search for a vacant spot
|
// search for a vacant spot
|
||||||
for( int j=iPerferredCol; j<NUM_OPTION_ICONS; j++ )
|
for( int j=iPerferredCol; j<NUM_OPTION_ICONS; j++ )
|
||||||
|
|||||||
+4
-4
@@ -181,7 +181,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( const RString &_sPath )
|
|||||||
RageVector4 Ambient;
|
RageVector4 Ambient;
|
||||||
if( sscanf(sLine, "%f %f %f %f", &Ambient[0], &Ambient[1], &Ambient[2], &Ambient[3]) != 4 )
|
if( sscanf(sLine, "%f %f %f %f", &Ambient[0], &Ambient[1], &Ambient[2], &Ambient[3]) != 4 )
|
||||||
THROW;
|
THROW;
|
||||||
memcpy( &Material.Ambient, &Ambient, sizeof(Material.Ambient) );
|
Material.Ambient = Ambient;
|
||||||
|
|
||||||
// diffuse
|
// diffuse
|
||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
@@ -189,7 +189,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( const RString &_sPath )
|
|||||||
RageVector4 Diffuse;
|
RageVector4 Diffuse;
|
||||||
if( sscanf(sLine, "%f %f %f %f", &Diffuse[0], &Diffuse[1], &Diffuse[2], &Diffuse[3]) != 4 )
|
if( sscanf(sLine, "%f %f %f %f", &Diffuse[0], &Diffuse[1], &Diffuse[2], &Diffuse[3]) != 4 )
|
||||||
THROW;
|
THROW;
|
||||||
memcpy( &Material.Diffuse, &Diffuse, sizeof(Material.Diffuse) );
|
Material.Diffuse = Diffuse;
|
||||||
|
|
||||||
// specular
|
// specular
|
||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
@@ -197,7 +197,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( const RString &_sPath )
|
|||||||
RageVector4 Specular;
|
RageVector4 Specular;
|
||||||
if( sscanf(sLine, "%f %f %f %f", &Specular[0], &Specular[1], &Specular[2], &Specular[3]) != 4 )
|
if( sscanf(sLine, "%f %f %f %f", &Specular[0], &Specular[1], &Specular[2], &Specular[3]) != 4 )
|
||||||
THROW;
|
THROW;
|
||||||
memcpy( &Material.Specular, &Specular, sizeof(Material.Specular) );
|
Material.Specular = Specular;
|
||||||
|
|
||||||
// emissive
|
// emissive
|
||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
@@ -205,7 +205,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( const RString &_sPath )
|
|||||||
RageVector4 Emissive;
|
RageVector4 Emissive;
|
||||||
if( sscanf (sLine, "%f %f %f %f", &Emissive[0], &Emissive[1], &Emissive[2], &Emissive[3]) != 4 )
|
if( sscanf (sLine, "%f %f %f %f", &Emissive[0], &Emissive[1], &Emissive[2], &Emissive[3]) != 4 )
|
||||||
THROW;
|
THROW;
|
||||||
memcpy( &Material.Emissive, &Emissive, sizeof(Material.Emissive) );
|
Material.Emissive = Emissive;
|
||||||
|
|
||||||
// shininess
|
// shininess
|
||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
|
|||||||
+2
-2
@@ -56,6 +56,8 @@ public:
|
|||||||
// Lua
|
// Lua
|
||||||
virtual void PushSelf( lua_State *L );
|
virtual void PushSelf( lua_State *L );
|
||||||
|
|
||||||
|
Model& operator=(const Model& rhs) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RageModelGeometry *m_pGeometry;
|
RageModelGeometry *m_pGeometry;
|
||||||
|
|
||||||
@@ -86,8 +88,6 @@ private:
|
|||||||
float m_fCurAnimationRate;
|
float m_fCurAnimationRate;
|
||||||
bool m_bLoop;
|
bool m_bLoop;
|
||||||
bool m_bDrawCelShaded; // for Lua models
|
bool m_bDrawCelShaded; // for Lua models
|
||||||
|
|
||||||
Model& operator=(const Model& rhs);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+6
-3
@@ -59,9 +59,12 @@ static SortOrder ForceAppropriateSort( PlayMode pm, SortOrder so )
|
|||||||
case SORT_NONSTOP_COURSES:
|
case SORT_NONSTOP_COURSES:
|
||||||
case SORT_ENDLESS_COURSES:
|
case SORT_ENDLESS_COURSES:
|
||||||
so = SortOrder_Invalid;
|
so = SortOrder_Invalid;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return so;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return so;
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicWheelItem *MusicWheel::MakeItem()
|
MusicWheelItem *MusicWheel::MakeItem()
|
||||||
@@ -152,7 +155,7 @@ void MusicWheel::BeginScreen()
|
|||||||
const std::vector<MusicWheelItemData *> &from = getWheelItemsData(SORT_MODE_MENU);
|
const std::vector<MusicWheelItemData *> &from = getWheelItemsData(SORT_MODE_MENU);
|
||||||
for( unsigned i=0; i<from.size(); i++ )
|
for( unsigned i=0; i<from.size(); i++ )
|
||||||
{
|
{
|
||||||
ASSERT( &*from[i]->m_pAction != nullptr );
|
ASSERT( !from[i]->m_pAction.isNull() );
|
||||||
if( from[i]->m_pAction->DescribesCurrentModeForAllPlayers() )
|
if( from[i]->m_pAction->DescribesCurrentModeForAllPlayers() )
|
||||||
{
|
{
|
||||||
m_sLastModeMenuItem = from[i]->m_pAction->m_sName;
|
m_sLastModeMenuItem = from[i]->m_pAction->m_sName;
|
||||||
@@ -427,7 +430,7 @@ void MusicWheel::GetSongList( std::vector<Song*> &arraySongs, SortOrder so )
|
|||||||
apAllSongs = SONGMAN->GetSongs(GAMESTATE->m_sPreferredSongGroup);
|
apAllSongs = SONGMAN->GetSongs(GAMESTATE->m_sPreferredSongGroup);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// otherwise fall through
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
apAllSongs = SONGMAN->GetAllSongs();
|
apAllSongs = SONGMAN->GetAllSongs();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -424,14 +424,14 @@ void MusicWheelItem::HandleMessage( const Message &msg )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Message msg( "Set" );
|
Message tmpMsg( "Set" );
|
||||||
msg.SetParam( "Song", pWID->m_pSong );
|
tmpMsg.SetParam( "Song", pWID->m_pSong );
|
||||||
msg.SetParam( "Course", pWID->m_pCourse );
|
tmpMsg.SetParam( "Course", pWID->m_pCourse );
|
||||||
msg.SetParam( "Text", pWID->m_sText );
|
tmpMsg.SetParam( "Text", pWID->m_sText );
|
||||||
msg.SetParam( "Type", MusicWheelItemTypeToString(type) );
|
tmpMsg.SetParam( "Type", MusicWheelItemTypeToString(type) );
|
||||||
msg.SetParam( "Color", pWID->m_color );
|
tmpMsg.SetParam( "Color", pWID->m_color );
|
||||||
msg.SetParam( "Label", pWID->m_sLabel );
|
tmpMsg.SetParam( "Label", pWID->m_sLabel );
|
||||||
this->HandleMessage( msg );
|
this->HandleMessage( tmpMsg );
|
||||||
|
|
||||||
RefreshGrades();
|
RefreshGrades();
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-6
@@ -30,7 +30,7 @@ bool NoteData::IsComposite() const
|
|||||||
{
|
{
|
||||||
for( int track = 0; track < GetNumTracks(); ++track )
|
for( int track = 0; track < GetNumTracks(); ++track )
|
||||||
{
|
{
|
||||||
for (std::pair<int, TapNote> const &tn : m_TapNotes[track])
|
for (const auto& tn : m_TapNotes[track])
|
||||||
if( tn.second.pn != PLAYER_INVALID )
|
if( tn.second.pn != PLAYER_INVALID )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1340,12 +1340,24 @@ NoteData::_all_tracks_iterator<ND, iter, TN>::_all_tracks_iterator( const _all_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename ND, typename iter, typename TN>
|
template<typename ND, typename iter, typename TN>
|
||||||
NoteData::_all_tracks_iterator<ND, iter, TN>::~_all_tracks_iterator()
|
NoteData::_all_tracks_iterator<ND, iter, TN> &NoteData::_all_tracks_iterator<ND, iter, TN>::operator=( const _all_tracks_iterator &other )
|
||||||
{
|
{
|
||||||
if(m_pNoteData != nullptr)
|
_all_tracks_iterator tmp (other);
|
||||||
{
|
|
||||||
m_pNoteData->RemoveATIFromList(this);
|
#define SWAP_OTHER( x ) std::swap( x, tmp.x )
|
||||||
}
|
SWAP_OTHER( m_pNoteData );
|
||||||
|
SWAP_OTHER( m_vBeginIters );
|
||||||
|
SWAP_OTHER( m_vCurrentIters );
|
||||||
|
SWAP_OTHER( m_vEndIters );
|
||||||
|
SWAP_OTHER( m_iTrack );
|
||||||
|
SWAP_OTHER( m_bReverse );
|
||||||
|
SWAP_OTHER( m_PrevCurrentRows );
|
||||||
|
SWAP_OTHER( m_StartRow );
|
||||||
|
SWAP_OTHER( m_EndRow );
|
||||||
|
#undef SWAP_OTHER
|
||||||
|
m_pNoteData->AddATIToList(this);
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ND, typename iter, typename TN>
|
template<typename ND, typename iter, typename TN>
|
||||||
|
|||||||
+2
-1
@@ -81,7 +81,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
_all_tracks_iterator( ND &nd, int iStartRow, int iEndRow, bool bReverse, bool bInclusive );
|
_all_tracks_iterator( ND &nd, int iStartRow, int iEndRow, bool bReverse, bool bInclusive );
|
||||||
_all_tracks_iterator( const _all_tracks_iterator &other );
|
_all_tracks_iterator( const _all_tracks_iterator &other );
|
||||||
~_all_tracks_iterator();
|
~_all_tracks_iterator() { if(m_pNoteData != nullptr) { m_pNoteData->RemoveATIFromList(this); } }
|
||||||
|
_all_tracks_iterator &operator=( const _all_tracks_iterator &other );
|
||||||
_all_tracks_iterator &operator++(); // preincrement
|
_all_tracks_iterator &operator++(); // preincrement
|
||||||
_all_tracks_iterator operator++( int dummy ); // postincrement
|
_all_tracks_iterator operator++( int dummy ); // postincrement
|
||||||
//_all_tracks_iterator &operator--(); // predecrement
|
//_all_tracks_iterator &operator--(); // predecrement
|
||||||
|
|||||||
@@ -1514,6 +1514,7 @@ static void GetTrackMapping( StepsType st, NoteDataUtil::TrackMapping tt, int Nu
|
|||||||
}
|
}
|
||||||
if (needsBackwards) break;
|
if (needsBackwards) break;
|
||||||
}
|
}
|
||||||
|
[[fallthrough]];
|
||||||
case NoteDataUtil::mirror:
|
case NoteDataUtil::mirror:
|
||||||
{
|
{
|
||||||
for( int t=0; t<NumTracks; t++ )
|
for( int t=0; t<NumTracks; t++ )
|
||||||
@@ -1973,7 +1974,7 @@ static void HyperShuffleNotes( NoteData &inout, int iStartIndex, int iEndIndex)
|
|||||||
std::shuffle(viTargetTracks.begin(), viTargetTracks.end(), g_RandomNumberGenerator);
|
std::shuffle(viTargetTracks.begin(), viTargetTracks.end(), g_RandomNumberGenerator);
|
||||||
|
|
||||||
// Go through the tracks in their shuffled order and drop tap notes.
|
// Go through the tracks in their shuffled order and drop tap notes.
|
||||||
for(int i = 0; i < viTargetTracks.size(); i++)
|
for(size_t i = 0; i < viTargetTracks.size(); i++)
|
||||||
{
|
{
|
||||||
const int targetTrack = viTargetTracks[i];
|
const int targetTrack = viTargetTracks[i];
|
||||||
const TapNote current_tn = vtnTargetTaps[i];
|
const TapNote current_tn = vtnTargetTaps[i];
|
||||||
|
|||||||
+1
-1
@@ -983,7 +983,7 @@ void NoteDisplay::DrawHoldPart(std::vector<Sprite*> &vpSpr,
|
|||||||
|
|
||||||
// (step 2 of vector handling)
|
// (step 2 of vector handling)
|
||||||
RageVector3 render_left;
|
RageVector3 render_left;
|
||||||
if(abs(render_forward.z) > 0.9f) // 0.9 arbitrariliy picked.
|
if(std::abs(render_forward.z) > 0.9f) // 0.9 arbitrariliy picked.
|
||||||
{
|
{
|
||||||
RageVec3Cross(&render_left, &pos_y_vec, &render_forward);
|
RageVec3Cross(&render_left, &pos_y_vec, &render_forward);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-8
@@ -674,7 +674,7 @@ float FindLastDisplayedBeat( const PlayerState* pPlayerState, int iDrawDistanceB
|
|||||||
|
|
||||||
bool bBoomerang;
|
bool bBoomerang;
|
||||||
{
|
{
|
||||||
const float* fAccels = pPlayerState->m_PlayerOptions.GetCurrent().m_fAccels;
|
const auto& fAccels = pPlayerState->m_PlayerOptions.GetCurrent().m_fAccels;
|
||||||
bBoomerang = (fAccels[PlayerOptions::ACCEL_BOOMERANG] != 0);
|
bBoomerang = (fAccels[PlayerOptions::ACCEL_BOOMERANG] != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -794,13 +794,12 @@ void NoteField::DrawPrimitives()
|
|||||||
FOREACH_TimingSegmentType( tst )
|
FOREACH_TimingSegmentType( tst )
|
||||||
segs[tst] = &(pTiming->GetTimingSegments(tst));
|
segs[tst] = &(pTiming->GetTimingSegments(tst));
|
||||||
|
|
||||||
unsigned i = 0;
|
|
||||||
// Draw beat bars
|
// Draw beat bars
|
||||||
if( ( GAMESTATE->IsEditing() || SHOW_BEAT_BARS ) && pTiming != nullptr )
|
if( ( GAMESTATE->IsEditing() || SHOW_BEAT_BARS ) && pTiming != nullptr )
|
||||||
{
|
{
|
||||||
const std::vector<TimingSegment *> &tSigs = *segs[SEGMENT_TIME_SIG];
|
const std::vector<TimingSegment *> &tSigs = *segs[SEGMENT_TIME_SIG];
|
||||||
int iMeasureIndex = 0;
|
int iMeasureIndex = 0;
|
||||||
for (i = 0; i < tSigs.size(); i++)
|
for (size_t i = 0; i < tSigs.size(); i++)
|
||||||
{
|
{
|
||||||
const TimeSignatureSegment *ts = ToTimeSignature(tSigs[i]);
|
const TimeSignatureSegment *ts = ToTimeSignature(tSigs[i]);
|
||||||
int iSegmentEndRow = (i + 1 == tSigs.size()) ? m_FieldRenderArgs.last_row : tSigs[i+1]->GetRow();
|
int iSegmentEndRow = (i + 1 == tSigs.size()) ? m_FieldRenderArgs.last_row : tSigs[i+1]->GetRow();
|
||||||
@@ -848,7 +847,7 @@ void NoteField::DrawPrimitives()
|
|||||||
#define draw_all_segments(str_exp, name, caps_name) \
|
#define draw_all_segments(str_exp, name, caps_name) \
|
||||||
horiz_align= caps_name##_IS_LEFT_SIDE ? align_right : align_left; \
|
horiz_align= caps_name##_IS_LEFT_SIDE ? align_right : align_left; \
|
||||||
side_sign= caps_name##_IS_LEFT_SIDE ? -1 : 1; \
|
side_sign= caps_name##_IS_LEFT_SIDE ? -1 : 1; \
|
||||||
for(unsigned int i= 0; i < segs[SEGMENT_##caps_name]->size(); ++i) \
|
for(size_t i= 0; i < segs[SEGMENT_##caps_name]->size(); ++i) \
|
||||||
{ \
|
{ \
|
||||||
const name##Segment* seg= To##name((*segs[SEGMENT_##caps_name])[i]); \
|
const name##Segment* seg= To##name((*segs[SEGMENT_##caps_name])[i]); \
|
||||||
if(seg->GetRow() >= m_FieldRenderArgs.first_row && \
|
if(seg->GetRow() >= m_FieldRenderArgs.first_row && \
|
||||||
@@ -903,9 +902,6 @@ void NoteField::DrawPrimitives()
|
|||||||
AttackArray &attacks = GAMESTATE->m_bIsUsingStepTiming ?
|
AttackArray &attacks = GAMESTATE->m_bIsUsingStepTiming ?
|
||||||
GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks :
|
GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks :
|
||||||
GAMESTATE->m_pCurSong->m_Attacks;
|
GAMESTATE->m_pCurSong->m_Attacks;
|
||||||
// XXX: We're somehow getting here when attacks is null. Find the actual cause later.
|
|
||||||
if (&attacks)
|
|
||||||
{
|
|
||||||
for (Attack const &a : attacks)
|
for (Attack const &a : attacks)
|
||||||
{
|
{
|
||||||
float fBeat = timing.GetBeatFromElapsedTime(a.fStartSecond);
|
float fBeat = timing.GetBeatFromElapsedTime(a.fStartSecond);
|
||||||
@@ -917,7 +913,6 @@ void NoteField::DrawPrimitives()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( !GAMESTATE->m_bIsUsingStepTiming )
|
if( !GAMESTATE->m_bIsUsingStepTiming )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -544,9 +544,8 @@ bool BMSChart::Load( const RString &chartPath )
|
|||||||
std::vector<RString> lines;
|
std::vector<RString> lines;
|
||||||
Tree.evaluateBMSTree(headers, lines);
|
Tree.evaluateBMSTree(headers, lines);
|
||||||
|
|
||||||
for (std::vector<RString>::iterator i = lines.begin(); i != lines.end(); ++i)
|
for (const auto& line : lines)
|
||||||
{
|
{
|
||||||
RString line = *i;
|
|
||||||
RString data = line.substr(7);
|
RString data = line.substr(7);
|
||||||
int measure = atoi(line.substr(1, 3).c_str());
|
int measure = atoi(line.substr(1, 3).c_str());
|
||||||
int channel = atoi(line.substr(4, 2).c_str());
|
int channel = atoi(line.substr(4, 2).c_str());
|
||||||
@@ -963,6 +962,8 @@ StepsType BMSChartReader::DetermineStepsType()
|
|||||||
case 4: return StepsType_dance_single;
|
case 4: return StepsType_dance_single;
|
||||||
case 5:
|
case 5:
|
||||||
if( nonEmptyTracks.find(BMS_RAW_P2_KEY2) != nonEmptyTracks.end() ) return StepsType_popn_five;
|
if( nonEmptyTracks.find(BMS_RAW_P2_KEY2) != nonEmptyTracks.end() ) return StepsType_popn_five;
|
||||||
|
|
||||||
|
[[fallthrough]];
|
||||||
case 6:
|
case 6:
|
||||||
// FIXME: There's no way to distinguish between these types.
|
// FIXME: There's no way to distinguish between these types.
|
||||||
// They use the same number of tracks. Assume it's a Beat
|
// They use the same number of tracks. Assume it's a Beat
|
||||||
@@ -1087,7 +1088,7 @@ bmFrac toFraction(double f)
|
|||||||
long long upper = 1LL, lower = 1LL;
|
long long upper = 1LL, lower = 1LL;
|
||||||
df = 1;
|
df = 1;
|
||||||
|
|
||||||
while (abs(df - f) > 0.000001)
|
while (std::abs(df - f) > 0.000001)
|
||||||
{
|
{
|
||||||
if (df < f)
|
if (df < f)
|
||||||
{
|
{
|
||||||
@@ -1326,7 +1327,7 @@ bool BMSChartReader::ReadNoteData()
|
|||||||
|
|
||||||
if( channel == 3 ) // bpm change
|
if( channel == 3 ) // bpm change
|
||||||
{
|
{
|
||||||
int bpm;
|
unsigned int bpm;
|
||||||
if( sscanf(obj.value, "%x", &bpm) == 1 )
|
if( sscanf(obj.value, "%x", &bpm) == 1 )
|
||||||
{
|
{
|
||||||
if( bpm > 0 ) td.SetBPMAtRow( row, measureAdjust * (currentBPM = bpm) );
|
if( bpm > 0 ) td.SetBPMAtRow( row, measureAdjust * (currentBPM = bpm) );
|
||||||
|
|||||||
@@ -89,21 +89,17 @@ static void Deserialize(BackgroundChange &o, const Json::Value &root )
|
|||||||
|
|
||||||
static void Deserialize( TapNote &o, const Json::Value &root )
|
static void Deserialize( TapNote &o, const Json::Value &root )
|
||||||
{
|
{
|
||||||
//if( o.type != TapNoteType_Tap )
|
if( root.isInt() ) {
|
||||||
if( root.isInt() )
|
|
||||||
o.type = (TapNoteType)root["Type"].asInt();
|
o.type = (TapNoteType)root["Type"].asInt();
|
||||||
//if( o.type == TapNoteType_HoldHead )
|
}
|
||||||
|
|
||||||
|
// TODO should all of this also be within the if statement?
|
||||||
|
// It was not in the if statement previously, but that may have been unintentional.
|
||||||
o.subType = (TapNoteSubType)root["SubType"].asInt();
|
o.subType = (TapNoteSubType)root["SubType"].asInt();
|
||||||
//root["Source"] = (int)source;
|
|
||||||
//if( !o.sAttackModifiers.empty() )
|
|
||||||
o.sAttackModifiers = root["AttackModifiers"].asString();
|
o.sAttackModifiers = root["AttackModifiers"].asString();
|
||||||
//if( o.fAttackDurationSeconds > 0 )
|
|
||||||
o.fAttackDurationSeconds = (float)root["AttackDurationSeconds"].asDouble();
|
o.fAttackDurationSeconds = (float)root["AttackDurationSeconds"].asDouble();
|
||||||
//if( o.bKeysound )
|
|
||||||
o.iKeysoundIndex = root["KeysoundIndex"].asInt();
|
o.iKeysoundIndex = root["KeysoundIndex"].asInt();
|
||||||
//if( o.iDuration > 0 )
|
|
||||||
o.iDuration = root["Duration"].asInt();
|
o.iDuration = root["Duration"].asInt();
|
||||||
//if( o.pn != PLAYER_INVALID )
|
|
||||||
o.pn = (PlayerNumber)root["PlayerNumber"].asInt();
|
o.pn = (PlayerNumber)root["PlayerNumber"].asInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -952,10 +952,10 @@ bool SMLoader::LoadFromBGChangesVector( BackgroundChange &change, std::vector<RS
|
|||||||
change.m_def.m_sColor1 = aBGChangeValues[9];
|
change.m_def.m_sColor1 = aBGChangeValues[9];
|
||||||
change.m_def.m_sColor1.Replace( '^', ',' );
|
change.m_def.m_sColor1.Replace( '^', ',' );
|
||||||
change.m_def.m_sColor1 = RageColor::NormalizeColorString( change.m_def.m_sColor1 );
|
change.m_def.m_sColor1 = RageColor::NormalizeColorString( change.m_def.m_sColor1 );
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
case 9:
|
case 9:
|
||||||
change.m_sTransition = aBGChangeValues[8];
|
change.m_sTransition = aBGChangeValues[8];
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
RString tmp = aBGChangeValues[7];
|
RString tmp = aBGChangeValues[7];
|
||||||
@@ -966,11 +966,11 @@ bool SMLoader::LoadFromBGChangesVector( BackgroundChange &change, std::vector<RS
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
change.m_def.m_sFile2 = aBGChangeValues[7];
|
change.m_def.m_sFile2 = aBGChangeValues[7];
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
change.m_def.m_sEffect = aBGChangeValues[6];
|
change.m_def.m_sEffect = aBGChangeValues[6];
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
case 6:
|
case 6:
|
||||||
// param 7 overrides this.
|
// param 7 overrides this.
|
||||||
// Backward compatibility:
|
// Backward compatibility:
|
||||||
@@ -990,16 +990,16 @@ bool SMLoader::LoadFromBGChangesVector( BackgroundChange &change, std::vector<RS
|
|||||||
if( bRewindMovie )
|
if( bRewindMovie )
|
||||||
change.m_def.m_sEffect = SBE_StretchRewind;
|
change.m_def.m_sEffect = SBE_StretchRewind;
|
||||||
}
|
}
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
case 4:
|
case 4:
|
||||||
// param 9 overrides this.
|
// param 9 overrides this.
|
||||||
// Backward compatibility:
|
// Backward compatibility:
|
||||||
if( change.m_sTransition.empty() )
|
if( change.m_sTransition.empty() )
|
||||||
change.m_sTransition = (StringToInt( aBGChangeValues[3] ) != 0) ? "CrossFade" : "";
|
change.m_sTransition = (StringToInt( aBGChangeValues[3] ) != 0) ? "CrossFade" : "";
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
case 3:
|
case 3:
|
||||||
change.m_fRate = StringToFloat( aBGChangeValues[2] );
|
change.m_fRate = StringToFloat( aBGChangeValues[2] );
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
RString tmp = aBGChangeValues[1];
|
RString tmp = aBGChangeValues[1];
|
||||||
@@ -1010,11 +1010,10 @@ bool SMLoader::LoadFromBGChangesVector( BackgroundChange &change, std::vector<RS
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
change.m_def.m_sFile1 = aBGChangeValues[1];
|
change.m_def.m_sFile1 = aBGChangeValues[1];
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
change.m_fStartBeat = StringToFloat( aBGChangeValues[0] );
|
change.m_fStartBeat = StringToFloat( aBGChangeValues[0] );
|
||||||
// fall through
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return aBGChangeValues.size() >= 2;
|
return aBGChangeValues.size() >= 2;
|
||||||
@@ -1461,6 +1460,7 @@ void SMLoader::ParseBGChangesString(const RString& _sChanges, std::vector<std::v
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// deliberate fall-through if not found. treat it as a normal string like before
|
// deliberate fall-through if not found. treat it as a normal string like before
|
||||||
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
// everything else should be safe
|
// everything else should be safe
|
||||||
default:
|
default:
|
||||||
|
|||||||
+4
-1
@@ -857,7 +857,7 @@ void OptionRow::Reload()
|
|||||||
ImportOptions( vpns );
|
ImportOptions( vpns );
|
||||||
FOREACH_HumanPlayer( p )
|
FOREACH_HumanPlayer( p )
|
||||||
AfterImportOptions( p );
|
AfterImportOptions( p );
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
|
|
||||||
case RELOAD_CHANGED_ENABLED:
|
case RELOAD_CHANGED_ENABLED:
|
||||||
@@ -865,6 +865,9 @@ void OptionRow::Reload()
|
|||||||
FOREACH_HumanPlayer( pn )
|
FOREACH_HumanPlayer( pn )
|
||||||
PositionUnderlines( pn );
|
PositionUnderlines( pn );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Nothing uses this yet and it causes skips when changing options.
|
// TODO: Nothing uses this yet and it causes skips when changing options.
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
|
|||||||
sName.c_str(), num_selected, static_cast<int>(selected.size()));
|
sName.c_str(), num_selected, static_cast<int>(selected.size()));
|
||||||
for(unsigned int e= 0; e < selected.size(); ++e)
|
for(unsigned int e= 0; e < selected.size(); ++e)
|
||||||
{
|
{
|
||||||
if(selected[e] && e != first_selected)
|
if(selected[e] && (first_selected < 0 || e != static_cast<uint32_t>(first_selected)))
|
||||||
{
|
{
|
||||||
selected[e]= false;
|
selected[e]= false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ void OptionsCursor::StopTweening()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsCursor::BeginTweening( float fSecs )
|
void OptionsCursor::BeginTweening( float fSecs, TweenType tt )
|
||||||
{
|
{
|
||||||
ActorFrame::BeginTweening( fSecs );
|
ActorFrame::BeginTweening( fSecs );
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ public:
|
|||||||
void Load( const RString &sMetricsGroup, bool bLoadCanGos );
|
void Load( const RString &sMetricsGroup, bool bLoadCanGos );
|
||||||
|
|
||||||
void StopTweening();
|
void StopTweening();
|
||||||
void BeginTweening( float fSecs );
|
void BeginTweening( float fSecs, TweenType tt = TWEEN_LINEAR );
|
||||||
void SetBarWidth( int iWidth );
|
void SetBarWidth( int iWidth );
|
||||||
int GetBarWidth() const;
|
int GetBarWidth() const;
|
||||||
void SetCanGo( bool bCanGoLeft, bool bCanGoRight );
|
void SetCanGo( bool bCanGoLeft, bool bCanGoRight );
|
||||||
|
|||||||
+11
-10
@@ -1136,8 +1136,8 @@ void Player::Update( float fDeltaTime )
|
|||||||
* .5 before the row. Use a very slow song (around 2 BPM) as a test case: without
|
* .5 before the row. Use a very slow song (around 2 BPM) as a test case: without
|
||||||
* rounding, autoplay steps early. -glenn */
|
* rounding, autoplay steps early. -glenn */
|
||||||
const float fPositionSeconds = m_pPlayerState->m_Position.m_fMusicSeconds - PREFSMAN->m_fPadStickSeconds;
|
const float fPositionSeconds = m_pPlayerState->m_Position.m_fMusicSeconds - PREFSMAN->m_fPadStickSeconds;
|
||||||
const float fSongBeat = m_pPlayerState->GetDisplayedTiming().GetBeatFromElapsedTime( fPositionSeconds );
|
const float fSongBeatTmp = m_pPlayerState->GetDisplayedTiming().GetBeatFromElapsedTime( fPositionSeconds );
|
||||||
const int iRowNow = BeatToNoteRowNotRounded( fSongBeat );
|
const int iRowNow = BeatToNoteRowNotRounded( fSongBeatTmp );
|
||||||
|
|
||||||
if( iRowNow >= 0 )
|
if( iRowNow >= 0 )
|
||||||
{
|
{
|
||||||
@@ -2285,6 +2285,7 @@ void Player::Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRele
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Fall through to default.
|
// Fall through to default.
|
||||||
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
if( (pTN->type == TapNoteType_Lift) == bRelease )
|
if( (pTN->type == TapNoteType_Lift) == bRelease )
|
||||||
{
|
{
|
||||||
@@ -3213,22 +3214,22 @@ void Player::SetJudgment( int iRow, int iTrack, const TapNote &tn, TapNoteScore
|
|||||||
lua_createtable( L, 0, m_NoteData.GetNumTracks() ); // TapNotes this row
|
lua_createtable( L, 0, m_NoteData.GetNumTracks() ); // TapNotes this row
|
||||||
lua_createtable( L, 0, m_NoteData.GetNumTracks() ); // HoldHeads of tracks held at this row.
|
lua_createtable( L, 0, m_NoteData.GetNumTracks() ); // HoldHeads of tracks held at this row.
|
||||||
|
|
||||||
for( int iTrack = 0; iTrack < m_NoteData.GetNumTracks(); ++iTrack )
|
for( int iTrackTmp = 0; iTrackTmp < m_NoteData.GetNumTracks(); ++iTrackTmp )
|
||||||
{
|
{
|
||||||
NoteData::iterator tn = m_NoteData.FindTapNote(iTrack, iRow);
|
NoteData::iterator tnTmp = m_NoteData.FindTapNote(iTrackTmp, iRow);
|
||||||
if( tn != m_NoteData.end(iTrack) )
|
if( tnTmp != m_NoteData.end(iTrackTmp) )
|
||||||
{
|
{
|
||||||
tn->second.PushSelf(L);
|
tnTmp->second.PushSelf(L);
|
||||||
lua_rawseti(L, -3, iTrack + 1);
|
lua_rawseti(L, -3, iTrackTmp + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int iHeadRow;
|
int iHeadRow;
|
||||||
if( m_NoteData.IsHoldNoteAtRow( iTrack, iRow, &iHeadRow ) )
|
if( m_NoteData.IsHoldNoteAtRow( iTrackTmp, iRow, &iHeadRow ) )
|
||||||
{
|
{
|
||||||
NoteData::iterator hold = m_NoteData.FindTapNote(iTrack, iHeadRow);
|
NoteData::iterator hold = m_NoteData.FindTapNote(iTrackTmp, iHeadRow);
|
||||||
hold->second.PushSelf(L);
|
hold->second.PushSelf(L);
|
||||||
lua_rawseti(L, -2, iTrack + 1);
|
lua_rawseti(L, -2, iTrackTmp + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -82,10 +82,11 @@ public:
|
|||||||
m_fModTimerOffset(0), m_SpeedfModTimerOffset(1.0f),
|
m_fModTimerOffset(0), m_SpeedfModTimerOffset(1.0f),
|
||||||
m_fDrawSize(0), m_SpeedfDrawSize(1.0f),
|
m_fDrawSize(0), m_SpeedfDrawSize(1.0f),
|
||||||
m_fDrawSizeBack(0), m_SpeedfDrawSizeBack(1.0f),
|
m_fDrawSizeBack(0), m_SpeedfDrawSizeBack(1.0f),
|
||||||
m_bMuteOnError(false), m_FailType(FailType_Immediate),
|
m_bMuteOnError(false),
|
||||||
m_bStealthType(false), m_bStealthPastReceptors(false),
|
m_bStealthType(false), m_bStealthPastReceptors(false),
|
||||||
m_bDizzyHolds(false), m_bZBuffer(false),
|
m_bDizzyHolds(false), m_bZBuffer(false),
|
||||||
m_bCosecant(false),
|
m_bCosecant(false),
|
||||||
|
m_FailType(FailType_Immediate),
|
||||||
m_MinTNSToHideNotes(PREFSMAN->m_MinTNSToHideNotes)
|
m_MinTNSToHideNotes(PREFSMAN->m_MinTNSToHideNotes)
|
||||||
{
|
{
|
||||||
m_sNoteSkin = "";
|
m_sNoteSkin = "";
|
||||||
@@ -132,6 +133,7 @@ public:
|
|||||||
bool operator==( const PlayerOptions &other ) const;
|
bool operator==( const PlayerOptions &other ) const;
|
||||||
bool operator!=( const PlayerOptions &other ) const { return !operator==(other); }
|
bool operator!=( const PlayerOptions &other ) const { return !operator==(other); }
|
||||||
PlayerOptions& operator=(PlayerOptions const& other);
|
PlayerOptions& operator=(PlayerOptions const& other);
|
||||||
|
PlayerOptions(const PlayerOptions& other) { operator=(other); }
|
||||||
|
|
||||||
/** @brief The various acceleration mods. */
|
/** @brief The various acceleration mods. */
|
||||||
enum Accel {
|
enum Accel {
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ void PlayerStageStats::SetLifeRecordAt( float fLife, float fStepsSecond )
|
|||||||
}
|
}
|
||||||
m_fLifeRecord[fStepsSecond] = fLife;
|
m_fLifeRecord[fStepsSecond] = fLife;
|
||||||
|
|
||||||
Message msg(static_cast<MessageID>(Message_LifeMeterChangedP1+m_player_number));
|
Message msg(static_cast<MessageID>(Message_LifeMeterChangedP1+Enum::to_integral(m_player_number)));
|
||||||
msg.SetParam("Life", fLife);
|
msg.SetParam("Life", fLife);
|
||||||
msg.SetParam("StepsSecond", fStepsSecond);
|
msg.SetParam("StepsSecond", fStepsSecond);
|
||||||
MESSAGEMAN->Broadcast(msg);
|
MESSAGEMAN->Broadcast(msg);
|
||||||
|
|||||||
@@ -267,9 +267,6 @@ PrefsManager::PrefsManager() :
|
|||||||
m_sAdditionalCourseFoldersWritable( "AdditionalCourseFoldersWritable", "", nullptr, PreferenceType::Immutable ),
|
m_sAdditionalCourseFoldersWritable( "AdditionalCourseFoldersWritable", "", nullptr, PreferenceType::Immutable ),
|
||||||
m_sAdditionalFoldersReadOnly ( "AdditionalFoldersReadOnly", "", nullptr, PreferenceType::Immutable ),
|
m_sAdditionalFoldersReadOnly ( "AdditionalFoldersReadOnly", "", nullptr, PreferenceType::Immutable ),
|
||||||
m_sAdditionalFoldersWritable ( "AdditionalFoldersWritable", "", nullptr, PreferenceType::Immutable ),
|
m_sAdditionalFoldersWritable ( "AdditionalFoldersWritable", "", nullptr, PreferenceType::Immutable ),
|
||||||
m_sAdditionalSongFolders ( "AdditionalSongFolders", "", nullptr, PreferenceType::Deprecated ),
|
|
||||||
m_sAdditionalCourseFolders ( "AdditionalCourseFolders", "", nullptr, PreferenceType::Deprecated ),
|
|
||||||
m_sAdditionalFolders ( "AdditionalFolders", "", nullptr, PreferenceType::Deprecated ),
|
|
||||||
m_sDefaultTheme ( "DefaultTheme", "Simply Love" ),
|
m_sDefaultTheme ( "DefaultTheme", "Simply Love" ),
|
||||||
m_sLastSeenVideoDriver ( "LastSeenVideoDriver", "" ),
|
m_sLastSeenVideoDriver ( "LastSeenVideoDriver", "" ),
|
||||||
m_sVideoRenderers ( "VideoRenderers", "" ), // StepMania.cpp sets these on first run:
|
m_sVideoRenderers ( "VideoRenderers", "" ), // StepMania.cpp sets these on first run:
|
||||||
@@ -311,8 +308,10 @@ PrefsManager::PrefsManager() :
|
|||||||
m_bLogCheckpoints ( "LogCheckpoints", false ),
|
m_bLogCheckpoints ( "LogCheckpoints", false ),
|
||||||
m_bShowLoadingWindow ( "ShowLoadingWindow", true ),
|
m_bShowLoadingWindow ( "ShowLoadingWindow", true ),
|
||||||
m_bPseudoLocalize ( "PseudoLocalize", false ),
|
m_bPseudoLocalize ( "PseudoLocalize", false ),
|
||||||
m_show_theme_errors ( "ShowThemeErrors", false )
|
m_show_theme_errors ( "ShowThemeErrors", false ),
|
||||||
|
m_sAdditionalSongFolders ( "AdditionalSongFolders", "", nullptr, PreferenceType::Deprecated ),
|
||||||
|
m_sAdditionalCourseFolders ( "AdditionalCourseFolders", "", nullptr, PreferenceType::Deprecated ),
|
||||||
|
m_sAdditionalFolders ( "AdditionalFolders", "", nullptr, PreferenceType::Deprecated )
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
ReadPrefsFromDisk();
|
ReadPrefsFromDisk();
|
||||||
|
|||||||
+6
-6
@@ -96,7 +96,7 @@ void Profile::ClearSongs()
|
|||||||
int Profile::HighScoresForASong::GetNumTimesPlayed() const
|
int Profile::HighScoresForASong::GetNumTimesPlayed() const
|
||||||
{
|
{
|
||||||
int iCount = 0;
|
int iCount = 0;
|
||||||
for (std::pair<StepsID, HighScoresForASteps> const &i : m_StepsHighScores)
|
for (const auto& i : m_StepsHighScores)
|
||||||
{
|
{
|
||||||
iCount += i.second.hsl.GetNumTimesPlayed();
|
iCount += i.second.hsl.GetNumTimesPlayed();
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ int Profile::HighScoresForASong::GetNumTimesPlayed() const
|
|||||||
int Profile::HighScoresForACourse::GetNumTimesPlayed() const
|
int Profile::HighScoresForACourse::GetNumTimesPlayed() const
|
||||||
{
|
{
|
||||||
int iCount = 0;
|
int iCount = 0;
|
||||||
for (std::pair<TrailID const, HighScoresForATrail> const &i : m_TrailHighScores)
|
for (const auto& i : m_TrailHighScores)
|
||||||
{
|
{
|
||||||
iCount += i.second.hsl.GetNumTimesPlayed();
|
iCount += i.second.hsl.GetNumTimesPlayed();
|
||||||
}
|
}
|
||||||
@@ -394,7 +394,7 @@ float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
|
|||||||
{
|
{
|
||||||
Song* pSong = id.first.ToSong();
|
Song* pSong = id.first.ToSong();
|
||||||
|
|
||||||
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: %p", pSong) );
|
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: %p", static_cast<void*>(pSong)) );
|
||||||
|
|
||||||
// If the Song isn't loaded on the current machine, then we can't
|
// If the Song isn't loaded on the current machine, then we can't
|
||||||
// get radar values to compute dance points.
|
// get radar values to compute dance points.
|
||||||
@@ -411,7 +411,7 @@ float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
|
|||||||
{
|
{
|
||||||
const StepsID &sid = j.first;
|
const StepsID &sid = j.first;
|
||||||
Steps* pSteps = sid.ToSteps( pSong, true );
|
Steps* pSteps = sid.ToSteps( pSong, true );
|
||||||
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: song %p, steps %p", pSong, pSteps) );
|
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: song %p, steps %p", static_cast<void*>(pSong), static_cast<void*>(pSteps)) );
|
||||||
|
|
||||||
// If the Steps isn't loaded on the current machine, then we can't
|
// If the Steps isn't loaded on the current machine, then we can't
|
||||||
// get radar values to compute dance points.
|
// get radar values to compute dance points.
|
||||||
@@ -421,7 +421,7 @@ float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
|
|||||||
if( pSteps->m_StepsType != st )
|
if( pSteps->m_StepsType != st )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: n %s = %p", sid.ToString().c_str(), pSteps) );
|
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: n %s = %p", sid.ToString().c_str(), static_cast<void*>(pSteps)) );
|
||||||
if( pSteps->GetDifficulty() != dc )
|
if( pSteps->GetDifficulty() != dc )
|
||||||
{
|
{
|
||||||
continue; // skip
|
continue; // skip
|
||||||
@@ -1605,7 +1605,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
|
|||||||
|
|
||||||
{
|
{
|
||||||
XNode* pNumSongsPlayedByStyle = pGeneralDataNode->AppendChild("NumSongsPlayedByStyle");
|
XNode* pNumSongsPlayedByStyle = pGeneralDataNode->AppendChild("NumSongsPlayedByStyle");
|
||||||
for (std::pair<StyleID const, int> const iter : m_iNumSongsPlayedByStyle)
|
for (const auto& iter : m_iNumSongsPlayedByStyle)
|
||||||
{
|
{
|
||||||
const StyleID &s = iter.first;
|
const StyleID &s = iter.first;
|
||||||
int iNumPlays = iter.second;
|
int iNumPlays = iter.second;
|
||||||
|
|||||||
+21
-33
@@ -112,44 +112,30 @@ public:
|
|||||||
PAL(PAL_),
|
PAL(PAL_),
|
||||||
fDisplayAspectRatio(fDisplayAspectRatio_) {}
|
fDisplayAspectRatio(fDisplayAspectRatio_) {}
|
||||||
|
|
||||||
VideoModeParams(const VideoModeParams &other):
|
VideoModeParams(const VideoModeParams &other) = default;
|
||||||
windowed(other.windowed), sDisplayId(other.sDisplayId),
|
|
||||||
width(other.width), height(other.height),
|
|
||||||
bpp(other.bpp), rate(other.rate),
|
|
||||||
vsync(other.vsync), interlaced(other.interlaced),
|
|
||||||
bSmoothLines(other.bSmoothLines), bTrilinearFiltering(other.bTrilinearFiltering),
|
|
||||||
bAnisotropicFiltering(other.bAnisotropicFiltering), bWindowIsFullscreenBorderless(other.bWindowIsFullscreenBorderless),
|
|
||||||
sWindowTitle(other.sWindowTitle), sIconFile(other.sIconFile),
|
|
||||||
PAL(other.PAL), fDisplayAspectRatio(other.fDisplayAspectRatio)
|
|
||||||
{}
|
|
||||||
|
|
||||||
VideoModeParams(): windowed(false), width(0), height(0),
|
VideoModeParams() = default;
|
||||||
bpp(0), rate(0), vsync(false), interlaced(false),
|
|
||||||
bSmoothLines(false), bTrilinearFiltering(false),
|
|
||||||
bAnisotropicFiltering(false), bWindowIsFullscreenBorderless(false),
|
|
||||||
sWindowTitle(RString()), sIconFile(RString()),
|
|
||||||
PAL(false), fDisplayAspectRatio(0.0f) {}
|
|
||||||
|
|
||||||
// Subclassing VideoModeParams in ActualVideoModeParams. Make destructor virtual just in case
|
// Subclassing VideoModeParams in ActualVideoModeParams. Make destructor virtual just in case
|
||||||
// someone tries to delete one of those through a pointer to base...
|
// someone tries to delete one of those through a pointer to base...
|
||||||
virtual ~VideoModeParams() {}
|
virtual ~VideoModeParams() = default;
|
||||||
|
|
||||||
bool windowed;
|
bool windowed{false};
|
||||||
RString sDisplayId;
|
RString sDisplayId{};
|
||||||
int width;
|
int width{0};
|
||||||
int height;
|
int height{0};
|
||||||
int bpp;
|
int bpp{0};
|
||||||
int rate;
|
int rate{0};
|
||||||
bool vsync;
|
bool vsync{false};
|
||||||
bool interlaced;
|
bool interlaced{false};
|
||||||
bool bSmoothLines;
|
bool bSmoothLines{false};
|
||||||
bool bTrilinearFiltering;
|
bool bTrilinearFiltering{false};
|
||||||
bool bAnisotropicFiltering;
|
bool bAnisotropicFiltering{false};
|
||||||
bool bWindowIsFullscreenBorderless;
|
bool bWindowIsFullscreenBorderless{false};
|
||||||
RString sWindowTitle;
|
RString sWindowTitle{};
|
||||||
RString sIconFile;
|
RString sIconFile{};
|
||||||
bool PAL;
|
bool PAL{false};
|
||||||
float fDisplayAspectRatio;
|
float fDisplayAspectRatio{0.0f};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,6 +157,8 @@ public:
|
|||||||
renderOffscreen( renderOffscreen )
|
renderOffscreen( renderOffscreen )
|
||||||
{ }
|
{ }
|
||||||
ActualVideoModeParams (const ActualVideoModeParams &other) = default;
|
ActualVideoModeParams (const ActualVideoModeParams &other) = default;
|
||||||
|
ActualVideoModeParams& operator=(const ActualVideoModeParams& other) = default;
|
||||||
|
|
||||||
|
|
||||||
// If bWindowIsFullscreenBorderless is true,
|
// If bWindowIsFullscreenBorderless is true,
|
||||||
// then these properties will differ from width/height (which describe the
|
// then these properties will differ from width/height (which describe the
|
||||||
|
|||||||
@@ -744,7 +744,7 @@ void RageDisplay_D3D::SendCurrentMatrices()
|
|||||||
0.0f, 0.0f, 0.0f, 0.0f,
|
0.0f, 0.0f, 0.0f, 0.0f,
|
||||||
0.5f, -0.5f, 0.0f, 1.0f
|
0.5f, -0.5f, 0.0f, 1.0f
|
||||||
);
|
);
|
||||||
g_pd3dDevice->SetTransform( (D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0+tu), (D3DMATRIX*)&tex );
|
g_pd3dDevice->SetTransform( (D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0+Enum::to_integral(tu)), (D3DMATRIX*)&tex );
|
||||||
|
|
||||||
// Tell D3D to use transformed reflection vectors as texture co-ordinate 0
|
// Tell D3D to use transformed reflection vectors as texture co-ordinate 0
|
||||||
// and then transform this coordinate by the specified texture matrix.
|
// and then transform this coordinate by the specified texture matrix.
|
||||||
@@ -765,7 +765,7 @@ void RageDisplay_D3D::SendCurrentMatrices()
|
|||||||
tex1.m[3][0], tex1.m[3][1], tex1.m[3][3], 0,
|
tex1.m[3][0], tex1.m[3][1], tex1.m[3][3], 0,
|
||||||
0, 0, 0, 0
|
0, 0, 0, 0
|
||||||
);
|
);
|
||||||
g_pd3dDevice->SetTransform( D3DTRANSFORMSTATETYPE(D3DTS_TEXTURE0+tu), (D3DMATRIX*)&tex2 );
|
g_pd3dDevice->SetTransform( D3DTRANSFORMSTATETYPE(D3DTS_TEXTURE0+Enum::to_integral(tu)), (D3DMATRIX*)&tex2 );
|
||||||
|
|
||||||
g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU );
|
g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#ifndef RAGE_DISPLAY_D3D_H
|
#ifndef RAGE_DISPLAY_D3D_H
|
||||||
#define RAGE_DISPLAY_D3D_H
|
#define RAGE_DISPLAY_D3D_H
|
||||||
|
|
||||||
|
#include "RageDisplay.h"
|
||||||
|
|
||||||
class RageDisplay_D3D: public RageDisplay
|
class RageDisplay_D3D: public RageDisplay
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -169,7 +169,10 @@ namespace
|
|||||||
|
|
||||||
void FixLittleEndian()
|
void FixLittleEndian()
|
||||||
{
|
{
|
||||||
#if defined(ENDIAN_LITTLE)
|
if constexpr (!Endian::little) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static bool bInitialized = false;
|
static bool bInitialized = false;
|
||||||
if (bInitialized)
|
if (bInitialized)
|
||||||
return;
|
return;
|
||||||
@@ -197,7 +200,6 @@ namespace
|
|||||||
pf.masks[mask] = m;
|
pf.masks[mask] = m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
namespace Caps
|
namespace Caps
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -213,7 +213,10 @@ struct GLPixFmtInfo_t {
|
|||||||
|
|
||||||
static void FixLittleEndian()
|
static void FixLittleEndian()
|
||||||
{
|
{
|
||||||
#if defined(ENDIAN_LITTLE)
|
if constexpr (!Endian::little) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static bool bInitialized = false;
|
static bool bInitialized = false;
|
||||||
if (bInitialized)
|
if (bInitialized)
|
||||||
return;
|
return;
|
||||||
@@ -241,7 +244,6 @@ static void FixLittleEndian()
|
|||||||
pf.masks[mask] = m;
|
pf.masks[mask] = m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TurnOffHardwareVBO()
|
static void TurnOffHardwareVBO()
|
||||||
@@ -2213,7 +2215,7 @@ uintptr_t RageDisplay_Legacy::CreateTexture(
|
|||||||
|
|
||||||
/* If the image is paletted, but we're not sending it to a paletted image,
|
/* If the image is paletted, but we're not sending it to a paletted image,
|
||||||
* set up glPixelMap. */
|
* set up glPixelMap. */
|
||||||
SetPixelMapForSurface( glImageFormat, glTexFormat, pImg->format->palette );
|
SetPixelMapForSurface( glImageFormat, glTexFormat, pImg->format->palette.get() );
|
||||||
|
|
||||||
// HACK: OpenGL 1.2 types aren't available in GLU 1.3. Don't call GLU for mip
|
// HACK: OpenGL 1.2 types aren't available in GLU 1.3. Don't call GLU for mip
|
||||||
// mapping if we're using an OGL 1.2 type and don't have >= GLU 1.3.
|
// mapping if we're using an OGL 1.2 type and don't have >= GLU 1.3.
|
||||||
@@ -2433,7 +2435,7 @@ void RageDisplay_Legacy::UpdateTexture(
|
|||||||
{
|
{
|
||||||
GLenum glTexFormat = 0;
|
GLenum glTexFormat = 0;
|
||||||
glGetTexLevelParameteriv( GL_PROXY_TEXTURE_2D, 0, GLenum(GL_TEXTURE_INTERNAL_FORMAT), (GLint *) &glTexFormat );
|
glGetTexLevelParameteriv( GL_PROXY_TEXTURE_2D, 0, GLenum(GL_TEXTURE_INTERNAL_FORMAT), (GLint *) &glTexFormat );
|
||||||
SetPixelMapForSurface( glImageFormat, glTexFormat, pImg->format->palette );
|
SetPixelMapForSurface( glImageFormat, glTexFormat, pImg->format->palette.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
glTexSubImage2D( GL_TEXTURE_2D, 0,
|
glTexSubImage2D( GL_TEXTURE_2D, 0,
|
||||||
@@ -2691,7 +2693,7 @@ void RageDisplay_Legacy::SetLineWidth(float fWidth)
|
|||||||
glLineWidth(fWidth);
|
glLineWidth(fWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
RString RageDisplay_Legacy::GetTextureDiagnostics(unsigned iTexture) const
|
RString RageDisplay_Legacy::GetTextureDiagnostics(uintptr_t iTexture) const
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
s << (bGenerateMipMaps? "gluBuild2DMipmaps":"glTexImage2D");
|
s << (bGenerateMipMaps? "gluBuild2DMipmaps":"glTexImage2D");
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public:
|
|||||||
virtual void SetPolygonMode( PolygonMode pm );
|
virtual void SetPolygonMode( PolygonMode pm );
|
||||||
virtual void SetLineWidth( float fWidth );
|
virtual void SetLineWidth( float fWidth );
|
||||||
|
|
||||||
RString GetTextureDiagnostics( unsigned id ) const;
|
RString GetTextureDiagnostics( uintptr_t id ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts );
|
void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts );
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
* The original documentation stated this was a class for some reason. */
|
* The original documentation stated this was a class for some reason. */
|
||||||
namespace RageException
|
namespace RageException
|
||||||
{
|
{
|
||||||
void NORETURN Throw( const char *fmt, ... ) PRINTF(1,2);
|
void SM_NORETURN Throw( const char *fmt, ... ) PRINTF(1,2);
|
||||||
void SetCleanupHandler( void (*pHandler)(const RString &sError) );
|
void SetCleanupHandler( void (*pHandler)(const RString &sError) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ int RageFileObj::FillReadBuf()
|
|||||||
* the two is old data that we've read. (Don't mangle that data; we can use it
|
* the two is old data that we've read. (Don't mangle that data; we can use it
|
||||||
* for seeking backwards.) */
|
* for seeking backwards.) */
|
||||||
const int iBufAvail = BSIZE - (m_pReadBuf-m_pReadBuffer) - m_iReadBufAvail;
|
const int iBufAvail = BSIZE - (m_pReadBuf-m_pReadBuffer) - m_iReadBufAvail;
|
||||||
ASSERT_M( iBufAvail >= 0, ssprintf("%p, %p, %i", m_pReadBuf, m_pReadBuffer, (int) BSIZE ) );
|
ASSERT_M( iBufAvail >= 0, ssprintf("%p, %p, %i", static_cast<void*>(m_pReadBuf), static_cast<void*>(m_pReadBuffer), BSIZE ) );
|
||||||
const int iSize = this->ReadInternal( m_pReadBuf+m_iReadBufAvail, iBufAvail );
|
const int iSize = this->ReadInternal( m_pReadBuf+m_iReadBufAvail, iBufAvail );
|
||||||
|
|
||||||
if( iSize > 0 )
|
if( iSize > 0 )
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ RageFileObjDirect *RageFileObjDirect::Copy() const
|
|||||||
if( ret == nullptr )
|
if( ret == nullptr )
|
||||||
RageException::Throw( "Couldn't reopen \"%s\": %s", m_sPath.c_str(), strerror(iErr) );
|
RageException::Throw( "Couldn't reopen \"%s\": %s", m_sPath.c_str(), strerror(iErr) );
|
||||||
|
|
||||||
ret->Seek( (int)lseek( m_iFD, 0, SEEK_CUR ) );
|
ret->Seek( (int)DoLseek( m_iFD, 0, SEEK_CUR ) );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -322,7 +322,7 @@ RageFileObjDirect::~RageFileObjDirect()
|
|||||||
|
|
||||||
if( m_iFD != -1 )
|
if( m_iFD != -1 )
|
||||||
{
|
{
|
||||||
if( close( m_iFD ) == -1 )
|
if( DoClose( m_iFD ) == -1 )
|
||||||
{
|
{
|
||||||
WARN( ssprintf("Error closing %s: %s", this->m_sPath.c_str(), strerror(errno)) );
|
WARN( ssprintf("Error closing %s: %s", this->m_sPath.c_str(), strerror(errno)) );
|
||||||
SetError( strerror(errno) );
|
SetError( strerror(errno) );
|
||||||
@@ -391,7 +391,7 @@ RageFileObjDirect::~RageFileObjDirect()
|
|||||||
|
|
||||||
int RageFileObjDirect::ReadInternal( void *pBuf, size_t iBytes )
|
int RageFileObjDirect::ReadInternal( void *pBuf, size_t iBytes )
|
||||||
{
|
{
|
||||||
int iRet = read( m_iFD, pBuf, iBytes );
|
int iRet = DoRead( m_iFD, pBuf, iBytes );
|
||||||
if( iRet == -1 )
|
if( iRet == -1 )
|
||||||
{
|
{
|
||||||
SetError( strerror(errno) );
|
SetError( strerror(errno) );
|
||||||
@@ -407,7 +407,7 @@ static int RetriedWrite( int iFD, const void *pBuf, size_t iCount )
|
|||||||
int iTries = 3, iRet;
|
int iTries = 3, iRet;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
iRet = write( iFD, pBuf, iCount );
|
iRet = DoWrite( iFD, pBuf, iCount );
|
||||||
}
|
}
|
||||||
while( iRet == -1 && errno == EINTR && iTries-- );
|
while( iRet == -1 && errno == EINTR && iTries-- );
|
||||||
|
|
||||||
@@ -448,16 +448,16 @@ int RageFileObjDirect::WriteInternal( const void *pBuf, size_t iBytes )
|
|||||||
|
|
||||||
int RageFileObjDirect::SeekInternal( int iOffset )
|
int RageFileObjDirect::SeekInternal( int iOffset )
|
||||||
{
|
{
|
||||||
return (int)lseek( m_iFD, iOffset, SEEK_SET );
|
return (int)DoLseek( m_iFD, iOffset, SEEK_SET );
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObjDirect::GetFileSize() const
|
int RageFileObjDirect::GetFileSize() const
|
||||||
{
|
{
|
||||||
const int iOldPos = (int)lseek( m_iFD, 0, SEEK_CUR );
|
const int iOldPos = (int)DoLseek( m_iFD, 0, SEEK_CUR );
|
||||||
ASSERT_M( iOldPos != -1, ssprintf("\"%s\": %s", m_sPath.c_str(), strerror(errno)) );
|
ASSERT_M( iOldPos != -1, ssprintf("\"%s\": %s", m_sPath.c_str(), strerror(errno)) );
|
||||||
const int iRet = (int)lseek( m_iFD, 0, SEEK_END );
|
const int iRet = (int)DoLseek( m_iFD, 0, SEEK_END );
|
||||||
ASSERT_M( iRet != -1, ssprintf("\"%s\": %s", m_sPath.c_str(), strerror(errno)) );
|
ASSERT_M( iRet != -1, ssprintf("\"%s\": %s", m_sPath.c_str(), strerror(errno)) );
|
||||||
lseek( m_iFD, iOldPos, SEEK_SET );
|
DoLseek( m_iFD, iOldPos, SEEK_SET );
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,28 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DoOpen open
|
|
||||||
#define DoStat stat
|
#define DoStat stat
|
||||||
#define DoMkdir mkdir
|
#define DoMkdir mkdir
|
||||||
#define DoFindFirstFile FindFirstFile
|
#define DoFindFirstFile FindFirstFile
|
||||||
#define DoRename rename
|
#define DoRename rename
|
||||||
#define DoRemove remove
|
#define DoRemove remove
|
||||||
|
#if defined(WIN32)
|
||||||
|
#define DoOpen _open
|
||||||
|
#define DoRmdir _rmdir
|
||||||
|
#define DoLseek _lseek
|
||||||
|
#define DoClose _close
|
||||||
|
#define DoRead _read
|
||||||
|
#define DoWrite _write
|
||||||
|
#define DoGetCwd _getcwd
|
||||||
|
#else
|
||||||
|
#define DoOpen open
|
||||||
#define DoRmdir rmdir
|
#define DoRmdir rmdir
|
||||||
|
#define DoLseek lseek
|
||||||
|
#define DoClose close
|
||||||
|
#define DoRead read
|
||||||
|
#define DoWrite write
|
||||||
|
#define DoGetCwd getcwd
|
||||||
|
#endif
|
||||||
RString DoPathReplace( const RString &sPath );
|
RString DoPathReplace( const RString &sPath );
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ bool RageFileDriverZip::Load( const RString &sPath )
|
|||||||
bool RageFileDriverZip::Load( RageFileBasic *pFile )
|
bool RageFileDriverZip::Load( RageFileBasic *pFile )
|
||||||
{
|
{
|
||||||
ASSERT( m_pZip == nullptr ); /* don't load twice */
|
ASSERT( m_pZip == nullptr ); /* don't load twice */
|
||||||
m_sPath = ssprintf("%p", pFile);
|
m_sPath = ssprintf("%p", static_cast<void*>(pFile));
|
||||||
m_Mutex.SetName( ssprintf("RageFileDriverZip(%p)", pFile) );
|
m_Mutex.SetName( ssprintf("RageFileDriverZip(%p)", static_cast<void*>(pFile)) );
|
||||||
|
|
||||||
m_pZip = pFile;
|
m_pZip = pFile;
|
||||||
|
|
||||||
|
|||||||
@@ -114,8 +114,8 @@ size_t zipRead(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n)
|
|||||||
{
|
{
|
||||||
RageFile *f = static_cast<RageFile*>(pOpaque);
|
RageFile *f = static_cast<RageFile*>(pOpaque);
|
||||||
|
|
||||||
int pos = f->Seek(file_ofs);
|
const auto pos = f->Seek(file_ofs);
|
||||||
if (pos != file_ofs)
|
if (pos >= 0 && static_cast<uint64_t>(pos) != file_ofs)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -305,9 +305,9 @@ static RString ExtractDirectory( RString sPath )
|
|||||||
return sPath;
|
return sPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(UNIX) || defined(MACOSX)
|
||||||
static RString ReadlinkRecursive( RString sPath )
|
static RString ReadlinkRecursive( RString sPath )
|
||||||
{
|
{
|
||||||
#if defined(UNIX) || defined(MACOSX)
|
|
||||||
// unices support symbolic links; dereference them
|
// unices support symbolic links; dereference them
|
||||||
RString dereferenced = sPath;
|
RString dereferenced = sPath;
|
||||||
do
|
do
|
||||||
@@ -325,10 +325,10 @@ static RString ReadlinkRecursive( RString sPath )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (sPath != dereferenced);
|
} while (sPath != dereferenced);
|
||||||
#endif
|
|
||||||
|
|
||||||
return sPath;
|
return sPath;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static RString GetDirOfExecutable( RString argv0 )
|
static RString GetDirOfExecutable( RString argv0 )
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -616,8 +616,8 @@ float RageFastSin(float angle)
|
|||||||
{
|
{
|
||||||
if(angle == 0) { return 0; }
|
if(angle == 0) { return 0; }
|
||||||
float index= angle * sine_table_index_mult;
|
float index= angle * sine_table_index_mult;
|
||||||
int first_index= static_cast<int>(index);
|
auto first_index= static_cast<uint32_t>(index);
|
||||||
int second_index= (first_index + 1) % sine_index_mod;
|
auto second_index= (first_index + 1) % sine_index_mod;
|
||||||
float remainder= index - first_index;
|
float remainder= index - first_index;
|
||||||
first_index%= sine_index_mod;
|
first_index%= sine_index_mod;
|
||||||
float first= 0.0f;
|
float first= 0.0f;
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ void RageModelGeometry::LoadMilkshapeAscii( const RString& _sPath, bool bNeedsNo
|
|||||||
|
|
||||||
uint16_t nIndices[3];
|
uint16_t nIndices[3];
|
||||||
uint16_t nNormalIndices[3];
|
uint16_t nNormalIndices[3];
|
||||||
if( sscanf (sLine, "%d %hd %hd %hd %hd %hd %hd %d",
|
if( sscanf (sLine, "%d %hu %hu %hu %hu %hu %hu %d",
|
||||||
&nFlags,
|
&nFlags,
|
||||||
&nIndices[0], &nIndices[1], &nIndices[2],
|
&nIndices[0], &nIndices[1], &nIndices[2],
|
||||||
&nNormalIndices[0], &nNormalIndices[1], &nNormalIndices[2],
|
&nNormalIndices[0], &nNormalIndices[1], &nNormalIndices[2],
|
||||||
|
|||||||
+1
-1
@@ -271,7 +271,7 @@ int RageSound::GetDataToPlay( float *pBuffer, int iFrames, int64_t &iStreamFrame
|
|||||||
/* We only update m_iStreamFrame; only take a shared lock, so we don't block the main thread. */
|
/* We only update m_iStreamFrame; only take a shared lock, so we don't block the main thread. */
|
||||||
// LockMut(m_Mutex);
|
// LockMut(m_Mutex);
|
||||||
|
|
||||||
ASSERT_M( m_bPlaying, ssprintf("%p", this) );
|
ASSERT_M( m_bPlaying, ssprintf("%p", static_cast<void*>(this)) );
|
||||||
ASSERT( m_pSource != nullptr );
|
ASSERT( m_pSource != nullptr );
|
||||||
|
|
||||||
iFramesStored = 0;
|
iFramesStored = 0;
|
||||||
|
|||||||
+5
-10
@@ -176,20 +176,15 @@ int64_t pos_map_queue::Search( int64_t iSourceFrame, bool *bApproximate ) const
|
|||||||
* SoundStopped has been called.
|
* SoundStopped has been called.
|
||||||
* 3. Underflow; we'll be given a larger frame number than we know about.
|
* 3. Underflow; we'll be given a larger frame number than we know about.
|
||||||
*/
|
*/
|
||||||
#if defined(WIN32)
|
|
||||||
#define I64F "%I64i"
|
|
||||||
#elif defined(__x86_64__)
|
|
||||||
#define I64F "%li"
|
|
||||||
#else
|
|
||||||
#define I64F "%lli"
|
|
||||||
#endif
|
|
||||||
static RageTimer last;
|
static RageTimer last;
|
||||||
if( last.PeekDeltaTime() >= 1.0f )
|
if( last.PeekDeltaTime() >= 1.0f )
|
||||||
{
|
{
|
||||||
last.GetDeltaTime();
|
last.GetDeltaTime();
|
||||||
LOG->Trace( "Approximate sound time: driver frame " I64F ", m_pImpl->m_Queue frame " I64F ".." I64F " (dist " I64F "), closest position is " I64F,
|
std::stringstream ss;
|
||||||
iSourceFrame, pClosestBlock->m_iDestFrame, pClosestBlock->m_iDestFrame+pClosestBlock->m_iFrames,
|
ss << "Approximate sound time: driver frame " << iSourceFrame << ", m_pImpl->m_Queue frame "
|
||||||
iClosestPositionDist, iClosestPosition );
|
<< pClosestBlock->m_iDestFrame << ".." << (pClosestBlock->m_iDestFrame+pClosestBlock->m_iFrames)
|
||||||
|
<< " (dist " << iClosestPositionDist << "), closest position is " << iClosestPosition;
|
||||||
|
LOG->Trace( "%s", ss.str().c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bApproximate )
|
if( bApproximate )
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ static unsigned long id3_parse_uint( const unsigned char **ptr, unsigned int byt
|
|||||||
|
|
||||||
switch (bytes)
|
switch (bytes)
|
||||||
{
|
{
|
||||||
case 4: value = (value << 8) | *(*ptr)++;
|
case 4: value = (value << 8) | *(*ptr)++; [[fallthrough]];
|
||||||
case 3: value = (value << 8) | *(*ptr)++;
|
case 3: value = (value << 8) | *(*ptr)++; [[fallthrough]];
|
||||||
case 2: value = (value << 8) | *(*ptr)++;
|
case 2: value = (value << 8) | *(*ptr)++; [[fallthrough]];
|
||||||
case 1: value = (value << 8) | *(*ptr)++;
|
case 1: value = (value << 8) | *(*ptr)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ static unsigned long id3_parse_syncsafe( const unsigned char **ptr, unsigned int
|
|||||||
switch (bytes)
|
switch (bytes)
|
||||||
{
|
{
|
||||||
case 5:
|
case 5:
|
||||||
value = (value << 4) | (*(*ptr)++ & 0x0f);
|
value = (value << 4) | (*(*ptr)++ & 0x0f); [[fallthrough]];
|
||||||
case 4:
|
case 4:
|
||||||
value = (value << 7) | (*(*ptr)++ & 0x7f);
|
value = (value << 7) | (*(*ptr)++ & 0x7f);
|
||||||
value = (value << 7) | (*(*ptr)++ & 0x7f);
|
value = (value << 7) | (*(*ptr)++ & 0x7f);
|
||||||
|
|||||||
@@ -253,13 +253,6 @@ int RageSoundReader_Merge::Read( float *pBuffer, int iFrames )
|
|||||||
}
|
}
|
||||||
|
|
||||||
int iGotFrames = pSound->Read( Buffer, iFrames - iFramesRead );
|
int iGotFrames = pSound->Read( Buffer, iFrames - iFramesRead );
|
||||||
if( 0 && /*i == 1 && */iGotFrames > 0 )
|
|
||||||
{
|
|
||||||
int iAt = aNextSourceFrames[i] + lrintf(iGotFrames * aRatios[i]);
|
|
||||||
if( iAt != m_aSounds[i]->GetNextSourceFrame() )
|
|
||||||
LOG->Trace( "%i: at %i, expected %i",
|
|
||||||
i, iAt, m_aSounds[i]->GetNextSourceFrame() );
|
|
||||||
}
|
|
||||||
aNextSourceFrames[i] = m_aSounds[i]->GetNextSourceFrame();
|
aNextSourceFrames[i] = m_aSounds[i]->GetNextSourceFrame();
|
||||||
aRatios[i] = m_aSounds[i]->GetStreamToSourceRatio();
|
aRatios[i] = m_aSounds[i]->GetStreamToSourceRatio();
|
||||||
// LOG->Trace( "read %i from %i; %i -> %i", iGotFrames, i, oldf, aNextSourceFrames[i] );
|
// LOG->Trace( "read %i from %i; %i -> %i", iGotFrames, i, oldf, aNextSourceFrames[i] );
|
||||||
|
|||||||
@@ -120,8 +120,6 @@ namespace
|
|||||||
i2 = i1;
|
i2 = i1;
|
||||||
i1 = iRem;
|
i1 = iRem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ int RageSoundReader_Vorbisfile::Read( float *buf, int iFrames )
|
|||||||
/* The timestamps moved backwards. Ignore it. This file probably
|
/* The timestamps moved backwards. Ignore it. This file probably
|
||||||
* won't sync correctly. */
|
* won't sync correctly. */
|
||||||
LOG->Trace( "p ahead %p %i < %i, we're ahead by %i",
|
LOG->Trace( "p ahead %p %i < %i, we're ahead by %i",
|
||||||
this, curofs, read_offset, read_offset-curofs );
|
static_cast<void*>(this), curofs, read_offset, read_offset-curofs );
|
||||||
read_offset = curofs;
|
read_offset = curofs;
|
||||||
}
|
}
|
||||||
else if( curofs > read_offset )
|
else if( curofs > read_offset )
|
||||||
|
|||||||
+8
-10
@@ -41,21 +41,19 @@ RageSurfaceFormat::RageSurfaceFormat():
|
|||||||
Rmask(Mask[0]), Gmask(Mask[1]), Bmask(Mask[2]), Amask(Mask[3]),
|
Rmask(Mask[0]), Gmask(Mask[1]), Bmask(Mask[2]), Amask(Mask[3]),
|
||||||
Rshift(Shift[0]), Gshift(Shift[1]), Bshift(Shift[2]), Ashift(Shift[3])
|
Rshift(Shift[0]), Gshift(Shift[1]), Bshift(Shift[2]), Ashift(Shift[3])
|
||||||
{
|
{
|
||||||
palette = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RageSurfaceFormat::RageSurfaceFormat( const RageSurfaceFormat &cpy ):
|
RageSurfaceFormat::RageSurfaceFormat( const RageSurfaceFormat &cpy ):
|
||||||
Rmask(Mask[0]), Gmask(Mask[1]), Bmask(Mask[2]), Amask(Mask[3]),
|
Rmask(Mask[0]), Gmask(Mask[1]), Bmask(Mask[2]), Amask(Mask[3]),
|
||||||
Rshift(Shift[0]), Gshift(Shift[1]), Bshift(Shift[2]), Ashift(Shift[3])
|
Rshift(Shift[0]), Gshift(Shift[1]), Bshift(Shift[2]), Ashift(Shift[3])
|
||||||
{
|
{
|
||||||
memcpy( this, &cpy, sizeof(RageSurfaceFormat) );
|
BytesPerPixel = cpy.BytesPerPixel;
|
||||||
|
BitsPerPixel = cpy.BitsPerPixel;
|
||||||
|
Mask = cpy.Mask;
|
||||||
|
Shift = cpy.Shift;
|
||||||
|
Loss = cpy.Loss;
|
||||||
if( palette )
|
if( palette )
|
||||||
palette = new RageSurfacePalette( *palette );
|
palette = std::make_unique<RageSurfacePalette>(*palette);
|
||||||
}
|
|
||||||
|
|
||||||
RageSurfaceFormat::~RageSurfaceFormat()
|
|
||||||
{
|
|
||||||
delete palette;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSurfaceFormat::GetRGB( uint32_t val, uint8_t *r, uint8_t *g, uint8_t *b ) const
|
void RageSurfaceFormat::GetRGB( uint32_t val, uint8_t *r, uint8_t *g, uint8_t *b ) const
|
||||||
@@ -98,7 +96,7 @@ bool RageSurfaceFormat::operator== ( const RageSurfaceFormat &rhs ) const
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( BytesPerPixel == 1 )
|
if( BytesPerPixel == 1 )
|
||||||
if( memcmp( palette, rhs.palette, sizeof(RageSurfaceFormat) ) )
|
if( memcmp( palette.get(), rhs.palette.get(), sizeof(RageSurfaceFormat) ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -191,7 +189,7 @@ void SetupFormat( RageSurfaceFormat &fmt,
|
|||||||
// Loss for paletted textures is zero; the actual palette entries are 8-bit.
|
// Loss for paletted textures is zero; the actual palette entries are 8-bit.
|
||||||
ZERO( fmt.Loss );
|
ZERO( fmt.Loss );
|
||||||
|
|
||||||
fmt.palette = new RageSurfacePalette;
|
fmt.palette = std::make_unique<RageSurfacePalette>();
|
||||||
fmt.palette->ncolors = 256;
|
fmt.palette->ncolors = 256;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+8
-5
@@ -3,6 +3,9 @@
|
|||||||
#ifndef RAGE_SURFACE_H
|
#ifndef RAGE_SURFACE_H
|
||||||
#define RAGE_SURFACE_H
|
#define RAGE_SURFACE_H
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
/* XXX remove? */
|
/* XXX remove? */
|
||||||
struct RageSurfaceColor
|
struct RageSurfaceColor
|
||||||
{
|
{
|
||||||
@@ -40,16 +43,16 @@ struct RageSurfaceFormat
|
|||||||
{
|
{
|
||||||
RageSurfaceFormat();
|
RageSurfaceFormat();
|
||||||
RageSurfaceFormat( const RageSurfaceFormat &cpy );
|
RageSurfaceFormat( const RageSurfaceFormat &cpy );
|
||||||
~RageSurfaceFormat();
|
~RageSurfaceFormat() = default;
|
||||||
|
|
||||||
int32_t BytesPerPixel;
|
int32_t BytesPerPixel;
|
||||||
int32_t BitsPerPixel;
|
int32_t BitsPerPixel;
|
||||||
uint32_t Mask[4];
|
std::array<uint32_t, 4> Mask;
|
||||||
uint32_t Shift[4];
|
std::array<uint32_t, 4> Shift;
|
||||||
uint8_t Loss[4];
|
std::array<uint32_t, 4> Loss;
|
||||||
uint32_t &Rmask, &Gmask, &Bmask, &Amask; /* deprecated */
|
uint32_t &Rmask, &Gmask, &Bmask, &Amask; /* deprecated */
|
||||||
uint32_t &Rshift, &Gshift, &Bshift, &Ashift; /* deprecated */
|
uint32_t &Rshift, &Gshift, &Bshift, &Ashift; /* deprecated */
|
||||||
RageSurfacePalette *palette;
|
std::unique_ptr<RageSurfacePalette> palette;
|
||||||
|
|
||||||
void GetRGB( uint32_t val, uint8_t *r, uint8_t *g, uint8_t *b ) const;
|
void GetRGB( uint32_t val, uint8_t *r, uint8_t *g, uint8_t *b ) const;
|
||||||
|
|
||||||
|
|||||||
+24
-30
@@ -12,7 +12,7 @@ uint32_t RageSurfaceUtils::decodepixel( const uint8_t *p, int bpp )
|
|||||||
case 1: return *p;
|
case 1: return *p;
|
||||||
case 2: return *(uint16_t *)p;
|
case 2: return *(uint16_t *)p;
|
||||||
case 3:
|
case 3:
|
||||||
if( BYTE_ORDER == BIG_ENDIAN )
|
if constexpr ( Endian::big )
|
||||||
return p[0] << 16 | p[1] << 8 | p[2];
|
return p[0] << 16 | p[1] << 8 | p[2];
|
||||||
else
|
else
|
||||||
return p[0] | p[1] << 8 | p[2] << 16;
|
return p[0] | p[1] << 8 | p[2] << 16;
|
||||||
@@ -29,7 +29,7 @@ void RageSurfaceUtils::encodepixel( uint8_t *p, int bpp, uint32_t pixel )
|
|||||||
case 1: *p = uint8_t(pixel); break;
|
case 1: *p = uint8_t(pixel); break;
|
||||||
case 2: *(uint16_t *)p = uint16_t(pixel); break;
|
case 2: *(uint16_t *)p = uint16_t(pixel); break;
|
||||||
case 3:
|
case 3:
|
||||||
if( BYTE_ORDER == BIG_ENDIAN )
|
if constexpr ( Endian::big )
|
||||||
{
|
{
|
||||||
p[0] = uint8_t((pixel >> 16) & 0xff);
|
p[0] = uint8_t((pixel >> 16) & 0xff);
|
||||||
p[1] = uint8_t((pixel >> 8) & 0xff);
|
p[1] = uint8_t((pixel >> 8) & 0xff);
|
||||||
@@ -518,10 +518,10 @@ static bool blit_rgba_to_rgba( const RageSurface *src_surf, const RageSurface *d
|
|||||||
const int srcskip = src_surf->pitch - width*src_surf->format->BytesPerPixel;
|
const int srcskip = src_surf->pitch - width*src_surf->format->BytesPerPixel;
|
||||||
const int dstskip = dst_surf->pitch - width*dst_surf->format->BytesPerPixel;
|
const int dstskip = dst_surf->pitch - width*dst_surf->format->BytesPerPixel;
|
||||||
|
|
||||||
const uint32_t *src_shifts = src_surf->format->Shift;
|
const auto &src_shifts = src_surf->format->Shift;
|
||||||
const uint32_t *dst_shifts = dst_surf->format->Shift;
|
const auto &dst_shifts = dst_surf->format->Shift;
|
||||||
const uint32_t *src_masks = src_surf->format->Mask;
|
const auto &src_masks = src_surf->format->Mask;
|
||||||
const uint32_t *dst_masks = dst_surf->format->Mask;
|
const auto &dst_masks = dst_surf->format->Mask;
|
||||||
|
|
||||||
uint8_t lookup[4][256];
|
uint8_t lookup[4][256];
|
||||||
for( int c = 0; c < 4; ++c )
|
for( int c = 0; c < 4; ++c )
|
||||||
@@ -833,44 +833,38 @@ RageSurface *RageSurfaceUtils::LoadSurface( RString file )
|
|||||||
* two bits are the alpha component.
|
* two bits are the alpha component.
|
||||||
*
|
*
|
||||||
* This gives us a generic way to handle arbitrary 8-bit texture formats. */
|
* This gives us a generic way to handle arbitrary 8-bit texture formats. */
|
||||||
RageSurface *RageSurfaceUtils::PalettizeToGrayscale( const RageSurface *src_surf, int GrayBits, int AlphaBits )
|
RageSurface *RageSurfaceUtils::PalettizeToGrayscale( const RageSurface *src_surf, uint32_t GrayBits, uint32_t AlphaBits )
|
||||||
{
|
{
|
||||||
AlphaBits = std::min( AlphaBits, 8-src_surf->format->Loss[3] );
|
AlphaBits = std::min( AlphaBits, 8-src_surf->format->Loss[3] );
|
||||||
|
|
||||||
const int TotalBits = GrayBits + AlphaBits;
|
const auto TotalBits = GrayBits + AlphaBits;
|
||||||
ASSERT( TotalBits <= 8 );
|
ASSERT( TotalBits <= 8 );
|
||||||
|
|
||||||
RageSurface *dst_surf = CreateSurface(src_surf->w, src_surf->h,
|
RageSurface *dst_surf = CreateSurface(src_surf->w, src_surf->h,
|
||||||
8, 0,0,0,0 );
|
8, 0,0,0,0 );
|
||||||
|
|
||||||
// Set up the palette.
|
// Set up the palette.
|
||||||
const int TotalColors = 1 << TotalBits;
|
const auto TotalColors = 1u << TotalBits;
|
||||||
const int Ivalues = 1 << GrayBits; // number of intensity values
|
const auto Ivalues = 1u << GrayBits; // number of intensity values
|
||||||
const int Ishift = 0; // intensity shift
|
const auto Ishift = 0u; // intensity shift
|
||||||
const int Imask = ((1 << GrayBits) - 1) << Ishift; // intensity mask
|
const auto Imask = ((1u << GrayBits) - 1u) << Ishift; // intensity mask
|
||||||
const int Iloss = 8-GrayBits;
|
const auto Iloss = 8u-GrayBits;
|
||||||
|
|
||||||
const int Avalues = 1 << AlphaBits; // number of alpha values
|
const auto Avalues = 1u << AlphaBits; // number of alpha values
|
||||||
const int Ashift = GrayBits; // alpha shift
|
const auto Ashift = GrayBits; // alpha shift
|
||||||
const int Amask = ((1 << AlphaBits) - 1) << Ashift; // alpha mask
|
const auto Amask = ((1u << AlphaBits) - 1u) << Ashift; // alpha mask
|
||||||
const int Aloss = 8-AlphaBits;
|
const auto Aloss = 8u-AlphaBits;
|
||||||
|
|
||||||
for( int index = 0; index < TotalColors; ++index )
|
for( size_t index = 0; index < TotalColors; ++index )
|
||||||
{
|
{
|
||||||
const int I = (index & Imask) >> Ishift;
|
const auto I = (index & Imask) >> Ishift;
|
||||||
const int A = (index & Amask) >> Ashift;
|
const auto A = (index & Amask) >> Ashift;
|
||||||
|
|
||||||
int ScaledI;
|
// if only one intensity value, always fullbright
|
||||||
if( Ivalues == 1 )
|
const auto ScaledI = Ivalues == 1 ? 255 : clamp( lrintf(I * (255.0f / (Ivalues-1))), 0L, 255L );
|
||||||
ScaledI = 255; // if only one intensity value, always fullbright
|
|
||||||
else
|
|
||||||
ScaledI = clamp( lrintf(I * (255.0f / (Ivalues-1))), 0L, 255L );
|
|
||||||
|
|
||||||
int ScaledA;
|
// if only one alpha value, always opaque
|
||||||
if( Avalues == 1 )
|
const auto ScaledA = Avalues == 1 ? 255 : clamp( lrintf(A * (255.0f / (Avalues-1))), 0L, 255L );
|
||||||
ScaledA = 255; // if only one alpha value, always opaque
|
|
||||||
else
|
|
||||||
ScaledA = clamp( lrintf(A * (255.0f / (Avalues-1))), 0L, 255L );
|
|
||||||
|
|
||||||
RageSurfaceColor c;
|
RageSurfaceColor c;
|
||||||
c.r = uint8_t(ScaledI);
|
c.r = uint8_t(ScaledI);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace RageSurfaceUtils
|
|||||||
RageSurface *LoadSurface( RString file );
|
RageSurface *LoadSurface( RString file );
|
||||||
|
|
||||||
/* Quickly palettize to an gray/alpha texture. */
|
/* Quickly palettize to an gray/alpha texture. */
|
||||||
RageSurface *PalettizeToGrayscale( const RageSurface *src_surf, int GrayBits, int AlphaBits );
|
RageSurface *PalettizeToGrayscale( const RageSurface *src_surf, uint32_t GrayBits, uint32_t AlphaBits );
|
||||||
|
|
||||||
RageSurface *MakeDummySurface( int height, int width );
|
RageSurface *MakeDummySurface( int height, int width );
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ void RageSurfaceUtils::Palettize( RageSurface *&pImg, int iColors, bool bDither
|
|||||||
|
|
||||||
// Rescale the palette colors to a maxval of 255.
|
// Rescale the palette colors to a maxval of 255.
|
||||||
{
|
{
|
||||||
RageSurfacePalette *pal = pRet->format->palette;
|
auto& pal = pRet->format->palette;
|
||||||
for( int x = 0; x < pal->ncolors; ++x )
|
for( int x = 0; x < pal->ncolors; ++x )
|
||||||
{
|
{
|
||||||
// This is really just PAM_DEPTH() broken out for the palette.
|
// This is really just PAM_DEPTH() broken out for the palette.
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ RageSurfaceUtils::OpenResult RageSurface_Load_GIF( const RString &sPath, RageSur
|
|||||||
imageCount, imageCount > 1 ? "s" : "");
|
imageCount, imageCount > 1 ? "s" : "");
|
||||||
return RageSurfaceUtils::OPEN_FATAL_ERROR;
|
return RageSurfaceUtils::OPEN_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
|
|
||||||
case '!':
|
case '!':
|
||||||
{
|
{
|
||||||
/* Extension */
|
/* Extension */
|
||||||
|
|||||||
@@ -27,10 +27,13 @@ struct my_jpeg_error_mgr
|
|||||||
{
|
{
|
||||||
struct jpeg_error_mgr pub; /* "public" fields */
|
struct jpeg_error_mgr pub; /* "public" fields */
|
||||||
|
|
||||||
|
uint8_t pad1[8]; // Explicitly add padding that's implicitly added by the compiler
|
||||||
|
|
||||||
jmp_buf setjmp_buffer; /* for return to caller */
|
jmp_buf setjmp_buffer; /* for return to caller */
|
||||||
char errorbuf[JMSG_LENGTH_MAX];
|
char errorbuf[JMSG_LENGTH_MAX];
|
||||||
};
|
|
||||||
|
|
||||||
|
uint8_t pad2[8]; // Explicitly add padding that's implicitly added by the compiler
|
||||||
|
};
|
||||||
|
|
||||||
void my_output_message( j_common_ptr cinfo )
|
void my_output_message( j_common_ptr cinfo )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
|
|||||||
ASSERT( img != nullptr );
|
ASSERT( img != nullptr );
|
||||||
|
|
||||||
row_pointers = new png_byte*[height];
|
row_pointers = new png_byte*[height];
|
||||||
CHECKPOINT_M( ssprintf("%p",row_pointers) );
|
CHECKPOINT_M( ssprintf("%p",static_cast<void*>(row_pointers)) );
|
||||||
|
|
||||||
for( unsigned y = 0; y < height; ++y )
|
for( unsigned y = 0; y < height; ++y )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ RageSurface *RageSurface_Load_XPM( char * const *xpm, RString &error )
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
RString clr = color.substr( color_length+4 );
|
RString clr = color.substr( color_length+4 );
|
||||||
int r, g, b;
|
unsigned int r, g, b;
|
||||||
if( sscanf( clr, "%2x%2x%2x", &r, &g, &b ) != 3 )
|
if( sscanf( clr, "%2x%2x%2x", &r, &g, &b ) != 3 )
|
||||||
continue;
|
continue;
|
||||||
RageSurfaceColor colorval;
|
RageSurfaceColor colorval;
|
||||||
|
|||||||
@@ -254,27 +254,8 @@ void RageTextureManager::DeleteTexture( RageTexture *t )
|
|||||||
m_texture_ids_by_pointer.erase(id_entry);
|
m_texture_ids_by_pointer.erase(id_entry);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
FAIL_M("Tried to delete a texture that wasn't in the ids by pointer list.");
|
|
||||||
for (std::map<RageTextureID, RageTexture *>::iterator iter = m_mapPathToTexture.begin(); iter != m_mapPathToTexture.end(); ++iter)
|
|
||||||
{
|
|
||||||
if( iter->second == t )
|
|
||||||
{
|
|
||||||
m_mapPathToTexture.erase( iter ); // remove map entry
|
|
||||||
SAFE_DELETE( t ); // free the texture
|
|
||||||
std::map<RageTextureID, RageTexture*>::iterator tex_update_entry=
|
|
||||||
m_textures_to_update.find(iter->first);
|
|
||||||
if(tex_update_entry != m_textures_to_update.end())
|
|
||||||
{
|
|
||||||
m_textures_to_update.erase(tex_update_entry);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FAIL_M("Tried to delete a texture that wasn't loaded");
|
FAIL_M("Tried to delete a texture that wasn't in the ids by pointer list.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageTextureManager::GarbageCollect( GCType type )
|
void RageTextureManager::GarbageCollect( GCType type )
|
||||||
|
|||||||
+38
-36
@@ -3,6 +3,8 @@
|
|||||||
#ifndef RAGETYPES_H
|
#ifndef RAGETYPES_H
|
||||||
#define RAGETYPES_H
|
#define RAGETYPES_H
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "EnumHelper.h"
|
#include "EnumHelper.h"
|
||||||
|
|
||||||
enum BlendMode
|
enum BlendMode
|
||||||
@@ -101,7 +103,7 @@ struct lua_State;
|
|||||||
struct RageVector2
|
struct RageVector2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RageVector2(): x(0), y(0) {}
|
RageVector2() = default;
|
||||||
RageVector2( const float * f ): x(f[0]), y(f[1]) {}
|
RageVector2( const float * f ): x(f[0]), y(f[1]) {}
|
||||||
RageVector2( float x1, float y1 ): x(x1), y(y1) {}
|
RageVector2( float x1, float y1 ): x(x1), y(y1) {}
|
||||||
|
|
||||||
@@ -123,14 +125,14 @@ public:
|
|||||||
|
|
||||||
friend RageVector2 operator * ( float f, const RageVector2& other ) { return other*f; }
|
friend RageVector2 operator * ( float f, const RageVector2& other ) { return other*f; }
|
||||||
|
|
||||||
float x, y;
|
float x{0}, y{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct RageVector3
|
struct RageVector3
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RageVector3(): x(0), y(0), z(0) {}
|
RageVector3() = default;
|
||||||
RageVector3( const float * f ): x(f[0]), y(f[1]), z(f[2]) {}
|
RageVector3( const float * f ): x(f[0]), y(f[1]), z(f[2]) {}
|
||||||
RageVector3( float x1, float y1, float z1 ): x(x1), y(y1), z(z1) {}
|
RageVector3( float x1, float y1, float z1 ): x(x1), y(y1), z(z1) {}
|
||||||
|
|
||||||
@@ -152,14 +154,14 @@ public:
|
|||||||
|
|
||||||
friend RageVector3 operator * ( float f, const RageVector3& other ) { return other*f; }
|
friend RageVector3 operator * ( float f, const RageVector3& other ) { return other*f; }
|
||||||
|
|
||||||
float x, y, z;
|
float x{0}, y{0}, z{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct RageVector4
|
struct RageVector4
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RageVector4(): x(0), y(0), z(0), w(0) {}
|
RageVector4() = default;
|
||||||
RageVector4( const float * f ): x(f[0]), y(f[1]), z(f[2]), w(f[3]) {}
|
RageVector4( const float * f ): x(f[0]), y(f[1]), z(f[2]), w(f[3]) {}
|
||||||
RageVector4( float x1, float y1, float z1, float w1 ): x(x1), y(y1), z(z1), w(w1) {}
|
RageVector4( float x1, float y1, float z1, float w1 ): x(x1), y(y1), z(z1), w(w1) {}
|
||||||
|
|
||||||
@@ -181,16 +183,24 @@ public:
|
|||||||
|
|
||||||
friend RageVector4 operator * ( float f, const RageVector4& other ) { return other*f; }
|
friend RageVector4 operator * ( float f, const RageVector4& other ) { return other*f; }
|
||||||
|
|
||||||
float x, y, z, w;
|
float x{0}, y{0}, z{0}, w{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RageColor
|
struct RageColor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RageColor(): r(0), g(0), b(0), a(0) {}
|
RageColor() = default;
|
||||||
explicit RageColor( const float * f ): r(f[0]), g(f[1]), b(f[2]), a(f[3]) {}
|
explicit RageColor( const float * f ): r(f[0]), g(f[1]), b(f[2]), a(f[3]) {}
|
||||||
RageColor( float r1, float g1, float b1, float a1 ): r(r1), g(g1), b(b1), a(a1) {}
|
RageColor( float r1, float g1, float b1, float a1 ): r(r1), g(g1), b(b1), a(a1) {}
|
||||||
|
|
||||||
|
RageColor& operator=( const RageVector4& rv4 ) {
|
||||||
|
r = rv4.x;
|
||||||
|
g = rv4.y;
|
||||||
|
b = rv4.z;
|
||||||
|
a = rv4.w;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// casting
|
// casting
|
||||||
operator float* () { return &r; };
|
operator float* () { return &r; };
|
||||||
operator const float* () const { return &r; };
|
operator const float* () const { return &r; };
|
||||||
@@ -228,7 +238,7 @@ public:
|
|||||||
if( result == 4 )
|
if( result == 4 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int ir=255, ib=255, ig=255, ia=255;
|
unsigned int ir=255, ib=255, ig=255, ia=255;
|
||||||
result = sscanf( str, "#%2x%2x%2x%2x", &ir, &ig, &ib, &ia );
|
result = sscanf( str, "#%2x%2x%2x%2x", &ir, &ig, &ib, &ia );
|
||||||
if( result >= 3 )
|
if( result >= 3 )
|
||||||
{
|
{
|
||||||
@@ -251,7 +261,7 @@ public:
|
|||||||
void FromStack( lua_State *L, int iPos );
|
void FromStack( lua_State *L, int iPos );
|
||||||
void FromStackCompat( lua_State *L, int iPos );
|
void FromStackCompat( lua_State *L, int iPos );
|
||||||
|
|
||||||
float r, g, b, a;
|
float r{0}, g{0}, b{0}, a{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Convert floating-point 0..1 value to integer 0..255 value. *
|
/* Convert floating-point 0..1 value to integer 0..255 value. *
|
||||||
@@ -310,9 +320,9 @@ inline unsigned char FTOC(float a)
|
|||||||
class RageVColor
|
class RageVColor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
uint8_t b,g,r,a; // specific ordering required by Direct3D
|
uint8_t b{0},g{0},r{0},a{0}; // specific ordering required by Direct3D
|
||||||
|
|
||||||
RageVColor(): b(0), g(0), r(0), a(0) { }
|
RageVColor() = default;
|
||||||
RageVColor(const RageColor &rc): b(0), g(0), r(0), a(0) { *this = rc; }
|
RageVColor(const RageColor &rc): b(0), g(0), r(0), a(0) { *this = rc; }
|
||||||
RageVColor &operator= (const RageColor &rc)
|
RageVColor &operator= (const RageColor &rc)
|
||||||
{
|
{
|
||||||
@@ -327,7 +337,7 @@ namespace StepMania
|
|||||||
class Rect
|
class Rect
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Rect(): left(0), top(0), right(0), bottom(0) {}
|
Rect() = default;
|
||||||
Rect(T l, T t, T r, T b): left(l), top(t), right(r), bottom(b) {}
|
Rect(T l, T t, T r, T b): left(l), top(t), right(r), bottom(b) {}
|
||||||
|
|
||||||
T GetWidth() const { return right-left; };
|
T GetWidth() const { return right-left; };
|
||||||
@@ -347,7 +357,7 @@ public:
|
|||||||
}
|
}
|
||||||
bool operator!=( const Rect &other ) const { return !operator==(other); }
|
bool operator!=( const Rect &other ) const { return !operator==(other); }
|
||||||
|
|
||||||
T left, top, right, bottom;
|
T left{}, top{}, right{}, bottom{};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
typedef StepMania::Rect<int> RectI;
|
typedef StepMania::Rect<int> RectI;
|
||||||
@@ -357,11 +367,11 @@ typedef StepMania::Rect<float> RectF;
|
|||||||
* have the same layout that D3D expects. */
|
* have the same layout that D3D expects. */
|
||||||
struct RageSpriteVertex // has color
|
struct RageSpriteVertex // has color
|
||||||
{
|
{
|
||||||
RageSpriteVertex(): p(), n(), c(), t() {}
|
RageSpriteVertex() = default;
|
||||||
RageVector3 p; // position
|
RageVector3 p{}; // position
|
||||||
RageVector3 n; // normal
|
RageVector3 n{}; // normal
|
||||||
RageVColor c; // diffuse color
|
RageVColor c{}; // diffuse color
|
||||||
RageVector2 t; // texture coordinates
|
RageVector2 t{}; // texture coordinates
|
||||||
};
|
};
|
||||||
|
|
||||||
void lerp_rage_color(RageColor& out, RageColor const& a, RageColor const& b, float t);
|
void lerp_rage_color(RageColor& out, RageColor const& a, RageColor const& b, float t);
|
||||||
@@ -369,19 +379,12 @@ void WeightedAvergeOfRSVs(RageSpriteVertex& average_out, RageSpriteVertex const&
|
|||||||
|
|
||||||
struct RageModelVertex // doesn't have color. Relies on material color
|
struct RageModelVertex // doesn't have color. Relies on material color
|
||||||
{
|
{
|
||||||
/* Zero out by default. */
|
RageModelVertex() = default;
|
||||||
RageModelVertex():
|
RageVector3 p{}; // position
|
||||||
p(0,0,0),
|
RageVector3 n{}; // normal
|
||||||
n(0,0,0),
|
RageVector2 t{}; // texture coordinates
|
||||||
t(0,0),
|
int8_t bone{0};
|
||||||
bone(0),
|
RageVector2 TextureMatrixScale{1,1}; // usually 1,1
|
||||||
TextureMatrixScale(1,1)
|
|
||||||
{ }
|
|
||||||
RageVector3 p; // position
|
|
||||||
RageVector3 n; // normal
|
|
||||||
RageVector2 t; // texture coordinates
|
|
||||||
int8_t bone;
|
|
||||||
RageVector2 TextureMatrixScale; // usually 1,1
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -394,9 +397,8 @@ struct RageModelVertex // doesn't have color. Relies on material color
|
|||||||
struct RageMatrix
|
struct RageMatrix
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RageMatrix() {};
|
RageMatrix() = default;
|
||||||
RageMatrix( const float *f ) { for(int i=0; i<4; i++) for(int j=0; j<4; j++) m[j][i]=f[j*4+i]; }
|
RageMatrix( const float *f ) { for(int i=0; i<4; i++) for(int j=0; j<4; j++) m[j][i]=f[j*4+i]; }
|
||||||
RageMatrix( const RageMatrix& other ) { for(int i=0; i<4; i++) for(int j=0; j<4; j++) m[j][i]=other.m[j][i]; }
|
|
||||||
RageMatrix( float v00, float v01, float v02, float v03,
|
RageMatrix( float v00, float v01, float v02, float v03,
|
||||||
float v10, float v11, float v12, float v13,
|
float v10, float v11, float v12, float v13,
|
||||||
float v20, float v21, float v22, float v23,
|
float v20, float v21, float v22, float v23,
|
||||||
@@ -407,12 +409,12 @@ public:
|
|||||||
float operator () ( int iRow, int iCol ) const { return m[iCol][iRow]; }
|
float operator () ( int iRow, int iCol ) const { return m[iCol][iRow]; }
|
||||||
|
|
||||||
// casting operators
|
// casting operators
|
||||||
operator float* () { return m[0]; }
|
operator float* () { return m[0].data(); }
|
||||||
operator const float* () const { return m[0]; }
|
operator const float* () const { return m[0].data(); }
|
||||||
|
|
||||||
RageMatrix GetTranspose() const;
|
RageMatrix GetTranspose() const;
|
||||||
|
|
||||||
float m[4][4];
|
std::array<std::array<float, 4>, 4> m{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+7
-9
@@ -3,6 +3,7 @@
|
|||||||
#include "RageMath.h"
|
#include "RageMath.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
|
#include "RageFileDriverDirectHelpers.h"
|
||||||
#include "RageSoundReader_FileReader.h"
|
#include "RageSoundReader_FileReader.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
#include "LuaBinding.h"
|
#include "LuaBinding.h"
|
||||||
@@ -1086,7 +1087,7 @@ bool GetCommandlineArgument( const RString &option, RString *argument, int iInde
|
|||||||
RString GetCwd()
|
RString GetCwd()
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
bool ret = getcwd(buf, PATH_MAX) != nullptr;
|
bool ret = DoGetCwd(buf, PATH_MAX) != nullptr;
|
||||||
ASSERT(ret);
|
ASSERT(ret);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@@ -1980,7 +1981,7 @@ void ReplaceEntityText( RString &sText, const std::map<char, RString> &m )
|
|||||||
{
|
{
|
||||||
RString sFind;
|
RString sFind;
|
||||||
|
|
||||||
for (std::pair<char, RString> const &c : m)
|
for (const auto &c : m)
|
||||||
sFind.append( 1, c.first );
|
sFind.append( 1, c.first );
|
||||||
|
|
||||||
RString sRet;
|
RString sRet;
|
||||||
@@ -2058,11 +2059,8 @@ void Replace_Unicode_Markers( RString &sText )
|
|||||||
continue;
|
continue;
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
int iNum;
|
unsigned int iNum;
|
||||||
if( bHex )
|
sscanf( sText.c_str()+iPos, bHex ? "&x%x;" : "&#%u;", &iNum );
|
||||||
sscanf( sText.c_str()+iPos, "&x%x;", &iNum );
|
|
||||||
else
|
|
||||||
sscanf( sText.c_str()+iPos, "&#%i;", &iNum );
|
|
||||||
if( iNum > 0xFFFF )
|
if( iNum > 0xFFFF )
|
||||||
iNum = INVALID_CHAR;
|
iNum = INVALID_CHAR;
|
||||||
|
|
||||||
@@ -2509,7 +2507,7 @@ int LuaFunc_JsonEncode(lua_State* L)
|
|||||||
Json::Value array(Json::arrayValue);
|
Json::Value array(Json::arrayValue);
|
||||||
array.resize(len);
|
array.resize(len);
|
||||||
|
|
||||||
for (int i = 0; i < len; i++)
|
for (unsigned int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
lua_rawgeti(L, index, i + 1);
|
lua_rawgeti(L, index, i + 1);
|
||||||
array[i] = convert(-1);
|
array[i] = convert(-1);
|
||||||
@@ -2615,7 +2613,7 @@ int LuaFunc_JsonDecode(lua_State* L)
|
|||||||
else if (val.isArray())
|
else if (val.isArray())
|
||||||
{
|
{
|
||||||
lua_createtable(L, val.size(), 0);
|
lua_createtable(L, val.size(), 0);
|
||||||
for (int i = 0; i < val.size(); i++)
|
for (unsigned int i = 0; i < val.size(); i++)
|
||||||
{
|
{
|
||||||
convert(val[i]);
|
convert(val[i]);
|
||||||
lua_rawseti(L, -2, i + 1);
|
lua_rawseti(L, -2, i + 1);
|
||||||
|
|||||||
+24
-16
@@ -3,6 +3,8 @@
|
|||||||
#ifndef RAGE_UTIL_H
|
#ifndef RAGE_UTIL_H
|
||||||
#define RAGE_UTIL_H
|
#define RAGE_UTIL_H
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <bit>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -25,7 +27,7 @@ class RageFileDriver;
|
|||||||
extern const RString CUSTOM_SONG_PATH;
|
extern const RString CUSTOM_SONG_PATH;
|
||||||
|
|
||||||
/** @brief If outside the range from low to high, bring it within range. */
|
/** @brief If outside the range from low to high, bring it within range. */
|
||||||
#define clamp(val,low,high) ( std::max( (low), std::min((val),(high)) ) )
|
#define clamp(val,low,high) std::clamp( val, low, high )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Scales x so that l1 corresponds to l2 and h1 corresponds to h2.
|
* @brief Scales x so that l1 corresponds to l2 and h1 corresponds to h2.
|
||||||
@@ -183,6 +185,21 @@ static inline T enum_cycle( T val, int iMax, int iAmt = 1 )
|
|||||||
return static_cast<T>( iVal );
|
return static_cast<T>( iVal );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Endian
|
||||||
|
{
|
||||||
|
// When std::endian is supported by all desired compilers, we can eliminate the #ifdefs
|
||||||
|
// (At least) the current compiler used for the Ubuntu 20.04 build does not support this.
|
||||||
|
#if defined(__cpp_lib_endian)
|
||||||
|
inline constexpr bool little = std::endian::native == std::endian::little;
|
||||||
|
inline constexpr bool big = std::endian::native == std::endian::big;
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
inline constexpr bool little = false;
|
||||||
|
inline constexpr bool big = true;
|
||||||
|
#else
|
||||||
|
inline constexpr bool little = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__;
|
||||||
|
inline constexpr bool big = __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* We only have unsigned swaps; byte swapping a signed value doesn't make sense.
|
/* We only have unsigned swaps; byte swapping a signed value doesn't make sense.
|
||||||
*
|
*
|
||||||
@@ -215,21 +232,12 @@ inline uint16_t Swap16( uint16_t n )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENDIAN_LITTLE)
|
inline uint32_t Swap32LE( uint32_t n ) { return Endian::little ? n : Swap32( n ); }
|
||||||
inline uint32_t Swap32LE( uint32_t n ) { return n; }
|
inline uint32_t Swap24LE( uint32_t n ) { return Endian::little ? n : Swap24( n ); }
|
||||||
inline uint32_t Swap24LE( uint32_t n ) { return n; }
|
inline uint16_t Swap16LE( uint16_t n ) { return Endian::little ? n : Swap16( n ); }
|
||||||
inline uint16_t Swap16LE( uint16_t n ) { return n; }
|
inline uint32_t Swap32BE( uint32_t n ) { return Endian::big ? n : Swap32( n ); }
|
||||||
inline uint32_t Swap32BE( uint32_t n ) { return Swap32( n ); }
|
inline uint32_t Swap24BE( uint32_t n ) { return Endian::big ? n : Swap24( n ); }
|
||||||
inline uint32_t Swap24BE( uint32_t n ) { return Swap24( n ); }
|
inline uint16_t Swap16BE( uint16_t n ) { return Endian::big ? n : Swap16( n ); }
|
||||||
inline uint16_t Swap16BE( uint16_t n ) { return Swap16( n ); }
|
|
||||||
#else
|
|
||||||
inline uint32_t Swap32BE( uint32_t n ) { return n; }
|
|
||||||
inline uint32_t Swap24BE( uint32_t n ) { return n; }
|
|
||||||
inline uint16_t Swap16BE( uint16_t n ) { return n; }
|
|
||||||
inline uint32_t Swap32LE( uint32_t n ) { return Swap32( n ); }
|
|
||||||
inline uint32_t Swap24LE( uint32_t n ) { return Swap24( n ); }
|
|
||||||
inline uint16_t Swap16LE( uint16_t n ) { return Swap16( n ); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class MersenneTwister : public std::mt19937
|
class MersenneTwister : public std::mt19937
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -176,6 +176,8 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool isNull() const { return !m_pPtr; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T *m_pPtr;
|
T *m_pPtr;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ BackgroundLoader::BackgroundLoader():
|
|||||||
if( !g_bEnableBackgroundLoading )
|
if( !g_bEnableBackgroundLoading )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_sCachePathPrefix = ssprintf( "@mem/%p", this );
|
m_sCachePathPrefix = ssprintf( "@mem/%p", static_cast<void*>(this) );
|
||||||
|
|
||||||
m_bShutdownThread = false;
|
m_bShutdownThread = false;
|
||||||
m_sThreadIsActive = m_sThreadShouldAbort = false;
|
m_sThreadIsActive = m_sThreadShouldAbort = false;
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ public:
|
|||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
read_pos = write_pos = 0;
|
read_pos = 0;
|
||||||
|
write_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Indicate that n elements have been written. */
|
/* Indicate that n elements have been written. */
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ void ScoreDisplayRave::Update( float fDelta )
|
|||||||
m_textLevel.SetText( ssprintf("%d",level+1) );
|
m_textLevel.SetText( ssprintf("%d",level+1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
float fPercent = fLevel - level;
|
float fPercent = fLevel - Enum::to_integral(level);
|
||||||
m_sprMeter[level].SetCropRight( 1-fPercent );
|
m_sprMeter[level].SetCropRight( 1-fPercent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ void ScoreKeeperRave::AddSuperMeterDelta( float fUnscaledPercentChange )
|
|||||||
{
|
{
|
||||||
if( PREFSMAN->m_bMercifulDrain && fUnscaledPercentChange<0 )
|
if( PREFSMAN->m_bMercifulDrain && fUnscaledPercentChange<0 )
|
||||||
{
|
{
|
||||||
float fSuperPercentage = m_pPlayerState->m_fSuperMeter / NUM_ATTACK_LEVELS;
|
float fSuperPercentage = m_pPlayerState->m_fSuperMeter / Enum::to_integral(NUM_ATTACK_LEVELS);
|
||||||
fUnscaledPercentChange *= SCALE( fSuperPercentage, 0.f, 1.f, 0.5f, 1.f);
|
fUnscaledPercentChange *= SCALE( fSuperPercentage, 0.f, 1.f, 0.5f, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -3238,6 +3238,7 @@ bool ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// fall through to input handling logic:
|
// fall through to input handling logic:
|
||||||
|
[[fallthrough]];
|
||||||
case PLAYER_1:
|
case PLAYER_1:
|
||||||
{
|
{
|
||||||
switch( gbt )
|
switch( gbt )
|
||||||
@@ -5255,12 +5256,12 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const std::vector<int>
|
|||||||
case tempo:
|
case tempo:
|
||||||
{
|
{
|
||||||
// This affects all steps.
|
// This affects all steps.
|
||||||
AlterType at = (AlterType)answers[c];
|
const auto tt = static_cast<TempoType>(answers[c]);
|
||||||
float fScale = -1;
|
float fScale = -1;
|
||||||
|
|
||||||
switch( at )
|
switch( tt )
|
||||||
{
|
{
|
||||||
DEFAULT_FAIL( at );
|
DEFAULT_FAIL( tt );
|
||||||
case compress_2x: fScale = 0.5f; break;
|
case compress_2x: fScale = 0.5f; break;
|
||||||
case compress_3_2: fScale = 2.0f/3; break;
|
case compress_3_2: fScale = 2.0f/3; break;
|
||||||
case compress_4_3: fScale = 0.75f; break;
|
case compress_4_3: fScale = 0.75f; break;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void ScreenGameplayLesson::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
ResetAndRestartCurrentSong();
|
ResetAndRestartCurrentSong();
|
||||||
|
|
||||||
m_Try = (Try)(m_Try+1);
|
m_Try = (Try)(m_Try+1);
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_LessonTry1+m_Try) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_LessonTry1+Enum::to_integral(m_Try)) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -164,7 +164,7 @@ void ScreenGameplayLesson::ChangeLessonPage( int iDir )
|
|||||||
|
|
||||||
ResetAndRestartCurrentSong();
|
ResetAndRestartCurrentSong();
|
||||||
|
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_LessonTry1+m_Try) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_LessonTry1+Enum::to_integral(m_Try)) );
|
||||||
|
|
||||||
// Change back to the current autoplay setting (in most cases, human controlled).
|
// Change back to the current autoplay setting (in most cases, human controlled).
|
||||||
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
|
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
|
||||||
|
|||||||
@@ -1269,7 +1269,7 @@ bool ScreenOptions::MenuLeft( const InputEventPlus &input )
|
|||||||
ChangeValueInRowRelative(m_iCurrentRow[input.pn],input.pn,-1, input.type != IET_FIRST_PRESS);
|
ChangeValueInRowRelative(m_iCurrentRow[input.pn],input.pn,-1, input.type != IET_FIRST_PRESS);
|
||||||
|
|
||||||
PlayerNumber pn = input.pn;
|
PlayerNumber pn = input.pn;
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+Enum::to_integral(pn)) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1281,7 +1281,7 @@ bool ScreenOptions::MenuRight( const InputEventPlus &input )
|
|||||||
ChangeValueInRowRelative(m_iCurrentRow[input.pn], input.pn,+1, input.type != IET_FIRST_PRESS);
|
ChangeValueInRowRelative(m_iCurrentRow[input.pn], input.pn,+1, input.type != IET_FIRST_PRESS);
|
||||||
|
|
||||||
PlayerNumber pn = input.pn;
|
PlayerNumber pn = input.pn;
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+Enum::to_integral(pn)) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1289,7 +1289,7 @@ bool ScreenOptions::MenuUp( const InputEventPlus &input )
|
|||||||
{
|
{
|
||||||
MenuUpDown( input, -1 );
|
MenuUpDown( input, -1 );
|
||||||
PlayerNumber pn = input.pn;
|
PlayerNumber pn = input.pn;
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+Enum::to_integral(pn)) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1297,7 +1297,7 @@ bool ScreenOptions::MenuDown( const InputEventPlus &input )
|
|||||||
{
|
{
|
||||||
MenuUpDown( input, +1 );
|
MenuUpDown( input, +1 );
|
||||||
PlayerNumber pn = input.pn;
|
PlayerNumber pn = input.pn;
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+Enum::to_integral(pn)) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,17 @@ int FindClosestEntry( T value, const U *mapping, unsigned cnt )
|
|||||||
|
|
||||||
for( unsigned i = 0; i < cnt; ++i )
|
for( unsigned i = 0; i < cnt; ++i )
|
||||||
{
|
{
|
||||||
const U val = mapping[i];
|
// Need to use if constexpr here so the compiler doesn't even
|
||||||
|
// attempt to parse the else branch for enums
|
||||||
|
const T val = [&]{
|
||||||
|
if constexpr (std::is_enum<U>::value) {
|
||||||
|
return Enum::to_integral(mapping[i]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return mapping[i];
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
float dist = value < val? (float)(val-value):(float)(value-val);
|
float dist = value < val? (float)(val-value):(float)(value-val);
|
||||||
if( have_best && best_dist < dist )
|
if( have_best && best_dist < dist )
|
||||||
continue;
|
continue;
|
||||||
@@ -64,10 +74,7 @@ int FindClosestEntry( T value, const U *mapping, unsigned cnt )
|
|||||||
iBestIndex = i;
|
iBestIndex = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( have_best )
|
|
||||||
return iBestIndex;
|
return iBestIndex;
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -845,7 +852,7 @@ static void InitializeConfOptions()
|
|||||||
ADD(ConfOption("CustomSongsMaxCount", CustomSongsCount, "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "1000"));
|
ADD(ConfOption("CustomSongsMaxCount", CustomSongsCount, "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "1000"));
|
||||||
ADD(ConfOption("CustomSongsLoadTimeout", CustomSongsLoadTimeout, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "20", "30", "1000"));
|
ADD(ConfOption("CustomSongsLoadTimeout", CustomSongsLoadTimeout, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "20", "30", "1000"));
|
||||||
ADD(ConfOption("CustomSongsMaxSeconds", CustomSongsMaxSeconds, "60", "90", "120", "150", "180", "210", "240", "10000"));
|
ADD(ConfOption("CustomSongsMaxSeconds", CustomSongsMaxSeconds, "60", "90", "120", "150", "180", "210", "240", "10000"));
|
||||||
ADD(ConfOption("CustomSongsMaxMegabytes", CustomSongsLoadTimeout, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "20", "30", "1000"));
|
ADD(ConfOption("CustomSongsMaxMegabytes", CustomSongsMaxMegabytes, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "20", "30", "1000"));
|
||||||
|
|
||||||
// Machine options
|
// Machine options
|
||||||
ADD( ConfOption( "MenuTimer", MovePref<bool>, "Off","On" ) );
|
ADD( ConfOption( "MenuTimer", MovePref<bool>, "Off","On" ) );
|
||||||
|
|||||||
+10
-10
@@ -374,7 +374,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
|
|
||||||
if( SM == SM_PlayPostSwitchPage )
|
if( SM == SM_PlayPostSwitchPage )
|
||||||
{
|
{
|
||||||
int iNewChoice = m_iChoice[ GAMESTATE->GetMasterPlayerNumber() ];
|
const auto iNewChoice = m_iChoice[ GAMESTATE->GetMasterPlayerNumber() ];
|
||||||
Page newPage = GetPage( iNewChoice );
|
Page newPage = GetPage( iNewChoice );
|
||||||
|
|
||||||
Message msg("PostSwitchPage");
|
Message msg("PostSwitchPage");
|
||||||
@@ -390,7 +390,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
for (PlayerNumber const &p : vpns)
|
for (PlayerNumber const &p : vpns)
|
||||||
{
|
{
|
||||||
int iChoice = m_iChoice[p];
|
const auto iChoice = m_iChoice[p];
|
||||||
m_vsprScroll[p][iChoice]->HandleMessage( msg );
|
m_vsprScroll[p][iChoice]->HandleMessage( msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -460,7 +460,7 @@ void ScreenSelectMaster::UpdateSelectableChoices()
|
|||||||
|
|
||||||
for ( PlayerNumber &p : vpns)
|
for ( PlayerNumber &p : vpns)
|
||||||
{
|
{
|
||||||
if(disabled && m_iChoice[p] == c)
|
if(disabled && m_iChoice[p] == static_cast<int32_t>(c))
|
||||||
{
|
{
|
||||||
on_unplayable[p]= true;
|
on_unplayable[p]= true;
|
||||||
}
|
}
|
||||||
@@ -503,7 +503,7 @@ bool ScreenSelectMaster::Move( PlayerNumber pn, MenuDir dir )
|
|||||||
if( !AnyOptionsArePlayable() )
|
if( !AnyOptionsArePlayable() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int iSwitchToIndex = m_iChoice[pn];
|
auto iSwitchToIndex = m_iChoice[pn];
|
||||||
std::set<int> seen;
|
std::set<int> seen;
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -540,7 +540,7 @@ bool ScreenSelectMaster::MenuLeft( const InputEventPlus &input )
|
|||||||
{
|
{
|
||||||
m_TrackingRepeatingInput = input.MenuI;
|
m_TrackingRepeatingInput = input.MenuI;
|
||||||
m_soundChange.Play(true);
|
m_soundChange.Play(true);
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+Enum::to_integral(pn)) );
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) );
|
||||||
|
|
||||||
// if they use double select
|
// if they use double select
|
||||||
@@ -571,7 +571,7 @@ bool ScreenSelectMaster::MenuRight( const InputEventPlus &input )
|
|||||||
{
|
{
|
||||||
m_TrackingRepeatingInput = input.MenuI;
|
m_TrackingRepeatingInput = input.MenuI;
|
||||||
m_soundChange.Play(true);
|
m_soundChange.Play(true);
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+Enum::to_integral(pn)) );
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) );
|
||||||
|
|
||||||
// if they use double select
|
// if they use double select
|
||||||
@@ -602,7 +602,7 @@ bool ScreenSelectMaster::MenuUp( const InputEventPlus &input )
|
|||||||
{
|
{
|
||||||
m_TrackingRepeatingInput = input.MenuI;
|
m_TrackingRepeatingInput = input.MenuI;
|
||||||
m_soundChange.Play(true);
|
m_soundChange.Play(true);
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+Enum::to_integral(pn)) );
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) );
|
||||||
|
|
||||||
// if they use double select
|
// if they use double select
|
||||||
@@ -633,7 +633,7 @@ bool ScreenSelectMaster::MenuDown( const InputEventPlus &input )
|
|||||||
{
|
{
|
||||||
m_TrackingRepeatingInput = input.MenuI;
|
m_TrackingRepeatingInput = input.MenuI;
|
||||||
m_soundChange.Play(true);
|
m_soundChange.Play(true);
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+Enum::to_integral(pn)) );
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuSelectionChanged) );
|
||||||
|
|
||||||
// if they use double select
|
// if they use double select
|
||||||
@@ -963,7 +963,7 @@ bool ScreenSelectMaster::MenuStart( const InputEventPlus &input )
|
|||||||
mc->ApplyToAllPlayers();
|
mc->ApplyToAllPlayers();
|
||||||
// We want to be able to broadcast a Start message to the theme, in
|
// We want to be able to broadcast a Start message to the theme, in
|
||||||
// case a themer wants to handle something. -aj
|
// case a themer wants to handle something. -aj
|
||||||
Message msg( MessageIDToString((MessageID)(Message_MenuStartP1+pn)) );
|
Message msg( MessageIDToString((MessageID)(Message_MenuStartP1+Enum::to_integral(pn))) );
|
||||||
msg.SetParam( "ScreenEmpty", true );
|
msg.SetParam( "ScreenEmpty", true );
|
||||||
MESSAGEMAN->Broadcast( msg );
|
MESSAGEMAN->Broadcast( msg );
|
||||||
return true;
|
return true;
|
||||||
@@ -991,7 +991,7 @@ bool ScreenSelectMaster::MenuStart( const InputEventPlus &input )
|
|||||||
if( bAllDone )
|
if( bAllDone )
|
||||||
{
|
{
|
||||||
// broadcast MenuStart just like MenuLeft/Right/etc.
|
// broadcast MenuStart just like MenuLeft/Right/etc.
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuStartP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuStartP1+Enum::to_integral(pn)) );
|
||||||
this->PostScreenMessage( SM_BeginFadingOut, fSecs );// tell our owner it's time to move on
|
this->PostScreenMessage( SM_BeginFadingOut, fSecs );// tell our owner it's time to move on
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ bool ScreenSelectProfile::MenuLeft( const InputEventPlus &input )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_TrackingRepeatingInput = input.MenuI;
|
m_TrackingRepeatingInput = input.MenuI;
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+Enum::to_integral(pn)) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ bool ScreenSelectProfile::MenuRight( const InputEventPlus &input )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_TrackingRepeatingInput = input.MenuI;
|
m_TrackingRepeatingInput = input.MenuI;
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+Enum::to_integral(pn)) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ bool ScreenSelectProfile::MenuUp( const InputEventPlus &input )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_TrackingRepeatingInput = input.MenuI;
|
m_TrackingRepeatingInput = input.MenuI;
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+Enum::to_integral(pn)) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ bool ScreenSelectProfile::MenuDown( const InputEventPlus &input )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_TrackingRepeatingInput = input.MenuI;
|
m_TrackingRepeatingInput = input.MenuI;
|
||||||
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+pn) );
|
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+Enum::to_integral(pn)) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -198,12 +198,13 @@ bool ScreenTestSound::Input( const InputEventPlus &input )
|
|||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
return false;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+3
-8
@@ -575,13 +575,8 @@ void SongManager::UnlistSong(Song *song)
|
|||||||
// remove all occurences of the song in each of our song vectors
|
// remove all occurences of the song in each of our song vectors
|
||||||
std::vector<Song*>* songVectors[3] = { &m_pSongs, &m_pPopularSongs, &m_pShuffledSongs };
|
std::vector<Song*>* songVectors[3] = { &m_pSongs, &m_pPopularSongs, &m_pShuffledSongs };
|
||||||
for (int songVecIdx=0; songVecIdx<3; ++songVecIdx) {
|
for (int songVecIdx=0; songVecIdx<3; ++songVecIdx) {
|
||||||
std::vector<Song*>& v = *songVectors[songVecIdx];
|
auto& v = *songVectors[songVecIdx];
|
||||||
for (int i=0; i<v.size(); ++i) {
|
std::erase_if( v, [song](Song* vSong){return vSong == song;} );
|
||||||
if (v[i] == song) {
|
|
||||||
v.erase(v.begin()+i);
|
|
||||||
--i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1335,7 +1330,7 @@ void SongManager::GetExtraStageInfo( bool bExtra2, const Style *sd, Song*& pSong
|
|||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_M( sGroup != "", ssprintf("%p '%s' '%s'",
|
ASSERT_M( sGroup != "", ssprintf("%p '%s' '%s'",
|
||||||
GAMESTATE->m_pCurSong.Get(),
|
static_cast<void*>(GAMESTATE->m_pCurSong.Get()),
|
||||||
GAMESTATE->m_pCurSong? GAMESTATE->m_pCurSong->GetSongDir().c_str():"",
|
GAMESTATE->m_pCurSong? GAMESTATE->m_pCurSong->GetSongDir().c_str():"",
|
||||||
GAMESTATE->m_pCurSong? GAMESTATE->m_pCurSong->m_sGroupName.c_str():"") );
|
GAMESTATE->m_pCurSong? GAMESTATE->m_pCurSong->m_sGroupName.c_str():"") );
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user