diff -Naur flying-6.20.orig/arcs.h flying-6.20/arcs.h --- flying-6.20.orig/arcs.h Mon Aug 7 22:26:55 1995 +++ flying-6.20/arcs.h Thu Jan 3 00:09:04 2002 @@ -6,7 +6,7 @@ // zu tun haben. Dabei gelten die folgenden Ableitungen // // StaticArc : Grundfunktionalität -// / \ +// / \ // OuterArc InnerArc : Bogen, der von außen/innen reflektiert // | \ | // | ArcWall : beidseitig reflektierend (Ableitung nur symbolisch) diff -Naur flying-6.20.orig/ball.h flying-6.20/ball.h --- flying-6.20.orig/ball.h Mon Aug 7 22:26:55 1995 +++ flying-6.20/ball.h Thu Jan 3 00:09:04 2002 @@ -6,7 +6,7 @@ // zu tun haben. Dabei gelten die folgenden Ableitungen // // StaticArc : Grundfunktionalität -// / \ +// / \ // OuterArc InnerArc : Bogen, der von außen/innen reflektiert // | \ | // | ArcWall : beidseitig reflektierend (Ableitung nur symbolisch) diff -Naur flying-6.20.orig/billard.C flying-6.20/billard.C --- flying-6.20.orig/billard.C Mon Aug 7 22:26:55 1995 +++ flying-6.20/billard.C Thu Jan 3 00:09:04 2002 @@ -35,6 +35,7 @@ } if (col>2) col=1; + ResetColor( table_marking_col, "white" ); switch(col) { default: SetMainBgColor( "rgb:60/90/70" ); // SeaGreen-GlobalBackground @@ -87,6 +88,7 @@ table_line_col = AddBgColor( "DarkGreen" ); table_light_col = AddBgColor( "LimeGreen" ); // table_dark_col = AddBgColor( "MediumForestGreen" ); + table_marking_col = AddBgColor( "White" ); table_col = CreateColorMix( 0, table_light_col, 3 ); diff -Naur flying-6.20.orig/billard.h flying-6.20/billard.h --- flying-6.20.orig/billard.h Mon Aug 7 22:26:55 1995 +++ flying-6.20/billard.h Thu Jan 3 00:09:04 2002 @@ -67,6 +67,9 @@ ColorId table_light_col; ColorId table_dark_col; + // Added DMR 22/04/2000 as the lines should be white but many things depend on table_line_col + ColorId table_marking_col; + void DrawMarker( const Real &midx, const Real &midy, const Real &ox, const Real &oy ) const; private: diff -Naur flying-6.20.orig/carrom.C flying-6.20/carrom.C --- flying-6.20.orig/carrom.C Mon Aug 7 22:26:55 1995 +++ flying-6.20/carrom.C Thu Jan 3 00:09:04 2002 @@ -114,7 +114,7 @@ void Carrom::Setup( double x, double y ) { static int nc[5] = { 3, 4, 5, 4, 3 }; // Steine pro Spalte -static t[19] = { -1, 1, -2, // Steinverteilung +static int t[19] = { -1, 1, -2, // Steinverteilung 2, -3, 3, 4, -4, 5, 0, -5, -6, 6, -7, 7, 8, diff -Naur flying-6.20.orig/flying.man flying-6.20/flying.man --- flying-6.20.orig/flying.6 Tue Jul 18 22:10:11 1995 +++ flying-6.20/flying.6 Fri Jan 4 19:47:23 2002 @@ -208,7 +208,7 @@ .B -presets shows the current internal values of static variables on stdout. The values can be dynamically altered by setting them in the file -\fIpresets.txt\fP with the same syntax as in this output. +\fI.flyingrc\fP with the same syntax as in this output. .PP There are many additional debugging options, when the executable was compiled for debugging. They are shown when no argument or -h is given at the @@ -217,7 +217,7 @@ .PP .SH FILES .TP 14 -presets.txt +.flyingrc file to overwrite internal static values .TP fly*-*.dta diff -Naur flying-6.20.orig/global.h flying-6.20/global.h --- flying-6.20.orig/global.h Mon Aug 7 22:26:56 1995 +++ flying-6.20/global.h Thu Jan 3 00:09:04 2002 @@ -7,7 +7,7 @@ #endif // name of the file to look for static data of the classes -#define PRESET_FILE "presets.txt" +#define PRESET_FILE ".flyingrc" #define LOG_FILE DATA_DIRECTORY"/logfile.txt" @@ -69,7 +69,7 @@ // Switch to pre-existing (better to understand) algorithms for // collision detection, instead of the special algortithm (which is // a bit faster). -#define EasyWall 0 +#define EasyWall 1 // // special constants instead of the collision time diff -Naur flying-6.20.orig/logfile.C flying-6.20/logfile.C --- flying-6.20.orig/logfile.C Mon Aug 7 22:26:56 1995 +++ flying-6.20/logfile.C Thu Jan 3 00:09:04 2002 @@ -64,7 +64,7 @@ printf( "\t%s", flying_version_string+4 ); time(&start_time); - strftime( buffer, sizeof(buffer), "%d-%m-%y %H:%M:%S", localtime(&start_time) ); + strftime( buffer, sizeof(buffer), "%d-%m-%Y %H:%M:%S", localtime(&start_time) ); sprintf( message, "%-8s%s %s: %s started by ", game, buffer, dpy_string,revision ); if ( !strcmp( user_string, "emshh" ) ) return; diff -Naur flying-6.20.orig/main.C flying-6.20/main.C --- flying-6.20.orig/main.C Mon Aug 7 22:26:56 1995 +++ flying-6.20/main.C Thu Jan 3 00:09:04 2002 @@ -176,7 +176,7 @@ srand( (unsigned)GetCurrentTime() ); load_konfi(); - if (!strcmp(argv[0],"xsnooker")) game_flag = 1; + if (!strcmp(argv[0],"xsnooker")) { game_flag = 1; color_flag = 2; } // Default to green DMR 28/04/2000 else if (!strcmp(argv[0],"xpool")) game_flag = 2; else if (!strcmp(argv[0],"xcannon")) game_flag = 3; else if (!strcmp(argv[0],"xcarrom")) game_flag = 4; @@ -186,8 +186,8 @@ else if (!strcmp(argv[0],"xgolf")) game_flag = 8; for (int i=1; iDrawBackground(); diff -Naur flying-6.20.orig/pool8.C flying-6.20/pool8.C --- flying-6.20.orig/pool8.C Mon Aug 7 22:26:57 1995 +++ flying-6.20/pool8.C Thu Jan 3 00:09:04 2002 @@ -56,7 +56,7 @@ void Pool8::Triangle( const Vec2 &vec ) { -static t[15] = { 1, +static int t[15] = { 1, -1, -2, 2, 0, 3, -3, 4, -4, -5, @@ -186,7 +186,7 @@ void Pool9::Triangle( const Vec2 &vec ) { -static t[9] = { 1, +static int t[9] = { 1, 2, 3, 4, -1, 5, 6, 7, diff -Naur flying-6.20.orig/snooker.C flying-6.20/snooker.C --- flying-6.20.orig/snooker.C Mon Aug 7 22:26:57 1995 +++ flying-6.20/snooker.C Fri Jan 4 19:36:22 2002 @@ -86,12 +86,14 @@ } void Snooker::SetupBalls() { - defs[0] = Vec2( AreaOffX()+AreaWidth()*0.25, AreaOffY()+AreaHeight()/2.+14.6 ); - defs[1] = Vec2( AreaOffX()+AreaWidth()*0.25, AreaOffY()+AreaHeight()/2.-14.6 ); - defs[2] = Vec2( AreaOffX()+AreaWidth()*0.25, AreaOffY()+AreaHeight()*0.50 ); - defs[3] = Vec2( AreaOffX()+AreaWidth()*0.50, AreaOffY()+AreaHeight()*0.50 ); - defs[4] = Vec2( AreaOffX()+AreaWidth()*0.75, AreaOffY()+AreaHeight()*0.50 ); - defs[5] = Vec2( AreaOffX()+AreaWidth()-32.0, AreaOffY()+AreaHeight()*0.50 ); +// Initial position of yellow, green and brown amended DMR 22/04/2000 + + defs[0] = Vec2( AreaOffX()+AreaWidth()*29/144, AreaOffY()+AreaHeight()* 47.5/72 ); // Yellow + defs[1] = Vec2( AreaOffX()+AreaWidth()*29/144, AreaOffY()+AreaHeight()* 24.5/72); // Green + defs[2] = Vec2( AreaOffX()+AreaWidth()*29/144, AreaOffY()+AreaHeight()* 0.50 ); // Brown + defs[3] = Vec2( AreaOffX()+AreaWidth()*0.50, AreaOffY()+AreaHeight()*0.50 ); // Blue + defs[4] = Vec2( AreaOffX()+AreaWidth()*0.75, AreaOffY()+AreaHeight()*0.50 ); // Pink + defs[5] = Vec2( AreaOffX()+AreaWidth()*131.25/144, AreaOffY()+AreaHeight()*0.50 ); // Black for (int i=0;i<6;i++) { colored[i] = new Ball( defs[i], BallRadius ); @@ -115,11 +117,20 @@ } void Snooker::DrawBackground() const { +// Table markings corrected DMR 22/04/2000 Pool::DrawBackground(); - SetBgColor(table_line_col); - DrawLine( defs[0], defs[1] ); - DrawArc( defs[2], 14.6, 90.0, 180.0 ); - for (int i=0;i<6;i++) FillCircle( defs[i], 1.0 ); + SetBgColor(table_marking_col); + DrawLine( defs[0].X(), AreaOffY() , defs[1].X(), AreaOffY()+AreaHeight() ); + DrawArc( defs[2], defs[0].Y() - defs[2].Y(), 90.0, 180.0 ); + + // Brown has a line across the baulk line + DrawLine( defs[2].X()-0.75, defs[2].Y(), defs[2].X()+0.75, defs[2].Y() ); + + // Blue, pink and black are on crosses + for (int i=3;i<6;i++) { + DrawLine( defs[i].X()-.75, defs[i].Y()-.75, defs[i].X()+.75, defs[i].Y()+.75 ); + DrawLine( defs[i].X()-.75, defs[i].Y()+.75, defs[i].X()+.75, defs[i].Y()-.75 ); + } } void Snooker::ResetGame() { @@ -177,50 +188,68 @@ } void Snooker::AllBallsStopped() { +// Direction of loop reversed DMR 02/01/2002. This is because, if two +// coloured balls are potted on the same stroke and only one spot is +// free, the higher-valued colour is placed on the free spot and the +// lower-valued colour as close to its own spot as possible. if (color_in_pocket) { - int mask=0; - for (int i=0;i<6;i++) { + int mask=63; + for (int i=5;i>=0;i--) { if ((reds_in_pocket!=0x7fff)||((color_in_pocket&mask)!=mask)) { if (color_in_pocket & (1<>= 1; } } Pool::AllBallsStopped(); } int Snooker::IsSelectable(Ball *b) { -int i; +// Coloured ball replacement algorithm corrected DMR 23/04/2000 and +// further modified 02/01/2002. The correct algorithm is: All balls +// which may replaced on their own spots are replaced. Any remaining +// ball is placed on the highest available colour's spot which is +// available. If no spot is available, the ball is placed as close as +// possible to its own spot along a line heading perpendicular away +// from the baulk cushion. If even that fails, the ball is placed as +// close as possible to its spot _towards_ the baulk cushion. +int i,j; +int done = 0; for (i=0;i<6;i++) { if (b==colored[i]) { - if (color_in_pocket & (1<FitsAt(defs[i])) { - b->SetP(defs[i]); // reset to default position - } - else if (b->FitsAt(defs[5])) { - b->SetP(defs[5]); // reset to black position + if ((color_in_pocket & (1<FitsAt(defs[i])) { + b->SetP(defs[i]); // reset to default position + done=1; + } + else { + for (j=5;j>=0;j--) { + if (b->FitsAt(defs[j]) && (color_in_pocket&(1<SetP(defs[j]); // reset to highest position + done=1; + break; + } } - else if (i<4) { - Vec2 newpos; - b->FitsNextTo(defs[i],Vec2(-1.0,RealZero),&newpos); - b->SetP(newpos); // closer to left wall + } + if (!done) { + Vec2 newpos; + b->FitsNextTo(defs[i],Vec2(1.0,RealZero),&newpos); + if (newpos.X() + GetNormalBallSize() <= AreaOffX() + AreaWidth()) { + b->SetP(newpos); // closer to right wall } else { - Vec2 newpos; - b->FitsNextTo(defs[i],Vec2(1.0,RealZero),&newpos); - b->SetP(newpos); // closer to right wall + b->FitsNextTo(defs[i],Vec2(-1.0,RealZero),&newpos); + b->SetP(newpos); } - - b->ChgV(Vec2Zero); - color_in_pocket &= ~(1<ChgV(Vec2Zero); + color_in_pocket &= ~(1<