Skip to content

Commit 3a734ed

Browse files
committed
Quick fix for very recent v1.04 release
1 parent 4dfccac commit 3a734ed

File tree

1 file changed

+65
-17
lines changed

1 file changed

+65
-17
lines changed

src/ft2_pattern_ed.c

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,29 +1904,55 @@ static void updatePtnLen(void)
19041904
uint16_t len = pattLens[editor.editPattern];
19051905

19061906
song.pattLen = len;
1907-
editor.pattPos = song.pattPos = CLAMP(song.pattPos, 0, len - 1);
1907+
if (song.pattPos >= len)
1908+
{
1909+
song.pattPos = len - 1;
1910+
editor.pattPos = song.pattPos;
1911+
}
19081912

19091913
checkMarkLimits();
19101914
}
19111915

19121916
void pbEditPattUp(void)
19131917
{
1914-
if (editor.editPattern == 255)
1915-
return;
1918+
if (songPlaying)
1919+
{
1920+
if (song.pattNr == 255)
1921+
return;
1922+
}
1923+
else
1924+
{
1925+
if (editor.editPattern == 255)
1926+
return;
1927+
}
19161928

19171929
bool audioWasntLocked = !audio.locked;
19181930
if (audioWasntLocked)
19191931
lockAudio();
19201932

1921-
if (editor.editPattern < 255)
1933+
if (songPlaying)
1934+
{
1935+
if (song.pattNr < 255)
1936+
{
1937+
song.pattNr++;
1938+
updatePtnLen();
1939+
1940+
editor.ui.updatePatternEditor = true;
1941+
editor.ui.updatePosSections = true;
1942+
}
1943+
}
1944+
else
19221945
{
1923-
editor.editPattern++;
1946+
if (editor.editPattern < 255)
1947+
{
1948+
editor.editPattern++;
19241949

1925-
song.pattNr = editor.editPattern;
1926-
updatePtnLen();
1950+
song.pattNr = editor.editPattern;
1951+
updatePtnLen();
19271952

1928-
editor.ui.updatePatternEditor = true;
1929-
editor.ui.updatePosSections = true;
1953+
editor.ui.updatePatternEditor = true;
1954+
editor.ui.updatePosSections = true;
1955+
}
19301956
}
19311957

19321958
if (audioWasntLocked)
@@ -1935,22 +1961,44 @@ void pbEditPattUp(void)
19351961

19361962
void pbEditPattDown(void)
19371963
{
1938-
if (editor.editPattern == 0)
1939-
return;
1964+
if (songPlaying)
1965+
{
1966+
if (song.pattNr == 0)
1967+
return;
1968+
}
1969+
else
1970+
{
1971+
if (editor.editPattern == 0)
1972+
return;
1973+
}
19401974

19411975
bool audioWasntLocked = !audio.locked;
19421976
if (audioWasntLocked)
19431977
lockAudio();
19441978

1945-
if (editor.editPattern > 0)
1979+
if (songPlaying)
19461980
{
1947-
editor.editPattern--;
1981+
if (song.pattNr > 0)
1982+
{
1983+
song.pattNr--;
1984+
updatePtnLen();
19481985

1949-
song.pattNr = editor.editPattern;
1950-
updatePtnLen();
1986+
editor.ui.updatePatternEditor = true;
1987+
editor.ui.updatePosSections = true;
1988+
}
1989+
}
1990+
else
1991+
{
1992+
if (editor.editPattern > 0)
1993+
{
1994+
editor.editPattern--;
19511995

1952-
editor.ui.updatePatternEditor = true;
1953-
editor.ui.updatePosSections = true;
1996+
song.pattNr = editor.editPattern;
1997+
updatePtnLen();
1998+
1999+
editor.ui.updatePatternEditor = true;
2000+
editor.ui.updatePosSections = true;
2001+
}
19542002
}
19552003

19562004
if (audioWasntLocked)

0 commit comments

Comments
 (0)