home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 98 / af098sub.adf / asteroids2.LZX / asteroids2 / rotx / screen.c < prev    next >
C/C++ Source or Header  |  2009-01-17  |  16KB  |  758 lines

  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3. #include <graphics/gfxmacros.h>
  4. #include <graphics/displayinfo.h>
  5. #include <string.h>
  6. #include <h/rot.h>
  7. #include <h/extern.h>
  8. #include <h/define.h>
  9.  
  10. DefineKeys(wrp,window)
  11. struct RastPort *wrp;
  12. struct Window *window;
  13. {
  14. struct IntuiMessage *msg;
  15. LONG code=NULL;
  16. LONG x=0,i;
  17. BYTE string[10];
  18. LONG keycode[10];
  19. LONG x0,x1,x2,x3,yy[10],y0;
  20.  
  21. x0 = gi.wi/2-170;
  22. x1 = x0+12*(gi.smallfontheight-2);
  23. x2 = gi.wi/2+10;
  24. x3 = x2+12*(gi.smallfontheight-2);
  25.  
  26. y0 = gi.he/2-60;
  27. for(i=0;i<6;i++)
  28.     yy[i] = y0 + (gi.smallfontheight+2)*i;
  29.  
  30.  
  31. SetFont(wrp,basicfont);
  32. Move(wrp,gi.wi/2-135,110);
  33. Text(wrp,"DEFINE KEYS",11);
  34.  
  35.  
  36. SetFont(wrp,fixplain7font);
  37. Move(wrp,gi.wi/2-210,gi.he/2-80);
  38. Text(wrp,"CURRENT KEY DEFINITIONS",23);
  39.  
  40. SetFont(wrp,hiresfont);
  41. Move(wrp,x0,yy[0]);
  42. Text(wrp,"ROTATE LEFT",11);
  43. Move(wrp,x0,yy[1]);
  44. Text(wrp,"ROTATE RIGHT",12);
  45. Move(wrp,x0,yy[2]);
  46. Text(wrp,"FIRE",4);
  47. Move(wrp,x0,yy[3]);
  48. Text(wrp,"THRUST",6);
  49. Move(wrp,x0,yy[4]);
  50. Text(wrp,"HYPERSPACE",10);
  51. Move(wrp,x0,yy[5]);
  52. Text(wrp,"PAUSE",5);
  53.  
  54. sprintf(string,"$%x",k.left);
  55. Move(wrp,x1,yy[0]);
  56. Text(wrp,string,strlen(string));
  57. sprintf(string,"$%x",k.right);
  58. Move(wrp,x1,yy[1]);
  59. Text(wrp,string,strlen(string));
  60. sprintf(string,"$%x",k.fire);
  61. Move(wrp,x1,yy[2]);
  62. Text(wrp,string,strlen(string));
  63. sprintf(string,"$%x",k.thrust);
  64. Move(wrp,x1,yy[3]);
  65. Text(wrp,string,strlen(string));
  66. sprintf(string,"$%x",k.hyperspace);
  67. Move(wrp,x1,yy[4]);
  68. Text(wrp,string,strlen(string));
  69. sprintf(string,"$%x",k.pause);
  70. Move(wrp,x1,yy[5]);
  71. Text(wrp,string,strlen(string));
  72.  
  73. SetFont(wrp,fixplain7font);
  74. Move(wrp,gi.wi/2+5,gi.he/2-80);
  75. Text(wrp,"NEW KEY DEFINITIONS",19);
  76.  
  77. SetFont(wrp,hiresfont);
  78. Move(wrp,x2,yy[0]);
  79. Text(wrp,"ROTATE LEFT",11);
  80.  
  81. while ((code != F1) && (code != ESC))
  82. {
  83. WaitPort(window->UserPort);
  84. while (msg = (struct IntuiMessage *)GetMsg(window->UserPort))
  85.     {
  86.     code = msg->Code;
  87.     ReplyMsg((struct Message *)msg);
  88.     
  89.     if (code < 0x64)
  90.         {
  91.         x++;
  92.  
  93.         Move(wrp,x2,yy[x]);
  94.         if (x == 1)
  95.             {
  96.             Text(wrp,"ROTATE RIGHT",12);
  97.             keycode[0] = code;
  98.             }
  99.         else
  100.         if (x == 2)
  101.             {
  102.             Text(wrp,"FIRE",4);
  103.             keycode[1] = code;
  104.             }
  105.         else
  106.         if (x == 3)
  107.             {
  108.             Text(wrp,"THRUST",6);
  109.             keycode[2] = code;
  110.             }
  111.         else
  112.         if (x == 4)
  113.             {
  114.             Text(wrp,"HYPERSPACE",10);
  115.             keycode[3] = code;
  116.             }
  117.         else
  118.         if (x == 5)
  119.             {
  120.             Text(wrp,"PAUSE",5);
  121.             keycode[4] = code;
  122.             }
  123.         if (x == 6)
  124.             {
  125.             Move(wrp,gi.wi/2-110,gi.he/2+150);
  126.             Text(wrp,"PRESS < S >  TO SAVE DEFINITIONS",31);
  127.             Move(wrp,gi.wi/2-90,gi.he/2+150+gi.smallfontheight+2);
  128.             Text(wrp,"PRESS < F1 > TO RETURN",22);
  129.             keycode[5] = code;
  130.             }
  131.         if (x < 7)
  132.             {
  133.             Move(wrp,x3,yy[x-1]);
  134.             sprintf(string,"$%x",code);
  135.             Text(wrp,string,strlen(string));
  136.             }
  137.         else if (code == 0x21)
  138.                 {
  139.                 k.left = keycode[0]; 
  140.                 k.right = keycode[1]; 
  141.                 k.fire = keycode[2]; 
  142.                 k.thrust = keycode[3]; 
  143.                 k.hyperspace = keycode[4]; 
  144.                 k.pause = keycode[5]; 
  145.                 SaveKeyDefines();
  146.                 code = ESC;
  147.                 }
  148.         }
  149.     }
  150. }
  151. }
  152.  
  153.  
  154.  
  155. HandleOptions(wrp,window)
  156. struct RastPort *wrp;
  157. struct Window *window;
  158. {
  159. struct IntuiMessage *msg;
  160. LONG code=NULL,class;
  161. LONG x;
  162. BYTE string[10];
  163. LONG y1,yy[20],x0,x1,x2,x3;
  164. LONG screentype;
  165.  
  166. x0 = gi.wi/2 - 22*(gi.smallfontheight-2);
  167. x1 = x0 + 5*(gi.mediumfontheight-2);
  168. x2 = x1 + 22*(gi.smallfontheight-2);
  169. x3 = x2 + 25*(gi.smallfontheight-2);
  170.  
  171. y1 = 100;
  172. for(x=0;x<20;x++) 
  173.     yy[x] = y1+40+(gi.mediumfontheight+3)*x;
  174.  
  175.  
  176. SetFont(wrp,basicfont);
  177. Move(wrp,gi.wi/2-90,y1);
  178. Text(wrp,"OPTIONS",7);
  179.  
  180.  
  181. SetFont(wrp,fixplain7font);
  182.  
  183.  
  184. Move(wrp,x0,yy[0]);
  185. Text(wrp,"<F1>",4);
  186. Move(wrp,x0,yy[1]);
  187. Text(wrp,"<F2>",4);
  188. Move(wrp,x0,yy[2]);
  189. Text(wrp,"<F3>",4);
  190. Move(wrp,x0,yy[3]);
  191. Text(wrp,"<F4>",4);
  192. Move(wrp,x0,yy[4]);
  193. Text(wrp,"<F5>",4);
  194. Move(wrp,x0,yy[5]);
  195. Text(wrp,"<F6>",4);
  196. Move(wrp,x0,yy[6]);
  197. Text(wrp,"<F7>",4);
  198. Move(wrp,x0,yy[7]);
  199. Text(wrp,"<F8>",4);
  200. Move(wrp,x0,yy[8]);
  201. Text(wrp,"<F9>",4);
  202. Move(wrp,x0,yy[9]);
  203. Text(wrp,"<F10>",5);
  204.  
  205. Move(wrp,x0,yy[11]);
  206. Text(wrp,"<L>",3);
  207. Move(wrp,x0,yy[12]);
  208. Text(wrp,"<D>",3);
  209. Move(wrp,x0,yy[13]);
  210. Text(wrp,"<G>",3);
  211. Move(wrp,x0,yy[14]);
  212. Text(wrp,"<T>",3);
  213. Move(wrp,x0,yy[15]);
  214. Text(wrp,"<F>",3);
  215. Move(wrp,x0,yy[17]);
  216. Text(wrp,"<S>",3);
  217.  
  218. Move(wrp,x1,yy[0]);
  219. Text(wrp,"TO RETURN",9);
  220.  
  221.  
  222.  
  223. SetFont(wrp,hiresfont);
  224. Move(wrp,x1,yy[1]-1);
  225. Text(wrp,"NUMBER OF PLAYERS--",19);
  226. Move(wrp,x2,yy[1]-1);
  227. sprintf(string,"%d",control.playernum);
  228. Text(wrp,string,strlen(string));
  229.  
  230.  
  231. SetFont(wrp,hiresfont);
  232. Move(wrp,x1,yy[2]-1);
  233. Text(wrp,"PLAYER ONE CONTROL--",20);
  234. Move(wrp,x2,yy[2]-1);
  235. if (control.input[0] == 0) Text(wrp,"HUMAN (KEYBOARD)",16);
  236. else
  237. if (control.input[0] == 1) Text(wrp,"HUMAN (JOYSTICK)",16);
  238.  
  239.  
  240. Move(wrp,x1,yy[3]-1);
  241. Text(wrp,"PLAYER TWO CONTROL--",20);
  242. Move(wrp,x2,yy[3]-1);
  243. if (control.input[1] == 0) Text(wrp,"HUMAN (KEYBOARD)",16);
  244. else
  245. if (control.input[1] == 1) Text(wrp,"HUMAN (JOYSTICK)",16);
  246.  
  247.  
  248. Move(wrp,x1,yy[4]-1);
  249. Text(wrp,"MAXIMUM ENEMY SHIPS--",21);
  250. Move(wrp,x2,yy[4]-1);
  251. sprintf(string,"%d",control.enemyonscreen);
  252. Text(wrp,string,strlen(string));
  253.  
  254. Move(wrp,x1,yy[5]-1);
  255. Text(wrp,"FIGHTERS IN SQUADRON--",22);
  256. Move(wrp,x2,yy[5]-1);
  257. sprintf(string,"%d",control.ftrnum);
  258. Text(wrp,string,strlen(string));
  259.  
  260. Move(wrp,x1,yy[6]-1);
  261. Text(wrp,"BASE GAME DELAY--",17);
  262. Move(wrp,x2,yy[6]-1);
  263. sprintf(string,"%d",control.delay);
  264. Text(wrp,string,strlen(string));
  265.  
  266. Move(wrp,x1,yy[7]-1);
  267. Text(wrp,"TEAM PLAY MODE--",16);
  268. Move(wrp,x2,yy[7]-1);
  269. if (control.playmode == 0) Text(wrp,"COOPERATIVE",11);
  270. else
  271. if (control.playmode == 1) Text(wrp,"COMPETITIVE",11);
  272.  
  273. Move(wrp,x1,yy[8]-1);
  274. Text(wrp,"AMOUNT OF DEBRIS--",18);
  275. Move(wrp,x2,yy[8]-1);
  276. sprintf(string,"%d",control.standarddebris);
  277. Text(wrp,string,strlen(string));
  278.  
  279. Move(wrp,x1,yy[9]-1);
  280. Text(wrp,"FIRE WRAP --",12);
  281. Move(wrp,x2,yy[9]-1);
  282. if (control.firewrap == FALSE) Text(wrp,"OFF",3);
  283. else                         Text(wrp,"ON",2);
  284.  
  285.  
  286.  
  287. Move(wrp,x1,yy[11]-1);
  288. Text(wrp,"START LEVEL-",12);
  289. Move(wrp,x2,yy[11]-1);
  290. sprintf(string,"%d",control.startlevel);
  291. Text(wrp,string,strlen(string));
  292.  
  293. Move(wrp,x1,yy[12]-1);
  294. Text(wrp,"DIFFICULTY--",12);
  295. Move(wrp,x2,yy[12]-1);
  296. if (control.difficulty == 0) Text(wrp,"SIMPLE",6);
  297. else
  298. if (control.difficulty == 1) Text(wrp,"PRACTICE",8);
  299. else
  300. if (control.difficulty == 2) Text(wrp,"NORMAL",6);
  301.  
  302. Move(wrp,x1,yy[13]-1);
  303. Text(wrp,"GAME --",7);
  304. Move(wrp,x2,yy[13]-1);
  305.  
  306.  
  307. #if REGISTERED == TRUE
  308. if (control.game == 0) Text(wrp,"ASTERIODS II",12);
  309. #else
  310. if (control.game == 0) Text(wrp,"LIMITED ASTERIODS II",20);
  311. #endif
  312. else                   Text(wrp,"BASIC ASTEROIDS",15);
  313.  
  314.  
  315. screentype = control.screentype;
  316. Move(wrp,x1,yy[14]-1);
  317. Text(wrp,"SCREEN TYPE--",12);
  318. Move(wrp,x2,yy[14]-1);
  319. if (control.screentype == 0) Text(wrp,"WORKBENCH CLONE",15);
  320. else
  321. if (control.screentype == 1) Text(wrp,"HIRES NTSC",10);
  322. else
  323. if (control.screentype == 2) Text(wrp,"HIRES PAL",9);
  324. else
  325. if (control.screentype == 3) Text(wrp,"SUPERHIRES NTSC",15);
  326. else
  327. if (control.screentype == 4) Text(wrp,"SUPERHIRES PAL",14);
  328.  
  329.  
  330. Move(wrp,x1,yy[15]-1);
  331. Text(wrp,"FONT SIZE--",11);
  332. Move(wrp,x2,yy[15]-1);
  333. if (control.fontsize == 0) Text(wrp,"SMALL",5);
  334. else
  335. if (control.fontsize == 1) Text(wrp,"LARGE",5);
  336.  
  337.  
  338. Move(wrp,x1,yy[17]-1);
  339. Text(wrp,"SAVE OPTIONS TO DISK",20);
  340. Move(wrp,x2,yy[17]-1);
  341.  
  342.  
  343. while ((code != F1) && (code != ESC))
  344. {
  345. WaitPort(window->UserPort);
  346. while (msg = (struct IntuiMessage *)GetMsg(window->UserPort))
  347.     {
  348.     class = msg->Class;
  349.     code = msg->Code;
  350.     ReplyMsg((struct Message *)msg);
  351.  
  352.     if (class == RAWKEY)
  353.     {
  354.  
  355.     if (code == F2)
  356.         {
  357.          SetAPen(wrp,0);
  358.          RectFill(wrp,x2-1,yy[1]-(gi.smallfontheight+1),x3,yy[1]);
  359.         SetAPen(wrp,1);
  360.         Move(wrp,x2,yy[1]-1);
  361.          if (++control.playernum > control.maxplayernum) control.playernum = 1;
  362.         sprintf(string,"%d",control.playernum);
  363.         Text(wrp,string,strlen(string));
  364.  
  365.         Delay(10);
  366.         }
  367.     else
  368.     if (code == F3)
  369.         {
  370.          SetAPen(wrp,0);
  371.          RectFill(wrp,x2-1,yy[2]-(gi.smallfontheight+1),x3,yy[2]);
  372.         SetAPen(wrp,1);
  373.         Move(wrp,x2,yy[2]-1);
  374.  
  375.          if (++control.input[0] > 1) control.input[0] = 0;
  376.  
  377.          if (control.input[0] == 0) Text(wrp,"HUMAN (KEYBOARD)",16);
  378.         else
  379.         if (control.input[0] == 1) Text(wrp,"HUMAN (JOYSTICK)",16);
  380.         Delay(10);
  381.         }
  382.     else
  383.     if (code == F4)
  384.         {
  385.         SetAPen(wrp,0);
  386.          RectFill(wrp,x2-1,yy[3]-(gi.smallfontheight+1),x3,yy[3]);
  387.         SetAPen(wrp,1);
  388.         Move(wrp,x2,yy[3]-1);
  389.  
  390.          if (++control.input[1] > 1) control.input[1] = 0;
  391.          if (control.input[1] == 0) Text(wrp,"HUMAN (KEYBOARD)",16);
  392.         else
  393.          if (control.input[1] == 1) Text(wrp,"HUMAN (JOYSTICK)",16);
  394.         Delay(10);
  395.         }
  396.     else
  397.     if (code == F5)
  398.         {
  399.         SetAPen(wrp,0);
  400.          RectFill(wrp,x2-1,yy[4]-(gi.smallfontheight+1),x3,yy[4]);
  401.         SetAPen(wrp,1);
  402.         Move(wrp,x2,yy[4]-1);
  403.         
  404.          if (++control.enemyonscreen > 3) control.enemyonscreen = 0;
  405.         sprintf(string,"%d",control.enemyonscreen);
  406.         Text(wrp,string,strlen(string));
  407.         Delay(10);
  408.         }
  409.     else
  410.     if (code == F6)
  411.         {
  412.         SetAPen(wrp,0);
  413.          RectFill(wrp,x2-1,yy[5]-(gi.smallfontheight+1),x3,yy[5]);
  414.         SetAPen(wrp,1);
  415.         Move(wrp,x2,yy[5]-1);
  416.         
  417.          if (++control.ftrnum > 24) control.ftrnum = 0;
  418.         sprintf(string,"%d",control.ftrnum);
  419.         Text(wrp,string,strlen(string));
  420.         Delay(5);
  421.         }
  422.     else
  423.     if (code == F7)
  424.         {
  425.         SetAPen(wrp,0);
  426.          RectFill(wrp,x2-1,yy[6]-(gi.smallfontheight+1),x3,yy[6]);
  427.         SetAPen(wrp,1);
  428.         Move(wrp,x2,yy[6]-1);
  429.         
  430.         control.delay+=1000;
  431.          if (++control.delay > 60000) control.delay = 0;
  432.         sprintf(string,"%d",control.delay);
  433.         Text(wrp,string,strlen(string));
  434.         Delay(1);
  435.         }
  436.     else
  437.     if (code == F8)
  438.         {
  439.         SetAPen(wrp,0);
  440.          RectFill(wrp,x2-1,yy[7]-(gi.smallfontheight+1),x3,yy[7]);
  441.         SetAPen(wrp,1);
  442.         Move(wrp,x2,yy[7]-1);
  443.  
  444.          if (++control.playmode > 1) control.playmode = 0;
  445.          if (control.playmode == 0) Text(wrp,"COOPERATIVE",11);
  446.         else
  447.          if (control.playmode == 1) Text(wrp,"COMPETITIVE",11);
  448.         Delay(10);
  449.         }
  450.     else
  451.     if (code == F9)
  452.         {
  453.         SetAPen(wrp,0);
  454.          RectFill(wrp,x2-1,yy[8]-(gi.smallfontheight+1),x3,yy[8]);
  455.         SetAPen(wrp,1);
  456.         Move(wrp,x2,yy[8]-1);
  457.  
  458.         if (++control.standarddebris > 24) control.standarddebris = 4;
  459.         sprintf(string,"%d",control.standarddebris);
  460.         Text(wrp,string,strlen(string));
  461.         Delay(2);
  462.         }
  463.     else
  464.     if (code == F10)
  465.         {
  466.         SetAPen(wrp,0);
  467.          RectFill(wrp,x2-1,yy[9]-(gi.smallfontheight+1),x3,yy[9]);
  468.         SetAPen(wrp,1);
  469.         Move(wrp,x2,yy[9]-1);
  470.  
  471.         if (++control.firewrap > 1) control.firewrap=0;
  472.         if (control.firewrap == FALSE) Text(wrp,"OFF",3);
  473.         else                         Text(wrp,"ON",2);
  474.         Delay(5);
  475.         }
  476.  
  477.  
  478.     if (code == 0x28) /* L */
  479.         {
  480.         SetAPen(wrp,0);
  481.          RectFill(wrp,x2-1,yy[11]-(gi.smallfontheight+1),x3,yy[11]);
  482.         SetAPen(wrp,1);
  483.         Move(wrp,x2,yy[11]-1);
  484.  
  485.         if (++control.startlevel > 30) control.startlevel=1;
  486.         sprintf(string,"%d",control.startlevel);
  487.         Text(wrp,string,strlen(string));
  488.         Delay(2);
  489.         }
  490.  
  491.     if (code == 0x22) /* D */
  492.         {
  493.         SetAPen(wrp,0);
  494.          RectFill(wrp,x2-1,yy[12]-(gi.smallfontheight+1),x3,yy[12]);
  495.         SetAPen(wrp,1);
  496.         Move(wrp,x2,yy[12]-1);
  497.  
  498.         if (++control.difficulty > 2) control.difficulty=0;
  499.         if (control.difficulty == 0) Text(wrp,"SIMPLE",6);
  500.         else
  501.         if (control.difficulty == 1) Text(wrp,"PRACTICE",8);
  502.         else
  503.         if (control.difficulty == 2) Text(wrp,"NORMAL",6);
  504.         }
  505.  
  506.     if (code == 0x24) /* G */
  507.         {
  508.         SetAPen(wrp,0);
  509.          RectFill(wrp,x2-1,yy[13]-(gi.smallfontheight+1),x3,yy[13]);
  510.         SetAPen(wrp,1);
  511.         Move(wrp,x2,yy[13]-1);
  512.         
  513.          if (++control.game > 1) control.game = 0;
  514.  
  515. #if REGISTERED == TRUE
  516.         if (control.game == 0) Text(wrp,"ASTERIODS II",12);
  517. #else
  518.         if (control.game == 0) Text(wrp,"LIMITED ASTERIODS II",20);
  519. #endif
  520.         else                   Text(wrp,"BASIC ASTEROIDS",15);
  521.  
  522.         Delay(10);
  523.         }
  524.  
  525.     if (code == 0x14) /* T */
  526.         {
  527.         SetAPen(wrp,0);
  528.          RectFill(wrp,x2-1,yy[14]-(gi.smallfontheight+1),x3,yy[14]);
  529.         SetAPen(wrp,1);
  530.         Move(wrp,x2,yy[14]-1);
  531.         
  532.          if (++control.screentype > 4) control.screentype = 0;
  533.  
  534.         if (control.screentype == 0) Text(wrp,"WORKBENCH CLONE",15);
  535.         else
  536.         if (control.screentype == 1) Text(wrp,"HIRES NTSC",10);
  537.         else
  538.         if (control.screentype == 2) Text(wrp,"HIRES PAL",9);
  539.         else
  540.         if (control.screentype == 3) Text(wrp,"SUPERHIRES NTSC",15);
  541.         else
  542.         if (control.screentype == 4) Text(wrp,"SUPERHIRES PAL",14);
  543.         }
  544.  
  545.     if (code == 0x23) /* F */
  546.         {
  547.         SetAPen(wrp,0);
  548.          RectFill(wrp,x2-1,yy[15]-(gi.smallfontheight+1),x3,yy[15]);
  549.         SetAPen(wrp,1);
  550.         Move(wrp,x2,yy[15]-1);
  551.         
  552.          if (++control.fontsize > 1) control.fontsize = 0;
  553.  
  554.         if (control.fontsize == 0) Text(wrp,"SMALL",5);
  555.         else
  556.         if (control.fontsize == 1) Text(wrp,"LARGE",5);
  557.         }
  558.  
  559.  
  560.     if (code == 0x21) /* S */
  561.         {
  562.         SaveOptions();
  563.         }
  564.     }
  565.     }
  566. }
  567.  
  568. for(x=0;x<control.playernum;x++)
  569.     control.player[x] = TRUE;
  570.  
  571. for(x=control.playernum;x<control.maxplayernum;x++)
  572.     control.player[x] = FALSE;
  573.  
  574. if (control.game == 1)
  575.     {
  576.     control.ftrnum = 0;
  577.     control.enemyonscreen=0;
  578.     }
  579.  
  580. if (screentype != control.screentype)
  581.     SwapScreen(control.screentype);
  582. SetGameFont();
  583. }
  584.  
  585.  
  586.  
  587. DrawTitleScreen(wrp)
  588. struct RastPort *wrp;
  589. {
  590. BYTE string[40];
  591. LONG yy = 200,x1,x2,x3;
  592.  
  593. SetAPen(wrp,1);
  594. SetFont(wrp,basicfont);            /* title screen */
  595. Move(wrp,gi.wi/2-140,100);
  596. Text(wrp,"ASTERIODS II",12);
  597.  
  598. SetFont(wrp,hiresfont);            /* title screen */
  599.  
  600.  
  601. x1 = gi.wi/2-5*(gi.smallfontheight);
  602. x2 = x1-6*(gi.smallfontheight);
  603. x3 = x1-(gi.smallfontheight-2);
  604.  
  605. sprintf(string,"VERSION %s",VERSION);
  606. Move(wrp,x1,130);
  607. Text(wrp,string,strlen(string));
  608.  
  609. Move(wrp,x3,145);
  610. Text(wrp,"by mike seifert",15);
  611.  
  612. Move(wrp,x2,yy+1*gi.smallfontheight);
  613. Text(wrp,"PRESS  <F1>  TO START",21); 
  614.  
  615. Move(wrp,x2,yy+2*gi.smallfontheight);
  616. Text(wrp,"PRESS  <F2>  TO CHANGE OPTIONS",30);
  617.  
  618. Move(wrp,x2,yy+3*gi.smallfontheight);
  619. Text(wrp,"PRESS  <F3>  TO VIEW HIGH SCORES",32);
  620.  
  621. Move(wrp,x2,yy+4*gi.smallfontheight);
  622. Text(wrp,"PRESS  <F4>  TO GET INFORMATION",31);
  623.  
  624. Move(wrp,x2,yy+5*gi.smallfontheight);
  625. Text(wrp,"PRESS  <F5>  TO DEFINE KEYS",27);
  626.  
  627. Move(wrp,x2,yy+6*gi.smallfontheight);
  628. Text(wrp,"PRESS  <ESC>  TO EXIT",21);
  629. }
  630.  
  631.  
  632.  
  633.  
  634. WaitStart()
  635. {
  636. struct IntuiMessage *msg;
  637. LONG code=NULL,class;
  638.  
  639. while(msg = (struct IntuiMessage *)GetMsg(masterwindow->UserPort)) ReplyMsg((struct Message *)msg);
  640.  
  641. DrawTitleScreen(mwrp);
  642.  
  643. while (code != F1)
  644. {
  645. WaitPort(masterwindow->UserPort);
  646. while (msg = (struct IntuiMessage *)GetMsg(masterwindow->UserPort))
  647.     {
  648.     class = msg->Class; 
  649.     code = msg->Code;
  650.     ReplyMsg((struct Message *)msg);
  651.  
  652.     if (class == RAWKEY)
  653.         {
  654.         if (code == F2) 
  655.             {
  656.             SetRast(mwrp,0);
  657.             HandleOptions(mwrp,masterwindow);
  658.             while(msg = (struct IntuiMessage *)GetMsg(masterwindow->UserPort)) ReplyMsg((struct Message *)msg);
  659.             SetRast(mwrp,0);
  660.             DrawTitleScreen(mwrp);
  661.             }
  662.         else
  663.         if (code == F3) 
  664.             {
  665.             SetRast(mwrp,0);
  666.             DisplayHighScores(mwrp);
  667.  
  668.             while ((code != F1) && (code != ESC))
  669.                 {
  670.                 WaitPort(masterwindow->UserPort);
  671.                 while (msg = (struct IntuiMessage *)GetMsg(masterwindow->UserPort))
  672.                     {
  673.                     code = msg->Code;
  674.                     ReplyMsg((struct Message *)msg);
  675.                     }
  676.                 }
  677.             code = NULL;
  678.             SetRast(mwrp,0);
  679.             DrawTitleScreen(mwrp);
  680.             while(msg = (struct IntuiMessage *)GetMsg(masterwindow->UserPort)) ReplyMsg((struct Message *)msg);
  681.             }
  682.         else
  683.         if (code == F4) 
  684.             {
  685.             ClearScreen();
  686.             Information();
  687.             ClearScreen();
  688.             DrawTitleScreen(mwrp);
  689.             while(msg = (struct IntuiMessage *)GetMsg(masterwindow->UserPort)) ReplyMsg((struct Message *)msg);
  690.             }
  691.         else
  692.         if (code == F5) 
  693.             {
  694.             SetRast(mwrp,0);
  695.             DefineKeys(mwrp,masterwindow);
  696.             SetRast(mwrp,0);
  697.             DrawTitleScreen(mwrp);
  698.             while(msg = (struct IntuiMessage *)GetMsg(masterwindow->UserPort)) ReplyMsg((struct Message *)msg);
  699.             }
  700.         else
  701.         if (code == ESC)
  702.             {
  703.             Cleanup();
  704.             }
  705.         }
  706.     }
  707. }
  708. }
  709.  
  710. DrawGameScreen()
  711. {
  712. LONG x;
  713.  
  714.  
  715. for(x=0;x<2;x++)
  716.     {
  717.     SetWrMsk(rp1[x],0xfe);
  718.     SetFont(rp1[x],hiresfont);
  719.     SetAPen(rp1[x],2);
  720.  
  721.     Move(rp1[x],gi.wi/2,gi.smallfontheight+2);
  722.     Text(rp1[x],"PLAYER 2 SHIELDS",16);
  723.     Move(rp1[x],gi.wi/2,gi.he-gi.smallfontheight-3);
  724.     Text(rp1[x],"PLAYER 2 SCORE",14);
  725.     Move(rp1[x],gi.wi/2,gi.he-1);
  726.     Text(rp1[x],"SHIPS REMAINING",15);
  727.  
  728.     Move(rp1[x],+gi.x1,gi.smallfontheight+2);
  729.     Text(rp1[x],"PLAYER 1 SHIELDS",16);
  730.     Move(rp1[x],+gi.x1,gi.he-gi.smallfontheight-3);
  731.     Text(rp1[x],"PLAYER 1 SCORE",14);
  732.     Move(rp1[x],+gi.x1,gi.he-1);
  733.     Text(rp1[x],"SHIPS REMAINING",15);
  734.  
  735.     IncreaseScore(x,0);
  736.     IncreaseLives(x,0);
  737.      IncreaseShields(x,0);
  738.  
  739. /*    Move(rp1[x],gi.x1,gi.y1);
  740.     Draw(rp1[x],gi.x2,gi.y1);
  741.     Draw(rp1[x],gi.x2,gi.y2);
  742.     Draw(rp1[x],gi.x1,gi.y2);
  743.     Draw(rp1[x],gi.x1,gi.y1);*/
  744.     }
  745. }
  746.  
  747.  
  748. ClearScreen()
  749. {
  750. LONG x;
  751.  
  752. for(x=0;x<2;x++)
  753.     {
  754.     SetWrMsk(rp1[x],0xff);
  755.     SetRast(rp1[x],0);
  756.     }
  757. }
  758.