home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 98 / af098sub.adf / asteroids2.LZX / asteroids2 / rotx / graphics.c < prev    next >
C/C++ Source or Header  |  2009-09-18  |  15KB  |  813 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3. #include <graphics/gfxmacros.h>
  4. #include <intuition/intuition.h>
  5. #include <libraries/dos.h>
  6. #include <libraries/iffparse.h>
  7. #include <graphics/gels.h>
  8. #include <math.h>
  9. #include "h/graphics.h"
  10.  
  11. #define LOADIMAGENUM 24
  12. #define RENDIMAGENUM 24
  13.  
  14. #define ID_BODY MAKE_ID('B','O','D','Y')
  15. #define ID_BMHD MAKE_ID('B','M','H','D')
  16. #define ID_ILBM MAKE_ID('I','L','B','M')
  17. struct BitMapHeader *bmhd;
  18.  
  19. static UWORD Data[200][4][12];
  20.  
  21. extern struct imagedata id[800];
  22. extern struct vectordata v[40];
  23. extern struct imagelocation il;
  24. extern struct RastPort *rp1[2];
  25. extern struct BitMap *bm1[2];
  26. extern struct RastPort *mwrp;
  27. extern struct gameinfo gi;
  28.  
  29.  
  30. LoadILBM(UBYTE *Name,LONG num)
  31. {
  32. struct IFFHandle *hand;
  33. struct StoredProperty *prop;
  34. struct ContextNode *contextnode;
  35. UWORD *pdata;
  36. LONG error,length;
  37.  
  38. hand = (struct IFFHandle *)AllocIFF();
  39. if (hand == NULL) makerequest("IFFParse Error 001");
  40. else
  41.     {
  42.     hand->iff_Stream=Open(Name,MODE_OLDFILE);
  43.     if (hand->iff_Stream == NULL) makerequest("IFFParse Error 002");
  44.     else
  45.         {
  46.         InitIFFasDOS(hand);
  47.         error = OpenIFF(hand,IFFF_READ);
  48.         if (error != NULL) makerequest("IFFParse Error 003");
  49.         else
  50.             {
  51.             error = PropChunk(hand,ID_ILBM,ID_BMHD); /* Remember the voice header chunk if encountered. */
  52.             if (error != NULL) makerequest("IFFParse Error 004");
  53.             else
  54.                 {
  55.                 error = StopChunk(hand,ID_ILBM,ID_BODY);
  56.                 if (error != NULL) makerequest("IFFParse Error 005");
  57.                 else
  58.                     {
  59.                     error = ParseIFF(hand,IFFPARSE_SCAN);
  60.                     if (error != NULL) makerequest("IFFParse Error 006");
  61.                     else
  62.                         {
  63.                         prop = (struct StoredProperty *)FindProp(hand,ID_ILBM,ID_BMHD);
  64.                         if (prop == NULL) makerequest("IFFParse Error 007");
  65.                         else
  66.                             {
  67.                             bmhd = (struct BitMapHeader *)prop->sp_Data;
  68.  
  69.                             contextnode = (struct ContextNode *)CurrentChunk(hand);
  70.                             if (contextnode == NULL) makerequest("IFFParse Error 008");
  71.                             else
  72.                                 {
  73.                                 length = contextnode->cn_Size;
  74.  
  75.                                 pdata = (UWORD *)AllocMem(length,MEMF_CLEAR);
  76.                                 if (pdata == NULL)
  77.                                     {
  78.                                     makerequest("Temporary Image Allocation Error");
  79.                                     Cleanup();
  80.                                     }
  81.                                 else
  82.                                     {
  83.                                     error = ReadChunkBytes(hand,pdata,length);
  84.                                     if (error != length) makerequest("IFFParse Error 010");
  85.                                     else    GetImageData(num,pdata,length);
  86.                                     FreeMem(pdata,length);
  87.                                     }
  88.                                 }
  89.                             }
  90.                         }
  91.                     }
  92.                 }
  93.             CloseIFF(hand);
  94.             }
  95.         Close(hand -> iff_Stream);
  96.         }
  97.     FreeIFF(hand);
  98.     }
  99. }
  100.  
  101.  
  102.  
  103. GetImageData(num,pdata,length)
  104. LONG num;
  105. UWORD *pdata;
  106. LONG length;
  107. {
  108. LONG he,wi,de,comp;
  109. LONG h,w,d;
  110. LONG x=0;
  111. BYTE string[30];
  112.  
  113. he = bmhd->h;
  114. wi = bmhd->w;
  115. de = bmhd->BitPlanes;
  116. comp = bmhd->Compression;
  117.  
  118.  
  119. if (comp == NULL)
  120.     {
  121.     for (h=0;h<he;h++)
  122.            for (d=0;d<de;d++)
  123.                  for (w = 0; w<((wi-1)/16)+1; w++)
  124.                       Data[h][d][w] = pdata[x++];
  125.     }
  126. else
  127.     {
  128.     UnpackImage(num,(BYTE *)pdata);
  129.     }
  130.  
  131.  
  132.  
  133. id[num].he = he;
  134. id[num].wi = wi;
  135. id[num].wo = (wi-1)/16+1;
  136. id[num].length = de*he*id[num].wo*2;
  137. id[num].data = (UWORD *)AllocMem(id[num].length,MEMF_CHIP | MEMF_CLEAR);
  138. if (id[num].data == NULL)
  139.     {
  140.     sprintf(string,"Image Allocation Error %d",num);
  141.     makerequest(string);
  142.     Cleanup();
  143.     }
  144.  
  145. x=0;
  146. for (d=0;d<de;d++)                        /* calculate length */
  147.     for (h=0; h<he; h++)
  148.         for(w=0; w<((wi-1)/16)+1; w++)
  149.             id[num].data[x++] = Data[h][d][w];
  150. }
  151.  
  152.  
  153. UnpackImage(num,pdata)
  154. LONG num;
  155. BYTE *pdata;
  156. {
  157. UBYTE rowbytes,bytecount;
  158. UBYTE info,data;
  159. BYTE *ref;
  160. LONG y,b,i;
  161. BYTE *location;
  162.  
  163. info = *pdata;
  164. ref = pdata;
  165.  
  166. rowbytes = ((bmhd->w-1)/8)+1;
  167.  
  168. for (y=0;y<bmhd->h;y++)
  169.      for (b=0;b<bmhd->BitPlanes;b++)
  170.           {
  171.            bytecount = 0;
  172.            location = (UBYTE *)&Data[y][b];  /*  DATA ARRAY STORAGE */
  173.          while (bytecount < rowbytes)
  174.                    {
  175.                 if (info < 128)
  176.                         {
  177.                     movmem(ref+1,location+bytecount,info+1);
  178.                     bytecount+=(info+1);
  179.                     ref+=(info+1);
  180.                        }
  181.  
  182.                 if (info > 128)
  183.                         {
  184.                     data = *(++ref);
  185.                     for (i=bytecount;i<(bytecount+257-info);i++)
  186.                        *(location+i) = data;
  187.                     bytecount+=(257-info);
  188.                        }
  189.  
  190.                 info = *(++ref);    
  191.                     }
  192.           }
  193. }
  194.  
  195.  
  196.  
  197. freeimages()
  198. {
  199. LONG n,x;
  200.  
  201. for (x=0;x<LOADIMAGENUM;x++)
  202.     if (id[x].data) FreeMem(id[x].data,id[x].length);
  203.  
  204. for (n=0;n<RENDIMAGENUM;n++)
  205.     for (x=0;x<v[n].rots;x++)
  206.         FreeRaster(id[x+v[n].zero].data,id[x+v[n].zero].wi,id[x+v[n].zero].he);
  207. }
  208.  
  209.  
  210.  
  211.  
  212. RendVectors()
  213. {
  214. LONG n,x,y;
  215. LONG xmin,xmax,ymin,ymax;
  216. DOUBLE theta,inc;
  217. LONG cosx,siny;
  218. LONG *dx,*dy;
  219. LONG he,wi,wo;
  220. struct RastPort trp;
  221. struct BitMap tbm;
  222.  
  223.  
  224. InitRastPort(&trp);
  225. SetAPen(&trp,3);
  226.  
  227.  
  228. dx = (LONG *)AllocMem(10000,MEMF_ANY);
  229. dy = (LONG *)AllocMem(10000,MEMF_ANY);
  230. if ((dx==NULL)||(dy==NULL))
  231.     {
  232.     makerequest("Temporary Vector Allocation Error");
  233.     Cleanup();
  234.     }
  235.  
  236.  
  237. for (n=0;n<RENDIMAGENUM;n++)
  238. {
  239. xmin = 200;
  240. xmax = 0;
  241. ymin = 200;
  242. ymax = 0;
  243.  
  244. inc = 360.0/((DOUBLE)v[n].rots);
  245.  
  246. for(x=0;x<v[n].rots;x++)
  247.     {
  248.     theta = (DOUBLE)((360-inc*(DOUBLE)x)/180.0*3.1415927);
  249.     cosx = (LONG)(cos(theta)*1000.0);
  250.     siny = (LONG)(sin(theta)*1000.0);
  251.     for (y=0;y<v[n].num;y++)
  252.         {
  253.         dx[30*x+y] = (640*v[n].x[y]*cosx/400+v[n].y[y]*siny)/1000;
  254.         dy[30*x+y] = (v[n].y[y]*cosx-640*v[n].x[y]*siny/400)/1000;
  255.         if (dx[30*x+y] < xmin) xmin = dx[30*x+y];
  256.         if (dy[30*x+y] < ymin) ymin = dy[30*x+y];
  257.         if (dx[30*x+y] > xmax) xmax = dx[30*x+y];
  258.         if (dy[30*x+y] > ymax) ymax = dy[30*x+y];
  259.         }
  260.     }
  261.  
  262. for(x=0;x<v[n].rots;x++)
  263.     {
  264.     he = id[x+v[n].zero].he = ymax-ymin+1;
  265.     wi = id[x+v[n].zero].wi = xmax-xmin+1;
  266.     wo = id[x+v[n].zero].wo = (id[x+v[n].zero].wi-1)/16+1;
  267.     id[x+v[n].zero].mask = v[n].mask;
  268.     id[x+v[n].zero].xc = xmin;
  269.     id[x+v[n].zero].yc = ymin;
  270.     id[x+v[n].zero].length = he*2*wo;
  271.  
  272.     InitBitMap(&tbm,1,wi,he);
  273.     tbm.Planes[0] = (PLANEPTR)AllocRaster(wi,he);
  274.     if (tbm.Planes[0] == NULL)
  275.         {
  276.         makerequest("Vector Image Allocation Error");
  277.         Cleanup();
  278.         }
  279.     BltClear(tbm.Planes[0],RASSIZE(wi,he),NULL);
  280.  
  281.     trp.BitMap = &tbm;
  282.  
  283.     Move(&trp,wi/2+dx[30*x],he/2+dy[30*x]);
  284.     for(y=1;y<v[n].num;y++)
  285.         Draw(&trp,wi/2+dx[30*x+y],he/2+dy[30*x+y]);
  286.     Draw(&trp,wi/2+dx[30*x],he/2+dy[30*x]);
  287.  
  288.     id[x+v[n].zero].data = (UWORD *)tbm.Planes[0];
  289.     }
  290. }
  291.  
  292. if (dx) FreeMem(dx,10000);
  293. if (dy) FreeMem(dy,10000);
  294. }
  295.  
  296. LoadAllImages()
  297. {
  298. LoadILBM("images/photon2",0);
  299. LoadILBM("images/photon",1);
  300. LoadILBM("images/exp1",2);
  301. LoadILBM("images/exp2",3);
  302. LoadILBM("images/exp3",4);
  303. LoadILBM("images/exp4",5);
  304. LoadILBM("images/exp5",6);
  305. LoadILBM("images/exp6",7);
  306. LoadILBM("images/exp7",8);
  307. LoadILBM("images/exp8",9);
  308.  
  309. LoadILBM("images/shield",10);
  310. LoadILBM("images/expander",11);
  311.  
  312. /*
  313. LoadILBM("images/asteroid2",12);
  314. LoadILBM("images/asteroid3",13);
  315. */
  316.  
  317. LoadILBM("images/sauceratt1",14);
  318. LoadILBM("images/sauceratt2",15);
  319. LoadILBM("images/sauceratt3",16);
  320. LoadILBM("images/sauceratt4",17);
  321. LoadILBM("images/sauceratt5",18);
  322.  
  323. LoadILBM("images/saucer1",19);
  324. LoadILBM("images/saucer2",20);
  325. LoadILBM("images/saucer3",21);
  326. LoadILBM("images/saucer4",22);
  327. LoadILBM("images/saucer5",23);
  328.  
  329. il.photon = 0;
  330. il.explosion = 2;
  331. il.shield = 10;
  332. il.asaucer = 14;
  333. il.saucer = 19;
  334. il.expander = 11;
  335. }
  336.  
  337.  
  338. DefineShips()
  339. {
  340.  
  341. /* player ship */
  342. v[0].x[0] =  0;
  343. v[0].y[0] = -10;
  344. v[0].x[1] = 4;
  345. v[0].y[1] = 4;
  346. v[0].x[2] = 0;
  347. v[0].y[2] = 8;
  348. v[0].x[3] = -4;
  349. v[0].y[3] = 4;
  350. v[0].num  = 4;
  351. v[0].pos  = 0;
  352. v[0].rots  = 32;
  353. v[0].mask  = 0xfd;
  354. v[0].zero  = 24;
  355.  
  356. /* enemy heavy cruiser */
  357. v[1].x[0] = 0;
  358. v[1].y[0] = -10;
  359. v[1].x[1] = 4;
  360. v[1].y[1] = 5;
  361. v[1].x[2] = 7;
  362. v[1].y[2] = 5;
  363. v[1].x[3] = 0;
  364. v[1].y[3] = 14;
  365. v[1].x[4] = -7;
  366. v[1].y[4] = 5;
  367. v[1].x[5] = -4;
  368. v[1].y[5] = 4;
  369. v[1].num  = 6;
  370. v[1].pos  = 0;
  371. v[1].rots  = 32;
  372. v[1].mask  = 0xfe;
  373. v[1].zero  = v[0].zero+v[0].rots;
  374.  
  375. /* enemy light cruiser */
  376. v[2].x[0] = 0;
  377. v[2].y[0] = -8;
  378. v[2].x[1] = 3;
  379. v[2].y[1] = 5;
  380. v[2].x[2] = 0;
  381. v[2].y[2] = 3;
  382. v[2].x[3] = -3;
  383. v[2].y[3] = 5;
  384. v[2].num  = 4;
  385. v[2].pos  = 0;
  386. v[2].rots  = 32;
  387. v[2].mask  = 0xfe;
  388. v[2].zero  = v[1].zero+v[1].rots;
  389.  
  390. /* enemy star destroyer*/
  391. v[3].x[0] = 0;
  392. v[3].y[0] = -40;
  393. v[3].x[1] = 14;
  394. v[3].y[1] = 12;
  395. v[3].x[2] = 0;
  396. v[3].y[2] = 22;
  397. v[3].x[3] = -14;
  398. v[3].y[3] = 12;
  399. v[3].num  = 4;
  400. v[3].pos  = 0;
  401. v[3].rots  = 32;
  402. v[3].mask  = 0xfe;
  403. v[3].zero  = v[2].zero+v[2].rots;
  404.  
  405. /* enemy escort cruiser */
  406. v[4].x[0] = 0;
  407. v[4].y[0] = -15;
  408. v[4].x[1] = 3;
  409. v[4].y[1] = 4;
  410. v[4].x[2] = 0;
  411. v[4].y[2] = 10;
  412. v[4].x[3] = -3;
  413. v[4].y[3] = 4;
  414. v[4].num  = 4;
  415. v[4].pos  = 0;
  416. v[4].rots  = 32;
  417. v[4].mask  = 0xfe;
  418. v[4].zero  = v[3].zero+v[3].rots;
  419.  
  420. /* triangle */
  421. v[5].x[0] = 0;
  422. v[5].y[0] = -4;
  423. v[5].x[1] = 3;
  424. v[5].y[1] = 3;
  425. v[5].x[2] = -3;
  426. v[5].y[2] = 3;
  427. v[5].num  = 3;
  428. v[5].pos  = 0;
  429. v[5].rots  = 16;
  430. v[5].mask  = 0xff;
  431. v[5].zero  = v[4].zero+v[4].rots;
  432.  
  433.  
  434. /* mine */
  435. v[6].x[0] = 0;
  436. v[6].y[0] = -4;
  437. v[6].x[1] = 0;
  438. v[6].y[1] = 0;
  439. v[6].x[2] = 2;
  440. v[6].y[2] = 0;
  441. v[6].x[3] = 0;
  442. v[6].y[3] = 0;
  443. v[6].x[4] = 0;
  444. v[6].y[4] = 4;
  445. v[6].x[5] = 0;
  446. v[6].y[5] = 0;
  447. v[6].x[6] = -2;
  448. v[6].y[6] = 0;
  449. v[6].x[7] = 0;
  450. v[6].y[7] = 0;
  451. v[6].num  = 8;
  452. v[6].pos  = 0;
  453. v[6].rots  = 16;
  454. v[6].mask  = 0xff;
  455. v[6].zero  = v[5].zero+v[5].rots;
  456.  
  457. /* box */
  458. v[7].x[0] = -2;
  459. v[7].y[0] = -3;
  460. v[7].x[1] = 2;
  461. v[7].y[1] = -3;
  462. v[7].x[2] = 2;
  463. v[7].y[2] = 3;
  464. v[7].x[3] = -2;
  465. v[7].y[3] = 3;
  466. v[7].num  = 4;
  467. v[7].pos  = 0;
  468. v[7].rots  = 16;
  469. v[7].mask  = 0xff;
  470. v[7].zero  = v[6].zero+v[6].rots;
  471.  
  472. /* diamond */
  473. v[8].x[0] = 0;
  474. v[8].y[0] = -7;
  475. v[8].x[1] = 2;
  476. v[8].y[1] = 0;
  477. v[8].x[2] = 0;
  478. v[8].y[2] = 7;
  479. v[8].x[3] = -2;
  480. v[8].y[3] = 0;
  481. v[8].num  = 4;
  482. v[8].pos  = 0;
  483. v[8].rots  = 32;
  484. v[8].mask  = 0xff;
  485. v[8].zero  = v[7].zero+v[7].rots;
  486.  
  487. /* line */
  488. v[9].x[0] = 0;
  489. v[9].y[0] = 5;
  490. v[9].x[1] = 0;
  491. v[9].y[1] = -5;
  492. v[9].num  = 2;
  493. v[9].pos  = 0;
  494. v[9].rots  = 16;
  495. v[9].mask  = 0xff;
  496. v[9].zero  = v[8].zero+v[8].rots;
  497.  
  498. /* fighter */
  499. v[10].x[0] = 0;
  500. v[10].y[0] = -4;
  501. v[10].x[1] = 2;
  502. v[10].y[1] = 0;
  503. v[10].x[2] = 0;
  504. v[10].y[2] = 2;
  505. v[10].x[3] = -2;
  506. v[10].y[3] = 0;
  507. v[10].num  = 4;
  508. v[10].pos  = 0;
  509. v[10].rots  = 16;
  510. v[10].mask  = 0xfe;
  511. v[10].zero  = v[9].zero+v[9].rots;
  512.  
  513. /* debris */
  514. v[11].x[0] = 0;
  515. v[11].y[0] = 7;
  516. v[11].x[1] = 0;
  517. v[11].y[1] = -7;
  518. v[11].num  = 2;
  519. v[11].pos  = 0;
  520. v[11].rots  = 32;
  521. v[11].mask  = 0xff;
  522. v[11].zero  = v[10].zero+v[10].rots;
  523.  
  524. /* player2 */
  525. v[12].x[0] = 0;
  526. v[12].y[0] = -10;
  527. v[12].x[1] = 5;
  528. v[12].y[1] = 4;
  529. v[12].x[2] = 2;
  530. v[12].y[2] = 8;
  531. v[12].x[3] = 0;
  532. v[12].y[3] = 6;
  533. v[12].x[4] = -2;
  534. v[12].y[4] = 8;
  535. v[12].x[5] = -5;
  536. v[12].y[5] = 4;
  537. v[12].num  = 6;
  538. v[12].pos  = 0;
  539. v[12].rots  = 32;
  540. v[12].mask  = 0xfd;
  541. v[12].zero  = v[11].zero+v[11].rots;
  542.  
  543.  
  544. /* xcruiser */
  545. v[13].x[0] = 0;
  546. v[13].y[0] = -12;
  547. v[13].x[1] = 0;
  548. v[13].y[1] = -2;
  549. v[13].x[2] = 4;
  550. v[13].y[2] = -2;
  551. v[13].x[3] = 0;
  552. v[13].y[3] = 8;
  553. v[13].x[4] = -4;
  554. v[13].y[4] = 2;
  555. v[13].num  = 5;
  556. v[13].pos  = 0;
  557. v[13].rots  = 32;
  558. v[13].mask  = 0xfe;
  559. v[13].zero  = v[12].zero+v[12].rots;
  560.  
  561. /* dreadnought */
  562. v[14].x[0] = -2;
  563. v[14].y[0] = -15;
  564. v[14].x[1] = -7;
  565. v[14].y[1] = -14;
  566. v[14].x[2] = -10;
  567. v[14].y[2] = 0;
  568. v[14].x[3] = 0;
  569. v[14].y[3] = 15;
  570. v[14].x[4] = 10;
  571. v[14].y[4] = 0;
  572. v[14].x[5] = 7;
  573. v[14].y[5] = -14;
  574. v[14].x[6] = 2;
  575. v[14].y[6] = -15;
  576. v[14].x[7] = 5;
  577. v[14].y[7] = -12;
  578. v[14].x[8] = 7;
  579. v[14].y[8] = 0;
  580. v[14].x[9] = 0;
  581. v[14].y[9] = 10;
  582. v[14].x[10] = -7;
  583. v[14].y[10] = 0;
  584. v[14].x[11] = -5;
  585. v[14].y[11] = -12;
  586. v[14].num  = 12;
  587. v[14].pos  = 0;
  588. v[14].rots  = 32;
  589. v[14].mask  = 0xfe;
  590. v[14].zero  = v[13].zero+v[13].rots;
  591.  
  592. /* m cruiser */
  593. v[15].x[0] = 0;
  594. v[15].y[0] = -12;
  595. v[15].x[1] = -3;
  596. v[15].y[1] = -8;
  597. v[15].x[2] = -2;
  598. v[15].y[2] = 0;
  599. v[15].x[3] = -5;
  600. v[15].y[3] = 8;
  601. v[15].x[4] = 0;
  602. v[15].y[4] = 12;
  603. v[15].x[5] = 5;
  604. v[15].y[5] = 8;
  605. v[15].x[6] = 2;
  606. v[15].y[6] = 0;
  607. v[15].x[7] = 3;
  608. v[15].y[7] = -8;
  609. v[15].num  = 8;
  610. v[15].pos  = 0;
  611. v[15].rots  = 32;
  612. v[15].mask  = 0xfe;
  613. v[15].zero  = v[14].zero+v[14].rots;
  614.  
  615. /* large asteroid */
  616. v[16].x[0] = 0;
  617. v[16].y[0] = -12;
  618. v[16].x[1] = -8;
  619. v[16].y[1] = -17;
  620. v[16].x[2] = -11;
  621. v[16].y[2] = -11;
  622. v[16].x[3] = -9;
  623. v[16].y[3] = -4;
  624. v[16].x[4] = -12;
  625. v[16].y[4] = 6;
  626. v[16].x[5] = -7;
  627. v[16].y[5] = 15;
  628. v[16].x[6] = 5;
  629. v[16].y[6] = 12;
  630. v[16].x[7] = 10;
  631. v[16].y[7] = 0;
  632. v[16].x[8] = 7;
  633. v[16].y[8] = -17;
  634. v[16].num  = 9;
  635. v[16].pos  = 0;
  636. v[16].rots  = 64;
  637. v[16].mask  = 0xfd;
  638. v[16].zero  = v[15].zero+v[15].rots;
  639.  
  640. /* medium asteroid */
  641. v[17].x[0] = -2;
  642. v[17].y[0] = -6;
  643. v[17].x[1] = -5;
  644. v[17].y[1] = -11;
  645. v[17].x[2] = -8;
  646. v[17].y[2] = -7;
  647. v[17].x[3] = -6;
  648. v[17].y[3] = 2;
  649. v[17].x[4] = -8;
  650. v[17].y[4] = 7;
  651. v[17].x[5] = -2;
  652. v[17].y[5] = 12;
  653. v[17].x[6] = 5;
  654. v[17].y[6] = 7;
  655. v[17].x[7] = 8;
  656. v[17].y[7] = -4;
  657. v[17].x[8] = 3;
  658. v[17].y[8] = -10;
  659. v[17].num  = 9;
  660. v[17].pos  = 0;
  661. v[17].rots  = 32;
  662. v[17].mask  = 0xfd;
  663. v[17].zero  = v[16].zero+v[16].rots;
  664.  
  665. /* small asteroid */
  666. v[18].x[0] = -1;
  667. v[18].y[0] = -7;
  668. v[18].x[1] = -5;
  669. v[18].y[1] = -1;
  670. v[18].x[2] = -2;
  671. v[18].y[2] = 7;
  672. v[18].x[3] = 3;
  673. v[18].y[3] = 5;
  674. v[18].x[4] = 5;
  675. v[18].y[4] = -2;
  676. v[18].x[5] = 3;
  677. v[18].y[5] = -5;
  678. v[18].x[6] = 2;
  679. v[18].y[6] = -4;
  680. v[18].num  = 7;
  681. v[18].pos  = 0;
  682. v[18].rots  = 16;
  683. v[18].mask  = 0xfd;
  684. v[18].zero  = v[17].zero+v[17].rots;
  685.  
  686.  
  687. /* displacer */
  688. v[19].x[0] = 0;
  689. v[19].y[0] = -6;
  690. v[19].x[1] = -4;
  691. v[19].y[1] = 0;
  692. v[19].x[2] = 4;
  693. v[19].y[2] = 0;
  694. v[19].x[3] = 0;
  695. v[19].y[3] = 6;
  696. v[19].num  = 4;
  697. v[19].pos  = 0;
  698. v[19].rots  = 16;
  699. v[19].mask  = 0xfd;
  700. v[19].zero  = v[18].zero+v[18].rots;
  701.  
  702. /* saucer photon */
  703. v[20].x[0] = 0;
  704. v[20].y[0] = -3;
  705. v[20].x[1] = 2;
  706. v[20].y[1] = -3;
  707. v[20].x[2] = 2;
  708. v[20].y[2] = 0;
  709. v[20].x[3] = -2;
  710. v[20].y[3] = 0;
  711. v[20].x[4] = -2;
  712. v[20].y[4] = 3;
  713. v[20].x[5] = 0;
  714. v[20].y[5] = 3;
  715. v[20].num  = 6;
  716. v[20].pos  = 0;
  717. v[20].rots  = 16;
  718. v[20].mask  = 0xfd;
  719. v[20].zero  = v[19].zero+v[19].rots;
  720.  
  721. /* dreadshield */
  722. v[21].x[0] = -6;
  723. v[21].y[0] = -16;
  724. v[21].x[1] = -11;
  725. v[21].y[1] = -8;
  726. v[21].x[2] = -11;
  727. v[21].y[2] = 8;
  728. v[21].x[3] = -6;
  729. v[21].y[3] = 16;
  730. v[21].x[4] = 6;
  731. v[21].y[4] = 16;
  732. v[21].x[5] = 11;
  733. v[21].y[5] = 8;
  734. v[21].x[6] = 11;
  735. v[21].y[6] = -8;
  736. v[21].x[7] = 6;
  737. v[21].y[7] = -16;
  738. v[21].num  = 8;
  739. v[21].pos  = 0;
  740. v[21].rots  = 1;
  741. v[21].mask  = 0xff;
  742. v[21].zero  = v[20].zero+v[20].rots;
  743.  
  744. /* rectangle */
  745. v[22].x[0] = -1;
  746. v[22].y[0] = -6;
  747. v[22].x[1] = 1;
  748. v[22].y[1] = -6;
  749. v[22].x[2] = 1;
  750. v[22].y[2] = 6;
  751. v[22].x[3] = -1;
  752. v[22].y[3] = 6;
  753. v[22].num  = 4;
  754. v[22].pos  = 0;
  755. v[22].rots  = 16;
  756. v[22].mask  = 0xff;
  757. v[22].zero  = v[21].zero+v[21].rots;
  758.  
  759. /* carrier */
  760. v[23].x[0] = -1;
  761. v[23].y[0] = -15;
  762. v[23].x[1] = -3;
  763. v[23].y[1] = -8;
  764. v[23].x[2] = -1;
  765. v[23].y[2] = -2;
  766. v[23].x[3] = -10;
  767. v[23].y[3] = 5;
  768. v[23].x[4] = -10;
  769. v[23].y[4] = 9;
  770. v[23].x[5] = 0;
  771. v[23].y[5] = 15;
  772. v[23].x[6] = 10;
  773. v[23].y[6] = 9;
  774. v[23].x[7] = 10;
  775. v[23].y[7] = 5;
  776. v[23].x[8] = 2;
  777. v[23].y[8] = -1;
  778. v[23].x[9] = 3;
  779. v[23].y[9] = -8;
  780. v[23].x[10] = 1;
  781. v[23].y[10] = -15;
  782. v[23].num  = 11;
  783. v[23].pos  = 0;
  784. v[23].rots  = 32;
  785. v[23].mask  = 0xfe;
  786. v[23].zero  = v[22].zero+v[22].rots;
  787.  
  788. il.player = v[0].zero;
  789. il.eheavy = v[1].zero;
  790. il.elight = v[2].zero;
  791. il.battleship = v[3].zero;
  792. il.xcruiser = v[4].zero;
  793. il.triangle = v[5].zero;
  794. il.mine = v[6].zero;
  795. il.box = v[7].zero;
  796. il.diamond = v[8].zero;
  797. il.line = v[9].zero;
  798. il.fighter = v[10].zero;
  799. il.debris = v[11].zero;
  800. il.player2 = v[12].zero;
  801. il.minelayer = v[13].zero;
  802. il.dreadnought = v[14].zero;
  803. il.magnetic = v[15].zero;
  804. il.asteroid[0] = v[16].zero;
  805. il.asteroid[1] = v[17].zero;
  806. il.asteroid[2] = v[18].zero;
  807. il.displacer = v[19].zero;
  808. il.sauphot = v[20].zero;
  809. il.dreadshield = v[21].zero;
  810. il.rectangle = v[22].zero;
  811. il.carrier = v[23].zero;
  812. }
  813.