Fix saves sending you to incorrect rooms, fix triggers

This commit is contained in:
Phillip Stephens 2019-11-05 09:18:14 -08:00
parent 1a5179feb2
commit 77b61b0e68
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
4 changed files with 11 additions and 7 deletions

View File

@ -83,7 +83,7 @@ CWorldState::CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CSaveW
void CWorldState::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const {
writer.WriteEncoded(x4_areaId, 32);
writer.WriteEncoded(x10_desiredAreaAssetId.Value(), 32);
writer.WriteEncoded(u32(x10_desiredAreaAssetId.Value()), 32);
x8_relayTracker->PutTo(writer, savw);
xc_mapWorldInfo->PutTo(writer, savw, x0_mlvlId);
x14_layerState->PutTo(writer);
@ -209,7 +209,7 @@ void CGameState::PutTo(CBitStreamWriter& writer) const {
writer.WriteEncoded(CBasics::ToWiiTime(std::chrono::system_clock::now()) / CBasics::TICKS_PER_SECOND, 32);
writer.WriteEncoded(x228_24_hardMode, 1);
writer.WriteEncoded(x228_25_initPowerupsAtFirstSpawn, 1);
writer.WriteEncoded(x84_mlvlId.Value(), 32);
writer.WriteEncoded(u32(x84_mlvlId.Value()), 32);
BitsToDouble conv;
conv.doub = xa0_playTime;

View File

@ -38,8 +38,10 @@ public:
: boo::DeviceFinder({dev_typeid(DolphinSmashAdapter)}), m_leftDiv(leftDiv), m_rightDiv(rightDiv) {}
~CInputGenerator() override {
if (smashAdapter)
if (smashAdapter) {
smashAdapter->setCallback(nullptr);
smashAdapter->closeDevice();
}
}
/* Keyboard and mouse events are delivered on the main game

View File

@ -332,8 +332,10 @@ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg,
return EMessageReturn::Exit;
}
if (!x18_guiMgr)
if (!x18_guiMgr) {
g_GameState->CurrentWorldState().SetDesiredAreaAssetId(CAssetId());
x18_guiMgr = std::make_shared<CInGameGuiManager>(*x14_stateMgr, queue);
}
if (!x18_guiMgr->CheckLoadComplete(*x14_stateMgr))
return EMessageReturn::Exit;

View File

@ -179,18 +179,18 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr) {
x148_25_camSubmerged = true;
if (True(x12c_flags & ETriggerFlags::DetectCamera)) {
InhabitantAdded(*cam, mgr);
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::Activate);
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None);
}
}
}
}
if (sendInside) {
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::Activate);
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None);
}
if (sendExited) {
SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::Activate);
SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::None);
if (x148_27_deactivateOnExited) {
mgr.SendScriptMsg(GetUniqueId(), mgr.GetEditorIdForUniqueId(GetUniqueId()), EScriptObjectMessage::Deactivate,
EScriptObjectState::Exited);