MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / OnTileFrozen

Method OnTileFrozen

Sources/Jazz2/LevelHandler.cpp:1496–1522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494 }
1495
1496 void LevelHandler::OnTileFrozen(std::int32_t x, std::int32_t y)
1497 {
1498 bool iceBlockFound = false;
1499 FindCollisionActorsByAABB(nullptr, AABBf(x - 1.0f, y - 1.0f, x + 1.0f, y + 1.0f), [&iceBlockFound](Actors::ActorBase* actor) -> bool {
1500 if ((actor->GetState() & Actors::ActorState::IsDestroyed) != Actors::ActorState::None) {
1501 return true;
1502 }
1503
1504 auto* iceBlock = runtime_cast<Actors::Environment::IceBlock>(actor);
1505 if (iceBlock != nullptr) {
1506 iceBlock->ResetTimeLeft();
1507 iceBlockFound = true;
1508 return false;
1509 }
1510
1511 return true;
1512 });
1513
1514 if (!iceBlockFound) {
1515 std::shared_ptr<Actors::Environment::IceBlock> iceBlock = std::make_shared<Actors::Environment::IceBlock>();
1516 iceBlock->OnActivated(Actors::ActorActivationDetails(
1517 this,
1518 Vector3i(x - 1, y - 2, ILevelHandler::MainPlaneZ)
1519 ));
1520 AddActor(iceBlock);
1521 }
1522 }
1523
1524 void LevelHandler::BeforeActorDestroyed(Actors::ActorBase* actor)
1525 {

Callers 1

IsTileEmptyMethod · 0.80

Calls 4

ResetTimeLeftMethod · 0.80
GetStateMethod · 0.45
OnActivatedMethod · 0.45

Tested by

no test coverage detected