mirror of https://github.com/AxioDL/metaforce.git
Merge pull request #292 from lioncash/automap
CAutoMapper: Eliminate usages of const_cast
This commit is contained in:
commit
206be48b43
|
@ -158,7 +158,7 @@ bool CAutoMapper::CanLeaveMapScreenInternal(const CStateManager& mgr) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::LeaveMapScreen(const CStateManager& mgr) {
|
void CAutoMapper::LeaveMapScreen(CStateManager& mgr) {
|
||||||
if (x1c0_nextState == EAutoMapperState::MapScreenUniverse) {
|
if (x1c0_nextState == EAutoMapperState::MapScreenUniverse) {
|
||||||
xa8_renderStates[1].x2c_drawDepth1 = GetMapAreaMiniMapDrawDepth();
|
xa8_renderStates[1].x2c_drawDepth1 = GetMapAreaMiniMapDrawDepth();
|
||||||
xa8_renderStates[1].x30_drawDepth2 = GetMapAreaMiniMapDrawDepth();
|
xa8_renderStates[1].x30_drawDepth2 = GetMapAreaMiniMapDrawDepth();
|
||||||
|
@ -180,9 +180,9 @@ void CAutoMapper::LeaveMapScreen(const CStateManager& mgr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::SetupMiniMapWorld(const CStateManager& mgr) {
|
void CAutoMapper::SetupMiniMapWorld(CStateManager& mgr) {
|
||||||
const CWorld& wld = *mgr.GetWorld();
|
CWorld& wld = *mgr.GetWorld();
|
||||||
const_cast<CMapWorld*>(wld.GetMapWorld())->SetWhichMapAreasLoaded(wld, wld.GetCurrentAreaId(), 3);
|
wld.GetMapWorld()->SetWhichMapAreasLoaded(wld, wld.GetCurrentAreaId(), 3);
|
||||||
x328_ = 3;
|
x328_ = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ void CAutoMapper::BeginMapperStateTransition(EAutoMapperState state, CStateManag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::CompleteMapperStateTransition(const CStateManager& mgr) {
|
void CAutoMapper::CompleteMapperStateTransition(CStateManager& mgr) {
|
||||||
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
|
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
|
||||||
TransformRenderStatesUniverseToWorld();
|
TransformRenderStatesUniverseToWorld();
|
||||||
|
|
||||||
|
@ -1093,7 +1093,7 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::Update(float dt, const CStateManager& mgr) {
|
void CAutoMapper::Update(float dt, CStateManager& mgr) {
|
||||||
if (x1bc_state != EAutoMapperState::MiniMap && x1c0_nextState != EAutoMapperState::MiniMap) {
|
if (x1bc_state != EAutoMapperState::MiniMap && x1c0_nextState != EAutoMapperState::MiniMap) {
|
||||||
x1d8_flashTimer = std::fmod(x1d8_flashTimer + dt, 0.75f);
|
x1d8_flashTimer = std::fmod(x1d8_flashTimer + dt, 0.75f);
|
||||||
x1dc_playerFlashPulse = x1d8_flashTimer < 0.375f ? x1d8_flashTimer / 0.375f : (0.75f - x1d8_flashTimer) / 0.375f;
|
x1dc_playerFlashPulse = x1d8_flashTimer < 0.375f ? x1d8_flashTimer / 0.375f : (0.75f - x1d8_flashTimer) / 0.375f;
|
||||||
|
@ -1289,7 +1289,7 @@ void CAutoMapper::Update(float dt, const CStateManager& mgr) {
|
||||||
wld->ICheckWorldComplete();
|
wld->ICheckWorldComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, float alpha) const {
|
void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, float alpha) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP("CAutoMapper::Draw", zeus::skPurple);
|
SCOPED_GRAPHICS_DEBUG_GROUP("CAutoMapper::Draw", zeus::skPurple);
|
||||||
alpha *= g_GameState->GameOptions().GetHUDAlpha() / 255.f;
|
alpha *= g_GameState->GameOptions().GetHUDAlpha() / 255.f;
|
||||||
// Blend mode alpha
|
// Blend mode alpha
|
||||||
|
@ -1447,7 +1447,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
|
||||||
if (IsInMapperState(EAutoMapperState::MapScreen)) {
|
if (IsInMapperState(EAutoMapperState::MapScreen)) {
|
||||||
CAssetId wldMlvl = x24_world->IGetWorldAssetId();
|
CAssetId wldMlvl = x24_world->IGetWorldAssetId();
|
||||||
const CMapWorld* mw = x24_world->IGetMapWorld();
|
const CMapWorld* mw = x24_world->IGetMapWorld();
|
||||||
std::vector<CTexturedQuadFilter>& hintBeaconFilters = const_cast<CAutoMapper&>(*this).m_hintBeaconFilters;
|
std::vector<CTexturedQuadFilter>& hintBeaconFilters = m_hintBeaconFilters;
|
||||||
if (hintBeaconFilters.size() < x1f8_hintLocations.size()) {
|
if (hintBeaconFilters.size() < x1f8_hintLocations.size()) {
|
||||||
hintBeaconFilters.reserve(x1f8_hintLocations.size());
|
hintBeaconFilters.reserve(x1f8_hintLocations.size());
|
||||||
for (u32 i = hintBeaconFilters.size(); i < x1f8_hintLocations.size(); ++i)
|
for (u32 i = hintBeaconFilters.size(); i < x1f8_hintLocations.size(); ++i)
|
||||||
|
@ -1607,8 +1607,8 @@ CAssetId CAutoMapper::GetAreaHintDescriptionString(CAssetId mreaId) {
|
||||||
void CAutoMapper::OnNewInGameGuiState(EInGameGuiState state, CStateManager& mgr) {
|
void CAutoMapper::OnNewInGameGuiState(EInGameGuiState state, CStateManager& mgr) {
|
||||||
if (state == EInGameGuiState::MapScreen) {
|
if (state == EInGameGuiState::MapScreen) {
|
||||||
MP1::CMain::EnsureWorldPaksReady();
|
MP1::CMain::EnsureWorldPaksReady();
|
||||||
const CWorld& wld = *mgr.GetWorld();
|
CWorld& wld = *mgr.GetWorld();
|
||||||
const_cast<CMapWorld*>(wld.GetMapWorld())->SetWhichMapAreasLoaded(wld, 0, 9999);
|
wld.GetMapWorld()->SetWhichMapAreasLoaded(wld, 0, 9999);
|
||||||
SetupHintNavigation();
|
SetupHintNavigation();
|
||||||
BeginMapperStateTransition(EAutoMapperState::MapScreen, mgr);
|
BeginMapperStateTransition(EAutoMapperState::MapScreen, mgr);
|
||||||
x28_frmeMapScreen = g_SimplePool->GetObj("FRME_MapScreen");
|
x28_frmeMapScreen = g_SimplePool->GetObj("FRME_MapScreen");
|
||||||
|
|
|
@ -194,8 +194,8 @@ private:
|
||||||
}
|
}
|
||||||
bool NotHintNavigating() const;
|
bool NotHintNavigating() const;
|
||||||
bool CanLeaveMapScreenInternal(const CStateManager& mgr) const;
|
bool CanLeaveMapScreenInternal(const CStateManager& mgr) const;
|
||||||
void LeaveMapScreen(const CStateManager& mgr);
|
void LeaveMapScreen(CStateManager& mgr);
|
||||||
void SetupMiniMapWorld(const CStateManager& mgr);
|
void SetupMiniMapWorld(CStateManager& mgr);
|
||||||
bool HasCurrentMapUniverseWorld() const;
|
bool HasCurrentMapUniverseWorld() const;
|
||||||
bool CheckDummyWorldLoad(CStateManager& mgr);
|
bool CheckDummyWorldLoad(CStateManager& mgr);
|
||||||
void UpdateHintNavigation(float dt, CStateManager& mgr);
|
void UpdateHintNavigation(float dt, CStateManager& mgr);
|
||||||
|
@ -238,11 +238,11 @@ public:
|
||||||
bool IsInPlayerControlState() const {
|
bool IsInPlayerControlState() const {
|
||||||
return IsInMapperState(EAutoMapperState::MapScreen) || IsInMapperState(EAutoMapperState::MapScreenUniverse);
|
return IsInMapperState(EAutoMapperState::MapScreen) || IsInMapperState(EAutoMapperState::MapScreenUniverse);
|
||||||
}
|
}
|
||||||
void Update(float dt, const CStateManager& mgr);
|
void Update(float dt, CStateManager& mgr);
|
||||||
void Draw(const CStateManager& mgr, const zeus::CTransform& xf, float alpha) const;
|
void Draw(const CStateManager& mgr, const zeus::CTransform& xf, float alpha);
|
||||||
float GetTimeIntoInterpolation() const { return x1c8_interpTime; }
|
float GetTimeIntoInterpolation() const { return x1c8_interpTime; }
|
||||||
void BeginMapperStateTransition(EAutoMapperState state, CStateManager& mgr);
|
void BeginMapperStateTransition(EAutoMapperState state, CStateManager& mgr);
|
||||||
void CompleteMapperStateTransition(const CStateManager& mgr);
|
void CompleteMapperStateTransition(CStateManager& mgr);
|
||||||
void ResetInterpolationTimer(float duration);
|
void ResetInterpolationTimer(float duration);
|
||||||
SAutoMapperRenderState BuildMiniMapWorldRenderState(const CStateManager& stateMgr, const zeus::CQuaternion& rot,
|
SAutoMapperRenderState BuildMiniMapWorldRenderState(const CStateManager& stateMgr, const zeus::CQuaternion& rot,
|
||||||
TAreaId area) const;
|
TAreaId area) const;
|
||||||
|
|
|
@ -257,15 +257,16 @@ void CMapArea::CMapAreaSurface::PostConstruct(const u8* buf, std::vector<u32>& i
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapArea::CMapAreaSurface::Draw(const zeus::CVector3f* verts, const zeus::CColor& surfColor,
|
void CMapArea::CMapAreaSurface::Draw(const zeus::CVector3f* verts, const zeus::CColor& surfColor,
|
||||||
const zeus::CColor& lineColor, float lineWidth, size_t instIdx) const {
|
const zeus::CColor& lineColor, float lineWidth, size_t instIdx) {
|
||||||
if (instIdx >= m_instances.size()) {
|
if (instIdx >= m_instances.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance& instance = const_cast<Instance&>(m_instances[instIdx]);
|
Instance& instance = m_instances[instIdx];
|
||||||
|
|
||||||
if (surfColor.a())
|
if (surfColor.a()) {
|
||||||
instance.m_surfacePrims.draw(surfColor, m_primStart, m_primCount);
|
instance.m_surfacePrims.draw(surfColor, m_primStart, m_primCount);
|
||||||
|
}
|
||||||
|
|
||||||
if (lineColor.a()) {
|
if (lineColor.a()) {
|
||||||
bool draw2 = lineWidth > 1.f;
|
bool draw2 = lineWidth > 1.f;
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
CMapAreaSurface(CMapAreaSurface&&) = default;
|
CMapAreaSurface(CMapAreaSurface&&) = default;
|
||||||
void PostConstruct(const u8* buf, std::vector<u32>& index);
|
void PostConstruct(const u8* buf, std::vector<u32>& index);
|
||||||
void Draw(const zeus::CVector3f* verts, const zeus::CColor& surfColor, const zeus::CColor& lineColor,
|
void Draw(const zeus::CVector3f* verts, const zeus::CColor& surfColor, const zeus::CColor& lineColor,
|
||||||
float lineWidth, size_t instIdx = 0) const;
|
float lineWidth, size_t instIdx = 0);
|
||||||
const zeus::CVector3f& GetNormal() const { return x0_normal; }
|
const zeus::CVector3f& GetNormal() const { return x0_normal; }
|
||||||
const zeus::CVector3f& GetCenterPosition() const { return xc_centroid; }
|
const zeus::CVector3f& GetCenterPosition() const { return xc_centroid; }
|
||||||
};
|
};
|
||||||
|
@ -74,7 +74,9 @@ public:
|
||||||
bool GetIsVisibleToAutoMapper(bool worldVis, bool areaVis) const;
|
bool GetIsVisibleToAutoMapper(bool worldVis, bool areaVis) const;
|
||||||
zeus::CVector3f GetAreaCenterPoint() const { return x10_box.center(); }
|
zeus::CVector3f GetAreaCenterPoint() const { return x10_box.center(); }
|
||||||
const zeus::CAABox& GetBoundingBox() const { return x10_box; }
|
const zeus::CAABox& GetBoundingBox() const { return x10_box; }
|
||||||
|
CMappableObject& GetMappableObject(int idx) { return m_mappableObjects[idx]; }
|
||||||
const CMappableObject& GetMappableObject(int idx) const { return m_mappableObjects[idx]; }
|
const CMappableObject& GetMappableObject(int idx) const { return m_mappableObjects[idx]; }
|
||||||
|
CMapAreaSurface& GetSurface(int idx) { return m_surfaces[idx]; }
|
||||||
const CMapAreaSurface& GetSurface(int idx) const { return m_surfaces[idx]; }
|
const CMapAreaSurface& GetSurface(int idx) const { return m_surfaces[idx]; }
|
||||||
u32 GetNumMappableObjects() const { return m_mappableObjects.size(); }
|
u32 GetNumMappableObjects() const { return m_mappableObjects.size(); }
|
||||||
u32 GetNumSurfaces() const { return m_surfaces.size(); }
|
u32 GetNumSurfaces() const { return m_surfaces.size(); }
|
||||||
|
|
|
@ -38,9 +38,10 @@ CMapUniverse::CMapWorldData::CMapWorldData(CInputStream& in, u32 version)
|
||||||
x64_centerPoint *= zeus::CVector3f(1.0f / float(x44_hexagonXfs.size()));
|
x64_centerPoint *= zeus::CVector3f(1.0f / float(x44_hexagonXfs.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3f&, float, float) const {
|
void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3f&, float, float) {
|
||||||
if (!x4_hexagonToken.IsLoaded())
|
if (!x4_hexagonToken.IsLoaded()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP("CMapUniverse::Draw", zeus::skBlue);
|
SCOPED_GRAPHICS_DEBUG_GROUP("CMapUniverse::Draw", zeus::skBlue);
|
||||||
|
|
||||||
u32 totalSurfaceCount = 0;
|
u32 totalSurfaceCount = 0;
|
||||||
|
@ -100,7 +101,7 @@ void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3
|
||||||
|
|
||||||
zeus::CTransform hexXf = mwData.GetMapAreaData(info.GetAreaIndex());
|
zeus::CTransform hexXf = mwData.GetMapAreaData(info.GetAreaIndex());
|
||||||
hexXf.orthonormalize();
|
hexXf.orthonormalize();
|
||||||
const CMapArea::CMapAreaSurface& surf = x4_hexagonToken->GetSurface(info.GetObjectIndex());
|
CMapArea::CMapAreaSurface& surf = x4_hexagonToken->GetSurface(info.GetObjectIndex());
|
||||||
zeus::CColor color(std::max(0.f, (-parms.GetCameraTransform().basis[1]).dot(hexXf.rotate(surf.GetNormal()))) *
|
zeus::CColor color(std::max(0.f, (-parms.GetCameraTransform().basis[1]).dot(hexXf.rotate(surf.GetNormal()))) *
|
||||||
g_tweakAutoMapper->GetMapSurfaceNormColorLinear() +
|
g_tweakAutoMapper->GetMapSurfaceNormColorLinear() +
|
||||||
g_tweakAutoMapper->GetMapSurfaceNormColorConstant());
|
g_tweakAutoMapper->GetMapSurfaceNormColorConstant());
|
||||||
|
|
|
@ -116,7 +116,7 @@ public:
|
||||||
u32 GetNumMapWorldDatas() const { return x10_worldDatas.size(); }
|
u32 GetNumMapWorldDatas() const { return x10_worldDatas.size(); }
|
||||||
float GetMapUniverseRadius() const { return x2c_universeRadius; }
|
float GetMapUniverseRadius() const { return x2c_universeRadius; }
|
||||||
const zeus::CVector3f& GetMapUniverseCenterPoint() const { return x20_universeCenter; }
|
const zeus::CVector3f& GetMapUniverseCenterPoint() const { return x20_universeCenter; }
|
||||||
void Draw(const CMapUniverseDrawParms&, const zeus::CVector3f&, float, float) const;
|
void Draw(const CMapUniverseDrawParms&, const zeus::CVector3f&, float, float);
|
||||||
std::vector<CMapWorldData>::const_iterator begin() const { return x10_worldDatas.cbegin(); }
|
std::vector<CMapWorldData>::const_iterator begin() const { return x10_worldDatas.cbegin(); }
|
||||||
std::vector<CMapWorldData>::const_iterator end() const { return x10_worldDatas.cend(); }
|
std::vector<CMapWorldData>::const_iterator end() const { return x10_worldDatas.cend(); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -311,13 +311,13 @@ void CMapWorld::SetWhichMapAreasLoaded(const IWorld& wld, int start, int count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMapWorld::IsMapAreasStreaming() const {
|
bool CMapWorld::IsMapAreasStreaming() {
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
CMapAreaData* data = x10_listHeads[1];
|
CMapAreaData* data = x10_listHeads[1];
|
||||||
while (data != nullptr) {
|
while (data != nullptr) {
|
||||||
if (data->IsLoaded()) {
|
if (data->IsLoaded()) {
|
||||||
CMapAreaData* next = data->GetNextMapAreaData();
|
CMapAreaData* next = data->GetNextMapAreaData();
|
||||||
const_cast<CMapWorld*>(this)->MoveMapAreaToList(data, EMapAreaList::Loaded);
|
MoveMapAreaToList(data, EMapAreaList::Loaded);
|
||||||
data = next;
|
data = next;
|
||||||
} else {
|
} else {
|
||||||
data = data->GetNextMapAreaData();
|
data = data->GetNextMapAreaData();
|
||||||
|
@ -448,8 +448,8 @@ bool CMapWorld::IsMapAreaValid(const IWorld& wld, int areaIdx, bool checkLoad) c
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selArea,
|
void CMapWorld::DrawAreas(const CMapWorldDrawParms& parms, int selArea, const std::vector<CMapAreaBFSInfo>& bfsInfos,
|
||||||
const std::vector<CMapAreaBFSInfo>& bfsInfos, bool inMapScreen) const {
|
bool inMapScreen) {
|
||||||
// Alpha blend
|
// Alpha blend
|
||||||
// Line width 1
|
// Line width 1
|
||||||
|
|
||||||
|
@ -579,17 +579,18 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
|
||||||
u32 lastAreaIdx = UINT32_MAX;
|
u32 lastAreaIdx = UINT32_MAX;
|
||||||
CMapObjectSortInfo::EObjectCode lastType = CMapObjectSortInfo::EObjectCode::Invalid;
|
CMapObjectSortInfo::EObjectCode lastType = CMapObjectSortInfo::EObjectCode::Invalid;
|
||||||
for (const CMapObjectSortInfo& info : sortInfos) {
|
for (const CMapObjectSortInfo& info : sortInfos) {
|
||||||
const CMapArea* mapa = GetMapArea(info.GetAreaIndex());
|
CMapArea* mapa = GetMapArea(info.GetAreaIndex());
|
||||||
zeus::CTransform areaPostXf = mapa->GetAreaPostTransform(parms.GetWorld(), info.GetAreaIndex());
|
zeus::CTransform areaPostXf = mapa->GetAreaPostTransform(parms.GetWorld(), info.GetAreaIndex());
|
||||||
if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Surface) {
|
if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Surface) {
|
||||||
const CMapArea::CMapAreaSurface& surf = mapa->GetSurface(info.GetLocalObjectIndex());
|
CMapArea::CMapAreaSurface& surf = mapa->GetSurface(info.GetLocalObjectIndex());
|
||||||
zeus::CColor color(
|
zeus::CColor color(
|
||||||
std::max(0.f, (-parms.GetCameraTransform().basis[1]).dot(areaPostXf.rotate(surf.GetNormal()))) *
|
std::max(0.f, (-parms.GetCameraTransform().basis[1]).dot(areaPostXf.rotate(surf.GetNormal()))) *
|
||||||
g_tweakAutoMapper->GetMapSurfaceNormColorLinear() +
|
g_tweakAutoMapper->GetMapSurfaceNormColorLinear() +
|
||||||
g_tweakAutoMapper->GetMapSurfaceNormColorConstant());
|
g_tweakAutoMapper->GetMapSurfaceNormColorConstant());
|
||||||
color *= info.GetSurfaceColor();
|
color *= info.GetSurfaceColor();
|
||||||
if (lastAreaIdx != info.GetAreaIndex() || lastType != CMapObjectSortInfo::EObjectCode::Surface)
|
if (lastAreaIdx != info.GetAreaIndex() || lastType != CMapObjectSortInfo::EObjectCode::Surface) {
|
||||||
CGraphics::SetModelMatrix(parms.GetPlaneProjectionTransform() * areaPostXf);
|
CGraphics::SetModelMatrix(parms.GetPlaneProjectionTransform() * areaPostXf);
|
||||||
|
}
|
||||||
surf.Draw(mapa->GetVertices(), color, info.GetOutlineColor(), parms.GetOutlineWidthScale());
|
surf.Draw(mapa->GetVertices(), color, info.GetOutlineColor(), parms.GetOutlineWidthScale());
|
||||||
|
|
||||||
lastAreaIdx = info.GetAreaIndex();
|
lastAreaIdx = info.GetAreaIndex();
|
||||||
|
@ -597,11 +598,11 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const CMapObjectSortInfo& info : sortInfos) {
|
for (const CMapObjectSortInfo& info : sortInfos) {
|
||||||
const CMapArea* mapa = GetMapArea(info.GetAreaIndex());
|
CMapArea* mapa = GetMapArea(info.GetAreaIndex());
|
||||||
if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Door ||
|
if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Door ||
|
||||||
info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Object) {
|
info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Object) {
|
||||||
const CMappableObject& mapObj = mapa->GetMappableObject(info.GetLocalObjectIndex());
|
CMappableObject& mapObj = mapa->GetMappableObject(info.GetLocalObjectIndex());
|
||||||
zeus::CTransform objXf =
|
const zeus::CTransform objXf =
|
||||||
zeus::CTransform::Translate(CMapArea::GetAreaPostTranslate(parms.GetWorld(), info.GetAreaIndex())) *
|
zeus::CTransform::Translate(CMapArea::GetAreaPostTranslate(parms.GetWorld(), info.GetAreaIndex())) *
|
||||||
mapObj.GetTransform();
|
mapObj.GetTransform();
|
||||||
if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Door) {
|
if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Door) {
|
||||||
|
@ -614,8 +615,8 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
|
||||||
mapObj.Draw(selArea, mwInfo, parms.GetAlpha(), lastType != info.GetObjectCode());
|
mapObj.Draw(selArea, mwInfo, parms.GetAlpha(), lastType != info.GetObjectCode());
|
||||||
lastType = info.GetObjectCode();
|
lastType = info.GetObjectCode();
|
||||||
} else if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::DoorSurface) {
|
} else if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::DoorSurface) {
|
||||||
const CMappableObject& mapObj = mapa->GetMappableObject(info.GetLocalObjectIndex() / 6);
|
CMappableObject& mapObj = mapa->GetMappableObject(info.GetLocalObjectIndex() / 6);
|
||||||
zeus::CTransform objXf =
|
const zeus::CTransform objXf =
|
||||||
parms.GetPlaneProjectionTransform() *
|
parms.GetPlaneProjectionTransform() *
|
||||||
zeus::CTransform::Translate(CMapArea::GetAreaPostTranslate(parms.GetWorld(), info.GetAreaIndex())) *
|
zeus::CTransform::Translate(CMapArea::GetAreaPostTranslate(parms.GetWorld(), info.GetAreaIndex())) *
|
||||||
mapObj.GetTransform();
|
mapObj.GetTransform();
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
void Lock() { x0_area.Lock(); }
|
void Lock() { x0_area.Lock(); }
|
||||||
void Unlock() { x0_area.Unlock(); }
|
void Unlock() { x0_area.Unlock(); }
|
||||||
bool IsLoaded() const { return x0_area.IsLoaded(); }
|
bool IsLoaded() const { return x0_area.IsLoaded(); }
|
||||||
|
CMapArea* GetMapArea() { return x0_area.GetObj(); }
|
||||||
const CMapArea* GetMapArea() const { return x0_area.GetObj(); }
|
const CMapArea* GetMapArea() const { return x0_area.GetObj(); }
|
||||||
CMapAreaData* GetNextMapAreaData() { return x14_next; }
|
CMapAreaData* GetNextMapAreaData() { return x14_next; }
|
||||||
const CMapAreaData* GetNextMapAreaData() const { return x14_next; }
|
const CMapAreaData* GetNextMapAreaData() const { return x14_next; }
|
||||||
|
@ -144,10 +145,11 @@ private:
|
||||||
public:
|
public:
|
||||||
explicit CMapWorld(CInputStream& in);
|
explicit CMapWorld(CInputStream& in);
|
||||||
u32 GetNumAreas() const { return x0_areas.size(); }
|
u32 GetNumAreas() const { return x0_areas.size(); }
|
||||||
|
CMapArea* GetMapArea(int aid) { return x0_areas[aid].GetMapArea(); }
|
||||||
const CMapArea* GetMapArea(int aid) const { return x0_areas[aid].GetMapArea(); }
|
const CMapArea* GetMapArea(int aid) const { return x0_areas[aid].GetMapArea(); }
|
||||||
bool IsMapAreaInBFSInfoVector(const CMapAreaData* area, const std::vector<CMapAreaBFSInfo>& vec) const;
|
bool IsMapAreaInBFSInfoVector(const CMapAreaData* area, const std::vector<CMapAreaBFSInfo>& vec) const;
|
||||||
void SetWhichMapAreasLoaded(const IWorld& wld, int start, int count);
|
void SetWhichMapAreasLoaded(const IWorld& wld, int start, int count);
|
||||||
bool IsMapAreasStreaming() const;
|
bool IsMapAreasStreaming();
|
||||||
void MoveMapAreaToList(CMapAreaData* data, EMapAreaList list);
|
void MoveMapAreaToList(CMapAreaData* data, EMapAreaList list);
|
||||||
s32 GetCurrentMapAreaDepth(const IWorld& wld, TAreaId aid);
|
s32 GetCurrentMapAreaDepth(const IWorld& wld, TAreaId aid);
|
||||||
std::vector<int> GetVisibleAreas(const IWorld& wld, const CMapWorldInfo& mwInfo) const;
|
std::vector<int> GetVisibleAreas(const IWorld& wld, const CMapWorldInfo& mwInfo) const;
|
||||||
|
@ -156,7 +158,7 @@ public:
|
||||||
std::vector<CMapAreaBFSInfo>& bfsInfos);
|
std::vector<CMapAreaBFSInfo>& bfsInfos);
|
||||||
bool IsMapAreaValid(const IWorld& wld, int areaIdx, bool checkLoad) const;
|
bool IsMapAreaValid(const IWorld& wld, int areaIdx, bool checkLoad) const;
|
||||||
void DrawAreas(const CMapWorldDrawParms& parms, int selArea, const std::vector<CMapAreaBFSInfo>& bfsInfos,
|
void DrawAreas(const CMapWorldDrawParms& parms, int selArea, const std::vector<CMapAreaBFSInfo>& bfsInfos,
|
||||||
bool inMapScreen) const;
|
bool inMapScreen);
|
||||||
void RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld& wld);
|
void RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld& wld);
|
||||||
zeus::CVector3f ConstrainToWorldVolume(const zeus::CVector3f& point, const zeus::CVector3f& lookVec) const;
|
zeus::CVector3f ConstrainToWorldVolume(const zeus::CVector3f& point, const zeus::CVector3f& lookVec) const;
|
||||||
void ClearTraversedFlags();
|
void ClearTraversedFlags();
|
||||||
|
|
|
@ -106,12 +106,12 @@ std::pair<zeus::CColor, zeus::CColor> CMappableObject::GetDoorColors(int curArea
|
||||||
|
|
||||||
void CMappableObject::PostConstruct(const void*) { x10_transform = AdjustTransformForType(); }
|
void CMappableObject::PostConstruct(const void*) { x10_transform = AdjustTransformForType(); }
|
||||||
|
|
||||||
void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo, float alpha, bool needsVtxLoad) const {
|
void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo, float alpha, bool needsVtxLoad) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP("CMappableObject::Draw", zeus::skCyan);
|
SCOPED_GRAPHICS_DEBUG_GROUP("CMappableObject::Draw", zeus::skCyan);
|
||||||
if (IsDoorType(x0_type)) {
|
if (IsDoorType(x0_type)) {
|
||||||
std::pair<zeus::CColor, zeus::CColor> colors = GetDoorColors(curArea, mwInfo, alpha);
|
std::pair<zeus::CColor, zeus::CColor> colors = GetDoorColors(curArea, mwInfo, alpha);
|
||||||
for (int s = 0; s < 6; ++s) {
|
for (int s = 0; s < 6; ++s) {
|
||||||
DoorSurface& ds = const_cast<DoorSurface&>(*m_doorSurface);
|
DoorSurface& ds = *m_doorSurface;
|
||||||
ds.m_surface.draw(colors.first, s * 4, 4);
|
ds.m_surface.draw(colors.first, s * 4, 4);
|
||||||
CLineRenderer& line = ds.m_outline;
|
CLineRenderer& line = ds.m_outline;
|
||||||
const u32* baseIdx = &DoorIndices[s * 4];
|
const u32* baseIdx = &DoorIndices[s * 4];
|
||||||
|
@ -164,22 +164,24 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo, float alpha
|
||||||
iconColor.a() *= alpha;
|
iconColor.a() *= alpha;
|
||||||
|
|
||||||
TLockedToken<CTexture> tex = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), iconRes});
|
TLockedToken<CTexture> tex = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), iconRes});
|
||||||
if (!m_texQuadFilter || m_texQuadFilter->GetTex().GetObj() != tex.GetObj())
|
if (!m_texQuadFilter || m_texQuadFilter->GetTex().GetObj() != tex.GetObj()) {
|
||||||
const_cast<CMappableObject*>(this)->m_texQuadFilter.emplace(EFilterType::Add, tex,
|
m_texQuadFilter.emplace(EFilterType::Add, tex, CTexturedQuadFilter::ZTest::GEqual);
|
||||||
CTexturedQuadFilter::ZTest::GEqual);
|
}
|
||||||
|
|
||||||
CTexturedQuadFilter::Vert verts[4] = {{{-2.6f, 0.f, 2.6f}, {0.f, 1.f}},
|
const CTexturedQuadFilter::Vert verts[4] = {
|
||||||
|
{{-2.6f, 0.f, 2.6f}, {0.f, 1.f}},
|
||||||
{{-2.6f, 0.f, -2.6f}, {0.f, 0.f}},
|
{{-2.6f, 0.f, -2.6f}, {0.f, 0.f}},
|
||||||
{{2.6f, 0.f, 2.6f}, {1.f, 1.f}},
|
{{2.6f, 0.f, 2.6f}, {1.f, 1.f}},
|
||||||
{{2.6f, 0.f, -2.6f}, {1.f, 0.f}}};
|
{{2.6f, 0.f, -2.6f}, {1.f, 0.f}},
|
||||||
const_cast<CMappableObject*>(this)->m_texQuadFilter->drawVerts(iconColor, verts);
|
};
|
||||||
|
m_texQuadFilter->drawVerts(iconColor, verts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappableObject::DrawDoorSurface(int curArea, const CMapWorldInfo& mwInfo, float alpha, int surfIdx,
|
void CMappableObject::DrawDoorSurface(int curArea, const CMapWorldInfo& mwInfo, float alpha, int surfIdx,
|
||||||
bool needsVtxLoad) const {
|
bool needsVtxLoad) {
|
||||||
std::pair<zeus::CColor, zeus::CColor> colors = GetDoorColors(curArea, mwInfo, alpha);
|
std::pair<zeus::CColor, zeus::CColor> colors = GetDoorColors(curArea, mwInfo, alpha);
|
||||||
DoorSurface& ds = const_cast<DoorSurface&>(*m_doorSurface);
|
DoorSurface& ds = *m_doorSurface;
|
||||||
ds.m_surface.draw(colors.first, surfIdx * 4, 4);
|
ds.m_surface.draw(colors.first, surfIdx * 4, 4);
|
||||||
CLineRenderer& line = ds.m_outline;
|
CLineRenderer& line = ds.m_outline;
|
||||||
const u32* baseIdx = &DoorIndices[surfIdx * 4];
|
const u32* baseIdx = &DoorIndices[surfIdx * 4];
|
||||||
|
|
|
@ -79,8 +79,8 @@ public:
|
||||||
void PostConstruct(const void*);
|
void PostConstruct(const void*);
|
||||||
const zeus::CTransform& GetTransform() const { return x10_transform; }
|
const zeus::CTransform& GetTransform() const { return x10_transform; }
|
||||||
EMappableObjectType GetType() const { return x0_type; }
|
EMappableObjectType GetType() const { return x0_type; }
|
||||||
void Draw(int, const CMapWorldInfo&, float, bool) const;
|
void Draw(int, const CMapWorldInfo&, float, bool);
|
||||||
void DrawDoorSurface(int curArea, const CMapWorldInfo& mwInfo, float alpha, int surfIdx, bool needsVtxLoad) const;
|
void DrawDoorSurface(int curArea, const CMapWorldInfo& mwInfo, float alpha, int surfIdx, bool needsVtxLoad);
|
||||||
zeus::CVector3f BuildSurfaceCenterPoint(int surfIdx) const;
|
zeus::CVector3f BuildSurfaceCenterPoint(int surfIdx) const;
|
||||||
bool IsDoorConnectedToArea(int idx, const CStateManager&) const;
|
bool IsDoorConnectedToArea(int idx, const CStateManager&) const;
|
||||||
bool IsDoorConnectedToVisitedArea(const CStateManager&) const;
|
bool IsDoorConnectedToVisitedArea(const CStateManager&) const;
|
||||||
|
|
|
@ -279,7 +279,7 @@ void CInGameGuiManager::OnNewPauseScreenState(CArchitectureQueue& archQueue) {
|
||||||
x1bc_prevState = x1c0_nextState;
|
x1bc_prevState = x1c0_nextState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInGameGuiManager::UpdateAutoMapper(float dt, const CStateManager& stateMgr) {
|
void CInGameGuiManager::UpdateAutoMapper(float dt, CStateManager& stateMgr) {
|
||||||
x38_autoMapper->Update(dt, stateMgr);
|
x38_autoMapper->Update(dt, stateMgr);
|
||||||
zeus::CTransform xf =
|
zeus::CTransform xf =
|
||||||
x148_model_automapper->GetParent()->GetWorldTransform() * x144_basewidget_automapper->GetTransform();
|
x148_model_automapper->GetParent()->GetWorldTransform() * x144_basewidget_automapper->GetTransform();
|
||||||
|
|
|
@ -121,7 +121,7 @@ private:
|
||||||
void TryReloadAreaTextures();
|
void TryReloadAreaTextures();
|
||||||
bool IsInGameStateNotTransitioning() const;
|
bool IsInGameStateNotTransitioning() const;
|
||||||
bool IsInPausedStateNotTransitioning() const;
|
bool IsInPausedStateNotTransitioning() const;
|
||||||
void UpdateAutoMapper(float dt, const CStateManager& stateMgr);
|
void UpdateAutoMapper(float dt, CStateManager& stateMgr);
|
||||||
void OnNewPauseScreenState(CArchitectureQueue& archQueue);
|
void OnNewPauseScreenState(CArchitectureQueue& archQueue);
|
||||||
void RefreshHudOptions();
|
void RefreshHudOptions();
|
||||||
|
|
||||||
|
|
|
@ -314,7 +314,7 @@ CScriptDoor::EDoorOpenCondition CScriptDoor::GetDoorOpenCondition(CStateManager&
|
||||||
if (connArea == kInvalidAreaId)
|
if (connArea == kInvalidAreaId)
|
||||||
return EDoorOpenCondition::NotReady;
|
return EDoorOpenCondition::NotReady;
|
||||||
|
|
||||||
const CWorld* world = mgr.GetWorld();
|
CWorld* world = mgr.GetWorld();
|
||||||
const CGameArea* area = world->GetAreaAlways(connArea);
|
const CGameArea* area = world->GetAreaAlways(connArea);
|
||||||
|
|
||||||
if (!area->IsPostConstructed()) {
|
if (!area->IsPostConstructed()) {
|
||||||
|
|
|
@ -177,7 +177,9 @@ public:
|
||||||
bool DoesAreaExist(TAreaId area) const;
|
bool DoesAreaExist(TAreaId area) const;
|
||||||
const std::vector<std::unique_ptr<CGameArea>>& GetGameAreas() const { return x18_areas; }
|
const std::vector<std::unique_ptr<CGameArea>>& GetGameAreas() const { return x18_areas; }
|
||||||
|
|
||||||
|
CMapWorld* GetMapWorld() { return x28_mapWorld.GetObj(); }
|
||||||
const CMapWorld* GetMapWorld() const { return x28_mapWorld.GetObj(); }
|
const CMapWorld* GetMapWorld() const { return x28_mapWorld.GetObj(); }
|
||||||
|
|
||||||
u32 GetRelayCount() const { return x2c_relays.size(); }
|
u32 GetRelayCount() const { return x2c_relays.size(); }
|
||||||
CRelay GetRelay(u32 idx) const { return x2c_relays[idx]; }
|
CRelay GetRelay(u32 idx) const { return x2c_relays[idx]; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue