| 431 | } |
| 432 | |
| 433 | void EpisodeSelectSection::OnAfterTransition() |
| 434 | { |
| 435 | auto& selectedItem = _items[_selectedIndex]; |
| 436 | auto* episodeContinue = PreferencesCache::GetEpisodeContinue(selectedItem.Item.Description.Name); |
| 437 | |
| 438 | PlayerType players[] = { (PlayerType)((episodeContinue->State.DifficultyAndPlayerType >> 4) & 0x0f) }; |
| 439 | LevelInitialization levelInit(String(selectedItem.Item.Description.Name + '/' + episodeContinue->LevelName), (GameDifficulty)(episodeContinue->State.DifficultyAndPlayerType & 0x0f), |
| 440 | PreferencesCache::EnableReforgedGameplay, false, players); |
| 441 | |
| 442 | if ((episodeContinue->State.Flags & EpisodeContinuationFlags::CheatsUsed) == EpisodeContinuationFlags::CheatsUsed) { |
| 443 | levelInit.CheatsUsed = true; |
| 444 | } |
| 445 | levelInit.ElapsedMilliseconds = episodeContinue->State.ElapsedMilliseconds; |
| 446 | |
| 447 | auto& firstPlayer = levelInit.PlayerCarryOvers[0]; |
| 448 | firstPlayer.Lives = episodeContinue->State.Lives; |
| 449 | firstPlayer.Score = episodeContinue->State.Score; |
| 450 | std::memcpy(firstPlayer.Gems, episodeContinue->State.Gems, sizeof(firstPlayer.Gems)); |
| 451 | std::memcpy(firstPlayer.Ammo, episodeContinue->State.Ammo, sizeof(firstPlayer.Ammo)); |
| 452 | std::memcpy(firstPlayer.WeaponUpgrades, episodeContinue->State.WeaponUpgrades, sizeof(firstPlayer.WeaponUpgrades)); |
| 453 | |
| 454 | _root->ChangeLevel(std::move(levelInit)); |
| 455 | } |
| 456 | |
| 457 | void EpisodeSelectSection::AddEpisode(StringView episodeFile) |
| 458 | { |
nothing calls this directly
no test coverage detected