More CGameArea and CActor imps

This commit is contained in:
Phillip Stephens 2016-08-09 17:46:53 -07:00
parent 6972926b66
commit 7740af2b04
5 changed files with 58 additions and 35 deletions

View File

@ -197,8 +197,8 @@ void CStateManager::UpdateThermalVisor()
std::unique_ptr<CGameArea>& connArea = x850_world->GetGameAreas()[x8cc_nextAreaId];
if (connArea->IsPostConstructed())
{
u32 something = connArea->GetPostConstructed()->x10dc_;
if (something == 1)
CGameArea::EOcclusionState occState = connArea->GetPostConstructed()->x10dc_occlusionState;
if (occState == CGameArea::EOcclusionState::Occluded)
{
closestDist = dist;
lastArea = connArea.get();

View File

@ -223,4 +223,15 @@ void CActor::SetSfxPitchBend(s32 val)
CSfxManager::PitchBend(*x8c_sfxHandle.get(), val);
}
void CActor::OnScanStateChanged(EScanState state, CStateManager& mgr)
{
if (state == EScanState::Zero)
SendScriptMsgs(EScriptObjectState::UNKS7, mgr, EScriptObjectMessage::None);
else if (state == EScanState::One)
SendScriptMsgs(EScriptObjectState::UNKS8, mgr, EScriptObjectMessage::None);
else if (state == EScanState::Two)
SendScriptMsgs(EScriptObjectState::ScanDone, mgr, EScriptObjectMessage::None);
}
}

View File

@ -45,43 +45,28 @@ protected:
bool xe4_28_ : 1;
bool xe4_29_ : 1;
bool xe4_30_ : 1;
};
u8 _dummy1 = 0;
};
union
{
struct
{
bool xe5_0_opaque : 1;
bool xe5_26_muted : 1;
bool xe5_27_useInSortedLists : 1;
bool xe5_28_callTouch : 1;
};
u8 _dummy2 = 0;
};
union
{
struct
{
bool xe6_26_inFluid : 1;
bool xe6_30_enablePitchBend : 1;
};
u8 _dummy3 = 0;
};
union
{
struct
{
bool xe7_29_ : 1;
};
u8 _dummy4 = 0;
u32 dummy = 0;
};
public:
enum class EFluidState
{
};
enum class EScanState
{
Zero,
One,
Two,
};
CActor(TUniqueId, bool, const std::string&, const CEntityInfo&,
const zeus::CTransform&, CModelData&&, const CMaterialList&,
const CActorParameters&, TUniqueId);
@ -111,7 +96,8 @@ public:
void RemoveEmitter();
virtual rstl::optional_object<zeus::CAABox> GetTouchBounds() const { return {} ; }
virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&, int);
virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
CWeaponMode&, int);
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
@ -138,6 +124,8 @@ public:
bool HasModelData() const;
const CSfxHandle* GetSfxHandle() const;
void SetSfxPitchBend(s32);
virtual void OnScanStateChanged(EScanState, CStateManager&);
};
}

View File

@ -504,7 +504,7 @@ void CGameArea::UpdateThermalVisor(float dt)
void CGameArea::AliveUpdate(float dt)
{
if (!x12c_postConstructed->x10dc_)
if (x12c_postConstructed->x10dc_occlusionState == EOcclusionState::NotOccluded)
x12c_postConstructed->x10e4_ += dt;
else
x12c_postConstructed->x10e4_ = 0.f;
@ -515,23 +515,38 @@ void CGameArea::AliveUpdate(float dt)
void CGameArea::SetOcclusionState(EOcclusionState state)
{
if (!xf0_24_postConstructed || x12c_postConstructed->x10dc_occlusionState == state)
return;
if (state == EOcclusionState::NotOccluded)
{
ReloadAllUnloadedTextures();
AddStaticGeometry();
}
else
{
x12c_postConstructed->x1108_26_ = true;
x12c_postConstructed->x1108_27_ = false;
RemoveStaticGeometry();
}
}
void CGameArea::RemoveStaticGeometry()
{
if (!xf0_24_postConstructed || !x12c_postConstructed || !x12c_postConstructed->x10dc_)
if (!xf0_24_postConstructed || !x12c_postConstructed ||
x12c_postConstructed->x10dc_occlusionState == EOcclusionState::NotOccluded)
return;
x12c_postConstructed->x10e0_ = 0;
x12c_postConstructed->x10dc_ = 0;
x12c_postConstructed->x10dc_occlusionState = EOcclusionState::NotOccluded;
g_Renderer->RemoveStaticGeometry(&x12c_postConstructed->x4c_insts);
}
void CGameArea::AddStaticGeometry()
{
if (x12c_postConstructed->x10dc_ != 1)
if (x12c_postConstructed->x10dc_occlusionState != EOcclusionState::Occluded)
{
x12c_postConstructed->x10e0_ = 0;
x12c_postConstructed->x10dc_ = 1;
x12c_postConstructed->x10dc_occlusionState = EOcclusionState::Occluded;
if (!x12c_postConstructed->x1108_25_)
FillInStaticGeometry();
g_Renderer->AddStaticGeometry(&x12c_postConstructed->x4c_insts,
@ -620,6 +635,10 @@ bool CGameArea::StartStreamingMainArea()
return true;
}
void CGameArea::ReloadAllUnloadedTextures()
{
}
u32 CGameArea::GetNumPartSizes() const
{
return hecl::SBig(*reinterpret_cast<u32*>(x110_mreaSecBufs[0].first.get() + 60));

View File

@ -122,6 +122,12 @@ class CGameArea : public IGameArea
std::list<std::shared_ptr<ProjectResourceFactoryBase::AsyncTask>> xf8_loadTransactions;
public:
enum class EOcclusionState
{
NotOccluded,
Occluded
};
class CAreaFog
{
ERglFogMode x0_fogMode = ERglFogMode::None;
@ -170,7 +176,7 @@ public:
u32 x10d0_sclySize = 0;
u32 x10d4_ = 0;
u32 x10d8_ = 0;
u32 x10dc_ = 0;
EOcclusionState x10dc_occlusionState = EOcclusionState::NotOccluded;
u32 x10e0_ = 0;
float x10e4_ = 5.f;
u32 x10e8_ = -1;
@ -185,6 +191,7 @@ public:
bool x1108_24_ : 1;
bool x1108_25_ : 1;
bool x1108_26_ : 1;
bool x1108_27_ : 1;
bool x1108_28_ : 1;
bool x1108_29_ : 1;
bool x1108_30_ : 1;
@ -236,9 +243,6 @@ public:
bool IsQualified(const CEntity& ent);
};
enum class EOcclusionState
{
};
CGameArea(CInputStream& in, int idx, int mlvlVersion);
@ -274,6 +278,7 @@ public:
bool StartStreamingMainArea();
//void UnloadAllLoadedTextures();
//void ReloadAllLoadedTextures();
void ReloadAllUnloadedTextures();
u32 GetNumPartSizes() const;
void AllocNewAreaData(int, int);
void Invalidate(CStateManager& mgr);