| 345 | } |
| 346 | |
| 347 | void Tile::updateBattlescapeParameters() |
| 348 | { |
| 349 | if (map.ceaseUpdates) |
| 350 | { |
| 351 | return; |
| 352 | } |
| 353 | bool providedGroundUpwards = solidGround && height >= 0.9625f; |
| 354 | height = 0.0f; |
| 355 | movementCostIn = -1; // -1 means empty, and will be set to 4 afterwards |
| 356 | movementCostOver = 255; |
| 357 | movementCostLeft = 0; |
| 358 | movementCostRight = 0; |
| 359 | solidGround = false; |
| 360 | canStand = false; |
| 361 | hasLift = false; |
| 362 | hasExit = false; |
| 363 | walkSfx = nullptr; |
| 364 | objectDropSfx = nullptr; |
| 365 | supportProviderForItems = nullptr; |
| 366 | closedDoorLeft = false; |
| 367 | closedDoorRight = false; |
| 368 | for (auto &o : ownedObjects) |
| 369 | { |
| 370 | if (o->getType() == TileObject::Type::Ground || o->getType() == TileObject::Type::Feature) |
| 371 | { |
| 372 | auto mp = std::static_pointer_cast<TileObjectBattleMapPart>(o)->getOwner(); |
| 373 | if (!mp->isAlive()) |
| 374 | { |
| 375 | continue; |
| 376 | } |
| 377 | height = std::max(height, (float)mp->type->height); |
| 378 | if (mp->type->floor || |
| 379 | (o->getType() == TileObject::Type::Feature && !mp->type->gravlift)) |
| 380 | { |
| 381 | if (!supportProviderForItems || |
| 382 | supportProviderForItems->type->height < mp->type->height) |
| 383 | { |
| 384 | supportProviderForItems = mp; |
| 385 | } |
| 386 | } |
| 387 | solidGround = solidGround || (mp->type->floor && !mp->type->gravlift) || |
| 388 | (o->getType() == TileObject::Type::Feature && !mp->type->gravlift); |
| 389 | hasLift = hasLift || mp->type->gravlift; |
| 390 | hasExit = hasExit || mp->type->exit; |
| 391 | movementCostIn = std::max(movementCostIn, mp->type->movement_cost); |
| 392 | if (mp->type->sfxIndex != -1) |
| 393 | { |
| 394 | walkSfx = mp->type->walkSounds; |
| 395 | objectDropSfx = mp->type->objectDropSound; |
| 396 | } |
| 397 | } |
| 398 | if (o->getType() == TileObject::Type::LeftWall) |
| 399 | { |
| 400 | auto mp = std::static_pointer_cast<TileObjectBattleMapPart>(o)->getOwner(); |
| 401 | if (!mp->isAlive()) |
| 402 | { |
| 403 | continue; |
| 404 | } |
no test coverage detected