@@ -90,8 +90,6 @@ public CourseScreen(final Golf game, Course course, GameMode gameMode, GameMode
9090
9191 System .out .println ("Offsets: [" + xoffset + ", " + yoffset + "]" );
9292 System .out .println ("Scales: [" + scaleX + ", " + scaleY + "]" );
93- this .course .setOffsets (new float []{this .xoffset , this .yoffset });
94- this .course .setScales (new float []{this .scaleX , this .scaleY });
9593 this .activeMode .setOffsets (new float []{this .xoffset , this .yoffset });
9694 this .activeMode .setScales (new float []{this .scaleX , this .scaleY });
9795 }
@@ -196,8 +194,8 @@ private void splineSetup() {
196194 // Setup Offsets
197195 BicubicInterpolator botLeftInterp = (BicubicInterpolator ) this .course .getFunctions ()[0 ][0 ];
198196 Point3D [][] points = botLeftInterp .getPoints ();
199- this .setXoffset (( float ) points [0 ][0 ].getX ());
200- this .setYoffset (( float ) points [0 ][0 ].getY ());
197+ this .setXoffset (points [0 ][0 ].getX ());
198+ this .setYoffset (points [0 ][0 ].getY ());
201199
202200 // Setup scales
203201 int xLength = this .course .getFunctions ().length ;
@@ -206,14 +204,17 @@ private void splineSetup() {
206204 // scaleX
207205 BicubicInterpolator botRightInterp = (BicubicInterpolator ) this .course .getFunctions ()[xLength - 1 ][0 ];
208206 Point3D [][] botRightPoints = botRightInterp .getPoints ();
209- double rightX = botRightPoints [1 ][0 ].getX ();
210- this .setScaleX ((float )( rightX - this .getXoffset ()) / Golf .VIRTUAL_WIDTH );
207+ float rightX = botRightPoints [1 ][0 ].getX ();
208+ this .setScaleX ((rightX - this .getXoffset ())/ Golf .VIRTUAL_WIDTH );
211209
212210 // scaleY
213211 BicubicInterpolator topLeftInterp = (BicubicInterpolator ) this .course .getFunctions ()[0 ][yLength - 1 ];
214212 Point3D [][] topLeftPoints = topLeftInterp .getPoints ();
215- double topY = topLeftPoints [0 ][1 ].getY ();
216- this .setScaleY ((float )(topY - this .getYoffset ()) / Golf .VIRTUAL_HEIGHT );
213+ float topY = topLeftPoints [0 ][1 ].getY ();
214+ this .setScaleY ((topY - this .getYoffset ()) / Golf .VIRTUAL_HEIGHT );
215+
216+ this .course .setOffsets (new float []{this .xoffset , this .yoffset });
217+ this .course .setScales (new float []{this .scaleX , this .scaleY });
217218 }
218219
219220 /**
@@ -368,6 +369,7 @@ public void calcScale() {
368369 limitDist *= 2 ;
369370 }
370371 this .scaleY = scaleX ;
372+ this .course .setScales (new float []{this .scaleX , this .scaleY });
371373 }
372374
373375 /**
@@ -382,6 +384,7 @@ public void calcOffsets() {
382384 float y2 = this .course .getGoal ()[1 ];
383385 float yUnits = Golf .VIRTUAL_HEIGHT / (1 /this .scaleY );
384386 this .yoffset = (y1 + y2 - yUnits ) / 2.0f ;
387+ this .course .setOffsets (new float []{this .xoffset , this .yoffset });
385388 }
386389
387390 /**
0 commit comments