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

Function InitializeLaraLevelJump

TombEngine/Game/Lara/lara_initialise.cpp:266–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void InitializeLaraLevelJump(ItemInfo* item, LaraInfo* playerBackup)
267{
268 auto& player = GetLaraInfo(*item);
269
270 // Restore inventory.
271 player.Inventory = playerBackup->Inventory;
272 player.Status = playerBackup->Status;
273 player.Control.Weapon.LastGunType = playerBackup->Control.Weapon.LastGunType;
274 memcpy(&player.Weapons, &playerBackup->Weapons, sizeof(CarriedWeaponInfo) * int(LaraWeaponType::NumWeapons));
275
276 // Restore holsters. First attempt restoring original holster data, then refer to selected weapons.
277 player.Control.Weapon.HolsterInfo = playerBackup->Control.Weapon.HolsterInfo;
278
279 if ((player.Control.Weapon.HolsterInfo.RightHolster == HolsterSlot::Empty ||
280 player.Control.Weapon.HolsterInfo.LeftHolster == HolsterSlot::Empty) &&
281 player.Control.Weapon.LastGunType <= LaraWeaponType::Uzi)
282 {
283 UndrawPistolMesh(*item, player.Control.Weapon.LastGunType, true);
284 UndrawPistolMesh(*item, player.Control.Weapon.LastGunType, false);
285 }
286
287 if (player.Control.Weapon.HolsterInfo.BackHolster == HolsterSlot::Empty &&
288 player.Control.Weapon.LastGunType > LaraWeaponType::Uzi)
289 {
290 UndrawShotgunMeshes(*item, player.Control.Weapon.LastGunType);
291 }
292
293 // Restore flare.
294 if (playerBackup->Control.Weapon.GunType == LaraWeaponType::Flare)
295 {
296 player.LeftArm = playerBackup->LeftArm;
297 player.RightArm = playerBackup->RightArm;
298 player.Control.HandStatus = playerBackup->Control.HandStatus;
299 player.Control.Weapon = playerBackup->Control.Weapon;
300 player.Flare = playerBackup->Flare;
301 DrawFlareMeshes(*item);
302 }
303
304 // Restore hit points.
305 item->HitPoints = PlayerHitPoints;
306}
307
308void InitializeLaraDefaultInventory(ItemInfo& item)
309{

Callers 1

InitializeLaraFunction · 0.85

Calls 3

UndrawPistolMeshFunction · 0.85
UndrawShotgunMeshesFunction · 0.85
DrawFlareMeshesFunction · 0.85

Tested by

no test coverage detected