From 0bac4579ef0927f4f05b1e55ee373b988a8eb962 Mon Sep 17 00:00:00 2001 From: Maikel de Vries Date: Fri, 19 Jan 2018 13:22:11 +0100 Subject: [PATCH] fix other script usages of SimFlight --- .../Environment.ocd/Cloud.ocd/Script.c | 10 +++++----- .../Libraries.ocd/MeleeWeapons.ocd/Script.c | 15 --------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/planet/Objects.ocd/Environment.ocd/Cloud.ocd/Script.c b/planet/Objects.ocd/Environment.ocd/Cloud.ocd/Script.c index 215d8ec3e..12715226e 100644 --- a/planet/Objects.ocd/Environment.ocd/Cloud.ocd/Script.c +++ b/planet/Objects.ocd/Environment.ocd/Cloud.ocd/Script.c @@ -378,12 +378,12 @@ private func RainDrop() { var x = RandomX(-wdt, wdt); var y = RandomX(-hgt, hgt); - var xdir = RandomX(GetWind(0,0,1)-5, GetWind(0,0,1)+5)/5; + var xdir = RandomX(GetWind(0, 0, true) - 5, GetWind(0, 0, true) + 5) / 5; var ydir = 30; if (!GBackSky(x, y)) continue; - if(mat == "Ice") + if (mat == "Ice") { // Ice (-> hail) falls faster. xdir *= 4; @@ -391,7 +391,7 @@ private func RainDrop() } // Snow is special. - if(mat == "Snow") + if (mat == "Snow") { CreateParticle("RaindropSnow", x, y, xdir, 10, PV_Random(2000, 3000), particle_cache.snow, 0); if (!i && rain_inserts_mat) @@ -400,14 +400,14 @@ private func RainDrop() } var particle = new particle_cache.rain {}; - if(Random(2)) + if (Random(2)) particle.Attach = ATTACH_Back; CreateParticle(particle_name, x, y, xdir, ydir, PV_Random(200, 300), particle, 0); // Splash. if (!i) { - var hit = SimFlight(x, y, xdir, ydir, 25 /* Liquid */, nil, nil, 3); + var hit = SimFlight(x, y, xdir, ydir, C4M_Liquid); var x_final = hit[0], y_final = hit[1], time_passed = hit[4]; if (time_passed > 0) { diff --git a/planet/Objects.ocd/Libraries.ocd/MeleeWeapons.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/MeleeWeapons.ocd/Script.c index d1602066a..5e42b5e13 100644 --- a/planet/Objects.ocd/Libraries.ocd/MeleeWeapons.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/MeleeWeapons.ocd/Script.c @@ -207,21 +207,6 @@ func GetRelativeVelocity(pObject1, pObject2) return b; } - -func GetJumpLength(pClonk) -{ - if(!pClonk->~IsJumping()) return 0; - var x = pClonk->GetX(), y = pClonk->GetY(), xDir = pClonk->GetXDir(), yDir = pClonk->GetYDir(); - //crash! var l=SimFlight(x, y, xDir, yDir, 0, 0, 100, 0); //SimFlight behavior changed (10/1/10) - var l=0; - if(!l) return 50; - else - { - // not a very good approximation. I really think SimFlight should return the number of iterations - return Sqrt((x - pClonk->GetX()) ** 2 + (y - pClonk->GetY()) ** 2); - } -} - func ApplyShieldFactor(pFrom, pTo, damage) { // totally prevent the strike?