szymski

Untitled

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