| 178 | } |
| 179 | |
| 180 | bool BigGunControl(ItemInfo* laraItem, CollisionInfo* coll) |
| 181 | { |
| 182 | auto* lara = GetLaraInfo(laraItem); |
| 183 | auto* bigGunItem = &g_Level.Items[lara->Context.Vehicle]; |
| 184 | auto* bigGun = GetBigGunInfo(bigGunItem); |
| 185 | |
| 186 | if (bigGun->Flags & BGUN_FLAG_UP_DOWN) |
| 187 | { |
| 188 | if (bigGun->IsBarrelRotating) |
| 189 | bigGun->BarrelRotation--; |
| 190 | |
| 191 | if (!bigGun->BarrelRotation) |
| 192 | bigGun->IsBarrelRotating = false; |
| 193 | |
| 194 | if (IsHeld(In::Brake) || laraItem->HitPoints <= 0) |
| 195 | bigGun->Flags = BGUN_FLAG_AUTO_ROT; |
| 196 | else |
| 197 | { |
| 198 | if ((IsHeld(In::Accelerate) || IsHeld(In::Fire)) && !bigGun->FireCount) |
| 199 | { |
| 200 | BigGunFire(bigGunItem, laraItem); |
| 201 | bigGun->FireCount = BGUN_RECOIL_TIME; |
| 202 | bigGun->BarrelRotation = BGUN_RECOIL_Z; |
| 203 | bigGun->IsBarrelRotating = true; |
| 204 | } |
| 205 | |
| 206 | if (IsHeld(In::Forward)) |
| 207 | { |
| 208 | if (bigGun->TurnRate.x < 0) |
| 209 | bigGun->TurnRate.x /= 2; |
| 210 | |
| 211 | bigGun->TurnRate.x += BGUN_TURN_RATE_ACCEL; |
| 212 | if (bigGun->TurnRate.x > (BGUN_TURN_RATE_MAX / 2)) |
| 213 | bigGun->TurnRate.x = (BGUN_TURN_RATE_MAX / 2); |
| 214 | } |
| 215 | else if (IsHeld(In::Back)) |
| 216 | { |
| 217 | if (bigGun->TurnRate.x > 0) |
| 218 | bigGun->TurnRate.x /= 2; |
| 219 | |
| 220 | bigGun->TurnRate.x -= BGUN_TURN_RATE_ACCEL; |
| 221 | if (bigGun->TurnRate.x < (-BGUN_TURN_RATE_MAX / 2)) |
| 222 | bigGun->TurnRate.x = (-BGUN_TURN_RATE_MAX / 2); |
| 223 | } |
| 224 | else |
| 225 | { |
| 226 | bigGun->TurnRate.x -= bigGun->TurnRate.x / 3; |
| 227 | if (abs(bigGun->TurnRate.x) < BGUN_TURN_RATE_ACCEL) |
| 228 | bigGun->TurnRate.x = 0; |
| 229 | } |
| 230 | |
| 231 | if (IsHeld(In::Left)) |
| 232 | { |
| 233 | if (bigGun->TurnRate.y > 0) |
| 234 | bigGun->TurnRate.y /= 2; |
| 235 | |
| 236 | bigGun->TurnRate.y -= BGUN_TURN_RATE_ACCEL; |
| 237 | if (bigGun->TurnRate.y < -BGUN_TURN_RATE_MAX) |
no test coverage detected