aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-29 03:24:33 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-29 03:24:33 +0000
commit76616a7974a926ddee09ab605f89acc78321e728 (patch)
tree4f7b9af0a804fff99b10af22fc257d46d1dd4c1d /Game/Code/Classes
parent95662b4cb8252ae665de8222762f9fc320f11ea0 (diff)
downloadusdx-76616a7974a926ddee09ab605f89acc78321e728.tar.gz
usdx-76616a7974a926ddee09ab605f89acc78321e728.tar.xz
usdx-76616a7974a926ddee09ab605f89acc78321e728.zip
fixed runtime sing errors, when compiled in lazarus.
mainly divide by 0 errors. need to be more careful with these, as they can be a pain to track down git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@446 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r--Game/Code/Classes/UDraw.pas48
-rw-r--r--Game/Code/Classes/USingScores.pas35
2 files changed, 79 insertions, 4 deletions
diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas
index 1e631648..22b1263d 100644
--- a/Game/Code/Classes/UDraw.pas
+++ b/Game/Code/Classes/UDraw.pas
@@ -221,6 +221,9 @@ var
PlayerNumber: Integer;
GoldenStarPos : real;
+
+ lTmpA ,
+ lTmpB : real;
begin
// We actually don't have a playernumber in this procedure, it should reside in NrCzesci - but it's always set to zero
// So we exploit this behavior a bit - we give NrCzesci the playernumber, keep it in playernumber - and then we set NrCzesci to zero
@@ -236,7 +239,26 @@ begin
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote);
+
+ lTmpA := (Right-Left);
+ lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote);
+
+ writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) );
+ writeln( 'UDRAW : ' + floattostr( lTmpB ) );
+ writeln( '' );
+
+
+ if ( lTmpA > 0 ) AND
+ ( lTmpB > 0 ) THEN
+ begin
+ TempR := lTmpA / lTmpB;
+ end
+ else
+ begin
+ TempR := 0;
+ end;
+
+
with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin
for Pet := 0 to HighNut do begin
with Nuta[Pet] do begin
@@ -440,13 +462,35 @@ var
R,G,B: real;
X1, X2, X3, X4: real;
W, H: real;
+
+ lTmpA ,
+ lTmpB : real;
begin
if (Player[NrGracza].ScoreTotalI >= 0) then begin
glColor4f(1, 1, 1, sqrt((1+sin(Music.Position * 3))/4)/ 2 + 0.5 );
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- TempR := (Right-Left) / (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote);
+
+
+ lTmpA := (Right-Left);
+ lTmpB := (Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].Koniec - Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt].StartNote);
+
+ writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) );
+ writeln( 'UDRAW : ' + floattostr( lTmpB ) );
+ writeln( '' );
+
+
+ if ( lTmpA > 0 ) AND
+ ( lTmpB > 0 ) THEN
+ begin
+ TempR := lTmpA / lTmpB;
+ end
+ else
+ begin
+ TempR := 0;
+ end;
+
with Czesci[NrCzesci].Czesc[Czesci[NrCzesci].Akt] do begin
for Pet := 0 to HighNut do begin
with Nuta[Pet] do begin
diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas
index 052ff678..88b278b7 100644
--- a/Game/Code/Classes/USingScores.pas
+++ b/Game/Code/Classes/USingScores.pas
@@ -414,15 +414,46 @@ end;
// Removes a PopUp w/o destroying the List
//-----------
Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp);
+var
+ lTempA ,
+ lTempB : real;
begin
//Give Player the Last Points that missing till now
aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven;
//Change Bars Position
- aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven)/Cur.ScoreDiff * (Cur.Rating / 20 - 0.26);
+
+ // TODO : JB_Lazarus - Exception=Invalid floating point operation
+ // AT THIS LINE !
+
+ writeln( 'USINGSCORES-aPlayers[Cur.Player].RBTarget : ' + floattostr( aPlayers[Cur.Player].RBTarget ) );
+ writeln( 'USINGSCORES-(Cur.ScoreDiff - Cur.ScoreGiven) : ' + floattostr( (Cur.ScoreDiff - Cur.ScoreGiven) ) );
+ writeln( 'USINGSCORES-Cur.ScoreDiff : ' + floattostr( Cur.ScoreDiff ) );
+ writeln( 'USINGSCORES-(Cur.Rating / 20 - 0.26) : ' + floattostr( (Cur.Rating / 20 - 0.26) ) );
+ writeln( '' );
+
+ lTempA := ( aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven) );
+ lTempB := ( Cur.ScoreDiff * (Cur.Rating / 20 - 0.26) );
+
+ writeln( 'USINGSCORES-lTempA : ' + floattostr( lTempA ) );
+ writeln( 'USINGSCORES-lTempB : ' + floattostr( lTempB ) );
+ writeln( '----------------------------------------------------------' );
+
+
+ if ( lTempA > 0 ) AND
+ ( lTempB > 0 ) THEN
+ begin
+ writeln( 'USINGSCORES-lTempA / lTempB :' + floattostr( lTempA / lTempB ) );
+ aPlayers[Cur.Player].RBTarget := lTempA / lTempB;
+ end;
+
+ writeln( '----------------------------------------------------------' );
+ writeln( '' );
+
If (aPlayers[Cur.Player].RBTarget > 1) then
aPlayers[Cur.Player].RBTarget := 1
- else If (aPlayers[Cur.Player].RBTarget < 0) then
+ else
+ If (aPlayers[Cur.Player].RBTarget < 0) then
aPlayers[Cur.Player].RBTarget := 0;
//If this is the First PopUp => Make Next PopUp the First