Advertisement
szymski

Untitled

Aug 21st, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. #include <windows.h>
  2.  
  3. #define W while
  4. #define R int
  5. #define S(X,Y,C,A)b[Y][X]=(R)(C)|A<<16;
  6. #define D(K)GetAsyncKeyState(K)&1<<16
  7. #define Q(A)x=A;W(x--)
  8.  
  9. void* h;
  10. int b[70][90]; //0xCC00AA00
  11.  
  12. R x, y, a, Z=37, V, B, L=0, E, G, e[15], K, k, X, Y, j, U, I;
  13. INT64 s[3]={0x42247E5AFFBDA542,0x183C7EDBFF245AA5,0x2418BDDBBD99C300};
  14.  
  15. void d(R N, R M, INT64 g,R o=0) {
  16. W(g) {
  17. y=8;
  18. W(y--) {
  19. if(!o||g&1)S(N,M,g&1?219:32,a);
  20. g>>=1;
  21. N++;
  22. }
  23.  
  24. N -= 8;
  25. M--;
  26. }
  27. }
  28.  
  29. void t(R N, R M, char* T) {
  30. W(*T)
  31. S(N++, M, *T++, a);
  32. }
  33.  
  34. void m() {
  35. SMALL_RECT r{0, 0, 90, 70};
  36. WriteConsoleOutput(h, (CHAR_INFO*)&b, COORD{90, 70}, COORD(), &r);
  37. }
  38.  
  39. R main() {
  40. h = GetStdHandle(-11);
  41.  
  42. // Reset
  43. r:
  44. E=G=B=K=0;
  45. ZeroMemory(&e,60);
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. W(1) {
  53.  
  54. // ClearScreen
  55. Q(6300)
  56. S(x, 0, 0, 0);
  57.  
  58.  
  59.  
  60.  
  61. // HandleInput
  62. Z+=D(65)?-1:D(68)?1:0;
  63.  
  64. Z = Z < 0 ? 0 : Z > 80 ? 80 : Z;
  65.  
  66. W(D(32) && !B) {
  67. Beep(500, 30);
  68. V = Z + 2;
  69. B = 62;
  70. }
  71.  
  72. !B?V=-1:B--;
  73.  
  74. //if(!B)
  75. // V=-1;
  76. //else
  77. // B--;
  78.  
  79.  
  80.  
  81.  
  82. // DrawPlayer
  83. a = 10;
  84. d(Z, 65, 265759);
  85.  
  86. if(B>=0)
  87. S(V, B, 64, 13);
  88.  
  89.  
  90.  
  91.  
  92. //G++%2?E++:0;
  93.  
  94. // DrawEnemies
  95. //if(G++ % 2)
  96. // E++;
  97.  
  98. k=++E/26,j=E/2%13;
  99.  
  100. X = k % 2 ? (13 - j) : j;
  101.  
  102. goto test;
  103.  
  104. Q(15) {
  105. if(!e[x]) {
  106. a = x%2+14-L;
  107. U = X + x%5 * 16, I = k + 8 + x/5 * 10;
  108. d(U, I, s[(L+(a&1))%3]);
  109. if(V>U&&V<U+8&&B>I-8&&B<I) {
  110. e[x] = 1;
  111. B=0;
  112. if(++K==15) {
  113. // Win
  114. Q(6300)
  115. S(x, 0, 219, (x&(L+1)*4%15));
  116.  
  117. if(++L==1) {
  118. test:
  119. L=380;
  120. d(15,15,0xFFBD7E3C18183C);
  121. m();
  122. W(++L)Beep(s[L%3]&L,100);
  123. }
  124.  
  125. a = 14;
  126. Q(2)d(35+x*5,35,0xE010D090E0,1);
  127. char h[7]="Lvl: ";
  128. h[5] =L+48;
  129. t(40, 37, &h[0]);
  130.  
  131. m();
  132.  
  133. Q(6)
  134. Beep(x&1?200:300, 300);
  135.  
  136. goto r;
  137. }
  138. }
  139.  
  140. if(I > 62) {
  141. Q(4)
  142. Beep(210+x*10, x?300:1000);
  143. L=0;
  144. goto r;
  145. }
  146. }
  147. }
  148.  
  149. m();
  150.  
  151. Sleep(40-L*4);
  152.  
  153. }
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement