mirror of https://github.com/AxioDL/metaforce.git
Runtime: Collapse emplace_back() calls where applicable
Same behavior, but with less code.
This commit is contained in:
parent
df4487bae8
commit
097d4a4422
|
@ -30,8 +30,7 @@ void CMapArea::PostConstruct() {
|
||||||
|
|
||||||
m_mappableObjects.reserve(x28_mappableObjCount);
|
m_mappableObjects.reserve(x28_mappableObjCount);
|
||||||
for (u32 i = 0, j = 0; i < x28_mappableObjCount; ++i, j += 0x50) {
|
for (u32 i = 0, j = 0; i < x28_mappableObjCount; ++i, j += 0x50) {
|
||||||
m_mappableObjects.emplace_back(x38_moStart + j);
|
m_mappableObjects.emplace_back(x38_moStart + j).PostConstruct(x44_buf.get());
|
||||||
m_mappableObjects.back().PostConstruct(x44_buf.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u8* tmp = x3c_vertexStart;
|
u8* tmp = x3c_vertexStart;
|
||||||
|
@ -45,8 +44,7 @@ void CMapArea::PostConstruct() {
|
||||||
std::vector<u32> index;
|
std::vector<u32> index;
|
||||||
m_surfaces.reserve(x30_surfaceCount);
|
m_surfaces.reserve(x30_surfaceCount);
|
||||||
for (u32 i = 0, j = 0; i < x30_surfaceCount; ++i, j += 32) {
|
for (u32 i = 0, j = 0; i < x30_surfaceCount; ++i, j += 32) {
|
||||||
m_surfaces.emplace_back(x40_surfaceStart + j);
|
m_surfaces.emplace_back(x40_surfaceStart + j).PostConstruct(x44_buf.get(), index);
|
||||||
m_surfaces.back().PostConstruct(x44_buf.get(), index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CGraphics::CommitResources([this, &index](boo::IGraphicsDataFactory::Context& ctx) {
|
CGraphics::CommitResources([this, &index](boo::IGraphicsDataFactory::Context& ctx) {
|
||||||
|
@ -60,8 +58,7 @@ void CMapArea::PostConstruct() {
|
||||||
CMapAreaSurface& surf = m_surfaces[i];
|
CMapAreaSurface& surf = m_surfaces[i];
|
||||||
surf.m_instances.reserve(instCount);
|
surf.m_instances.reserve(instCount);
|
||||||
for (u32 inst = 0; inst < instCount; ++inst) {
|
for (u32 inst = 0; inst < instCount; ++inst) {
|
||||||
surf.m_instances.emplace_back(ctx, m_vbo, m_ibo);
|
CMapAreaSurface::Instance& instance = surf.m_instances.emplace_back(ctx, m_vbo, m_ibo);
|
||||||
CMapAreaSurface::Instance& instance = surf.m_instances.back();
|
|
||||||
|
|
||||||
athena::io::MemoryReader r(surf.x1c_outlineOffset, INT_MAX);
|
athena::io::MemoryReader r(surf.x1c_outlineOffset, INT_MAX);
|
||||||
u32 outlineCount = r.readUint32Big();
|
u32 outlineCount = r.readUint32Big();
|
||||||
|
|
|
@ -17,11 +17,10 @@ CMapUniverse::CMapUniverse(CInputStream& in, u32 version) : x0_hexagonId(in.read
|
||||||
CMapUniverse::CMapWorldData::CMapWorldData(CInputStream& in, u32 version)
|
CMapUniverse::CMapWorldData::CMapWorldData(CInputStream& in, u32 version)
|
||||||
: x0_label(in.readString()), x10_worldAssetId(in.readUint32Big()) {
|
: x0_label(in.readString()), x10_worldAssetId(in.readUint32Big()) {
|
||||||
x14_transform.read34RowMajor(in);
|
x14_transform.read34RowMajor(in);
|
||||||
u32 worldCount = in.readUint32Big();
|
const u32 worldCount = in.readUint32Big();
|
||||||
x44_hexagonXfs.reserve(worldCount);
|
x44_hexagonXfs.reserve(worldCount);
|
||||||
for (u32 i = 0; i < worldCount; ++i) {
|
for (u32 i = 0; i < worldCount; ++i) {
|
||||||
x44_hexagonXfs.emplace_back();
|
x44_hexagonXfs.emplace_back().read34RowMajor(in);
|
||||||
x44_hexagonXfs.back().read34RowMajor(in);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version != 0)
|
if (version != 0)
|
||||||
|
|
|
@ -29,14 +29,14 @@ u8* CGameAllocator::Alloc(size_t len) {
|
||||||
|
|
||||||
/* Pad size to allow for allocation information */
|
/* Pad size to allow for allocation information */
|
||||||
allocSz = ROUND_UP_64(allocSz + sizeof(SChunkDescription));
|
allocSz = ROUND_UP_64(allocSz + sizeof(SChunkDescription));
|
||||||
m_allocations.emplace_back();
|
auto& alloc = m_allocations.emplace_back();
|
||||||
m_allocations.back().memptr.reset(new u8[allocSz]);
|
alloc.memptr.reset(new u8[allocSz]);
|
||||||
u8* ptr = m_allocations.back().memptr.get();
|
u8* ptr = alloc.memptr.get();
|
||||||
m_allocations.back().allocSize = allocSz;
|
alloc.allocSize = allocSz;
|
||||||
m_allocations.back().freeOffset += roundedLen;
|
alloc.freeOffset += roundedLen;
|
||||||
SChunkDescription* chunkInfo = reinterpret_cast<SChunkDescription*>(ptr);
|
SChunkDescription* chunkInfo = reinterpret_cast<SChunkDescription*>(ptr);
|
||||||
*chunkInfo = SChunkDescription();
|
*chunkInfo = SChunkDescription();
|
||||||
chunkInfo->parent = &m_allocations.back();
|
chunkInfo->parent = &alloc;
|
||||||
chunkInfo->len = len;
|
chunkInfo->len = len;
|
||||||
return ptr + sizeof(SChunkDescription);
|
return ptr + sizeof(SChunkDescription);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,43 +5,49 @@
|
||||||
namespace urde {
|
namespace urde {
|
||||||
CSaveWorld::CSaveWorld(CInputStream& in) {
|
CSaveWorld::CSaveWorld(CInputStream& in) {
|
||||||
in.readUint32Big();
|
in.readUint32Big();
|
||||||
u32 version = in.readUint32Big();
|
const u32 version = in.readUint32Big();
|
||||||
if (version > 1)
|
if (version > 1) {
|
||||||
x0_areaCount = in.readUint32Big();
|
x0_areaCount = in.readUint32Big();
|
||||||
if (version > 2) {
|
|
||||||
u32 cinematicCount = in.readUint32Big();
|
|
||||||
x4_cinematics.reserve(cinematicCount);
|
|
||||||
for (u32 i = 0; i < cinematicCount; ++i)
|
|
||||||
x4_cinematics.push_back(in.readUint32Big());
|
|
||||||
|
|
||||||
u32 relayCount = in.readUint32Big();
|
|
||||||
x14_relays.reserve(relayCount);
|
|
||||||
for (u32 i = 0; i < relayCount; ++i)
|
|
||||||
x14_relays.push_back(in.readUint32Big());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 layerCount = in.readUint32Big();
|
if (version > 2) {
|
||||||
|
const u32 cinematicCount = in.readUint32Big();
|
||||||
|
x4_cinematics.reserve(cinematicCount);
|
||||||
|
for (u32 i = 0; i < cinematicCount; ++i) {
|
||||||
|
x4_cinematics.push_back(in.readUint32Big());
|
||||||
|
}
|
||||||
|
|
||||||
|
const u32 relayCount = in.readUint32Big();
|
||||||
|
x14_relays.reserve(relayCount);
|
||||||
|
for (u32 i = 0; i < relayCount; ++i) {
|
||||||
|
x14_relays.push_back(in.readUint32Big());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const u32 layerCount = in.readUint32Big();
|
||||||
x24_layers.reserve(layerCount);
|
x24_layers.reserve(layerCount);
|
||||||
for (u32 i = 0; i < layerCount; ++i) {
|
for (u32 i = 0; i < layerCount; ++i) {
|
||||||
x24_layers.emplace_back();
|
SLayerState& st = x24_layers.emplace_back();
|
||||||
SLayerState& st = x24_layers.back();
|
|
||||||
st.x0_area = in.readUint32Big();
|
st.x0_area = in.readUint32Big();
|
||||||
st.x4_layer = in.readUint32Big();
|
st.x4_layer = in.readUint32Big();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 doorCount = in.readUint32Big();
|
const u32 doorCount = in.readUint32Big();
|
||||||
x34_doors.reserve(doorCount);
|
x34_doors.reserve(doorCount);
|
||||||
for (u32 i = 0; i < doorCount; ++i)
|
for (u32 i = 0; i < doorCount; ++i) {
|
||||||
x34_doors.push_back(in.readUint32Big());
|
x34_doors.push_back(in.readUint32Big());
|
||||||
if (version > 0) {
|
}
|
||||||
u32 scanCount = in.readUint32Big();
|
|
||||||
x44_scans.reserve(scanCount);
|
if (version <= 0) {
|
||||||
for (u32 i = 0; i < scanCount; ++i) {
|
return;
|
||||||
x44_scans.emplace_back();
|
}
|
||||||
SScanState& st = x44_scans.back();
|
|
||||||
st.x0_id = in.readUint32Big();
|
const u32 scanCount = in.readUint32Big();
|
||||||
st.x4_category = EScanCategory(in.readUint32Big());
|
x44_scans.reserve(scanCount);
|
||||||
}
|
for (u32 i = 0; i < scanCount; ++i) {
|
||||||
|
SScanState& st = x44_scans.emplace_back();
|
||||||
|
st.x0_id = in.readUint32Big();
|
||||||
|
st.x4_category = EScanCategory(in.readUint32Big());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,7 @@ void CCameraManager::RemoveCameraShaker(u32 id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int CCameraManager::AddCameraShaker(const CCameraShakeData& data, bool sfx) {
|
int CCameraManager::AddCameraShaker(const CCameraShakeData& data, bool sfx) {
|
||||||
x14_shakers.emplace_back(data);
|
x14_shakers.emplace_back(data).xbc_shakerId = ++x2c_lastShakeId;
|
||||||
x14_shakers.back().xbc_shakerId = ++x2c_lastShakeId;
|
|
||||||
if (!xa0_24_pendingRumble) {
|
if (!xa0_24_pendingRumble) {
|
||||||
xa0_24_pendingRumble = true;
|
xa0_24_pendingRumble = true;
|
||||||
x90_rumbleCooldown = 0.5f;
|
x90_rumbleCooldown = 0.5f;
|
||||||
|
|
|
@ -266,8 +266,7 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea&
|
||||||
zeus::CSphere sphere(light.GetPosition(), light.GetRadius() * 2.f);
|
zeus::CSphere sphere(light.GetPosition(), light.GetRadius() * 2.f);
|
||||||
if (aabb.intersects(sphere)) {
|
if (aabb.intersects(sphere)) {
|
||||||
/* Light passes as candidate */
|
/* Light passes as candidate */
|
||||||
valList.emplace_back();
|
SLightValue& value = valList.emplace_back();
|
||||||
SLightValue& value = valList.back();
|
|
||||||
value.x0_areaLightIdx = lightIdx;
|
value.x0_areaLightIdx = lightIdx;
|
||||||
value.x4_color = light.GetNormalIndependentLightingAtPoint(vec);
|
value.x4_color = light.GetNormalIndependentLightingAtPoint(vec);
|
||||||
value.x4_color.a() = 0.f;
|
value.x4_color.a() = 0.f;
|
||||||
|
|
|
@ -51,18 +51,16 @@ std::unique_ptr<float[]> RotationAndOffsetStorage::GetRotationsAndOffsets(const
|
||||||
}
|
}
|
||||||
|
|
||||||
RotationAndOffsetStorage::CRotationAndOffsetVectors::CRotationAndOffsetVectors(CInputStream& in) {
|
RotationAndOffsetStorage::CRotationAndOffsetVectors::CRotationAndOffsetVectors(CInputStream& in) {
|
||||||
u32 quatCount = in.readUint32Big();
|
const u32 quatCount = in.readUint32Big();
|
||||||
x0_rotations.reserve(quatCount);
|
x0_rotations.reserve(quatCount);
|
||||||
for (u32 i = 0; i < quatCount; ++i) {
|
for (u32 i = 0; i < quatCount; ++i) {
|
||||||
x0_rotations.emplace_back();
|
x0_rotations.emplace_back().readBig(in);
|
||||||
x0_rotations.back().readBig(in);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 vecCount = in.readUint32Big();
|
const u32 vecCount = in.readUint32Big();
|
||||||
x10_offsets.reserve(vecCount);
|
x10_offsets.reserve(vecCount);
|
||||||
for (u32 i = 0; i < vecCount; ++i) {
|
for (u32 i = 0; i < vecCount; ++i) {
|
||||||
x10_offsets.emplace_back();
|
x10_offsets.emplace_back().readBig(in);
|
||||||
x10_offsets.back().readBig(in);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1721,8 +1721,7 @@ pas::EAnimationState CBSLocomotion::GetBodyStateTransition(float, CBodyControlle
|
||||||
CBSBiPedLocomotion::CBSBiPedLocomotion(CActor& actor) {
|
CBSBiPedLocomotion::CBSBiPedLocomotion(CActor& actor) {
|
||||||
const CPASDatabase& pasDatabase = actor.GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase();
|
const CPASDatabase& pasDatabase = actor.GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase();
|
||||||
for (int i = 0; i < 14; ++i) {
|
for (int i = 0; i < 14; ++i) {
|
||||||
x8_anims.emplace_back();
|
rstl::reserved_vector<std::pair<s32, float>, 8>& innerVec = x8_anims.emplace_back();
|
||||||
rstl::reserved_vector<std::pair<s32, float>, 8>& innerVec = x8_anims.back();
|
|
||||||
for (int j = 0; j < 8; ++j) {
|
for (int j = 0; j < 8; ++j) {
|
||||||
CPASAnimParmData parms(5, CPASAnimParm::FromEnum(j), CPASAnimParm::FromEnum(i));
|
CPASAnimParmData parms(5, CPASAnimParm::FromEnum(j), CPASAnimParm::FromEnum(i));
|
||||||
std::pair<float, s32> best = pasDatabase.FindBestAnimation(parms, -1);
|
std::pair<float, s32> best = pasDatabase.FindBestAnimation(parms, -1);
|
||||||
|
|
|
@ -263,13 +263,15 @@ GeometryUniformLayout::GeometryUniformLayout(const CModel* model, const Material
|
||||||
}
|
}
|
||||||
|
|
||||||
CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf) {
|
CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf) {
|
||||||
if (!x40_24_texturesLoaded && !g_DummyTextures)
|
if (!x40_24_texturesLoaded && !g_DummyTextures) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_instances.size() >= 512)
|
if (m_instances.size() >= 512) {
|
||||||
Log.report(logvisor::Fatal, fmt("Model buffer overflow"));
|
Log.report(logvisor::Fatal, fmt("Model buffer overflow"));
|
||||||
m_instances.emplace_back();
|
}
|
||||||
ModelInstance& newInst = m_instances.back();
|
|
||||||
|
ModelInstance& newInst = m_instances.emplace_back();
|
||||||
|
|
||||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||||
/* Build geometry uniform buffer if shared not available */
|
/* Build geometry uniform buffer if shared not available */
|
||||||
|
@ -371,8 +373,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf) {
|
||||||
|
|
||||||
const CModelShaders::ShaderPipelines& pipelines = m_pipelines->at(surf.m_data.matIdx);
|
const CModelShaders::ShaderPipelines& pipelines = m_pipelines->at(surf.m_data.matIdx);
|
||||||
|
|
||||||
newInst.m_shaderDataBindings.emplace_back();
|
std::vector<boo::ObjToken<boo::IShaderDataBinding>>& extendeds = newInst.m_shaderDataBindings.emplace_back();
|
||||||
std::vector<boo::ObjToken<boo::IShaderDataBinding>>& extendeds = newInst.m_shaderDataBindings.back();
|
|
||||||
extendeds.reserve(pipelines->size());
|
extendeds.reserve(pipelines->size());
|
||||||
|
|
||||||
EExtendedShader idx{};
|
EExtendedShader idx{};
|
||||||
|
@ -1171,10 +1172,9 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
|
||||||
const u8* dataCur = data.get() + ROUND_UP_32(0x2c + secCount * 4);
|
const u8* dataCur = data.get() + ROUND_UP_32(0x2c + secCount * 4);
|
||||||
const u32* secSizeCur = reinterpret_cast<const u32*>(data.get() + 0x2c);
|
const u32* secSizeCur = reinterpret_cast<const u32*>(data.get() + 0x2c);
|
||||||
for (u32 i = 0; i < matSetCount; ++i) {
|
for (u32 i = 0; i < matSetCount; ++i) {
|
||||||
u32 matSetSz = hecl::SBig(*secSizeCur);
|
const u32 matSetSz = hecl::SBig(*secSizeCur);
|
||||||
const u8* sec = MemoryFromPartData(dataCur, secSizeCur);
|
const u8* sec = MemoryFromPartData(dataCur, secSizeCur);
|
||||||
x18_matSets.emplace_back(i);
|
SShader& shader = x18_matSets.emplace_back(i);
|
||||||
SShader& shader = x18_matSets.back();
|
|
||||||
athena::io::MemoryReader r(sec, matSetSz);
|
athena::io::MemoryReader r(sec, matSetSz);
|
||||||
shader.m_matSet.read(r);
|
shader.m_matSet.read(r);
|
||||||
CBooModel::MakeTexturesFromMats(shader.m_matSet, shader.x0_textures, *store);
|
CBooModel::MakeTexturesFromMats(shader.m_matSet, shader.x0_textures, *store);
|
||||||
|
@ -1217,13 +1217,12 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
|
||||||
return true;
|
return true;
|
||||||
} BooTrace);
|
} BooTrace);
|
||||||
|
|
||||||
u32 surfCount = hecl::SBig(*reinterpret_cast<const u32*>(surfInfo));
|
const u32 surfCount = hecl::SBig(*reinterpret_cast<const u32*>(surfInfo));
|
||||||
x8_surfaces.reserve(surfCount);
|
x8_surfaces.reserve(surfCount);
|
||||||
for (u32 i = 0; i < surfCount; ++i) {
|
for (u32 i = 0; i < surfCount; ++i) {
|
||||||
u32 surfSz = hecl::SBig(*secSizeCur);
|
const u32 surfSz = hecl::SBig(*secSizeCur);
|
||||||
const u8* sec = MemoryFromPartData(dataCur, secSizeCur);
|
const u8* sec = MemoryFromPartData(dataCur, secSizeCur);
|
||||||
x8_surfaces.emplace_back();
|
CBooSurface& surf = x8_surfaces.emplace_back();
|
||||||
CBooSurface& surf = x8_surfaces.back();
|
|
||||||
surf.selfIdx = i;
|
surf.selfIdx = i;
|
||||||
athena::io::MemoryReader r(sec, surfSz);
|
athena::io::MemoryReader r(sec, surfSz);
|
||||||
surf.m_data.read(r);
|
surf.m_data.read(r);
|
||||||
|
|
|
@ -205,8 +205,7 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
||||||
/* Allocate textures here (rather than at decode time) */
|
/* Allocate textures here (rather than at decode time) */
|
||||||
x80_textures.reserve(3);
|
x80_textures.reserve(3);
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
x80_textures.emplace_back();
|
CTHPTextureSet& set = x80_textures.emplace_back();
|
||||||
CTHPTextureSet& set = x80_textures.back();
|
|
||||||
if (deinterlace) {
|
if (deinterlace) {
|
||||||
/* urde addition: this way interlaced THPs don't look horrible */
|
/* urde addition: this way interlaced THPs don't look horrible */
|
||||||
set.Y[0] = ctx.newDynamicTexture(x6c_videoInfo.width, x6c_videoInfo.height / 2, boo::TextureFormat::I8,
|
set.Y[0] = ctx.newDynamicTexture(x6c_videoInfo.width, x6c_videoInfo.height / 2, boo::TextureFormat::I8,
|
||||||
|
|
|
@ -31,8 +31,8 @@ CHudRadarInterface::CHudRadarInterface(CGuiFrame& baseHud, CStateManager& stateM
|
||||||
void CHudRadarInterface::DoDrawRadarPaint(const zeus::CVector3f& translate, float radius,
|
void CHudRadarInterface::DoDrawRadarPaint(const zeus::CVector3f& translate, float radius,
|
||||||
const zeus::CColor& color) const {
|
const zeus::CColor& color) const {
|
||||||
radius *= 4.f;
|
radius *= 4.f;
|
||||||
m_paintInsts.emplace_back();
|
|
||||||
CRadarPaintShader::Instance& inst = m_paintInsts.back();
|
CRadarPaintShader::Instance& inst = m_paintInsts.emplace_back();
|
||||||
inst.pos[0] = translate + zeus::CVector3f(-radius, 0.f, radius);
|
inst.pos[0] = translate + zeus::CVector3f(-radius, 0.f, radius);
|
||||||
inst.uv[0].assign(0.f, 1.f);
|
inst.uv[0].assign(0.f, 1.f);
|
||||||
inst.pos[1] = translate + zeus::CVector3f(-radius, 0.f, -radius);
|
inst.pos[1] = translate + zeus::CVector3f(-radius, 0.f, -radius);
|
||||||
|
|
|
@ -185,8 +185,8 @@ void CTextRenderBuffer::AddCharacter(const zeus::CVector2i& offset, char16_t ch,
|
||||||
m_primitiveMarks.push_back({Command::CharacterRender, m_activeFontCh, chs.m_charCount++});
|
m_primitiveMarks.push_back({Command::CharacterRender, m_activeFontCh, chs.m_charCount++});
|
||||||
else {
|
else {
|
||||||
const CGlyph* glyph = chs.m_font.GetObj()->GetGlyph(ch);
|
const CGlyph* glyph = chs.m_font.GetObj()->GetGlyph(ch);
|
||||||
chs.m_charData.emplace_back();
|
|
||||||
CTextSupportShader::CharacterInstance& inst = chs.m_charData.back();
|
CTextSupportShader::CharacterInstance& inst = chs.m_charData.emplace_back();
|
||||||
inst.SetMetrics(*glyph, offset);
|
inst.SetMetrics(*glyph, offset);
|
||||||
inst.m_fontColor = m_main * color;
|
inst.m_fontColor = m_main * color;
|
||||||
inst.m_outlineColor = m_outline * color;
|
inst.m_outlineColor = m_outline * color;
|
||||||
|
|
|
@ -114,8 +114,7 @@ void CDecal::RenderQuad(CQuadDecal& decal, const SQuadDescr& desc) const {
|
||||||
g_instTexData.clear();
|
g_instTexData.clear();
|
||||||
g_instTexData.reserve(1);
|
g_instTexData.reserve(1);
|
||||||
|
|
||||||
g_instTexData.emplace_back();
|
SParticleInstanceTex& inst = g_instTexData.emplace_back();
|
||||||
SParticleInstanceTex& inst = g_instTexData.back();
|
|
||||||
if (decal.x8_rotation == 0.f) {
|
if (decal.x8_rotation == 0.f) {
|
||||||
inst.pos[0] = zeus::CVector3f(-size, 0.001f, size);
|
inst.pos[0] = zeus::CVector3f(-size, 0.001f, size);
|
||||||
inst.pos[1] = zeus::CVector3f(size, 0.001f, size);
|
inst.pos[1] = zeus::CVector3f(size, 0.001f, size);
|
||||||
|
@ -142,8 +141,7 @@ void CDecal::RenderQuad(CQuadDecal& decal, const SQuadDescr& desc) const {
|
||||||
g_instNoTexData.clear();
|
g_instNoTexData.clear();
|
||||||
g_instNoTexData.reserve(1);
|
g_instNoTexData.reserve(1);
|
||||||
|
|
||||||
g_instNoTexData.emplace_back();
|
SParticleInstanceNoTex& inst = g_instNoTexData.emplace_back();
|
||||||
SParticleInstanceNoTex& inst = g_instNoTexData.back();
|
|
||||||
if (decal.x8_rotation == 0.f) {
|
if (decal.x8_rotation == 0.f) {
|
||||||
inst.pos[0] = zeus::CVector3f(-size, 0.001f, size);
|
inst.pos[0] = zeus::CVector3f(-size, 0.001f, size);
|
||||||
inst.pos[1] = zeus::CVector3f(size, 0.001f, size);
|
inst.pos[1] = zeus::CVector3f(size, 0.001f, size);
|
||||||
|
|
|
@ -493,17 +493,18 @@ void CElementGen::CreateNewParticles(int count) {
|
||||||
CParticleGlobals::instance()->m_particleAccessParameters = nullptr;
|
CParticleGlobals::instance()->m_particleAccessParameters = nullptr;
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
x30_particles.emplace_back();
|
CParticle& particle = x30_particles.emplace_back();
|
||||||
++g_ParticleAliveCount;
|
++g_ParticleAliveCount;
|
||||||
++x25c_activeParticleCount;
|
++x25c_activeParticleCount;
|
||||||
++x260_cumulativeParticles;
|
++x260_cumulativeParticles;
|
||||||
if (x2c_orientType == EModelOrientationType::One)
|
if (x2c_orientType == EModelOrientationType::One) {
|
||||||
x50_parentMatrices[x30_particles.size() - 1] = x1d8_orientation.buildMatrix3f();
|
x50_parentMatrices[x30_particles.size() - 1] = x1d8_orientation.buildMatrix3f();
|
||||||
|
}
|
||||||
|
|
||||||
CParticle& particle = x30_particles.back();
|
|
||||||
particle.x28_startFrame = x74_curFrame;
|
particle.x28_startFrame = x74_curFrame;
|
||||||
if (CIntElement* ltme = desc->x34_x28_LTME.get())
|
if (CIntElement* ltme = desc->x34_x28_LTME.get()) {
|
||||||
ltme->GetValue(0, particle.x0_endFrame);
|
ltme->GetValue(0, particle.x0_endFrame);
|
||||||
|
}
|
||||||
CParticleGlobals::instance()->SetParticleLifetime(particle.x0_endFrame);
|
CParticleGlobals::instance()->SetParticleLifetime(particle.x0_endFrame);
|
||||||
CParticleGlobals::instance()->UpdateParticleLifetimeTweenValues(0);
|
CParticleGlobals::instance()->UpdateParticleLifetimeTweenValues(0);
|
||||||
g_currentParticle = &particle;
|
g_currentParticle = &particle;
|
||||||
|
@ -994,8 +995,7 @@ void CElementGen::RenderModels(const CActorLights* actorLights) {
|
||||||
|
|
||||||
switch (m_shaderClass) {
|
switch (m_shaderClass) {
|
||||||
case CElementGenShaders::EShaderClass::Tex: {
|
case CElementGenShaders::EShaderClass::Tex: {
|
||||||
g_instTexData.emplace_back();
|
SParticleInstanceTex& inst = g_instTexData.emplace_back();
|
||||||
SParticleInstanceTex& inst = g_instTexData.back();
|
|
||||||
inst.pos[0] = CGraphics::g_GXModelView * zeus::CVector3f{0.5f, 0.f, 0.5f};
|
inst.pos[0] = CGraphics::g_GXModelView * zeus::CVector3f{0.5f, 0.f, 0.5f};
|
||||||
inst.pos[1] = CGraphics::g_GXModelView * zeus::CVector3f{-0.5f, 0.f, 0.5f};
|
inst.pos[1] = CGraphics::g_GXModelView * zeus::CVector3f{-0.5f, 0.f, 0.5f};
|
||||||
inst.pos[2] = CGraphics::g_GXModelView * zeus::CVector3f{0.5f, 0.f, -0.5f};
|
inst.pos[2] = CGraphics::g_GXModelView * zeus::CVector3f{0.5f, 0.f, -0.5f};
|
||||||
|
@ -1008,8 +1008,7 @@ void CElementGen::RenderModels(const CActorLights* actorLights) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CElementGenShaders::EShaderClass::NoTex: {
|
case CElementGenShaders::EShaderClass::NoTex: {
|
||||||
g_instNoTexData.emplace_back();
|
SParticleInstanceNoTex& inst = g_instNoTexData.emplace_back();
|
||||||
SParticleInstanceNoTex& inst = g_instNoTexData.back();
|
|
||||||
inst.pos[0] = CGraphics::g_GXModelView * zeus::CVector3f{0.5f, 0.f, 0.5f};
|
inst.pos[0] = CGraphics::g_GXModelView * zeus::CVector3f{0.5f, 0.f, 0.5f};
|
||||||
inst.pos[1] = CGraphics::g_GXModelView * zeus::CVector3f{-0.5f, 0.f, 0.5f};
|
inst.pos[1] = CGraphics::g_GXModelView * zeus::CVector3f{-0.5f, 0.f, 0.5f};
|
||||||
inst.pos[2] = CGraphics::g_GXModelView * zeus::CVector3f{0.5f, 0.f, -0.5f};
|
inst.pos[2] = CGraphics::g_GXModelView * zeus::CVector3f{0.5f, 0.f, -0.5f};
|
||||||
|
@ -1327,8 +1326,7 @@ void CElementGen::RenderParticles() {
|
||||||
if (0.f == particle.x30_lineWidthOrRota) {
|
if (0.f == particle.x30_lineWidthOrRota) {
|
||||||
switch (m_shaderClass) {
|
switch (m_shaderClass) {
|
||||||
case CElementGenShaders::EShaderClass::Tex: {
|
case CElementGenShaders::EShaderClass::Tex: {
|
||||||
g_instTexData.emplace_back();
|
SParticleInstanceTex& inst = g_instTexData.emplace_back();
|
||||||
SParticleInstanceTex& inst = g_instTexData.back();
|
|
||||||
inst.pos[0] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
inst.pos[0] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
||||||
inst.pos[1] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
inst.pos[1] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
||||||
inst.pos[2] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() - size, 1.f};
|
inst.pos[2] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() - size, 1.f};
|
||||||
|
@ -1341,8 +1339,7 @@ void CElementGen::RenderParticles() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CElementGenShaders::EShaderClass::NoTex: {
|
case CElementGenShaders::EShaderClass::NoTex: {
|
||||||
g_instNoTexData.emplace_back();
|
SParticleInstanceNoTex& inst = g_instNoTexData.emplace_back();
|
||||||
SParticleInstanceNoTex& inst = g_instNoTexData.back();
|
|
||||||
inst.pos[0] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
inst.pos[0] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
||||||
inst.pos[1] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
inst.pos[1] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
||||||
inst.pos[2] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() - size, 1.f};
|
inst.pos[2] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() - size, 1.f};
|
||||||
|
@ -1360,8 +1357,7 @@ void CElementGen::RenderParticles() {
|
||||||
|
|
||||||
switch (m_shaderClass) {
|
switch (m_shaderClass) {
|
||||||
case CElementGenShaders::EShaderClass::Tex: {
|
case CElementGenShaders::EShaderClass::Tex: {
|
||||||
g_instTexData.emplace_back();
|
SParticleInstanceTex& inst = g_instTexData.emplace_back();
|
||||||
SParticleInstanceTex& inst = g_instTexData.back();
|
|
||||||
inst.pos[0] = zeus::CVector4f{viewPoint.x() + sinT + cosT, viewPoint.y(), viewPoint.z() + cosT - sinT, 1.f};
|
inst.pos[0] = zeus::CVector4f{viewPoint.x() + sinT + cosT, viewPoint.y(), viewPoint.z() + cosT - sinT, 1.f};
|
||||||
inst.pos[1] = zeus::CVector4f{viewPoint.x() + sinT - cosT, viewPoint.y(), viewPoint.z() + sinT + cosT, 1.f};
|
inst.pos[1] = zeus::CVector4f{viewPoint.x() + sinT - cosT, viewPoint.y(), viewPoint.z() + sinT + cosT, 1.f};
|
||||||
inst.pos[2] =
|
inst.pos[2] =
|
||||||
|
@ -1376,8 +1372,7 @@ void CElementGen::RenderParticles() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CElementGenShaders::EShaderClass::NoTex: {
|
case CElementGenShaders::EShaderClass::NoTex: {
|
||||||
g_instNoTexData.emplace_back();
|
SParticleInstanceNoTex& inst = g_instNoTexData.emplace_back();
|
||||||
SParticleInstanceNoTex& inst = g_instNoTexData.back();
|
|
||||||
inst.pos[0] = zeus::CVector4f{viewPoint.x() + sinT + cosT, viewPoint.y(), viewPoint.z() + cosT - sinT, 1.f};
|
inst.pos[0] = zeus::CVector4f{viewPoint.x() + sinT + cosT, viewPoint.y(), viewPoint.z() + cosT - sinT, 1.f};
|
||||||
inst.pos[1] = zeus::CVector4f{viewPoint.x() + sinT - cosT, viewPoint.y(), viewPoint.z() + sinT + cosT, 1.f};
|
inst.pos[1] = zeus::CVector4f{viewPoint.x() + sinT - cosT, viewPoint.y(), viewPoint.z() + sinT + cosT, 1.f};
|
||||||
inst.pos[2] =
|
inst.pos[2] =
|
||||||
|
@ -1437,8 +1432,7 @@ void CElementGen::RenderParticles() {
|
||||||
|
|
||||||
switch (m_shaderClass) {
|
switch (m_shaderClass) {
|
||||||
case CElementGenShaders::EShaderClass::Tex: {
|
case CElementGenShaders::EShaderClass::Tex: {
|
||||||
g_instTexData.emplace_back();
|
SParticleInstanceTex& inst = g_instTexData.emplace_back();
|
||||||
SParticleInstanceTex& inst = g_instTexData.back();
|
|
||||||
viewPoint += rightVec * 0.5f;
|
viewPoint += rightVec * 0.5f;
|
||||||
inst.pos[0] = zeus::CVector4f{viewPoint + 0.5f * foreVec};
|
inst.pos[0] = zeus::CVector4f{viewPoint + 0.5f * foreVec};
|
||||||
inst.pos[1] = zeus::CVector4f{viewPoint - 0.5f * foreVec};
|
inst.pos[1] = zeus::CVector4f{viewPoint - 0.5f * foreVec};
|
||||||
|
@ -1453,8 +1447,7 @@ void CElementGen::RenderParticles() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CElementGenShaders::EShaderClass::NoTex: {
|
case CElementGenShaders::EShaderClass::NoTex: {
|
||||||
g_instNoTexData.emplace_back();
|
SParticleInstanceNoTex& inst = g_instNoTexData.emplace_back();
|
||||||
SParticleInstanceNoTex& inst = g_instNoTexData.back();
|
|
||||||
viewPoint += rightVec * 0.5f;
|
viewPoint += rightVec * 0.5f;
|
||||||
inst.pos[0] = zeus::CVector4f{viewPoint + 0.5f * foreVec};
|
inst.pos[0] = zeus::CVector4f{viewPoint + 0.5f * foreVec};
|
||||||
inst.pos[1] = zeus::CVector4f{viewPoint - 0.5f * foreVec};
|
inst.pos[1] = zeus::CVector4f{viewPoint - 0.5f * foreVec};
|
||||||
|
@ -1521,8 +1514,7 @@ void CElementGen::RenderParticles() {
|
||||||
|
|
||||||
switch (m_shaderClass) {
|
switch (m_shaderClass) {
|
||||||
case CElementGenShaders::EShaderClass::Tex: {
|
case CElementGenShaders::EShaderClass::Tex: {
|
||||||
g_instTexData.emplace_back();
|
SParticleInstanceTex& inst = g_instTexData.emplace_back();
|
||||||
SParticleInstanceTex& inst = g_instTexData.back();
|
|
||||||
inst.pos[0] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() + size, 1.f};
|
inst.pos[0] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() + size, 1.f};
|
||||||
inst.pos[1] = zeus::CVector4f{vec2.x() - size, vec2.y(), vec2.z() + size, 1.f};
|
inst.pos[1] = zeus::CVector4f{vec2.x() - size, vec2.y(), vec2.z() + size, 1.f};
|
||||||
inst.pos[2] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() - size, 1.f};
|
inst.pos[2] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() - size, 1.f};
|
||||||
|
@ -1535,8 +1527,7 @@ void CElementGen::RenderParticles() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CElementGenShaders::EShaderClass::NoTex: {
|
case CElementGenShaders::EShaderClass::NoTex: {
|
||||||
g_instNoTexData.emplace_back();
|
SParticleInstanceNoTex& inst = g_instNoTexData.emplace_back();
|
||||||
SParticleInstanceNoTex& inst = g_instNoTexData.back();
|
|
||||||
inst.pos[0] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() + size, 1.f};
|
inst.pos[0] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() + size, 1.f};
|
||||||
inst.pos[1] = zeus::CVector4f{vec2.x() - size, vec2.y(), vec2.z() + size, 1.f};
|
inst.pos[1] = zeus::CVector4f{vec2.x() - size, vec2.y(), vec2.z() + size, 1.f};
|
||||||
inst.pos[2] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() - size, 1.f};
|
inst.pos[2] = zeus::CVector4f{vec2.x() + size, vec2.y(), vec2.z() - size, 1.f};
|
||||||
|
@ -1559,8 +1550,7 @@ void CElementGen::RenderParticles() {
|
||||||
|
|
||||||
switch (m_shaderClass) {
|
switch (m_shaderClass) {
|
||||||
case CElementGenShaders::EShaderClass::Tex: {
|
case CElementGenShaders::EShaderClass::Tex: {
|
||||||
g_instTexData.emplace_back();
|
SParticleInstanceTex& inst = g_instTexData.emplace_back();
|
||||||
SParticleInstanceTex& inst = g_instTexData.back();
|
|
||||||
inst.pos[0] = zeus::CVector4f{vec2.x() + sinT + cosT, vec2.y(), vec2.z() + cosT - sinT, 1.f};
|
inst.pos[0] = zeus::CVector4f{vec2.x() + sinT + cosT, vec2.y(), vec2.z() + cosT - sinT, 1.f};
|
||||||
inst.pos[1] = zeus::CVector4f{vec2.x() + sinT - cosT, vec2.y(), vec2.z() + sinT + cosT, 1.f};
|
inst.pos[1] = zeus::CVector4f{vec2.x() + sinT - cosT, vec2.y(), vec2.z() + sinT + cosT, 1.f};
|
||||||
inst.pos[2] = zeus::CVector4f{vec2.x() + (cosT - sinT), vec2.y(), vec2.z() + (-cosT - sinT), 1.f};
|
inst.pos[2] = zeus::CVector4f{vec2.x() + (cosT - sinT), vec2.y(), vec2.z() + (-cosT - sinT), 1.f};
|
||||||
|
@ -1573,8 +1563,7 @@ void CElementGen::RenderParticles() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CElementGenShaders::EShaderClass::NoTex: {
|
case CElementGenShaders::EShaderClass::NoTex: {
|
||||||
g_instNoTexData.emplace_back();
|
SParticleInstanceNoTex& inst = g_instNoTexData.emplace_back();
|
||||||
SParticleInstanceNoTex& inst = g_instNoTexData.back();
|
|
||||||
inst.pos[0] = zeus::CVector4f{vec2.x() + sinT + cosT, vec2.y(), vec2.z() + cosT - sinT, 1.f};
|
inst.pos[0] = zeus::CVector4f{vec2.x() + sinT + cosT, vec2.y(), vec2.z() + cosT - sinT, 1.f};
|
||||||
inst.pos[1] = zeus::CVector4f{vec2.x() + sinT - cosT, vec2.y(), vec2.z() + sinT + cosT, 1.f};
|
inst.pos[1] = zeus::CVector4f{vec2.x() + sinT - cosT, vec2.y(), vec2.z() + sinT + cosT, 1.f};
|
||||||
inst.pos[2] = zeus::CVector4f{vec2.x() + (cosT - sinT), vec2.y(), vec2.z() + (-cosT - sinT), 1.f};
|
inst.pos[2] = zeus::CVector4f{vec2.x() + (cosT - sinT), vec2.y(), vec2.z() + (-cosT - sinT), 1.f};
|
||||||
|
@ -1718,8 +1707,7 @@ void CElementGen::RenderParticlesIndirectTexture() {
|
||||||
|
|
||||||
CGraphics::ResolveSpareTexture(clipRect);
|
CGraphics::ResolveSpareTexture(clipRect);
|
||||||
|
|
||||||
g_instIndTexData.emplace_back();
|
SParticleInstanceIndTex& inst = g_instIndTexData.emplace_back();
|
||||||
SParticleInstanceIndTex& inst = g_instIndTexData.back();
|
|
||||||
inst.pos[0] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
inst.pos[0] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
||||||
inst.pos[1] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
inst.pos[1] = zeus::CVector4f{viewPoint.x() - size, viewPoint.y(), viewPoint.z() + size, 1.f};
|
||||||
inst.pos[2] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() - size, 1.f};
|
inst.pos[2] = zeus::CVector4f{viewPoint.x() + size, viewPoint.y(), viewPoint.z() - size, 1.f};
|
||||||
|
|
|
@ -69,8 +69,7 @@ void CGrappleArm::BuildSuitDependencyList() {
|
||||||
x184_grappleArm.Lock();
|
x184_grappleArm.Lock();
|
||||||
for (const char* name : skDependencyNames) {
|
for (const char* name : skDependencyNames) {
|
||||||
TLockedToken<CDependencyGroup> dgrp = g_SimplePool->GetObj(name);
|
TLockedToken<CDependencyGroup> dgrp = g_SimplePool->GetObj(name);
|
||||||
x19c_suitDeps.emplace_back();
|
std::vector<CToken>& depsOut = x19c_suitDeps.emplace_back();
|
||||||
std::vector<CToken>& depsOut = x19c_suitDeps.back();
|
|
||||||
FillTokenVector(dgrp->GetObjectTagVector(), depsOut);
|
FillTokenVector(dgrp->GetObjectTagVector(), depsOut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,11 +234,10 @@ void CGameArea::CAreaFog::DisableFog() { x0_fogMode = ERglFogMode::None; }
|
||||||
|
|
||||||
static std::vector<SObjectTag> ReadDependencyList(CInputStream& in) {
|
static std::vector<SObjectTag> ReadDependencyList(CInputStream& in) {
|
||||||
std::vector<SObjectTag> ret;
|
std::vector<SObjectTag> ret;
|
||||||
u32 count = in.readUint32Big();
|
const u32 count = in.readUint32Big();
|
||||||
ret.reserve(count);
|
ret.reserve(count);
|
||||||
for (u32 i = 0; i < count; ++i) {
|
for (u32 i = 0; i < count; ++i) {
|
||||||
ret.emplace_back();
|
ret.emplace_back().readMLVL(in);
|
||||||
ret.back().readMLVL(in);
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1072,13 +1071,12 @@ void CGameArea::FillInStaticGeometry(bool textures) {
|
||||||
ibo = ctx.newStaticBuffer(boo::BufferUse::Index, secIt->first, 4, inst.m_hmdlMeta.indexCount);
|
ibo = ctx.newStaticBuffer(boo::BufferUse::Index, secIt->first, 4, inst.m_hmdlMeta.indexCount);
|
||||||
++secIt;
|
++secIt;
|
||||||
|
|
||||||
u32 surfCount = hecl::SBig(*reinterpret_cast<const u32*>(secIt->first));
|
const u32 surfCount = hecl::SBig(*reinterpret_cast<const u32*>(secIt->first));
|
||||||
inst.m_surfaces.reserve(surfCount);
|
inst.m_surfaces.reserve(surfCount);
|
||||||
inst.m_shaders.reserve(surfCount);
|
inst.m_shaders.reserve(surfCount);
|
||||||
++secIt;
|
++secIt;
|
||||||
for (u32 j = 0; j < surfCount; ++j) {
|
for (u32 j = 0; j < surfCount; ++j) {
|
||||||
inst.m_surfaces.emplace_back();
|
CBooSurface& surf = inst.m_surfaces.emplace_back();
|
||||||
CBooSurface& surf = inst.m_surfaces.back();
|
|
||||||
surf.selfIdx = j;
|
surf.selfIdx = j;
|
||||||
athena::io::MemoryReader r(secIt->first, secIt->second);
|
athena::io::MemoryReader r(secIt->first, secIt->second);
|
||||||
surf.m_data.read(r);
|
surf.m_data.read(r);
|
||||||
|
|
|
@ -36,8 +36,7 @@ CStateMachine::CStateMachine(CInputStream& in) {
|
||||||
float arg = in.readFloatBig();
|
float arg = in.readFloatBig();
|
||||||
CAiTrigger* newTrig;
|
CAiTrigger* newTrig;
|
||||||
if (k < lastTriggerIdx) {
|
if (k < lastTriggerIdx) {
|
||||||
x10_triggers.emplace_back();
|
newTrig = &x10_triggers.emplace_back();
|
||||||
newTrig = &x10_triggers.back();
|
|
||||||
} else {
|
} else {
|
||||||
newTrig = &firstTrig[j];
|
newTrig = &firstTrig[j];
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,27 +72,30 @@ std::vector<CWorld::CRelay> CWorld::CRelay::ReadMemoryRelays(athena::io::MemoryR
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldLayers::ReadWorldLayers(athena::io::MemoryReader& r, int version, CAssetId mlvlId) {
|
void CWorldLayers::ReadWorldLayers(athena::io::MemoryReader& r, int version, CAssetId mlvlId) {
|
||||||
if (version <= 14)
|
if (version <= 14) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CWorldLayers ret;
|
CWorldLayers ret;
|
||||||
|
|
||||||
u32 areaCount = r.readUint32Big();
|
u32 areaCount = r.readUint32Big();
|
||||||
ret.m_areas.reserve(areaCount);
|
ret.m_areas.reserve(areaCount);
|
||||||
for (u32 i = 0; i < areaCount; ++i) {
|
for (u32 i = 0; i < areaCount; ++i) {
|
||||||
ret.m_areas.emplace_back();
|
auto& area = ret.m_areas.emplace_back();
|
||||||
ret.m_areas.back().m_layerCount = r.readUint32Big();
|
area.m_layerCount = r.readUint32Big();
|
||||||
ret.m_areas.back().m_layerBits = r.readUint64Big();
|
area.m_layerBits = r.readUint64Big();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nameCount = r.readUint32Big();
|
const u32 nameCount = r.readUint32Big();
|
||||||
ret.m_names.reserve(nameCount);
|
ret.m_names.reserve(nameCount);
|
||||||
for (u32 i = 0; i < nameCount; ++i)
|
for (u32 i = 0; i < nameCount; ++i) {
|
||||||
ret.m_names.push_back(r.readString());
|
ret.m_names.push_back(r.readString());
|
||||||
|
}
|
||||||
|
|
||||||
areaCount = r.readUint32Big();
|
areaCount = r.readUint32Big();
|
||||||
for (u32 i = 0; i < areaCount; ++i)
|
for (u32 i = 0; i < areaCount; ++i) {
|
||||||
ret.m_areas[i].m_startNameIdx = r.readUint32Big();
|
ret.m_areas[i].m_startNameIdx = r.readUint32Big();
|
||||||
|
}
|
||||||
|
|
||||||
CWorldState& wldState = g_GameState->StateForWorld(mlvlId);
|
CWorldState& wldState = g_GameState->StateForWorld(mlvlId);
|
||||||
wldState.GetLayerState()->InitializeWorldLayers(ret.m_areas);
|
wldState.GetLayerState()->InitializeWorldLayers(ret.m_areas);
|
||||||
|
|
Loading…
Reference in New Issue