diff options
Diffstat (limited to 'src/thundercloud.cpp')
-rwxr-xr-x | src/thundercloud.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/thundercloud.cpp b/src/thundercloud.cpp index 597c08f..9b3fa1f 100755 --- a/src/thundercloud.cpp +++ b/src/thundercloud.cpp @@ -417,19 +417,23 @@ void dThunderCloud::beginState_Lightning() { float backupY = pos.y, backupYSpeed = speed.y; u32 result = 0; - while (result == 0) { - below.y -= 0x1000; - OSReport("Sending out leader to %d", below.y>>12); + while (result == 0 && below.y > (-30 << 16)) { + below.y -= 0x4000; + //OSReport("Sending out leader to %d", below.y>>12); result = collMgr.calculateBelowCollisionWithSmokeEffect(); - OSReport("Result %d", result); - - if (below.y>>12 > 800) { result = 1; } + //OSReport("Result %d", result); } - OSReport("Lightning strikes at %d", below.y>>12); + if (result == 0) { + OSReport("Couldn't find any ground, falling back to 13 tiles distance"); + + leader = 13 * 16; + } else { + OSReport("Lightning strikes at %d", below.y>>12); - leader = -(below.y >> 12); + leader = -(below.y >> 12); + } below.y = 0; pos.y = backupY; |