CModel destructor & frame list fixes

This commit is contained in:
Luke Street 2022-03-09 02:23:56 -05:00
parent 8d83afa102
commit d62336b813
6 changed files with 19 additions and 2 deletions

View File

@ -2099,7 +2099,10 @@ void CStateManager::UpdateAreaSounds() {
CSfxManager::SetActiveAreas(areas);
}
void CStateManager::FrameEnd() { g_SimplePool->Flush(); }
void CStateManager::FrameEnd() {
CModel::FrameDone();
g_SimplePool->Flush();
}
void CStateManager::ProcessPlayerInput() {
if (x84c_player) {

View File

@ -102,6 +102,8 @@ IObj* CToken::GetObj() {
return x0_objRef->GetObject();
}
CToken& CToken::operator=(const CToken& other) {
if (this == &other)
return *this;
Unlock();
RemoveRef();
x0_objRef = other.x0_objRef;

View File

@ -133,6 +133,11 @@ CModel::CModel(std::unique_ptr<u8[]> in, u32 dataLen, IObjectStore* store)
// DCFlushRange(x0_data, dataLen);
}
CModel::~CModel() {
RemoveFromList();
sTotalMemory -= x4_dataLen;
}
void CModel::UpdateLastFrame() { x38_lastFrame = CGraphics::GetFrameCounter(); }
void CModel::MoveToThisFrameList() {

View File

@ -92,6 +92,7 @@ private:
public:
CModel(std::unique_ptr<u8[]> in, u32 dataLen, IObjectStore* store);
~CModel();
void UpdateLastFrame();
void MoveToThisFrameList();

View File

@ -168,7 +168,10 @@ void CInGameGuiManager::DoStateTransition(CStateManager& stateMgr) {
}
}
void CInGameGuiManager::DestroyAreaTextures(CStateManager& stateMgr) {}
void CInGameGuiManager::DestroyAreaTextures(CStateManager& stateMgr) {
// TODO
CModel::DisableTextureTimeout();
}
void CInGameGuiManager::TryReloadAreaTextures() {}
@ -270,6 +273,7 @@ void CInGameGuiManager::OnNewPauseScreenState(CArchitectureQueue& archQueue) {
if (x1c0_nextState >= EInGameGuiState::Zero && x1c0_nextState <= EInGameGuiState::InGame) {
if (x44_messageScreen)
x44_messageScreen.reset();
CModel::EnableTextureTimeout();
RefreshHudOptions();
}
x1bc_prevState = x1c0_nextState;

View File

@ -255,6 +255,7 @@ void CMFGame::EnterMapScreen() {
}
CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader") {
CModel::DisableTextureTimeout();
auto* m = static_cast<CMain*>(g_Main);
switch (m->GetFlowState()) {
case EClientFlowStates::Default:
@ -357,6 +358,7 @@ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg,
if (x2c_25_transitionFinished) {
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000,
std::make_shared<CMFGame>(x14_stateMgr, x18_guiMgr, queue)));
CModel::EnableTextureTimeout();
return EMessageReturn::RemoveIOWinAndExit;
}
break;