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
81 changes: 38 additions & 43 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ void printstatus()

printblankc(0, 0, colors.CHEADER, MAX_COLUMNS);

// Header
if (!menu)
{
short cblue = (colors.CHDRBG == CDBLUE) ? CLBLUE : CDBLUE;
Expand Down Expand Up @@ -185,7 +186,7 @@ void printstatus()
printtext(0, dpos.statusTopY, colors.CHEADER, " PLAY | PLAYPOS | PLAYPATT | STOP | LOAD | SAVE | PACK/RL | HELP | CLEAR | QUIT |");
}

if (followplay && (isplaying()))
if (followplay && isplaying())
{
for (int c = 0; c < maxChns; c++)
{
Expand Down Expand Up @@ -221,6 +222,7 @@ void printstatus()
}
}

// Pattern view
for (int c = 0; c < maxChns; c++)
{
std::sprintf(textbuffer, "CH.%d PATT.%02X ", c+1, epnum[c]);
Expand Down Expand Up @@ -323,6 +325,7 @@ void printstatus()
}
}

// Orderlist view
std::sprintf(textbuffer, "CHN ORDERLIST (SUBTUNE ");
printtext(dpos.orderlistX, dpos.orderlistY, colors.CTITLE|(colors.CHDRBG<<4), textbuffer);
std::sprintf(textbuffer, "%02X", esnum);
Expand All @@ -334,7 +337,7 @@ void printstatus()
std::sprintf(textbuffer, ")");
printtext(dpos.orderlistX+33, dpos.orderlistY, colors.CTITLE|(colors.CHDRBG<<4), textbuffer);
if (numsids == 2)
std::sprintf(textbuffer, " ");
std::sprintf(textbuffer, " ");
else
std::sprintf(textbuffer, " ");
printtext(dpos.orderlistX+34, dpos.orderlistY, colors.CTITLE|(colors.CHDRBG<<4), textbuffer);
Expand Down Expand Up @@ -432,58 +435,46 @@ void printstatus()
}
}

std::sprintf(textbuffer, "INSTRUMENT NUM. %02X %-16s ", einum, instr[einum].name);
// Instruments view
std::sprintf(textbuffer, "INSTRUMENTS AD SR WT PT FT VT VD GT FW");
printtext(dpos.instrumentsX, dpos.instrumentsY, colors.CTITLE|(colors.CHDRBG<<4), textbuffer);

int color;
std::sprintf(textbuffer, "Attack/Decay %02X", instr[einum].ad);
if (eipos == 0) color = colors.CEDIT; else color = colors.CNORMAL;
printtext(dpos.instrumentsX, dpos.instrumentsY+1, color, textbuffer);

std::sprintf(textbuffer, "Sustain/Release %02X", instr[einum].sr);
if (eipos == 1) color = colors.CEDIT; else color = colors.CNORMAL;
printtext(dpos.instrumentsX, dpos.instrumentsY+2, color, textbuffer);

std::sprintf(textbuffer, "Wavetable Pos %02X", instr[einum].ptr[WTBL]);
if (eipos == 2) color = colors.CEDIT; else color = colors.CNORMAL;
printtext(dpos.instrumentsX, dpos.instrumentsY+3, color, textbuffer);

std::sprintf(textbuffer, "Pulsetable Pos %02X", instr[einum].ptr[PTBL]);
if (eipos == 3) color = colors.CEDIT; else color = colors.CNORMAL;
printtext(dpos.instrumentsX, dpos.instrumentsY+4, color, textbuffer);

std::sprintf(textbuffer, "Filtertable Pos %02X", instr[einum].ptr[FTBL]);
if (eipos == 4) color = colors.CEDIT; else color = colors.CNORMAL;
printtext(dpos.instrumentsX, dpos.instrumentsY+5, color, textbuffer);

std::sprintf(textbuffer, "Vibrato Param %02X", instr[einum].ptr[STBL]);
if (eipos == 5) color = colors.CEDIT; else color = colors.CNORMAL;
printtext(dpos.instrumentsX+20, dpos.instrumentsY+1, color, textbuffer);

std::sprintf(textbuffer, "Vibrato Delay %02X", instr[einum].vibdelay);
if (eipos == 6) color = colors.CEDIT; else color = colors.CNORMAL;
printtext(dpos.instrumentsX+20, dpos.instrumentsY+2, color, textbuffer);

std::sprintf(textbuffer, "HR/Gate Timer %02X", instr[einum].gatetimer);
if (eipos == 7) color = colors.CEDIT; else color = colors.CNORMAL;
printtext(dpos.instrumentsX+20, dpos.instrumentsY+3, color, textbuffer);

std::sprintf(textbuffer, "1stFrame Wave %02X", instr[einum].firstwave);
if (eipos == 8) color = colors.CEDIT; else color = colors.CNORMAL;
printtext(dpos.instrumentsX+20, dpos.instrumentsY+4, color, textbuffer);
for (int i=0; i<5; i++)
{
int insnum = eirow + i;
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
);
printtext(dpos.instrumentsX, dpos.instrumentsY+1+i, color, textbuffer);
}

if (editmode == EDIT_INSTRUMENT)
int selpos = einum - eirow;
if ((editmode == EDIT_INSTRUMENT) && (selpos >= 0) && (selpos < 5))
{
if (eipos < 9)
{
if (!eamode) printbg(dpos.instrumentsX+16+eicolumn+20*(eipos/5), dpos.instrumentsY+1+(eipos%5), cc, 1);
// Instr param
if (!eamode) printbg(dpos.instrumentsX+20+3*eipos+eicolumn, dpos.instrumentsY+1+selpos, cc, 1);
}
else
{
if (!eamode) printbg(dpos.instrumentsX+20+std::strlen(instr[einum].name), dpos.instrumentsY, cc, 1);
// Instr name
if (!eamode) printbg(dpos.instrumentsX+3+std::strlen(instr[einum].name), dpos.instrumentsY+1+selpos, cc, 1);
}
}

// Tables view
std::sprintf(textbuffer, "WAVE TBL PULSETBL FILT.TBL SPEEDTBL");
printtext(dpos.instrumentsX, dpos.instrumentsY+7, colors.CTITLE|(colors.CHDRBG<<4), textbuffer);

Expand All @@ -493,7 +484,7 @@ void printstatus()
{
int p = etview[c]+d;

color = colors.CNORMAL;
int color = colors.CNORMAL;
switch (c)
{
case WTBL:
Expand Down Expand Up @@ -536,6 +527,7 @@ void printstatus()
}
}

// Info view
if (editmode == EDIT_TABLES)
{
if (!eamode) printbg(dpos.instrumentsX+3+etnum*10+(etcolumn & 1)+(etcolumn/2)*3, dpos.instrumentsY+8+etpos-etview[etnum], cc, 1);
Expand Down Expand Up @@ -568,9 +560,12 @@ void printstatus()
break;
}
}

// Footer
std::sprintf(textbuffer, "OCTAVE %d", epoctave);
printtext(dpos.octaveX, dpos.octaveY, colors.CTITLE, textbuffer);

int color;
switch(autoadvance)
{
case 0:
Expand Down
61 changes: 32 additions & 29 deletions src/instr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int cutinstr = -1;

int einum;
int eipos;
int eirow;
int eicolumn;

void instrumentcommands()
Expand Down Expand Up @@ -97,45 +98,45 @@ void instrumentcommands()
case KEY_RIGHT:
if (eipos < 9)
{
eicolumn++;
if (eicolumn > 1)
{
eicolumn = 0;
eipos += 5;
if (eipos >= 9) eipos -= 10;
if (eipos < 0) eipos = 8;
}
eipos++;
if (eipos >= 9) eipos -= 10;
if (eipos < 0) eipos = 0;
}
break;

case KEY_LEFT:
if (eipos < 9)
{
eicolumn--;
if (eicolumn < 0)
{
eicolumn = 1;
eipos -= 5;
if (eipos < 0) eipos += 10;
if (eipos >= 9) eipos = 8;
}
eipos--;
if (eipos < 0) eipos += 10;
if (eipos > 8) eipos = 8;
}
break;

case KEY_DOWN:
if (eipos < 9)
{
eipos++;
if (eipos > 8) eipos = 0;
}
nextinstr();
break;

case KEY_UP:
if (eipos < 9)
{
eipos--;
if (eipos < 0) eipos = 8;
}
previnstr();
break;

case KEY_PGUP:
for (int scrrep = PGUPDNREPEAT; scrrep; scrrep--)
previnstr();
break;

case KEY_PGDN:
for (int scrrep = PGUPDNREPEAT; scrrep; scrrep--)
nextinstr();
break;

case KEY_HOME:
while (einum != 0) previnstr();
break;

case KEY_END:
while (einum != MAX_INSTR-1) nextinstr();
break;

case KEY_N:
Expand Down Expand Up @@ -259,21 +260,23 @@ void gotoinstr(int i)
editmode = EDIT_INSTRUMENT;
}

void nextinstr(void)
void nextinstr()
{
einum++;
if (einum >= MAX_INSTR) einum = MAX_INSTR - 1;
if ((einum - eirow) >= 5) eirow++;
showinstrtable();
}

void previnstr(void)
void previnstr()
{
einum--;
if (einum < 0) einum = 0;
if ((einum - eirow) < 0) eirow--;
showinstrtable();
}

void showinstrtable(void)
void showinstrtable()
{
if (!etlock)
{
Expand Down
3 changes: 3 additions & 0 deletions src/instr.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
#include "common.h"

#ifndef INSTR_C
// Curent instrument number
extern int einum;
// Instrument on the first row
extern int eirow;
extern int eipos;
extern int eicolumn;
extern INSTR instrcopybuffer;
Expand Down
48 changes: 24 additions & 24 deletions src/loadtrk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,17 @@ void mousecommands()
else if (win_mouseywheel < 0.f)
patterndown();
}
// Scroll instruments
if ((mousey >= dpos.instrumentsY+1) &&
(mousey <= dpos.instrumentsY+5) &&
(mousex >= dpos.instrumentsX) &&
(mousex <= dpos.instrumentsX+46))
{
if (win_mouseywheel > 0.f)
previnstr();
else if (win_mouseywheel < 0.f)
nextinstr();
}
// Scroll orderlist
if ((mousey >= dpos.orderlistY+1) &&
(mousey <= dpos.orderlistY+1+maxChns) &&
Expand Down Expand Up @@ -891,38 +902,27 @@ void mousecommands()
if (mouseb & MOUSEB_RIGHT) prevsong();
}

// Instrument editpos & instrument number selection
// Instrument editpos
if ((mousey >= dpos.instrumentsY+1) &&
(mousey <= dpos.instrumentsY+5) &&
(mousex >= (dpos.instrumentsX+16)) &&
(mousex <= (dpos.instrumentsX+17)))
(mousex >= (dpos.instrumentsX+20)) &&
(mousex <= (dpos.instrumentsX+46)))
{
editmode = EDIT_INSTRUMENT;
eipos = mousey-(dpos.instrumentsY+1);
eicolumn = mousex-(dpos.instrumentsX+16);
// Instr param
eicolumn = (mousex-(dpos.instrumentsX+20))%3;
eipos = (mousex-(dpos.instrumentsX+20))/3;
einum = eirow+mousey-(dpos.instrumentsY+1);
editmode = (eicolumn < 2) ? EDIT_INSTRUMENT : -1;
}
if ((mousey >= dpos.instrumentsY+1) &&
(mousey <= dpos.instrumentsY+4) &&
(mousex >= dpos.instrumentsX+36) &&
(mousex <= dpos.instrumentsX+37))
{
editmode = EDIT_INSTRUMENT;
eipos = mousey-(dpos.instrumentsY+1)+5;
eicolumn = mousex-(dpos.instrumentsX+36);
}
if ((mousey == dpos.instrumentsY) &&
(mousex >= dpos.instrumentsX+20))
(mousey <= dpos.instrumentsY+5) &&
(mousex >= dpos.instrumentsX+3) &&
(mousex <= dpos.instrumentsX+19))
{
// Instr name
editmode = EDIT_INSTRUMENT;
eipos = 9;
}
if (((!prevmouseb) || (mouseheld > HOLDDELAY)) &&
(mousey == dpos.instrumentsY) &&
(mousex >= dpos.instrumentsX+16) &&
(mousex <= dpos.instrumentsX+17))
{
if (mouseb & MOUSEB_LEFT) nextinstr();
if (mouseb & MOUSEB_RIGHT) previnstr();
einum = eirow+mousey-(dpos.instrumentsY+1);
}

// Table editpos
Expand Down
14 changes: 1 addition & 13 deletions src/loadtrk.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,7 @@

#include "common.h"
#include "file.h"
/*
#include "console.h"
#include "sound.h"
#include "sid.h"
#include "song.h"
#include "play.h"
#include "display.h"
#include "reloc.h"
#include "pattern.h"
#include "order.h"
#include "instr.h"
#include "table.h"
*/

enum
{
EDIT_PATTERN = 0,
Expand Down
1 change: 1 addition & 0 deletions src/song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,7 @@ void clearsong(bool cs, bool cp, bool ci, bool ct, bool cn)
std::memset(&instrcopybuffer, 0, sizeof(INSTR));
eipos = 0;
eicolumn = 0;
eirow = 1;
einum = 1;
}
if (ct == 1)
Expand Down
Loading