MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / GetHighlightAt

Method GetHighlightAt

Source/SongData.cpp:216–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216stHighlight CSongData::GetHighlightAt(unsigned Frame, unsigned Row) const { // // //
217// while (Frame < 0)
218// Frame += GetFrameCount();
219 Frame %= GetFrameCount();
220
221 stHighlight Hl = GetRowHighlight();
222
223 const CBookmark Zero { };
224 const CBookmarkCollection &Col = GetBookmarks();
225 if (const unsigned Count = Col.GetCount()) {
226 CBookmark tmp(Frame, Row);
227 unsigned int Min = tmp.Distance(Zero);
228 for (unsigned i = 0; i < Count; ++i) {
229 CBookmark *pMark = Col.GetBookmark(i);
230 unsigned Dist = tmp.Distance(*pMark);
231 if (Dist <= Min) {
232 Min = Dist;
233 if (pMark->m_Highlight.First != -1 && (pMark->m_bPersist || pMark->m_iFrame == Frame))
234 Hl.First = pMark->m_Highlight.First;
235 if (pMark->m_Highlight.Second != -1 && (pMark->m_bPersist || pMark->m_iFrame == Frame))
236 Hl.Second = pMark->m_Highlight.Second;
237 Hl.Offset = pMark->m_Highlight.Offset + pMark->m_iRow;
238 }
239 }
240 }
241
242 return Hl;
243}
244
245highlight_state_t CSongData::GetHighlightState(unsigned Frame, unsigned Row) const { // // //
246 stHighlight Hl = GetHighlightAt(Frame, Row);

Callers 1

ApplyGlobalStateMethod · 0.80

Calls 3

DistanceMethod · 0.80
GetBookmarkMethod · 0.80
GetCountMethod · 0.45

Tested by

no test coverage detected