| 120 | //============================================================================// |
| 121 | |
| 122 | void LocalPlayer::doUpdate(float dt) { |
| 123 | const bool hadShotActive = anyShotActive; |
| 124 | const int numShots = getMaxShots(); |
| 125 | |
| 126 | // if paused then boost the reload times by dt (so that, effectively, |
| 127 | // reloading isn't performed) |
| 128 | int i; |
| 129 | if (isPaused()) { |
| 130 | for (i = 0; i < numShots; i++) { |
| 131 | if (shots[i]) { |
| 132 | shots[i]->boostReloadTime(dt); |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // reap dead (reloaded) shots |
| 138 | for (i = 0; i < numShots; i++) { |
| 139 | if (shots[i] && shots[i]->isReloaded()) { |
| 140 | if (!shots[i]->isExpired()) { |
| 141 | shots[i]->setExpired(); |
| 142 | } |
| 143 | deleteShot(i); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | // update shots |
| 148 | anyShotActive = false; |
| 149 | for (i = 0; i < numShots; i++) { |
| 150 | if (shots[i]) { |
| 151 | shots[i]->update(dt); |
| 152 | if (!shots[i]->isExpired()) { |
| 153 | anyShotActive = true; |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | // if no shots now out (but there had been) then reset target |
| 159 | if (!anyShotActive && hadShotActive) { |
| 160 | target = NULL; |
| 161 | } |
| 162 | |
| 163 | // drop bad flag if timeout has expired |
| 164 | World* world = World::getWorld(); |
| 165 | if (!isPaused() && dt > 0.0f && world && world->allowShakeTimeout() && |
| 166 | getFlagType() != Flags::Null && getFlagType()->endurance == FlagSticky && |
| 167 | flagShakingTime > 0.0f) { |
| 168 | flagShakingTime -= dt; |
| 169 | if (flagShakingTime <= 0.0f) { |
| 170 | flagShakingTime = 0.0f; |
| 171 | server->sendDropFlag(getPosition()); |
| 172 | setShotType(StandardShot); |
| 173 | } |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | |
| 178 | void LocalPlayer::doSlideMotion(float dt, float slideTime, |
nothing calls this directly
no test coverage detected