home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / goattracker_2.73.zip / src / ghelp.c < prev    next >
C/C++ Source or Header  |  2014-07-23  |  18KB  |  408 lines

  1. //
  2. // GOATTRACKER v2 online help
  3. //
  4.  
  5. #define GHELP_C
  6.  
  7. #include "goattrk2.h"
  8.  
  9. #define HELP_HEADER 15
  10. #define HELP_NORMAL 7
  11.  
  12. int printrows(int column, int row, int color, char *strings[] ) {
  13.   int n = 0;
  14.   while(strings[n]) {
  15.     printtext(column, row++, color, strings[n++]);
  16.   }
  17.   return row;
  18. }
  19.  
  20. void onlinehelp(int standalone,int context)
  21. {
  22.   char *genkeys[] = {
  23.     "F1  Play from beginning",
  24.     "F2  Play from current position",
  25.     "F3  Play current pattern",
  26.     "F4  Stop playing",
  27.     "F5  Go to pattern editor",
  28.     "F6  Go to orderlist editor",
  29.     "F7  Go to instrument/table editor",
  30.     "F8  Go to songname editor",
  31.     "F9  Pack, relocate & save PRG,SID etc.",
  32.     "F10 Load song/instrument",
  33.     "F11 Save song/instrument",
  34.     "F12 This screen",
  35.     "SHIFT+F1-F3 Follow play begin/pos/patt.",
  36.     "SHIFT+F4 Mute current channel",
  37.     "SHIFT+F5-F6 Change speed multiplier",
  38.     "SHIFT+F7 Change hardrestart ADSR",
  39.     "SHIFT+F8 Switch between 6581/8580 SID",
  40.     "SHIFT+F10 Merge-load song",
  41.     "SHIFT+, . Move song startpos & restart",
  42.     "TAB Cycle between editing modes",
  43.     "INS Insert row (Press on endmark to",
  44.     "DEL Delete row change patt. length)",
  45.     "SHIFT+ESC Clear/optimize all musicdata",
  46.     "ESC Exit program",
  47.     NULL
  48.   };
  49.  
  50.   char *patternkeys[] = {
  51.     "Enter notes like on piano (PT or DMC)",
  52.     "0-9 & A-F to enter commands",
  53.     "SPC Switch between jam/editmode",
  54.     "BACKSPC Insert rest",
  55.     "RET Keyoff (/w SHIFT = Keyon)",
  56.     "- + Select instrument",
  57.     "/ * Select octave",
  58.     "< > Select pattern",
  59.     "BACKQUOTE Select channel",
  60.     "SHIFT+SPC Play from cursor pos",
  61.     "SHIFT+CRSR Mark pattern",
  62.     "SHIFT+Q,W Transpose half/octave up",
  63.     "SHIFT+A,S Transpose half/octave down",
  64.     "SHIFT+E,R Copy,paste effects",
  65.     "SHIFT+H Make hifi vib/portaspeed",
  66.     "SHIFT+I Invert selection/pattern",
  67.     "SHIFT+J,K Join/split pattern",
  68.     "SHIFT+L Mark/unmark whole pattern",
  69.     "SHIFT+M,N Choose highlighting step",
  70.     "SHIFT+O,P Shrink/expand pattern",
  71.     "SHIFT+X,C,V Cut,copy,paste pattern",
  72.     "SHIFT+Z Cycle autoadvance-mode",
  73.     "SHIFT+1,2,3 Mute channel",
  74.     NULL
  75.   };
  76.  
  77.   char *songkeys[] = {
  78.     "0-9 & A-F to enter pattern numbers",
  79.     "SPC Set start position for F2 key",
  80.     "BACKSPC Set end position for F2 key",
  81.     "RET Go to pattern (/w SHIFT=all chns.)",
  82.     "< > Select subtune",
  83.     "- + Insert transpose down/up command",
  84.     "SHIFT+CRSR LEFT/RIGHT Mark orderlist",
  85.     "SHIFT+L Mark/unmark whole orderlist",
  86.     "SHIFT+R Insert repeat command",
  87.     "SHIFT+X,C,V Cut,copy,paste orderlist",
  88.     "SHIFT+1,2,3 Swap orderlist with chn.",
  89.     NULL
  90.   };
  91.  
  92.   char *instkeys[] = {
  93.     "0-9 & A-F to enter parameters",
  94.     "SPC Play test note",
  95.     "SHIFT+SPC Silence test note",
  96.     "RET Go to table",
  97.     "- + Select instrument",
  98.     "/ * Select octave",
  99.     "BACKQUOTE Select table",
  100.     "SHIFT+CRSR Mark table",
  101.     "SHIFT+Q,W Trans. speed half/octave up",
  102.     "SHIFT+A,S Trans. speed half/octave down",
  103.     "SHIFT+L Convert pulse/filter limit",
  104.     "SHIFT+N Edit name/negate value or note",
  105.     "SHIFT+O Optimize table (remove unused)",
  106.     "SHIFT+R Convert absolute/relative note",
  107.     "SHIFT+S ""Smart"" instrument paste",
  108.     "SHIFT+U Unlock/lock table view",
  109.     "SHIFT+X,C,V Cut,copy,paste instr./table",
  110.     "SHIFT+DEL Delete instrument+tabledata",
  111.     "SHIFT+RET Convert vibrato parameter",
  112.     NULL
  113.   };
  114.  
  115.   char *pattcmds[] = {
  116.     "                                                                               ",
  117.     "Command 0XY: Do nothing. Databyte will always be 00.                           ",
  118.     "                                                                               ",
  119.     "Command 1XY: Portamento up. XY is index to a 16-bit speed in speedtable.       ",
  120.     "                                                                               ",
  121.     "Command 2XY: Portamento down. XY is index to a 16-bit speed in speedtable.     ",
  122.     "                                                                               ",
  123.     "Command 3XY: Toneportamento. Raise or lower pitch until target note has been   ",
  124.     "             reached. XY is index to a 16-bit speed or 00 for ""tie note"".      ",
  125.     "                                                                               ",
  126.     "Command 4XY: Vibrato. XY is index to speedtable. Left side value determines how",
  127.     "             long until the direction changes (speed) and right side value is  ",
  128.     "             the amount of pitch change each tick (depth).                     ",
  129.     "                                                                               ",
  130.     "Command 5XY: Set attack/decay register to value XY.                            ",
  131.     "                                                                               ",
  132.     "Command 6XY: Set sustain/release register to value XY.                         ",
  133.     "                                                                               ",
  134.     "Command 7XY: Set waveform register to value XY. If a wavetable is actively     ",
  135.     "             changing the channel's waveform at the same time, will be         ",
  136.     "             ineffective.                                                      ",
  137.     "                                                                               ",
  138.     "Command 8XY: Set wavetable pointer. 00 stops wavetable execution.              ",
  139.     "                                                                               ",
  140.     "Command 9XY: Set pulsetable pointer. 00 stops pulsetable execution.            ",
  141.     "                                                                               ",
  142.     "Command AXY: Set filtertable pointer. 00 stops filtertable execution.          ",
  143.     "                                                                               ",
  144.     "Command BXY: Set filter control. X is resonance and Y is channel bitmask.      ",
  145.     "             00 turns filter off and also stops filtertable execution.         ",
  146.     "                                                                               ",
  147.     "Command CXY: Set filter cutoff to XY. Can be ineffective if the filtertable is ",
  148.     "             active and also changing the cutoff.                              ",
  149.     "                                                                               ",
  150.     "Command DXY: Set mastervolume to Y, if X is 0. If X is not 0, value XY is      ",
  151.     "             copied to the timing mark location, which is playeraddress+$3F.   ",
  152.     "                                                                               ",
  153.     "Command EXY: Funktempo. XY is an index to speedtable. Will alternate left side ",
  154.     "             and right side tempo values on each pattern step.                 ",
  155.     "                                                                               ",
  156.     "Command FXY: Set tempo. Values 03-7F set tempo on all channels, values 83-FF   ",
  157.     "             only on current channel (subtract 80 to get actual tempo). Tempos ",
  158.     "             00 and 01 recall the funktempos set by EXY command.               ",
  159.     NULL
  160.   };
  161.  
  162.   char *instparm[] = {
  163.     "                                                                               ",
  164.     "Attack/Decay          0 is fastest attack or decay, F is slowest               ",
  165.     "                                                                               ",
  166.     "Sustain/Release       Sustain level 0 is silent and F is the loudest. Release  ",
  167.     "                      behaves like Attack & Decay (F slowest).                 ",
  168.     "                                                                               ",
  169.     "Wavetable Pos         Wavetable startposition. Value 00 stops the wavetable    ",
  170.     "                      execution and is not very useful.                        ",
  171.     "                                                                               ",
  172.     "Pulsetable Pos        Pulsetable startposition. Value 00 will leave pulse      ",
  173.     "                      execution untouched.                                     ",
  174.     "                                                                               ",
  175.     "Filtertable Pos       Filtertable startposition. Value 00 will leave filter    ",
  176.     "                      execution untouched. In most cases it makes sense to have",
  177.     "                      a filter-controlling instrument only on one channel at a ",
  178.     "                      time.                                                    ",
  179.     "                                                                               ",
  180.     "Vibrato Param         Instrument vibrato parameters. An index to the speed-    ",
  181.     "                      table, see command 4XY.                                  ",
  182.     "                                                                               ",
  183.     "Vibrato Delay         How many ticks until instrument vibrato starts. Value 00 ",
  184.     "                      turns instrument vibrato off.                            ",
  185.     "                                                                               ",
  186.     "HR/Gate Timer         How many ticks before note start note fetch, gateoff and ",
  187.     "                      hard restart happen. Can be at most tempo-1. So on tempo ",
  188.     "                      4 highest acceptable value is 3. Bitvalue 80 disables    ",
  189.     "                      hard restart and bitvalue 40 disables gateoff.           ",
  190.     "                                                                               ",
  191.     "1stFrame Wave         Waveform used on init frame of the note, usually 09 (gate",
  192.     "                      + testbit). Values 00, FE and FF have special meaning:   ",
  193.     "                      leave waveform unchanged and additionally set gate off   ",
  194.     "                      (FE), gate on (FF), or gate unchanged (00).              ",
  195.     NULL
  196.   };
  197.  
  198.   char *tables[] = {
  199.     "                                                                               ",
  200.     "Wavetable left side:  00    Leave waveform unchanged                           ",
  201.     "                      01-0F Delay this step by 1-15 frames                     ",
  202.     "                      10-DF Waveform values                                    ",
  203.     "                      E0-EF Inaudible waveform values 00-0F                    ",
  204.     "                      F0-FE Execute command 0XY-EXY. Right side is parameter   ",
  205.     "                      FF    Jump. Right side tells jump position (00 = stop)   ",
  206.     "                                                                               ",
  207.     "Wavetable right side: 00-5F Relative notes                                     ",
  208.     "                      60-7F Negative relative notes (lower pitch)              ",
  209.     "                      80    Keep frequency unchanged                           ",
  210.     "                      81-DF Absolute notes C#0 - B-7                           ",
  211.     "                                                                               ",
  212.     "Pulsetable left side: 01-7F Pulse modulation step. Left side indicates time and",
  213.     "                            right side the speed (8bit signed value).          ",
  214.     "                      8X-FX Set pulse width. X is the high 4 bits, right side  ",
  215.     "                            tells the 8 low bits.                              ",
  216.     "                      FF    Jump. Right side tells jump position (00 = stop)   ",
  217.     "                                                                               ",
  218.     "Filt.table left side: 00    Set cutoff, indicated by right side                ",
  219.     "                      01-7F Filter modulation step. Left side indicates time   ",
  220.     "                            and right side the speed (signed 8bit value)       ",
  221.     "                      80-F0 Set filter parameters. Left side high nybble tells ",
  222.     "                            the passband (90 = lowpass, A0 = bandpass etc.) and",
  223.     "                            right side tells resonance/channel bitmask, as in  ",
  224.     "                            command BXY.                                       ",
  225.     "                      FF    Jump. Right side tells jump position (00 = stop)   ",
  226.     "                                                                               ",
  227.     "Speedtbl. vibrato:    XX YY Left side tells how long until vibrato direction   ",
  228.     "                            changes (speed), right side is the value added to  ",
  229.     "                            pitch each tick (depth).                           ",
  230.     "                                                                               ",
  231.     "Speedtbl. portamento: XX YY A 16-bit value added to pitch each tick. Left side ",
  232.     "                            is the MSB and the right side the LSB.             ",
  233.     "                                                                               ",
  234.     "Speedtbl. funktempo:  XX YY Two 8-bit tempo values that are alternated on each ",
  235.     "                            pattern row, starting from the left side.          ",
  236.     "                                                                               ",
  237.     "For both vibrato and portamento, if XX has the high bit ($80) set, note        ",
  238.     "independent vibrato depth / portamento speed calculation is enabled, and YY    ",
  239.     "specifies the divisor (higher value -> lower result and more rastertime taken).",
  240.     NULL
  241.   };
  242.  
  243.   int hview = -1;
  244.  
  245.   int lastrow=0;
  246.  
  247.   for (;;)
  248.   {
  249.     int left = hview + 2;
  250.     int right = hview + 2;
  251.  
  252.     clearscreen();
  253.     if(!context) {
  254.       printtext(0, left++, HELP_HEADER, "GENERAL KEYS");
  255.       left = printrows(0,left,HELP_NORMAL, genkeys);
  256.       left++;
  257.  
  258.       printtext(40,right++, HELP_HEADER, "PATTERN EDIT MODE");
  259.       right = printrows(40,right,HELP_NORMAL, patternkeys);
  260.       right++;
  261.     
  262.       printtext(0, left++, HELP_HEADER, "SONG EDIT MODE");
  263.       left = printrows(0,left,HELP_NORMAL, songkeys);
  264.       left++;
  265.  
  266.       printtext(0, left++, HELP_HEADER, "SONGNAME EDIT MODE");
  267.       printtext(0, left++, HELP_NORMAL, "Use cursor UP/DOWN to change rows");
  268.       left++;
  269.  
  270.       printtext(40,right++, HELP_HEADER, "INSTRUMENT/TABLE EDIT MODE");
  271.       right = printrows(40,right,HELP_NORMAL, instkeys);
  272.       right++;
  273.     
  274.       left = (left<right ? right : left);
  275.     
  276.       printtext(0, left++, HELP_HEADER, "PATTERN COMMANDS");
  277.       left = printrows(0,left,HELP_NORMAL, pattcmds);
  278.       left++;
  279.  
  280.       printtext(0, left++, HELP_HEADER, "INSTRUMENT PARAMETERS");
  281.       left = printrows(0,left,HELP_NORMAL, instparm);
  282.       left++;
  283.  
  284.       printtext(0, left++, HELP_HEADER,"TABLES");
  285.       left = printrows(0,left,HELP_NORMAL, tables);
  286.       left++;
  287.     } else {
  288.       switch(editmode) {
  289.       case EDIT_PATTERN:      
  290.         printtext(0,left++, HELP_HEADER, "PATTERN EDIT MODE");
  291.         left = printrows(0,left,HELP_NORMAL, patternkeys);
  292.         left++;
  293.         printtext(0, left++, HELP_HEADER, "PATTERN COMMANDS");
  294.         left = printrows(0,left,HELP_NORMAL, pattcmds);
  295.         left++;
  296.         break;
  297.       case EDIT_ORDERLIST:
  298.         printtext(0, left++, HELP_HEADER, "SONG EDIT MODE");
  299.         left = printrows(0,left,HELP_NORMAL, songkeys);
  300.         left++;
  301.         break;
  302.       case EDIT_INSTRUMENT:
  303.         printtext(0,left++, HELP_HEADER, "INSTRUMENT/TABLE EDIT MODE");
  304.         left = printrows(0,left,HELP_NORMAL, instkeys);
  305.         left++;
  306.         printtext(0, left++, HELP_HEADER, "INSTRUMENT PARAMETERS");
  307.         left = printrows(0,left,HELP_NORMAL, instparm);
  308.         left++;
  309.         break;
  310.       case EDIT_NAMES:
  311.         printtext(0, left++, HELP_HEADER, "SONGNAME EDIT MODE");
  312.         printtext(0, left++, HELP_NORMAL, "Use cursor UP/DOWN to change rows");
  313.         left++;
  314.         break;
  315.       case EDIT_TABLES:
  316.         printtext(0,left++, HELP_HEADER, "INSTRUMENT/TABLE EDIT MODE");
  317.         left = printrows(0,left++,HELP_NORMAL, instkeys);
  318.         left++;
  319.         break;
  320.       default:
  321.         break;
  322.       }
  323.  
  324.     }
  325.  
  326.     if(!lastrow) lastrow=left;
  327.  
  328.     printblank(0, 0, MAX_COLUMNS);
  329.     sprintf(textbuffer, "%s Online Help", programname);
  330.     printtext(0, 0, HELP_HEADER, textbuffer);
  331.     if(standalone) {
  332.       printtext(55, 0, HELP_HEADER, "Arrows/PgUp/PgDn/Home/End scroll, ESC exits");
  333.     } else {
  334.       printtext(34, 0, HELP_HEADER, "Arrows/PgUp/PgDn/Home/End scroll, F12 toggles context, others exit");
  335.     }
  336.     printbg(0, 0, 1, MAX_COLUMNS);
  337.  
  338.     fliptoscreen();
  339.     waitkeymousenoupdate();
  340.  
  341.  
  342.     if (win_quitted)
  343.     {
  344.       exitprogram = 1;
  345.       break;
  346.     }
  347.  
  348.     switch(rawkey)
  349.     {
  350.       case KEY_LEFT:
  351.       case KEY_UP:
  352.         hview++;
  353.         break;
  354.  
  355.       case KEY_RIGHT:
  356.       case KEY_DOWN:
  357.         hview--;
  358.         break;
  359.  
  360.       case KEY_PGUP:
  361.         hview+=PGUPDNREPEAT;
  362.         break;
  363.  
  364.       case KEY_PGDN:
  365.         hview-=PGUPDNREPEAT;
  366.         break;
  367.  
  368.       case KEY_HOME:
  369.       hview = -1;
  370.       break;
  371.  
  372.       case KEY_END:
  373.       hview = -(lastrow-MAX_ROWS+1);
  374.       break;
  375.  
  376.       case KEY_F12:
  377.         context = !context;
  378.         hview = -1;
  379.         lastrow = 0;
  380.         continue;
  381.         break;
  382.  
  383.     case KEY_ESC:
  384.       goto EXITHELP;
  385.       break;
  386.  
  387.       default:
  388.       if (rawkey && !standalone) goto EXITHELP;
  389.  
  390.       break;
  391.     }
  392.  
  393.     if ((mouseb) && (mousey == 1)) hview++;
  394.     if ((mouseb) && (mousey == MAX_ROWS-1)) hview--;
  395.  
  396.     if (hview > -1) hview = -1;
  397.     if (hview < -(lastrow-MAX_ROWS+1)) hview = -(lastrow-MAX_ROWS+1);
  398.     if ((mouseb) && (!prevmouseb) && (!mousey)) break;
  399.   }
  400.   EXITHELP: ;
  401.   if(!standalone) {
  402.     printmainscreen();
  403.     key = 0;
  404.     rawkey = 0;
  405.   }
  406. }
  407.  
  408.