home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / boodfly.zip / BOODMISC.CPP < prev    next >
C/C++ Source or Header  |  1992-10-28  |  20KB  |  534 lines

  1. #include "boodmisc.h"
  2.  
  3. #include <alloc.h>
  4. #include <conio.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include "xlib.h"
  8. #include "xrect.h"
  9. #include "xtext.h"
  10. #include "xpoint.h"
  11.  
  12. extern int turns;
  13. extern int score;
  14. extern icon logo;
  15. extern int numboodles, numgrumjugs;
  16. extern boodlepiece ** boodles;
  17. extern boodlepiece ** grumjugs;
  18.  
  19. void display(boodlepiece * my_actor, animap * mymap)
  20. {
  21.   char * boodletype;
  22.   mymap->show(my_actor->mapx,my_actor->mapy, 225 - my_actor->squarex,150 - my_actor->squarey, 7,4, HiddenPageOffs);
  23.   x_rect_fill(370,20,380,220,HiddenPageOffs,0);
  24.   x_rect_fill(30,198,360,220, HiddenPageOffs, 0);
  25.   switch (my_actor->my_identity)
  26.   {
  27.     case BOODLE : boodletype = "Boodle"; break;
  28.     case BOODLINO : boodletype = "Boodlino"; break;
  29.     case BOODLEWIZ : boodletype = "BoodleWiz"; break;
  30.     case BOODLEBLASTER : boodletype = "BoodleBlaster"; break;
  31.     case BOODLETTAH : boodletype = "Boodlettah"; break;
  32.     case GRUMJUG : boodletype = "Grumjug"; break;
  33.     case DEAD : boodletype = "Grave"; break;
  34.     case CARRIEDGRUMJUG : boodletype = "Passenger"; break;
  35.     case GRUMBUGGY : boodletype = "GrumBuggy"; break;
  36.     case BROKEBUGGY : boodletype = "BrokeBuggy"; break;
  37.     case CURSOR : boodletype = "BlastCursor"; break;
  38.     case SAFEBOODLE : boodletype = "Safe Boodle!"; break;
  39.   }
  40.   my_actor->draw(30, 200, HiddenPageOffs);
  41.   x_printf(65,210, HiddenPageOffs, 10, "%s", boodletype);
  42.   x_printf(170,210,HiddenPageOffs, 10, "Move: %d", my_actor->movesleft);
  43.   x_printf(250, 210, HiddenPageOffs, 10, "Cargo:");
  44.   if (my_actor->cargo != NULL)
  45.     my_actor->cargo->draw(300,200, HiddenPageOffs);
  46.   if (my_actor->cargo2 != NULL)
  47.     my_actor->cargo2->draw(340,200, HiddenPageOffs);
  48.   x_page_flip(20,20);
  49. }
  50.  
  51. void blast(boodlepiece * tobeblasted, boodlepiece * toblast)
  52. {
  53.   boodle cursor(CURSOR);  //could be just an animactor, but I'm tired.
  54.   cursor.mymap = tobeblasted->mymap;
  55.   cursor.mapx = tobeblasted->mapx;
  56.   cursor.mapy = tobeblasted->mapy;
  57.   cursor.squarex = cursor.squarey = 20;
  58.   cursor.put(tobeblasted->mapx, tobeblasted->mapy);
  59.   char exit = 0;
  60.   while ((exit != ' ') && (exit != 13))
  61.   {
  62.     if (!kbhit())
  63.       if (cursor.this_line == NULL)
  64.     cursor.addcommand(DO_NOTHING, 0,0,0,0); //so the "on" char. animates
  65.     if (kbhit())
  66.     {
  67.       exit = getch();
  68.       flushall();
  69.       cursor.remove();
  70.       if (exit == 0)
  71.       {
  72.     exit = getch();
  73.     switch(exit)
  74.     {
  75.       case 72 : cursor.mapy--; break;
  76.       case 80 : cursor.mapy++; break;
  77.       case 75 : cursor.mapx--; break;
  78.       case 77 : cursor.mapx++; break;
  79.       case 71 : cursor.mapy--; cursor.mapx--; break;
  80.       case 73 : cursor.mapy--; cursor.mapx++; break;
  81.       case 79 : cursor.mapy++; cursor.mapx--; break;
  82.       case 81 : cursor.mapy++; cursor.mapx++; break;
  83.     } //switch
  84.       }
  85.       if (((int)cursor.mapx - (int)tobeblasted->mapx) > 3) cursor.mapx--;
  86.       if (-((int)cursor.mapx - (int)tobeblasted->mapx) > 3) cursor.mapx++;
  87.       if (((int)cursor.mapy - (int)tobeblasted->mapy) > 3) cursor.mapy--;
  88.       if (-((int)cursor.mapy - (int)tobeblasted->mapy) > 3) cursor.mapy++;
  89.       if ((int)cursor.mapx < 0) cursor.mapx = 0;
  90.       if ((int)cursor.mapy < 0) cursor.mapy = 0;
  91.       cursor.put(cursor.mapx, cursor.mapy);
  92.     }
  93.     display(&cursor, cursor.mymap);
  94.   }
  95.   cursor.remove();
  96.   int deltax = ((cursor.mapx - tobeblasted->mapx) * cursor.mymap->squarewidth);
  97.   int deltay = ((cursor.mapy - tobeblasted->mapy) * cursor.mymap->squarewidth);
  98.   tobeblasted->addcommand(FINESLIDE, 6, 0, deltax, deltay);
  99.   tobeblasted->movesleft = 0;
  100.   toblast->spawn(new boodblast);
  101.   for (int counter = 0; counter < 8; ++counter)
  102.     display(toblast, toblast->mymap);
  103. }
  104.  
  105.  
  106. void spell(boodlepiece * caster)
  107. {
  108.   event spellzap;
  109.   spellzap.mymap = caster->mymap;
  110.   spellzap.squarex = 23;
  111.   spellzap.squarey = 23;
  112.   spellzap.assign_event(1);
  113.   int height_counter, width_counter, x, y;
  114.   boodlepiece * target;
  115.   if (random(6) < 4)
  116.   {
  117.     for (height_counter = -3; height_counter <= 3; ++height_counter)
  118.     {
  119.       for (width_counter = -3; width_counter <= 3; ++width_counter)
  120.       {
  121.     x = (caster->mapx + width_counter) % (int)(caster->mymap->width);
  122.     y = (caster->mapy + height_counter) % (int)(caster->mymap->height);
  123.     x += (x < 0) ? caster->mymap->width : 0;
  124.     y += (y < 0) ? caster->mymap->height : 0;
  125.     caster->mymap->mapdata[x][y].my_terrain_type |= 16;
  126.     if (target = (boodlepiece *)caster->mymap->isinsquare(x,y,GRUMBUGGY))
  127.     {
  128.     target->assign_icon(BROKEBUGGY, ONEFACE);
  129.     spellzap.addat(x, y, 23, 23);
  130.     }
  131.       }
  132.     }
  133.   }
  134.   caster->movesleft = 0;
  135. }
  136.  
  137.  
  138. char commandloop(boodlepiece * myactor, animap * mymap)
  139. {
  140.   boodlepiece * target;
  141.   boodlepiece * bombtoset = NULL;
  142.   char exit = 'd', stayhere = 1;
  143.   if (myactor->my_identity == GRUMBOMB)
  144.     myactor->move(CENTER);
  145.   if (myactor->my_identity == CARRIEDGRUMJUG)
  146.     stayhere = 0;
  147.   while (stayhere)
  148.   {
  149.     if (!kbhit())
  150.       if (myactor->this_line == NULL)
  151.     myactor->addcommand(DO_NOTHING, 0,0,0,0); //so the "on" char. animates
  152.     if (kbhit())
  153.     {
  154.       exit = getch();
  155.       flushall();
  156.       if (myactor->this_line == NULL)
  157.       {
  158.       if (exit == 0)
  159.       {
  160.     exit = getch();
  161.     switch(exit)
  162.     {
  163.       case 72 : myactor->move(NORTH); break;
  164.       case 80 : myactor->move(SOUTH); break;
  165.       case 75 : myactor->move(WEST); break;
  166.       case 77 : myactor->move(EAST); break;
  167.       case 71 : myactor->move(NORTHWEST); break;
  168.       case 73 : myactor->move(NORTHEAST); break;
  169.       case 79 : myactor->move(SOUTHWEST); break;
  170.       case 81 : myactor->move(SOUTHEAST); break;
  171.     } //switch
  172.       }
  173.       else
  174.       {
  175.     switch(exit)
  176.     {
  177.       case '+' :
  178.       case 'p' : myactor->pick_up(); break;
  179.       case '-' :
  180.       case 'D' :
  181.       case 'd' : myactor->drop(); break;
  182.       case 'B' :
  183.       case 'b' : if ((target = (boodlepiece *)myactor->isinsquare(BOODLEBLASTER)) &&
  184.                ((myactor->my_identity == BOODLE) ||
  185.             (myactor->my_identity == BOODLINO) ||
  186.             (myactor->my_identity == BOODLEWIZ) ||
  187.             (myactor->my_identity == BOODLETTAH)))
  188.              blast(myactor, target);
  189.              stayhere = 0;
  190.              break;
  191.       case 'S' :
  192.       case 's' : if (myactor->cargo->my_identity == UNSETBOODLEBLASTER)
  193.              myactor->cargo->assign_icon(BOODLEBLASTER, ONEFACE);
  194.            if (myactor->cargo->my_identity == UNSETGRUMBOMB)
  195.            {
  196.              bombtoset = myactor->cargo;
  197.            }
  198.            if (myactor->cargo2->my_identity == UNSETGRUMBOMB)
  199.            {
  200.              bombtoset = myactor->cargo2;
  201.            }
  202.            myactor->drop(); break;
  203.       case 'R' :
  204.       case 'r' : if ((myactor->my_identity == GRUMJUG) &&
  205.               (target = (boodlepiece *)myactor->isinsquare(GRUMBUGGY)))
  206.            {
  207.              target->pick_up();
  208.              myactor->movesleft = 0;
  209.            }
  210.            break;
  211.       case 'C' :
  212.       case 'c' : if (myactor->my_identity == BOODLEWIZ)
  213.              spell(myactor); break;
  214.       case 'T' :
  215.       case 't' : tactical_map(mymap, myactor); break;
  216.       case '?' : help_screen(); break;
  217.       case 'Q' :
  218.       case 13  :
  219.       case ' ' : myactor->movesleft = 0; stayhere = 0; break;
  220.       case 'W' :
  221.       case 'w' : stayhere = 0; break;
  222.     } //switch
  223.       }
  224.       }
  225.     }
  226.     display(myactor, mymap);
  227.     if ((exit != 'Q') && (exit != ' ') && (exit != 13))
  228.     {
  229.       if (myactor->movesleft == 0)
  230.       {
  231.     stayhere = 0;
  232.     for(int counter = 0; counter < 10; ++counter)
  233.       display(myactor, mymap);
  234.     myactor->movesleft = -1;
  235.       }
  236.       if ((myactor->movesleft <= 0) && (exit != ' ') && (exit != 'b'))
  237.       {
  238.     if (((myactor->isinsquare(UNSETBOODLEBLASTER))
  239.         ||(myactor->isinsquare(UNSETGRUMBOMB))
  240.         ||(myactor->isinsquare(GRUMBUGGY))
  241.         ||(myactor->isinsquare(BOODLEBLASTER))
  242.         ||(myactor->cargo->my_identity == CARRIEDGRUMJUG)
  243.         ||(myactor->cargo->my_identity == UNSETBOODLEBLASTER))
  244.         &&(myactor->my_identity != CARRIEDGRUMJUG))
  245.       stayhere = 1;
  246.     else (stayhere = 0);
  247.       }
  248.       if (myactor->my_identity == DEAD)
  249.     stayhere = 0;
  250.     }
  251.   }
  252.   if (bombtoset != NULL)
  253.     bombtoset->assign_icon(GRUMBOMB, ONEFACE);
  254.   return(exit);
  255. }
  256.  
  257. int boodleturn(animap * mymap)
  258. {
  259.   char exit;
  260.   int counter, totalmoves = 0, liveboodles = 0;
  261.   boodlepiece * myactor;
  262.   for (counter = 0; counter < numboodles; ++counter)
  263.   {
  264.     boodles[counter]->setmovement();
  265.     totalmoves += boodles[counter]->movesleft;
  266.     if ((boodles[counter]->my_identity == BOODLE) ||
  267.     (boodles[counter]->my_identity == BOODLINO) ||
  268.     (boodles[counter]->my_identity == BOODLEWIZ) ||
  269.     (boodles[counter]->my_identity == BOODLETTAH))
  270.       liveboodles++;
  271.   }
  272.   while (totalmoves > 0)
  273.   {
  274.     totalmoves = 0;
  275.     for (counter = 0; counter < numboodles; ++counter)
  276.       totalmoves += boodles[counter]->movesleft;
  277.  
  278.     for (counter = 0; counter < numboodles; ++counter)
  279.     {
  280.       myactor = boodles[counter];
  281.       if ((myactor->movesleft > 0) && (myactor->my_identity != DEAD))
  282.     exit = commandloop(myactor, mymap);
  283.       if (exit == 'Q') return(0);
  284.     }
  285.   }
  286.   return(liveboodles);
  287. }
  288.  
  289.  
  290. void makenewgrumpiece(animap * mymap)
  291. {
  292.   int counter;
  293.   boodlepiece * target;  //not sure why, but wouldn't let me use pointer.
  294.   if (numgrumjugs < 100)
  295.     {
  296.     if (target = (boodlepiece *)mymap->isinsquare(16, 1, GRUMBUGGY))
  297.       grumjugs[numgrumjugs] = new grumjug;
  298.     else if (target = (boodlepiece *)mymap->isinsquare(16, 1, UNSETGRUMBOMB))
  299.       grumjugs[numgrumjugs] = new grumbuggy;
  300.     else grumjugs[numgrumjugs] = new grumbomb;
  301.     grumjugs[numgrumjugs]->squarex = random(10) + 10;
  302.     grumjugs[numgrumjugs]->squarey = random(10) + 10;
  303.     grumjugs[numgrumjugs]->mymap = mymap;
  304.     grumjugs[numgrumjugs]->put(16,1);
  305.     numgrumjugs += 1;
  306.   }
  307. }
  308.  
  309.  
  310. char grumturn(animap * mymap)
  311. {
  312.   char exit;
  313.   int counter, totalmoves = 0;
  314.   boodlepiece * myactor;
  315.   for (counter = 0; counter < numgrumjugs; ++counter)
  316.   {
  317.     grumjugs[counter]->setmovement();
  318.     totalmoves += grumjugs[counter]->movesleft;
  319.   }
  320.   while (totalmoves > 0)
  321.   {
  322.     totalmoves = 0;
  323.     for (counter = 0; counter < numgrumjugs; ++counter)
  324.       if (grumjugs[counter]->my_identity != CARRIEDGRUMJUG)
  325.     totalmoves += grumjugs[counter]->movesleft;
  326.     for (counter = 0; counter < numgrumjugs; ++counter)
  327.     {
  328.       myactor = grumjugs[counter];
  329.       if ((myactor->movesleft > 0) && (myactor->my_identity != DEAD))
  330.     exit = commandloop(myactor, mymap);
  331.       if (exit == 'Q') return('Q');
  332.     }
  333.   }
  334.   for (counter = 0; counter < numgrumjugs; ++counter)
  335.     if (grumjugs[counter]->my_identity == BROKEBUGGY)
  336.       grumjugs[counter]->assign_icon(GRUMBUGGY, TWOFACE);
  337.   if (turns % 3 == 0)
  338.     makenewgrumpiece(mymap);
  339.   return(exit);
  340. }
  341.  
  342.  
  343. void tactical_map(animap * mymap, boodlepiece * myactor)
  344. {
  345.   int ledge = 40, top = 40, color = 0;
  346.   x_rect_fill(ledge - 1,top - 1,ledge + 1 + (mymap->width * 2), top + 1 + (mymap->height * 2), VisiblePageOffs, 0);
  347.   for (int width_counter = 0; width_counter < mymap->width; ++width_counter)
  348.   {
  349.     for (int height_counter = 0; height_counter < mymap->height; ++height_counter)
  350.     {
  351.       switch (mymap->mapdata[width_counter][height_counter].my_terrain_type & 239)
  352.       {
  353.     case GRASS: color = 43; break;
  354.     case MOUNTAINS: color = 8; break;
  355.     case WATER: color = 63; break;
  356.     case VALLEY: color =111; break;
  357.       }
  358.       x_rect_fill(ledge + (width_counter*2), top + (height_counter *2), ledge + (2*width_counter) + 2, top + (2*height_counter) + 2, VisiblePageOffs, color);
  359.     }
  360.   }
  361.   for (int counter = 0; counter < numboodles; ++counter)
  362.     x_rect_fill(ledge + (boodles[counter]->mapx *2), top + (boodles[counter]->mapy*2), ledge + (2*boodles[counter]->mapx) + 1, top + (2*boodles[counter]->mapy) + 1, VisiblePageOffs, 58);
  363.   for (counter = 0; counter < numgrumjugs; ++counter)
  364.     x_rect_fill(ledge + (grumjugs[counter]->mapx *2), top + (grumjugs[counter]->mapy*2), ledge + (2*grumjugs[counter]->mapx) + 1, top + (2*grumjugs[counter]->mapy) + 1, VisiblePageOffs, 28);
  365.   x_rect_fill(ledge + (myactor->mapx *2), top + (myactor->mapy*2), ledge + (2*myactor->mapx) + 1, top + (2*myactor->mapy) + 1, VisiblePageOffs, 15);
  366.   while (!kbhit());
  367.   getch();
  368. }
  369.  
  370. void allocate_forces(animap * mymap, int boodlepoints, int grumpoints)
  371. {
  372.   int numboodlettahs = 1, numplainboodles = 0, numboodlinos = 0, numboodlewizzes = 0, numboodleblasters = 0;
  373.   int numgrumkings = 1, numplaingrumjugs = 0, numgrumbuggies = 0, numgrumbombs = 0;
  374.   numboodles = numgrumjugs = 0;
  375.   int randomx=0, randomy=0; //for grumjug placement
  376.   int randomnum, counter, stepcounter, boodleside = random(2);
  377.   for (int height_counter = 1; height_counter < 20; ++height_counter)
  378.   {
  379.     mymap->setsquare(((boodleside == 1) ? 1 : 28), height_counter, VALLEY);
  380.     mymap->setsquare(((boodleside == 1) ? 2 : 29), height_counter, VALLEY);
  381.   }
  382.   char commandchar = 0;
  383.   x_rect_fill(0,0,340,220, VisiblePageOffs, 0);
  384.   factor::ficon_table[BOODLETTAH][CENTER].draw(40,40,VisiblePageOffs);
  385.   factor::ficon_table[BOODLE][CENTER].draw(40, 72, VisiblePageOffs);
  386.   factor::ficon_table[BOODLINO][CENTER].draw(40,104, VisiblePageOffs);
  387.   factor::ficon_table[BOODLEWIZ][CENTER].draw(40,136, VisiblePageOffs);
  388.   factor::ficon_table[BOODLEBLASTER][CENTER].draw(40, 168, VisiblePageOffs);
  389.   x_set_font(0);
  390.   x_printf(50,20, VisiblePageOffs, 31, "Players: Allocate your forces!");
  391.   x_set_font(2);
  392.   x_printf(60,46, VisiblePageOffs, 10, "   Boodlettah");
  393.   x_printf(60,78, VisiblePageOffs, 10, "A: Boodle(1)");
  394.   x_printf(60,110, VisiblePageOffs, 10, "B: Boodlino(4)");
  395.   x_printf(60,142, VisiblePageOffs, 10, "C: BoodleWiz(6)");
  396.   x_printf(60,174, VisiblePageOffs, 10, "D: BoodleBlaster(4)");
  397.   factor::ficon_table[GRUMKING][CENTER].draw(290, 40, VisiblePageOffs);
  398.   factor::ficon_table[GRUMJUG][CENTER].draw(290, 72, VisiblePageOffs);
  399.   factor::ficon_table[GRUMBUGGY][CENTER].draw(290,104, VisiblePageOffs);
  400.   factor::ficon_table[GRUMBOMB][CENTER].draw(290,136, VisiblePageOffs);
  401.   x_printf(180,46,  VisiblePageOffs, 10, "GrumKing");
  402.   x_printf(180,78,  VisiblePageOffs, 10, "GrumJug(3)  :1");
  403.   x_printf(180,110, VisiblePageOffs, 10, "GrumBuggy(3):2");
  404.   x_printf(180,142, VisiblePageOffs, 10, "GrumBomb(3) :3");
  405.   while (((boodlepoints > 0) || (grumpoints > 0)) && (commandchar != 'Q'))
  406.   {
  407.     x_bgprintf(30, 46, VisiblePageOffs, 10, 0, "%d", numboodlettahs);
  408.     x_bgprintf(30, 78, VisiblePageOffs, 10, 0, "%d", numplainboodles);
  409.     x_bgprintf(30,110, VisiblePageOffs, 10, 0, "%d", numboodlinos);
  410.     x_bgprintf(30,142, VisiblePageOffs, 10, 0, "%d", numboodlewizzes);
  411.     x_bgprintf(30,174, VisiblePageOffs, 10, 0, "%d", numboodleblasters);
  412.     x_bgprintf(310, 46, VisiblePageOffs, 10, 0, "%d", numgrumkings);
  413.     x_bgprintf(310, 78, VisiblePageOffs, 10, 0, "%d", numplaingrumjugs);
  414.     x_bgprintf(310,110, VisiblePageOffs, 10, 0, "%d", numgrumbuggies);
  415.     x_bgprintf(310,142, VisiblePageOffs, 10, 0, "%d", numgrumbombs);
  416.     x_bgprintf(55,35, VisiblePageOffs, 10,0,"Points: %d  ", boodlepoints);
  417.     x_bgprintf(210, 35, VisiblePageOffs, 10,0,"Points: %d  ", grumpoints);
  418.     commandchar = getch();
  419.     switch(commandchar)
  420.     {
  421.       case 'a' :
  422.       case 'A' : if (boodlepoints > 0){++numplainboodles; boodlepoints -= 1;} break;
  423.       case 'b' :
  424.       case 'B' : if (boodlepoints > 0){++numboodlinos; boodlepoints -= 4;} break;
  425.       case 'c' :
  426.       case 'C' : if (boodlepoints > 0){++numboodlewizzes; boodlepoints -= 6;} break;
  427.       case 'd' :
  428.       case 'D' : if (boodlepoints > 0){++numboodleblasters; boodlepoints -= 4;} break;
  429.       case '1' : if (grumpoints > 0){++numplaingrumjugs; grumpoints -= 3;} break;
  430.       case '2' : if (grumpoints > 0){++numgrumbuggies; grumpoints -= 3;} break;
  431.       case '3' : if (grumpoints > 0){++numgrumbombs; grumpoints -= 3;} break;
  432.     }
  433.   }
  434.   numboodles = numboodlettahs + numplainboodles + numboodlinos + numboodlewizzes + numboodleblasters;
  435.   numgrumjugs = numgrumkings + numplaingrumjugs + numgrumbuggies + numgrumbombs;
  436.   boodles = new boodlepiece *[numboodles];//[numboodles];
  437.   grumjugs = new boodlepiece *[(numgrumjugs < 100) ? 100 : numgrumjugs];
  438.   for (counter = 0; counter < numboodlettahs; ++counter)
  439.     boodles[counter] = new boodlettah;
  440.   for (stepcounter = counter;counter < stepcounter + numplainboodles; ++counter)
  441.     boodles[counter] = new boodle;
  442.   for (stepcounter = counter;counter < stepcounter + numboodlinos; ++counter)
  443.     boodles[counter] = new boodlino;
  444.   for (stepcounter = counter;counter < stepcounter + numboodlewizzes; ++counter)
  445.     boodles[counter] = new boodlewiz;
  446.   for (stepcounter = counter;counter < stepcounter + numboodleblasters; ++counter)
  447.     boodles[counter] = new boodleblaster;
  448.   for (counter = 0; counter < numgrumkings; ++counter)
  449.     grumjugs[counter] = new grumking;
  450.   for (stepcounter = counter;counter < stepcounter + numgrumbuggies; ++counter)
  451.     grumjugs[counter] = new grumbuggy;
  452.   for (stepcounter = counter;counter < stepcounter + numplaingrumjugs; ++counter)
  453.     grumjugs[counter] = new grumjug;
  454.   for (stepcounter = counter;counter < stepcounter + numgrumbombs; ++counter)
  455.     grumjugs[counter] = new grumbomb;
  456.   for (counter = 0; counter < numboodles; ++counter)
  457.   {
  458.     boodles[counter]->squarex = random(10) + 10;
  459.     boodles[counter]->squarey = random(10) + 10;
  460.     boodles[counter]->mymap = mymap;
  461.     boodles[counter]->put(((boodleside == 0) ? 1 : 28) + random(2), random(19)+1);
  462.   }
  463.   grumjugs[0]->squarex = 20;
  464.   grumjugs[0]->squarey = 20;
  465.   grumjugs[0]->mymap = mymap;
  466.   grumjugs[0]->put(15,1);
  467.   for (counter = 1; counter < numgrumjugs; ++counter)
  468.   {
  469.     grumjugs[counter]->squarex = random(10) + 10;
  470.     if (grumjugs[counter]->my_identity == GRUMBUGGY)
  471.       grumjugs[counter]->squarex = 23;
  472.     grumjugs[counter]->squarey = random(10) + 10;
  473.     grumjugs[counter]->mymap = mymap;
  474.     randomx = random(26) + 2;
  475.     randomy = random(19) + 1;
  476.     while (mymap->mapdata[randomx][randomy].my_terrain_type != GRASS)
  477.     {
  478.       randomx = random(26) + 2;
  479.       randomy = random(19) + 1;
  480.     }
  481.     grumjugs[counter]->put(randomx, randomy);
  482.   }
  483. }
  484.  
  485. void showlogo(animap * mymap)
  486. {
  487.   mymap->show(15,5,185,140, 6,4, VisiblePageOffs);
  488.   logo.showmasked(75,50,VisiblePageOffs);
  489.   x_bgprintf(95,120, VisiblePageOffs, 15,1, "Press a key to begin play.");
  490.   getch();
  491. }
  492.  
  493. void endgame(void)
  494. {
  495.   x_rect_fill(70,50, 330, 190, VisiblePageOffs, 0);
  496.   logo.showmasked(95,55,VisiblePageOffs);
  497.   if (score > 3)
  498.   {
  499.     factor::ficon_table[BOODLETTAH][CENTER].draw(90,90,VisiblePageOffs);
  500.     x_printf(95,120,VisiblePageOffs, 15, "And so, their new homesteads est-");
  501.     x_printf(95,130,VisiblePageOffs, 15, "ablished, the Boodles settled down");
  502.     x_printf(95,140,VisiblePageOffs, 15, "to a long, peaceful, happy life; ");
  503.     x_printf(95,150,VisiblePageOffs, 15, "and only poems and stories now tell");
  504.     x_printf(95,160,VisiblePageOffs, 15, "of the epic Flight of the Boodles.");
  505.   }
  506.   else
  507.   {
  508.     factor::ficon_table[GRUMKING][CENTER].draw(90,90,VisiblePageOffs);
  509.     x_printf(95,120,VisiblePageOffs, 15, "What the Rotsnort plague had failed");
  510.     x_printf(95,130,VisiblePageOffs, 15, "to do, the happy Grumjugs had");
  511.     x_printf(95,140,VisiblePageOffs, 15, "done, and they rejoiced, hopping");
  512.     x_printf(95,150,VisiblePageOffs, 15, "in mad dances as they celebrated");
  513.     x_printf(95,160,VisiblePageOffs, 15, "their victory over the invasive and");
  514.     x_printf(95,170,VisiblePageOffs, 15, "terrifying Flight of the Boodles.");
  515.   }
  516.   getch();
  517. }
  518.  
  519. void help_screen(void)
  520. {
  521.   x_rect_fill(70,30, 330, 200, VisiblePageOffs, 0);
  522.   logo.showmasked(95,35,VisiblePageOffs);
  523.   x_printf(95,100,VisiblePageOffs, 15, "Arrow keys:  Movement/attack  ");
  524.   x_printf(95,110,VisiblePageOffs, 15, "space, cr:  end turn (this piece)");
  525.   x_printf(95,120,VisiblePageOffs, 15, "W:  wait to finish move");
  526.   x_printf(95,130,VisiblePageOffs, 15, "T:  tactical map display");
  527.   x_printf(95,140,VisiblePageOffs, 15, "P,+:  pick up (blaster, bomb, jug)");
  528.   x_printf(95,150,VisiblePageOffs, 15, "D,-:  drop cargo carried (doesn't set)");
  529.   x_printf(95,160,VisiblePageOffs, 15, "S:  set (grumbomb, boodleblaster)");
  530.   x_printf(95,170,VisiblePageOffs, 15, "R:  ride (grumjug in grumbuggy)");
  531.   x_printf(95,180,VisiblePageOffs, 15, "B:  blast with boodleblaster)  ");
  532.   x_printf(95,190,VisiblePageOffs, 15, "C:  cast spell (boodlewizzes)");
  533.   getch();
  534. }