Minor fixes in CGameState and CScriptEffect

This commit is contained in:
Phillip Stephens 2019-02-24 15:04:10 -08:00
parent d78e90f593
commit 5ebf465a53
2 changed files with 8 additions and 6 deletions

View File

@ -99,7 +99,7 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data) {
ret.x20_hardMode = stream.ReadEncoded(1); ret.x20_hardMode = stream.ReadEncoded(1);
stream.ReadEncoded(1); stream.ReadEncoded(1);
CAssetId origMLVL = stream.ReadEncoded(32); CAssetId origMLVL = u32(stream.ReadEncoded(32));
ret.x8_mlvlId = g_ResFactory->TranslateOriginalToNew(origMLVL); ret.x8_mlvlId = g_ResFactory->TranslateOriginalToNew(origMLVL);
BitsToDouble conv; BitsToDouble conv;
@ -146,7 +146,7 @@ CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx
x228_24_hardMode = stream.ReadEncoded(1); x228_24_hardMode = stream.ReadEncoded(1);
x228_25_initPowerupsAtFirstSpawn = stream.ReadEncoded(1); x228_25_initPowerupsAtFirstSpawn = stream.ReadEncoded(1);
x84_mlvlId = g_ResFactory->TranslateOriginalToNew(stream.ReadEncoded(32)); x84_mlvlId = g_ResFactory->TranslateOriginalToNew(u32(stream.ReadEncoded(32)));
MP1::CMain::EnsureWorldPakReady(x84_mlvlId); MP1::CMain::EnsureWorldPakReady(x84_mlvlId);
BitsToDouble conv; BitsToDouble conv;

View File

@ -163,10 +163,12 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
if (playIds.size() > 0) { if (playIds.size() > 0) {
TCastToConstPtr<CActor> otherAct = TCastToConstPtr<CActor> otherAct =
mgr.GetObjectById(playIds[u32(0.99f * playIds.size() * mgr.GetActiveRandom()->Float())]); mgr.GetObjectById(playIds[u32(0.99f * playIds.size() * mgr.GetActiveRandom()->Float())]);
if (otherAct) if (otherAct) {
light->SetTransform(otherAct->GetTransform()); if (light)
else light->SetTransform(otherAct->GetTransform());
light->SetTransform(GetTransform()); else
SetTransform(otherAct->GetTransform());
}
} }
x110_24_enable = true; x110_24_enable = true;
if (x104_particleSystem) if (x104_particleSystem)