Advertisement
ZoriaRPG

Keyboard Input Buffer v5

Jan 24th, 2017
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 19.11 KB | None | 0 0
  1. import "std.zh"
  2.  
  3. const int SFX_KEYPRESS = 58;           
  4.  
  5. const int LINKTILEOFFSET = -261; const int KEY_DELAY = 65; //Trying this as 6.5 and timer changes as 1.0, using 65 and 10
  6. const int LINE_LENGTH = 54; const int BUFFER_LENGTH = 55;
  7. //int b1[55]; int b2[55]; int b3[55]; int b4[55]; int b5[55];
  8. //int b6[55]; int b7[55]; int b8[55]; int b9[55]; int b10[55];
  9. //int bufptr;
  10.  
  11. const int CHAR_WIDTH = 4;
  12. const int CURSOR_WIDTH = 4;
  13. const int CURSOR_POINT_CHAR = 62;
  14. const int CURSOR_Y_OFFSET = 4;
  15. const int CURSOR_X_OFFSET = 4;
  16. const int BUFFER_OUTPUT_X = 0;
  17. const int BUFFER_OUTPUT_Y = 0;
  18. const int CURSOR_BLINK_DUR = 70;
  19. const int CURSOR_Y_OFS = 1;
  20.  
  21. int ram[64]; const int RAM_q = 0;
  22.  
  23.  
  24. int buffer[214747]; //={CURSOR_POINT_CHAR, CHAR_SPACE};
  25. int bufferoverlay[214747]; //handles the cursor.
  26. bool ShiftKey;
  27. //int curbuffer = 0;
  28. int q; int timer = KEY_DELAY; bool cantype = true;
  29.  
  30. int temp_q; int cursorblink = 0;
  31.  
  32.  
  33. //CursorAdv(RAM_q);
  34. void CursorAdv(int n){
  35.     bufferoverlay[ram[n]] = CHAR_SPACE;
  36.     ram[n]++;
  37.     bufferoverlay[ram[n]] = '_'; //Cursor.
  38. }
  39.  
  40. //CursorRev(RAM_q);
  41. void CursorRev(int n){
  42.     bufferoverlay[ram[n]] = 0;
  43.     ram[n]--;
  44.     bufferoverlay[ram[n]] = '_'; //Cursor.
  45. }
  46.  
  47. global script a{
  48.     void run(){
  49. //int buffers[]={b1, b2, b3, b4, b5, b6, b7, b8, b9, b10};
  50.     //bufptr = buffers;
  51.     //int curbuffer = bufptr[q];
  52.         Link->Y = 90;
  53.         //Game->Cheat = 4;
  54.         while(true){
  55.             //Link->PressMap = false;
  56.             Link->InputMap = false;
  57.             if ( timer ) cantype = false;
  58.             if ( !timer ) cantype = true;
  59.             if ( Game->KeyPress[115] || Game->KeyPress[116] ) ShiftKey = true;
  60.             else ShiftKey = false;
  61.             if ( timer > 0 ) timer -10;
  62.             if ( timer <= 0 ) timer = 0;
  63.             if ( cursorblink > 0 ) cursorblink--;
  64.             if ( cursorblink <= 0 ) cursorblink = 100;
  65.             if ( cantype ) {
  66.                 //NoAction(); //Link->PressMap = false; Link->InputMap = false;
  67.                 for ( int qq = 1; qq <= 26; qq++ ) {
  68.                     if ( Game->KeyPress[qq] ){
  69.                         NoAction();
  70.                         if ( q < 214746 ) {
  71.                             if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  72.                             {
  73.                                 buffer[q] = CHAR_A-1+qq; CursorAdv(RAM_q); temp_q++;
  74.                                 if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  75.                                 timer = KEY_DELAY;
  76.                                 break;
  77.                             }
  78.                             else {
  79.                                 buffer[q] = CHAR_a-1+qq; CursorAdv(RAM_q); temp_q++;
  80.                                 if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  81.                                 timer = KEY_DELAY;
  82.                                 break;
  83.                             }
  84.                         }
  85.                        
  86.                     }
  87.                 }
  88.                 if ( Game->KeyPress[27] ){
  89.                     if ( q < 214746 ) {
  90.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  91.                         {   buffer[q] = ')'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  92.                         else { buffer[q] = '0'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  93.                         timer = KEY_DELAY;
  94.                     }
  95.                 }
  96.                 if ( Game->KeyPress[28] ){
  97.                     if ( q < 214746 ) {
  98.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  99.                         {   buffer[q] = '!'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  100.                         else { buffer[q] = '1'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  101.                         timer = KEY_DELAY;
  102.                     }
  103.                 }
  104.                 if ( Game->KeyPress[29] ){
  105.                     if ( q < 214746 ) {
  106.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  107.                         {   buffer[q] = '"'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  108.                         else { buffer[q] = '2'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  109.                         timer = KEY_DELAY;
  110.                     }
  111.                 }
  112.                 if ( Game->KeyPress[30] ){
  113.                     if ( q < 214746 ) {
  114.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  115.                         {   buffer[q] = '#'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  116.                         else { buffer[q] = '3'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  117.                         timer = KEY_DELAY;
  118.                     }
  119.                 }
  120.                 if ( Game->KeyPress[31] ){
  121.                     if ( q < 214746 ) {
  122.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  123.                         {   buffer[q] = '$'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  124.                         else { buffer[q] = '4'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  125.                         timer = KEY_DELAY;
  126.                     }
  127.                 }
  128.                 if ( Game->KeyPress[32] ){
  129.                     if ( q < 214746 ) {
  130.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  131.                         {   buffer[q] = '%'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  132.                         else { buffer[q] = '5'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  133.                         timer = KEY_DELAY;
  134.                     }
  135.                 }
  136.                 if ( Game->KeyPress[33] ){
  137.                     if ( q < 214746 ) {
  138.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  139.                         {   buffer[q] = '^'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  140.                         else { buffer[q] = '6'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  141.                         timer = KEY_DELAY;
  142.                     }
  143.                 }
  144.                 if ( Game->KeyPress[34] ){
  145.                     if ( q < 214746 ) {
  146.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  147.                         {   buffer[q] = '&'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  148.                         else { buffer[q] = '7'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  149.                         timer = KEY_DELAY;
  150.                     }
  151.                 }
  152.                 if ( Game->KeyPress[35] ){
  153.                     if ( q < 214746 ) {
  154.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  155.                         {   buffer[q] = '*'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  156.                         else { buffer[q] = '8'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  157.                         timer = KEY_DELAY;
  158.                     }
  159.                 }
  160.                 if ( Game->KeyPress[36] ){
  161.                     if ( q < 214746 ) {
  162.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  163.                         {   buffer[q] = '('; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  164.                         else { buffer[q] = '9'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  165.                         timer = KEY_DELAY;
  166.                     }
  167.                 }
  168.                 if ( Game->KeyPress[37] ){ //tilde -- this might have issues unless we can set uncap false.
  169.                     if ( q < 214746 ) {
  170.                         buffer[q] = '0'; CursorAdv(RAM_q); temp_q++;
  171.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  172.                         timer = KEY_DELAY;
  173.                     }
  174.                 }
  175.                 if ( Game->KeyPress[38] ){ //tilde -- this might have issues unless we can set uncap false.
  176.                     if ( q < 214746 ) {
  177.                         buffer[q] = '1'; CursorAdv(RAM_q); temp_q++;
  178.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  179.                         timer = KEY_DELAY;
  180.                     }
  181.                 }
  182.                 if ( Game->KeyPress[39] ){ //tilde -- this might have issues unless we can set uncap false.
  183.                     if ( q < 214746 ) {
  184.                         buffer[q] = '2'; CursorAdv(RAM_q); temp_q++;
  185.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  186.                         timer = KEY_DELAY;
  187.                     }
  188.                 }
  189.                 if ( Game->KeyPress[40] ){ //tilde -- this might have issues unless we can set uncap false.
  190.                     if ( q < 214746 ) {
  191.                         buffer[q] = '3'; CursorAdv(RAM_q); temp_q++;
  192.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  193.                         timer = KEY_DELAY;
  194.                     }
  195.                 }
  196.                 if ( Game->KeyPress[41] ){ //tilde -- this might have issues unless we can set uncap false.
  197.                     if ( q < 214746 ) {
  198.                         buffer[q] = '4'; CursorAdv(RAM_q); temp_q++;
  199.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  200.                         timer = KEY_DELAY;
  201.                     }
  202.                 }
  203.                 if ( Game->KeyPress[42] ){ //tilde -- this might have issues unless we can set uncap false.
  204.                     if ( q < 214746 ) {
  205.                         buffer[q] = '5'; CursorAdv(RAM_q); temp_q++;
  206.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  207.                         timer = KEY_DELAY;
  208.                     }
  209.                 }
  210.                 if ( Game->KeyPress[43] ){ //tilde -- this might have issues unless we can set uncap false.
  211.                     if ( q < 214746 ) {
  212.                         buffer[q] = '6'; CursorAdv(RAM_q); temp_q++;
  213.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  214.                         timer = KEY_DELAY;
  215.                     }
  216.                 }
  217.                 if ( Game->KeyPress[44] ){ //tilde -- this might have issues unless we can set uncap false.
  218.                     if ( q < 214746 ) {
  219.                         buffer[q] = '7'; CursorAdv(RAM_q); temp_q++;
  220.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  221.                         timer = KEY_DELAY;
  222.                     }
  223.                 }
  224.                 if ( Game->KeyPress[45] ){ //tilde -- this might have issues unless we can set uncap false.
  225.                     if ( q < 214746 ) {
  226.                         buffer[q] = '8'; CursorAdv(RAM_q); temp_q++;
  227.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  228.                         timer = KEY_DELAY;
  229.                     }
  230.                 }              
  231.                 if ( Game->KeyPress[46] ){ //tilde -- this might have issues unless we can set uncap false.
  232.                     if ( q < 214746 ) {
  233.                         buffer[q] = '9'; CursorAdv(RAM_q); temp_q++;
  234.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  235.                         timer = KEY_DELAY;
  236.                     }
  237.                 }
  238.                 if ( Game->KeyPress[60] ){ //tilde -- this might have issues unless we can set uncap false.
  239.                     if ( q < 214746 ) {
  240.                         buffer[q] = '~'; CursorAdv(RAM_q); temp_q++;
  241.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  242.                         timer = KEY_DELAY;
  243.                     }
  244.                 }
  245.                 if ( Game->KeyPress[61] ){
  246.                     if ( q < 214746 ) {
  247.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  248.                         {   buffer[q] = '_'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  249.                         else { buffer[q] = '-'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  250.                         timer = KEY_DELAY;
  251.                     }
  252.                 }
  253.                 if ( Game->KeyPress[62] ){
  254.                     if ( q < 214746 ) {
  255.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  256.                         {   buffer[q] = '+'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  257.                         else { buffer[q] = '='; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  258.                         timer = KEY_DELAY;
  259.                     }
  260.                 }
  261.                 if ( Game->KeyPress[63] ){ //Delete key
  262.                     if ( q < 214746 ) {
  263.                         CursorRev(RAM_q); temp_q--; buffer[q] = 0;
  264.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  265.                         timer = KEY_DELAY;
  266.                     }
  267.                 }  
  268.  
  269.                 if ( Game->KeyPress[64] ){ //tab
  270.                     if ( q < 214746 ) {
  271.                         for ( int w = 0; w < 4; w++ ) { buffer[q] = CHAR_SPACE; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  272.                         timer = KEY_DELAY;
  273.                     }
  274.                 }
  275.                 if ( Game->KeyPress[65] ){
  276.                     if ( q < 214746 ) {
  277.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  278.                         {   buffer[q] = '{'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  279.                         else { buffer[q] = '['; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  280.                         timer = KEY_DELAY;
  281.                     }
  282.                 }
  283.                 if ( Game->KeyPress[66] ){
  284.                     if ( q < 214746 ) {
  285.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  286.                         {   buffer[q] = '}'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  287.                         else { buffer[q] = ']'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  288.                         timer = KEY_DELAY;
  289.                     }
  290.                 }
  291.                 if ( Game->KeyPress[68] ){
  292.                     if ( q < 214746 ) {
  293.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  294.                         {   buffer[q] = ':'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  295.                         else { buffer[q] = ';'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  296.                         timer = KEY_DELAY;
  297.                     }
  298.                 }
  299.                 if ( Game->KeyPress[69] ){
  300.                     if ( q < 214746 ) {
  301.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  302.                         {   buffer[q] = CHAR_DQUOTE; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  303.                         else { buffer[q] = CHAR_QUOTE; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  304.                         timer = KEY_DELAY;
  305.                     }
  306.                 }
  307.                 if ( Game->KeyPress[70] ){
  308.                     if ( q < 214746 ) {
  309.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  310.                         {   buffer[q] = '|'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  311.                         else { buffer[q] = CHAR_BSLASH; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  312.                         timer = KEY_DELAY;
  313.                     }
  314.                 }
  315.                 if ( Game->KeyPress[71] ){
  316.                     if ( q < 214746 ) {
  317.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  318.                         {   buffer[q] = '|'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  319.                         else { buffer[q] = CHAR_BSLASH; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  320.                         timer = KEY_DELAY;
  321.                     }
  322.                 }
  323.                 if ( Game->KeyPress[72] ){
  324.                     if ( q < 214746 ) {
  325.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  326.                         {   buffer[q] = '<'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  327.                         else { buffer[q] = ','; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  328.                         timer = KEY_DELAY;
  329.                     }
  330.                 }
  331.                 if ( Game->KeyPress[73] ){
  332.                     if ( q < 214746 ) {
  333.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  334.                         {   buffer[q] = '>'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  335.                         else { buffer[q] = '.'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  336.                         timer = KEY_DELAY;
  337.                     }
  338.                 }
  339.                 if ( Game->KeyPress[74] ){
  340.                     if ( q < 214746 ) {
  341.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  342.                         {   buffer[q] = '?'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  343.                         else { buffer[q] = '/'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  344.                         timer = KEY_DELAY;
  345.                     }
  346.                 }
  347.                
  348.                 if ( Game->KeyPress[75] ){
  349.                     if ( q < 214746 ) {
  350.                         buffer[q] = CHAR_SPACE; CursorAdv(RAM_q); temp_q++;
  351.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  352.                         timer = KEY_DELAY;
  353.                     }
  354.                 }
  355.                 if ( Game->KeyPress[77] ){ //delete
  356.                     if ( q < 214746 ) {
  357.                         for ( int w = q; w >= 0; w-- ) buffer[w] = 0;
  358.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  359.                         q = 0; temp_q = 0;
  360.                         timer = KEY_DELAY;
  361.                     }
  362.                 }
  363.                 if ( Game->KeyPress[78] ){
  364.                     if ( q < 214746 ) {
  365.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  366.                         {   buffer[q] = '~'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  367.                         else { buffer[q] = '`'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  368.                         timer = KEY_DELAY;
  369.                     }
  370.                 }
  371.                 if ( Game->KeyPress[82] ){ //leftarrow
  372.                     Link->PressLeft = false; Link->InputLeft = false;
  373.                     if ( q < 214746 ) {
  374.                         ram[RAM_q}--;
  375.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);//temp_q--;
  376.                         timer = KEY_DELAY;
  377.                     }
  378.                 }
  379.                 if ( Game->KeyPress[83] ){ //leftarrow
  380.                     Link->PressRight = false; Link->InputRight = false;
  381.                     if ( q < 214746 ) {
  382.                         ram[RAM_q]++;
  383.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);//temp_q--; //needs to operate on temp_q so that the highest position is recorded.
  384.                         timer = KEY_DELAY;
  385.                     }
  386.                 }
  387.                 if ( Game->KeyPress[84] ){ //up
  388.                     Link->PressUp = false; Link->InputUp = false;
  389.                     //find the previous command in the list
  390.                     /* if ( q < 214746 ) {
  391.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  392.                         {   buffer[q] = '|'; q++; temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  393.                         else { buffer[q] = CHAR_BSLASH; q++; temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  394.                         timer = KEY_DELAY;
  395.                     }
  396.                     */
  397.                 }
  398.                 if ( Game->KeyPress[85] ){ //up
  399.                     Link->PressDown = false; Link->InputDown = false;
  400.                     //find the next command in the list, clear if none
  401.                     /* if ( q < 214746 ) {
  402.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  403.                         {   buffer[q] = '|'; q++; temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  404.                         else { buffer[q] = CHAR_BSLASH; q++; temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  405.                         timer = KEY_DELAY;
  406.                     }
  407.                     */
  408.                 }
  409.                 if ( Game->KeyPress[86] ){
  410.                     if ( q < 214746 ) {
  411.                         buffer[q] = '/'; CursorAdv(RAM_q); temp_q++;
  412.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  413.                         timer = KEY_DELAY;
  414.                     }
  415.                 }
  416.                 if ( Game->KeyPress[87] ){
  417.                     if ( q < 214746 ) {
  418.                         buffer[q] = '*'; CursorAdv(RAM_q); temp_q++;
  419.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  420.                         timer = KEY_DELAY;
  421.                     }
  422.                 }          
  423.                 if ( Game->KeyPress[88] ){
  424.                     if ( q < 214746 ) {
  425.                         buffer[q] = '-'; CursorAdv(RAM_q); temp_q++;
  426.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  427.                         timer = KEY_DELAY;
  428.                     }
  429.                 }  
  430.                 if ( Game->KeyPress[89] ){
  431.                     if ( q < 214746 ) {
  432.                         buffer[q] = '+'; CursorAdv(RAM_q); temp_q++;
  433.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  434.                         timer = KEY_DELAY;
  435.                     }
  436.                 }  
  437.                 if ( Game->KeyPress[90] ){ //delete key, num pad
  438.                     if ( q < 214746 ) {
  439.                         buffer[q] = '/'; CursorAdv(RAM_q); temp_q++;
  440.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  441.                         timer = KEY_DELAY;
  442.                     }
  443.                 }  
  444.                 if ( Game->KeyPress[91] ){
  445.                     if ( q < 214746 ) {
  446.                         for ( int w = q; w >= 0; w-- ) buffer[w] = 0;
  447.                         if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);
  448.                         q = 0; temp_q = 0;
  449.                         timer = KEY_DELAY;
  450.                     }
  451.                 }  
  452.                 if ( Game->KeyPress[101] ){
  453.                     if ( q < 214746 ) {
  454.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  455.                         {   buffer[q] = ':'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  456.                         else { buffer[q] = ';'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  457.                         timer = KEY_DELAY;
  458.                     }
  459.                 }
  460.                
  461.                 if ( Game->KeyPress[105] ){
  462.                     if ( q < 214746 ) {
  463.                         if ( (Game->KeyPress[115] || Game->KeyPress[116]))
  464.                         {   buffer[q] = ':'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  465.                         else { buffer[q] = ';'; CursorAdv(RAM_q); temp_q++; if ( SFX_KEYPRESS > 0 ) Game->PlaySound(SFX_KEYPRESS);}
  466.                         timer = KEY_DELAY;
  467.                     }
  468.                 }
  469.                 //for ( int qqq = 0; qqq < SizeOfArray(bufferoverlay); qqq++ ) bufferoverlay[q] = CHAR_SPACE;
  470.                 //bufferoverlay[q] = '_'; //Cursor.
  471.             }
  472.  
  473.             Screen->DrawString(6,0,0,2, 0x01, -1, 0, GetBuffer(),128);
  474.    
  475.             if ( cursorblink > CURSOR_BLINK_DUR ) {
  476.                 Screen->DrawString(6,0,0+CURSOR_Y_OFS,2, 0x01, -1, 0, GetCursorOverlay(),128); //cursor
  477.                 /*
  478.                 Screen->Line(6,
  479.                     0+0+(q*CHAR_WIDTH),
  480.                     //BUFFER_OUTPUT_X+CURSOR_X_OFFSET+(q*CHAR_WIDTH),
  481.                     //BUFFER_OUTPUT_Y+CURSOR_Y_OFFSET,
  482.                     6,
  483.                     0+0+(q*CHAR_WIDTH)+4,
  484.                     //BUFFER_OUTPUT_X+CURSOR_X_OFFSET+(q*CHAR_WIDTH) + CURSOR_WIDTH,
  485.                     6,
  486.                     //BUFFER_OUTPUT_Y+CURSOR_Y_OFFSET,
  487.                     0x01, 1, 0, 0, 0, 128);
  488.                 */
  489.             }  
  490.             Waitdraw(); Waitframe();
  491.         }
  492.     }
  493. }  
  494. int GetBuffer(){
  495.     //int ptr = bufptr;
  496.     //return bufptr[buffer];
  497.     return buffer;
  498.    
  499. }  
  500.  
  501. int GetCursorOverlay(){
  502.     return bufferoverlay;
  503. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement