home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MORE WinGames
/
WINGAMES.iso
/
winpool
/
mainset.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-12-22
|
3KB
|
123 lines
#include <string.h>
#include <dos.h>
#include "definiti.h"
/* at the beginning */
extern int WhiteBallOut;
extern int BlackBallOut;
extern int YourScore, MyScore;
/* these are for stick position */
extern int StartX, StartY, NewX, NewY;
extern Space PlayGround;
extern Timing PlayTime;
/* this is the big guy, controlling everything */
extern Coordinator *Dept_Head;
extern Stick *PoolStick;
extern Stick *Trajectory;
extern Ball *WhiteBall, *BlackBall;
extern Ball *DottedWhiteBall;/* we'll use it for 3-ball pool */
extern Ball *MyBalls[7];
extern Ball *YourBalls[7];
extern int gameType, HowManyBalls;
extern Stick *
new__Stick(int type);
extern Coordinator *
new__Coordinator(int HowManyObjects);
extern Ball *
new__Ball(double Mass, double radious, float initX, float initY, double initVx, double initVy, double initVr);
/* just to on the safe side
PlayGround.xmin = 72.000000;
PlayGround.ymin = 42.000000;
PlayGround.xmax = 510.000000;
PlayGround.ymax = 320.000000;
*/
void
MainSetup()
{
int i;
PlayTime.currenttime = 0.000;
PlayTime.totaltime = 100000.0000; /* you can play max 100000
* sec. */
/* seconds */
PlayTime.dt = 0.040000; /* don't change this value without adjusting
* others */
/* here are the defaults */
gameType = SIXTEENBALL;
HowManyBalls = SIXTEENBALL;
Dept_Head = new__Coordinator(HowManyBalls);
/* we need these balls anyway */
WhiteBall = new__Ball(20, BALLRADIUS, 500, 230, 50, 0, 0);
BlackBall = new__Ball(20, BALLRADIUS, 200, 230, 0.1, 0, 0);
WhiteBall->MyIDis(WhiteBall, Dept_Head->RegisterThisObject(Dept_Head, WhiteBall));
BlackBall->MyIDis(BlackBall, Dept_Head->RegisterThisObject(Dept_Head, BlackBall));
/* now let's see what user wants to play */
if (gameType == SIXTEENBALL) {
for (i = 0; i < 7; i++) {
MyBalls[i] = new__Ball(20, BALLRADIUS, 100 + i * 42, 400, 0.1, 0, 0);
MyBalls[i]->MyIDis(MyBalls[i], Dept_Head->RegisterThisObject(Dept_Head, MyBalls[i]));
}
for (i = 0; i < 7; i++) {
YourBalls[i] = new__Ball(20, BALLRADIUS, 100 + i * 42, 300, 0.1, 0, 0);
YourBalls[i]->MyIDis(YourBalls[i], Dept_Head->RegisterThisObject(Dept_Head, YourBalls[i]));
}
} else {
/*
* DottedWhiteBall = new__Ball(20, BALLRADIUS, 100, 250, 0.1,
* 0, 0); DottedWhiteBall->MyColor_is(DottedWhiteBall,
* YOUR_BALLS_COLOR);
* DottedWhiteBall->MyIDis(DottedWhiteBall,
* Dept_Head->RegisterThisObject(Dept_Head,
* DottedWhiteBall));
*/
}
Dept_Head->GetGameType(Dept_Head, gameType);
Dept_Head->GetBoundary(Dept_Head, PlayGround);
Dept_Head->GetTime(Dept_Head, PlayTime);
/* Dept_Head -> AllowableBump (Dept_Head, 4.000000); */
Dept_Head->CheckSpeedsAndCalculateK(Dept_Head);
/* This was the end of the major setups now windows stuff */
};