2019-12-22 20:04:07 +00:00
|
|
|
#include "Runtime/World/IGameArea.hpp"
|
2022-02-18 07:37:54 +00:00
|
|
|
#include "Runtime/IOStreams.hpp"
|
2016-04-23 18:04:49 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
|
|
|
IGameArea::Dock::Dock(metaforce::CInputStream& in, const zeus::CTransform& xf) {
|
2022-02-18 07:37:54 +00:00
|
|
|
u32 refCount = in.ReadLong();
|
2018-12-08 05:30:43 +00:00
|
|
|
x4_dockReferences.reserve(refCount);
|
|
|
|
for (u32 i = 0; i < refCount; i++) {
|
|
|
|
SDockReference ref;
|
2022-02-18 07:37:54 +00:00
|
|
|
ref.x0_area = in.ReadLong();
|
|
|
|
ref.x4_dock = in.ReadLong();
|
2018-12-08 05:30:43 +00:00
|
|
|
x4_dockReferences.push_back(ref);
|
|
|
|
}
|
2016-04-23 18:04:49 +00:00
|
|
|
|
2022-02-18 07:37:54 +00:00
|
|
|
u32 vertCount = in.ReadLong();
|
2016-04-23 18:04:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
for (u32 i = 0; i < vertCount; i++) {
|
2022-02-18 07:37:54 +00:00
|
|
|
zeus::CVector3f vert = in.Get<zeus::CVector3f>();
|
2018-12-08 05:30:43 +00:00
|
|
|
x14_planeVertices.push_back(xf * vert);
|
|
|
|
}
|
2016-04-23 18:04:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
TAreaId IGameArea::Dock::GetConnectedAreaId(s32 other) const {
|
|
|
|
if (x4_dockReferences.empty())
|
|
|
|
return kInvalidAreaId;
|
2016-04-23 18:04:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return x4_dockReferences[other].x0_area;
|
2016-04-23 18:04:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
s16 IGameArea::Dock::GetOtherDockNumber(s32 other) const {
|
|
|
|
if (u32(other) >= x4_dockReferences.size() || other < 0)
|
|
|
|
return -1;
|
2016-04-23 18:04:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return x4_dockReferences[other].x4_dock;
|
2016-04-23 18:04:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool IGameArea::Dock::GetShouldLoadOther(s32 other) const {
|
|
|
|
if (other >= x4_dockReferences.size())
|
|
|
|
return false;
|
2016-12-22 02:48:22 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return x4_dockReferences[other].x6_loadOther;
|
2016-04-23 18:04:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void IGameArea::Dock::SetShouldLoadOther(s32 other, bool should) {
|
|
|
|
if (other >= x4_dockReferences.size())
|
|
|
|
return;
|
2017-01-04 04:08:30 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x4_dockReferences[other].x6_loadOther = should;
|
2016-04-23 18:04:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool IGameArea::Dock::ShouldLoadOtherArea(s32 other) const {
|
|
|
|
if (x4_dockReferences.size() == 0)
|
|
|
|
return false;
|
2017-01-04 04:08:30 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return x4_dockReferences[other].x6_loadOther;
|
2016-04-23 18:04:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CVector3f IGameArea::Dock::GetPoint(s32 idx) const {
|
|
|
|
if (idx >= x14_planeVertices.size() || idx < 0)
|
|
|
|
return zeus::CVector3f();
|
2016-04-23 18:04:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return x14_planeVertices[idx];
|
2016-04-23 18:04:49 +00:00
|
|
|
}
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|