///////////////////////////////////////////////////////////////////// clear everything out before loading a checkpoint
| 525 | ////////////////////////////////////////////////////////////////////////// |
| 526 | //clear everything out before loading a checkpoint |
| 527 | void CCheckpointSystem::ResetEngine() |
| 528 | { |
| 529 | //let game do initial resetting |
| 530 | if (m_pGameHandler) |
| 531 | { |
| 532 | m_pGameHandler->OnPreResetEngine(); |
| 533 | } |
| 534 | |
| 535 | //turn off physics |
| 536 | gEnv->pSystem->SetThreadState(ESubsys_Physics, false); |
| 537 | |
| 538 | //reset engine similar to editor when leaving game mode |
| 539 | //broken geometry and dynamics |
| 540 | CCryAction::GetCryAction()->FlushBreakableObjects(); |
| 541 | DeleteDynamicEntities(); |
| 542 | CCryAction::GetCryAction()->ResetBrokenGameObjects(); |
| 543 | |
| 544 | //this should just reset the velocity of all moving things, but instead vehicle doors fall off ... |
| 545 | //CXP : add this back in after CXP, Anton has to fix it |
| 546 | //gEnv->pPhysicalWorld->ResetDynamicEntities(); |
| 547 | |
| 548 | //particle and post process effects |
| 549 | gEnv->p3DEngine->ResetPostEffects(); |
| 550 | gEnv->p3DEngine->ResetParticlesAndDecals(); |
| 551 | |
| 552 | REINST("notify the audio system?"); |
| 553 | |
| 554 | //AI System |
| 555 | if (gEnv->pAISystem) |
| 556 | { |
| 557 | gEnv->pAISystem->Reset(IAISystem::RESET_EXIT_GAME); |
| 558 | gEnv->pAISystem->Reset(IAISystem::RESET_ENTER_GAME); |
| 559 | } |
| 560 | |
| 561 | //flow system |
| 562 | |
| 563 | //reset trackview |
| 564 | gEnv->pMovieSystem->Reset(true, true); |
| 565 | |
| 566 | //entity system |
| 567 | SEntityEvent event; |
| 568 | event.event = ENTITY_EVENT_RESET; |
| 569 | event.nParam[0] = 0; |
| 570 | gEnv->pEntitySystem->SendEventToAll(event); |
| 571 | |
| 572 | //Vehicle System |
| 573 | IVehicleSystem* pVehicleSystem = CCryAction::GetCryAction()->GetIVehicleSystem(); |
| 574 | IVehicleIteratorPtr pVehIt = pVehicleSystem->CreateVehicleIterator(); |
| 575 | while (IVehicle* pVehicle = pVehIt->Next()) |
| 576 | { |
| 577 | pVehicle->Reset(true); |
| 578 | } |
| 579 | |
| 580 | //make sure the scripts are clean |
| 581 | gEnv->pScriptSystem->ForceGarbageCollection(); |
| 582 | |
| 583 | //turn on physics again |
| 584 | gEnv->pSystem->SetThreadState(ESubsys_Physics, true); |
nothing calls this directly
no test coverage detected