Address PR feedback.

This commit is contained in:
Brian Phlipot
2023-02-02 11:54:17 -08:00
committed by teejusb
parent 4a6b1a743c
commit d079940fea
44 changed files with 259 additions and 236 deletions
+17 -17
View File
@@ -33,8 +33,8 @@ public:
ActorMultiVertex( const ActorMultiVertex &cpy ); ActorMultiVertex( const ActorMultiVertex &cpy );
virtual ~ActorMultiVertex(); virtual ~ActorMultiVertex();
void LoadFromNode( const XNode* Node ); void LoadFromNode( const XNode* Node ) override;
virtual ActorMultiVertex *Copy() const; virtual ActorMultiVertex *Copy() const override;
struct AMV_TweenState struct AMV_TweenState
{ {
@@ -68,19 +68,19 @@ public:
} }
const AMV_TweenState& AMV_DestTweenState() const { return const_cast<ActorMultiVertex*>(this)->AMV_DestTweenState(); } const AMV_TweenState& AMV_DestTweenState() const { return const_cast<ActorMultiVertex*>(this)->AMV_DestTweenState(); }
virtual void EnableAnimation(bool bEnable); virtual void EnableAnimation(bool bEnable) override;
virtual void Update(float fDelta); virtual void Update(float fDelta) override;
virtual bool EarlyAbortDraw() const; virtual bool EarlyAbortDraw() const override;
virtual void DrawPrimitives(); virtual void DrawPrimitives() override;
virtual void DrawInternal( const AMV_TweenState *TS ); virtual void DrawInternal( const AMV_TweenState *TS );
void SetCurrentTweenStart(); void SetCurrentTweenStart() override;
void EraseHeadTween(); void EraseHeadTween() override;
void UpdatePercentThroughTween( float PercentThroughTween ); void UpdatePercentThroughTween( float PercentThroughTween ) override;
void BeginTweening( float time, ITween *pInterp ); void BeginTweening( float time, ITween *pInterp ) override;
void StopTweening(); void StopTweening() override;
void FinishTweening(); void FinishTweening() override;
void SetTexture( RageTexture *Texture ); void SetTexture( RageTexture *Texture );
RageTexture* GetTexture() { return _Texture; }; RageTexture* GetTexture() { return _Texture; };
@@ -119,7 +119,7 @@ public:
RectF rect; RectF rect;
float delay; float delay;
}; };
int GetNumStates() const { return _states.size(); } int GetNumStates() const override { return _states.size(); }
void AddState(const State& new_state) { _states.push_back(new_state); } void AddState(const State& new_state) { _states.push_back(new_state); }
void RemoveState(size_t i) void RemoveState(size_t i)
{ ASSERT(i < _states.size()); _states.erase(_states.begin()+i); } { ASSERT(i < _states.size()); _states.erase(_states.begin()+i); }
@@ -130,10 +130,10 @@ 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(int i); void SetState(int i) override;
void SetAllStateDelays(float delay); void SetAllStateDelays(float delay);
float GetAnimationLengthSeconds() const; float GetAnimationLengthSeconds() const override;
void SetSecondsIntoAnimation(float seconds); void SetSecondsIntoAnimation(float seconds) override;
void UpdateAnimationState(bool force_update= false); void UpdateAnimationState(bool force_update= false);
size_t GetNumQuadStates() const size_t GetNumQuadStates() const
{ return AMV_DestTweenState().quad_states.size(); } { return AMV_DestTweenState().quad_states.size(); }
@@ -148,7 +148,7 @@ public:
bool _use_animation_state; bool _use_animation_state;
bool _decode_movie; bool _decode_movie;
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L ) override;
private: private:
RageTexture* _Texture; RageTexture* _Texture;
+20 -20
View File
@@ -319,8 +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 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];
@@ -514,8 +514,8 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float
return fYOffset * fScrollSpeed; return fYOffset * fScrollSpeed;
} }
const auto& fAccels = curr_options->m_fAccels; const float* fAccels = curr_options->m_fAccels;
const auto& fEffects = curr_options->m_fEffects; const float* 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];
@@ -636,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 auto& fEffects = curr_options->m_fEffects; const float* 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
@@ -669,7 +669,7 @@ float ArrowEffects::GetYOffsetFromYPos(int iCol, float YPos, float fYReverseOffs
{ {
float f = YPos; float f = YPos;
const auto& fEffects = curr_options->m_fEffects; const float* 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.
@@ -694,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 auto& fEffects = curr_options->m_fEffects; const float* 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];
@@ -864,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 auto& fEffects = curr_options->m_fEffects; const float* 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
@@ -879,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 auto& fEffects = curr_options->m_fEffects; const float* 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
@@ -894,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 auto& fEffects = curr_options->m_fEffects; const float* 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
@@ -916,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 auto& fEffects = curr_options->m_fEffects; const float* 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 )
@@ -939,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 auto& fEffects = curr_options->m_fEffects; const float* 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 )
@@ -962,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 auto& fEffects = curr_options->m_fEffects; const float* 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 )
@@ -985,7 +985,7 @@ float ArrowEffects::ReceptorGetRotationY( const PlayerState* pPlayerState, int i
float ArrowEffects::GetMoveX(int iCol) float ArrowEffects::GetMoveX(int iCol)
{ {
const auto& fMoves = curr_options->m_fMovesX; const float* 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];
@@ -994,7 +994,7 @@ float ArrowEffects::GetMoveX(int iCol)
float ArrowEffects::GetMoveY(int iCol) float ArrowEffects::GetMoveY(int iCol)
{ {
const auto& fMoves = curr_options->m_fMovesY; const float* 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];
@@ -1003,7 +1003,7 @@ float ArrowEffects::GetMoveY(int iCol)
float ArrowEffects::GetMoveZ(int iCol) float ArrowEffects::GetMoveZ(int iCol)
{ {
const auto& fMoves = curr_options->m_fMovesZ; const float* 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];
@@ -1024,7 +1024,7 @@ static float GetCenterLine()
static float GetHiddenSudden() static float GetHiddenSudden()
{ {
const auto& fAppearances = curr_options->m_fAppearances; const float* fAppearances = curr_options->m_fAppearances;
return fAppearances[PlayerOptions::APPEARANCE_HIDDEN] * return fAppearances[PlayerOptions::APPEARANCE_HIDDEN] *
fAppearances[PlayerOptions::APPEARANCE_SUDDEN]; fAppearances[PlayerOptions::APPEARANCE_SUDDEN];
} }
@@ -1084,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 auto& fAppearances = curr_options->m_fAppearances; const float* fAppearances = curr_options->m_fAppearances;
float fVisibleAdjust = 0; float fVisibleAdjust = 0;
@@ -1173,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 auto& fEffects = curr_options->m_fEffects; const float* 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.
@@ -1295,7 +1295,7 @@ float ArrowEffects::GetZPos( const PlayerState* pPlayerState, int iCol, float fY
bool ArrowEffects::NeedZBuffer() bool ArrowEffects::NeedZBuffer()
{ {
const auto& fEffects = curr_options->m_fEffects; const float* 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 ||
+1 -1
View File
@@ -669,7 +669,7 @@ 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 auto bgChange = mainlayer.m_aBGChanges[i]; const BackgroundChange bgChange = mainlayer.m_aBGChanges[i];
if( bgChange.m_def.m_sFile1 != RANDOM_BACKGROUND_FILE ) if( bgChange.m_def.m_sFile1 != RANDOM_BACKGROUND_FILE )
continue; continue;
+1 -1
View File
@@ -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];
const auto fit= m_pFont->GetGlyphsThatFit(line, &used_width); const size_t 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());
+13 -13
View File
@@ -16,8 +16,8 @@ public:
BitmapText &operator=(const BitmapText &cpy); BitmapText &operator=(const BitmapText &cpy);
virtual ~BitmapText(); virtual ~BitmapText();
virtual void LoadFromNode( const XNode* pNode ); virtual void LoadFromNode( const XNode* pNode ) override;
virtual BitmapText *Copy() const; virtual BitmapText *Copy() const override;
struct BMT_TweenState struct BMT_TweenState
{ {
@@ -43,16 +43,16 @@ public:
} }
BMT_TweenState const& BMT_DestTweenState() const { return const_cast<BitmapText*>(this)->BMT_DestTweenState(); } BMT_TweenState const& BMT_DestTweenState() const { return const_cast<BitmapText*>(this)->BMT_DestTweenState(); }
virtual void SetCurrentTweenStart(); virtual void SetCurrentTweenStart() override;
virtual void EraseHeadTween(); virtual void EraseHeadTween() override;
virtual void UpdatePercentThroughTween(float between); virtual void UpdatePercentThroughTween(float between) override;
virtual void BeginTweening(float time, ITween* interp); virtual void BeginTweening(float time, ITween* interp) override;
// This function exists because the compiler tried to connect a call of // This function exists because the compiler tried to connect a call of
// "BeginTweening(1.2f)" to the function above. -Kyz // "BeginTweening(1.2f)" to the function above. -Kyz
virtual void BeginTweening(float time, TweenType tt = TWEEN_LINEAR) virtual void BeginTweening(float time, TweenType tt = TWEEN_LINEAR) override
{ Actor::BeginTweening(time, tt); } { Actor::BeginTweening(time, tt); }
virtual void StopTweening(); virtual void StopTweening() override;
virtual void FinishTweening(); virtual void FinishTweening() override;
bool LoadFromFont( const RString& sFontName ); bool LoadFromFont( const RString& sFontName );
bool LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars ); bool LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars );
@@ -65,8 +65,8 @@ public:
void CropLineToWidth(size_t l, int width); void CropLineToWidth(size_t l, int width);
void CropToWidth(int width); void CropToWidth(int width);
virtual bool EarlyAbortDraw() const; virtual bool EarlyAbortDraw() const override;
virtual void DrawPrimitives(); virtual void DrawPrimitives() override;
void SetUppercase( bool b ); void SetUppercase( bool b );
void SetRainbowScroll( bool b ) { m_bRainbowScroll = b; } void SetRainbowScroll( bool b ) { m_bRainbowScroll = b; }
@@ -76,7 +76,7 @@ public:
void set_mult_attrs_with_diffuse(bool m); void set_mult_attrs_with_diffuse(bool m);
bool get_mult_attrs_with_diffuse(); bool get_mult_attrs_with_diffuse();
void SetHorizAlign( float f ); void SetHorizAlign( float f ) override;
void SetStrokeColor(RageColor c) { BMT_DestTweenState().SetStrokeColor(c); } void SetStrokeColor(RageColor c) { BMT_DestTweenState().SetStrokeColor(c); }
RageColor const& GetStrokeColor() { return BMT_DestTweenState().GetStrokeColor(); } RageColor const& GetStrokeColor() { return BMT_DestTweenState().GetStrokeColor(); }
@@ -107,7 +107,7 @@ public:
void ClearAttributes(); void ClearAttributes();
// Commands // Commands
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L ) override;
protected: protected:
Font *m_pFont; Font *m_pFont;
+12 -10
View File
@@ -543,20 +543,22 @@ ulg crc32(ulg crc, const uch *buf, size_t len)
class TZip class TZip
{ {
public: public:
TZip() = default; TZip() : pfout(nullptr),ooffset(0),oerr(false),writ(0),hasputcen(false),zfis(0),hfin(0)
{
}
~TZip() = default; ~TZip() = default;
// 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{nullptr}; // if valid, we'll write here (for files or pipes) RageFile *pfout; // if valid, we'll write here (for files or pipes)
unsigned ooffset{0}; // for pfout, this is where the pointer was initially unsigned ooffset; // for pfout, this is where the pointer was initially
ZRESULT oerr{false}; // did a write operation give rise to an error? ZRESULT oerr; // did a write operation give rise to an error?
unsigned writ{0}; // how have we written. This is maintained by Add, not write(), to avoid confusion over seeks unsigned writ; // how have we written. This is maintained by Add, not write(), to avoid confusion over seeks
unsigned int opos{0}; // current pos in the mmap unsigned int opos; // current pos in the mmap
unsigned int mapsize{0}; // the size of the map we created unsigned int mapsize; // the size of the map we created
bool hasputcen{false}; // have we yet placed the central directory? bool hasputcen; // have we yet placed the central directory?
// //
TZipFileInfo *zfis{nullptr}; // each file gets added onto this list, for writing the table at the end TZipFileInfo *zfis; // 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);
@@ -571,7 +573,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{nullptr}; // for input files and pipes RageFile *hfin; // 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
+1 -1
View File
@@ -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. */
inline constexpr auto MAX_METERS = (Enum::to_integral(NUM_Difficulty) * Enum::to_integral(NUM_StepsType)) + MAX_EDITS_PER_SONG; inline constexpr int MAX_METERS = (Enum::to_integral(NUM_Difficulty) * Enum::to_integral(NUM_StepsType)) + MAX_EDITS_PER_SONG;
REGISTER_ACTOR_CLASS( StepsDisplayList ); REGISTER_ACTOR_CLASS( StepsDisplayList );
+1 -1
View File
@@ -45,7 +45,7 @@ void ModIcon::Load( RString sMetricsGroup )
// stop words // stop words
STOP_WORDS.Load( sMetricsGroup, "StopWords" ); STOP_WORDS.Load( sMetricsGroup, "StopWords" );
// TODO should m_vStopWords be cleared? m_vStopWords.clear();
split(STOP_WORDS, ",", m_vStopWords); split(STOP_WORDS, ",", m_vStopWords);
Set(""); Set("");
+3 -3
View File
@@ -151,11 +151,11 @@ void ModIconRow::SetFromGameState()
for( unsigned i=0; i<vsOptions.size(); i++ ) for( unsigned i=0; i<vsOptions.size(); i++ )
{ {
RString sOption = vsOptions[i]; RString sOption = vsOptions[i];
int iPerferredCol = OptionToPreferredColumn( sOption ); int iPreferredCol = OptionToPreferredColumn( sOption );
iPerferredCol = clamp( iPerferredCol, 0, (int)m_vpModIcon.size()-1 ); iPreferredCol = clamp( iPreferredCol, 0, (int)m_vpModIcon.size()-1 );
// search for a vacant spot // search for a vacant spot
for( int j=iPerferredCol; j<NUM_OPTION_ICONS; j++ ) for( int j=iPreferredCol; j<NUM_OPTION_ICONS; j++ )
{ {
if( vsText[j] != "" ) if( vsText[j] != "" )
{ {
+10 -10
View File
@@ -17,7 +17,7 @@ class Model : public Actor
public: public:
Model(); Model();
virtual ~Model(); virtual ~Model();
virtual Model *Copy() const; virtual Model *Copy() const override;
void Clear(); void Clear();
void Load( const RString &sFile ); void Load( const RString &sFile );
@@ -27,26 +27,26 @@ public:
void LoadMaterialsFromMilkshapeAscii( const RString &sPath ); void LoadMaterialsFromMilkshapeAscii( const RString &sPath );
bool LoadMilkshapeAsciiBones( const RString &sAniName, const RString &sPath ); bool LoadMilkshapeAsciiBones( const RString &sAniName, const RString &sPath );
void LoadFromNode( const XNode* pNode ); void LoadFromNode( const XNode* pNode ) override;
void PlayAnimation( const RString &sAniName, float fPlayRate = 1 ); void PlayAnimation( const RString &sAniName, float fPlayRate = 1 );
void SetRate( float fRate ) { m_fCurAnimationRate = fRate; } void SetRate( float fRate ) { m_fCurAnimationRate = fRate; }
void SetLoop( bool b ) { m_bLoop = b; } void SetLoop( bool b ) { m_bLoop = b; }
void SetPosition( float fSeconds ); void SetPosition( float fSeconds );
virtual void Update( float fDelta ); virtual void Update( float fDelta ) override;
virtual bool EarlyAbortDraw() const; virtual bool EarlyAbortDraw() const override;
virtual void DrawPrimitives(); virtual void DrawPrimitives() override;
void DrawCelShaded(); void DrawCelShaded();
void SetCelShading( bool bShading ) { m_bDrawCelShaded = bShading; } void SetCelShading( bool bShading ) { m_bDrawCelShaded = bShading; }
virtual int GetNumStates() const; virtual int GetNumStates() const override;
virtual void SetState( int iNewState ); virtual void SetState( int iNewState ) override;
virtual float GetAnimationLengthSeconds() const virtual float GetAnimationLengthSeconds() const override
{ return m_animation_length_seconds; } { return m_animation_length_seconds; }
virtual void RecalcAnimationLengthSeconds(); virtual void RecalcAnimationLengthSeconds();
virtual void SetSecondsIntoAnimation( float fSeconds ); virtual void SetSecondsIntoAnimation( float fSeconds ) override;
RString GetDefaultAnimation() const { return m_sDefaultAnimation; }; RString GetDefaultAnimation() const { return m_sDefaultAnimation; };
void SetDefaultAnimation( RString sAnimation, float fPlayRate = 1 ); void SetDefaultAnimation( RString sAnimation, float fPlayRate = 1 );
@@ -54,7 +54,7 @@ public:
bool MaterialsNeedNormals() const; bool MaterialsNeedNormals() const;
// Lua // Lua
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L ) override;
Model& operator=(const Model& rhs) = delete; Model& operator=(const Model& rhs) = delete;
+8 -8
View File
@@ -424,14 +424,14 @@ void MusicWheelItem::HandleMessage( const Message &msg )
break; break;
} }
Message tmpMsg( "Set" ); Message setMsg( "Set" );
tmpMsg.SetParam( "Song", pWID->m_pSong ); setMsg.SetParam( "Song", pWID->m_pSong );
tmpMsg.SetParam( "Course", pWID->m_pCourse ); setMsg.SetParam( "Course", pWID->m_pCourse );
tmpMsg.SetParam( "Text", pWID->m_sText ); setMsg.SetParam( "Text", pWID->m_sText );
tmpMsg.SetParam( "Type", MusicWheelItemTypeToString(type) ); setMsg.SetParam( "Type", MusicWheelItemTypeToString(type) );
tmpMsg.SetParam( "Color", pWID->m_color ); setMsg.SetParam( "Color", pWID->m_color );
tmpMsg.SetParam( "Label", pWID->m_sLabel ); setMsg.SetParam( "Label", pWID->m_sLabel );
this->HandleMessage( tmpMsg ); this->HandleMessage( setMsg );
RefreshGrades(); RefreshGrades();
} }
+10 -1
View File
@@ -30,7 +30,7 @@ bool NoteData::IsComposite() const
{ {
for( int track = 0; track < GetNumTracks(); ++track ) for( int track = 0; track < GetNumTracks(); ++track )
{ {
for (const auto& tn : m_TapNotes[track]) for (const std::pair<const int, TapNote>& tn : m_TapNotes[track])
if( tn.second.pn != PLAYER_INVALID ) if( tn.second.pn != PLAYER_INVALID )
return true; return true;
} }
@@ -1339,6 +1339,15 @@ NoteData::_all_tracks_iterator<ND, iter, TN>::_all_tracks_iterator( const _all_t
m_pNoteData->AddATIToList(this); m_pNoteData->AddATIToList(this);
} }
template<typename ND, typename iter, typename TN>
NoteData::_all_tracks_iterator<ND, iter, TN>::~_all_tracks_iterator()
{
if(m_pNoteData != nullptr)
{
m_pNoteData->RemoveATIFromList(this);
}
}
template<typename ND, typename iter, typename TN> template<typename ND, typename iter, typename TN>
NoteData::_all_tracks_iterator<ND, iter, TN> &NoteData::_all_tracks_iterator<ND, iter, TN>::operator=( const _all_tracks_iterator &other ) NoteData::_all_tracks_iterator<ND, iter, TN> &NoteData::_all_tracks_iterator<ND, iter, TN>::operator=( const _all_tracks_iterator &other )
{ {
+1 -1
View File
@@ -81,7 +81,7 @@ 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() { if(m_pNoteData != nullptr) { m_pNoteData->RemoveATIFromList(this); } } ~_all_tracks_iterator();
_all_tracks_iterator &operator=( const _all_tracks_iterator &other ); _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
+8 -8
View File
@@ -297,8 +297,8 @@ struct NoteColumnRenderer : public Actor
// and receptor positions follow the splines. It's called by their row // and receptor positions follow the splines. It's called by their row
// update functions. -Kyz // update functions. -Kyz
void UpdateReceptorGhostStuff(Actor* receptor) const; void UpdateReceptorGhostStuff(Actor* receptor) const;
virtual void DrawPrimitives(); virtual void DrawPrimitives() override;
virtual void PushSelf(lua_State* L); virtual void PushSelf(lua_State* L) override;
struct NCR_TweenState struct NCR_TweenState
{ {
@@ -321,12 +321,12 @@ struct NoteColumnRenderer : public Actor
} }
const NCR_TweenState& NCR_DestTweenState() const { return const_cast<NoteColumnRenderer*>(this)->NCR_DestTweenState(); } const NCR_TweenState& NCR_DestTweenState() const { return const_cast<NoteColumnRenderer*>(this)->NCR_DestTweenState(); }
virtual void SetCurrentTweenStart(); virtual void SetCurrentTweenStart() override;
virtual void EraseHeadTween(); virtual void EraseHeadTween() override;
virtual void UpdatePercentThroughTween(float between); virtual void UpdatePercentThroughTween(float between) override;
virtual void BeginTweening(float time, ITween* interp); virtual void BeginTweening(float time, ITween* interp) override;
virtual void StopTweening(); virtual void StopTweening() override;
virtual void FinishTweening(); virtual void FinishTweening() override;
NCSplineHandler* GetPosHandler() { return &NCR_DestTweenState().m_pos_handler; } NCSplineHandler* GetPosHandler() { return &NCR_DestTweenState().m_pos_handler; }
NCSplineHandler* GetRotHandler() { return &NCR_DestTweenState().m_rot_handler; } NCSplineHandler* GetRotHandler() { return &NCR_DestTweenState().m_rot_handler; }
+2 -2
View File
@@ -674,7 +674,7 @@ float FindLastDisplayedBeat( const PlayerState* pPlayerState, int iDrawDistanceB
bool bBoomerang; bool bBoomerang;
{ {
const auto& fAccels = pPlayerState->m_PlayerOptions.GetCurrent().m_fAccels; const float* fAccels = pPlayerState->m_PlayerOptions.GetCurrent().m_fAccels;
bBoomerang = (fAccels[PlayerOptions::ACCEL_BOOMERANG] != 0); bBoomerang = (fAccels[PlayerOptions::ACCEL_BOOMERANG] != 0);
} }
@@ -902,7 +902,7 @@ 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;
for (Attack const &a : attacks) for (const Attack &a : attacks)
{ {
float fBeat = timing.GetBeatFromElapsedTime(a.fStartSecond); float fBeat = timing.GetBeatFromElapsedTime(a.fStartSecond);
if (BeatToNoteRow(fBeat) >= m_FieldRenderArgs.first_row && if (BeatToNoteRow(fBeat) >= m_FieldRenderArgs.first_row &&
+1 -1
View File
@@ -544,7 +544,7 @@ bool BMSChart::Load( const RString &chartPath )
std::vector<RString> lines; std::vector<RString> lines;
Tree.evaluateBMSTree(headers, lines); Tree.evaluateBMSTree(headers, lines);
for (const auto& line : lines) for (const RString& line : lines)
{ {
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());
+6 -6
View File
@@ -205,7 +205,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
int num_selected = 0; int num_selected = 0;
if( st == SELECT_ONE ) if( st == SELECT_ONE )
{ {
int first_selected= -1; size_t first_selected= std::numeric_limits<size_t>::max();
if(selected.empty()) if(selected.empty())
{ {
LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one " LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one "
@@ -213,14 +213,14 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
"elements.", sName.c_str()); "elements.", sName.c_str());
return; return;
} }
for(unsigned int e= 0; e < selected.size(); ++e) for(size_t e= 0; e < selected.size(); ++e)
{ {
if(selected[e]) if(selected[e])
{ {
num_selected++; num_selected++;
if(first_selected == -1) if(first_selected == std::numeric_limits<size_t>::max())
{ {
first_selected= static_cast<int>(e); first_selected= e;
} }
} }
} }
@@ -229,9 +229,9 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one " LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one "
"thing to be selected, but %i out of %i things are selected.", "thing to be selected, but %i out of %i things are selected.",
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(size_t e= 0; e < selected.size(); ++e)
{ {
if(selected[e] && (first_selected < 0 || e != static_cast<uint32_t>(first_selected))) if(selected[e] && e != first_selected)
{ {
selected[e]= false; selected[e]= false;
} }
+2 -2
View File
@@ -18,8 +18,8 @@ public:
void Load( const RString &sMetricsGroup, bool bLoadCanGos ); void Load( const RString &sMetricsGroup, bool bLoadCanGos );
void StopTweening(); void StopTweening() override;
void BeginTweening( float fSecs, TweenType tt = TWEEN_LINEAR ); void BeginTweening( float fSecs, TweenType tt = TWEEN_LINEAR ) override;
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 );
+2 -2
View File
@@ -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 fSongBeatTmp = m_pPlayerState->GetDisplayedTiming().GetBeatFromElapsedTime( fPositionSeconds ); const float fDisplayedSongBeat = m_pPlayerState->GetDisplayedTiming().GetBeatFromElapsedTime( fPositionSeconds );
const int iRowNow = BeatToNoteRowNotRounded( fSongBeatTmp ); const int iRowNow = BeatToNoteRowNotRounded( fDisplayedSongBeat );
if( iRowNow >= 0 ) if( iRowNow >= 0 )
{ {
+3 -3
View File
@@ -96,7 +96,7 @@ void Profile::ClearSongs()
int Profile::HighScoresForASong::GetNumTimesPlayed() const int Profile::HighScoresForASong::GetNumTimesPlayed() const
{ {
int iCount = 0; int iCount = 0;
for (const auto& i : m_StepsHighScores) for (const std::pair<const StepsID, HighScoresForASteps>& 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 (const auto& i : m_TrailHighScores) for (const std::pair<const TrailID, HighScoresForATrail>& i : m_TrailHighScores)
{ {
iCount += i.second.hsl.GetNumTimesPlayed(); iCount += i.second.hsl.GetNumTimesPlayed();
} }
@@ -1605,7 +1605,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
{ {
XNode* pNumSongsPlayedByStyle = pGeneralDataNode->AppendChild("NumSongsPlayedByStyle"); XNode* pNumSongsPlayedByStyle = pGeneralDataNode->AppendChild("NumSongsPlayedByStyle");
for (const auto& iter : m_iNumSongsPlayedByStyle) for (const std::pair<StyleID const, int>& iter : m_iNumSongsPlayedByStyle)
{ {
const StyleID &s = iter.first; const StyleID &s = iter.first;
int iNumPlays = iter.second; int iNumPlays = iter.second;
+22 -17
View File
@@ -114,28 +114,33 @@ public:
VideoModeParams(const VideoModeParams &other) = default; VideoModeParams(const VideoModeParams &other) = default;
VideoModeParams() = default; VideoModeParams(): windowed(false), width(0), height(0),
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() = default; virtual ~VideoModeParams() = default;
bool windowed{false}; bool windowed;
RString sDisplayId{}; RString sDisplayId;
int width{0}; int width;
int height{0}; int height;
int bpp{0}; int bpp;
int rate{0}; int rate;
bool vsync{false}; bool vsync;
bool interlaced{false}; bool interlaced;
bool bSmoothLines{false}; bool bSmoothLines;
bool bTrilinearFiltering{false}; bool bTrilinearFiltering;
bool bAnisotropicFiltering{false}; bool bAnisotropicFiltering;
bool bWindowIsFullscreenBorderless{false}; bool bWindowIsFullscreenBorderless;
RString sWindowTitle{}; RString sWindowTitle;
RString sIconFile{}; RString sIconFile;
bool PAL{false}; bool PAL;
float fDisplayAspectRatio{0.0f}; float fDisplayAspectRatio;
}; };
/** /**
+1 -1
View File
@@ -114,7 +114,7 @@ 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);
const auto pos = f->Seek(file_ofs); const int pos = f->Seek(file_ofs);
if (pos >= 0 && static_cast<uint64_t>(pos) != file_ofs) if (pos >= 0 && static_cast<uint64_t>(pos) != file_ofs)
{ {
return 0; return 0;
+1 -1
View File
@@ -616,7 +616,7 @@ 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;
auto first_index= static_cast<uint32_t>(index); auto first_index= static_cast<unsigned int>(index);
auto 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;
+1 -10
View File
@@ -110,16 +110,7 @@ namespace
int GCD( int i1, int i2 ) int GCD( int i1, int i2 )
{ {
for(;;) return std::gcd(i1, i2);
{
unsigned iRem = i2 % i1;
if( iRem == 0 )
{
return i1;
}
i2 = i1;
i1 = iRem;
}
} }
} }
+2 -1
View File
@@ -52,8 +52,9 @@ RageSurfaceFormat::RageSurfaceFormat( const RageSurfaceFormat &cpy ):
Mask = cpy.Mask; Mask = cpy.Mask;
Shift = cpy.Shift; Shift = cpy.Shift;
Loss = cpy.Loss; Loss = cpy.Loss;
if( palette ) if( palette ) {
palette = std::make_unique<RageSurfacePalette>(*palette); palette = std::make_unique<RageSurfacePalette>(*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
+23 -23
View File
@@ -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 auto &src_shifts = src_surf->format->Shift; const std::array<uint32_t, 4> &src_shifts = src_surf->format->Shift;
const auto &dst_shifts = dst_surf->format->Shift; const std::array<uint32_t, 4> &dst_shifts = dst_surf->format->Shift;
const auto &src_masks = src_surf->format->Mask; const std::array<uint32_t, 4> &src_masks = src_surf->format->Mask;
const auto &dst_masks = dst_surf->format->Mask; const std::array<uint32_t, 4> &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,44 @@ 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, uint32_t GrayBits, uint32_t AlphaBits ) RageSurface *RageSurfaceUtils::PalettizeToGrayscale( const RageSurface *src_surf, unsigned int GrayBits, unsigned int AlphaBits )
{ {
AlphaBits = std::min( AlphaBits, 8-src_surf->format->Loss[3] ); AlphaBits = std::min( AlphaBits, 8-src_surf->format->Loss[3] );
const auto TotalBits = GrayBits + AlphaBits; const unsigned int 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 auto TotalColors = 1u << TotalBits; const unsigned int TotalColors = 1u << TotalBits;
const auto Ivalues = 1u << GrayBits; // number of intensity values const unsigned int Ivalues = 1u << GrayBits; // number of intensity values
const auto Ishift = 0u; // intensity shift const unsigned int Ishift = 0u; // intensity shift
const auto Imask = ((1u << GrayBits) - 1u) << Ishift; // intensity mask const unsigned int Imask = ((1u << GrayBits) - 1u) << Ishift; // intensity mask
const auto Iloss = 8u-GrayBits; const unsigned int Iloss = 8u-GrayBits;
const auto Avalues = 1u << AlphaBits; // number of alpha values const unsigned int Avalues = 1u << AlphaBits; // number of alpha values
const auto Ashift = GrayBits; // alpha shift const unsigned int Ashift = GrayBits; // alpha shift
const auto Amask = ((1u << AlphaBits) - 1u) << Ashift; // alpha mask const unsigned int Amask = ((1u << AlphaBits) - 1u) << Ashift; // alpha mask
const auto Aloss = 8u-AlphaBits; const unsigned int Aloss = 8u-AlphaBits;
for( size_t index = 0; index < TotalColors; ++index ) for( size_t index = 0; index < TotalColors; ++index )
{ {
const auto I = (index & Imask) >> Ishift; const unsigned int I = (index & Imask) >> Ishift;
const auto A = (index & Amask) >> Ashift; const unsigned int A = (index & Amask) >> Ashift;
// if only one intensity value, always fullbright // if only one intensity value, always fullbright
const auto ScaledI = Ivalues == 1 ? 255 : clamp( lrintf(I * (255.0f / (Ivalues-1))), 0L, 255L ); const uint8_t ScaledI = Ivalues == 1 ? 255 : clamp( lrintf(I * (255.0f / (Ivalues-1))), 0L, 255L );
// if only one alpha value, always opaque // if only one alpha value, always opaque
const auto ScaledA = Avalues == 1 ? 255 : clamp( lrintf(A * (255.0f / (Avalues-1))), 0L, 255L ); const uint8_t ScaledA = Avalues == 1 ? 255 : clamp( lrintf(A * (255.0f / (Avalues-1))), 0L, 255L );
RageSurfaceColor c; RageSurfaceColor c;
c.r = uint8_t(ScaledI); c.r = ScaledI;
c.g = uint8_t(ScaledI); c.g = ScaledI;
c.b = uint8_t(ScaledI); c.b = ScaledI;
c.a = uint8_t(ScaledA); c.a = ScaledA;
dst_surf->fmt.palette->colors[index] = c; dst_surf->fmt.palette->colors[index] = c;
} }
+1 -1
View File
@@ -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, uint32_t GrayBits, uint32_t AlphaBits ); RageSurface *PalettizeToGrayscale( const RageSurface *src_surf, unsigned int GrayBits, unsigned int AlphaBits );
RageSurface *MakeDummySurface( int height, int width ); RageSurface *MakeDummySurface( int height, int width );
+1 -1
View File
@@ -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.
{ {
auto& pal = pRet->format->palette; std::unique_ptr<RageSurfacePalette>& 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.
+1 -5
View File
@@ -27,12 +27,8 @@ 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 */
char errorbuf[JMSG_LENGTH_MAX]; char errorbuf[JMSG_LENGTH_MAX];
jmp_buf setjmp_buffer; /* for return to caller */
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 )
+30 -23
View File
@@ -103,7 +103,7 @@ struct lua_State;
struct RageVector2 struct RageVector2
{ {
public: public:
RageVector2() = default; RageVector2(): x(0), y(0) {}
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) {}
@@ -125,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{0}, y{0}; float x, y;
}; };
struct RageVector3 struct RageVector3
{ {
public: public:
RageVector3() = default; RageVector3(): x(0), y(0), z(0) {}
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) {}
@@ -154,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{0}, y{0}, z{0}; float x, y, z;
}; };
struct RageVector4 struct RageVector4
{ {
public: public:
RageVector4() = default; RageVector4(): x(0), y(0), z(0), w(0) {}
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) {}
@@ -183,13 +183,13 @@ 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{0}, y{0}, z{0}, w{0}; float x, y, z, w;
}; };
struct RageColor struct RageColor
{ {
public: public:
RageColor() = default; RageColor(): r(0), g(0), b(0), a(0) {}
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) {}
@@ -261,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{0}, g{0}, b{0}, a{0}; float r, g, b, a;
}; };
/* Convert floating-point 0..1 value to integer 0..255 value. * /* Convert floating-point 0..1 value to integer 0..255 value. *
@@ -320,9 +320,9 @@ inline unsigned char FTOC(float a)
class RageVColor class RageVColor
{ {
public: public:
uint8_t b{0},g{0},r{0},a{0}; // specific ordering required by Direct3D uint8_t b,g,r,a; // specific ordering required by Direct3D
RageVColor() = default; RageVColor(): b(0), g(0), r(0), a(0) { }
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)
{ {
@@ -337,7 +337,7 @@ namespace StepMania
class Rect class Rect
{ {
public: public:
Rect() = default; Rect(): left(0), top(0), right(0), bottom(0) {}
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; };
@@ -357,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;
@@ -367,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() = default; RageSpriteVertex(): p(), n(), c(), t() {}
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);
@@ -379,12 +379,19 @@ 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
{ {
RageModelVertex() = default; /* Zero out by default. */
RageVector3 p{}; // position RageModelVertex():
RageVector3 n{}; // normal p(0,0,0),
RageVector2 t{}; // texture coordinates n(0,0,0),
int8_t bone{0}; t(0,0),
RageVector2 TextureMatrixScale{1,1}; // usually 1,1 bone(0),
TextureMatrixScale(1,1)
{ }
RageVector3 p; // position
RageVector3 n; // normal
RageVector2 t; // texture coordinates
int8_t bone;
RageVector2 TextureMatrixScale; // usually 1,1
}; };
+1 -1
View File
@@ -1981,7 +1981,7 @@ void ReplaceEntityText( RString &sText, const std::map<char, RString> &m )
{ {
RString sFind; RString sFind;
for (const auto &c : m) for (const std::pair<const char, RString> &c : m)
sFind.append( 1, c.first ); sFind.append( 1, c.first );
RString sRet; RString sRet;
+1 -1
View File
@@ -176,7 +176,7 @@ public:
} }
#endif #endif
bool isNull() const { return !m_pPtr; } bool isNull() const { return m_pPtr != nullptr; }
private: private:
T *m_pPtr; T *m_pPtr;
+1 -1
View File
@@ -5256,7 +5256,7 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const std::vector<int>
case tempo: case tempo:
{ {
// This affects all steps. // This affects all steps.
const auto tt = static_cast<TempoType>(answers[c]); const TempoType tt = static_cast<TempoType>(answers[c]);
float fScale = -1; float fScale = -1;
switch( tt ) switch( tt )
+4 -4
View File
@@ -374,7 +374,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
if( SM == SM_PlayPostSwitchPage ) if( SM == SM_PlayPostSwitchPage )
{ {
const auto iNewChoice = m_iChoice[ GAMESTATE->GetMasterPlayerNumber() ]; const int 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)
{ {
const auto iChoice = m_iChoice[p]; const int 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] == static_cast<int32_t>(c)) if(disabled && m_iChoice[p] == static_cast<int>(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;
auto iSwitchToIndex = m_iChoice[pn]; int iSwitchToIndex = m_iChoice[pn];
std::set<int> seen; std::set<int> seen;
do do
+1 -1
View File
@@ -575,7 +575,7 @@ 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) {
auto& v = *songVectors[songVecIdx]; std::vector<Song*>& v = *songVectors[songVecIdx];
std::erase_if( v, [song](Song* vSong){return vSong == song;} ); std::erase_if( v, [song](Song* vSong){return vSong == song;} );
} }
} }
+20 -11
View File
@@ -33,18 +33,27 @@ LuaDeclareType( SoundEffectType );
class SongOptions class SongOptions
{ {
public: public:
bool m_bAssistClap{false}; bool m_bAssistClap;
bool m_bAssistMetronome{false}; bool m_bAssistMetronome;
float m_fMusicRate{1.0f}, m_SpeedfMusicRate{1.0f}; float m_fMusicRate, m_SpeedfMusicRate;
float m_fHaste{0.0f}, m_SpeedfHaste{1.0f}; float m_fHaste, m_SpeedfHaste;
AutosyncType m_AutosyncType{AutosyncType_Off}; AutosyncType m_AutosyncType;
SoundEffectType m_SoundEffectType{SoundEffectType_Off}; SoundEffectType m_SoundEffectType;
bool m_bStaticBackground{false}; bool m_bStaticBackground;
bool m_bRandomBGOnly{false}; bool m_bRandomBGOnly;
bool m_bSaveScore{true}; bool m_bSaveScore;
bool m_bSaveReplay{false}; bool m_bSaveReplay;
SongOptions() = default; /**
* @brief Set up the SongOptions with reasonable defaults.
*/
SongOptions(): m_bAssistClap(false),
m_bAssistMetronome(false), m_fMusicRate(1.0f),
m_SpeedfMusicRate(1.0f), m_fHaste(0.0f),
m_SpeedfHaste(1.0f), m_AutosyncType(AutosyncType_Off),
m_SoundEffectType(SoundEffectType_Off),
m_bStaticBackground(false), m_bRandomBGOnly(false),
m_bSaveScore(true), m_bSaveReplay(false) {};
void Init() { *this = {}; } void Init() { *this = {}; }
void Approach( const SongOptions& other, float fDeltaSeconds ); void Approach( const SongOptions& other, float fDeltaSeconds );
void GetMods( std::vector<RString> &AddTo ) const; void GetMods( std::vector<RString> &AddTo ) const;
+12 -12
View File
@@ -27,14 +27,14 @@ public:
// See explanation in source. // See explanation in source.
static Sprite* NewBlankSprite(); static Sprite* NewBlankSprite();
virtual void InitState(); virtual void InitState() override;
void LoadFromNode( const XNode* pNode ); void LoadFromNode( const XNode* pNode ) override;
virtual Sprite *Copy() const; virtual Sprite *Copy() const override;
virtual bool EarlyAbortDraw() const; virtual bool EarlyAbortDraw() const override;
virtual void DrawPrimitives(); virtual void DrawPrimitives() override;
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime ) override;
void UpdateAnimationState(); // take m_fSecondsIntoState, and move to a new state void UpdateAnimationState(); // take m_fSecondsIntoState, and move to a new state
@@ -50,15 +50,15 @@ public:
void UnloadTexture(); void UnloadTexture();
RageTexture* GetTexture() { return m_pTexture; }; RageTexture* GetTexture() { return m_pTexture; };
virtual void EnableAnimation( bool bEnable ); virtual void EnableAnimation( bool bEnable ) override;
virtual int GetNumStates() const; virtual int GetNumStates() const override;
virtual void SetState( int iNewState ); virtual void SetState( int iNewState ) override;
int GetState() { return m_iCurState; } int GetState() { return m_iCurState; }
virtual float GetAnimationLengthSeconds() const virtual float GetAnimationLengthSeconds() const override
{ return m_animation_length_seconds; } { return m_animation_length_seconds; }
virtual void RecalcAnimationLengthSeconds(); virtual void RecalcAnimationLengthSeconds();
virtual void SetSecondsIntoAnimation( float fSeconds ); virtual void SetSecondsIntoAnimation( float fSeconds ) override;
void SetStateProperties(const std::vector<State>& new_states) void SetStateProperties(const std::vector<State>& new_states)
{ m_States= new_states; RecalcAnimationLengthSeconds(); SetState(0); } { m_States= new_states; RecalcAnimationLengthSeconds(); SetState(0); }
@@ -91,7 +91,7 @@ public:
void CropTo( float fWidth, float fHeight ); void CropTo( float fWidth, float fHeight );
// Commands // Commands
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L ) override;
void SetAllStateDelays(float fDelay); void SetAllStateDelays(float fDelay);
+1 -1
View File
@@ -314,7 +314,7 @@ bool StageStats::PlayerHasHighScore( PlayerNumber pn ) const
PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse, pTrail) : PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse, pTrail) :
PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong, pSteps); PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong, pSteps);
const auto iScore = m_player[pn].m_iScore; const unsigned int iScore = m_player[pn].m_iScore;
float fPercentDP = m_player[pn].GetPercentDancePoints(); float fPercentDP = m_player[pn].GetPercentDancePoints();
for( int h=0; h<(int)hsl.vHighScores.size() && h<PREFSMAN->m_iMaxHighScoresPerListForMachine; ++h ) for( int h=0; h<(int)hsl.vHighScores.size() && h<PREFSMAN->m_iMaxHighScoresPerListForMachine; ++h )
{ {
+1 -1
View File
@@ -65,7 +65,7 @@ void StepsUtil::GetAllMatchingEndless( Song *pSong, const StepsCriteria &stc, st
{ {
const std::vector<Steps*> &vSteps = ( stc.m_st == StepsType_Invalid ? pSong->GetAllSteps() : const std::vector<Steps*> &vSteps = ( stc.m_st == StepsType_Invalid ? pSong->GetAllSteps() :
pSong->GetStepsByStepsType( stc.m_st ) ); pSong->GetStepsByStepsType( stc.m_st ) );
const auto previousSize = out.size(); const size_t previousSize = out.size();
int successful = false; int successful = false;
GetAllMatching( pSong, stc, out ); GetAllMatching( pSong, stc, out );
+2 -2
View File
@@ -274,7 +274,7 @@ void TimingData::ShiftRange(int start_row, int end_row,
// the rows of the segments, the second time removing segments that // the rows of the segments, the second time removing segments that
// have been run over by a segment being moved. Attempts to combine // have been run over by a segment being moved. Attempts to combine
// both operations into a single loop were error prone. -Kyz // both operations into a single loop were error prone. -Kyz
for(size_t i= first_affected; last_affected >= 0 && i <= static_cast<uint32_t>(last_affected) && i < segs.size(); ++i) for(size_t i= first_affected; i <= static_cast<size_t>(last_affected) && i < segs.size(); ++i)
{ {
int seg_row= segs[i]->GetRow(); int seg_row= segs[i]->GetRow();
if(seg_row > 0 && seg_row >= start_row && seg_row <= end_row) if(seg_row > 0 && seg_row >= start_row && seg_row <= end_row)
@@ -284,7 +284,7 @@ void TimingData::ShiftRange(int start_row, int end_row,
} }
} }
#define ERASE_SEG(s) if(segs.size() > 1) { EraseSegment(segs, s, segs[s]); --i; --last_affected; erased= true; } #define ERASE_SEG(s) if(segs.size() > 1) { EraseSegment(segs, s, segs[s]); --i; --last_affected; erased= true; }
for(size_t i= first_affected; last_affected >= 0 && i <= static_cast<uint32_t>(last_affected) && i < segs.size(); ++i) for(size_t i= first_affected; i <= static_cast<size_t>(last_affected) && i < segs.size(); ++i)
{ {
bool erased= false; bool erased= false;
int seg_row= segs[i]->GetRow(); int seg_row= segs[i]->GetRow();
@@ -771,8 +771,8 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
} }
} }
inline constexpr auto XINPUT_GAMEPAD_THUMB_MIN = std::numeric_limits<short>::min(); inline constexpr short XINPUT_GAMEPAD_THUMB_MIN = std::numeric_limits<short>::min();
inline constexpr auto XINPUT_GAMEPAD_THUMB_MAX = std::numeric_limits<short>::max(); inline constexpr short XINPUT_GAMEPAD_THUMB_MAX = std::numeric_limits<short>::max();
void InputHandler_DInput::UpdateXInput( XIDevice &device, const RageTimer &tm ) void InputHandler_DInput::UpdateXInput( XIDevice &device, const RageTimer &tm )
{ {
@@ -263,6 +263,9 @@ EventDevice::~EventDevice()
} }
InputHandler_Linux_Event::InputHandler_Linux_Event() InputHandler_Linux_Event::InputHandler_Linux_Event()
: m_NextDevice(DEVICE_JOY10)
, m_bShutdown(true)
, m_bDevicesChanged(false)
{ {
if(LINUXINPUT == nullptr) LINUXINPUT = new LinuxInputManager; if(LINUXINPUT == nullptr) LINUXINPUT = new LinuxInputManager;
LINUXINPUT->InitDriver(this); LINUXINPUT->InitDriver(this);
@@ -23,8 +23,8 @@ private:
void InputThread(); void InputThread();
RageThread m_InputThread; RageThread m_InputThread;
InputDevice m_NextDevice{DEVICE_JOY10}; InputDevice m_NextDevice;
bool m_bShutdown{true}, m_bDevicesChanged{false}; bool m_bShutdown, m_bDevicesChanged;
}; };
#define USE_INPUT_HANDLER_LINUX_JOYSTICK #define USE_INPUT_HANDLER_LINUX_JOYSTICK
@@ -388,8 +388,8 @@ RString LowLevelWindow_X11::TryVideoMode( const VideoModeParams &p, bool &bNewDe
// with as close to our desired refresh rate as possible. // with as close to our desired refresh rate as possible.
for (int i = 0; i < scrRes->nmode; i++) { for (int i = 0; i < scrRes->nmode; i++) {
const XRRModeInfo &thisMI = scrRes->modes[i]; const XRRModeInfo &thisMI = scrRes->modes[i];
const auto modeWidth = bPortrait ? thisMI.height : thisMI.width; const unsigned int modeWidth = bPortrait ? thisMI.height : thisMI.width;
const auto modeHeight = bPortrait ? thisMI.width : thisMI.height; const unsigned int modeHeight = bPortrait ? thisMI.width : thisMI.height;
if (p.width >= 0 && p.height >= 0 && modeWidth == static_cast<uint32_t>(p.width) && modeHeight == static_cast<uint32_t>(p.height)) { if (p.width >= 0 && p.height >= 0 && modeWidth == static_cast<uint32_t>(p.width) && modeHeight == static_cast<uint32_t>(p.height)) {
float fTempRefresh = calcRandRRefresh(thisMI.dotClock, thisMI.hTotal, thisMI.vTotal); float fTempRefresh = calcRandRRefresh(thisMI.dotClock, thisMI.hTotal, thisMI.vTotal);
float fTempDiff = std::abs(p.rate - fTempRefresh); float fTempDiff = std::abs(p.rate - fTempRefresh);