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

Method Initialize

Sources/Jazz2/LevelHandler.cpp:132–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130 }
131
132 bool LevelHandler::Initialize(const LevelInitialization& levelInit)
133 {
134 ZoneScopedC(0x4876AF);
135
136 _levelName = levelInit.LevelName;
137 _difficulty = levelInit.Difficulty;
138 _isReforged = levelInit.IsReforged;
139 _cheatsUsed = levelInit.CheatsUsed;
140 _elapsedMillisecondsBegin = levelInit.ElapsedMilliseconds;
141
142 auto& resolver = ContentResolver::Get();
143 resolver.BeginLoading();
144
145 _noiseTexture = resolver.GetNoiseTexture();
146
147 _rootNode = std::make_unique<SceneNode>();
148 _rootNode->setVisitOrderState(SceneNode::VisitOrderState::Disabled);
149
150 _console = std::make_unique<UI::InGameConsole>(this);
151
152 auto p = _levelName.partition('/');
153
154 // Try to search also "unknown" directory
155 LevelDescriptor descriptor;
156 if (!resolver.TryLoadLevel(_levelName, _difficulty, descriptor) &&
157 (p[0] == "unknown"_s || !resolver.TryLoadLevel(String("unknown/"_s + p[2]), _difficulty, descriptor))) {
158 LOGE("Cannot load level \"{}\"", _levelName);
159 return false;
160 }
161
162 _console->WriteLine(UI::MessageLevel::Debug, _f("Level \"{}\" initialized", descriptor.DisplayName));
163
164 AttachComponents(std::move(descriptor));
165 SpawnPlayers(levelInit);
166
167 OnInitialized();
168 resolver.EndLoading();
169
170 return true;
171 }
172
173 bool LevelHandler::Initialize(Stream& src, std::uint16_t version)
174 {

Callers 1

OnInitializeViewportMethod · 0.45

Calls 15

_fFunction · 0.85
BeginLoadingMethod · 0.80
GetNoiseTextureMethod · 0.80
setVisitOrderStateMethod · 0.80
TryLoadLevelMethod · 0.80
WriteLineMethod · 0.80
EndLoadingMethod · 0.80
ReadVariableUint64Method · 0.80
BeginFadeInMethod · 0.80
StringClass · 0.50
partitionMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected