mirror of https://github.com/AxioDL/metaforce.git
commit
b3b8c33006
|
@ -194,7 +194,7 @@ bool CAutoMapper::HasCurrentMapUniverseWorld() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAutoMapper::CheckDummyWorldLoad(const CStateManager& mgr) {
|
bool CAutoMapper::CheckDummyWorldLoad(CStateManager& mgr) {
|
||||||
const CMapUniverse::CMapWorldData& mapuWld = x8_mapu->GetMapWorldData(x9c_worldIdx);
|
const CMapUniverse::CMapWorldData& mapuWld = x8_mapu->GetMapWorldData(x9c_worldIdx);
|
||||||
auto& dummyWorld = x14_dummyWorlds[x9c_worldIdx];
|
auto& dummyWorld = x14_dummyWorlds[x9c_worldIdx];
|
||||||
if (!dummyWorld) {
|
if (!dummyWorld) {
|
||||||
|
@ -222,7 +222,7 @@ bool CAutoMapper::CheckDummyWorldLoad(const CStateManager& mgr) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::UpdateHintNavigation(float dt, const CStateManager& mgr) {
|
void CAutoMapper::UpdateHintNavigation(float dt, CStateManager& mgr) {
|
||||||
SAutoMapperHintStep& nextStep = x1e0_hintSteps.front();
|
SAutoMapperHintStep& nextStep = x1e0_hintSteps.front();
|
||||||
bool oldProcessing = nextStep.x8_processing;
|
bool oldProcessing = nextStep.x8_processing;
|
||||||
nextStep.x8_processing = true;
|
nextStep.x8_processing = true;
|
||||||
|
@ -321,7 +321,7 @@ void CAutoMapper::SetCurWorldAssetId(CAssetId mlvlId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::BeginMapperStateTransition(EAutoMapperState state, const CStateManager& mgr) {
|
void CAutoMapper::BeginMapperStateTransition(EAutoMapperState state, CStateManager& mgr) {
|
||||||
if (state == x1c0_nextState)
|
if (state == x1c0_nextState)
|
||||||
return;
|
return;
|
||||||
if ((state == EAutoMapperState::MiniMap && x1c0_nextState != EAutoMapperState::MiniMap) ||
|
if ((state == EAutoMapperState::MiniMap && x1c0_nextState != EAutoMapperState::MiniMap) ||
|
||||||
|
@ -378,7 +378,7 @@ void CAutoMapper::CompleteMapperStateTransition(const CStateManager& mgr) {
|
||||||
|
|
||||||
if (x1c0_nextState == EAutoMapperState::MapScreen) {
|
if (x1c0_nextState == EAutoMapperState::MapScreen) {
|
||||||
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo();
|
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo();
|
||||||
x24_world->IGetMapWorld()->RecalculateWorldSphere(mwInfo, *x24_world);
|
x24_world->IMapWorld()->RecalculateWorldSphere(mwInfo, *x24_world);
|
||||||
x1d8_flashTimer = 0.f;
|
x1d8_flashTimer = 0.f;
|
||||||
x1dc_playerFlashPulse = 0.f;
|
x1dc_playerFlashPulse = 0.f;
|
||||||
}
|
}
|
||||||
|
@ -784,7 +784,7 @@ void CAutoMapper::SetShouldRotatingSoundBePlaying(bool b) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::ProcessMapScreenInput(const CFinalInput& input, const CStateManager& mgr) {
|
void CAutoMapper::ProcessMapScreenInput(const CFinalInput& input, CStateManager& mgr) {
|
||||||
zeus::CMatrix3f camRot = xa8_renderStates[0].x8_camOrientation.toTransform().buildMatrix3f();
|
zeus::CMatrix3f camRot = xa8_renderStates[0].x8_camOrientation.toTransform().buildMatrix3f();
|
||||||
if (x1bc_state == EAutoMapperState::MapScreen) {
|
if (x1bc_state == EAutoMapperState::MapScreen) {
|
||||||
if ((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter)) && x328_ == 0 && HasCurrentMapUniverseWorld())
|
if ((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter)) && x328_ == 0 && HasCurrentMapUniverseWorld())
|
||||||
|
@ -911,7 +911,7 @@ zeus::CVector2i CAutoMapper::GetMapScreenViewportSize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
float CAutoMapper::GetMapAreaMaxDrawDepth(const CStateManager&, TAreaId aid) const {
|
float CAutoMapper::GetMapAreaMaxDrawDepth(const CStateManager&, TAreaId aid) const {
|
||||||
return x24_world->IGetMapWorld()->GetCurrentMapAreaDepth(*x24_world, aid);
|
return x24_world->IMapWorld()->GetCurrentMapAreaDepth(*x24_world, aid);
|
||||||
}
|
}
|
||||||
|
|
||||||
float CAutoMapper::GetMapAreaMiniMapDrawAlphaSurfaceVisited(const CStateManager& stateMgr) {
|
float CAutoMapper::GetMapAreaMiniMapDrawAlphaSurfaceVisited(const CStateManager& stateMgr) {
|
||||||
|
@ -1224,7 +1224,7 @@ void CAutoMapper::Update(float dt, const CStateManager& mgr) {
|
||||||
else
|
else
|
||||||
xa8_renderStates[1].x18_camDist -= 3.f;
|
xa8_renderStates[1].x18_camDist -= 3.f;
|
||||||
} else if (x1bc_state != EAutoMapperState::MiniMap && x1c0_nextState != EAutoMapperState::MiniMap && x24_world) {
|
} else if (x1bc_state != EAutoMapperState::MiniMap && x1c0_nextState != EAutoMapperState::MiniMap && x24_world) {
|
||||||
x24_world->IGetMapWorld()->RecalculateWorldSphere(
|
x24_world->IMapWorld()->RecalculateWorldSphere(
|
||||||
*g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo(), *x24_world);
|
*g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo(), *x24_world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1341,7 +1341,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
|
||||||
if (x1bc_state != EAutoMapperState::MiniMap && x1c0_nextState != EAutoMapperState::MiniMap) {
|
if (x1bc_state != EAutoMapperState::MiniMap && x1c0_nextState != EAutoMapperState::MiniMap) {
|
||||||
if (universeInterp < 1.f && x24_world) {
|
if (universeInterp < 1.f && x24_world) {
|
||||||
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo();
|
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo();
|
||||||
const CMapWorld* mw = x24_world->IGetMapWorld();
|
CMapWorld* mw = x24_world->IMapWorld();
|
||||||
float hintFlash = 0.f;
|
float hintFlash = 0.f;
|
||||||
if (x1e0_hintSteps.size() && x1e0_hintSteps.front().x0_type == SAutoMapperHintStep::Type::ShowBeacon) {
|
if (x1e0_hintSteps.size() && x1e0_hintSteps.front().x0_type == SAutoMapperHintStep::Type::ShowBeacon) {
|
||||||
if (xa0_curAreaId == mgr.GetNextAreaId() && x24_world == mgr.GetWorld()) {
|
if (xa0_curAreaId == mgr.GetNextAreaId() && x24_world == mgr.GetWorld()) {
|
||||||
|
@ -1360,35 +1360,37 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zeus::CTransform modelXf = planeXf * preXf;
|
const zeus::CTransform modelXf = planeXf * preXf;
|
||||||
CMapWorld::CMapWorldDrawParms parms(xa8_renderStates[0].x34_alphaSurfaceVisited * alphaInterp,
|
const CMapWorld::CMapWorldDrawParms parms(xa8_renderStates[0].x34_alphaSurfaceVisited * alphaInterp,
|
||||||
xa8_renderStates[0].x38_alphaOutlineVisited * alphaInterp,
|
xa8_renderStates[0].x38_alphaOutlineVisited * alphaInterp,
|
||||||
xa8_renderStates[0].x3c_alphaSurfaceUnvisited * alphaInterp,
|
xa8_renderStates[0].x3c_alphaSurfaceUnvisited * alphaInterp,
|
||||||
xa8_renderStates[0].x40_alphaOutlineUnvisited * alphaInterp, mapAlpha, 2.f,
|
xa8_renderStates[0].x40_alphaOutlineUnvisited * alphaInterp, mapAlpha,
|
||||||
mgr, modelXf, camXf, *x24_world, mwInfo, x1dc_playerFlashPulse, hintFlash,
|
2.f, mgr, modelXf, camXf, *x24_world, mwInfo, x1dc_playerFlashPulse,
|
||||||
objectScale, true);
|
hintFlash, objectScale, true);
|
||||||
mw->Draw(parms, xa0_curAreaId, xa0_curAreaId, xa8_renderStates[0].x2c_drawDepth1,
|
mw->Draw(parms, xa0_curAreaId, xa0_curAreaId, xa8_renderStates[0].x2c_drawDepth1,
|
||||||
xa8_renderStates[0].x30_drawDepth2, true);
|
xa8_renderStates[0].x30_drawDepth2, true);
|
||||||
}
|
}
|
||||||
} else if (IsInMapperState(EAutoMapperState::MiniMap)) {
|
} else if (IsInMapperState(EAutoMapperState::MiniMap)) {
|
||||||
const CMapWorld* mw = x24_world->IGetMapWorld();
|
CMapWorld* mw = x24_world->IMapWorld();
|
||||||
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo();
|
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo();
|
||||||
CMapWorld::CMapWorldDrawParms parms(xa8_renderStates[0].x34_alphaSurfaceVisited * alphaInterp,
|
const CMapWorld::CMapWorldDrawParms parms(xa8_renderStates[0].x34_alphaSurfaceVisited * alphaInterp,
|
||||||
xa8_renderStates[0].x38_alphaOutlineVisited * alphaInterp,
|
xa8_renderStates[0].x38_alphaOutlineVisited * alphaInterp,
|
||||||
xa8_renderStates[0].x3c_alphaSurfaceUnvisited * alphaInterp,
|
xa8_renderStates[0].x3c_alphaSurfaceUnvisited * alphaInterp,
|
||||||
xa8_renderStates[0].x40_alphaOutlineUnvisited * alphaInterp, mapAlpha, 1.f, mgr,
|
xa8_renderStates[0].x40_alphaOutlineUnvisited * alphaInterp, mapAlpha,
|
||||||
planeXf, camXf, *x24_world, mwInfo, 0.f, 0.f, objectScale, false);
|
1.f, mgr, planeXf, camXf, *x24_world, mwInfo, 0.f, 0.f, objectScale,
|
||||||
|
false);
|
||||||
mw->Draw(parms, xa0_curAreaId, xa4_otherAreaId, xa8_renderStates[0].x2c_drawDepth1,
|
mw->Draw(parms, xa0_curAreaId, xa4_otherAreaId, xa8_renderStates[0].x2c_drawDepth1,
|
||||||
xa8_renderStates[0].x30_drawDepth2, false);
|
xa8_renderStates[0].x30_drawDepth2, false);
|
||||||
} else {
|
} else {
|
||||||
const CMapWorld* mw = x24_world->IGetMapWorld();
|
CMapWorld* mw = x24_world->IMapWorld();
|
||||||
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo();
|
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo();
|
||||||
zeus::CTransform modelXf = planeXf * preXf;
|
zeus::CTransform modelXf = planeXf * preXf;
|
||||||
CMapWorld::CMapWorldDrawParms parms(xa8_renderStates[0].x34_alphaSurfaceVisited * alphaInterp,
|
const CMapWorld::CMapWorldDrawParms parms(xa8_renderStates[0].x34_alphaSurfaceVisited * alphaInterp,
|
||||||
xa8_renderStates[0].x38_alphaOutlineVisited * alphaInterp,
|
xa8_renderStates[0].x38_alphaOutlineVisited * alphaInterp,
|
||||||
xa8_renderStates[0].x3c_alphaSurfaceUnvisited * alphaInterp,
|
xa8_renderStates[0].x3c_alphaSurfaceUnvisited * alphaInterp,
|
||||||
xa8_renderStates[0].x40_alphaOutlineUnvisited * alphaInterp, mapAlpha, 2.f, mgr,
|
xa8_renderStates[0].x40_alphaOutlineUnvisited * alphaInterp, mapAlpha,
|
||||||
modelXf, camXf, *x24_world, mwInfo, 0.f, 0.f, objectScale, true);
|
2.f, mgr, modelXf, camXf, *x24_world, mwInfo, 0.f, 0.f, objectScale,
|
||||||
|
true);
|
||||||
mw->Draw(parms, xa0_curAreaId, xa0_curAreaId, xa8_renderStates[0].x2c_drawDepth1,
|
mw->Draw(parms, xa0_curAreaId, xa0_curAreaId, xa8_renderStates[0].x2c_drawDepth1,
|
||||||
xa8_renderStates[0].x30_drawDepth2, false);
|
xa8_renderStates[0].x30_drawDepth2, false);
|
||||||
}
|
}
|
||||||
|
@ -1410,8 +1412,8 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CMapUniverse::CMapUniverseDrawParms parms(universeInterp, x9c_worldIdx, g_GameState->CurrentWorldAssetId(), hexIdx,
|
const CMapUniverse::CMapUniverseDrawParms parms(universeInterp, x9c_worldIdx, g_GameState->CurrentWorldAssetId(),
|
||||||
x1dc_playerFlashPulse, mgr, planeXf, camXf);
|
hexIdx, x1dc_playerFlashPulse, mgr, planeXf, camXf);
|
||||||
x8_mapu->Draw(parms, zeus::skZero3f, 0.f, 0.f);
|
x8_mapu->Draw(parms, zeus::skZero3f, 0.f, 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1601,7 +1603,7 @@ CAssetId CAutoMapper::GetAreaHintDescriptionString(CAssetId mreaId) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::OnNewInGameGuiState(EInGameGuiState state, const 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();
|
const CWorld& wld = *mgr.GetWorld();
|
||||||
|
|
|
@ -128,7 +128,7 @@ private:
|
||||||
ELoadPhase x4_loadPhase = ELoadPhase::LoadResources;
|
ELoadPhase x4_loadPhase = ELoadPhase::LoadResources;
|
||||||
TLockedToken<CMapUniverse> x8_mapu;
|
TLockedToken<CMapUniverse> x8_mapu;
|
||||||
std::vector<std::unique_ptr<IWorld>> x14_dummyWorlds;
|
std::vector<std::unique_ptr<IWorld>> x14_dummyWorlds;
|
||||||
const CWorld* x24_world;
|
CWorld* x24_world;
|
||||||
TLockedToken<CGuiFrame> x28_frmeMapScreen; // Used to be ptr
|
TLockedToken<CGuiFrame> x28_frmeMapScreen; // Used to be ptr
|
||||||
bool m_frmeInitialized = false;
|
bool m_frmeInitialized = false;
|
||||||
TLockedToken<CModel> x30_miniMapSamus;
|
TLockedToken<CModel> x30_miniMapSamus;
|
||||||
|
@ -197,8 +197,8 @@ private:
|
||||||
void LeaveMapScreen(const CStateManager& mgr);
|
void LeaveMapScreen(const CStateManager& mgr);
|
||||||
void SetupMiniMapWorld(const CStateManager& mgr);
|
void SetupMiniMapWorld(const CStateManager& mgr);
|
||||||
bool HasCurrentMapUniverseWorld() const;
|
bool HasCurrentMapUniverseWorld() const;
|
||||||
bool CheckDummyWorldLoad(const CStateManager& mgr);
|
bool CheckDummyWorldLoad(CStateManager& mgr);
|
||||||
void UpdateHintNavigation(float dt, const CStateManager& mgr);
|
void UpdateHintNavigation(float dt, CStateManager& mgr);
|
||||||
static zeus::CVector2i GetMiniMapViewportSize();
|
static zeus::CVector2i GetMiniMapViewportSize();
|
||||||
static zeus::CVector2i GetMapScreenViewportSize();
|
static zeus::CVector2i GetMapScreenViewportSize();
|
||||||
static float GetMapAreaMiniMapDrawDepth() { return 2.f; }
|
static float GetMapAreaMiniMapDrawDepth() { return 2.f; }
|
||||||
|
@ -241,7 +241,7 @@ public:
|
||||||
void Update(float dt, const CStateManager& mgr);
|
void Update(float dt, const CStateManager& mgr);
|
||||||
void Draw(const CStateManager&, const zeus::CTransform&, float) const;
|
void Draw(const CStateManager&, const zeus::CTransform&, float) const;
|
||||||
float GetTimeIntoInterpolation() const { return x1c8_interpTime; }
|
float GetTimeIntoInterpolation() const { return x1c8_interpTime; }
|
||||||
void BeginMapperStateTransition(EAutoMapperState, const CStateManager&);
|
void BeginMapperStateTransition(EAutoMapperState, CStateManager&);
|
||||||
void CompleteMapperStateTransition(const CStateManager&);
|
void CompleteMapperStateTransition(const CStateManager&);
|
||||||
void ResetInterpolationTimer(float);
|
void ResetInterpolationTimer(float);
|
||||||
SAutoMapperRenderState BuildMiniMapWorldRenderState(const CStateManager&, const zeus::CQuaternion&, TAreaId) const;
|
SAutoMapperRenderState BuildMiniMapWorldRenderState(const CStateManager&, const zeus::CQuaternion&, TAreaId) const;
|
||||||
|
@ -250,7 +250,7 @@ public:
|
||||||
SAutoMapperRenderState BuildMapScreenUniverseRenderState(const CStateManager&, const zeus::CQuaternion&,
|
SAutoMapperRenderState BuildMapScreenUniverseRenderState(const CStateManager&, const zeus::CQuaternion&,
|
||||||
TAreaId) const;
|
TAreaId) const;
|
||||||
void LeaveMapScreenState();
|
void LeaveMapScreenState();
|
||||||
void ProcessMapScreenInput(const CFinalInput& input, const CStateManager& mgr);
|
void ProcessMapScreenInput(const CFinalInput& input, CStateManager& mgr);
|
||||||
zeus::CQuaternion GetMiniMapCameraOrientation(const CStateManager&) const;
|
zeus::CQuaternion GetMiniMapCameraOrientation(const CStateManager&) const;
|
||||||
zeus::CVector3f GetAreaPointOfInterest(const CStateManager&, TAreaId) const;
|
zeus::CVector3f GetAreaPointOfInterest(const CStateManager&, TAreaId) const;
|
||||||
TAreaId FindClosestVisibleArea(const zeus::CVector3f&, const zeus::CUnitVector3f&, const CStateManager&,
|
TAreaId FindClosestVisibleArea(const zeus::CVector3f&, const zeus::CUnitVector3f&, const CStateManager&,
|
||||||
|
@ -267,7 +267,7 @@ public:
|
||||||
bool IsFullyOutOfMiniMapState() const {
|
bool IsFullyOutOfMiniMapState() const {
|
||||||
return x1bc_state != EAutoMapperState::MiniMap && x1c0_nextState != EAutoMapperState::MiniMap;
|
return x1bc_state != EAutoMapperState::MiniMap && x1c0_nextState != EAutoMapperState::MiniMap;
|
||||||
}
|
}
|
||||||
void OnNewInGameGuiState(EInGameGuiState, const CStateManager&);
|
void OnNewInGameGuiState(EInGameGuiState, CStateManager&);
|
||||||
float GetInterp() const {
|
float GetInterp() const {
|
||||||
if (x1c4_interpDur > 0.f)
|
if (x1c4_interpDur > 0.f)
|
||||||
return x1c8_interpTime / x1c4_interpDur;
|
return x1c8_interpTime / x1c4_interpDur;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "Runtime/AutoMapper/CMapWorld.hpp"
|
#include "Runtime/AutoMapper/CMapWorld.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "Runtime/CSimplePool.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Runtime/CStateManager.hpp"
|
#include "Runtime/CStateManager.hpp"
|
||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
|
@ -93,7 +95,7 @@ void CMapWorld::MoveMapAreaToList(CMapWorld::CMapAreaData* data, CMapWorld::EMap
|
||||||
x10_listHeads[int(list)] = data;
|
x10_listHeads[int(list)] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 CMapWorld::GetCurrentMapAreaDepth(const IWorld& wld, TAreaId aid) const {
|
s32 CMapWorld::GetCurrentMapAreaDepth(const IWorld& wld, TAreaId aid) {
|
||||||
ClearTraversedFlags();
|
ClearTraversedFlags();
|
||||||
std::vector<CMapAreaBFSInfo> info;
|
std::vector<CMapAreaBFSInfo> info;
|
||||||
info.reserve(x0_areas.size());
|
info.reserve(x0_areas.size());
|
||||||
|
@ -118,8 +120,8 @@ std::vector<int> CMapWorld::GetVisibleAreas(const IWorld& wld, const CMapWorldIn
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapWorld::Draw(const CMapWorld::CMapWorldDrawParms& parms, int curArea, int otherArea, float depth1, float depth2,
|
void CMapWorld::Draw(const CMapWorldDrawParms& parms, int curArea, int otherArea, float depth1, float depth2,
|
||||||
bool inMapScreen) const {
|
bool inMapScreen) {
|
||||||
if (depth1 == 0.f && depth2 == 0.f)
|
if (depth1 == 0.f && depth2 == 0.f)
|
||||||
return;
|
return;
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP("CMapWorld::Draw", zeus::skBlue);
|
SCOPED_GRAPHICS_DEBUG_GROUP("CMapWorld::Draw", zeus::skBlue);
|
||||||
|
@ -130,7 +132,7 @@ void CMapWorld::Draw(const CMapWorld::CMapWorldDrawParms& parms, int curArea, in
|
||||||
std::vector<CMapAreaBFSInfo> bfsInfos;
|
std::vector<CMapAreaBFSInfo> bfsInfos;
|
||||||
bfsInfos.reserve(x0_areas.size());
|
bfsInfos.reserve(x0_areas.size());
|
||||||
if (curArea != otherArea) {
|
if (curArea != otherArea) {
|
||||||
const_cast<CMapWorld*>(this)->x20_traversed[otherArea] = true;
|
x20_traversed[otherArea] = true;
|
||||||
DoBFS(parms.GetWorld(), curArea, areaDepth, depth1, depth2, true, bfsInfos);
|
DoBFS(parms.GetWorld(), curArea, areaDepth, depth1, depth2, true, bfsInfos);
|
||||||
|
|
||||||
float lowD1 = std::ceil(depth1 - 1.f);
|
float lowD1 = std::ceil(depth1 - 1.f);
|
||||||
|
@ -150,7 +152,7 @@ void CMapWorld::Draw(const CMapWorld::CMapWorldDrawParms& parms, int curArea, in
|
||||||
|
|
||||||
int otherDepth = std::ceil(std::max(newD1, newD2));
|
int otherDepth = std::ceil(std::max(newD1, newD2));
|
||||||
if (parms.GetWorld().IGetAreaAlways(otherArea)->IIsActive()) {
|
if (parms.GetWorld().IGetAreaAlways(otherArea)->IIsActive()) {
|
||||||
const_cast<CMapWorld*>(this)->x20_traversed[otherArea] = false;
|
x20_traversed[otherArea] = false;
|
||||||
DoBFS(parms.GetWorld(), otherArea, otherDepth, newD1, newD2, true, bfsInfos);
|
DoBFS(parms.GetWorld(), otherArea, otherDepth, newD1, newD2, true, bfsInfos);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -161,13 +163,13 @@ void CMapWorld::Draw(const CMapWorld::CMapWorldDrawParms& parms, int curArea, in
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapWorld::DoBFS(const IWorld& wld, int startArea, int areaCount, float surfDepth, float outlineDepth,
|
void CMapWorld::DoBFS(const IWorld& wld, int startArea, int areaCount, float surfDepth, float outlineDepth,
|
||||||
bool checkLoad, std::vector<CMapAreaBFSInfo>& bfsInfos) const {
|
bool checkLoad, std::vector<CMapAreaBFSInfo>& bfsInfos) {
|
||||||
if (areaCount <= 0 || !IsMapAreaValid(wld, startArea, checkLoad))
|
if (areaCount <= 0 || !IsMapAreaValid(wld, startArea, checkLoad))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size_t size = bfsInfos.size();
|
size_t size = bfsInfos.size();
|
||||||
bfsInfos.emplace_back(startArea, 1, surfDepth, outlineDepth);
|
bfsInfos.emplace_back(startArea, 1, surfDepth, outlineDepth);
|
||||||
const_cast<CMapWorld*>(this)->x20_traversed[startArea] = true;
|
x20_traversed[startArea] = true;
|
||||||
|
|
||||||
for (; size != bfsInfos.size(); ++size) {
|
for (; size != bfsInfos.size(); ++size) {
|
||||||
CMapAreaBFSInfo& testInfo = bfsInfos[size];
|
CMapAreaBFSInfo& testInfo = bfsInfos[size];
|
||||||
|
@ -182,7 +184,7 @@ void CMapWorld::DoBFS(const IWorld& wld, int startArea, int areaCount, float sur
|
||||||
TAreaId attId = area->IGetAttachedAreaId(i);
|
TAreaId attId = area->IGetAttachedAreaId(i);
|
||||||
if (IsMapAreaValid(wld, attId, checkLoad) && !x20_traversed[attId]) {
|
if (IsMapAreaValid(wld, attId, checkLoad) && !x20_traversed[attId]) {
|
||||||
bfsInfos.emplace_back(attId, testInfo.GetDepth() + 1, surfDepth, outlineDepth);
|
bfsInfos.emplace_back(attId, testInfo.GetDepth() + 1, surfDepth, outlineDepth);
|
||||||
const_cast<CMapWorld*>(this)->x20_traversed[attId] = true;
|
x20_traversed[attId] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,7 +620,7 @@ static Circle MinCircle(const std::vector<zeus::CVector2f>& coords) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapWorld::RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld& wld) const {
|
void CMapWorld::RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld& wld) {
|
||||||
std::vector<zeus::CVector2f> coords;
|
std::vector<zeus::CVector2f> coords;
|
||||||
coords.reserve(x0_areas.size() * 8);
|
coords.reserve(x0_areas.size() * 8);
|
||||||
float zMin = FLT_MAX;
|
float zMin = FLT_MAX;
|
||||||
|
@ -638,11 +640,10 @@ void CMapWorld::RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Circle circle = MinCircle(coords);
|
const Circle circle = MinCircle(coords);
|
||||||
const_cast<CMapWorld*>(this)->x3c_worldSphereRadius = circle.x8_radius;
|
x3c_worldSphereRadius = circle.x8_radius;
|
||||||
const_cast<CMapWorld*>(this)->x30_worldSpherePoint =
|
x30_worldSpherePoint = zeus::CVector3f(circle.x0_point.x(), circle.x0_point.y(), (zMin + zMax) * 0.5f);
|
||||||
zeus::CVector3f(circle.x0_point.x(), circle.x0_point.y(), (zMin + zMax) * 0.5f);
|
x40_worldSphereHalfDepth = (zMax - zMin) * 0.5f;
|
||||||
const_cast<CMapWorld*>(this)->x40_worldSphereHalfDepth = (zMax - zMin) * 0.5f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::CVector3f CMapWorld::ConstrainToWorldVolume(const zeus::CVector3f& point, const zeus::CVector3f& lookVec) const {
|
zeus::CVector3f CMapWorld::ConstrainToWorldVolume(const zeus::CVector3f& point, const zeus::CVector3f& lookVec) const {
|
||||||
|
@ -670,10 +671,8 @@ zeus::CVector3f CMapWorld::ConstrainToWorldVolume(const zeus::CVector3f& point,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapWorld::ClearTraversedFlags() const {
|
void CMapWorld::ClearTraversedFlags() {
|
||||||
std::vector<bool>& flags = const_cast<CMapWorld*>(this)->x20_traversed;
|
std::fill(x20_traversed.begin(), x20_traversed.end(), false);
|
||||||
for (size_t i = 0; i < flags.size(); ++i)
|
|
||||||
flags[i] = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFactoryFnReturn FMapWorldFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param,
|
CFactoryFnReturn FMapWorldFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param,
|
||||||
|
|
|
@ -142,22 +142,24 @@ private:
|
||||||
float x40_worldSphereHalfDepth = 0.f;
|
float x40_worldSphereHalfDepth = 0.f;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMapWorld(CInputStream&);
|
explicit CMapWorld(CInputStream& in);
|
||||||
u32 GetNumAreas() const { return x0_areas.size(); }
|
u32 GetNumAreas() const { return x0_areas.size(); }
|
||||||
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*, const std::vector<CMapAreaBFSInfo>&) const;
|
bool IsMapAreaInBFSInfoVector(const CMapAreaData* area, const std::vector<CMapAreaBFSInfo>& vec) const;
|
||||||
void SetWhichMapAreasLoaded(const IWorld&, int start, int count);
|
void SetWhichMapAreasLoaded(const IWorld& wld, int start, int count);
|
||||||
bool IsMapAreasStreaming() const;
|
bool IsMapAreasStreaming() const;
|
||||||
void MoveMapAreaToList(CMapAreaData*, EMapAreaList);
|
void MoveMapAreaToList(CMapAreaData* data, EMapAreaList list);
|
||||||
s32 GetCurrentMapAreaDepth(const IWorld&, int areaIdx) const;
|
s32 GetCurrentMapAreaDepth(const IWorld& wld, TAreaId aid);
|
||||||
std::vector<int> GetVisibleAreas(const IWorld&, const CMapWorldInfo&) const;
|
std::vector<int> GetVisibleAreas(const IWorld& wld, const CMapWorldInfo& mwInfo) const;
|
||||||
void Draw(const CMapWorldDrawParms&, int, int, float, float, bool) const;
|
void Draw(const CMapWorldDrawParms& parms, int curArea, int otherArea, float depth1, float depth2, bool inMapScreen);
|
||||||
void DoBFS(const IWorld&, int, int, float, float, bool, std::vector<CMapAreaBFSInfo>&) const;
|
void DoBFS(const IWorld& wld, int startArea, int areaCount, float surfDepth, float outlineDepth, bool checkLoad,
|
||||||
bool IsMapAreaValid(const IWorld&, int, bool) const;
|
std::vector<CMapAreaBFSInfo>& bfsInfos);
|
||||||
void DrawAreas(const CMapWorldDrawParms&, int, const std::vector<CMapAreaBFSInfo>&, bool) const;
|
bool IsMapAreaValid(const IWorld& wld, int areaIdx, bool checkLoad) const;
|
||||||
void RecalculateWorldSphere(const CMapWorldInfo&, const IWorld&) const;
|
void DrawAreas(const CMapWorldDrawParms& parms, int selArea, const std::vector<CMapAreaBFSInfo>& bfsInfos,
|
||||||
zeus::CVector3f ConstrainToWorldVolume(const zeus::CVector3f&, const zeus::CVector3f&) const;
|
bool inMapScreen) const;
|
||||||
void ClearTraversedFlags() const;
|
void RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld& wld);
|
||||||
|
zeus::CVector3f ConstrainToWorldVolume(const zeus::CVector3f& point, const zeus::CVector3f& lookVec) const;
|
||||||
|
void ClearTraversedFlags();
|
||||||
};
|
};
|
||||||
|
|
||||||
CFactoryFnReturn FMapWorldFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param,
|
CFactoryFnReturn FMapWorldFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param,
|
||||||
|
|
Loading…
Reference in New Issue