Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void printstatus()
{
for (int c = 0; c < maxChns; c++)
{
int currentSonglen = songlen[esnum][c];
int currentSonglen = song.len[esnum][c];
int newpos = chn[c].pattptr / 4;
if (chn[c].advance) epnum[c] = chn[c].pattnum;

Expand Down Expand Up @@ -271,23 +271,23 @@ void printstatus()
else
std::sprintf(textbuffer, " %02X", p);

if (pattern[epnum[c]][p*4] == ENDPATT)
if (song.pattern[epnum[c]][p*4] == ENDPATT)
{
std::sprintf(&textbuffer[3], " PATT. END");
if (color == colors.CNORMAL) color = colors.CCOMMAND;
}
else
{
std::sprintf(&textbuffer[3], " %s %02X%01X%02X",
notename[pattern[epnum[c]][p*4]-FIRSTNOTE],
pattern[epnum[c]][p*4+1],
pattern[epnum[c]][p*4+2],
pattern[epnum[c]][p*4+3]);
notename[song.pattern[epnum[c]][p*4]-FIRSTNOTE],
song.pattern[epnum[c]][p*4+1],
song.pattern[epnum[c]][p*4+2],
song.pattern[epnum[c]][p*4+3]);
if (patterndispmode & 2)
{
if (!pattern[epnum[c]][p*4+1])
if (!song.pattern[epnum[c]][p*4+1])
std::memset(&textbuffer[8], '.', 2);
if (!pattern[epnum[c]][p*4+2])
if (!song.pattern[epnum[c]][p*4+2])
std::memset(&textbuffer[10], '.', 3);
}
}
Expand Down Expand Up @@ -351,8 +351,8 @@ void printstatus()
for (int d = 0; d < visibleOrderlist; d++)
{
int p = esview+d;
unsigned char currentSongorder = songorder[esnum][c][p];
int currentSonglen = songlen[esnum][c];
unsigned char currentSongorder = song.order[esnum][c][p];
int currentSonglen = song.len[esnum][c];
int color = colors.CNORMAL;
if (isplaying())
{
Expand Down Expand Up @@ -437,16 +437,16 @@ void printstatus()
int color = insnum == einum ? colors.CEDIT : colors.CNORMAL;
std::sprintf(textbuffer, "%2d %-16s %02X %02X %02X %02X %02X %02X %02X %02X %02X",
insnum,
instr[insnum].name,
instr[insnum].ad,
instr[insnum].sr,
instr[insnum].ptr[WTBL],
instr[insnum].ptr[PTBL],
instr[insnum].ptr[FTBL],
instr[insnum].ptr[STBL],
instr[insnum].vibdelay,
instr[insnum].gatetimer,
instr[insnum].firstwave
song.instr[insnum].name,
song.instr[insnum].ad,
song.instr[insnum].sr,
song.instr[insnum].ptr[WTBL],
song.instr[insnum].ptr[PTBL],
song.instr[insnum].ptr[FTBL],
song.instr[insnum].ptr[STBL],
song.instr[insnum].vibdelay,
song.instr[insnum].gatetimer,
song.instr[insnum].firstwave
);
printtext(dpos.instrumentsX, dpos.instrumentsY+1+i, color, textbuffer);
}
Expand All @@ -462,7 +462,7 @@ void printstatus()
else
{
// Instr name
if (!eamode) printbg(dpos.instrumentsX+3+std::strlen(instr[einum].name), dpos.instrumentsY+1+selpos, cc, 1);
if (!eamode) printbg(dpos.instrumentsX+3+std::strlen(song.instr[einum].name), dpos.instrumentsY+1+selpos, cc, 1);
}
}

Expand All @@ -480,22 +480,22 @@ void printstatus()
switch (c)
{
case WTBL:
if (ltable[c][p] >= WAVECMD) color = colors.CCOMMAND;
if (song.ltable[c][p] >= WAVECMD) color = colors.CCOMMAND;
break;

case PTBL:
if (ltable[c][p] >= 0x80) color = colors.CCOMMAND;
if (song.ltable[c][p] >= 0x80) color = colors.CCOMMAND;
break;

case FTBL:
if ((ltable[c][p] >= 0x80) || ((!ltable[c][p]) && (rtable[c][p]))) color = colors.CCOMMAND;
if ((song.ltable[c][p] >= 0x80) || ((!song.ltable[c][p]) && (song.rtable[c][p]))) color = colors.CCOMMAND;
break;
}
if ((p == tables.pos()) && (tables.num() == c)) color = colors.CEDIT;
std::sprintf(textbuffer, "%02X:%02X %02X", p+1, ltable[c][p], rtable[c][p]);
std::sprintf(textbuffer, "%02X:%02X %02X", p+1, song.ltable[c][p], song.rtable[c][p]);
if (patterndispmode & 2)
{
if (!ltable[c][p] && !rtable[c][p] && !ltable[c][p+1] && !rtable[c][p+1])
if (!song.ltable[c][p] && !song.rtable[c][p] && !song.ltable[c][p+1] && !song.rtable[c][p+1])
{
std::memset(&textbuffer[3], '.', 2);
std::memset(&textbuffer[6], '.', 2);
Expand Down Expand Up @@ -524,29 +524,29 @@ void printstatus()

// Info view
printtext(dpos.instrumentsX, dpos.instrumentsY+8+VISIBLETABLEROWS+1, colors.CTITLE, "NAME ");
std::sprintf(textbuffer, "%-32s", songname);
std::sprintf(textbuffer, "%-32s", song.title);
printtext(dpos.instrumentsX+9, dpos.instrumentsY+8+VISIBLETABLEROWS+1, colors.CEDIT, textbuffer);

printtext(dpos.instrumentsX, dpos.instrumentsY+8+VISIBLETABLEROWS+2, colors.CTITLE, "AUTHOR ");
std::sprintf(textbuffer, "%-32s", authorname);
std::sprintf(textbuffer, "%-32s", song.author);
printtext(dpos.instrumentsX+9, dpos.instrumentsY+8+VISIBLETABLEROWS+2, colors.CEDIT, textbuffer);

printtext(dpos.instrumentsX, dpos.instrumentsY+8+VISIBLETABLEROWS+3, colors.CTITLE, "RELEASED ");
std::sprintf(textbuffer, "%-32s", copyrightname);
std::sprintf(textbuffer, "%-32s", song.released);
printtext(dpos.instrumentsX+9, dpos.instrumentsY+8+VISIBLETABLEROWS+3, colors.CEDIT, textbuffer);

if ((editmode == EDIT_NAMES) && (!eamode))
{
switch(enpos)
{
case 0:
printbg(dpos.instrumentsX+9+std::strlen(songname), dpos.instrumentsY+8+VISIBLETABLEROWS+1, cc, 1);
printbg(dpos.instrumentsX+9+std::strlen(song.title), dpos.instrumentsY+8+VISIBLETABLEROWS+1, cc, 1);
break;
case 1:
printbg(dpos.instrumentsX+9+std::strlen(authorname), dpos.instrumentsY+8+VISIBLETABLEROWS+2, cc, 1);
printbg(dpos.instrumentsX+9+std::strlen(song.author), dpos.instrumentsY+8+VISIBLETABLEROWS+2, cc, 1);
break;
case 2:
printbg(dpos.instrumentsX+9+std::strlen(copyrightname), dpos.instrumentsY+8+VISIBLETABLEROWS+3, cc, 1);
printbg(dpos.instrumentsX+9+std::strlen(song.released), dpos.instrumentsY+8+VISIBLETABLEROWS+3, cc, 1);
break;
}
}
Expand Down
36 changes: 18 additions & 18 deletions src/instr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void instrumentcommands()
if ((einum) && (shiftpressed) && (eipos < 9))
{
cutinstr = einum;
std::memcpy(&instrcopybuffer, &instr[einum], sizeof(INSTR));
std::memcpy(&instrcopybuffer, &song.instr[einum], sizeof(INSTR));
clearinstr(einum);
}
break;
Expand All @@ -70,20 +70,20 @@ void instrumentcommands()
if ((einum) && (shiftpressed) && (eipos < 9))
{
cutinstr = -1;
std::memcpy(&instrcopybuffer, &instr[einum], sizeof(INSTR));
std::memcpy(&instrcopybuffer, &song.instr[einum], sizeof(INSTR));
}
break;

case KEY_S:
if ((einum) && (shiftpressed) && (eipos < 9))
{
std::memcpy(&instr[einum], &instrcopybuffer, sizeof(INSTR));
std::memcpy(&song.instr[einum], &instrcopybuffer, sizeof(INSTR));
if (cutinstr != -1)
{
for (int c = 0; c < MAX_PATT; c++)
{
for (int d = 0; d < getPattlen(c); d++)
if (pattern[c][d*4+1] == cutinstr) pattern[c][d*4+1] = einum;
if (song.pattern[c][d*4+1] == cutinstr) song.pattern[c][d*4+1] = einum;
}
}
}
Expand All @@ -92,7 +92,7 @@ void instrumentcommands()
case KEY_V:
if ((einum) && (shiftpressed) && (eipos < 9))
{
std::memcpy(&instr[einum], &instrcopybuffer, sizeof(INSTR));
std::memcpy(&song.instr[einum], &instrcopybuffer, sizeof(INSTR));
}
break;

Expand Down Expand Up @@ -177,20 +177,20 @@ void instrumentcommands()
{
int pos;

if (instr[einum].ptr[eipos-2])
if (song.instr[einum].ptr[eipos-2])
{
if ((eipos == 5) && (shiftpressed))
{
instr[einum].ptr[STBL] = makespeedtable(instr[einum].ptr[STBL], finevibrato, true) + 1;
song.instr[einum].ptr[STBL] = makespeedtable(song.instr[einum].ptr[STBL], finevibrato, true) + 1;
break;
}
pos = instr[einum].ptr[eipos-2] - 1;
pos = song.instr[einum].ptr[eipos-2] - 1;
}
else
{
pos = gettablelen(eipos-2);
if (pos >= MAX_TABLELEN-1) pos = MAX_TABLELEN - 1;
if (shiftpressed) instr[einum].ptr[eipos-2] = pos + 1;
if (shiftpressed) song.instr[einum].ptr[eipos-2] = pos + 1;
}
gototable(eipos-2, pos);
}
Expand All @@ -202,10 +202,10 @@ void instrumentcommands()
}
break;
}
if ((eipos == 9) && (einum)) editstring(instr[einum].name, MAX_INSTRNAMELEN);
if ((eipos == 9) && (einum)) editstring(song.instr[einum].name, MAX_INSTRNAMELEN);
if ((hexnybble >= 0) && (eipos < 9) && (einum))
{
unsigned char *ptr = &instr[einum].ad;
unsigned char *ptr = &song.instr[einum].ad;
ptr += eipos;

switch(eicolumn)
Expand All @@ -232,22 +232,22 @@ void instrumentcommands()
// Validate instrument parameters
if (einum)
{
if (!(instr[einum].gatetimer & 0x3f)) instr[einum].gatetimer |= 1;
if (!(song.instr[einum].gatetimer & 0x3f)) song.instr[einum].gatetimer |= 1;
}
}


void clearinstr(int num)
{
std::memset(&instr[num], 0, sizeof(INSTR));
std::memset(&song.instr[num], 0, sizeof(INSTR));
if (num)
{
if (multiplier)
instr[num].gatetimer = 2 * multiplier;
song.instr[num].gatetimer = 2 * multiplier;
else
instr[num].gatetimer = 1;
song.instr[num].gatetimer = 1;

instr[num].firstwave = 0x9;
song.instr[num].firstwave = 0x9;
}
}

Expand Down Expand Up @@ -294,8 +294,8 @@ void showinstrtable()
{
for (int c = MAX_TABLES-1; c >= 0; c--)
{
if (instr[einum].ptr[c])
tables.settableviewfirst(c, instr[einum].ptr[c] - 1);
if (song.instr[einum].ptr[c])
tables.settableviewfirst(c, song.instr[einum].ptr[c] - 1);
}
}
}
Expand Down
36 changes: 18 additions & 18 deletions src/loadtrk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void mousecommands()
{
int maxChns = getMaxChannels();

int currentSonglen = songlen[esnum][eschn];
int currentSonglen = song.len[esnum][eschn];

if (win_mouseywheel != 0.f)
{
Expand Down Expand Up @@ -550,7 +550,7 @@ void mousecommands()
}
else if (win_mouseywheel < 0.f)
{
if ((songlen[esnum][eschn]-esview) > getVisibleOrderlist()-1)
if ((song.len[esnum][eschn]-esview) > getVisibleOrderlist()-1)
{
esview++;
eseditpos++;
Expand Down Expand Up @@ -956,7 +956,7 @@ void generalcommands()
case ':':
for (int c = 0; c < maxChns; c++)
{
currentSonglen = songlen[esnum][c];
currentSonglen = song.len[esnum][c];
if (espos[c] < (currentSonglen-1))
espos[c]++;
if ((espos[c] - esview) >= visibleOrderlist)
Expand Down Expand Up @@ -1162,10 +1162,10 @@ void save()
// Repeat until quit or save successful
while (!done)
{
if ((!std::strlen(instrfilename)) && (strlen(instr[einum].name)))
if ((!std::strlen(instrfilename)) && (std::strlen(song.instr[einum].name)))
{
useinstrname = 1;
std::strcpy(instrfilename, instr[einum].name);
std::strcpy(instrfilename, song.instr[einum].name);
std::strcat(instrfilename, ".ins");
std::strcpy(tempfilename, instrfilename);
}
Expand Down Expand Up @@ -1683,9 +1683,9 @@ void optimizeeverything()
{
for (int d = 0; d < MAX_PATTROWS; d++)
{
if (pattern[c][d*4] == ENDPATT) break;
if (pattern[c][d*4+1])
instrused[pattern[c][d*4+1]] = 1;
if (song.pattern[c][d*4] == ENDPATT) break;
if (song.pattern[c][d*4+1])
instrused[song.pattern[c][d*4+1]] = 1;
}
}
else deletepattern(c);
Expand All @@ -1701,14 +1701,14 @@ void optimizeeverything()

if (c < MAX_INSTR-2)
{
std::memmove(&instr[c], &instr[c+1], (MAX_INSTR-2-c) * sizeof(INSTR));
std::memmove(&song.instr[c], &song.instr[c+1], (MAX_INSTR-2-c) * sizeof(INSTR));
clearinstr(MAX_INSTR-2);
for (int d = 0; d < MAX_PATT; d++)
{
for (int e = 0; e < getPattlen(d); e++)
{
if ((pattern[d][e*4+1] > c) && (pattern[d][e*4+1] != MAX_INSTR-1))
pattern[d][e*4+1]--;
if ((song.pattern[d][e*4+1] > c) && (song.pattern[d][e*4+1] != MAX_INSTR-1))
song.pattern[d][e*4+1]--;
}
}
}
Expand All @@ -1732,20 +1732,20 @@ void findduplicatepatterns()
{
if (getPattlen(d) == getPattlen(c))
{
if (!std::memcmp(pattern[c], pattern[d], getPattlen(c)*4))
if (!std::memcmp(song.pattern[c], song.pattern[d], getPattlen(c)*4))
{
for (int f = 0; f < MAX_SONGS; f++)
{
if ((songlen[f][0]) &&
(songlen[f][1]) &&
(songlen[f][2]))
if ((song.len[f][0]) &&
(song.len[f][1]) &&
(song.len[f][2]))
{
for (int g = 0; g < maxChns; g++)
{
for (int h = 0; h < songlen[f][g]; h++)
for (int h = 0; h < song.len[f][g]; h++)
{
if (songorder[f][g][h] == d)
songorder[f][g][h] = c;
if (song.order[f][g][h] == d)
song.order[f][g][h] = c;
}
}
}
Expand Down
Loading
Loading