From 2f3aeb2c37136463c73a1df65797d7996b6f6034 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 1 Oct 2005 02:23:59 +0000 Subject: Changed to using Doubles --- Default.ppinch | Bin 738 -> 1243 bytes designer.bmx | 18 ++++++++--------- game.bmx | 2 +- level.bmx | 62 ++++++++++++++++++++++++++++----------------------------- types.bmx | 30 ++++++++++++++-------------- 5 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Default.ppinch b/Default.ppinch index 7d6fcf9..7e40481 100644 Binary files a/Default.ppinch and b/Default.ppinch differ diff --git a/designer.bmx b/designer.bmx index 9040d63..9afde62 100644 --- a/designer.bmx +++ b/designer.bmx @@ -61,7 +61,7 @@ Type TDesObj Abstract GameGFX.guifont.Draw(x+","+y,0,0) End Method - Method FloatString:String(v:Double) + Method DoubleString:String(v:Double) Local s:String=v If s.Find(".")<>-1 @@ -151,7 +151,7 @@ Type TDesGrav Extends TDesObj If GUIDialog(Designer.mdialog,Designer.md_ok,Designer.md_cancel,GameGFX.pointer) g.friendly = Designer.md_friendly.checked g.repel = Designer.md_invert.checked - g.mass = Designer.md_mass.text.ToFloat() + g.mass = Designer.md_mass.text.ToDouble() EndIf End Method @@ -160,7 +160,7 @@ Type TDesGrav Extends TDesObj End Method Method SetInfo(w:TLabel) - w.text="Friendly:" + BoolString(g.friendly) + " Inverse gravity:" + BoolString(g.repel) + " Mass: " + FloatString(g.mass) + w.text="Friendly:" + BoolString(g.friendly) + " Inverse gravity:" + BoolString(g.repel) + " Mass: " + DoubleString(g.mass) End Method Method Snap() @@ -316,10 +316,10 @@ Type TDesPoint Extends TDesObj If GUIDialog(Designer.pdialog,Designer.pd_ok,Designer.pd_cancel,GameGFX.pointer) l.gap = Max(1,Designer.pd_gap.text.ToInt()) - l.v.x = Designer.pd_vx.text.ToFloat() - l.v.y = Designer.pd_vy.text.ToFloat() + l.v.x = Designer.pd_vx.text.ToDouble() + l.v.y = Designer.pd_vy.text.ToDouble() l.circle = Designer.pd_circle.checked - l.circvel = Designer.pd_circvel.text.ToFloat() + l.circvel = Designer.pd_circvel.text.ToDouble() EndIf End Method @@ -329,9 +329,9 @@ Type TDesPoint Extends TDesObj Method SetInfo(w:TLabel) If l.circle - w.text="Gap:" + l.gap + " DX: " + FloatString(l.v.x) + " DY: " + FloatString(l.v.y) + " Angular velocity: " + FloatString(l.circvel) + w.text="Gap:" + l.gap + " DX: " + DoubleString(l.v.x) + " DY: " + DoubleString(l.v.y) + " Angular velocity: " + DoubleString(l.circvel) Else - w.text="Gap:" + l.gap + " DX: " + FloatString(l.v.x) + " DY: " + FloatString(l.v.y) + w.text="Gap:" + l.gap + " DX: " + DoubleString(l.v.x) + " DY: " + DoubleString(l.v.y) EndIf End Method @@ -558,7 +558,7 @@ Type Designer level.maxmass = ld_maxmass.text.ToInt() level.winpercent = Max(0,Min(100,ld_winpercent.text.ToInt())) level.timer = ld_timer.text.ToInt() - level.placemass = ld_placemass.text.ToFloat() + level.placemass = ld_placemass.text.ToDouble() EndIf End Function End Type diff --git a/game.bmx b/game.bmx index 8908235..6c30f84 100644 --- a/game.bmx +++ b/game.bmx @@ -153,7 +153,7 @@ Type TGame If done<>LEVEL_NOTOVER percent=final_percent Else - percent:Int=Int(Float(captured)/Float(num)*100.0) + percent:Int=Int(Double(captured)/Double(num)*100.0) If percent>=level.winpercent And pass_time=0 pass_time=timer diff --git a/level.bmx b/level.bmx index c7e3e4b..b86c33a 100644 --- a/level.bmx +++ b/level.bmx @@ -28,9 +28,9 @@ End Type Type TGravPoint Field repel:Int Field friendly:Int - Field x:Float - Field y:Float - Field mass:Float + Field x:Double + Field y:Double + Field mass:Double Method CreateMass:TMass() Local m:TMass=New TMass @@ -54,30 +54,30 @@ Type TGravPoint Local o:TGravPoint=New TGravPoint o.repel=s.ReadInt() o.friendly=s.ReadInt() - o.x=s.ReadFloat() - o.y=s.ReadFloat() - o.mass=s.ReadFloat() + o.x=s.ReadDouble() + o.y=s.ReadDouble() + o.mass=s.ReadDouble() Return o End Function Method ToStream(s:TStream) s.WriteInt(repel) s.WriteInt(friendly) - s.WriteFloat(x) - s.WriteFloat(y) - s.WriteFloat(mass) + s.WriteDouble(x) + s.WriteDouble(y) + s.WriteDouble(mass) End Method End Type Type TPointLine - Field x1:Float - Field y1:Float - Field x2:Float - Field y2:Float + Field x1:Double + Field y1:Double + Field x2:Double + Field y2:Double Field gap:Int Field v:TVector Field circle:Int - Field circvel:Float + Field circvel:Double Method New() v=TVector.Create() @@ -124,28 +124,28 @@ Type TPointLine Function FromStream:TPointLine(s:TStream) Local o:TPointLine=New TPointLine - o.x1=s.ReadFloat() - o.y1=s.ReadFloat() - o.x2=s.ReadFloat() - o.y2=s.ReadFloat() + o.x1=s.ReadDouble() + o.y1=s.ReadDouble() + o.x2=s.ReadDouble() + o.y2=s.ReadDouble() o.gap=s.ReadInt() - o.v.x=s.ReadFloat() - o.v.y=s.ReadFloat() + o.v.x=s.ReadDouble() + o.v.y=s.ReadDouble() o.circle=s.ReadInt() - o.circvel=s.ReadFloat() + o.circvel=s.ReadDouble() Return o End Function Method ToStream(s:TStream) - s.WriteFloat(x1) - s.WriteFloat(y1) - s.WriteFloat(x2) - s.WriteFloat(y2) + s.WriteDouble(x1) + s.WriteDouble(y1) + s.WriteDouble(x2) + s.WriteDouble(y2) s.WriteInt(gap) - s.WriteFloat(v.x) - s.WriteFloat(v.y) + s.WriteDouble(v.x) + s.WriteDouble(v.y) s.WriteInt(circle) - s.WriteFloat(circvel) + s.WriteDouble(circvel) End Method End Type @@ -157,7 +157,7 @@ Type TLevel Field winpercent:Int Field timer:Int Field invmass:Int - Field placemass:Float + Field placemass:Double Field placefriend:Int Method New() @@ -190,7 +190,7 @@ Type TLevel o.winpercent=s.ReadInt() o.timer=s.ReadInt() o.invmass=s.ReadInt() - o.placemass=s.ReadFloat() + o.placemass=s.ReadDouble() o.placefriend=s.ReadInt() c=s.ReadInt() @@ -212,7 +212,7 @@ Type TLevel s.WriteInt(winpercent) s.WriteInt(timer) s.WriteInt(invmass) - s.WriteFloat(placemass) + s.WriteDouble(placemass) s.WriteInt(placefriend) s.WriteInt(grav.Count()) diff --git a/types.bmx b/types.bmx index a0974e3..0c06eba 100644 --- a/types.bmx +++ b/types.bmx @@ -23,10 +23,10 @@ Type GameGFX End Type Type TMass - Field x:Float - Field y:Float + Field x:Double + Field y:Double Field v:TVector - Field mass:Float + Field mass:Double Field friend:Int Field inverse:Int Field img:TImage @@ -48,7 +48,7 @@ Type TMass EndIf Local d:TVector=TVector.Create(o.x-x,o.y-y) - Local l:Float=d.Length() + Local l:Double=d.Length() If l>0.1 l:*l @@ -83,10 +83,10 @@ End Type Type TPoint Global img:TImage - Field x:Float - Field y:Float - Field lx:Float - Field ly:Float + Field x:Double + Field y:Double + Field lx:Double + Field ly:Double Field v:TVector Field r:Int Field g:Int @@ -113,7 +113,7 @@ Type TPoint EndIf Local d:TVector=TVector.Create(o.x-x,o.y-y) - Local l:Float=d.Length() + Local l:Double=d.Length() If l