MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / FreeThisLevel

Function FreeThisLevel

Descent3/gamesequence.cpp:1768–1826  ·  view source on GitHub ↗

frees any data/esc that was created for that level

Source from the content-addressed store, hash-verified

1766
1767// frees any data/esc that was created for that level
1768void FreeThisLevel() {
1769 if (!Level_started)
1770 return;
1771
1772 bool original_controls = Control_poll_flag;
1773
1774 Cinematic_Stop();
1775
1776 // make sure our controls are correct (this is needed for failed missions)
1777 if (Control_poll_flag != original_controls) {
1778 if (Control_poll_flag)
1779 SuspendControls();
1780 else
1781 ResumeControls();
1782 }
1783
1784 Multi_bail_ui_menu = false;
1785
1786 DemoAbort();
1787
1788 // closes hud.
1789 FreeCockpit();
1790 CloseShipHUD();
1791
1792 // end music sequencer's run.
1793 D3MusicStop();
1794
1795 FreeScriptsForLevel();
1796 ClearAllEvents();
1797
1798 // Resets the ambient life controller
1799 a_life.ALReset();
1800
1801 DestroyAllMatcens();
1802 Level_goals.CleanupAfterLevel();
1803
1804 Sound_system.StopAllSounds();
1805
1806 // Clear out all memory that was used for this past level
1807 FlushDataCache();
1808
1809 InitGamePaths(); // DAJ LEAKFIX
1810
1811 DSSoarEnd();
1812
1813 // Reset the camera if need be
1814 if (Player_camera_objnum != -1) {
1815 SetObjectDeadFlag(&Objects[Player_camera_objnum]);
1816 Player_camera_objnum = -1;
1817 Viewer_object = &Objects[Players[Player_num].objnum];
1818 }
1819
1820 ResetHUDMessages();
1821
1822 DestroyDefaultBSPTree();
1823
1824 Level_started = false;
1825 IsRestoredGame = false;

Callers 2

GameSequencerFunction · 0.85
EndLevelFunction · 0.85

Calls 15

Cinematic_StopFunction · 0.85
SuspendControlsFunction · 0.85
ResumeControlsFunction · 0.85
DemoAbortFunction · 0.85
FreeCockpitFunction · 0.85
CloseShipHUDFunction · 0.85
D3MusicStopFunction · 0.85
FreeScriptsForLevelFunction · 0.85
ClearAllEventsFunction · 0.85
FlushDataCacheFunction · 0.85
InitGamePathsFunction · 0.85
DSSoarEndFunction · 0.85

Tested by

no test coverage detected