home *** CD-ROM | disk | FTP | other *** search
/ MORE WinGames / WINGAMES.iso / winpool / mainset.c < prev    next >
C/C++ Source or Header  |  1992-12-22  |  3KB  |  123 lines

  1.  
  2.  
  3. #include <string.h>
  4. #include <dos.h>
  5.  
  6. #include "definiti.h"
  7.  
  8.  
  9. /* at the beginning */
  10. extern int      WhiteBallOut;
  11. extern int      BlackBallOut;
  12.  
  13. extern int      YourScore, MyScore;
  14. /* these are for stick position */
  15. extern int      StartX, StartY, NewX, NewY;
  16.  
  17. extern Space    PlayGround;
  18. extern Timing   PlayTime;
  19.  
  20. /* this is the big guy, controlling everything */
  21. extern Coordinator *Dept_Head;
  22.  
  23. extern Stick   *PoolStick;
  24. extern Stick   *Trajectory;
  25.  
  26. extern Ball    *WhiteBall, *BlackBall;
  27. extern Ball    *DottedWhiteBall;/* we'll use it for 3-ball pool */
  28. extern Ball    *MyBalls[7];
  29. extern Ball    *YourBalls[7];
  30. extern int      gameType, HowManyBalls;
  31.  
  32.  
  33. extern Stick   *
  34. new__Stick(int type);
  35. extern Coordinator *
  36. new__Coordinator(int HowManyObjects);
  37. extern Ball    *
  38. new__Ball(double Mass, double radious, float initX, float initY, double initVx, double initVy, double initVr);
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48. /* just to on the safe side
  49.  
  50. PlayGround.xmin = 72.000000;
  51. PlayGround.ymin = 42.000000;
  52. PlayGround.xmax = 510.000000;
  53. PlayGround.ymax = 320.000000;
  54. */
  55.  
  56.  
  57. void
  58. MainSetup()
  59. {
  60.     int             i;
  61.  
  62.  
  63.     PlayTime.currenttime = 0.000;
  64.     PlayTime.totaltime = 100000.0000;    /* you can play max 100000
  65.                          * sec. */
  66.     /* seconds */
  67.     PlayTime.dt = 0.040000;    /* don't change this value without adjusting
  68.                  * others */
  69.  
  70.  
  71.     /* here are the defaults */
  72.     gameType = SIXTEENBALL;
  73.     HowManyBalls = SIXTEENBALL;
  74.  
  75.     Dept_Head = new__Coordinator(HowManyBalls);
  76.  
  77.     /* we need these balls anyway */
  78.     WhiteBall = new__Ball(20, BALLRADIUS, 500, 230, 50, 0, 0);
  79.     BlackBall = new__Ball(20, BALLRADIUS, 200, 230, 0.1, 0, 0);
  80.  
  81.     WhiteBall->MyIDis(WhiteBall, Dept_Head->RegisterThisObject(Dept_Head, WhiteBall));
  82.     BlackBall->MyIDis(BlackBall, Dept_Head->RegisterThisObject(Dept_Head, BlackBall));
  83.  
  84.     /* now let's see what user wants to play */
  85.     if (gameType == SIXTEENBALL) {
  86.         for (i = 0; i < 7; i++) {
  87.             MyBalls[i] = new__Ball(20, BALLRADIUS, 100 + i * 42, 400, 0.1, 0, 0);
  88.             MyBalls[i]->MyIDis(MyBalls[i], Dept_Head->RegisterThisObject(Dept_Head, MyBalls[i]));
  89.         }
  90.         for (i = 0; i < 7; i++) {
  91.             YourBalls[i] = new__Ball(20, BALLRADIUS, 100 + i * 42, 300, 0.1, 0, 0);
  92.             YourBalls[i]->MyIDis(YourBalls[i], Dept_Head->RegisterThisObject(Dept_Head, YourBalls[i]));
  93.  
  94.         }
  95.     } else {
  96.         /*
  97.          * DottedWhiteBall = new__Ball(20, BALLRADIUS, 100, 250, 0.1,
  98.          * 0, 0); DottedWhiteBall->MyColor_is(DottedWhiteBall,
  99.          * YOUR_BALLS_COLOR);
  100.          * DottedWhiteBall->MyIDis(DottedWhiteBall,
  101.          * Dept_Head->RegisterThisObject(Dept_Head,
  102.          * DottedWhiteBall));
  103.          */
  104.     }
  105.  
  106.     Dept_Head->GetGameType(Dept_Head, gameType);
  107.  
  108.     Dept_Head->GetBoundary(Dept_Head, PlayGround);
  109.  
  110.     Dept_Head->GetTime(Dept_Head, PlayTime);
  111.  
  112.     /* Dept_Head -> AllowableBump (Dept_Head, 4.000000); */
  113.  
  114.     Dept_Head->CheckSpeedsAndCalculateK(Dept_Head);
  115.  
  116.     /* This was the end of the major setups now windows stuff    */
  117.  
  118.  
  119.  
  120. };
  121.  
  122.  
  123.