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

Method OnAfterTransition

Sources/Jazz2/UI/Menu/EpisodeSelectSection.cpp:433–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 2

StringClass · 0.50
ChangeLevelMethod · 0.45

Tested by

no test coverage detected