summaryrefslogtreecommitdiff
path: root/src/thundercloud.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-01-14 22:18:00 +0100
committerTreeki <treeki@gmail.com>2013-01-14 22:18:00 +0100
commit7e0ef3242299cc39d273589b4a122440d0c1e184 (patch)
treeff34d94f04cddb9257b01e58993bd6daaf01ef5a /src/thundercloud.cpp
parent27e79e27f08806559be022b320755a0dbde1c8c7 (diff)
downloadkamek-7e0ef3242299cc39d273589b4a122440d0c1e184.tar.gz
kamek-7e0ef3242299cc39d273589b4a122440d0c1e184.zip
fixed thundercloud off ground
Diffstat (limited to 'src/thundercloud.cpp')
-rwxr-xr-xsrc/thundercloud.cpp20
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;