CMapArea: Make use of std::array where applicable

This commit is contained in:
Lioncash 2020-03-17 19:24:41 -04:00
parent 62682fe19f
commit 03f7047549
1 changed files with 54 additions and 46 deletions

View File

@ -1,5 +1,8 @@
#include "Runtime/AutoMapper/CMapArea.hpp" #include "Runtime/AutoMapper/CMapArea.hpp"
#include <array>
#include <cstring>
#include "Runtime/CResFactory.hpp" #include "Runtime/CResFactory.hpp"
#include "Runtime/CToken.hpp" #include "Runtime/CToken.hpp"
#include "Runtime/GameGlobalObjects.hpp" #include "Runtime/GameGlobalObjects.hpp"
@ -8,6 +11,57 @@
#include "Runtime/World/CWorld.hpp" #include "Runtime/World/CWorld.hpp"
namespace urde { namespace urde {
constexpr std::array<zeus::CVector3f, 3> MinesPostTransforms{{
{0.f, 0.f, 200.f},
{0.f, 0.f, 0.f},
{0.f, 0.f, -200.f},
}};
constexpr std::array<u8, 42> MinesPostTransformIndices{
0, // 00 Transport to Tallon Overworld South
0, // 01 Quarry Access
0, // 02 Main Quarry
0, // 03 Waste Disposal
0, // 04 Save Station Mines A
0, // 05 Security Access A
0, // 06 Ore Processing
0, // 07 Mine Security Station
0, // 08 Research Access
0, // 09 Storage Depot B
0, // 10 Elevator Access A
0, // 11 Security Access B
0, // 12 Storage Depot A
0, // 13 Elite Research
0, // 14 Elevator A
1, // 15 Elite Control Access
1, // 16 Elite Control
1, // 17 Maintenance Tunnel
1, // 18 Ventilation Shaft
2, // 19 Phazon Processing Center
1, // 20 Omega Research
2, // 21 Transport Access
2, // 22 Processing Center Access
1, // 23 Map Station Mines
1, // 24 Dynamo Access
2, // 25 Transport to Magmoor Caverns South
2, // 26 Elite Quarters
1, // 27 Central Dynamo
2, // 28 Elite Quarters Access
1, // 29 Quarantine Access A
1, // 30 Save Station Mines B
2, // 31 Metroid Quarantine B
1, // 32 Metroid Quarantine A
2, // 33 Quarantine Access B
2, // 34 Save Station Mines C
1, // 35 Elevator Access B
2, // 36 Fungal Hall B
1, // 37 Elevator B
2, // 38 Missile Station Mines
2, // 39 Phazon Mining Tunnel
2, // 40 Fungal Hall Access
2, // 41 Fungal Hall A
};
CMapArea::CMapArea(CInputStream& in, u32 size) CMapArea::CMapArea(CInputStream& in, u32 size)
: x0_magic(in.readUint32()) : x0_magic(in.readUint32())
, x4_version(in.readUint32Big()) , x4_version(in.readUint32Big())
@ -107,52 +161,6 @@ bool CMapArea::GetIsVisibleToAutoMapper(bool worldVis, bool areaVis) const {
} }
} }
static const zeus::CVector3f MinesPostTransforms[3] = {{0.f, 0.f, 200.f}, {0.f, 0.f, 0.f}, {0.f, 0.f, -200.f}};
static const u8 MinesPostTransformIndices[] = {
0, // 00 Transport to Tallon Overworld South
0, // 01 Quarry Access
0, // 02 Main Quarry
0, // 03 Waste Disposal
0, // 04 Save Station Mines A
0, // 05 Security Access A
0, // 06 Ore Processing
0, // 07 Mine Security Station
0, // 08 Research Access
0, // 09 Storage Depot B
0, // 10 Elevator Access A
0, // 11 Security Access B
0, // 12 Storage Depot A
0, // 13 Elite Research
0, // 14 Elevator A
1, // 15 Elite Control Access
1, // 16 Elite Control
1, // 17 Maintenance Tunnel
1, // 18 Ventilation Shaft
2, // 19 Phazon Processing Center
1, // 20 Omega Research
2, // 21 Transport Access
2, // 22 Processing Center Access
1, // 23 Map Station Mines
1, // 24 Dynamo Access
2, // 25 Transport to Magmoor Caverns South
2, // 26 Elite Quarters
1, // 27 Central Dynamo
2, // 28 Elite Quarters Access
1, // 29 Quarantine Access A
1, // 30 Save Station Mines B
2, // 31 Metroid Quarantine B
1, // 32 Metroid Quarantine A
2, // 33 Quarantine Access B
2, // 34 Save Station Mines C
1, // 35 Elevator Access B
2, // 36 Fungal Hall B
1, // 37 Elevator B
2, // 38 Missile Station Mines
2, // 39 Phazon Mining Tunnel
2, // 40 Fungal Hall Access
2, // 41 Fungal Hall A
};
zeus::CTransform CMapArea::GetAreaPostTransform(const IWorld& world, TAreaId aid) const { zeus::CTransform CMapArea::GetAreaPostTransform(const IWorld& world, TAreaId aid) const {
if (world.IGetWorldAssetId() == 0xB1AC4D65) // Phazon Mines if (world.IGetWorldAssetId() == 0xB1AC4D65) // Phazon Mines
{ {