| 344 | } |
| 345 | |
| 346 | void LoadPlayer(LoadHelper &file, Player &player) |
| 347 | { |
| 348 | player._pmode = static_cast<PLR_MODE>(file.NextLE<int32_t>()); |
| 349 | |
| 350 | for (int8_t &step : player.walkpath) { |
| 351 | step = file.NextLE<int8_t>(); |
| 352 | } |
| 353 | player.plractive = file.NextBool8(); |
| 354 | file.Skip(2); // Alignment |
| 355 | player.destAction = static_cast<action_id>(file.NextLE<int32_t>()); |
| 356 | player.destParam1 = file.NextLE<int32_t>(); |
| 357 | player.destParam2 = file.NextLE<int32_t>(); |
| 358 | player.destParam3 = file.NextLE<int32_t>(); |
| 359 | player.destParam4 = file.NextLE<int32_t>(); |
| 360 | player.setLevel(file.NextLE<uint32_t>()); |
| 361 | player.position.tile.x = file.NextLE<int32_t>(); |
| 362 | player.position.tile.y = file.NextLE<int32_t>(); |
| 363 | player.position.future.x = file.NextLE<int32_t>(); |
| 364 | player.position.future.y = file.NextLE<int32_t>(); |
| 365 | file.Skip<uint32_t>(2); // Skip _ptargx and _ptargy |
| 366 | player.position.last.x = file.NextLE<int32_t>(); |
| 367 | player.position.last.y = file.NextLE<int32_t>(); |
| 368 | player.position.old.x = file.NextLE<int32_t>(); |
| 369 | player.position.old.y = file.NextLE<int32_t>(); |
| 370 | file.Skip<int32_t>(4); // Skip offset and velocity |
| 371 | player._pdir = static_cast<Direction>(file.NextLE<int32_t>()); |
| 372 | file.Skip(4); // Unused |
| 373 | player._pgfxnum = file.NextLENarrow<uint32_t, uint8_t>(); |
| 374 | file.Skip<uint32_t>(); // Skip pointer pData |
| 375 | player.AnimInfo = {}; |
| 376 | player.AnimInfo.ticksPerFrame = file.NextLENarrow<int32_t, int8_t>(1); |
| 377 | player.AnimInfo.tickCounterOfCurrentFrame = file.NextLENarrow<int32_t, int8_t>(); |
| 378 | player.AnimInfo.numberOfFrames = file.NextLENarrow<int32_t, int8_t>(); |
| 379 | player.AnimInfo.currentFrame = file.NextLENarrow<int32_t, int8_t>(-1); |
| 380 | file.Skip<uint32_t>(3); // Skip _pAnimWidth, _pAnimWidth2, _peflag |
| 381 | player.lightId = file.NextLE<int32_t>(); |
| 382 | file.Skip<int32_t>(); // _pvid |
| 383 | |
| 384 | player.queuedSpell.spellId = static_cast<SpellID>(file.NextLE<int32_t>()); |
| 385 | player.queuedSpell.spellType = static_cast<SpellType>(file.NextLE<int8_t>()); |
| 386 | auto spellFrom = file.NextLE<int8_t>(); |
| 387 | if (!IsValidSpellFrom(spellFrom)) |
| 388 | spellFrom = 0; |
| 389 | player.spellFrom = spellFrom; |
| 390 | player.queuedSpell.spellFrom = spellFrom; |
| 391 | file.Skip(2); // Alignment |
| 392 | player.inventorySpell = static_cast<SpellID>(file.NextLE<int32_t>()); |
| 393 | file.Skip<int8_t>(); // Skip _pTSplType |
| 394 | file.Skip(3); // Alignment |
| 395 | player._pRSpell = static_cast<SpellID>(file.NextLE<int32_t>()); |
| 396 | player._pRSplType = static_cast<SpellType>(file.NextLE<int8_t>()); |
| 397 | file.Skip(3); // Alignment |
| 398 | player._pSBkSpell = static_cast<SpellID>(file.NextLE<int32_t>()); |
| 399 | file.Skip<int8_t>(); // Skip _pSBkSplType |
| 400 | for (uint8_t &spellLevel : player._pSplLvl) |
| 401 | spellLevel = file.NextLE<uint8_t>(); |
| 402 | file.Skip(7); // Alignment |
| 403 | player._pMemSpells = file.NextLE<uint64_t>(); |
no test coverage detected