Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.67 KB | None | 0 0
  1. /*
  2. Galactic Raiders.
  3.  
  4.  
  5. um, yeah, lost interest in finishing this off, which is a shame, coz it could have
  6. been something half-decent.
  7.  
  8. Maybe one day I will finish it, or at least start the actual 'fun' bit of the so-called
  9. game. How about I just write it down on my lengthy "to do" list?
  10.  
  11. ---------------------------------------------------------------------------------- */
  12.  
  13. #include <vz.h>
  14. #include <games.h>
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <conio.h>
  18. #include <graphics.h>
  19. #include <math.h>
  20.  
  21.  
  22. #define scrsize 2048
  23. #define video 0x7000
  24. #define vz_lines 3 /* No. vz_lines that dont scroll.*/
  25.  
  26. char *mem;
  27. char scr[32*64];
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. draw_string(x,y,color,src)
  35. int x,y,color;
  36. char *src;
  37. { while (*src) {
  38. vz_char_draw(x,y,color,*src);
  39. x += 6;
  40. src++; }}
  41.  
  42.  
  43.  
  44. main(argc, argv)
  45. int argc;
  46. int *argv;
  47.  
  48. {
  49. int a,b,c,d,e,f,g,h,i,j,k,l,x,y,z;
  50. int lives, die, die2, rot, rot2;
  51.  
  52. (rand()&0); /* Setup intro stars */
  53. for(i=0;i<100;i++){
  54. a=(rand()&32);
  55. b=(rand()&64);
  56. c=(rand()&4);
  57. if (c==1) c=64;
  58. if (c==2) c=128;
  59. if (c==3) c=192;
  60. scr[(b*32)+a]=c;}
  61.  
  62. clg();
  63. vz_mode(1);
  64.  
  65. memcpy(0xc000,scr-i,2048);
  66. // vz_setbase(0xc000);
  67. draw_string(10, 25, 2, "GALACTIC RAIDERS");
  68. draw_string(11, 26, 1, "GALACTIC RAIDERS");
  69. memcpy(0x7000,0xc000,2048);
  70. vz_setbase(scr);
  71. j=100;k=200; /* play intro music */
  72. for(z=0;z<10;z++){
  73. j++; if (j==200)j=100; vz_sound(j,20);
  74. k--; if (k==100)k=200; vz_sound(k,10);}
  75. j=90;k=180;for(z=0;z<10;z++){
  76. j++; if (j==180)j=90; vz_sound(j,20);
  77. k--; if (k==100)k=180; vz_sound(k,10);}
  78. j=70;k=150;for(z=0;z<10;z++){
  79. j++; if (j==150)j=70; vz_sound(j,20);
  80. k--; if (k==100)k=150; vz_sound(k,20);}
  81. j=90;k=180;for(z=0;z<10;z++){
  82. j++; if (j==180)j=90; vz_sound(j,20);
  83. k--; if (k==100)k=150; vz_sound(k,20);}
  84. j=80;k=140;l=160;for(z=0;z<10;z++){
  85. j++; if (j==140)j=80; vz_sound(j,20);
  86. k--; if (k==80)k=140; vz_sound(k,20);
  87. l--; if (k==110)l=160; vz_sound(k,20);}
  88.  
  89. for (g=0;g<80;g++){ /* show stars */
  90. memcpy(0xc000,scr-i,2048);
  91. i++;
  92. vz_setbase(0xc000);
  93. draw_string(10, 25, 2, "GALACTIC RAIDERS");
  94. draw_string(11, 26, 1, "GALACTIC RAIDERS");
  95. memcpy(0x7000,0xc000,2048);
  96. vz_setbase(scr);
  97. for (j=0;j<10;j++){;}
  98. }
  99. vz_mode(1);
  100. die=63;
  101. die2=0;
  102. lives=3;
  103. c=0;
  104. a=0;
  105. z=1;
  106. x=60;
  107. y=50;
  108. g=1;
  109. i=0;
  110. h=0; /* X, bullet fired? */
  111. i=0; /* Y, bullet */
  112. vz_line(0,vz_lines,127,vz_lines,2);
  113. vz_line(b,vz_lines,c,vz_lines,1);
  114. b=30;
  115. c=97;
  116.  
  117.  
  118.  
  119. while(lives>0){
  120. vz_line(0,vz_lines,127,vz_lines,2);
  121. a=(rand()&4);
  122. srand(a);
  123. f=(rand()&3);
  124. g=(rand()&3);
  125. if (a==1&&f==1){vz_plot((rand()&b),vz_lines,3);} /* left side red rocks */
  126. if (a==1&&f==2){vz_plot((rand()&127-c)+c,vz_lines,3);} /* right side red rocks */
  127. if (f==1&&g==1){ /* centre blue chunky rocks */
  128. k = (rand()&c-b)+b;
  129. vz_plot(k,vz_lines,2);
  130. vz_plot(k,vz_lines+1,2);
  131. vz_plot(k+1,vz_lines,2);
  132. vz_plot(k+1,vz_lines+1,2);}
  133.  
  134. if (a==1){b=b+f;c=c+g;} /* make random sides */
  135. if (a==2){b=b-f;c=c-g;}
  136. if (a==3){b=b+f;c=c-g;}
  137. if (a==4){b=b-f;c=c+g;}
  138. if (b<10) {b=10;} /* if min or max, then stay there */
  139. if (b>50) {b=50;}
  140. if (c<70) {c=70;}
  141. if (c>116){c=116;}
  142. vz_line(b,vz_lines,c,vz_lines,1);
  143. vz_plot(b,vz_lines,3); /* side rocks */
  144. vz_plot(c,vz_lines,3);
  145.  
  146.  
  147. if ((mem[0x68fe] & 0x10) == 0) {y=y-1;} /* up Q */
  148. if ((mem[0x68fb] & 0x04) == 0) {y=y+1;} /* down shift */
  149. if ((mem[0x68ef] & 0x20) == 0) {x=x-1;} /* left M */
  150. if ((mem[0x68ef] & 0x08) == 0) {x=x+1;} /* right , */
  151. if ((mem[0x68ef] & 0x10) == 0) { /* fire space */
  152. h=x; /* turn bullet on, X of bullet */
  153. i=y; /* y of bullet */
  154. }
  155.  
  156. if (die < 2){
  157. if (die2 == 1){
  158. die2=0;
  159. x=((c-b)/2)+b; /* reset X of ship */
  160. }
  161.  
  162.  
  163. /* draw ship
  164. * ........ 00000000 00000000
  165. * ...x.... 00010000 00010000
  166. * ...x.... 00010000 00010000
  167. * ..xxx... 00111000 00111000
  168. * .xxxxx.. 01111100 01222100
  169. * ..x.x... 00101000 00303000
  170. * ........ 00000000 00000000
  171. * ........ 00000000 00000000
  172. */
  173. vz_shape(x-3,y+0,8,8,1,"\xff\xff\xff\xff\xff\xff\xff\xff");
  174. vz_shape(x-3,y+1,8,4,0,"\x10\x10\x38\x44");
  175. vz_shape(x-3,y+4,8,1,2,"\x38");
  176. vz_shape(x-3,y+5,8,1,3,"\x28");
  177.  
  178.  
  179.  
  180. if (y<20){y=20;} /* limit Y axis */
  181. if (y>58){y=58;}
  182. if ((rot==0)&&(y<58)){y++;} /* increase ship Y slowly every fourth scroll */
  183. if ((x<b+5)||(x>c-5)){ /* detect side hit */
  184. lives--;
  185. k=0;
  186. while(k<600){ /* blow up ship and start again. */
  187. vz_plot(x+(rand()&k/25),y+3+(rand()&k/25),3);
  188. vz_plot(x+(rand()&k/25),y+3-(rand()&k/25),3);
  189. vz_plot(x-(rand()&k/25),y+3+(rand()&k/25),3);
  190. vz_plot(x-(rand()&k/25),y+3-(rand()&k/25),3);
  191. k=k+20;
  192. memcpy(0x7000,scr,scrsize); /* dump screen */
  193. }
  194. die=63;
  195. die2=1;
  196. j=20;k=70;l=40; /* bunch of vz_sound */
  197. for(i=0;i<80;i++){
  198. j++; if (j==60)j=20; vz_sound(j,5);
  199. k--; if (k==30)k=70; vz_sound(k,5);}
  200.  
  201. }
  202.  
  203. if (h>0){ /* bullet is on if true */
  204. i--;
  205. if (x==b) {h=0;} /* turn bullet off */
  206. vz_plot (h,i+1,1); /* remove old bullet */
  207. vz_plot (h,i+2,1); /* remove old bullet */
  208. vz_plot (h,i,3); /* draw bullet */
  209. }
  210. } /* of while die < 2 */
  211.  
  212. die--;
  213. if(die<2){die=0;}
  214.  
  215. memset(scr, 0, 96);
  216.  
  217. if (lives>0){vz_line(121,0,121,2,1);} /* display lives left */
  218. if (lives>1){vz_line(123,0,123,2,1);}
  219. if (lives>2){vz_line(125,0,125,2,1);}
  220.  
  221. vz_plot(1,1,3);
  222. if(rot==0){vz_plot(0,0,3);
  223. vz_plot(2,2,3);}
  224. if(rot==1){vz_plot(1,0,3);
  225. vz_plot(1,2,3);}
  226. if(rot==2){vz_plot(2,0,3);
  227. vz_plot(0,2,3);}
  228. if(rot==3){vz_plot(0,1,3);
  229. vz_plot(2,1,3);}
  230. vz_plot(6,1,2);
  231. if(rot2==0){vz_plot(6,0,2);}
  232. if(rot2==1){vz_plot(7,0,2);}
  233. if(rot2==2){vz_plot(7,1,2);}
  234. if(rot2==3){vz_plot(7,2,2);}
  235. if(rot2==4){vz_plot(6,2,2);}
  236. if(rot2==5){vz_plot(5,2,2);}
  237. if(rot2==6){vz_plot(5,1,2);}
  238. if(rot2==7){vz_plot(5,0,2);}
  239. rot++;
  240. if (rot==4){rot=0;}
  241. rot2++;
  242. if (rot2==8){rot2=0;}
  243.  
  244.  
  245. memcpy(0x7000,scr,scrsize); /* dump screen */
  246. memcpy(scr+32,0x7000,2048-32); /* scroll screen */
  247.  
  248.  
  249. }
  250. /* no lives left */
  251.  
  252. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement