Commit 77b61b0e authored by Phillip Stephens's avatar Phillip Stephens

Fix saves sending you to incorrect rooms, fix triggers

parent 1a5179fe
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment