| 342 | } |
| 343 | |
| 344 | void JJ2Level::LoadMlleData(JJ2Block& block, std::uint32_t version, StringView path, bool strictParser) |
| 345 | { |
| 346 | if (version > 0x107) { |
| 347 | LOGW("MLLE stream version 0x{:x} in level \"{}\" is not supported", version, LevelName); |
| 348 | return; |
| 349 | } |
| 350 | |
| 351 | bool isSnowing = block.ReadBool(); |
| 352 | bool isSnowingOutdoorsOnly = block.ReadBool(); |
| 353 | std::uint8_t snowIntensity = block.ReadByte(); |
| 354 | // Weather particles type (Snow, Flower, Rain, Leaf) |
| 355 | std::uint8_t snowType = block.ReadByte(); |
| 356 | |
| 357 | if (isSnowing) { |
| 358 | _weatherIntensity = snowIntensity; |
| 359 | _weatherType = (WeatherType)(snowType + 1); |
| 360 | if (_weatherType != WeatherType::None && isSnowingOutdoorsOnly) { |
| 361 | _weatherType |= WeatherType::OutdoorsOnly; |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | // TODO: Convert remaining coins to gems when warp is used |
| 366 | bool warpsTransmuteCoins = block.ReadBool(); |
| 367 | // TODO: Objects spawned from Generators will derive their parameters from tile they first appear at (e.g., after gravitation) |
| 368 | bool delayGeneratedCrateOrigins = block.ReadBool(); |
| 369 | std::int32_t echo = block.ReadInt32(); |
| 370 | std::uint32_t darknessColorBgra = block.ReadUInt32(); |
| 371 | _darknessColor = ((darknessColorBgra >> 16) & 0xff) | (darknessColorBgra & 0x0000ff00) | ((darknessColorBgra << 16) & 0x00ff0000); |
| 372 | // TODO: Water level change speed |
| 373 | float waterChangeSpeed = block.ReadFloat(); |
| 374 | // TODO: How player should react to being underwater (PositionBased, Swim, LowGravity) |
| 375 | std::uint8_t waterInteraction = block.ReadByte(); |
| 376 | std::int32_t waterLayer = block.ReadInt32(); |
| 377 | // TODO: How water and ambient lighting should interact in the level (None, Global, Lagunicus) |
| 378 | std::uint8_t waterLighting = block.ReadByte(); |
| 379 | _waterLevel = (std::uint16_t)block.ReadFloat(); |
| 380 | std::uint32_t waterGradientStart = block.ReadUInt32(); |
| 381 | std::uint32_t waterGradientStop = block.ReadUInt32(); |
| 382 | |
| 383 | // Level palette |
| 384 | _useLevelPalette = block.ReadBool(); |
| 385 | if (_useLevelPalette) { |
| 386 | block.ReadRawBytes(_levelPalette, sizeof(_levelPalette)); |
| 387 | |
| 388 | if (version >= 0x106) { |
| 389 | // TODO: Reapply palette on death |
| 390 | bool reapplyPaletteOnDeath = block.ReadBool(); |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | // Additional palettes for SPRITE::MAPPING and 24-bit tile sets |
| 395 | if (version >= 0x106) { |
| 396 | std::uint8_t extraPaletteCount = block.ReadByte(); |
| 397 | while (extraPaletteCount-- != 0) { |
| 398 | auto& palette = AlternatePalettes.emplace_back(); |
| 399 | std::int32_t nameLength = block.ReadUint7bitEncoded(); |
| 400 | palette.Name = String(NoInit, nameLength); |
| 401 | block.ReadRawBytes((std::uint8_t*)palette.Name.data(), nameLength); |
nothing calls this directly
no test coverage detected