| 329 | } |
| 330 | |
| 331 | void Scene_Map::FinishPendingTeleport2(MapUpdateAsyncContext actx, TeleportParams tp) { |
| 332 | PreUpdate(actx); |
| 333 | |
| 334 | if (actx.IsActive()) { |
| 335 | OnAsyncSuspend([=] { FinishPendingTeleport2(actx, tp); }, actx.GetAsyncOp(), true); |
| 336 | return; |
| 337 | } |
| 338 | |
| 339 | if (!tp.defer_recursive_teleports) { |
| 340 | // RPG_RT behavior - Escape and Teleport skills silently ignore any teleport commands |
| 341 | // executed by events during pre-update frame and defer them until first frame. |
| 342 | if (Main_Data::game_player->IsPendingTeleport()) { |
| 343 | tp.erase_screen = false; |
| 344 | StartPendingTeleport(tp); |
| 345 | return; |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | auto& transition = Transition::instance(); |
| 350 | |
| 351 | // This logic was tested against RPG_RT and works this way ... |
| 352 | if (tp.use_default_transition_in && transition.IsErasedNotActive()) { |
| 353 | transition.InitShow(Transition::TransitionFadeIn, this); |
| 354 | } else if (!tp.use_default_transition_in && !screen_erased_by_event) { |
| 355 | transition.InitShow(Main_Data::game_system->GetTransition(Main_Data::game_system->Transition_TeleportShow), this); |
| 356 | } |
| 357 | |
| 358 | // Call any requested scenes when transition is done. |
| 359 | AsyncNext([=]() { FinishPendingTeleport3(actx, tp); }); |
| 360 | } |
| 361 | |
| 362 | void Scene_Map::FinishPendingTeleport3(MapUpdateAsyncContext actx, TeleportParams tp) { |
| 363 | if (tp.run_foreground_events) { |
nothing calls this directly
no test coverage detected