MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / ParseEffects

Function ParseEffects

TombEngine/Game/savegame.cpp:2377–2608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2375}
2376
2377static void ParseEffects(const Save::SaveGame* s)
2378{
2379 // Restore camera FOV.
2380 AlterFOV(s->current_fov());
2381
2382 // Restore postprocess effects.
2383 g_Renderer.SetPostProcessMode((PostProcessMode)s->postprocess_mode());
2384 g_Renderer.SetPostProcessStrength(s->postprocess_strength());
2385 g_Renderer.SetPostProcessTint(ToVector3(s->postprocess_tint()));
2386
2387 // Restore soundtracks.
2388 for (int i = 0; i < s->soundtracks()->size(); i++)
2389 {
2390 TENAssert(i < (int)SoundTrackType::Count, "Soundtrack type count was changed");
2391
2392 auto track = s->soundtracks()->Get(i);
2393 PlaySoundTrack(track->name()->str(), (SoundTrackType)i, track->position(), SOUND_XFADETIME_LEVELJUMP);
2394 }
2395
2396 // Restore video playback.
2397 std::string videoName = s->video()->name()->str();
2398 if (!videoName.empty())
2399 {
2400 g_VideoPlayer.Play(videoName, VideoPlaybackMode::Background, s->video()->silent(), s->video()->looped());
2401 g_VideoPlayer.SetNormalizedPosition(s->video()->position());
2402 }
2403
2404 // Load fish swarm.
2405 for (int i = 0; i < s->fish_swarm()->size(); i++)
2406 {
2407 const auto& fishSave = s->fish_swarm()->Get(i);
2408 auto fish = FishData{};
2409
2410 fish.IsLethal = fishSave->is_lethal();
2411 fish.IsPatrolling = fishSave->is_patrolling();
2412 fish.LeaderItemPtr = (fishSave->leader_item_number() == -1) ? nullptr : &g_Level.Items[fishSave->leader_item_number()];
2413 fish.Life = fishSave->life();
2414 fish.MeshIndex = fishSave->mesh_index();
2415 fish.Orientation = ToEulerAngles(fishSave->orientation());
2416 fish.Position = ToVector3i(fishSave->position());
2417 fish.PositionTarget = ToVector3i(fishSave->position_target());
2418 fish.RoomNumber = fishSave->room_number();
2419 fish.TargetItemPtr = (fishSave->target_item_number() == -1) ? nullptr : &g_Level.Items[fishSave->target_item_number()];
2420 fish.Undulation = fishSave->undulation();
2421 fish.Velocity = fishSave->velocity();
2422
2423 FishSwarm.push_back(fish);
2424 }
2425
2426 // Load firefly swarm.
2427 for (int i = 0; i < s->firefly_swarm()->size(); i++)
2428 {
2429 const auto& fireflySave = s->firefly_swarm()->Get(i);
2430 auto firefly = FireflyData{};
2431
2432 firefly.SpriteSeqID = fireflySave->sprite_index();
2433 firefly.SpriteID = fireflySave->sprite_id();
2434 firefly.blendMode = (BlendMode)fireflySave->blend_mode();

Callers 1

ParseMethod · 0.85

Calls 15

AlterFOVFunction · 0.85
ToVector3Function · 0.85
TENAssertFunction · 0.85
PlaySoundTrackFunction · 0.85
ToEulerAnglesFunction · 0.85
ToVector3iFunction · 0.85
ToPoseFunction · 0.85
ToVector4Function · 0.85
SetPostProcessModeMethod · 0.80
SetPostProcessTintMethod · 0.80
SetNormalizedPositionMethod · 0.80

Tested by

no test coverage detected