From dad72499274a690329b7e06ecc6b75d2934b5c07 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Thu, 17 Feb 2022 23:37:54 -0800 Subject: [PATCH 01/17] RE COutput/InputStream and friends and migrate over This branch is probably still horribly broken, but it's a good first step to migrating away from having hecl embedded in the runtime --- DataSpec/DNACommon/AROTBuilder.hpp | 2 +- DataSpec/DNACommon/CMDL.cpp | 3 +- DataSpec/DNACommon/PATH.cpp | 1 + DataSpec/SpecMP1.cpp | 2 + Runtime/Audio/CAudioGroupSet.cpp | 8 +- Runtime/Audio/CMidiManager.cpp | 14 +- Runtime/Audio/CSfxManager.cpp | 5 +- Runtime/AutoMapper/CMapArea.cpp | 90 +- Runtime/AutoMapper/CMapUniverse.cpp | 18 +- Runtime/AutoMapper/CMapWorld.cpp | 8 +- Runtime/AutoMapper/CMapWorldInfo.cpp | 24 +- Runtime/AutoMapper/CMapWorldInfo.hpp | 4 +- Runtime/AutoMapper/CMappableObject.cpp | 12 +- Runtime/CBasics.hpp | 8 + Runtime/CBasicsPC.cpp | 59 + Runtime/CDependencyGroup.cpp | 2 +- Runtime/CFactoryMgr.cpp | 16 +- Runtime/CGameHintInfo.cpp | 26 +- Runtime/CGameOptions.cpp | 132 +- Runtime/CGameOptions.hpp | 12 +- Runtime/CGameState.cpp | 76 +- Runtime/CGameState.hpp | 14 +- Runtime/CInputStream.cpp | 278 +++ Runtime/CInputStream.hpp | 83 + Runtime/CMakeLists.txt | 9 +- Runtime/CMayaSpline.cpp | 33 +- Runtime/CMemoryCardSys.cpp | 22 +- Runtime/CMemoryCardSys.hpp | 21 +- Runtime/CMemoryInStream.hpp | 19 + Runtime/CMemoryStreamOut.cpp | 22 + Runtime/CMemoryStreamOut.hpp | 25 + Runtime/COutputStream.cpp | 209 ++ Runtime/COutputStream.hpp | 88 + Runtime/CPakFile.cpp | 30 +- Runtime/CPakFile.hpp | 2 +- Runtime/CPlayerState.cpp | 42 +- Runtime/CPlayerState.hpp | 4 +- Runtime/CResLoader.cpp | 13 +- Runtime/CScannableObjectInfo.cpp | 30 +- Runtime/CScriptMailbox.cpp | 8 +- Runtime/CScriptMailbox.hpp | 4 +- Runtime/CStateManager.cpp | 206 +- Runtime/CStringExtras.cpp | 21 + Runtime/CStringExtras.hpp | 4 +- Runtime/CTextureCache.cpp | 4 +- Runtime/CTextureCache.hpp | 14 +- Runtime/CWorldSaveGameInfo.cpp | 30 +- Runtime/CZipInputStream.cpp | 34 + Runtime/CZipInputStream.hpp | 21 + Runtime/Camera/CCameraShakeData.cpp | 40 +- Runtime/Camera/CCameraShakeData.hpp | 1 + Runtime/Character/CAdditiveAnimPlayback.hpp | 5 +- Runtime/Character/CAllFormatsAnimSource.cpp | 2 +- Runtime/Character/CAnimCharacterSet.cpp | 2 +- Runtime/Character/CAnimPOIData.cpp | 10 +- Runtime/Character/CAnimSource.cpp | 16 +- Runtime/Character/CAnimation.cpp | 2 +- Runtime/Character/CAnimationSet.cpp | 18 +- Runtime/Character/CBoolPOINode.cpp | 2 +- Runtime/Character/CCharAnimTime.hpp | 2 +- Runtime/Character/CCharLayoutInfo.cpp | 12 +- Runtime/Character/CCharacterInfo.cpp | 57 +- Runtime/Character/CCharacterSet.cpp | 6 +- Runtime/Character/CEffectComponent.cpp | 12 +- Runtime/Character/CFBStreamedCompression.cpp | 38 +- Runtime/Character/CFBStreamedCompression.hpp | 18 +- Runtime/Character/CHalfTransition.cpp | 2 +- Runtime/Character/CInt32POINode.cpp | 2 +- Runtime/Character/CMetaAnimBlend.cpp | 4 +- Runtime/Character/CMetaAnimFactory.cpp | 2 +- Runtime/Character/CMetaAnimPhaseBlend.cpp | 4 +- Runtime/Character/CMetaAnimRandom.cpp | 4 +- Runtime/Character/CMetaAnimSequence.cpp | 2 +- Runtime/Character/CMetaTransFactory.cpp | 2 +- Runtime/Character/CMetaTransPhaseTrans.cpp | 6 +- Runtime/Character/CMetaTransTrans.cpp | 8 +- Runtime/Character/CPASAnimState.cpp | 18 +- Runtime/Character/CPASDatabase.cpp | 6 +- Runtime/Character/CPASParmInfo.cpp | 28 +- Runtime/Character/CPOINode.cpp | 16 +- Runtime/Character/CParticleData.cpp | 8 +- Runtime/Character/CPrimitive.cpp | 6 +- Runtime/Character/CSegId.hpp | 2 +- Runtime/Character/CSegIdList.cpp | 2 +- Runtime/Character/CSkinBank.cpp | 2 +- Runtime/Character/CSkinRules.cpp | 17 +- Runtime/Character/CSkinRules.hpp | 2 +- Runtime/Character/CSoundPOINode.cpp | 2 +- Runtime/Character/CTransition.cpp | 6 +- Runtime/Collision/CAreaOctTree.cpp | 15 +- Runtime/Collision/CCollidableOBBTreeGroup.cpp | 2 +- Runtime/Collision/CCollisionEdge.cpp | 5 +- Runtime/Collision/CCollisionResponseData.cpp | 2 +- Runtime/Collision/COBBTree.cpp | 40 +- Runtime/Graphics/CCubeModel.cpp | 18 +- Runtime/Graphics/CGraphicsPalette.hpp | 6 +- Runtime/Graphics/CPVSAreaSet.cpp | 16 +- Runtime/Graphics/CPVSVisOctree.cpp | 10 +- Runtime/Graphics/CTextureBoo.cpp | 42 +- Runtime/GuiSys/CAuiEnergyBarT01.cpp | 2 +- Runtime/GuiSys/CAuiImagePane.cpp | 14 +- Runtime/GuiSys/CAuiMeter.cpp | 8 +- Runtime/GuiSys/CGuiCamera.cpp | 22 +- Runtime/GuiSys/CGuiFrame.cpp | 14 +- Runtime/GuiSys/CGuiGroup.cpp | 4 +- Runtime/GuiSys/CGuiLight.cpp | 18 +- Runtime/GuiSys/CGuiModel.cpp | 6 +- Runtime/GuiSys/CGuiPane.cpp | 4 +- Runtime/GuiSys/CGuiSliderGroup.cpp | 8 +- Runtime/GuiSys/CGuiTableGroup.cpp | 30 +- Runtime/GuiSys/CGuiTextPane.cpp | 24 +- Runtime/GuiSys/CGuiWidget.cpp | 31 +- Runtime/GuiSys/CRasterFont.cpp | 76 +- Runtime/GuiSys/CStringTable.cpp | 36 +- Runtime/GuiSys/CStringTable.hpp | 2 +- Runtime/IOStreams.cpp | 204 +- Runtime/IOStreams.hpp | 107 +- Runtime/MP1/CMemoryCardDriver.cpp | 28 +- Runtime/MP1/CMemoryCardDriver.hpp | 8 +- Runtime/MP1/CTweaks.cpp | 46 +- Runtime/MP1/MP1.cpp | 9 +- Runtime/MP1/MP1.hpp | 4 +- Runtime/MP1/World/CBabygoth.cpp | 22 +- Runtime/MP1/World/CBouncyGrenade.hpp | 2 +- Runtime/MP1/World/CChozoGhost.cpp | 16 +- Runtime/MP1/World/CElitePirate.cpp | 34 +- Runtime/MP1/World/CFlaahgra.cpp | 14 +- Runtime/MP1/World/CFlyingPirate.cpp | 40 +- Runtime/MP1/World/CGrenadeLauncher.hpp | 8 +- Runtime/MP1/World/CIceSheegoth.cpp | 30 +- Runtime/MP1/World/CMetroid.cpp | 14 +- Runtime/MP1/World/CMetroidBeta.cpp | 20 +- Runtime/MP1/World/CMetroidPrimeExo.cpp | 53 +- Runtime/MP1/World/CMetroidPrimeProjectile.cpp | 20 +- Runtime/MP1/World/CRidley.cpp | 26 +- Runtime/MP1/World/CSpacePirate.cpp | 50 +- Runtime/Particle/CColorElement.cpp | 16 +- Runtime/Particle/CDecalDataFactory.cpp | 2 +- Runtime/Particle/CIntElement.cpp | 16 +- Runtime/Particle/CParticleDataFactory.cpp | 26 +- .../Particle/CParticleElectricDataFactory.cpp | 2 +- .../Particle/CParticleSwooshDataFactory.cpp | 2 +- .../Particle/CProjectileWeaponDataFactory.cpp | 2 +- Runtime/Particle/CRealElement.cpp | 16 +- Runtime/Particle/CSpawnSystemKeyframeData.cpp | 22 +- Runtime/Particle/CVectorElement.cpp | 16 +- Runtime/RetroTypes.cpp | 44 +- Runtime/RetroTypes.hpp | 20 +- Runtime/Weapon/CBeamInfo.hpp | 34 +- Runtime/Weapon/CFlameInfo.cpp | 12 +- Runtime/Weapon/CPlasmaProjectile.hpp | 2 +- Runtime/World/CAnimationParameters.hpp | 3 +- Runtime/World/CDamageInfo.hpp | 10 +- Runtime/World/CDamageVulnerability.cpp | 24 +- Runtime/World/CGameArea.cpp | 174 +- Runtime/World/CHUDMemoParms.hpp | 4 +- Runtime/World/CHealthInfo.cpp | 7 +- Runtime/World/CPathFindArea.cpp | 34 +- Runtime/World/CPathFindRegion.cpp | 34 +- Runtime/World/CPatternedInfo.cpp | 66 +- Runtime/World/CPlayerCameraBob.cpp | 31 +- Runtime/World/CScriptGunTurret.cpp | 70 +- Runtime/World/CScriptMazeNode.cpp | 2 +- Runtime/World/CScriptSpindleCamera.cpp | 10 +- Runtime/World/CStateMachine.cpp | 31 +- Runtime/World/CTeamAiMgr.cpp | 18 +- Runtime/World/CVisorFlare.cpp | 10 +- Runtime/World/CWorld.cpp | 84 +- Runtime/World/CWorld.hpp | 4 +- Runtime/World/CWorldLight.cpp | 23 +- Runtime/World/IGameArea.cpp | 12 +- Runtime/World/ScriptLoader.cpp | 2110 ++++++++--------- 172 files changed, 3629 insertions(+), 2780 deletions(-) create mode 100644 Runtime/CInputStream.cpp create mode 100644 Runtime/CInputStream.hpp create mode 100644 Runtime/CMemoryInStream.hpp create mode 100644 Runtime/CMemoryStreamOut.cpp create mode 100644 Runtime/CMemoryStreamOut.hpp create mode 100644 Runtime/COutputStream.cpp create mode 100644 Runtime/COutputStream.hpp create mode 100644 Runtime/CStringExtras.cpp create mode 100644 Runtime/CZipInputStream.cpp create mode 100644 Runtime/CZipInputStream.hpp diff --git a/DataSpec/DNACommon/AROTBuilder.hpp b/DataSpec/DNACommon/AROTBuilder.hpp index 9e32b23b9..df42876a7 100644 --- a/DataSpec/DNACommon/AROTBuilder.hpp +++ b/DataSpec/DNACommon/AROTBuilder.hpp @@ -4,7 +4,7 @@ #include "DeafBabe.hpp" #include "zeus/CAABox.hpp" #include "CMDL.hpp" -#include "IOStreams.hpp" +#include #include namespace DataSpec { diff --git a/DataSpec/DNACommon/CMDL.cpp b/DataSpec/DNACommon/CMDL.cpp index 2af280e61..1baa4d90b 100644 --- a/DataSpec/DNACommon/CMDL.cpp +++ b/DataSpec/DNACommon/CMDL.cpp @@ -9,8 +9,9 @@ #include "DataSpec/DNAMP2/CSKR.hpp" #include "DataSpec/DNAMP3/CMDLMaterials.hpp" #include "DataSpec/DNAMP3/CSKR.hpp" -#include "IOStreams.hpp" +#include +#include #include #include #include diff --git a/DataSpec/DNACommon/PATH.cpp b/DataSpec/DNACommon/PATH.cpp index dff277911..9ef5325fb 100644 --- a/DataSpec/DNACommon/PATH.cpp +++ b/DataSpec/DNACommon/PATH.cpp @@ -2,6 +2,7 @@ #include "hecl/Blender/Connection.hpp" #include "zeus/CAABox.hpp" #include "DataSpec/DNACommon/AROTBuilder.hpp" +#include namespace DataSpec::DNAPATH { diff --git a/DataSpec/SpecMP1.cpp b/DataSpec/SpecMP1.cpp index a6a7fa1f1..8fa336584 100644 --- a/DataSpec/SpecMP1.cpp +++ b/DataSpec/SpecMP1.cpp @@ -52,6 +52,8 @@ #include "hecl/Blender/Connection.hpp" #include "hecl/Blender/SDNARead.hpp" #include "nod/nod.hpp" +#include +#include namespace DataSpec { diff --git a/Runtime/Audio/CAudioGroupSet.cpp b/Runtime/Audio/CAudioGroupSet.cpp index d24e2c62f..1249e9a42 100644 --- a/Runtime/Audio/CAudioGroupSet.cpp +++ b/Runtime/Audio/CAudioGroupSet.cpp @@ -11,11 +11,11 @@ amuse::AudioGroupData CAudioGroupSet::LoadData() { return SBig(value); }; - athena::io::MemoryReader r(m_buffer.get(), INT32_MAX); - x10_baseName = r.readString(); - x20_name = r.readString(); + CMemoryInStream r(m_buffer.get(), INT32_MAX, CMemoryInStream::EOwnerShip::NotOwned); + x10_baseName = r.Get(); + x20_name = r.Get(); - u8* buf = m_buffer.get() + r.position(); + u8* buf = m_buffer.get() + r.GetReadPosition(); const uint32_t poolLen = readU32(buf); unsigned char* pool = buf + 4; buf += poolLen + 4; diff --git a/Runtime/Audio/CMidiManager.cpp b/Runtime/Audio/CMidiManager.cpp index 14332d621..e996c957c 100644 --- a/Runtime/Audio/CMidiManager.cpp +++ b/Runtime/Audio/CMidiManager.cpp @@ -1,5 +1,7 @@ #include "Runtime/Audio/CMidiManager.hpp" +#include "Runtime/CInputStream.hpp" + namespace metaforce { std::unordered_set CMidiManager::m_MidiWrappers = {}; @@ -35,13 +37,13 @@ CMidiHandle CMidiManager::Play(const CMidiData& data, float fadeTime, bool stopE } CMidiManager::CMidiData::CMidiData(CInputStream& in) { - in.readUint32Big(); - x0_setupId = in.readUint32Big(); - x2_groupId = in.readUint32Big(); - x4_agscId = in.readUint32Big(); - u32 length = in.readUint32Big(); + in.ReadLong(); + x0_setupId = in.ReadLong(); + x2_groupId = in.ReadLong(); + x4_agscId = in.ReadLong(); + u32 length = in.ReadLong(); x8_arrData.reset(new u8[length]); - in.readUBytesToBuf(x8_arrData.get(), length); + in.ReadBytes(reinterpret_cast(x8_arrData.get()), length); } CFactoryFnReturn FMidiDataFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& parms, diff --git a/Runtime/Audio/CSfxManager.cpp b/Runtime/Audio/CSfxManager.cpp index 8394782d4..c6d94329d 100644 --- a/Runtime/Audio/CSfxManager.cpp +++ b/Runtime/Audio/CSfxManager.cpp @@ -1,4 +1,5 @@ #include "Runtime/Audio/CSfxManager.hpp" +#include "Runtime/CInputStream.hpp" #include "Runtime/CSimplePool.hpp" @@ -19,10 +20,10 @@ static amuse::EffectDelay* s_DelayState = nullptr; CFactoryFnReturn FAudioTranslationTableFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms, CObjectReference* selfRef) { std::unique_ptr> obj = std::make_unique>(); - u32 count = in.readUint32Big(); + u32 count = in.ReadLong(); obj->reserve(count); for (u32 i = 0; i < count; ++i) - obj->push_back(in.readUint16Big()); + obj->push_back(in.ReadShort()); return TToken>::GetIObjObjectFor(std::move(obj)); } diff --git a/Runtime/AutoMapper/CMapArea.cpp b/Runtime/AutoMapper/CMapArea.cpp index f434a189d..ea017cd14 100644 --- a/Runtime/AutoMapper/CMapArea.cpp +++ b/Runtime/AutoMapper/CMapArea.cpp @@ -3,10 +3,11 @@ #include #include +#include "Runtime/AutoMapper/CMappableObject.hpp" #include "Runtime/CToken.hpp" #include "Runtime/GameGlobalObjects.hpp" -#include "Runtime/AutoMapper/CMappableObject.hpp" #include "Runtime/World/CWorld.hpp" +#include "Runtime/CBasics.hpp" namespace metaforce { constexpr std::array MinesPostTransforms{{ @@ -61,17 +62,17 @@ constexpr std::array MinesPostTransformIndices{ }; CMapArea::CMapArea(CInputStream& in, u32 size) -: x0_magic(in.readUint32()) -, x4_version(in.readUint32Big()) -, x8_(in.readUint32Big()) -, xc_visibilityMode(EVisMode(in.readUint32Big())) -, x10_box(zeus::CAABox::ReadBoundingBoxBig(in)) -, x28_mappableObjCount(in.readUint32Big()) -, x2c_vertexCount(in.readUint32Big()) -, x30_surfaceCount(in.readUint32Big()) +: x0_magic(in.ReadLong()) +, x4_version(in.ReadLong()) +, x8_(in.ReadLong()) +, xc_visibilityMode(EVisMode(in.ReadLong())) +, x10_box(in.Get()) +, x28_mappableObjCount(in.ReadLong()) +, x2c_vertexCount(in.ReadLong()) +, x30_surfaceCount(in.ReadLong()) , x34_size(size - 52) { x44_buf.reset(new u8[x34_size]); - in.readUBytesToBuf(x44_buf.get(), x34_size); + in.ReadBytes(x44_buf.get(), x34_size); PostConstruct(); } @@ -120,14 +121,14 @@ void CMapArea::PostConstruct() { // CMapAreaSurface::Instance& instance = surf.m_instances.emplace_back(ctx, m_vbo, m_ibo); // // athena::io::MemoryReader r(surf.x1c_outlineOffset, INT_MAX); -// u32 outlineCount = r.readUint32Big(); +// u32 outlineCount = r.ReadLong(); // // std::vector& linePrims = instance.m_linePrims; // linePrims.reserve(outlineCount * 2); // for (u32 j = 0; j < 2; ++j) { // r.seek(4, athena::SeekOrigin::Begin); // for (u32 k = 0; k < outlineCount; ++k) { -// const u32 count = r.readUint32Big(); +// const u32 count = r.ReadLong(); // r.seek(count); // r.seekAlign4(); // linePrims.emplace_back(ctx, CLineRenderer::EPrimitiveMode::LineStrip, count, nullptr, false, false, true); @@ -179,11 +180,11 @@ const zeus::CVector3f& CMapArea::GetAreaPostTranslate(const IWorld& world, TArea } CMapArea::CMapAreaSurface::CMapAreaSurface(const void* surfBuf) { - athena::io::MemoryReader r(surfBuf, 32); - x0_normal = r.readVec3fBig(); - xc_centroid = r.readVec3fBig(); - x18_surfOffset = reinterpret_cast(uintptr_t(r.readUint32Big())); - x1c_outlineOffset = reinterpret_cast(uintptr_t(r.readUint32Big())); + CMemoryInStream r(surfBuf, 32, CMemoryInStream::EOwnerShip::NotOwned); + x0_normal = r.Get(); + xc_centroid = r.Get(); + x18_surfOffset = reinterpret_cast(uintptr_t(r.ReadLong())); + x1c_outlineOffset = reinterpret_cast(uintptr_t(r.ReadLong())); } void CMapArea::CMapAreaSurface::PostConstruct(const u8* buf, std::vector& index) { @@ -193,24 +194,24 @@ void CMapArea::CMapAreaSurface::PostConstruct(const u8* buf, std::vector& i m_primStart = index.size(); bool start = true; { - athena::io::MemoryReader r(x18_surfOffset, INT_MAX); - u32 primCount = r.readUint32Big(); + CMemoryInStream r(x18_surfOffset, INT_MAX, CMemoryInStream::EOwnerShip::NotOwned); + u32 primCount = r.ReadLong(); for (u32 i = 0; i < primCount; ++i) { - GX::Primitive prim = GX::Primitive(r.readUint32Big()); - u32 count = r.readUint32Big(); + GX::Primitive prim = GX::Primitive(r.ReadLong()); + u32 count = r.ReadLong(); switch (prim) { case GX::Primitive::TRIANGLES: { for (u32 v = 0; v < count; v += 3) { if (!start) { index.push_back(index.back()); - index.push_back(r.readUByte()); + index.push_back(r.ReadUint8()); index.push_back(index.back()); } else { - index.push_back(r.readUByte()); + index.push_back(r.ReadUint8()); start = false; } - index.push_back(r.readUByte()); - index.push_back(r.readUByte()); + index.push_back(r.ReadUint8()); + index.push_back(r.ReadUint8()); index.push_back(index.back()); } break; @@ -218,38 +219,41 @@ void CMapArea::CMapAreaSurface::PostConstruct(const u8* buf, std::vector& i case GX::Primitive::TRIANGLESTRIP: { if (!start) { index.push_back(index.back()); - index.push_back(r.readUByte()); + index.push_back(r.ReadUint8()); index.push_back(index.back()); } else { - index.push_back(r.readUByte()); + index.push_back(r.ReadUint8()); start = false; } for (u32 v = 1; v < count; ++v) - index.push_back(r.readUByte()); + index.push_back(r.ReadUint8()); if (count & 1) index.push_back(index.back()); break; } case GX::Primitive::TRIANGLEFAN: { - u8 firstVert = r.readUByte(); + u8 firstVert = r.ReadUint8(); if (!start) { index.push_back(index.back()); - index.push_back(r.readUByte()); + index.push_back(r.ReadUint8()); } else { - index.push_back(r.readUByte()); + index.push_back(r.ReadUint8()); index.push_back(index.back()); start = false; } for (u32 v = 1; v < count; ++v) { index.push_back(firstVert); - index.push_back(r.readUByte()); + index.push_back(r.ReadUint8()); } break; } default: break; } - r.seekAlign4(); + u32 pos = r.GetReadPosition(); + while (r.GetReadPosition() != ROUND_UP_4(pos)) { + r.ReadUint8(); + } } } m_primCount = index.size() - m_primStart; @@ -269,8 +273,11 @@ void CMapArea::CMapAreaSurface::Draw(const zeus::CVector3f* verts, const zeus::C if (lineColor.a()) { bool draw2 = lineWidth > 1.f; - athena::io::MemoryReader r(x1c_outlineOffset, INT_MAX); - u32 outlineCount = r.readUint32Big(); + u32 outlineCount = *reinterpret_cast(&x1c_outlineOffset); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + outlineCount = CBasics::SwapBytes(outlineCount); +#endif + std::vector& linePrims = instance.m_linePrims; zeus::CColor color = lineColor; @@ -280,16 +287,21 @@ void CMapArea::CMapAreaSurface::Draw(const zeus::CVector3f* verts, const zeus::C auto primIt = linePrims.begin(); for (u32 j = 0; j <= u32(draw2); ++j) { - r.seek(4, athena::SeekOrigin::Begin); + CMemoryInStream r(x1c_outlineOffset, INT_MAX, CMemoryInStream::EOwnerShip::NotOwned); + r.ReadLong(); for (u32 i = 0; i < outlineCount; ++i) { CLineRenderer& prim = *primIt++; prim.Reset(); - u32 count = r.readUint32Big(); + u32 count = r.ReadLong(); for (u32 v = 0; v < count; ++v) { - u8 idx = r.readUByte(); + u8 idx = r.ReadUint8(); prim.AddVertex(verts[idx], color, width); } - r.seekAlign4(); + + u32 pos = r.GetReadPosition(); + while (r.GetReadPosition() != ROUND_UP_4(pos)) { + r.ReadUint8(); + } prim.Render(); } width -= 1.f; diff --git a/Runtime/AutoMapper/CMapUniverse.cpp b/Runtime/AutoMapper/CMapUniverse.cpp index 84f68f034..f1673f1a4 100644 --- a/Runtime/AutoMapper/CMapUniverse.cpp +++ b/Runtime/AutoMapper/CMapUniverse.cpp @@ -6,25 +6,25 @@ namespace metaforce { -CMapUniverse::CMapUniverse(CInputStream& in, u32 version) : x0_hexagonId(in.readUint32Big()) { +CMapUniverse::CMapUniverse(CInputStream& in, u32 version) : x0_hexagonId(in.Get()) { x4_hexagonToken = g_SimplePool->GetObj({FOURCC('MAPA'), x0_hexagonId}); - u32 count = in.readUint32Big(); + u32 count = in.ReadLong(); x10_worldDatas.reserve(count); for (u32 i = 0; i < count; ++i) x10_worldDatas.emplace_back(in, version); } CMapUniverse::CMapWorldData::CMapWorldData(CInputStream& in, u32 version) -: x0_label(in.readString()), x10_worldAssetId(in.readUint32Big()) { - x14_transform.read34RowMajor(in); - const u32 worldCount = in.readUint32Big(); +: x0_label(in.Get()), x10_worldAssetId(in.ReadLong()) { + x14_transform = in.Get(); + const u32 worldCount = in.ReadLong(); x44_hexagonXfs.reserve(worldCount); for (u32 i = 0; i < worldCount; ++i) { - x44_hexagonXfs.emplace_back().read34RowMajor(in); + x44_hexagonXfs.emplace_back() = in.Get(); } if (version != 0) - x54_surfColorSelected.readRGBABig(in); + x54_surfColorSelected = in.Get(); else x54_surfColorSelected.fromRGBA32(255 | (u32(x10_worldAssetId.Value()) & 0xFFFFFF00)); @@ -115,8 +115,8 @@ void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3 } CFactoryFnReturn FMapUniverseFactory(const SObjectTag&, CInputStream& in, const CVParamTransfer&, CObjectReference*) { - in.readUint32Big(); - u32 version = in.readUint32Big(); + in.ReadLong(); + u32 version = in.ReadLong(); return TToken::GetIObjObjectFor(std::make_unique(in, version)); } diff --git a/Runtime/AutoMapper/CMapWorld.cpp b/Runtime/AutoMapper/CMapWorld.cpp index 2b3711bcd..9ccede18d 100644 --- a/Runtime/AutoMapper/CMapWorld.cpp +++ b/Runtime/AutoMapper/CMapWorld.cpp @@ -274,13 +274,13 @@ CMapWorld::CMapAreaData::CMapAreaData(CAssetId areaRes, EMapAreaList list, CMapA CMapWorld::CMapWorld(CInputStream& in) { x10_listHeads.resize(3); - in.readUint32Big(); - in.readUint32Big(); - u32 areaCount = in.readUint32Big(); + in.ReadLong(); + in.ReadLong(); + u32 areaCount = in.ReadLong(); x0_areas.reserve(areaCount); x20_traversed.resize(areaCount); for (u32 i = 0; i < areaCount; ++i) { - CAssetId mapaId = in.readUint32Big(); + CAssetId mapaId = in.ReadLong(); x0_areas.emplace_back(mapaId, EMapAreaList::Unloaded, x0_areas.empty() ? nullptr : &x0_areas.back()); } x10_listHeads[2] = &x0_areas.back(); diff --git a/Runtime/AutoMapper/CMapWorldInfo.cpp b/Runtime/AutoMapper/CMapWorldInfo.cpp index 926259c6a..dfc4b5b2f 100644 --- a/Runtime/AutoMapper/CMapWorldInfo.cpp +++ b/Runtime/AutoMapper/CMapWorldInfo.cpp @@ -5,52 +5,52 @@ namespace metaforce { -CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CWorldSaveGameInfo& savw, CAssetId mlvlId) { +CMapWorldInfo::CMapWorldInfo(CInputStream& reader, const CWorldSaveGameInfo& savw, CAssetId mlvlId) { const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId); x4_visitedAreas.reserve((worldMem.GetAreaCount() + 31) / 32); for (u32 i = 0; i < worldMem.GetAreaCount(); ++i) { - const bool visited = reader.ReadEncoded(1) != 0; + const bool visited = reader.ReadBits(1) != 0; SetAreaVisited(i, visited); } x18_mappedAreas.reserve((worldMem.GetAreaCount() + 31) / 32); for (u32 i = 0; i < worldMem.GetAreaCount(); ++i) { - const bool mapped = reader.ReadEncoded(1) != 0; + const bool mapped = reader.ReadBits(1) != 0; SetIsMapped(i, mapped); } for (const auto& doorId : savw.GetDoors()) { - SetDoorVisited(doorId, reader.ReadEncoded(1) != 0); + SetDoorVisited(doorId, reader.ReadBits(1) != 0); } - x38_mapStationUsed = reader.ReadEncoded(1) != 0; + x38_mapStationUsed = reader.ReadBits(1) != 0; } -void CMapWorldInfo::PutTo(CBitStreamWriter& writer, const CWorldSaveGameInfo& savw, CAssetId mlvlId) const { +void CMapWorldInfo::PutTo(COutputStream& writer, const CWorldSaveGameInfo& savw, CAssetId mlvlId) const { const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId); for (u32 i = 0; i < worldMem.GetAreaCount(); ++i) { if (i < x0_visitedAreasAllocated) { - writer.WriteEncoded(u32(IsAreaVisited(i)), 1); + writer.WriteBits(u32(IsAreaVisited(i)), 1); } else { - writer.WriteEncoded(0, 1); + writer.WriteBits(0, 1); } } for (u32 i = 0; i < worldMem.GetAreaCount(); ++i) { if (i < x14_mappedAreasAllocated) { - writer.WriteEncoded(u32(IsMapped(i)), 1); + writer.WriteBits(u32(IsMapped(i)), 1); } else { - writer.WriteEncoded(0, 1); + writer.WriteBits(0, 1); } } for (const auto& doorId : savw.GetDoors()) { - writer.WriteEncoded(u32(IsDoorVisited(doorId)), 1); + writer.WriteBits(u32(IsDoorVisited(doorId)), 1); } - writer.WriteEncoded(u32(x38_mapStationUsed), 1); + writer.WriteBits(u32(x38_mapStationUsed), 1); } void CMapWorldInfo::SetDoorVisited(TEditorId eid, bool visited) { x28_visitedDoors[eid] = visited; } diff --git a/Runtime/AutoMapper/CMapWorldInfo.hpp b/Runtime/AutoMapper/CMapWorldInfo.hpp index 14474e8fc..642dfef99 100644 --- a/Runtime/AutoMapper/CMapWorldInfo.hpp +++ b/Runtime/AutoMapper/CMapWorldInfo.hpp @@ -19,8 +19,8 @@ class CMapWorldInfo { public: CMapWorldInfo() = default; - explicit CMapWorldInfo(CBitStreamReader& reader, const CWorldSaveGameInfo& saveWorld, CAssetId mlvlId); - void PutTo(CBitStreamWriter& writer, const CWorldSaveGameInfo& savw, CAssetId mlvlId) const; + explicit CMapWorldInfo(CInputStream& reader, const CWorldSaveGameInfo& saveWorld, CAssetId mlvlId); + void PutTo(COutputStream& writer, const CWorldSaveGameInfo& savw, CAssetId mlvlId) const; bool IsMapped(TAreaId aid) const; void SetIsMapped(TAreaId aid, bool mapped); void SetDoorVisited(TEditorId eid, bool val); diff --git a/Runtime/AutoMapper/CMappableObject.cpp b/Runtime/AutoMapper/CMappableObject.cpp index 5c57d7530..f4edeafd9 100644 --- a/Runtime/AutoMapper/CMappableObject.cpp +++ b/Runtime/AutoMapper/CMappableObject.cpp @@ -15,12 +15,12 @@ std::array CMappableObject::skDoorIndices{ }; CMappableObject::CMappableObject(const void* buf) { - athena::io::MemoryReader r(buf, 64); - x0_type = EMappableObjectType(r.readUint32Big()); - x4_visibilityMode = EVisMode(r.readUint32Big()); - x8_objId = r.readUint32Big(); - xc_ = r.readUint32Big(); - x10_transform.read34RowMajor(r); + CMemoryInStream r(buf, 64); + x0_type = EMappableObjectType(r.ReadLong()); + x4_visibilityMode = EVisMode(r.ReadLong()); + x8_objId = r.ReadLong(); + xc_ = r.ReadLong(); + x10_transform = r.Get(); } zeus::CTransform CMappableObject::AdjustTransformForType() const { diff --git a/Runtime/CBasics.hpp b/Runtime/CBasics.hpp index 7e761fea0..b760f00bf 100644 --- a/Runtime/CBasics.hpp +++ b/Runtime/CBasics.hpp @@ -40,6 +40,14 @@ public: static OSCalendarTime ToCalendarTime(OSTime time) { return ToCalendarTime(FromWiiTime(time)); } static OSCalendarTime ToCalendarTime(std::chrono::system_clock::time_point time); + static u16 SwapBytes(u16 v); + static u32 SwapBytes(u32 v); + static u64 SwapBytes(u64 v); + static float SwapBytes(float v); + static double SwapBytes(double s); + static void Swap2Bytes(u8* v); + static void Swap4Bytes(u8* v); + static void Swap8Bytes(u8* v); }; } // namespace metaforce diff --git a/Runtime/CBasicsPC.cpp b/Runtime/CBasicsPC.cpp index 36262e260..868006163 100644 --- a/Runtime/CBasicsPC.cpp +++ b/Runtime/CBasicsPC.cpp @@ -136,4 +136,63 @@ OSCalendarTime CBasics::ToCalendarTime(std::chrono::system_clock::time_point tim return ret; } +u16 CBasics::SwapBytes(u16 v) { + Swap2Bytes(reinterpret_cast(&v)); + return v; +} +u32 CBasics::SwapBytes(u32 v) { + Swap4Bytes(reinterpret_cast(&v)); + return v; +} + +u64 CBasics::SwapBytes(u64 v) { + Swap8Bytes(reinterpret_cast(&v)); + return v; +} +float CBasics::SwapBytes(float v) { + Swap4Bytes(reinterpret_cast(&v)); + return v; +} +double CBasics::SwapBytes(double v) { + Swap8Bytes(reinterpret_cast(&v)); + return v; +} + +void CBasics::Swap2Bytes(u8* v) { + u16* val = reinterpret_cast(v); +#if __GNUC__ + *val = __builtin_bswap16(*val); +#elif _WIN32 + *val = _byteswap_ushort(*val); +#else + *val = (*val << 8) | ((*val >> 8) & 0xFF); +#endif +} + +void CBasics::Swap4Bytes(u8* v) { + u32* val = reinterpret_cast(v); +#if __GNUC__ + *val = __builtin_bswap32(*val); +#elif _WIN32 + *val = _byteswap_ulong(*val); +#else + *val = ((*val & 0x0000FFFF) << 16) | ((*val & 0xFFFF0000) >> 16) | ((*val & 0x00FF00FF) << 8) | + ((*val & 0xFF00FF00) >> 8); +#endif +} + +void CBasics::Swap8Bytes(u8* v) { + u64* val = reinterpret_cast(v); +#if __GNUC__ + *val = __builtin_bswap64(*val); +#elif _WIN32 + *val = _byteswap_uint64(val); +#else + *val = ((val & 0xFF00000000000000ULL) >> 56) | ((val & 0x00FF000000000000ULL) >> 40) | + ((val & 0x0000FF0000000000ULL) >> 24) | ((val & 0x000000FF00000000ULL) >> 8) | + ((val & 0x00000000FF000000ULL) << 8) | ((val & 0x0000000000FF0000ULL) << 24) | + ((val & 0x000000000000FF00ULL) << 40) | ((val & 0x00000000000000FFULL) << 56); +#endif +} + } // namespace metaforce diff --git a/Runtime/CDependencyGroup.cpp b/Runtime/CDependencyGroup.cpp index bc6064eae..ae1391b86 100644 --- a/Runtime/CDependencyGroup.cpp +++ b/Runtime/CDependencyGroup.cpp @@ -5,7 +5,7 @@ namespace metaforce { CDependencyGroup::CDependencyGroup(CInputStream& in) { ReadFromStream(in); } void CDependencyGroup::ReadFromStream(CInputStream& in) { - u32 depCount = in.readUint32Big(); + u32 depCount = in.ReadLong(); x0_objectTags.reserve(depCount); for (u32 i = 0; i < depCount; i++) x0_objectTags.emplace_back(in); diff --git a/Runtime/CFactoryMgr.cpp b/Runtime/CFactoryMgr.cpp index 72fda9658..c391f9eb1 100644 --- a/Runtime/CFactoryMgr.cpp +++ b/Runtime/CFactoryMgr.cpp @@ -42,10 +42,12 @@ CFactoryFnReturn CFactoryMgr::MakeObjectFromMemory(const SObjectTag& tag, std::u const auto memFactoryIter = m_memFactories.find(tag.type); if (memFactoryIter != m_memFactories.cend()) { if (compressed) { - std::unique_ptr compRead = std::make_unique(localBuf.get(), size); - const u32 decompLen = compRead->readUint32Big(); + std::unique_ptr compRead = + std::make_unique(localBuf.get(), size, CMemoryInStream::EOwnerShip::NotOwned); + const u32 decompLen = compRead->ReadLong(); CZipInputStream r(std::move(compRead)); - std::unique_ptr decompBuf = r.readUBytes(decompLen); + std::unique_ptr decompBuf(new u8[decompLen]); + r.Get(decompBuf.get(), decompLen); return memFactoryIter->second(tag, std::move(decompBuf), decompLen, paramXfer, selfRef); } else { return memFactoryIter->second(tag, std::move(localBuf), size, paramXfer, selfRef); @@ -57,12 +59,14 @@ CFactoryFnReturn CFactoryMgr::MakeObjectFromMemory(const SObjectTag& tag, std::u } if (compressed) { - std::unique_ptr compRead = std::make_unique(localBuf.get(), size); - compRead->readUint32Big(); + std::unique_ptr compRead = + std::make_unique(localBuf.get(), size, CMemoryInStream::EOwnerShip::NotOwned); + + compRead->ReadLong(); CZipInputStream r(std::move(compRead)); return factoryIter->second(tag, r, paramXfer, selfRef); } else { - CMemoryInStream r(localBuf.get(), size); + CMemoryInStream r(localBuf.get(), size, CMemoryInStream::EOwnerShip::NotOwned); return factoryIter->second(tag, r, paramXfer, selfRef); } } diff --git a/Runtime/CGameHintInfo.cpp b/Runtime/CGameHintInfo.cpp index be625c576..02172e1fa 100644 --- a/Runtime/CGameHintInfo.cpp +++ b/Runtime/CGameHintInfo.cpp @@ -7,29 +7,29 @@ namespace metaforce { CGameHintInfo::CGameHintInfo(CInputStream& in, s32 version) { - u32 hintCount = in.readUint32Big(); + u32 hintCount = in.ReadLong(); x0_hints.reserve(hintCount); for (u32 i = 0; i < hintCount; ++i) x0_hints.emplace_back(in, version); } CGameHintInfo::CGameHint::CGameHint(CInputStream& in, s32 version) -: x0_name(in.readString()) -, x10_immediateTime(in.readFloatBig()) -, x14_normalTime(in.readFloatBig()) -, x18_stringId(in.readUint32Big()) -, x1c_textTime(3.f * float(version <= 0 ? 1 : in.readUint32Big())) { - u32 locationCount = in.readUint32Big(); +: x0_name(in.Get()) +, x10_immediateTime(in.ReadFloat()) +, x14_normalTime(in.ReadFloat()) +, x18_stringId(in.ReadLong()) +, x1c_textTime(3.f * float(version <= 0 ? 1 : in.ReadLong())) { + u32 locationCount = in.ReadLong(); x20_locations.reserve(locationCount); for (u32 i = 0; i < locationCount; ++i) x20_locations.emplace_back(in, version); } CGameHintInfo::SHintLocation::SHintLocation(CInputStream& in, s32) -: x0_mlvlId(in.readUint32Big()) -, x4_mreaId(in.readUint32Big()) -, x8_areaId(in.readUint32Big()) -, xc_stringId(in.readUint32Big()) {} +: x0_mlvlId(in.ReadLong()) +, x4_mreaId(in.ReadLong()) +, x8_areaId(in.ReadLong()) +, xc_stringId(in.ReadLong()) {} int CGameHintInfo::FindHintIndex(std::string_view str) { const std::vector& gameHints = g_MemoryCardSys->GetHints(); @@ -40,8 +40,8 @@ int CGameHintInfo::FindHintIndex(std::string_view str) { } CFactoryFnReturn FHintFactory(const SObjectTag&, CInputStream& in, const CVParamTransfer&, CObjectReference*) { - in.readUint32Big(); - s32 version = in.readInt32Big(); + in.ReadLong(); + s32 version = in.ReadInt32(); return TToken::GetIObjObjectFor(std::make_unique(in, version)); } diff --git a/Runtime/CGameOptions.cpp b/Runtime/CGameOptions.cpp index d03ef368b..e7a366479 100644 --- a/Runtime/CGameOptions.cpp +++ b/Runtime/CGameOptions.cpp @@ -96,26 +96,26 @@ constexpr std::array, 5> GameOptionsRegist {0, nullptr}, }}; -CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) { +CPersistentOptions::CPersistentOptions(CInputStream& stream) { for (u8& entry : x0_nesState) { - entry = stream.ReadEncoded(8); + entry = stream.ReadBits(8); } for (bool& entry : x68_) { - entry = stream.ReadEncoded(8) != 0; + entry = stream.ReadBits(8) != 0; } - xc0_frozenFpsCount = stream.ReadEncoded(2); - xc4_frozenBallCount = stream.ReadEncoded(2); - xc8_powerBombAmmoCount = stream.ReadEncoded(1); - xcc_logScanPercent = stream.ReadEncoded(7); - xd0_24_fusionLinked = stream.ReadEncoded(1) != 0; - xd0_25_normalModeBeat = stream.ReadEncoded(1) != 0; - xd0_26_hardModeBeat = stream.ReadEncoded(1) != 0; - xd0_27_fusionBeat = stream.ReadEncoded(1) != 0; + xc0_frozenFpsCount = stream.ReadBits(2); + xc4_frozenBallCount = stream.ReadBits(2); + xc8_powerBombAmmoCount = stream.ReadBits(1); + xcc_logScanPercent = stream.ReadBits(7); + xd0_24_fusionLinked = stream.ReadBits(1) != 0; + xd0_25_normalModeBeat = stream.ReadBits(1) != 0; + xd0_26_hardModeBeat = stream.ReadBits(1) != 0; + xd0_27_fusionBeat = stream.ReadBits(1) != 0; xd0_28_fusionSuitActive = false; - xd0_29_allItemsCollected = stream.ReadEncoded(1) != 0; - xbc_autoMapperKeyState = stream.ReadEncoded(2); + xd0_29_allItemsCollected = stream.ReadBits(1) != 0; + xbc_autoMapperKeyState = stream.ReadBits(2); const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds(); size_t cinematicCount = 0; @@ -128,7 +128,7 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) { std::vector cinematicStates; cinematicStates.reserve(cinematicCount); for (size_t i = 0; i < cinematicCount; ++i) { - cinematicStates.push_back(stream.ReadEncoded(1) != 0); + cinematicStates.push_back(stream.ReadBits(1) != 0); } for (const auto& world : memWorlds) { @@ -142,25 +142,25 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) { } } -void CPersistentOptions::PutTo(CBitStreamWriter& w) const { +void CPersistentOptions::PutTo(COutputStream& w) const { for (const u8 entry : x0_nesState) { - w.WriteEncoded(entry, 8); + w.WriteBits(entry, 8); } for (const bool entry : x68_) { - w.WriteEncoded(u32(entry), 8); + w.WriteBits(u32(entry), 8); } - w.WriteEncoded(xc0_frozenFpsCount, 2); - w.WriteEncoded(xc4_frozenBallCount, 2); - w.WriteEncoded(xc8_powerBombAmmoCount, 1); - w.WriteEncoded(xcc_logScanPercent, 7); - w.WriteEncoded(xd0_24_fusionLinked, 1); - w.WriteEncoded(xd0_25_normalModeBeat, 1); - w.WriteEncoded(xd0_26_hardModeBeat, 1); - w.WriteEncoded(xd0_27_fusionBeat, 1); - w.WriteEncoded(xd0_29_allItemsCollected, 1); - w.WriteEncoded(xbc_autoMapperKeyState, 2); + w.WriteBits(xc0_frozenFpsCount, 2); + w.WriteBits(xc4_frozenBallCount, 2); + w.WriteBits(xc8_powerBombAmmoCount, 1); + w.WriteBits(xcc_logScanPercent, 7); + w.WriteBits(xd0_24_fusionLinked, 1); + w.WriteBits(xd0_25_normalModeBeat, 1); + w.WriteBits(xd0_26_hardModeBeat, 1); + w.WriteBits(xd0_27_fusionBeat, 1); + w.WriteBits(xd0_29_allItemsCollected, 1); + w.WriteBits(xbc_autoMapperKeyState, 2); const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds(); for (const auto& world : memWorlds) { @@ -168,7 +168,7 @@ void CPersistentOptions::PutTo(CBitStreamWriter& w) const { g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()}); for (const auto& cineId : saveWorld->GetCinematics()) { - w.WriteEncoded(u32(GetCinematicState(world.first, cineId)), 1); + w.WriteBits(u32(GetCinematicState(world.first, cineId)), 1); } } } @@ -194,26 +194,26 @@ void CPersistentOptions::SetCinematicState(CAssetId mlvlId, TEditorId cineId, bo xac_cinematicStates.erase(existing); } -CGameOptions::CGameOptions(CBitStreamReader& stream) { +CGameOptions::CGameOptions(CInputStream& stream) { for (u8& entry : x0_) - entry = stream.ReadEncoded(8); + entry = stream.ReadBits(8); - x44_soundMode = CAudioSys::ESurroundModes(stream.ReadEncoded(2)); - x48_screenBrightness = stream.ReadEncoded(4); + x44_soundMode = CAudioSys::ESurroundModes(stream.ReadBits(2)); + x48_screenBrightness = stream.ReadBits(4); - x4c_screenXOffset = stream.ReadEncoded(6) - 30; - x50_screenYOffset = stream.ReadEncoded(6) - 30; - x54_screenStretch = stream.ReadEncoded(5) - 10; - x58_sfxVol = stream.ReadEncoded(7); - x5c_musicVol = stream.ReadEncoded(7); - x60_hudAlpha = stream.ReadEncoded(8); - x64_helmetAlpha = stream.ReadEncoded(8); + x4c_screenXOffset = stream.ReadBits(6) - 30; + x50_screenYOffset = stream.ReadBits(6) - 30; + x54_screenStretch = stream.ReadBits(5) - 10; + x58_sfxVol = stream.ReadBits(7); + x5c_musicVol = stream.ReadBits(7); + x60_hudAlpha = stream.ReadBits(8); + x64_helmetAlpha = stream.ReadBits(8); - x68_24_hudLag = stream.ReadEncoded(1) != 0; - x68_28_hintSystem = stream.ReadEncoded(1) != 0; - x68_25_invertY = stream.ReadEncoded(1) != 0; - x68_26_rumble = stream.ReadEncoded(1) != 0; - x68_27_swapBeamsControls = stream.ReadEncoded(1) != 0; + x68_24_hudLag = stream.ReadBits(1) != 0; + x68_28_hintSystem = stream.ReadBits(1) != 0; + x68_25_invertY = stream.ReadBits(1) != 0; + x68_26_rumble = stream.ReadBits(1) != 0; + x68_27_swapBeamsControls = stream.ReadBits(1) != 0; } void CGameOptions::ResetToDefaults() { @@ -235,26 +235,26 @@ void CGameOptions::ResetToDefaults() { EnsureSettings(); } -void CGameOptions::PutTo(CBitStreamWriter& writer) const { +void CGameOptions::PutTo(COutputStream& writer) const { for (const u8 entry : x0_) - writer.WriteEncoded(entry, 8); + writer.WriteBits(entry, 8); - writer.WriteEncoded(u32(x44_soundMode), 2); - writer.WriteEncoded(x48_screenBrightness, 4); + writer.WriteBits(u32(x44_soundMode), 2); + writer.WriteBits(x48_screenBrightness, 4); - writer.WriteEncoded(x4c_screenXOffset + 30, 6); - writer.WriteEncoded(x50_screenYOffset + 30, 6); - writer.WriteEncoded(x54_screenStretch + 10, 5); - writer.WriteEncoded(x58_sfxVol, 7); - writer.WriteEncoded(x5c_musicVol, 7); - writer.WriteEncoded(x60_hudAlpha, 8); - writer.WriteEncoded(x64_helmetAlpha, 8); + writer.WriteBits(x4c_screenXOffset + 30, 6); + writer.WriteBits(x50_screenYOffset + 30, 6); + writer.WriteBits(x54_screenStretch + 10, 5); + writer.WriteBits(x58_sfxVol, 7); + writer.WriteBits(x5c_musicVol, 7); + writer.WriteBits(x60_hudAlpha, 8); + writer.WriteBits(x64_helmetAlpha, 8); - writer.WriteEncoded(x68_24_hudLag, 1); - writer.WriteEncoded(x68_28_hintSystem, 1); - writer.WriteEncoded(x68_25_invertY, 1); - writer.WriteEncoded(x68_26_rumble, 1); - writer.WriteEncoded(x68_27_swapBeamsControls, 1); + writer.WriteBits(x68_24_hudLag, 1); + writer.WriteBits(x68_28_hintSystem, 1); + writer.WriteBits(x68_25_invertY, 1); + writer.WriteBits(x68_26_rumble, 1); + writer.WriteBits(x68_27_swapBeamsControls, 1); } CGameOptions::CGameOptions() @@ -579,14 +579,14 @@ int CGameOptions::GetOption(EGameOption option) { return 0; } -CHintOptions::CHintOptions(CBitStreamReader& stream) { +CHintOptions::CHintOptions(CInputStream& stream) { const auto& hints = g_MemoryCardSys->GetHints(); x0_hintStates.reserve(hints.size()); u32 hintIdx = 0; for ([[maybe_unused]] const auto& hint : hints) { - const auto state = EHintState(stream.ReadEncoded(2)); - const s32 timeBits = stream.ReadEncoded(32); + const auto state = EHintState(stream.ReadBits(2)); + const s32 timeBits = stream.ReadBits(32); float time; std::memcpy(&time, &timeBits, sizeof(s32)); if (state == EHintState::Zero) { @@ -602,14 +602,14 @@ CHintOptions::CHintOptions(CBitStreamReader& stream) { } } -void CHintOptions::PutTo(CBitStreamWriter& writer) const { +void CHintOptions::PutTo(COutputStream& writer) const { for (const SHintState& hint : x0_hintStates) { - writer.WriteEncoded(u32(hint.x0_state), 2); + writer.WriteBits(u32(hint.x0_state), 2); u32 timeBits; std::memcpy(&timeBits, &hint.x4_time, sizeof(timeBits)); - writer.WriteEncoded(timeBits, 32); + writer.WriteBits(timeBits, 32); } } diff --git a/Runtime/CGameOptions.hpp b/Runtime/CGameOptions.hpp index 84b7b2b07..c30ce87d3 100644 --- a/Runtime/CGameOptions.hpp +++ b/Runtime/CGameOptions.hpp @@ -66,7 +66,7 @@ class CPersistentOptions { public: CPersistentOptions() = default; - explicit CPersistentOptions(CBitStreamReader& stream); + explicit CPersistentOptions(CInputStream& stream); bool GetCinematicState(CAssetId mlvlId, TEditorId cineId) const; void SetCinematicState(CAssetId mlvlId, TEditorId cineId, bool state); @@ -93,7 +93,7 @@ public: bool GetShowPowerBombAmmoMessage() const { return xc8_powerBombAmmoCount != 1; } void IncrementPowerBombAmmoCount() { xc8_powerBombAmmoCount = std::min(1, xc8_powerBombAmmoCount + 1); } - void PutTo(CBitStreamWriter& w) const; + void PutTo(COutputStream& w) const; u8* GetNESState() { return x0_nesState.data(); } const u8* GetNESState() const { return x0_nesState.data(); } @@ -122,11 +122,11 @@ class CGameOptions { public: CGameOptions(); - explicit CGameOptions(CBitStreamReader& stream); + explicit CGameOptions(CInputStream& stream); void ResetToDefaults(); void InitSoundMode(); void EnsureSettings(); - void PutTo(CBitStreamWriter& writer) const; + void PutTo(COutputStream& writer) const; float TuneScreenBrightness() const; void SetScreenBrightness(s32 value, bool apply); @@ -189,8 +189,8 @@ private: public: CHintOptions() = default; - explicit CHintOptions(CBitStreamReader& stream); - void PutTo(CBitStreamWriter& writer) const; + explicit CHintOptions(CInputStream& stream); + void PutTo(COutputStream& writer) const; void SetNextHintTime(); void InitializeMemoryState(); const SHintState* GetCurrentDisplayedHint() const; diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index ccfbc9a6c..012b679a3 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -23,12 +23,12 @@ union BitsToDouble { double doub; }; -CScriptLayerManager::CScriptLayerManager(CBitStreamReader& reader, const CWorldSaveGameInfo& saveWorld) { - const u32 bitCount = reader.ReadEncoded(10); +CScriptLayerManager::CScriptLayerManager(CInputStream& reader, const CWorldSaveGameInfo& saveWorld) { + const u32 bitCount = reader.ReadBits(10); x10_saveLayers.reserve(bitCount); for (u32 i = 0; i < bitCount; ++i) { - const bool bit = reader.ReadEncoded(1) != 0; + const bool bit = reader.ReadBits(1) != 0; if (bit) { x10_saveLayers.setBit(i); } else { @@ -37,18 +37,18 @@ CScriptLayerManager::CScriptLayerManager(CBitStreamReader& reader, const CWorldS } } -void CScriptLayerManager::PutTo(CBitStreamWriter& writer) const { +void CScriptLayerManager::PutTo(COutputStream& writer) const { u32 totalLayerCount = 0; for (size_t i = 0; i < x0_areaLayers.size(); ++i) { totalLayerCount += GetAreaLayerCount(s32(i)) - 1; } - writer.WriteEncoded(totalLayerCount, 10); + writer.WriteBits(totalLayerCount, 10); for (size_t i = 0; i < x0_areaLayers.size(); ++i) { const u32 count = GetAreaLayerCount(s32(i)); for (u32 l = 1; l < count; ++l) { - writer.WriteEncoded(IsLayerActive(s32(i), s32(l)), 1); + writer.WriteBits(IsLayerActive(s32(i), s32(l)), 1); } } } @@ -81,40 +81,40 @@ CWorldState::CWorldState(CAssetId id) : x0_mlvlId(id), x4_areaId(0) { x14_layerState = std::make_shared(); } -CWorldState::CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CWorldSaveGameInfo& saveWorld) +CWorldState::CWorldState(CInputStream& reader, CAssetId mlvlId, const CWorldSaveGameInfo& saveWorld) : x0_mlvlId(mlvlId) { - x4_areaId = TAreaId(reader.ReadEncoded(32)); - x10_desiredAreaAssetId = u32(reader.ReadEncoded(32)); + x4_areaId = TAreaId(reader.ReadBits(32)); + x10_desiredAreaAssetId = u32(reader.ReadBits(32)); x8_mailbox = std::make_shared(reader, saveWorld); xc_mapWorldInfo = std::make_shared(reader, saveWorld, mlvlId); x14_layerState = std::make_shared(reader, saveWorld); } -void CWorldState::PutTo(CBitStreamWriter& writer, const CWorldSaveGameInfo& savw) const { - writer.WriteEncoded(x4_areaId, 32); - writer.WriteEncoded(u32(x10_desiredAreaAssetId.Value()), 32); +void CWorldState::PutTo(COutputStream& writer, const CWorldSaveGameInfo& savw) const { + writer.WriteBits(x4_areaId, 32); + writer.WriteBits(u32(x10_desiredAreaAssetId.Value()), 32); x8_mailbox->PutTo(writer, savw); xc_mapWorldInfo->PutTo(writer, savw, x0_mlvlId); x14_layerState->PutTo(writer); } CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data) { - CBitStreamReader stream(data, 4096); + CMemoryInStream stream(data, 4096, CMemoryInStream::EOwnerShip::NotOwned); GameFileStateInfo ret; for (u32 i = 0; i < 128; i++) { - stream.ReadEncoded(8); + stream.ReadBits(8); } - ret.x14_timestamp = stream.ReadEncoded(32); + ret.x14_timestamp = stream.ReadBits(32); - ret.x20_hardMode = stream.ReadEncoded(1) != 0; - stream.ReadEncoded(1); - const CAssetId origMLVL = u32(stream.ReadEncoded(32)); + ret.x20_hardMode = stream.ReadBits(1) != 0; + stream.ReadBits(1); + const CAssetId origMLVL = u32(stream.ReadBits(32)); ret.x8_mlvlId = origMLVL; BitsToDouble conv; - conv.low = stream.ReadEncoded(32); - conv.high = stream.ReadEncoded(32); + conv.low = stream.ReadBits(32); + conv.high = stream.ReadBits(32); ret.x0_playTime = conv.doub; CPlayerState playerState(stream); @@ -148,24 +148,24 @@ CGameState::CGameState() { } } -CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx(saveIdx) { +CGameState::CGameState(CInputStream& stream, u32 saveIdx) : x20c_saveFileIdx(saveIdx) { x9c_transManager = std::make_shared(); x228_24_hardMode = false; x228_25_initPowerupsAtFirstSpawn = true; for (bool& value : x0_) { - value = stream.ReadEncoded(8) != 0; + value = stream.ReadBits(8) != 0; } - stream.ReadEncoded(32); + stream.ReadBits(32); - x228_24_hardMode = stream.ReadEncoded(1) != 0; - x228_25_initPowerupsAtFirstSpawn = stream.ReadEncoded(1) != 0; - x84_mlvlId = u32(stream.ReadEncoded(32)); + x228_24_hardMode = stream.ReadBits(1) != 0; + x228_25_initPowerupsAtFirstSpawn = stream.ReadBits(1) != 0; + x84_mlvlId = u32(stream.ReadBits(32)); MP1::CMain::EnsureWorldPakReady(x84_mlvlId); BitsToDouble conv; - conv.low = stream.ReadEncoded(32); - conv.high = stream.ReadEncoded(32); + conv.low = stream.ReadBits(32); + conv.high = stream.ReadBits(32); xa0_playTime = conv.doub; x98_playerState = std::make_shared(stream); @@ -185,7 +185,7 @@ CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx WriteBackupBuf(); } -void CGameState::ReadPersistentOptions(CBitStreamReader& r) { xa8_systemOptions = CPersistentOptions(r); } +void CGameState::ReadPersistentOptions(CInputStream& r) { xa8_systemOptions = r.Get(); } void CGameState::ImportPersistentOptions(const CPersistentOptions& opts) { if (opts.xd0_24_fusionLinked) @@ -212,24 +212,24 @@ void CGameState::ExportPersistentOptions(CPersistentOptions& opts) const { void CGameState::WriteBackupBuf() { x218_backupBuf.resize(940); - CBitStreamWriter w(x218_backupBuf.data(), 940); + CMemoryStreamOut w(x218_backupBuf.data(), 940); PutTo(w); } -void CGameState::PutTo(CBitStreamWriter& writer) { +void CGameState::PutTo(COutputStream& writer) { for (const bool value : x0_) { - writer.WriteEncoded(u32(value), 8); + writer.WriteBits(u32(value), 8); } - writer.WriteEncoded(CBasics::GetTime() / CBasics::TICKS_PER_SECOND, 32); - writer.WriteEncoded(x228_24_hardMode, 1); - writer.WriteEncoded(x228_25_initPowerupsAtFirstSpawn, 1); - writer.WriteEncoded(u32(x84_mlvlId.Value()), 32); + writer.WriteBits(CBasics::GetTime() / CBasics::TICKS_PER_SECOND, 32); + writer.WriteBits(x228_24_hardMode, 1); + writer.WriteBits(x228_25_initPowerupsAtFirstSpawn, 1); + writer.WriteBits(u32(x84_mlvlId.Value()), 32); BitsToDouble conv; conv.doub = xa0_playTime; - writer.WriteEncoded(conv.low, 32); - writer.WriteEncoded(conv.high, 32); + writer.WriteBits(conv.low, 32); + writer.WriteBits(conv.high, 32); x98_playerState->PutTo(writer); x17c_gameOptions.PutTo(writer); diff --git a/Runtime/CGameState.hpp b/Runtime/CGameState.hpp index 86bf1df80..0c411b1ce 100644 --- a/Runtime/CGameState.hpp +++ b/Runtime/CGameState.hpp @@ -24,7 +24,7 @@ class CScriptLayerManager { public: CScriptLayerManager() = default; - CScriptLayerManager(CBitStreamReader& reader, const CWorldSaveGameInfo& saveWorld); + CScriptLayerManager(CInputStream& reader, const CWorldSaveGameInfo& saveWorld); bool IsLayerActive(int areaIdx, int layerIdx) const { return ((x0_areaLayers[areaIdx].m_layerBits >> layerIdx) & 1); } @@ -40,7 +40,7 @@ public: u32 GetAreaLayerCount(int areaIdx) const { return x0_areaLayers[areaIdx].m_layerCount; } u32 GetAreaCount() const { return x0_areaLayers.size(); } - void PutTo(CBitStreamWriter& writer) const; + void PutTo(COutputStream& writer) const; }; class CWorldState { @@ -53,7 +53,7 @@ class CWorldState { public: explicit CWorldState(CAssetId id); - CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CWorldSaveGameInfo& saveWorld); + CWorldState(CInputStream& reader, CAssetId mlvlId, const CWorldSaveGameInfo& saveWorld); CAssetId GetWorldAssetId() const { return x0_mlvlId; } void SetAreaId(TAreaId aid) { x4_areaId = aid; } TAreaId GetCurrentAreaId() const { return x4_areaId; } @@ -62,7 +62,7 @@ public: const std::shared_ptr& Mailbox() const { return x8_mailbox; } const std::shared_ptr& MapWorldInfo() const { return xc_mapWorldInfo; } const std::shared_ptr& GetLayerState() const { return x14_layerState; } - void PutTo(CBitStreamWriter& writer, const CWorldSaveGameInfo& savw) const; + void PutTo(COutputStream& writer, const CWorldSaveGameInfo& savw) const; }; class CGameState { @@ -86,7 +86,7 @@ class CGameState { public: CGameState(); - CGameState(CBitStreamReader& stream, u32 saveIdx); + CGameState(CInputStream& stream, u32 saveIdx); void SetCurrentWorldId(CAssetId id); std::shared_ptr GetPlayerState() const { return x98_playerState; } std::shared_ptr GetWorldTransitionManager() const { return x9c_transManager; } @@ -100,7 +100,7 @@ public: CAssetId CurrentWorldAssetId() const { return x84_mlvlId; } void SetHardMode(bool v) { x228_24_hardMode = v; } bool GetHardMode() const { return x228_24_hardMode; } - void ReadPersistentOptions(CBitStreamReader& r); + void ReadPersistentOptions(CInputStream& r); void SetPersistentOptions(const CPersistentOptions& opts) { xa8_systemOptions = opts; } void ImportPersistentOptions(const CPersistentOptions& opts); void ExportPersistentOptions(CPersistentOptions& opts) const; @@ -111,7 +111,7 @@ public: void SetFileIdx(u32 idx) { x20c_saveFileIdx = idx; } void SetCardSerial(u64 serial) { x210_cardSerial = serial; } u64 GetCardSerial() const { return x210_cardSerial; } - void PutTo(CBitStreamWriter& writer); + void PutTo(COutputStream& writer); float GetHardModeDamageMultiplier() const; float GetHardModeWeaponMultiplier() const; void InitializeMemoryWorlds(); diff --git a/Runtime/CInputStream.cpp b/Runtime/CInputStream.cpp new file mode 100644 index 000000000..1113bc7c8 --- /dev/null +++ b/Runtime/CInputStream.cpp @@ -0,0 +1,278 @@ +#include "CInputStream.hpp" +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ +#include "Runtime/CBasics.hpp" +#endif + +#include + +namespace metaforce { +static u32 min_containing_bytes(u32 v) { + v = 32 - v; + v = (v >> 3) - ((s32) - (v & 7) >> 31); + return v; +} + +CInputStream::CInputStream(s32 len) : xc_len(len), x10_ptr(new u8[len]), x14_owned(true) {} +CInputStream::CInputStream(const void* ptr, u32 len, bool owned) +: x8_blockLen(len), xc_len(len), x10_ptr(reinterpret_cast(ptr)), x14_owned(owned) {} + +CInputStream::~CInputStream() { + if (x14_owned) { + delete[] x10_ptr; + } +} + +bool CInputStream::InternalReadNext() { + x8_blockLen = Read(const_cast(x10_ptr), xc_len); + x4_blockOffset = 0; + return x8_blockLen != 0; +} + +bool CInputStream::GrabAnotherBlock() { return InternalReadNext(); } + +void CInputStream::Get(u8* dest, u32 len) { + x20_bitOffset = 0; + u32 offset = 0; + while (len != 0) { + u32 blockLen = x8_blockLen - x4_blockOffset; + if (len < blockLen) { + blockLen = len; + } + + if (blockLen == 0) { + if (len <= 256) { + GrabAnotherBlock(); + } else { + u32 readLen = Read(dest + offset, len); + len -= readLen; + offset += readLen; + } + } else { + memcpy(dest + offset, x10_ptr + x4_blockOffset, blockLen); + len -= blockLen; + x4_blockOffset += blockLen; + } + } + + x18_readPosition += offset; +} + +u32 CInputStream::ReadBytes(void* dest, u32 len) { + if (len == 0) { + return 0; + } + + if (x4_blockOffset == x8_blockLen) { + GrabAnotherBlock(); + } + + u32 curReadLen = 0; + u32 curLen = len; + + do { + while (true) { + if (len <= curReadLen) { + x18_readPosition += curReadLen; + return curReadLen; + } + + u32 readCount = x8_blockLen - x4_blockOffset; + if (readCount == 0) { + break; + } + + if (curLen < readCount) { + readCount = curLen; + } + + memcpy(reinterpret_cast(dest) + curReadLen, x10_ptr + x4_blockOffset, readCount); + curReadLen += readCount; + curLen -= readCount; + } + } while (InternalReadNext()); + + return curReadLen; +} + +u32 CInputStream::ReadBits(u32 bitCount) { + u32 ret = x20_bitOffset; + if (ret < bitCount) { + const u32 shiftAmt = bitCount - x20_bitOffset; + const u32 mask = ret == 32 ? -1 : (1 << x20_bitOffset) - 1; + + u32 uVar2 = x1c_bitWord; + x20_bitOffset = 0; + u32 len = min_containing_bytes(shiftAmt); + Get(reinterpret_cast(&x1c_bitWord), len); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + x1c_bitWord = CBasics::SwapBytes(x1c_bitWord); +#endif + + const u32 retMask = shiftAmt == 32 ? -1 : (1 << shiftAmt) - 1; + const u32 tmpOffset = x20_bitOffset; + x20_bitOffset = len * 8; + ret = ((mask & uVar2) >> (32 - ret) << shiftAmt) | (retMask & (x1c_bitWord >> (32 - shiftAmt))) << tmpOffset; + x20_bitOffset -= shiftAmt; + x1c_bitWord <<= shiftAmt; + } else { + x20_bitOffset -= bitCount; + ret = bitCount == 32 ? -1 : (1 << bitCount) - 1; + ret &= x1c_bitWord >> (32 - bitCount); + x1c_bitWord <<= bitCount; + } + return ret; +} + +char CInputStream::ReadChar() { + u8 tmp = 0; + Get(&tmp, sizeof(tmp)); + return static_cast(tmp); +} + +bool CInputStream::ReadBool() { return Get(); } + +s16 CInputStream::ReadInt16() { + s16 tmp = 0; + Get(reinterpret_cast(&tmp), sizeof(tmp)); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + CBasics::Swap2Bytes(reinterpret_cast(&tmp)); +#endif + return tmp; +} + +u16 CInputStream::ReadUint16() { + u16 tmp = 0; + Get(reinterpret_cast(&tmp), sizeof(tmp)); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + CBasics::Swap2Bytes(reinterpret_cast(&tmp)); +#endif + return tmp; +} + +s32 CInputStream::ReadInt32() { + s32 tmp = 0; + Get(reinterpret_cast(&tmp), sizeof(tmp)); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + CBasics::Swap4Bytes(reinterpret_cast(&tmp)); +#endif + return tmp; +} + +u32 CInputStream::ReadUint32() { + u32 tmp = 0; + Get(reinterpret_cast(&tmp), sizeof(tmp)); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + CBasics::Swap4Bytes(reinterpret_cast(&tmp)); +#endif + return tmp; +} + +s64 CInputStream::ReadInt64() { + s64 tmp = 0; + Get(reinterpret_cast(&tmp), sizeof(tmp)); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + CBasics::Swap8Bytes(reinterpret_cast(&tmp)); +#endif + return tmp; +} + +u64 CInputStream::ReadUint64() { + u64 tmp = 0; + Get(reinterpret_cast(&tmp), sizeof(tmp)); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + CBasics::Swap8Bytes(reinterpret_cast(&tmp)); +#endif + return tmp; +} + +float CInputStream::ReadFloat() { + float tmp = 0.f; + Get(reinterpret_cast(&tmp), sizeof(tmp)); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + CBasics::Swap4Bytes(reinterpret_cast(&tmp)); +#endif + return tmp; +} + +float CInputStream::ReadReal32() { return Get(); } + +double CInputStream::ReadDouble() { + double tmp = 0.0; + Get(reinterpret_cast(&tmp), sizeof(tmp)); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + CBasics::Swap8Bytes(reinterpret_cast(&tmp)); +#endif + return tmp; +} + +double CInputStream::ReadReal64() { return Get(); } + +template <> +bool cinput_stream_helper(CInputStream& in) { + return in.ReadChar() != 0; +} + +template <> +s8 cinput_stream_helper(CInputStream& in) { + return in.ReadChar(); +} +template <> +u8 cinput_stream_helper(CInputStream& in) { + return in.ReadChar(); +} + +template <> +s16 cinput_stream_helper(CInputStream& in) { + return in.ReadInt16(); +} + +template <> +s32 cinput_stream_helper(CInputStream& in) { + return in.ReadInt32(); +} + +template <> +u32 cinput_stream_helper(CInputStream& in) { + return in.ReadUint32(); +} + +template <> +s64 cinput_stream_helper(CInputStream& in) { + return in.ReadInt64(); +} + +template <> +u64 cinput_stream_helper(CInputStream& in) { + return in.ReadUint64(); +} + +template <> +float cinput_stream_helper(CInputStream& in) { + return in.ReadFloat(); +} + +template <> +double cinput_stream_helper(CInputStream& in) { + return in.ReadDouble(); +} + +template <> +std::string cinput_stream_helper(CInputStream& in) { + std::string ret; + auto chr = in.ReadChar(); + while (chr != '\0') { + ret += chr; + chr = in.ReadChar(); + } + + return ret; +} + +u32 CInputStream::GetBitCount(u32 val) { + int bits = 0; + for (; val != 0; val >>= 1) { + bits += 1; + } + return bits; +} +} // namespace metaforce diff --git a/Runtime/CInputStream.hpp b/Runtime/CInputStream.hpp new file mode 100644 index 000000000..21298e33a --- /dev/null +++ b/Runtime/CInputStream.hpp @@ -0,0 +1,83 @@ +#pragma once +#include "Runtime/GCNTypes.hpp" +#include + +namespace metaforce { +class CInputStream { + u32 x4_blockOffset = 0; + u32 x8_blockLen = 0; + u32 xc_len = 0; + const u8* x10_ptr = nullptr; + bool x14_owned = false; + u32 x18_readPosition = 0; + u32 x1c_bitWord = 0; + u32 x20_bitOffset = 0; + + bool InternalReadNext(); + bool GrabAnotherBlock(); + +public: + explicit CInputStream(s32 len); + CInputStream(const void* ptr, u32 len, bool owned); + virtual ~CInputStream(); + + virtual u32 Read(void* dest, u32 len) = 0; + + u32 GetReadPosition() const { return x18_readPosition; } + u32 ReadBits(u32 bitCount); + u32 ReadBytes(void* dest, u32 len); + s8 ReadInt8() { return Get(); } + u8 ReadUint8() { return Get(); } + char ReadChar(); + bool ReadBool(); + s16 ReadInt16(); + s16 ReadShort() { return Get(); } + u16 ReadUint16(); + s32 ReadInt32(); + s32 ReadLong() { return Get(); } + u32 ReadUint32(); + s64 ReadInt64(); + s64 ReadLongLong() { return Get(); } + u64 ReadUint64(); + + float ReadReal32(); + float ReadFloat(); + double ReadReal64(); + double ReadDouble(); + + void Get(u8* dest, u32 len); + template + T Get() { + return cinput_stream_helper(*this); + } + + static u32 GetBitCount(u32 val); +}; + +template +T cinput_stream_helper(CInputStream& in) { + return T(in); +} +template <> +bool cinput_stream_helper(CInputStream& in); +template <> +s8 cinput_stream_helper(CInputStream& in); +template <> +u8 cinput_stream_helper(CInputStream& in); +template <> +s16 cinput_stream_helper(CInputStream& in); +template <> +s32 cinput_stream_helper(CInputStream& in); +template <> +u32 cinput_stream_helper(CInputStream& in); +template <> +s64 cinput_stream_helper(CInputStream& in); +template <> +u64 cinput_stream_helper(CInputStream& in); +template <> +float cinput_stream_helper(CInputStream& in); +template <> +double cinput_stream_helper(CInputStream& in); +template <> +std::string cinput_stream_helper(CInputStream& in); +} // namespace metaforce \ No newline at end of file diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index 7c3042c65..1a85d9f78 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -73,6 +73,11 @@ set(RUNTIME_SOURCES_B ITweak.hpp IMain.hpp CStopwatch.hpp + CMemoryStreamOut.hpp CMemoryStreamOut.cpp + CInputStream.hpp CInputStream.cpp + COutputStream.hpp COutputStream.cpp + CMemoryInStream.hpp + CZipInputStream.hpp CZipInputStream.cpp CGameAllocator.hpp CGameAllocator.cpp CMemoryCardSys.hpp CMemoryCardSys.cpp CScannableObjectInfo.hpp CScannableObjectInfo.cpp @@ -109,7 +114,7 @@ set(RUNTIME_SOURCES_B CToken.hpp CToken.cpp CFactoryMgr.hpp CFactoryMgr.cpp CPakFile.hpp CPakFile.cpp - CStringExtras.hpp + CStringExtras.hpp CStringExtras.cpp IOStreams.hpp IOStreams.cpp CMainFlowBase.hpp CMainFlowBase.cpp CMFGameBase.hpp @@ -125,6 +130,7 @@ set(RUNTIME_SOURCES_B function(add_runtime_common_library name) add_library(${name} ${ARGN}) + target_compile_definitions(${name} PUBLIC "-DMETAFORCE_TARGET_BYTE_ORDER=__BYTE_ORDER__") if (COMMAND add_sanitizers) add_sanitizers(${name}) endif () @@ -209,6 +215,7 @@ add_executable(metaforce CMain.cpp ${PLAT_SRCS} ImGuiConsole.hpp ImGuiConsole.cp # target_atdna(metaforce atdna_ImGuiPlayerLoadouts.cpp ImGuiPlayerLoadouts.hpp) # RUNTIME_LIBRARIES repeated here for link ordering target_link_libraries(metaforce PUBLIC RuntimeCommon RuntimeCommonB ${RUNTIME_LIBRARIES} ${PLAT_LIBS}) +target_compile_definitions(metaforce PUBLIC "-DMETAFORCE_TARGET_BYTE_ORDER=__BYTE_ORDER__") if (COMMAND add_sanitizers) add_sanitizers(metaforce) diff --git a/Runtime/CMayaSpline.cpp b/Runtime/CMayaSpline.cpp index 1802c2edc..ce42e11aa 100644 --- a/Runtime/CMayaSpline.cpp +++ b/Runtime/CMayaSpline.cpp @@ -1,6 +1,6 @@ -#include "CMayaSpline.hpp" +#include "Runtime/CMayaSpline.hpp" -namespace rstl {} // namespace rstl +#include "Runtime/CInputStream.hpp" namespace metaforce { void ValidateTangent(zeus::CVector2f& tangent) { @@ -21,19 +21,19 @@ void ValidateTangent(zeus::CVector2f& tangent) { } CMayaSplineKnot::CMayaSplineKnot(CInputStream& in) { - x0_time = in.readFloatBig(); - x4_amplitude = in.readFloatBig(); - x8_ = in.readByte(); - x9_ = in.readByte(); + x0_time = in.ReadFloat(); + x4_amplitude = in.ReadFloat(); + x8_ = in.ReadInt8(); + x9_ = in.ReadInt8(); if (x8_ == 5) { - float x = in.readFloatBig(); - float y = in.readFloatBig(); + float x = in.ReadFloat(); + float y = in.ReadFloat(); xc_cachedTangentA = {x, y}; } if (x9_ == 5) { - float x = in.readFloatBig(); - float y = in.readFloatBig(); + float x = in.ReadFloat(); + float y = in.ReadFloat(); x14_cachedTangentB = {x, y}; } } @@ -166,17 +166,16 @@ void CMayaSplineKnot::CalculateTangents(CMayaSplineKnot* prev, CMayaSplineKnot* ValidateTangent(x14_cachedTangentB); } -CMayaSpline::CMayaSpline(CInputStream& in, s32 count) { - x0_preInfinity = in.readByte(); - x4_postInfinity = in.readByte(); - u32 knotCount = in.readUint32Big(); +CMayaSpline::CMayaSpline(CInputStream& in, s32 count) : x0_preInfinity(in.ReadInt8()), x4_postInfinity(in.ReadInt8()) { + + u32 knotCount = in.ReadLong(); x8_knots.reserve(knotCount); for (size_t i = 0; i < knotCount; ++i) { x8_knots.emplace_back(in); } - x18_clampMode = in.readByte(); - x1c_minAmplitudeTime = in.readFloatBig(); - x20_maxAmplitudeTime = in.readFloatBig(); + x18_clampMode = in.ReadInt8(); + x1c_minAmplitudeTime = in.ReadFloat(); + x20_maxAmplitudeTime = in.ReadFloat(); } float CMayaSpline::GetMinTime() const { return x8_knots.empty() ? 0.f : x8_knots[0].GetTime(); } diff --git a/Runtime/CMemoryCardSys.cpp b/Runtime/CMemoryCardSys.cpp index 9ae7656d1..31a49efff 100644 --- a/Runtime/CMemoryCardSys.cpp +++ b/Runtime/CMemoryCardSys.cpp @@ -215,12 +215,12 @@ void CMemoryCardSys::CCardFileInfo::BuildCardBuffer() { u32 bannerSz = CalculateBannerDataSize(); x104_cardBuffer.resize((bannerSz + xf4_saveBuffer.size() + 8191) & ~8191); - CMemoryOutStream w(x104_cardBuffer.data(), x104_cardBuffer.size()); - w.writeUint32Big(0); + CMemoryStreamOut w(x104_cardBuffer.data(), x104_cardBuffer.size(), CMemoryStreamOut::EOwnerShip::NotOwned); + w.WriteLong(0); char comment[64]; std::memset(comment, 0, std::size(comment)); std::strncpy(comment, x28_comment.data(), std::size(comment) - 1); - w.writeBytes(comment, 64); + w.Write(reinterpret_cast(comment), 64); WriteBannerData(w); WriteIconData(w); memmove(x104_cardBuffer.data() + bannerSz, xf4_saveBuffer.data(), xf4_saveBuffer.size()); @@ -230,7 +230,7 @@ void CMemoryCardSys::CCardFileInfo::BuildCardBuffer() { xf4_saveBuffer.clear(); } -void CMemoryCardSys::CCardFileInfo::WriteBannerData(CMemoryOutStream& out) const { +void CMemoryCardSys::CCardFileInfo::WriteBannerData(COutputStream& out) const { if (x3c_bannerTex.IsValid()) { const TLockedToken& tex = *x40_bannerTok; u32 bufSz; @@ -239,16 +239,16 @@ void CMemoryCardSys::CCardFileInfo::WriteBannerData(CMemoryOutStream& out) const std::unique_ptr texels = tex->BuildMemoryCardTex(bufSz, fmt, palette); if (fmt == ETexelFormat::RGB5A3) - out.writeBytes(texels.get(), 6144); + out.Write(texels.get(), 6144); else - out.writeBytes(texels.get(), 3072); + out.Write(texels.get(), 3072); if (fmt == ETexelFormat::C8) - out.writeBytes(palette.get(), 512); + out.Write(palette.get(), 512); } } -void CMemoryCardSys::CCardFileInfo::WriteIconData(CMemoryOutStream& out) const { +void CMemoryCardSys::CCardFileInfo::WriteIconData(COutputStream& out) const { std::unique_ptr palette; for (const Icon& icon : x50_iconToks) { u32 bufSz; @@ -256,12 +256,12 @@ void CMemoryCardSys::CCardFileInfo::WriteIconData(CMemoryOutStream& out) const { std::unique_ptr texels = icon.x8_tex->BuildMemoryCardTex(bufSz, fmt, palette); if (fmt == ETexelFormat::RGB5A3) - out.writeBytes(texels.get(), 2048); + out.Write(texels.get(), 2048); else - out.writeBytes(texels.get(), 1024); + out.Write(texels.get(), 1024); } if (palette) - out.writeBytes(palette.get(), 512); + out.Write(palette.get(), 512); } ECardResult CMemoryCardSys::CCardFileInfo::PumpCardTransfer() { diff --git a/Runtime/CMemoryCardSys.hpp b/Runtime/CMemoryCardSys.hpp index 6c99bf540..eec4cec22 100644 --- a/Runtime/CMemoryCardSys.hpp +++ b/Runtime/CMemoryCardSys.hpp @@ -6,11 +6,12 @@ #include #include "Runtime/CGameHintInfo.hpp" -#include "Runtime/CWorldSaveGameInfo.hpp" +#include "Runtime/CMemoryStreamOut.hpp" #include "Runtime/CToken.hpp" -#include "Runtime/rstl.hpp" +#include "Runtime/CWorldSaveGameInfo.hpp" #include "Runtime/GuiSys/CStringTable.hpp" #include "Runtime/World/CWorld.hpp" +#include "Runtime/rstl.hpp" #include @@ -137,13 +138,13 @@ public: void LockBannerToken(CAssetId bannerTxtr, CSimplePool& sp); void LockIconToken(CAssetId iconTxtr, kabufuda::EAnimationSpeed speed, CSimplePool& sp); - kabufuda::ECardSlot GetCardPort() const { return m_handle.slot; } - int GetFileNo() const { return m_handle.getFileNo(); } - u32 CalculateBannerDataSize() const; - u32 CalculateTotalDataSize() const; + [[nodiscard]] kabufuda::ECardSlot GetCardPort() const { return m_handle.slot; } + [[nodiscard]] int GetFileNo() const { return m_handle.getFileNo(); } + [[nodiscard]] u32 CalculateBannerDataSize() const; + [[nodiscard]] u32 CalculateTotalDataSize() const; void BuildCardBuffer(); - void WriteBannerData(CMemoryOutStream& out) const; - void WriteIconData(CMemoryOutStream& out) const; + void WriteBannerData(COutputStream& out) const; + void WriteIconData(COutputStream& out) const; void SetComment(const std::string& c) { x28_comment = c; } ECardResult PumpCardTransfer(); ECardResult GetStatus(CardStat& stat) const; @@ -151,9 +152,9 @@ public: ECardResult WriteFile(); ECardResult CloseFile(); - CMemoryOutStream BeginMemoryOut(u32 sz) { + CMemoryStreamOut BeginMemoryOut(u32 sz) { xf4_saveBuffer.resize(sz); - return CMemoryOutStream(xf4_saveBuffer.data(), sz); + return CMemoryStreamOut(xf4_saveBuffer.data(), sz, CMemoryStreamOut::EOwnerShip::NotOwned, sz); } }; diff --git a/Runtime/CMemoryInStream.hpp b/Runtime/CMemoryInStream.hpp new file mode 100644 index 000000000..3bb0e7ef1 --- /dev/null +++ b/Runtime/CMemoryInStream.hpp @@ -0,0 +1,19 @@ +#pragma once +#include "../../metaforce/Runtime/CInputStream.hpp" + +namespace metaforce { +class CMemoryInStream final : public CInputStream { +public: + enum class EOwnerShip { + NotOwned, + Owned, + }; + +public: + CMemoryInStream(const void* ptr, u32 len) : CInputStream(ptr, len, false) {} + CMemoryInStream(const void* ptr, u32 len, EOwnerShip ownership) + : CInputStream(ptr, len, ownership == EOwnerShip::Owned) {} + u32 Read(void* dest, u32 len) override { return 0; } +}; + +} // namespace metaforce \ No newline at end of file diff --git a/Runtime/CMemoryStreamOut.cpp b/Runtime/CMemoryStreamOut.cpp new file mode 100644 index 000000000..e20580dfc --- /dev/null +++ b/Runtime/CMemoryStreamOut.cpp @@ -0,0 +1,22 @@ +#include "CMemoryStreamOut.hpp" +#include + +namespace metaforce { +CMemoryStreamOut::~CMemoryStreamOut() { + Flush(); + + if (x88_owned) { + delete[] x7c_ptr; + } +} +void CMemoryStreamOut::Write(const u8* ptr, u32 len) { + const auto offset = (x80_len - x84_position); + if (offset < len) { + len = offset; + } + + if (len != 0) { + memcpy(x7c_ptr + x84_position, ptr, len); + } +} +} \ No newline at end of file diff --git a/Runtime/CMemoryStreamOut.hpp b/Runtime/CMemoryStreamOut.hpp new file mode 100644 index 000000000..88ef2d20a --- /dev/null +++ b/Runtime/CMemoryStreamOut.hpp @@ -0,0 +1,25 @@ +#pragma once +#include "Runtime/COutputStream.hpp" + +namespace metaforce { +class CMemoryStreamOut final : public COutputStream { +public: + enum class EOwnerShip { + NotOwned, + Owned, + }; +private: + u8* x7c_ptr = nullptr; + u32 x80_len = 0; + u32 x84_position = 0; + bool x88_owned; + +public: + CMemoryStreamOut(u8* workBuf, u32 len, EOwnerShip ownership = EOwnerShip::NotOwned, s32 unk = 4096) + : COutputStream(workBuf, unk), x7c_ptr(workBuf), x80_len(len), x88_owned(ownership == EOwnerShip::Owned) {} + + ~CMemoryStreamOut() override; + + void Write(const u8* ptr, u32 len) override; +}; +} // namespace metaforce \ No newline at end of file diff --git a/Runtime/COutputStream.cpp b/Runtime/COutputStream.cpp new file mode 100644 index 000000000..d1fe0798e --- /dev/null +++ b/Runtime/COutputStream.cpp @@ -0,0 +1,209 @@ +#include "COutputStream.hpp" + +#include "Runtime/CBasics.hpp" + +#include + +namespace metaforce { +static u32 min_containing_bytes(u32 v) { + v = 32 - v; + v = (v >> 3) - ((s32) - (v & 7) >> 31); + return v; +} + +COutputStream::COutputStream(u8* ptr, s32 len) : x8_bufLen(len) { + xc_ptr = len <= 64 ? reinterpret_cast(((reinterpret_cast(x1c_scratch) + 7) & ~7) + 6) : new u8[len]; +} + +COutputStream::~COutputStream() { + if (x8_bufLen < 64) { + delete[] xc_ptr; + } +} + +void COutputStream::DoFlush() { + if (x4_position != 0) { + Write(xc_ptr, x4_position); + x4_position = 0; + } +} + +void COutputStream::DoPut(const u8* ptr, u32 len) { + if (len == 0) { + return; + } + + x10_numWrites += len; + u32 offset = x4_position; + u32 curLen = len; + if (x8_bufLen < len + offset) { + while (curLen != 0) { + offset = x4_position; + u32 count = x8_bufLen - offset; + if (curLen < count) { + count = curLen; + } + if (count == 0) { + DoFlush(); + } else { + memcpy(xc_ptr + offset, ptr + (len - curLen), count); + curLen -= count; + } + } + } else { + memcpy(xc_ptr + offset, ptr, len); + x4_position += len; + } +} + +void COutputStream::FlushShiftRegister() { + if (x18_shiftRegisterOffset < 32) { +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + x14_shiftRegister = CBasics::SwapBytes(x14_shiftRegister); +#endif + DoPut(reinterpret_cast(&x14_shiftRegister), min_containing_bytes(x18_shiftRegisterOffset)); + x14_shiftRegister = 0; + x18_shiftRegisterOffset = 32; + } +} + +void COutputStream::Flush() { + FlushShiftRegister(); + DoFlush(); +} + +void COutputStream::Put(const u8* ptr, u32 len) { + FlushShiftRegister(); + DoPut(ptr, len); +} + +void COutputStream::WriteBits(u32 val, u32 bitCount) { + const u32 bitOffset = x18_shiftRegisterOffset; + if (x18_shiftRegisterOffset < bitCount) { + /* OR remaining bits to cached value */ + const u32 shiftAmt = (bitCount - x18_shiftRegisterOffset); + const u32 mask = bitOffset == 32 ? -1 : (1 << bitOffset) - 1; + + /* Write out 32-bits */ + x14_shiftRegister |= (val >> shiftAmt) & mask; + x18_shiftRegisterOffset = 0; + FlushShiftRegister(); + + /* Cache remaining bits */ + x14_shiftRegister = (val & (shiftAmt == 32 ? -1 : (1 << shiftAmt) - 1)) << (32 - shiftAmt); + x18_shiftRegisterOffset -= shiftAmt; + } else { + /* OR bits to cached value */ + const u32 mask = bitOffset == 0x20 ? -1 : (1 << bitOffset) - 1; + x14_shiftRegister |= (val & mask) << (bitOffset - bitCount); + /* New bit offset */ + x18_shiftRegisterOffset -= bitCount; + } +} + +void COutputStream::WriteChar(u8 c) { + FlushShiftRegister(); + if (x8_bufLen <= x4_position) { + DoFlush(); + } + ++x10_numWrites; + *reinterpret_cast(xc_ptr + x4_position) = c; + ++x4_position; +} +void COutputStream::WriteShort(u16 s) { +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + s = CBasics::SwapBytes(s); +#endif + Put(reinterpret_cast(&s), sizeof(s)); +} +void COutputStream::WriteLong(u32 l) { +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + l = CBasics::SwapBytes(l); +#endif + Put(reinterpret_cast(&l), sizeof(l)); +} +void COutputStream::WriteLongLong(u64 ll) { +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + ll = CBasics::SwapBytes(ll); +#endif + Put(reinterpret_cast(&ll), sizeof(ll)); +} +void COutputStream::WriteFloat(float f) { +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + f = CBasics::SwapBytes(f); +#endif + Put(reinterpret_cast(&f), sizeof(f)); +} + +void COutputStream::WriteDouble(double d) { +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ + d = CBasics::SwapBytes(d); +#endif + Put(reinterpret_cast(&d), sizeof(d)); +} + +/* Default Stream Helpers */ +template <> +void coutput_stream_helper(const bool& t, COutputStream& out) { + out.WriteChar(static_cast(t)); +} +template <> +void coutput_stream_helper(const char& t, COutputStream& out) { + out.WriteChar(static_cast(t)); +} +template <> +void coutput_stream_helper(const s8& t, COutputStream& out) { + out.WriteChar(t); +} +template <> +void coutput_stream_helper(const u8& t, COutputStream& out) { + out.WriteChar(t); +} +template <> +void coutput_stream_helper(const s16& t, COutputStream& out) { + out.WriteShort(t); +} +template <> +void coutput_stream_helper(const u16& t, COutputStream& out) { + out.WriteShort(t); +} +template <> +void coutput_stream_helper(const s32& t, COutputStream& out) { + out.WriteLong(t); +} +template <> +void coutput_stream_helper(const u32& t, COutputStream& out) { + out.WriteLong(t); +} +template <> +void coutput_stream_helper(const s64& t, COutputStream& out) { + out.WriteLongLong(t); +} +template <> +void coutput_stream_helper(const u64& t, COutputStream& out) { + out.WriteLongLong(t); +} +template <> +void coutput_stream_helper(const float& t, COutputStream& out) { + out.WriteFloat(t); +} +template <> +void coutput_stream_helper(const double& t, COutputStream& out) { + out.WriteDouble(t); +} +template <> +void coutput_stream_helper(const std::string& t, COutputStream& out) { + for (size_t i = 0; i < t.size() + 1; ++i) { + out.FlushShiftRegister(); + out.Put(t[i]); + } +} + +u32 COutputStream::GetBitCount(u32 val) { + int bits = 0; + for (; val != 0; val >>= 1) { + bits += 1; + } + return bits; +} +} // namespace metaforce diff --git a/Runtime/COutputStream.hpp b/Runtime/COutputStream.hpp new file mode 100644 index 000000000..47dbb9026 --- /dev/null +++ b/Runtime/COutputStream.hpp @@ -0,0 +1,88 @@ +#pragma once +#include "Runtime/GCNTypes.hpp" + +#include +#include + +namespace metaforce { +class COutputStream { + friend class coutput_stream_helper; + u32 x4_position = 0; + u32 x8_bufLen = 0; + u8* xc_ptr = nullptr; + u32 x10_numWrites = 0; + u32 x14_shiftRegister = 0; + u32 x18_shiftRegisterOffset = 32; + u8 x1c_scratch[96]{}; + +protected: + + void DoFlush(); + void DoPut(const u8* ptr, u32 len); +public: + COutputStream(u8* ptr, s32 unk); + virtual ~COutputStream(); + virtual void Write(const u8* ptr, u32 len) = 0; + + void WriteBits(u32 val, u32 bitCount); + void WriteChar(u8 c); + void WriteShort(u16 s); + void WriteLong(u32 l); + void WriteLongLong(u64 ll); + void WriteFloat(float f); + void WriteDouble(double d); + + void WriteInt8(s8 c) { Put(c); } + void WriteUint8(u8 c) { Put(c); } + void WriteInt16(s16 s) { Put(s); } + void WriteUint16(u16 s) { Put(s); } + void WriteInt32(s32 l) { Put(l); } + void WriteUint32(u32 l) { Put(l); } + void WriteInt64(u64 ll) { Put(ll); } + void WriteUint64(u64 ll) { Put(ll); } + void WriteReal32(float f) { Put(f); } + void WriteReal64(double d) { Put(d); } + + void FlushShiftRegister(); + void Flush(); + void Put(const u8* ptr, u32 len); + template + void Put(const T& t) { + coutput_stream_helper(t, *this); + } + + static u32 GetBitCount(u32 val); +}; + +template +void coutput_stream_helper(const T& t, COutputStream& out) { + t.PutTo(out); +} + +template <> +void coutput_stream_helper(const bool& t, COutputStream& out); +template <> +void coutput_stream_helper(const char& t, COutputStream& out); +template <> +void coutput_stream_helper(const s8& t, COutputStream& out); +template <> +void coutput_stream_helper(const u8& t, COutputStream& out); +template <> +void coutput_stream_helper(const s16& t, COutputStream& out); +template <> +void coutput_stream_helper(const u16& t, COutputStream& out); +template <> +void coutput_stream_helper(const s32& t, COutputStream& out); +template <> +void coutput_stream_helper(const u32& t, COutputStream& out); +template <> +void coutput_stream_helper(const s64& t, COutputStream& out); +template <> +void coutput_stream_helper(const u64& t, COutputStream& out); +template <> +void coutput_stream_helper(const float& t, COutputStream& out); +template <> +void coutput_stream_helper(const double& t, COutputStream& out); +template <> +void coutput_stream_helper(const std::string& t, COutputStream& out); +} diff --git a/Runtime/CPakFile.cpp b/Runtime/CPakFile.cpp index 3555ceffa..068d804df 100644 --- a/Runtime/CPakFile.cpp +++ b/Runtime/CPakFile.cpp @@ -26,19 +26,19 @@ const SObjectTag* CPakFile::GetResIdByName(std::string_view name) const { return nullptr; } -void CPakFile::LoadResourceTable(athena::io::MemoryReader& r) { +void CPakFile::LoadResourceTable(CInputStream& r) { x74_resList.reserve( std::max(size_t(64), size_t(ROUND_UP_32(x4c_resTableCount * sizeof(SResInfo)) + sizeof(SResInfo) - 1)) / sizeof(SResInfo)); if (x28_24_buildDepList) x64_depList.reserve(x4c_resTableCount); for (u32 i = 0; i < x4c_resTableCount; ++i) { - u32 flags = r.readUint32Big(); + u32 flags = r.ReadLong(); FourCC fcc; - r.readBytesToBuf(&fcc, 4); - CAssetId id = r.readUint32Big(); - u32 size = r.readUint32Big(); - u32 offset = r.readUint32Big(); + r.ReadBytes(reinterpret_cast(&fcc), 4); + CAssetId id = r.ReadLong(); + u32 size = r.ReadLong(); + u32 offset = r.ReadLong(); if (fcc == FOURCC('MLVL')) m_mlvlId = id; x74_resList.emplace_back(id, fcc, offset, size, flags); @@ -50,7 +50,8 @@ void CPakFile::LoadResourceTable(athena::io::MemoryReader& r) { void CPakFile::DataLoad() { x30_dvdReq.reset(); - athena::io::MemoryReader r(x38_headerData.data() + x48_resTableOffset, x38_headerData.size() - x48_resTableOffset); + CMemoryInStream r(x38_headerData.data() + x48_resTableOffset, x38_headerData.size() - x48_resTableOffset, + CMemoryInStream::EOwnerShip::NotOwned); LoadResourceTable(r); x2c_asyncLoadPhase = EAsyncPhase::Loaded; if (x28_26_worldPak) { @@ -60,9 +61,9 @@ void CPakFile::DataLoad() { } void CPakFile::InitialHeaderLoad() { - athena::io::MemoryReader r(x38_headerData.data(), x38_headerData.size()); + CMemoryInStream r(x38_headerData.data(), x38_headerData.size(), CMemoryInStream::EOwnerShip::NotOwned); x30_dvdReq.reset(); - u32 version = r.readUint32Big(); + u32 version = r.ReadLong(); if (version != 0x00030005) { Log.report(logvisor::Fatal, FMT_STRING("{}: Incompatible pak file version -- Current version is {:08X}, you're using {:08X}"), @@ -70,18 +71,17 @@ void CPakFile::InitialHeaderLoad() { return; } - r.readUint32Big(); - u32 nameCount = r.readUint32Big(); + r.ReadLong(); + u32 nameCount = r.ReadLong(); x54_nameList.reserve(nameCount); for (u32 i = 0; i < nameCount; ++i) { SObjectTag tag(r); - u32 nameLen = r.readUint32Big(); - auto name = r.readString(nameLen); + auto name = CStringExtras::ReadString(r); x54_nameList.emplace_back(name, tag); } - x4c_resTableCount = r.readUint32Big(); - x48_resTableOffset = u32(r.position()); + x4c_resTableCount = r.ReadLong(); + x48_resTableOffset = u32(r.GetReadPosition()); x2c_asyncLoadPhase = EAsyncPhase::DataLoad; u32 newSize = ROUND_UP_32(x4c_resTableCount * 20 + x48_resTableOffset); u32 origSize = u32(x38_headerData.size()); diff --git a/Runtime/CPakFile.hpp b/Runtime/CPakFile.hpp index a0804e076..01119b1d7 100644 --- a/Runtime/CPakFile.hpp +++ b/Runtime/CPakFile.hpp @@ -57,7 +57,7 @@ private: std::vector x74_resList; mutable s32 x84_currentSeek = -1; CAssetId m_mlvlId; - void LoadResourceTable(athena::io::MemoryReader& r); + void LoadResourceTable(CInputStream& r); void DataLoad(); void InitialHeaderLoad(); void Warmup(); diff --git a/Runtime/CPlayerState.cpp b/Runtime/CPlayerState.cpp index 2f263e1d6..667e470e6 100644 --- a/Runtime/CPlayerState.cpp +++ b/Runtime/CPlayerState.cpp @@ -76,63 +76,63 @@ constexpr std::array ComboAmmoPeriods{ CPlayerState::CPlayerState() { x24_powerups.resize(41); } -CPlayerState::CPlayerState(CBitStreamReader& stream) { - x4_enabledItems = u32(stream.ReadEncoded(32)); +CPlayerState::CPlayerState(CInputStream& stream) { + x4_enabledItems = u32(stream.ReadBits(32)); - const u32 integralHP = u32(stream.ReadEncoded(32)); + const u32 integralHP = u32(stream.ReadBits(32)); float realHP; std::memcpy(&realHP, &integralHP, sizeof(float)); xc_health.SetHP(realHP); - x8_currentBeam = EBeamId(stream.ReadEncoded(CBitStreamReader::GetBitCount(5))); - x20_currentSuit = EPlayerSuit(stream.ReadEncoded(CBitStreamReader::GetBitCount(4))); + x8_currentBeam = EBeamId(stream.ReadBits(CInputStream::GetBitCount(5))); + x20_currentSuit = EPlayerSuit(stream.ReadBits(CInputStream::GetBitCount(4))); x24_powerups.resize(41); for (size_t i = 0; i < x24_powerups.size(); ++i) { if (PowerUpMaxValues[i] == 0) { continue; } - const u32 a = u32(stream.ReadEncoded(CBitStreamReader::GetBitCount(PowerUpMaxValues[i]))); - const u32 b = u32(stream.ReadEncoded(CBitStreamReader::GetBitCount(PowerUpMaxValues[i]))); + const u32 a = u32(stream.ReadBits(CInputStream::GetBitCount(PowerUpMaxValues[i]))); + const u32 b = u32(stream.ReadBits(CInputStream::GetBitCount(PowerUpMaxValues[i]))); x24_powerups[i] = CPowerUp(a, b); } const auto& scanStates = g_MemoryCardSys->GetScanStates(); x170_scanTimes.reserve(scanStates.size()); for (const auto& state : scanStates) { - float time = stream.ReadEncoded(1) ? 1.f : 0.f; + float time = stream.ReadBits(1) ? 1.f : 0.f; x170_scanTimes.emplace_back(state.first, time); } - x180_scanCompletionRate.first = u32(stream.ReadEncoded(CBitStreamReader::GetBitCount(0x100u))); - x180_scanCompletionRate.second = u32(stream.ReadEncoded(CBitStreamReader::GetBitCount(0x100u))); + x180_scanCompletionRate.first = u32(stream.ReadBits(CInputStream::GetBitCount(0x100u))); + x180_scanCompletionRate.second = u32(stream.ReadBits(CInputStream::GetBitCount(0x100u))); } -void CPlayerState::PutTo(CBitStreamWriter& stream) { - stream.WriteEncoded(x4_enabledItems, 32); +void CPlayerState::PutTo(COutputStream& stream) { + stream.WriteBits(x4_enabledItems, 32); const float realHP = xc_health.GetHP(); u32 integralHP; std::memcpy(&integralHP, &realHP, sizeof(u32)); - stream.WriteEncoded(integralHP, 32); - stream.WriteEncoded(u32(x8_currentBeam), CBitStreamWriter::GetBitCount(5)); - stream.WriteEncoded(u32(x20_currentSuit), CBitStreamWriter::GetBitCount(4)); + stream.WriteBits(integralHP, 32); + stream.WriteBits(u32(x8_currentBeam), COutputStream::GetBitCount(5)); + stream.WriteBits(u32(x20_currentSuit), COutputStream::GetBitCount(4)); for (size_t i = 0; i < x24_powerups.size(); ++i) { const CPowerUp& pup = x24_powerups[i]; - stream.WriteEncoded(pup.x0_amount, CBitStreamWriter::GetBitCount(PowerUpMaxValues[i])); - stream.WriteEncoded(pup.x4_capacity, CBitStreamWriter::GetBitCount(PowerUpMaxValues[i])); + stream.WriteBits(pup.x0_amount, COutputStream::GetBitCount(PowerUpMaxValues[i])); + stream.WriteBits(pup.x4_capacity, COutputStream::GetBitCount(PowerUpMaxValues[i])); } for (const auto& scanTime : x170_scanTimes) { if (scanTime.second >= 1.f) - stream.WriteEncoded(true, 1); + stream.WriteBits(true, 1); else - stream.WriteEncoded(false, 1); + stream.WriteBits(false, 1); } - stream.WriteEncoded(x180_scanCompletionRate.first, CBitStreamWriter::GetBitCount(0x100)); - stream.WriteEncoded(x180_scanCompletionRate.second, CBitStreamWriter::GetBitCount(0x100)); + stream.WriteBits(x180_scanCompletionRate.first, COutputStream::GetBitCount(0x100)); + stream.WriteBits(x180_scanCompletionRate.second, COutputStream::GetBitCount(0x100)); } u32 CPlayerState::GetMissileCostForAltAttack() const { return costs[size_t(x8_currentBeam)]; } diff --git a/Runtime/CPlayerState.hpp b/Runtime/CPlayerState.hpp index 72ae5b136..db9ce26b1 100644 --- a/Runtime/CPlayerState.hpp +++ b/Runtime/CPlayerState.hpp @@ -164,8 +164,8 @@ public: CStaticInterference& GetStaticInterference() { return x188_staticIntf; } const std::vector>& GetScanTimes() const { return x170_scanTimes; } CPlayerState(); - explicit CPlayerState(CBitStreamReader& stream); - void PutTo(CBitStreamWriter& stream); + explicit CPlayerState(CInputStream& stream); + void PutTo(COutputStream& stream); static u32 GetPowerUpMaxValue(EItemType type); static EItemType ItemNameToType(std::string_view name); static std::string_view ItemTypeToName(EItemType type); diff --git a/Runtime/CResLoader.cpp b/Runtime/CResLoader.cpp index 3a30bee4a..99a1b1d9d 100644 --- a/Runtime/CResLoader.cpp +++ b/Runtime/CResLoader.cpp @@ -44,7 +44,8 @@ std::unique_ptr CResLoader::LoadNewResourcePartSync(const SObjectT CPakFile* const file = FindResourceForLoad(tag); file->SyncSeekRead(buf, length, ESeekOrigin::Begin, x50_cachedResInfo->GetOffset() + offset); - return std::make_unique(buf, length, !extBuf); + return std::make_unique( + buf, length, extBuf == nullptr ? CMemoryInStream::EOwnerShip::Owned : CMemoryInStream::EOwnerShip::NotOwned); } void CResLoader::LoadMemResourceSync(const SObjectTag& tag, std::unique_ptr& bufOut, int* sizeOut) { @@ -57,9 +58,10 @@ void CResLoader::LoadMemResourceSync(const SObjectTag& tag, std::unique_ptr CResLoader::LoadResourceFromMemorySync(const SObjectTag& tag, const void* buf) { FindResourceForLoad(tag); - std::unique_ptr newStrm = std::make_unique(buf, x50_cachedResInfo->GetSize()); + std::unique_ptr newStrm = + std::make_unique(buf, x50_cachedResInfo->GetSize(), CMemoryInStream::EOwnerShip::NotOwned); if (x50_cachedResInfo->IsCompressed()) { - newStrm->readUint32Big(); + newStrm->ReadLong(); newStrm = std::make_unique(std::move(newStrm)); } return newStrm; @@ -77,9 +79,10 @@ std::unique_ptr CResLoader::LoadNewResourceSync(const SObjectTag& file->SyncSeekRead(buf, resSz, ESeekOrigin::Begin, x50_cachedResInfo->GetOffset()); const bool takeOwnership = extBuf == nullptr; - std::unique_ptr newStrm = std::make_unique(buf, resSz, takeOwnership); + std::unique_ptr newStrm = std::make_unique( + buf, resSz, takeOwnership ? CMemoryInStream::EOwnerShip::Owned : CMemoryInStream::EOwnerShip::NotOwned); if (x50_cachedResInfo->IsCompressed()) { - newStrm->readUint32Big(); + newStrm->ReadLong(); newStrm = std::make_unique(std::move(newStrm)); } diff --git a/Runtime/CScannableObjectInfo.cpp b/Runtime/CScannableObjectInfo.cpp index d950522fc..838fe5a48 100644 --- a/Runtime/CScannableObjectInfo.cpp +++ b/Runtime/CScannableObjectInfo.cpp @@ -4,7 +4,7 @@ namespace metaforce { CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, CAssetId resId) : x0_scannableObjectId(resId) { - const u32 version = in.readUint32Big(); + const u32 version = in.ReadLong(); Load(in, version); for (auto& bucket : x14_buckets) { @@ -33,18 +33,18 @@ CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, CAssetId resId) : x } void CScannableObjectInfo::Load(CInputStream& in, u32 version) { - in.readUint32Big(); - in.readUint32Big(); - x4_stringId = in.readUint32Big(); + in.ReadLong(); + in.ReadLong(); + x4_stringId = in.ReadLong(); if (version < 4) { - x8_totalDownloadTime = in.readFloatBig(); + x8_totalDownloadTime = in.ReadFloat(); } else { - const u32 scanSpeed = in.readUint32Big(); + const u32 scanSpeed = in.ReadLong(); x8_totalDownloadTime = g_tweakGui->GetScanSpeed(scanSpeed); } - xc_category = in.readUint32Big(); + xc_category = in.ReadLong(); if (version > 4) { - x10_important = in.readBool(); + x10_important = in.ReadBool(); } for (size_t i = 0; i < x14_buckets.capacity(); i++) { @@ -53,15 +53,15 @@ void CScannableObjectInfo::Load(CInputStream& in, u32 version) { } CScannableObjectInfo::SBucket::SBucket(CInputStream& in, u32 version) { - x0_texture = in.readUint32Big(); - x4_appearanceRange = in.readFloatBig(); - x8_imagePos = in.readUint32Big(); + x0_texture = in.ReadLong(); + x4_appearanceRange = in.ReadFloat(); + x8_imagePos = in.ReadLong(); if (version > 1) { - xc_size.x = in.readUint32Big(); - xc_size.y = in.readUint32Big(); - x14_interval = in.readFloatBig(); + xc_size.x = in.ReadLong(); + xc_size.y = in.ReadLong(); + x14_interval = in.ReadFloat(); if (version >= 3) - x18_fadeDuration = in.readFloatBig(); + x18_fadeDuration = in.ReadFloat(); } } diff --git a/Runtime/CScriptMailbox.cpp b/Runtime/CScriptMailbox.cpp index 2f6b10dde..a6b64edb8 100644 --- a/Runtime/CScriptMailbox.cpp +++ b/Runtime/CScriptMailbox.cpp @@ -8,12 +8,12 @@ namespace metaforce { -CScriptMailbox::CScriptMailbox(CBitStreamReader& in, const CWorldSaveGameInfo& saveWorld) { +CScriptMailbox::CScriptMailbox(CInputStream& in, const CWorldSaveGameInfo& saveWorld) { const u32 relayCount = saveWorld.GetRelayCount(); if (saveWorld.GetRelayCount()) { std::vector relayStates(saveWorld.GetRelayCount()); for (u32 i = 0; i < relayCount; ++i) { - relayStates[i] = in.ReadEncoded(1); + relayStates[i] = in.ReadBits(1); } for (u32 i = 0; i < relayCount; ++i) { @@ -79,7 +79,7 @@ void CScriptMailbox::SendMsgs(TAreaId areaId, CStateManager& stateMgr) { } } -void CScriptMailbox::PutTo(CBitStreamWriter& out, const CWorldSaveGameInfo& saveWorld) { +void CScriptMailbox::PutTo(COutputStream& out, const CWorldSaveGameInfo& saveWorld) { const u32 relayCount = saveWorld.GetRelayCount(); std::vector relays(relayCount); @@ -91,7 +91,7 @@ void CScriptMailbox::PutTo(CBitStreamWriter& out, const CWorldSaveGameInfo& save } for (u32 i = 0; i < relayCount; ++i) { - out.WriteEncoded(u32(relays[i]), 1); + out.WriteBits(u32(relays[i]), 1); } } diff --git a/Runtime/CScriptMailbox.hpp b/Runtime/CScriptMailbox.hpp index a8fac0dbc..db02b3078 100644 --- a/Runtime/CScriptMailbox.hpp +++ b/Runtime/CScriptMailbox.hpp @@ -29,13 +29,13 @@ class CScriptMailbox { public: CScriptMailbox() = default; - CScriptMailbox(CBitStreamReader& in, const CWorldSaveGameInfo& saveWorld); + CScriptMailbox(CInputStream& in, const CWorldSaveGameInfo& saveWorld); bool HasMsg(TEditorId id) const; void AddMsg(TEditorId id); void RemoveMsg(TEditorId id); void SendMsgs(TAreaId areaId, CStateManager& stateMgr); - void PutTo(CBitStreamWriter& out, const CWorldSaveGameInfo& saveWorld); + void PutTo(COutputStream& out, const CWorldSaveGameInfo& saveWorld); }; } // namespace metaforce diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 56ab6ec29..670b8d3be 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -439,7 +439,7 @@ void CStateManager::SetupParticleHook(const CActor& actor) const { void CStateManager::MurderScriptInstanceNames() { xb40_uniqueInstanceNames.clear(); } -std::string CStateManager::HashInstanceName(CInputStream& in) { return in.readString(); } +std::string CStateManager::HashInstanceName(CInputStream& in) { return in.Get(); } void CStateManager::SetActorAreaId(CActor& actor, TAreaId aid) { const TAreaId actorAid = actor.GetAreaIdAlways(); @@ -985,90 +985,90 @@ void CStateManager::DrawWorld() { } void CStateManager::DrawActorCubeFaces(CActor& actor, int& cubeInst) const { -// if (!actor.m_reflectionCube || -// (!TCastToPtr(actor) && (!actor.GetActive() || !actor.IsDrawEnabled() || actor.xe4_30_outOfFrustum))) -// return; -// -// const TAreaId visAreaId = actor.GetAreaIdAlways(); -// const SViewport backupVp = g_Viewport; -// -// int areaCount = 0; -// std::array areaArr; -// for (const CGameArea& area : *x850_world) { -// if (areaCount == 10) { -// break; -// } -// auto occState = CGameArea::EOcclusionState::Occluded; -// if (area.IsPostConstructed()) { -// occState = area.GetOcclusionState(); -// } -// if (occState == CGameArea::EOcclusionState::Visible) { -// areaArr[areaCount++] = &area; -// } -// } -// -// for (int f = 0; f < 6; ++f) { -// SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CStateManager::DrawActorCubeFaces [{}] {} {} {}"), f, -// actor.GetUniqueId(), actor.GetEditorId(), actor.GetName()) -// .c_str(), -// zeus::skOrange); -// CGraphics::g_BooMainCommandQueue->setRenderTarget(actor.m_reflectionCube, f); -// SetupViewForCubeFaceDraw(actor.GetRenderBounds().center(), f); -// CGraphics::g_BooMainCommandQueue->clearTarget(); -// -// std::sort(areaArr.begin(), areaArr.begin() + areaCount, [visAreaId](const CGameArea* a, const CGameArea* b) { -// if (a->x4_selfIdx == b->x4_selfIdx) { -// return false; -// } -// if (visAreaId == a->x4_selfIdx) { -// return false; -// } -// if (visAreaId == b->x4_selfIdx) { -// return true; -// } -// return CGraphics::g_ViewPoint.dot(a->GetAABB().center()) > CGraphics::g_ViewPoint.dot(b->GetAABB().center()); -// }); -// -// int pvsCount = 0; -// std::array pvsArr; -// for (auto area = areaArr.cbegin(); area != areaArr.cbegin() + areaCount; ++area) { -// const CGameArea* areaPtr = *area; -// CPVSVisSet& pvsSet = pvsArr[pvsCount++]; -// pvsSet.Reset(EPVSVisSetState::OutOfBounds); -// GetVisSetForArea(areaPtr->x4_selfIdx, visAreaId, pvsSet); -// } -// -// for (int i = areaCount - 1; i >= 0; --i) { -// const CGameArea& area = *areaArr[i]; -// SetupFogForArea(area); -// g_Renderer->EnablePVS(pvsArr[i], area.x4_selfIdx); -// g_Renderer->SetWorldLightFadeLevel(area.GetPostConstructed()->x1128_worldLightingLevel); -// g_Renderer->UpdateAreaUniforms(area.x4_selfIdx, EWorldShadowMode::None, true, cubeInst * 6 + f); -// g_Renderer->DrawUnsortedGeometry(area.x4_selfIdx, 0x2, 0x0); -// } -// -// if (!SetupFogForDraw()) { -// g_Renderer->SetWorldFog(ERglFogMode::None, 0.f, 1.f, zeus::skBlack); -// } -// -// x850_world->DrawSky(zeus::CTransform::Translate(CGraphics::g_ViewPoint)); -// -// for (int i = 0; i < areaCount; ++i) { -// const CGameArea& area = *areaArr[i]; -// CPVSVisSet& pvs = pvsArr[i]; -// SetupFogForArea(area); -// g_Renderer->SetWorldLightFadeLevel(area.GetPostConstructed()->x1128_worldLightingLevel); -// g_Renderer->EnablePVS(pvs, area.x4_selfIdx); -// g_Renderer->DrawSortedGeometry(area.x4_selfIdx, 0x2, 0x0); -// } -// } -// -// CGraphics::g_BooMainCommandQueue->generateMipmaps(actor.m_reflectionCube); -// -// CBooRenderer::BindMainDrawTarget(); -// g_Renderer->SetViewport(backupVp.x0_left, backupVp.x4_top, backupVp.x8_width, backupVp.xc_height); -// -// ++cubeInst; + // if (!actor.m_reflectionCube || + // (!TCastToPtr(actor) && (!actor.GetActive() || !actor.IsDrawEnabled() || actor.xe4_30_outOfFrustum))) + // return; + // + // const TAreaId visAreaId = actor.GetAreaIdAlways(); + // const SViewport backupVp = g_Viewport; + // + // int areaCount = 0; + // std::array areaArr; + // for (const CGameArea& area : *x850_world) { + // if (areaCount == 10) { + // break; + // } + // auto occState = CGameArea::EOcclusionState::Occluded; + // if (area.IsPostConstructed()) { + // occState = area.GetOcclusionState(); + // } + // if (occState == CGameArea::EOcclusionState::Visible) { + // areaArr[areaCount++] = &area; + // } + // } + // + // for (int f = 0; f < 6; ++f) { + // SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CStateManager::DrawActorCubeFaces [{}] {} {} {}"), f, + // actor.GetUniqueId(), actor.GetEditorId(), actor.GetName()) + // .c_str(), + // zeus::skOrange); + // CGraphics::g_BooMainCommandQueue->setRenderTarget(actor.m_reflectionCube, f); + // SetupViewForCubeFaceDraw(actor.GetRenderBounds().center(), f); + // CGraphics::g_BooMainCommandQueue->clearTarget(); + // + // std::sort(areaArr.begin(), areaArr.begin() + areaCount, [visAreaId](const CGameArea* a, const CGameArea* b) { + // if (a->x4_selfIdx == b->x4_selfIdx) { + // return false; + // } + // if (visAreaId == a->x4_selfIdx) { + // return false; + // } + // if (visAreaId == b->x4_selfIdx) { + // return true; + // } + // return CGraphics::g_ViewPoint.dot(a->GetAABB().center()) > CGraphics::g_ViewPoint.dot(b->GetAABB().center()); + // }); + // + // int pvsCount = 0; + // std::array pvsArr; + // for (auto area = areaArr.cbegin(); area != areaArr.cbegin() + areaCount; ++area) { + // const CGameArea* areaPtr = *area; + // CPVSVisSet& pvsSet = pvsArr[pvsCount++]; + // pvsSet.Reset(EPVSVisSetState::OutOfBounds); + // GetVisSetForArea(areaPtr->x4_selfIdx, visAreaId, pvsSet); + // } + // + // for (int i = areaCount - 1; i >= 0; --i) { + // const CGameArea& area = *areaArr[i]; + // SetupFogForArea(area); + // g_Renderer->EnablePVS(pvsArr[i], area.x4_selfIdx); + // g_Renderer->SetWorldLightFadeLevel(area.GetPostConstructed()->x1128_worldLightingLevel); + // g_Renderer->UpdateAreaUniforms(area.x4_selfIdx, EWorldShadowMode::None, true, cubeInst * 6 + f); + // g_Renderer->DrawUnsortedGeometry(area.x4_selfIdx, 0x2, 0x0); + // } + // + // if (!SetupFogForDraw()) { + // g_Renderer->SetWorldFog(ERglFogMode::None, 0.f, 1.f, zeus::skBlack); + // } + // + // x850_world->DrawSky(zeus::CTransform::Translate(CGraphics::g_ViewPoint)); + // + // for (int i = 0; i < areaCount; ++i) { + // const CGameArea& area = *areaArr[i]; + // CPVSVisSet& pvs = pvsArr[i]; + // SetupFogForArea(area); + // g_Renderer->SetWorldLightFadeLevel(area.GetPostConstructed()->x1128_worldLightingLevel); + // g_Renderer->EnablePVS(pvs, area.x4_selfIdx); + // g_Renderer->DrawSortedGeometry(area.x4_selfIdx, 0x2, 0x0); + // } + // } + // + // CGraphics::g_BooMainCommandQueue->generateMipmaps(actor.m_reflectionCube); + // + // CBooRenderer::BindMainDrawTarget(); + // g_Renderer->SetViewport(backupVp.x0_left, backupVp.x4_top, backupVp.x8_width, backupVp.xc_height); + // + // ++cubeInst; } void CStateManager::DrawWorldCubeFaces() const { @@ -1470,14 +1470,14 @@ CStateManager::GetIdListForScript(TEditorId id) const { } void CStateManager::LoadScriptObjects(TAreaId aid, CInputStream& in, std::vector& idsOut) { - in.readUByte(); + in.ReadUint8(); - const u32 objCount = in.readUint32Big(); + const u32 objCount = in.ReadLong(); idsOut.reserve(idsOut.size() + objCount); for (u32 i = 0; i < objCount; ++i) { - const auto objType = static_cast(in.readUByte()); - const u32 objSize = in.readUint32Big(); - const u32 pos = static_cast(in.position()); + const auto objType = static_cast(in.ReadUint8()); + const u32 objSize = in.ReadLong(); + const u32 pos = static_cast(in.GetReadPosition()); const auto id = LoadScriptObject(aid, objType, objSize, in); if (id.first == kInvalidEditorId) { continue; @@ -1502,15 +1502,15 @@ void CStateManager::LoadScriptObjects(TAreaId aid, CInputStream& in, std::vector std::pair CStateManager::LoadScriptObject(TAreaId aid, EScriptObjectType type, u32 length, CInputStream& in) { OPTICK_EVENT(); - const TEditorId id = in.readUint32Big(); - const u32 connCount = in.readUint32Big(); + const TEditorId id = in.ReadLong(); + const u32 connCount = in.ReadLong(); length -= 8; std::vector conns; conns.reserve(connCount); for (u32 i = 0; i < connCount; ++i) { - const auto state = EScriptObjectState(in.readUint32Big()); - const auto msg = EScriptObjectMessage(in.readUint32Big()); - const TEditorId target = in.readUint32Big(); + const auto state = EScriptObjectState(in.ReadLong()); + const auto msg = EScriptObjectMessage(in.ReadLong()); + const TEditorId target = in.ReadLong(); // Metaforce Addition if (m_incomingConnections.find(target) == m_incomingConnections.cend()) { m_incomingConnections.emplace(target, std::set()); @@ -1521,9 +1521,9 @@ std::pair CStateManager::LoadScriptObject(TAreaId aid, ESc length -= 12; conns.push_back(SConnection{state, msg, target}); } - const u32 propCount = in.readUint32Big(); + const u32 propCount = in.ReadLong(); length -= 4; - const auto startPos = in.position(); + const auto startPos = in.GetReadPosition(); bool error = false; FScriptLoader loader = {}; @@ -1545,7 +1545,7 @@ std::pair CStateManager::LoadScriptObject(TAreaId aid, ESc error = true; } - const u32 readAmt = in.position() - startPos; + const u32 readAmt = in.GetReadPosition() - startPos; if (readAmt > length) { LogModule.report(logvisor::Fatal, FMT_STRING("Script object overread while reading {}"), ScriptObjectTypeToStr(type)); @@ -1553,13 +1553,17 @@ std::pair CStateManager::LoadScriptObject(TAreaId aid, ESc const u32 leftover = length - readAmt; for (u32 i = 0; i < leftover; ++i) { - in.readByte(); + in.ReadChar(); } if (error || ent == nullptr) { - in.seek(startPos, athena::SeekOrigin::Begin); + while (in.GetReadPosition() != startPos) { + in.ReadChar(); + } const std::string name = HashInstanceName(in); - in.seek(startPos + length, athena::SeekOrigin::Begin); + while (in.GetReadPosition() != startPos + length) { + in.ReadChar(); + } LogModule.report(logvisor::Error, FMT_STRING("Script load error while loading {}, name: {}"), ScriptObjectTypeToStr(type), name); return {kInvalidEditorId, kInvalidUniqueId}; diff --git a/Runtime/CStringExtras.cpp b/Runtime/CStringExtras.cpp new file mode 100644 index 000000000..6d50ab1b0 --- /dev/null +++ b/Runtime/CStringExtras.cpp @@ -0,0 +1,21 @@ +#include "Runtime/CStringExtras.hpp" +#include "Runtime/CInputStream.hpp" + +namespace metaforce { +std::string CStringExtras::ReadString(CInputStream& in) { + u32 strLen = in.ReadLong(); + std::string ret; + u32 readLen = 512; + char tmp[512] = {}; + for (; strLen > 0; strLen -= readLen) { + readLen = 512; + if (strLen <= 512) { + readLen = strLen; + } + in.ReadBytes(tmp, readLen); + ret.append(tmp, readLen); + } + + return ret; +} +} \ No newline at end of file diff --git a/Runtime/CStringExtras.hpp b/Runtime/CStringExtras.hpp index 96bb9ba3a..03a295cf1 100644 --- a/Runtime/CStringExtras.hpp +++ b/Runtime/CStringExtras.hpp @@ -5,7 +5,7 @@ #include namespace metaforce { - +class CInputStream; class CStringExtras { public: // Checks if the provided views into string data can be considered equal or not based on @@ -35,6 +35,8 @@ public: } return s; } + + static std::string ReadString(CInputStream& in); }; } // namespace metaforce diff --git a/Runtime/CTextureCache.cpp b/Runtime/CTextureCache.cpp index 3311e857b..2c4bee3b3 100644 --- a/Runtime/CTextureCache.cpp +++ b/Runtime/CTextureCache.cpp @@ -3,11 +3,11 @@ namespace metaforce { CTextureCache::CTextureCache(CInputStream& in) { - u32 textureCount = in.readUint32Big(); + u32 textureCount = in.ReadLong(); for (u32 i = 0; i < textureCount; ++i) { CAssetId uid(in); if (m_textureInfo.find(uid) == m_textureInfo.end()) - m_textureInfo.emplace(uid, CTextureInfo(in)); + m_textureInfo.emplace(uid, in.Get()); } } diff --git a/Runtime/CTextureCache.hpp b/Runtime/CTextureCache.hpp index 3dc558331..258965014 100644 --- a/Runtime/CTextureCache.hpp +++ b/Runtime/CTextureCache.hpp @@ -13,7 +13,7 @@ class CPaletteInfo { public: explicit CPaletteInfo(CInputStream& in) - : m_format(in.readUint32Big()), m_elementCount(in.readUint32Big()), m_dolphinHash(in.readUint64Big()) {} + : m_format(in.ReadLong()), m_elementCount(in.ReadLong()), m_dolphinHash(in.ReadLongLong()) {} }; class CTextureInfo { ETexelFormat m_format; @@ -25,12 +25,12 @@ class CTextureInfo { public: explicit CTextureInfo(CInputStream& in) - : m_format(ETexelFormat(in.readUint32Big())) - , m_mipCount(in.readUint32Big()) - , m_width(in.readUint16Big()) - , m_height(in.readUint16Big()) - , m_dolphinHash(in.readUint64Big()) { - bool hasPal = in.readBool(); + : m_format(ETexelFormat(in.ReadLong())) + , m_mipCount(in.ReadLong()) + , m_width(in.ReadShort()) + , m_height(in.ReadShort()) + , m_dolphinHash(in.ReadLongLong()) { + bool hasPal = in.ReadBool(); if (hasPal) m_paletteInfo.emplace(in); } diff --git a/Runtime/CWorldSaveGameInfo.cpp b/Runtime/CWorldSaveGameInfo.cpp index dd0829d03..aec5b9cf9 100644 --- a/Runtime/CWorldSaveGameInfo.cpp +++ b/Runtime/CWorldSaveGameInfo.cpp @@ -4,50 +4,50 @@ namespace metaforce { CWorldSaveGameInfo::CWorldSaveGameInfo(CInputStream& in) { - in.readUint32Big(); - const u32 version = in.readUint32Big(); + in.ReadLong(); + const u32 version = in.ReadLong(); if (version > 1) { - x0_areaCount = in.readUint32Big(); + x0_areaCount = in.ReadLong(); } if (version > 2) { - const u32 cinematicCount = in.readUint32Big(); + const u32 cinematicCount = in.ReadLong(); x4_cinematics.reserve(cinematicCount); for (u32 i = 0; i < cinematicCount; ++i) { - x4_cinematics.emplace_back(in.readUint32Big()); + x4_cinematics.emplace_back(in.ReadLong()); } - const u32 relayCount = in.readUint32Big(); + const u32 relayCount = in.ReadLong(); x14_relays.reserve(relayCount); for (u32 i = 0; i < relayCount; ++i) { - x14_relays.emplace_back(in.readUint32Big()); + x14_relays.emplace_back(in.ReadLong()); } } - const u32 layerCount = in.readUint32Big(); + const u32 layerCount = in.ReadLong(); x24_layers.reserve(layerCount); for (u32 i = 0; i < layerCount; ++i) { SLayerState& st = x24_layers.emplace_back(); - st.x0_area = in.readUint32Big(); - st.x4_layer = in.readUint32Big(); + st.x0_area = in.ReadLong(); + st.x4_layer = in.ReadLong(); } - const u32 doorCount = in.readUint32Big(); + const u32 doorCount = in.ReadLong(); x34_doors.reserve(doorCount); for (u32 i = 0; i < doorCount; ++i) { - x34_doors.emplace_back(in.readUint32Big()); + x34_doors.emplace_back(in.ReadLong()); } if (version <= 0) { return; } - const u32 scanCount = in.readUint32Big(); + const u32 scanCount = in.ReadLong(); 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()); + st.x0_id = in.ReadLong(); + st.x4_category = EScanCategory(in.ReadLong()); } } diff --git a/Runtime/CZipInputStream.cpp b/Runtime/CZipInputStream.cpp new file mode 100644 index 000000000..337792f9a --- /dev/null +++ b/Runtime/CZipInputStream.cpp @@ -0,0 +1,34 @@ +#include "CZipInputStream.hpp" + +namespace metaforce { +CZipInputStream::CZipInputStream(std::unique_ptr&& strm) +: CInputStream(4096), x24_compBuf(new u8[4096]), x28_strm(std::move(strm)) { + x30_zstrm = std::make_unique(); + x30_zstrm->next_in = x24_compBuf.get(); + x30_zstrm->avail_in = 0; + x30_zstrm->zalloc = [](void*, u32 c, u32 n) -> void* { return new u8[size_t{c} * size_t{n}]; }; + x30_zstrm->zfree = [](void*, void* buf) { delete[] static_cast(buf); }; + inflateInit(x30_zstrm.get()); +} + +CZipInputStream::~CZipInputStream() { inflateEnd(x30_zstrm.get()); } + +u32 CZipInputStream::Read(void* buf, u32 len) { + x30_zstrm->next_out = static_cast(buf); + x30_zstrm->avail_out = len; + x30_zstrm->total_out = 0; + while (x30_zstrm->avail_out != 0) { + if (x30_zstrm->avail_in == 0) { + u32 readSz = x28_strm->ReadBytes(x24_compBuf.get(), 4096); + x30_zstrm->avail_in = readSz; + x30_zstrm->next_in = x24_compBuf.get(); + } + int inflateRet = inflate(x30_zstrm.get(), Z_NO_FLUSH); + if (inflateRet != Z_OK) { + break; + } + } + return x30_zstrm->total_out; +} + +} // namespace metaforce \ No newline at end of file diff --git a/Runtime/CZipInputStream.hpp b/Runtime/CZipInputStream.hpp new file mode 100644 index 000000000..9fa7e96cf --- /dev/null +++ b/Runtime/CZipInputStream.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "CInputStream.hpp" + +#include + +#include +namespace metaforce { +class CZipInputStream : public CInputStream { + std::unique_ptr x24_compBuf; + std::unique_ptr x28_strm; + std::unique_ptr x30_zstrm = {}; + +public: + explicit CZipInputStream(std::unique_ptr&& strm); + ~CZipInputStream() override; + + u32 Read(void* ptr, u32 len) override; +}; + +} // namespace metaforce \ No newline at end of file diff --git a/Runtime/Camera/CCameraShakeData.cpp b/Runtime/Camera/CCameraShakeData.cpp index 28a25d3ed..8d97d0dea 100644 --- a/Runtime/Camera/CCameraShakeData.cpp +++ b/Runtime/Camera/CCameraShakeData.cpp @@ -13,10 +13,10 @@ namespace metaforce { SCameraShakePoint SCameraShakePoint::LoadCameraShakePoint(CInputStream& in) { u32 useEnvelope = ScriptLoader::LoadParameterFlags(in); - float attackTime = in.readFloatBig(); - float sustainTime = in.readFloatBig(); - float duration = in.readFloatBig(); - float magnitude = in.readFloatBig(); + float attackTime = in.ReadFloat(); + float sustainTime = in.ReadFloat(); + float duration = in.ReadFloat(); + float magnitude = in.ReadFloat(); return {useEnvelope != 0, attackTime, sustainTime, duration, magnitude}; } @@ -28,15 +28,15 @@ CCameraShakerComponent CCameraShakerComponent::LoadNewCameraShakerComponent(CInp } CCameraShakeData::CCameraShakeData(CInputStream& in) { - in.readUint32Big(); - in.readFloatBig(); - in.readFloatBig(); - in.readFloatBig(); - in.readFloatBig(); - in.readFloatBig(); - in.readFloatBig(); - in.readFloatBig(); - in.readBool(); + in.ReadLong(); + in.ReadFloat(); + in.ReadFloat(); + in.ReadFloat(); + in.ReadFloat(); + in.ReadFloat(); + in.ReadFloat(); + in.ReadFloat(); + in.ReadBool(); BuildProjectileCameraShake(0.5f, 0.75f); } @@ -100,13 +100,13 @@ float CCameraShakeData::GetMaxFMComponent() const { } CCameraShakeData CCameraShakeData::LoadCameraShakeData(CInputStream& in) { - const float xMag = in.readFloatBig(); - in.readFloatBig(); - const float yMag = in.readFloatBig(); - in.readFloatBig(); - const float zMag = in.readFloatBig(); - in.readFloatBig(); - const float duration = in.readFloatBig(); + const float xMag = in.ReadFloat(); + in.ReadFloat(); + const float yMag = in.ReadFloat(); + in.ReadFloat(); + const float zMag = in.ReadFloat(); + in.ReadFloat(); + const float duration = in.ReadFloat(); const SCameraShakePoint xAM(false, 0.f, 0.f, duration, 2.f * xMag); const SCameraShakePoint yAM(false, 0.f, 0.f, duration, 2.f * yMag); diff --git a/Runtime/Camera/CCameraShakeData.hpp b/Runtime/Camera/CCameraShakeData.hpp index b1a4de181..e5389d487 100644 --- a/Runtime/Camera/CCameraShakeData.hpp +++ b/Runtime/Camera/CCameraShakeData.hpp @@ -60,6 +60,7 @@ class CCameraShakeData { public: static const CCameraShakeData skChargedShotCameraShakeData; + constexpr CCameraShakeData() = default; constexpr CCameraShakeData(float duration, float sfxDist, u32 flags, const zeus::CVector3f& sfxPos, const CCameraShakerComponent& shaker1, const CCameraShakerComponent& shaker2, const CCameraShakerComponent& shaker3) noexcept diff --git a/Runtime/Character/CAdditiveAnimPlayback.hpp b/Runtime/Character/CAdditiveAnimPlayback.hpp index c85ac976d..80baee67d 100644 --- a/Runtime/Character/CAdditiveAnimPlayback.hpp +++ b/Runtime/Character/CAdditiveAnimPlayback.hpp @@ -2,6 +2,7 @@ #include #include "Runtime/RetroTypes.hpp" +#include "Runtime/CInputStream.hpp" namespace metaforce { class CAdditiveAnimationInfo; @@ -16,8 +17,8 @@ class CAdditiveAnimationInfo { public: void read(CInputStream& in) { - x0_fadeInDur = in.readFloatBig(); - x4_fadeOutDur = in.readFloatBig(); + x0_fadeInDur = in.ReadFloat(); + x4_fadeOutDur = in.ReadFloat(); } CAdditiveAnimationInfo() = default; explicit CAdditiveAnimationInfo(CInputStream& in) { read(in); } diff --git a/Runtime/Character/CAllFormatsAnimSource.cpp b/Runtime/Character/CAllFormatsAnimSource.cpp index 7e852ede9..e3c01f9cc 100644 --- a/Runtime/Character/CAllFormatsAnimSource.cpp +++ b/Runtime/Character/CAllFormatsAnimSource.cpp @@ -26,7 +26,7 @@ void CAnimFormatUnion::SubConstruct(u8* storage, EAnimFormat fmt, CInputStream& } CAnimFormatUnion::CAnimFormatUnion(CInputStream& in, IObjectStore& store) { - x0_format = EAnimFormat(in.readUint32Big()); + x0_format = EAnimFormat(in.ReadLong()); SubConstruct(x4_storage, x0_format, in, store); } diff --git a/Runtime/Character/CAnimCharacterSet.cpp b/Runtime/Character/CAnimCharacterSet.cpp index a85150f8f..bced78e93 100644 --- a/Runtime/Character/CAnimCharacterSet.cpp +++ b/Runtime/Character/CAnimCharacterSet.cpp @@ -5,7 +5,7 @@ namespace metaforce { CAnimCharacterSet::CAnimCharacterSet(CInputStream& in) -: x0_version(in.readUint16Big()), x4_characterSet(in), x1c_animationSet(in) {} +: x0_version(in.ReadShort()), x4_characterSet(in), x1c_animationSet(in) {} CFactoryFnReturn FAnimCharacterSet(const SObjectTag&, CInputStream& in, const CVParamTransfer&, CObjectReference* selfRef) { diff --git a/Runtime/Character/CAnimPOIData.cpp b/Runtime/Character/CAnimPOIData.cpp index 0f9328307..600044fba 100644 --- a/Runtime/Character/CAnimPOIData.cpp +++ b/Runtime/Character/CAnimPOIData.cpp @@ -4,24 +4,24 @@ namespace metaforce { -CAnimPOIData::CAnimPOIData(CInputStream& in) : x0_version(in.readUint32Big()) { - u32 boolCount = in.readUint32Big(); +CAnimPOIData::CAnimPOIData(CInputStream& in) : x0_version(in.ReadLong()) { + u32 boolCount = in.ReadLong(); x4_boolNodes.reserve(boolCount); for (u32 i = 0; i < boolCount; ++i) x4_boolNodes.emplace_back(in); - u32 int32Count = in.readUint32Big(); + u32 int32Count = in.ReadLong(); x14_int32Nodes.reserve(int32Count); for (u32 i = 0; i < int32Count; ++i) x14_int32Nodes.emplace_back(in); - u32 particleCount = in.readUint32Big(); + u32 particleCount = in.ReadLong(); x24_particleNodes.reserve(particleCount); for (u32 i = 0; i < particleCount; ++i) x24_particleNodes.emplace_back(in); if (x0_version >= 2) { - u32 soundCount = in.readUint32Big(); + u32 soundCount = in.ReadLong(); x34_soundNodes.reserve(soundCount); for (u32 i = 0; i < soundCount; ++i) x34_soundNodes.emplace_back(in); diff --git a/Runtime/Character/CAnimSource.cpp b/Runtime/Character/CAnimSource.cpp index 7ab35115e..fc9e18281 100644 --- a/Runtime/Character/CAnimSource.cpp +++ b/Runtime/Character/CAnimSource.cpp @@ -51,16 +51,16 @@ std::unique_ptr RotationAndOffsetStorage::GetRotationsAndOffsets(const } RotationAndOffsetStorage::CRotationAndOffsetVectors::CRotationAndOffsetVectors(CInputStream& in) { - const u32 quatCount = in.readUint32Big(); + const u32 quatCount = in.ReadLong(); x0_rotations.reserve(quatCount); for (u32 i = 0; i < quatCount; ++i) { - x0_rotations.emplace_back().readBig(in); + x0_rotations.emplace_back() = in.Get(); } - const u32 vecCount = in.readUint32Big(); + const u32 vecCount = in.ReadLong(); x10_offsets.reserve(vecCount); for (u32 i = 0; i < vecCount; ++i) { - x10_offsets.emplace_back().readBig(in); + x10_offsets.emplace_back() = in.Get(); } } @@ -75,10 +75,10 @@ RotationAndOffsetStorage::RotationAndOffsetStorage(const CRotationAndOffsetVecto static std::vector ReadIndexTable(CInputStream& in) { std::vector ret; - u32 count = in.readUint32Big(); + u32 count = in.ReadLong(); ret.reserve(count); for (u32 i = 0; i < count; ++i) - ret.push_back(in.readUByte()); + ret.push_back(in.ReadUint8()); return ret; } @@ -103,12 +103,12 @@ void CAnimSource::CalcAverageVelocity() { CAnimSource::CAnimSource(CInputStream& in, IObjectStore& store) : x0_duration(in) , x8_interval(in) -, x10_frameCount(in.readUint32Big()) +, x10_frameCount(in.ReadLong()) , x1c_rootBone(in) , x20_rotationChannels(ReadIndexTable(in)) , x30_translationChannels(ReadIndexTable(in)) , x40_data(RotationAndOffsetStorage::CRotationAndOffsetVectors(in), x10_frameCount) -, x54_evntId(in.readUint32Big()) { +, x54_evntId(in.ReadLong()) { if (x54_evntId.IsValid()) { x58_evntData = store.GetObj({SBIG('EVNT'), x54_evntId}); x58_evntData.GetObj(); diff --git a/Runtime/Character/CAnimation.cpp b/Runtime/Character/CAnimation.cpp index d7de743bb..eb216e020 100644 --- a/Runtime/Character/CAnimation.cpp +++ b/Runtime/Character/CAnimation.cpp @@ -5,7 +5,7 @@ namespace metaforce { CAnimation::CAnimation(CInputStream& in) { - x0_name = in.readString(); + x0_name = in.Get(); x10_anim = CMetaAnimFactory::CreateMetaAnim(in); } diff --git a/Runtime/Character/CAnimationSet.cpp b/Runtime/Character/CAnimationSet.cpp index 690b1a3c7..68f5be3ee 100644 --- a/Runtime/Character/CAnimationSet.cpp +++ b/Runtime/Character/CAnimationSet.cpp @@ -4,13 +4,13 @@ namespace metaforce { -CAnimationSet::CAnimationSet(CInputStream& in) : x0_tableCount(in.readUint16Big()) { - u32 animationCount = in.readUint32Big(); +CAnimationSet::CAnimationSet(CInputStream& in) : x0_tableCount(in.ReadShort()) { + u32 animationCount = in.ReadLong(); x4_animations.reserve(animationCount); for (u32 i = 0; i < animationCount; ++i) x4_animations.emplace_back(in); - u32 transitionCount = in.readUint32Big(); + u32 transitionCount = in.ReadLong(); x14_transitions.reserve(transitionCount); for (u32 i = 0; i < transitionCount; ++i) x14_transitions.emplace_back(in); @@ -18,28 +18,28 @@ CAnimationSet::CAnimationSet(CInputStream& in) : x0_tableCount(in.readUint16Big( x24_defaultTransition = CMetaTransFactory::CreateMetaTrans(in); if (x0_tableCount > 1) { - u32 additiveAnimCount = in.readUint32Big(); + u32 additiveAnimCount = in.ReadLong(); x28_additiveInfo.reserve(additiveAnimCount); for (u32 i = 0; i < additiveAnimCount; ++i) { - u32 id = in.readUint32Big(); + u32 id = in.ReadLong(); x28_additiveInfo.emplace_back(id, in); } x38_defaultAdditiveInfo.read(in); } if (x0_tableCount > 2) { - u32 halfTransitionCount = in.readUint32Big(); + u32 halfTransitionCount = in.ReadLong(); x40_halfTransitions.reserve(halfTransitionCount); for (u32 i = 0; i < halfTransitionCount; ++i) x40_halfTransitions.emplace_back(in); } if (x0_tableCount > 3) { - u32 animResourcesCount = in.readUint32Big(); + u32 animResourcesCount = in.ReadLong(); x50_animRes.reserve(animResourcesCount); for (u32 i = 0; i < animResourcesCount; ++i) { - CAssetId anim = in.readUint32Big(); - CAssetId evnt = in.readUint32Big(); + CAssetId anim = in.ReadLong(); + CAssetId evnt = in.ReadLong(); x50_animRes.emplace_back(anim, evnt); } } diff --git a/Runtime/Character/CBoolPOINode.cpp b/Runtime/Character/CBoolPOINode.cpp index 50e847dfe..f65ae2f94 100644 --- a/Runtime/Character/CBoolPOINode.cpp +++ b/Runtime/Character/CBoolPOINode.cpp @@ -6,7 +6,7 @@ namespace metaforce { CBoolPOINode::CBoolPOINode() : CPOINode("root", EPOIType::EmptyBool, CCharAnimTime(), -1, false, 1.f, -1, 0) {} -CBoolPOINode::CBoolPOINode(CInputStream& in) : CPOINode(in), x38_val(in.readBool()) {} +CBoolPOINode::CBoolPOINode(CInputStream& in) : CPOINode(in), x38_val(in.ReadBool()) {} CBoolPOINode CBoolPOINode::CopyNodeMinusStartTime(const CBoolPOINode& node, const CCharAnimTime& startTime) { CBoolPOINode ret = node; diff --git a/Runtime/Character/CCharAnimTime.hpp b/Runtime/Character/CCharAnimTime.hpp index e2aa45e3b..0f38dc46e 100644 --- a/Runtime/Character/CCharAnimTime.hpp +++ b/Runtime/Character/CCharAnimTime.hpp @@ -19,7 +19,7 @@ public: constexpr CCharAnimTime() = default; constexpr CCharAnimTime(float time) : x0_time(time), x4_type(x0_time != 0.f ? EType::NonZero : EType::ZeroSteady) {} constexpr CCharAnimTime(EType type, float t) : x0_time(t), x4_type(type) {} - explicit CCharAnimTime(CInputStream& in) : x0_time(in.readFloatBig()), x4_type(EType(in.readUint32Big())) {} + explicit CCharAnimTime(CInputStream& in) : x0_time(in.ReadFloat()), x4_type(EType(in.ReadLong())) {} static constexpr CCharAnimTime Infinity() { return {EType::Infinity, 1.0f}; } float GetSeconds() const { return x0_time; } diff --git a/Runtime/Character/CCharLayoutInfo.cpp b/Runtime/Character/CCharLayoutInfo.cpp index 64b1941d5..8fd511d3f 100644 --- a/Runtime/Character/CCharLayoutInfo.cpp +++ b/Runtime/Character/CCharLayoutInfo.cpp @@ -32,30 +32,30 @@ CSegId CCharLayoutInfo::GetSegIdFromString(std::string_view name) const { void CCharLayoutNode::Bone::read(CInputStream& in) { x0_parentId = CSegId(in); - x4_origin.readBig(in); + x4_origin = in.Get(); - const u32 chCount = in.readUint32Big(); + const u32 chCount = in.ReadLong(); x10_children.reserve(chCount); for (u32 i = 0; i < chCount; ++i) { x10_children.emplace_back(in); } } -CCharLayoutNode::CCharLayoutNode(CInputStream& in) : x0_boneMap(in.readUint32Big()) { +CCharLayoutNode::CCharLayoutNode(CInputStream& in) : x0_boneMap(in.ReadLong()) { const u32 cap = x0_boneMap.GetCapacity(); for (u32 i = 0; i < cap; ++i) { - const u32 thisId = in.readUint32Big(); + const u32 thisId = in.ReadLong(); Bone& bone = x0_boneMap[thisId]; bone.read(in); } } CCharLayoutInfo::CCharLayoutInfo(CInputStream& in) : x0_node(std::make_shared(in)), x8_segIdList(in) { - const atUint32 mapCount = in.readUint32Big(); + const atUint32 mapCount = in.ReadLong(); for (atUint32 i = 0; i < mapCount; ++i) { - std::string key = in.readString(); + std::string key = in.Get(); x18_segIdMap.emplace(std::move(key), in); } } diff --git a/Runtime/Character/CCharacterInfo.cpp b/Runtime/Character/CCharacterInfo.cpp index 7dec11562..0ce8908a9 100644 --- a/Runtime/Character/CCharacterInfo.cpp +++ b/Runtime/Character/CCharacterInfo.cpp @@ -1,76 +1,77 @@ #include "Runtime/Character/CCharacterInfo.hpp" +#include "Runtime/IOStreams.hpp" namespace metaforce { CCharacterInfo::CParticleResData::CParticleResData(CInputStream& in, u16 tableCount) { - const u32 partCount = in.readUint32Big(); + const u32 partCount = in.ReadLong(); x0_part.reserve(partCount); for (u32 i = 0; i < partCount; ++i) { - x0_part.emplace_back(in.readUint32Big()); + x0_part.emplace_back(in.Get()); } - const u32 swhcCount = in.readUint32Big(); + const u32 swhcCount = in.ReadLong(); x10_swhc.reserve(swhcCount); for (u32 i = 0; i < swhcCount; ++i) { - x10_swhc.emplace_back(in.readUint32Big()); + x10_swhc.emplace_back(in.Get()); } - const u32 unkCount = in.readUint32Big(); + const u32 unkCount = in.ReadLong(); x20_elsc.reserve(unkCount); for (u32 i = 0; i < unkCount; ++i) { - x20_elsc.emplace_back(in.readUint32Big()); + x20_elsc.emplace_back(in.Get()); } if (tableCount > 5) { - const u32 elscCount = in.readUint32Big(); + const u32 elscCount = in.ReadLong(); x30_elsc.reserve(elscCount); for (u32 i = 0; i < elscCount; ++i) { - x30_elsc.emplace_back(in.readUint32Big()); + x30_elsc.emplace_back(in.Get()); } } } static std::vector>> MakeAnimInfoVector(CInputStream& in) { std::vector>> ret; - const u32 animInfoCount = in.readUint32Big(); + const u32 animInfoCount = in.ReadLong(); ret.reserve(animInfoCount); for (u32 i = 0; i < animInfoCount; ++i) { - const s32 idx = in.readInt32Big(); - std::string a = in.readString(); - std::string b = in.readString(); + const s32 idx = in.ReadLong(); + std::string a = in.Get(); + std::string b = in.Get(); ret.emplace_back(idx, std::make_pair(std::move(a), std::move(b))); } return ret; } CCharacterInfo::CCharacterInfo(CInputStream& in) -: x0_tableCount(in.readUint16Big()) -, x4_name(in.readString()) -, x14_cmdl(in.readUint32Big()) -, x18_cskr(in.readUint32Big()) -, x1c_cinf(in.readUint32Big()) +: x0_tableCount(in.ReadShort()) +, x4_name(in.Get()) +, x14_cmdl(in.ReadLong()) +, x18_cskr(in.ReadLong()) +, x1c_cinf(in.ReadLong()) , x20_animInfo(MakeAnimInfoVector(in)) , x30_pasDatabase(in) , x44_partRes(in, x0_tableCount) -, x84_unk(in.readUint32Big()) { +, x84_unk(in.ReadLong()) { if (x0_tableCount > 1) { - const u32 aabbCount = in.readUint32Big(); + const u32 aabbCount = in.ReadLong(); x88_aabbs.reserve(aabbCount); for (u32 i = 0; i < aabbCount; ++i) { - std::string name = in.readString(); + std::string name = in.Get(); x88_aabbs.emplace_back(std::move(name), zeus::CAABox()); - x88_aabbs.back().second.readBoundingBoxBig(in); + x88_aabbs.back().second = in.Get(); } } if (x0_tableCount > 2) { - const u32 effectCount = in.readUint32Big(); + const u32 effectCount = in.ReadLong(); x98_effects.reserve(effectCount); for (u32 i = 0; i < effectCount; ++i) { - std::string name = in.readString(); + std::string name = in.Get(); x98_effects.emplace_back(std::move(name), std::vector()); std::vector& comps = x98_effects.back().second; - const u32 compCount = in.readUint32Big(); + const u32 compCount = in.ReadLong(); comps.reserve(compCount); for (u32 j = 0; j < compCount; ++j) { comps.emplace_back(in); @@ -79,15 +80,15 @@ CCharacterInfo::CCharacterInfo(CInputStream& in) } if (x0_tableCount > 3) { - xa8_cmdlOverlay = in.readUint32Big(); - xac_cskrOverlay = in.readUint32Big(); + xa8_cmdlOverlay = in.ReadLong(); + xac_cskrOverlay = in.ReadLong(); } if (x0_tableCount > 4) { - const u32 aidxCount = in.readUint32Big(); + const u32 aidxCount = in.ReadLong(); xb0_animIdxs.reserve(aidxCount); for (u32 i = 0; i < aidxCount; ++i) { - xb0_animIdxs.push_back(in.readInt32Big()); + xb0_animIdxs.push_back(in.ReadLong()); } } } diff --git a/Runtime/Character/CCharacterSet.cpp b/Runtime/Character/CCharacterSet.cpp index a0bc9bbdc..4cc652b4d 100644 --- a/Runtime/Character/CCharacterSet.cpp +++ b/Runtime/Character/CCharacterSet.cpp @@ -2,10 +2,10 @@ namespace metaforce { -CCharacterSet::CCharacterSet(CInputStream& in) : x0_version(in.readUint16Big()) { - u32 charCount = in.readUint32Big(); +CCharacterSet::CCharacterSet(CInputStream& in) : x0_version(in.ReadShort()) { + u32 charCount = in.ReadLong(); for (u32 i = 0; i < charCount; ++i) { - u32 id = in.readUint32Big(); + u32 id = in.ReadLong(); x4_characters.emplace(id, in); } } diff --git a/Runtime/Character/CEffectComponent.cpp b/Runtime/Character/CEffectComponent.cpp index 050a960d9..17f79d617 100644 --- a/Runtime/Character/CEffectComponent.cpp +++ b/Runtime/Character/CEffectComponent.cpp @@ -2,15 +2,15 @@ namespace metaforce { -SObjectTag CEffectComponent::GetSObjectTagFromStream(CInputStream& in) { return SObjectTag(in); } +SObjectTag CEffectComponent::GetSObjectTagFromStream(CInputStream& in) { return in.Get(); } CEffectComponent::CEffectComponent(CInputStream& in) { - x0_name = in.readString(); + x0_name = in.Get(); x10_tag = GetSObjectTagFromStream(in); - x18_boneName = in.readString(); - x28_scale = in.readFloatBig(); - x2c_parentedMode = CParticleData::EParentedMode(in.readUint32Big()); - x30_flags = in.readUint32Big(); + x18_boneName = in.Get(); + x28_scale = in.ReadFloat(); + x2c_parentedMode = CParticleData::EParentedMode(in.ReadLong()); + x30_flags = in.ReadLong(); } } // namespace metaforce diff --git a/Runtime/Character/CFBStreamedCompression.cpp b/Runtime/Character/CFBStreamedCompression.cpp index a2be29412..4b18c7afb 100644 --- a/Runtime/Character/CFBStreamedCompression.cpp +++ b/Runtime/Character/CFBStreamedCompression.cpp @@ -23,8 +23,8 @@ void WriteValue(u8* data, T value) { } // Anonymous namespace CFBStreamedCompression::CFBStreamedCompression(CInputStream& in, IObjectStore& objStore, bool pc) : m_pc(pc) { - x0_scratchSize = in.readUint32Big(); - x4_evnt = in.readUint32Big(); + x0_scratchSize = in.ReadLong(); + x4_evnt = in.ReadLong(); xc_rotsAndOffs = GetRotationsAndOffsets(x0_scratchSize / 4 + 1, in); @@ -86,78 +86,78 @@ std::unique_ptr CFBStreamedCompression::GetRotationsAndOffsets(u32 words, std::memcpy(ret.get(), &head, sizeof(head)); u32* bitmapOut = &ret[9]; - const u32 bitmapBitCount = in.readUint32Big(); + const u32 bitmapBitCount = in.ReadLong(); bitmapOut[0] = bitmapBitCount; const u32 bitmapWordCount = (bitmapBitCount + 31) / 32; for (u32 i = 0; i < bitmapWordCount; ++i) { - bitmapOut[i + 1] = in.readUint32Big(); + bitmapOut[i + 1] = in.ReadLong(); } - in.readUint32Big(); + in.ReadLong(); u8* chans = reinterpret_cast(bitmapOut + bitmapWordCount + 1); u8* bs = ReadBoneChannelDescriptors(chans, in); const u32 bsWords = ComputeBitstreamWords(chans); u32* bsPtr = reinterpret_cast(bs); for (u32 w = 0; w < bsWords; ++w) - bsPtr[w] = in.readUint32Big(); + bsPtr[w] = in.ReadLong(); return ret; } u8* CFBStreamedCompression::ReadBoneChannelDescriptors(u8* out, CInputStream& in) const { - const u32 boneChanCount = in.readUint32Big(); + const u32 boneChanCount = in.ReadLong(); WriteValue(out, boneChanCount); out += 4; if (m_pc) { for (u32 b = 0; b < boneChanCount; ++b) { - WriteValue(out, in.readUint32Big()); + WriteValue(out, in.ReadLong()); out += 4; - WriteValue(out, in.readUint32Big()); + WriteValue(out, in.ReadLong()); out += 4; for (int i = 0; i < 3; ++i) { - WriteValue(out, in.readUint32Big()); + WriteValue(out, in.ReadLong()); out += 4; } - const u32 tCount = in.readUint32Big(); + const u32 tCount = in.ReadLong(); WriteValue(out, tCount); out += 4; if (tCount != 0) { for (int i = 0; i < 3; ++i) { - WriteValue(out, in.readUint32Big()); + WriteValue(out, in.ReadLong()); out += 4; } } } } else { for (u32 b = 0; b < boneChanCount; ++b) { - WriteValue(out, in.readUint32Big()); + WriteValue(out, in.ReadLong()); out += 4; - WriteValue(out, in.readUint16Big()); + WriteValue(out, in.ReadShort()); out += 2; for (int i = 0; i < 3; ++i) { - WriteValue(out, in.readInt16Big()); + WriteValue(out, in.ReadShort()); out += 2; - WriteValue(out, in.readUByte()); + WriteValue(out, in.ReadUint8()); out += 1; } - const u16 tCount = in.readUint16Big(); + const u16 tCount = in.ReadShort(); WriteValue(out, tCount); out += 2; if (tCount != 0) { for (int i = 0; i < 3; ++i) { - WriteValue(out, in.readInt16Big()); + WriteValue(out, in.ReadShort()); out += 2; - WriteValue(out, in.readUByte()); + WriteValue(out, in.ReadUint8()); out += 1; } } diff --git a/Runtime/Character/CFBStreamedCompression.hpp b/Runtime/Character/CFBStreamedCompression.hpp index 2d06cd1cc..a6aca4390 100644 --- a/Runtime/Character/CFBStreamedCompression.hpp +++ b/Runtime/Character/CFBStreamedCompression.hpp @@ -31,23 +31,23 @@ public: void read(CInputStream& in) { /* unk0 */ - unk0 = in.readUint32Big(); + unk0 = in.ReadLong(); /* duration */ - duration = in.readFloatBig(); + duration = in.ReadFloat(); /* interval */ - interval = in.readFloatBig(); + interval = in.ReadFloat(); /* rootBoneId */ - rootBoneId = in.readUint32Big(); + rootBoneId = in.ReadLong(); /* looping */ - looping = in.readUint32Big(); + looping = in.ReadLong(); /* rotDiv */ - rotDiv = in.readUint32Big(); + rotDiv = in.ReadLong(); /* translationMult */ - translationMult = in.readFloatBig(); + translationMult = in.ReadFloat(); /* boneChannelCount */ - boneChannelCount = in.readUint32Big(); + boneChannelCount = in.ReadLong(); /* unk3 */ - unk3 = in.readUint32Big(); + unk3 = in.ReadLong(); } }; diff --git a/Runtime/Character/CHalfTransition.cpp b/Runtime/Character/CHalfTransition.cpp index 36a00f1e3..43025512f 100644 --- a/Runtime/Character/CHalfTransition.cpp +++ b/Runtime/Character/CHalfTransition.cpp @@ -5,7 +5,7 @@ namespace metaforce { CHalfTransition::CHalfTransition(CInputStream& in) { - x0_id = in.readUint32Big(); + x0_id = in.ReadLong(); x4_trans = CMetaTransFactory::CreateMetaTrans(in); } diff --git a/Runtime/Character/CInt32POINode.cpp b/Runtime/Character/CInt32POINode.cpp index 324ff54f4..3e0cd218b 100644 --- a/Runtime/Character/CInt32POINode.cpp +++ b/Runtime/Character/CInt32POINode.cpp @@ -11,7 +11,7 @@ CInt32POINode::CInt32POINode(std::string_view name, EPOIType type, const CCharAn : CPOINode(name, type, time, index, unique, weight, charIndex, flags), x38_val(val), x3c_locatorName(locator) {} CInt32POINode::CInt32POINode(CInputStream& in) -: CPOINode(in), x38_val(in.readUint32Big()), x3c_locatorName(in.readString()) {} +: CPOINode(in), x38_val(in.ReadLong()), x3c_locatorName(in.Get()) {} CInt32POINode CInt32POINode::CopyNodeMinusStartTime(const CInt32POINode& node, const CCharAnimTime& startTime) { CInt32POINode ret = node; diff --git a/Runtime/Character/CMetaAnimBlend.cpp b/Runtime/Character/CMetaAnimBlend.cpp index 67d81f3d2..30c988ec2 100644 --- a/Runtime/Character/CMetaAnimBlend.cpp +++ b/Runtime/Character/CMetaAnimBlend.cpp @@ -8,8 +8,8 @@ namespace metaforce { CMetaAnimBlend::CMetaAnimBlend(CInputStream& in) { x4_animA = CMetaAnimFactory::CreateMetaAnim(in); x8_animB = CMetaAnimFactory::CreateMetaAnim(in); - xc_blend = in.readFloatBig(); - x10_ = in.readBool(); + xc_blend = in.ReadFloat(); + x10_ = in.ReadBool(); } void CMetaAnimBlend::GetUniquePrimitives(std::set& primsOut) const { diff --git a/Runtime/Character/CMetaAnimFactory.cpp b/Runtime/Character/CMetaAnimFactory.cpp index daf92802e..b41bc3c11 100644 --- a/Runtime/Character/CMetaAnimFactory.cpp +++ b/Runtime/Character/CMetaAnimFactory.cpp @@ -9,7 +9,7 @@ namespace metaforce { std::shared_ptr CMetaAnimFactory::CreateMetaAnim(CInputStream& in) { - EMetaAnimType type = EMetaAnimType(in.readUint32Big()); + EMetaAnimType type = EMetaAnimType(in.ReadLong()); switch (type) { case EMetaAnimType::Play: diff --git a/Runtime/Character/CMetaAnimPhaseBlend.cpp b/Runtime/Character/CMetaAnimPhaseBlend.cpp index da9d00cde..42095d332 100644 --- a/Runtime/Character/CMetaAnimPhaseBlend.cpp +++ b/Runtime/Character/CMetaAnimPhaseBlend.cpp @@ -9,8 +9,8 @@ namespace metaforce { CMetaAnimPhaseBlend::CMetaAnimPhaseBlend(CInputStream& in) { x4_animA = CMetaAnimFactory::CreateMetaAnim(in); x8_animB = CMetaAnimFactory::CreateMetaAnim(in); - xc_blend = in.readFloatBig(); - x10_ = in.readBool(); + xc_blend = in.ReadFloat(); + x10_ = in.ReadBool(); } void CMetaAnimPhaseBlend::GetUniquePrimitives(std::set& primsOut) const { diff --git a/Runtime/Character/CMetaAnimRandom.cpp b/Runtime/Character/CMetaAnimRandom.cpp index 02f1f1342..74cdac9c1 100644 --- a/Runtime/Character/CMetaAnimRandom.cpp +++ b/Runtime/Character/CMetaAnimRandom.cpp @@ -7,12 +7,12 @@ namespace metaforce { CMetaAnimRandom::RandomData CMetaAnimRandom::CreateRandomData(CInputStream& in) { CMetaAnimRandom::RandomData ret; - u32 randCount = in.readUint32Big(); + u32 randCount = in.ReadLong(); ret.reserve(randCount); for (u32 i = 0; i < randCount; ++i) { std::shared_ptr metaAnim = CMetaAnimFactory::CreateMetaAnim(in); - ret.emplace_back(std::move(metaAnim), in.readUint32Big()); + ret.emplace_back(std::move(metaAnim), in.ReadLong()); } return ret; diff --git a/Runtime/Character/CMetaAnimSequence.cpp b/Runtime/Character/CMetaAnimSequence.cpp index a96539731..ffa717670 100644 --- a/Runtime/Character/CMetaAnimSequence.cpp +++ b/Runtime/Character/CMetaAnimSequence.cpp @@ -7,7 +7,7 @@ namespace metaforce { std::vector> CMetaAnimSequence::CreateSequence(CInputStream& in) { std::vector> ret; - u32 seqCount = in.readUint32Big(); + u32 seqCount = in.ReadLong(); ret.reserve(seqCount); for (u32 i = 0; i < seqCount; ++i) diff --git a/Runtime/Character/CMetaTransFactory.cpp b/Runtime/Character/CMetaTransFactory.cpp index 1ae7d87fd..b408d00f1 100644 --- a/Runtime/Character/CMetaTransFactory.cpp +++ b/Runtime/Character/CMetaTransFactory.cpp @@ -8,7 +8,7 @@ namespace metaforce { std::shared_ptr CMetaTransFactory::CreateMetaTrans(CInputStream& in) { - EMetaTransType type = EMetaTransType(in.readUint32Big()); + EMetaTransType type = EMetaTransType(in.ReadLong()); switch (type) { case EMetaTransType::MetaAnim: diff --git a/Runtime/Character/CMetaTransPhaseTrans.cpp b/Runtime/Character/CMetaTransPhaseTrans.cpp index f158da0aa..7a09cee6b 100644 --- a/Runtime/Character/CMetaTransPhaseTrans.cpp +++ b/Runtime/Character/CMetaTransPhaseTrans.cpp @@ -9,9 +9,9 @@ namespace metaforce { CMetaTransPhaseTrans::CMetaTransPhaseTrans(CInputStream& in) { x4_transDur = CCharAnimTime(in); - xc_ = in.readBool(); - xd_runA = in.readBool(); - x10_flags = in.readUint32Big(); + xc_ = in.ReadBool(); + xd_runA = in.ReadBool(); + x10_flags = in.ReadLong(); } std::shared_ptr CMetaTransPhaseTrans::VGetTransitionTree(const std::weak_ptr& a, diff --git a/Runtime/Character/CMetaTransTrans.cpp b/Runtime/Character/CMetaTransTrans.cpp index a64b86b30..914d1755c 100644 --- a/Runtime/Character/CMetaTransTrans.cpp +++ b/Runtime/Character/CMetaTransTrans.cpp @@ -5,10 +5,10 @@ namespace metaforce { CMetaTransTrans::CMetaTransTrans(CInputStream& in) { - x4_transDur = CCharAnimTime(in); - xc_ = in.readBool(); - xd_runA = in.readBool(); - x10_flags = in.readUint32Big(); + x4_transDur = in.Get(); + xc_ = in.ReadBool(); + xd_runA = in.ReadBool(); + x10_flags = in.ReadLong(); } std::shared_ptr CMetaTransTrans::VGetTransitionTree(const std::weak_ptr& a, diff --git a/Runtime/Character/CPASAnimState.cpp b/Runtime/Character/CPASAnimState.cpp index 1c02ffd78..8781f94e2 100644 --- a/Runtime/Character/CPASAnimState.cpp +++ b/Runtime/Character/CPASAnimState.cpp @@ -14,9 +14,9 @@ namespace metaforce { CPASAnimState::CPASAnimState(CInputStream& in) { - x0_id = static_cast(in.readUint32Big()); - u32 parmCount = in.readUint32Big(); - u32 animCount = in.readUint32Big(); + x0_id = static_cast(in.ReadLong()); + u32 parmCount = in.ReadLong(); + u32 animCount = in.ReadLong(); x4_parms.reserve(parmCount); x14_anims.reserve(animCount); @@ -26,25 +26,25 @@ CPASAnimState::CPASAnimState(CInputStream& in) { x4_parms.emplace_back(in); for (u32 i = 0; i < animCount; ++i) { - s32 id = in.readUint32Big(); + s32 id = in.ReadLong(); rstl::reserved_vector parms; for (const CPASParmInfo& parm : x4_parms) { CPASAnimParm::UParmValue val = {}; switch (parm.GetParameterType()) { case CPASAnimParm::EParmType::Int32: - val.m_int = in.readInt32Big(); + val.m_int = in.ReadInt32(); break; case CPASAnimParm::EParmType::UInt32: - val.m_uint = in.readUint32Big(); + val.m_uint = in.ReadLong(); break; case CPASAnimParm::EParmType::Float: - val.m_float = in.readFloatBig(); + val.m_float = in.ReadFloat(); break; case CPASAnimParm::EParmType::Bool: - val.m_bool = in.readBool(); + val.m_bool = in.ReadBool(); break; case CPASAnimParm::EParmType::Enum: - val.m_int = in.readInt32Big(); + val.m_int = in.ReadInt32(); break; default: break; diff --git a/Runtime/Character/CPASDatabase.cpp b/Runtime/Character/CPASDatabase.cpp index d6d922684..d661116e0 100644 --- a/Runtime/Character/CPASDatabase.cpp +++ b/Runtime/Character/CPASDatabase.cpp @@ -17,9 +17,9 @@ void CPASDatabase::AddAnimState(CPASAnimState&& state) { } CPASDatabase::CPASDatabase(CInputStream& in) { - in.readUint32Big(); - u32 animStateCount = in.readUint32Big(); - u32 defaultState = in.readUint32Big(); + in.ReadLong(); + u32 animStateCount = in.ReadLong(); + u32 defaultState = in.ReadLong(); x0_states.reserve(animStateCount); for (u32 i = 0; i < animStateCount; ++i) { diff --git a/Runtime/Character/CPASParmInfo.cpp b/Runtime/Character/CPASParmInfo.cpp index 80920c0b4..919f1ff5f 100644 --- a/Runtime/Character/CPASParmInfo.cpp +++ b/Runtime/Character/CPASParmInfo.cpp @@ -2,33 +2,33 @@ namespace metaforce { -CPASParmInfo::CPASParmInfo(CInputStream& in) { +CPASParmInfo::CPASParmInfo(CInputStream& in) +: x0_type(CPASAnimParm::EParmType(in.ReadLong())), x4_weightFunction(EWeightFunction(in.ReadLong())) { xc_min.m_int = 0; x10_max.m_int = 0; - x0_type = CPASAnimParm::EParmType(in.readUint32Big()); - x4_weightFunction = EWeightFunction(in.readUint32Big()); - x8_weight = in.readFloatBig(); + + x8_weight = in.ReadFloat(); switch (x0_type) { case CPASAnimParm::EParmType::Int32: - xc_min.m_int = in.readInt32Big(); - x10_max.m_int = in.readInt32Big(); + xc_min.m_int = in.ReadInt32(); + x10_max.m_int = in.ReadInt32(); break; case CPASAnimParm::EParmType::UInt32: - xc_min.m_uint = in.readUint32Big(); - x10_max.m_uint = in.readUint32Big(); + xc_min.m_uint = in.ReadLong(); + x10_max.m_uint = in.ReadLong(); break; case CPASAnimParm::EParmType::Float: - xc_min.m_float = in.readFloatBig(); - x10_max.m_float = in.readFloatBig(); + xc_min.m_float = in.ReadFloat(); + x10_max.m_float = in.ReadFloat(); break; case CPASAnimParm::EParmType::Bool: - xc_min.m_bool = in.readBool(); - x10_max.m_bool = in.readBool(); + xc_min.m_bool = in.ReadBool(); + x10_max.m_bool = in.ReadBool(); break; case CPASAnimParm::EParmType::Enum: - xc_min.m_int = in.readInt32Big(); - x10_max.m_int = in.readInt32Big(); + xc_min.m_int = in.ReadInt32(); + x10_max.m_int = in.ReadInt32(); break; default: break; diff --git a/Runtime/Character/CPOINode.cpp b/Runtime/Character/CPOINode.cpp index 9e3ece784..911c1c107 100644 --- a/Runtime/Character/CPOINode.cpp +++ b/Runtime/Character/CPOINode.cpp @@ -21,15 +21,15 @@ CPOINode::CPOINode(std::string_view name, EPOIType type, const CCharAnimTime& ti , x34_flags(f) {} CPOINode::CPOINode(CInputStream& in) -: x4_(in.readUint16Big()) -, x8_name(in.readString()) -, x18_type(EPOIType(in.readUint16Big())) +: x4_(in.ReadShort()) +, x8_name(in.Get()) +, x18_type(EPOIType(in.ReadShort())) , x1c_time(in) -, x24_index(in.readInt32Big()) -, x28_unique(in.readBool()) -, x2c_weight(in.readFloatBig()) -, x30_charIdx(in.readInt32Big()) -, x34_flags(in.readInt32Big()) {} +, x24_index(in.ReadInt32()) +, x28_unique(in.ReadBool()) +, x2c_weight(in.ReadFloat()) +, x30_charIdx(in.ReadInt32()) +, x34_flags(in.ReadInt32()) {} bool CPOINode::operator>(const CPOINode& other) const { return x1c_time > other.x1c_time; } diff --git a/Runtime/Character/CParticleData.cpp b/Runtime/Character/CParticleData.cpp index c54b8bc26..3b0b11905 100644 --- a/Runtime/Character/CParticleData.cpp +++ b/Runtime/Character/CParticleData.cpp @@ -3,10 +3,10 @@ namespace metaforce { CParticleData::CParticleData(CInputStream& in) -: x0_duration(in.readUint32Big()) +: x0_duration(in.ReadLong()) , x4_particle(in) -, xc_boneName(in.readString()) -, x1c_scale(in.readFloatBig()) -, x20_parentMode(EParentedMode(in.readUint32Big())) {} +, xc_boneName(in.Get()) +, x1c_scale(in.ReadFloat()) +, x20_parentMode(EParentedMode(in.ReadLong())) {} } // namespace metaforce diff --git a/Runtime/Character/CPrimitive.cpp b/Runtime/Character/CPrimitive.cpp index 3857528c0..feb436ce0 100644 --- a/Runtime/Character/CPrimitive.cpp +++ b/Runtime/Character/CPrimitive.cpp @@ -3,9 +3,9 @@ namespace metaforce { CPrimitive::CPrimitive(CInputStream& in) { - x0_animId = in.readUint32Big(); - x4_animIdx = in.readUint32Big(); - x8_animName = in.readString(); + x0_animId = in.ReadLong(); + x4_animIdx = in.ReadLong(); + x8_animName = in.Get(); } } // namespace metaforce diff --git a/Runtime/Character/CSegId.hpp b/Runtime/Character/CSegId.hpp index 3bcaa78d2..2611e60ba 100644 --- a/Runtime/Character/CSegId.hpp +++ b/Runtime/Character/CSegId.hpp @@ -11,7 +11,7 @@ class CSegId { public: constexpr CSegId() noexcept = default; constexpr CSegId(u8 id) noexcept : x0_segId(id) {} - explicit CSegId(CInputStream& in) : x0_segId(in.readUint32Big()) {} + explicit CSegId(CInputStream& in) : x0_segId(in.ReadUint8()) {} constexpr CSegId& operator++() noexcept { ++x0_segId; return *this; diff --git a/Runtime/Character/CSegIdList.cpp b/Runtime/Character/CSegIdList.cpp index aecb44d48..9ece5f11d 100644 --- a/Runtime/Character/CSegIdList.cpp +++ b/Runtime/Character/CSegIdList.cpp @@ -3,7 +3,7 @@ namespace metaforce { CSegIdList::CSegIdList(CInputStream& in) { - u32 count = in.readUint32Big(); + u32 count = in.ReadLong(); x0_list.reserve(count); for (u32 i = 0; i < count; ++i) x0_list.emplace_back(in); diff --git a/Runtime/Character/CSkinBank.cpp b/Runtime/Character/CSkinBank.cpp index 487a58875..ca9f42406 100644 --- a/Runtime/Character/CSkinBank.cpp +++ b/Runtime/Character/CSkinBank.cpp @@ -5,7 +5,7 @@ namespace metaforce { CSkinBank::CSkinBank(CInputStream& in) { - u32 boneCount = in.readUint32Big(); + u32 boneCount = in.ReadLong(); x0_segments.reserve(boneCount); for (u32 i = 0; i < boneCount; ++i) x0_segments.emplace_back(in); diff --git a/Runtime/Character/CSkinRules.cpp b/Runtime/Character/CSkinRules.cpp index dce9d3b2e..f05e1a21d 100644 --- a/Runtime/Character/CSkinRules.cpp +++ b/Runtime/Character/CSkinRules.cpp @@ -7,16 +7,21 @@ namespace metaforce { static u32 ReadCount(CInputStream& in) { - u32 result = in.readUint32Big(); + u32 result = in.ReadLong(); if (result == UINT32_MAX) { - return in.readUint32Big(); + return in.ReadLong(); + } + u8 junk[784]; + for (u32 i = 0; i < (result * 3); ++i) { + u32 iVar2 = ((result * 3) - i); + iVar2 = 192 < iVar2 ? 192 : iVar2; + in.Get(junk, iVar2 * 4); } - in.seek(s64(result) * 3); return result; } CSkinRules::CSkinRules(CInputStream& in) { - u32 weightCount = in.readUint32Big(); + u32 weightCount = in.ReadLong(); x0_bones.reserve(weightCount); for (int i = 0; i < weightCount; ++i) { x0_bones.emplace_back(in); @@ -51,7 +56,7 @@ CFactoryFnReturn FSkinRulesFactory(const SObjectTag& tag, CInputStream& in, cons auto StreamInSkinWeighting(CInputStream& in) { rstl::reserved_vector weights; - u32 weightCount = in.readUint32Big(); + u32 weightCount = in.ReadLong(); for (int i = 0; i < std::min(3u, weightCount); ++i) { weights.emplace_back(in); } @@ -62,5 +67,5 @@ auto StreamInSkinWeighting(CInputStream& in) { } CVirtualBone::CVirtualBone(CInputStream& in) -: x0_weights(StreamInSkinWeighting(in)), x1c_vertexCount(in.readUint32Big()) {} +: x0_weights(StreamInSkinWeighting(in)), x1c_vertexCount(in.ReadLong()) {} } // namespace metaforce diff --git a/Runtime/Character/CSkinRules.hpp b/Runtime/Character/CSkinRules.hpp index 109c9a783..732166a07 100644 --- a/Runtime/Character/CSkinRules.hpp +++ b/Runtime/Character/CSkinRules.hpp @@ -15,7 +15,7 @@ class CModel; struct SSkinWeighting { CSegId x0_id; float x4_weight; - explicit SSkinWeighting(CInputStream& in) : x0_id(in), x4_weight(in.readFloatBig()) {} + explicit SSkinWeighting(CInputStream& in) : x0_id(in), x4_weight(in.ReadFloat()) {} }; class CVirtualBone { diff --git a/Runtime/Character/CSoundPOINode.cpp b/Runtime/Character/CSoundPOINode.cpp index 53a2b3c1f..3f65d7c4b 100644 --- a/Runtime/Character/CSoundPOINode.cpp +++ b/Runtime/Character/CSoundPOINode.cpp @@ -11,7 +11,7 @@ CSoundPOINode::CSoundPOINode() , x40_maxDist(0.f) {} CSoundPOINode::CSoundPOINode(CInputStream& in) -: CPOINode(in), x38_sfxId(in.readUint32Big()), x3c_falloff(in.readFloatBig()), x40_maxDist(in.readFloatBig()) {} +: CPOINode(in), x38_sfxId(in.ReadLong()), x3c_falloff(in.ReadFloat()), x40_maxDist(in.ReadFloat()) {} CSoundPOINode::CSoundPOINode(std::string_view name, EPOIType a, const CCharAnimTime& time, u32 b, bool c, float d, u32 e, u32 f, u32 sfxId, float falloff, float maxDist) diff --git a/Runtime/Character/CTransition.cpp b/Runtime/Character/CTransition.cpp index db98cd867..358fb1745 100644 --- a/Runtime/Character/CTransition.cpp +++ b/Runtime/Character/CTransition.cpp @@ -3,9 +3,9 @@ namespace metaforce { CTransition::CTransition(CInputStream& in) -: x0_id(in.readUint32Big()) -, x4_animA(in.readUint32Big()) -, x8_animB(in.readUint32Big()) +: x0_id(in.ReadLong()) +, x4_animA(in.ReadLong()) +, x8_animB(in.ReadLong()) , xc_trans(CMetaTransFactory::CreateMetaTrans(in)) {} } // namespace metaforce diff --git a/Runtime/Collision/CAreaOctTree.cpp b/Runtime/Collision/CAreaOctTree.cpp index 5cf30f2a3..11804b718 100644 --- a/Runtime/Collision/CAreaOctTree.cpp +++ b/Runtime/Collision/CAreaOctTree.cpp @@ -538,14 +538,13 @@ CAreaOctTree::CAreaOctTree(const zeus::CAABox& aabb, Node::ETreeType treeType, c } std::unique_ptr CAreaOctTree::MakeFromMemory(const u8* buf, unsigned int size) { - athena::io::MemoryReader r(buf + 8, size - 8); - r.readUint32Big(); - r.readUint32Big(); - zeus::CAABox aabb; - aabb.readBoundingBoxBig(r); - Node::ETreeType nodeType = Node::ETreeType(r.readUint32Big()); - u32 treeSize = r.readUint32Big(); - const u8* cur = reinterpret_cast(buf) + 8 + r.position(); + CMemoryInStream r(buf + 8, size - 8, CMemoryInStream::EOwnerShip::NotOwned); + r.ReadLong(); + r.ReadLong(); + zeus::CAABox aabb = r.Get(); + Node::ETreeType nodeType = Node::ETreeType(r.ReadLong()); + u32 treeSize = r.ReadLong(); + const u8* cur = reinterpret_cast(buf) + 8 + r.GetReadPosition(); const u8* treeBuf = cur; cur += treeSize; diff --git a/Runtime/Collision/CCollidableOBBTreeGroup.cpp b/Runtime/Collision/CCollidableOBBTreeGroup.cpp index fcedbe3c4..8d59ccc5b 100644 --- a/Runtime/Collision/CCollidableOBBTreeGroup.cpp +++ b/Runtime/Collision/CCollidableOBBTreeGroup.cpp @@ -11,7 +11,7 @@ namespace metaforce { constexpr CCollisionPrimitive::Type sType(CCollidableOBBTreeGroup::SetStaticTableIndex, "CCollidableOBBTreeGroup"); CCollidableOBBTreeGroupContainer::CCollidableOBBTreeGroupContainer(CInputStream& in) { - const u32 treeCount = in.readUint32Big(); + const u32 treeCount = in.ReadLong(); x0_trees.reserve(treeCount); for (u32 i = 0; i < treeCount; i++) { diff --git a/Runtime/Collision/CCollisionEdge.cpp b/Runtime/Collision/CCollisionEdge.cpp index d7733136b..368a6c359 100644 --- a/Runtime/Collision/CCollisionEdge.cpp +++ b/Runtime/Collision/CCollisionEdge.cpp @@ -1,8 +1,9 @@ #include "Runtime/Collision/CCollisionEdge.hpp" +#include "Runtime/CInputStream.hpp" namespace metaforce { CCollisionEdge::CCollisionEdge(CInputStream& in) { - x0_index1 = in.readUint16Big(); - x2_index2 = in.readUint16Big(); + x0_index1 = in.ReadShort(); + x2_index2 = in.ReadShort(); } } // namespace metaforce diff --git a/Runtime/Collision/CCollisionResponseData.cpp b/Runtime/Collision/CCollisionResponseData.cpp index e99c8fbc1..cff473279 100644 --- a/Runtime/Collision/CCollisionResponseData.cpp +++ b/Runtime/Collision/CCollisionResponseData.cpp @@ -100,7 +100,7 @@ bool CCollisionResponseData::CheckAndAddDecalToResponse(FourCC clsId, CInputStre return true; } - const CAssetId id{u64(in.readUint32Big())}; + const CAssetId id = in.Get(); if (!id.IsValid()) { return true; } diff --git a/Runtime/Collision/COBBTree.cpp b/Runtime/Collision/COBBTree.cpp index fec3facd0..aa54e57b9 100644 --- a/Runtime/Collision/COBBTree.cpp +++ b/Runtime/Collision/COBBTree.cpp @@ -41,16 +41,16 @@ constexpr std::array DefaultSurfaceIndices{ }; /* This is exactly what retro did >.< */ -u32 verify_deaf_babe(CInputStream& in) { return in.readUint32Big(); } +u32 verify_deaf_babe(CInputStream& in) { return in.ReadLong(); } /* This is exactly what retro did >.< */ -u32 verify_version(CInputStream& in) { return in.readUint32Big(); } +u32 verify_version(CInputStream& in) { return in.ReadLong(); } } // Anonymous namespace COBBTree::COBBTree(CInputStream& in) : x0_magic(verify_deaf_babe(in)) , x4_version(verify_version(in)) -, x8_memsize(in.readUint32()) +, x8_memsize(in.ReadLong()) , x18_indexData(in) , x88_root(std::make_unique(in)) {} @@ -158,38 +158,38 @@ zeus::CAABox COBBTree::CalculateAABox(const zeus::CTransform& xf) const { } COBBTree::SIndexData::SIndexData(CInputStream& in) { - u32 count = in.readUint32Big(); + u32 count = in.ReadLong(); x0_materials.reserve(count); for (u32 i = 0; i < count; i++) { - x0_materials.emplace_back(in.readUint32Big()); + x0_materials.emplace_back(in.ReadLong()); } - count = in.readUint32Big(); + count = in.ReadLong(); for (u32 i = 0; i < count; i++) { - x10_vertMaterials.emplace_back(in.readUByte()); + x10_vertMaterials.emplace_back(in.ReadUint8()); } - count = in.readUint32Big(); + count = in.ReadLong(); for (u32 i = 0; i < count; i++) { - x20_edgeMaterials.emplace_back(in.readUByte()); + x20_edgeMaterials.emplace_back(in.ReadUint8()); } - count = in.readUint32Big(); + count = in.ReadLong(); for (u32 i = 0; i < count; i++) { - x30_surfaceMaterials.emplace_back(in.readUByte()); + x30_surfaceMaterials.emplace_back(in.ReadUint8()); } - count = in.readUint32Big(); + count = in.ReadLong(); for (u32 i = 0; i < count; i++) { x40_edges.emplace_back(in); } - count = in.readUint32Big(); + count = in.ReadLong(); for (u32 i = 0; i < count; i++) { - x50_surfaceIndices.emplace_back(in.readUint16Big()); + x50_surfaceIndices.emplace_back(in.ReadShort()); } - count = in.readUint32Big(); + count = in.ReadLong(); for (u32 i = 0; i < count; i++) { - x60_vertices.emplace_back(zeus::CVector3f::ReadBig(in)); + x60_vertices.emplace_back(in.Get()); } } @@ -202,8 +202,8 @@ COBBTree::CNode::CNode(const zeus::CTransform& xf, const zeus::CVector3f& point, , x48_leaf(std::move(leaf)) {} COBBTree::CNode::CNode(CInputStream& in) { - x0_obb = zeus::COBBox::ReadBig(in); - x3c_isLeaf = in.readBool(); + x0_obb = in.Get(); + x3c_isLeaf = in.ReadBool(); if (x3c_isLeaf) x48_leaf = std::make_unique(in); else { @@ -236,9 +236,9 @@ size_t COBBTree::CLeafData::GetMemoryUsage() const { } COBBTree::CLeafData::CLeafData(CInputStream& in) { - const u32 edgeCount = in.readUint32Big(); + const u32 edgeCount = in.ReadLong(); for (u32 i = 0; i < edgeCount; i++) { - x0_surface.emplace_back(in.readUint16Big()); + x0_surface.emplace_back(in.ReadShort()); } } diff --git a/Runtime/Graphics/CCubeModel.cpp b/Runtime/Graphics/CCubeModel.cpp index 184eba72d..dc151c453 100644 --- a/Runtime/Graphics/CCubeModel.cpp +++ b/Runtime/Graphics/CCubeModel.cpp @@ -253,16 +253,16 @@ void CCubeModel::MakeTexturesFromMats(const u8* ptr, std::vector(mem.readUint32Big()); - x18_nextSurface = reinterpret_cast(mem.readUint32Big()); - x1c_extraSize = mem.readUint32Big(); - x20_normal.readBig(mem); + CMemoryInStream mem(ptr, 10000, CMemoryInStream::EOwnerShip::NotOwned); // Oversized so we can read everything in + x0_center = mem.Get(); + xc_materialIndex = mem.ReadLong(); + x10_displayListSize = mem.ReadLong(); + x14_parent = reinterpret_cast(mem.ReadLong()); + x18_nextSurface = reinterpret_cast(mem.ReadLong()); + x1c_extraSize = mem.ReadLong(); + x20_normal = mem.Get(); if (x1c_extraSize > 0) { - x2c_bounds = zeus::CAABox::ReadBoundingBoxBig(mem); + x2c_bounds = mem.Get(); } } diff --git a/Runtime/Graphics/CGraphicsPalette.hpp b/Runtime/Graphics/CGraphicsPalette.hpp index 3c83d78b7..cdf2436cb 100644 --- a/Runtime/Graphics/CGraphicsPalette.hpp +++ b/Runtime/Graphics/CGraphicsPalette.hpp @@ -23,9 +23,9 @@ class CGraphicsPalette { public: explicit CGraphicsPalette(EPaletteFormat fmt, int count) : x0_fmt(fmt), x8_entryCount(count), xc_entries(new u16[count]) {} - explicit CGraphicsPalette(CInputStream& in) : x0_fmt(EPaletteFormat(in.readUint32Big())) { - u16 w = in.readUint16Big(); - u16 h = in.readUint16Big(); + explicit CGraphicsPalette(CInputStream& in) : x0_fmt(EPaletteFormat(in.ReadLong())) { + u16 w = in.ReadShort(); + u16 h = in.ReadShort(); x8_entryCount = w * h; /* GX Tlut init here */ diff --git a/Runtime/Graphics/CPVSAreaSet.cpp b/Runtime/Graphics/CPVSAreaSet.cpp index 085d0c8d5..cf51a1a2a 100644 --- a/Runtime/Graphics/CPVSAreaSet.cpp +++ b/Runtime/Graphics/CPVSAreaSet.cpp @@ -5,16 +5,16 @@ namespace metaforce { CPVSAreaSet::CPVSAreaSet(const u8* data, u32 len) { CMemoryInStream r(data, len); - x0_numFeatures = r.readUint32Big(); - x4_numLights = r.readUint32Big(); - x8_num2ndLights = r.readUint32Big(); - xc_numActors = r.readUint32Big(); - x10_leafSize = r.readUint32Big(); - x14_lightIndexCount = r.readUint32Big(); + x0_numFeatures = r.ReadLong(); + x4_numLights = r.ReadLong(); + x8_num2ndLights = r.ReadLong(); + xc_numActors = r.ReadLong(); + x10_leafSize = r.ReadLong(); + x14_lightIndexCount = r.ReadLong(); x18_entityIndex.reserve(xc_numActors); for (u32 i = 0; i < xc_numActors; ++i) - x18_entityIndex.push_back(r.readUint32Big()); - x1c_lightLeaves = data + r.position(); + x18_entityIndex.push_back(r.ReadLong()); + x1c_lightLeaves = data + r.GetReadPosition(); const u8* octreeData = x1c_lightLeaves + x14_lightIndexCount * x10_leafSize; x20_octree = CPVSVisOctree::MakePVSVisOctree(octreeData); } diff --git a/Runtime/Graphics/CPVSVisOctree.cpp b/Runtime/Graphics/CPVSVisOctree.cpp index 5f58e334a..643407584 100644 --- a/Runtime/Graphics/CPVSVisOctree.cpp +++ b/Runtime/Graphics/CPVSVisOctree.cpp @@ -7,11 +7,11 @@ namespace metaforce { CPVSVisOctree CPVSVisOctree::MakePVSVisOctree(const u8* data) { CMemoryInStream r(data, 68); - const zeus::CAABox aabb = zeus::CAABox::ReadBoundingBoxBig(r); - const u32 numObjects = r.readUint32Big(); - const u32 numLights = r.readUint32Big(); - r.readUint32Big(); - return CPVSVisOctree(aabb, numObjects, numLights, data + r.position()); + const zeus::CAABox aabb = r.Get(); + const u32 numObjects = r.ReadLong(); + const u32 numLights = r.ReadLong(); + r.ReadLong(); + return CPVSVisOctree(aabb, numObjects, numLights, data + r.GetReadPosition()); } CPVSVisOctree::CPVSVisOctree(const zeus::CAABox& aabb, u32 numObjects, u32 numLights, const u8* c) diff --git a/Runtime/Graphics/CTextureBoo.cpp b/Runtime/Graphics/CTextureBoo.cpp index 40832a6d1..b91255ecf 100644 --- a/Runtime/Graphics/CTextureBoo.cpp +++ b/Runtime/Graphics/CTextureBoo.cpp @@ -92,7 +92,7 @@ void CTexture::BuildI4FromGCN(CInputStream& in, aurora::zstring_view label) { for (int y = 0; y < std::min(h, 8); ++y) { RGBA8* target = targetMip + (baseY + y) * w + baseX; std::array source; - in.readBytesToBuf(source.data(), std::min(size_t(w) / 4, source.size())); + in.Get(source.data(), std::min(size_t(w) / 4, source.size())); for (size_t x = 0; x < std::min(w, 8); ++x) { target[x].r = Convert4To8(source[x / 2] >> ((x & 1) ? 0 : 4) & 0xf); target[x].g = target[x].r; @@ -132,7 +132,7 @@ void CTexture::BuildI8FromGCN(CInputStream& in, aurora::zstring_view label) { for (int y = 0; y < 4; ++y) { RGBA8* target = targetMip + (baseY + y) * w + baseX; std::array source; - in.readBytesToBuf(source.data(), source.size()); + in.Get(source.data(), source.size()); for (size_t x = 0; x < source.size(); ++x) { target[x].r = source[x]; target[x].g = source[x]; @@ -172,7 +172,7 @@ void CTexture::BuildIA4FromGCN(CInputStream& in, aurora::zstring_view label) { for (int y = 0; y < 4; ++y) { RGBA8* target = targetMip + (baseY + y) * w + baseX; std::array source; - in.readBytesToBuf(source.data(), source.size()); + in.Get(source.data(), source.size()); for (size_t x = 0; x < source.size(); ++x) { const u8 intensity = Convert4To8(source[x] >> 4 & 0xf); target[x].r = intensity; @@ -213,7 +213,7 @@ void CTexture::BuildIA8FromGCN(CInputStream& in, aurora::zstring_view label) { for (int y = 0; y < 4; ++y) { RGBA8* target = targetMip + (baseY + y) * w + baseX; std::array source; - in.readBytesToBuf(source.data(), sizeof(source)); + in.Get(reinterpret_cast(source.data()), sizeof(source)); for (size_t x = 0; x < source.size(); ++x) { const u8 intensity = source[x] >> 8; target[x].r = intensity; @@ -243,27 +243,27 @@ static std::vector DecodePalette(int numEntries, CInputStream& in) { enum class EPaletteType { IA8, RGB565, RGB5A3 }; - EPaletteType format = EPaletteType(in.readUint32Big()); - in.readUint32Big(); + EPaletteType format = EPaletteType(in.ReadLong()); + in.ReadLong(); switch (format) { case EPaletteType::IA8: { for (int e = 0; e < numEntries; ++e) { - u8 intensity = in.readUByte(); - u8 alpha = in.readUByte(); + u8 intensity = in.ReadUint8(); + u8 alpha = in.ReadUint8(); ret.push_back({intensity, intensity, intensity, alpha}); } break; } case EPaletteType::RGB565: { for (int e = 0; e < numEntries; ++e) { - u16 texel = in.readUint16Big(); + u16 texel = in.ReadShort(); ret.push_back({Convert5To8(texel >> 11 & 0x1f), Convert6To8(texel >> 5 & 0x3f), Convert5To8(texel & 0x1f), 0xff}); } break; } case EPaletteType::RGB5A3: { for (int e = 0; e < numEntries; ++e) { - u16 texel = in.readUint16Big(); + u16 texel = in.ReadShort(); if (texel & 0x8000) { ret.push_back( {Convert5To8(texel >> 10 & 0x1f), Convert5To8(texel >> 5 & 0x1f), Convert5To8(texel & 0x1f), 0xff}); @@ -296,7 +296,7 @@ void CTexture::BuildC4FromGCN(CInputStream& in, aurora::zstring_view label) { for (int y = 0; y < 8; ++y) { RGBA8* target = targetMip + (baseY + y) * w + baseX; std::array source; - in.readBytesToBuf(source.data(), source.size()); + in.Get(source.data(), source.size()); for (size_t x = 0; x < 8; ++x) { target[x] = palette[source[x / 2] >> ((x & 1) ? 0 : 4) & 0xf]; } @@ -334,7 +334,7 @@ void CTexture::BuildC8FromGCN(CInputStream& in, aurora::zstring_view label) { for (int y = 0; y < 4; ++y) { RGBA8* target = targetMip + (baseY + y) * w + baseX; std::array source; - in.readBytesToBuf(source.data(), source.size()); + in.Get(source.data(), source.size()); for (size_t x = 0; x < source.size(); ++x) { target[x] = palette[source[x]]; } @@ -375,7 +375,7 @@ void CTexture::BuildRGB565FromGCN(CInputStream& in, aurora::zstring_view label) for (int y = 0; y < 4; ++y) { RGBA8* target = targetMip + (baseY + y) * w + baseX; for (size_t x = 0; x < 4; ++x) { - const u16 texel = in.readUint16Big(); + const u16 texel = in.ReadShort(); target[x].r = Convert5To8(texel >> 11 & 0x1f); target[x].g = Convert6To8(texel >> 5 & 0x3f); target[x].b = Convert5To8(texel & 0x1f); @@ -414,7 +414,7 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in, aurora::zstring_view label) for (int y = 0; y < 4; ++y) { RGBA8* target = targetMip + (baseY + y) * w + baseX; for (size_t x = 0; x < 4; ++x) { - const u16 texel = in.readUint16Big(); + const u16 texel = in.ReadShort(); if ((texel & 0x8000) != 0) { target[x].r = Convert5To8(texel >> 10 & 0x1f); target[x].g = Convert5To8(texel >> 5 & 0x1f); @@ -461,7 +461,7 @@ void CTexture::BuildRGBA8FromGCN(CInputStream& in, aurora::zstring_view label) { for (int y = 0; y < 4; ++y) { RGBA8* target = targetMip + (baseY + y) * w + baseX; std::array source; - in.readBytesToBuf(source.data(), source.size()); + in.Get(source.data(), source.size()); for (size_t x = 0; x < 4; ++x) { if (c != 0) { target[x].g = source[x * 2]; @@ -505,7 +505,7 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in, aurora::zstring_view label) { for (int y = 0; y < 2; ++y) { DXT1Block* target = targetMip + (baseY + y) * w + baseX; std::array source; - in.readBytesToBuf(source.data(), sizeof(source)); + in.Get(reinterpret_cast(source.data()), sizeof(source)); for (size_t x = 0; x < source.size(); ++x) { target[x].color1 = hecl::SBig(source[x].color1); target[x].color2 = hecl::SBig(source[x].color2); @@ -715,11 +715,11 @@ CTexture::CTexture(ETexelFormat fmt, s16 w, s16 h, s32 mips) : x0_fmt(fmt), x4_w CTexture::CTexture(std::unique_ptr&& in, u32 length, bool otex, const CTextureInfo* inf, CAssetId id) : m_textureInfo(inf) { std::unique_ptr owned = std::move(in); - athena::io::MemoryReader r(owned.get(), length); - x0_fmt = ETexelFormat(r.readUint32Big()); - x4_w = r.readUint16Big(); - x6_h = r.readUint16Big(); - x8_mips = r.readUint32Big(); + CMemoryInStream r(owned.get(), length, CMemoryInStream::EOwnerShip::NotOwned); + x0_fmt = ETexelFormat(r.ReadLong()); + x4_w = r.ReadShort(); + x6_h = r.ReadShort(); + x8_mips = r.ReadLong(); auto label = fmt::format(FMT_STRING("TXTR {:08X} ({})"), id.Value(), TextureFormatString(x0_fmt)); switch (x0_fmt) { diff --git a/Runtime/GuiSys/CAuiEnergyBarT01.cpp b/Runtime/GuiSys/CAuiEnergyBarT01.cpp index e01285c93..d255a729b 100644 --- a/Runtime/GuiSys/CAuiEnergyBarT01.cpp +++ b/Runtime/GuiSys/CAuiEnergyBarT01.cpp @@ -142,7 +142,7 @@ void CAuiEnergyBarT01::SetMaxEnergy(float maxEnergy) { std::shared_ptr CAuiEnergyBarT01::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - CAssetId tex = in.readUint32Big(); + CAssetId tex = in.ReadLong(); std::shared_ptr ret = std::make_shared(parms, sp, tex); ret->ParseBaseInfo(frame, in, parms); return ret; diff --git a/Runtime/GuiSys/CAuiImagePane.cpp b/Runtime/GuiSys/CAuiImagePane.cpp index 5c86d1bc7..43252d022 100644 --- a/Runtime/GuiSys/CAuiImagePane.cpp +++ b/Runtime/GuiSys/CAuiImagePane.cpp @@ -17,17 +17,17 @@ CAuiImagePane::CAuiImagePane(const CGuiWidgetParms& parms, CSimplePool* sp, CAss std::shared_ptr CAuiImagePane::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - in.readUint32Big(); - in.readUint32Big(); - in.readUint32Big(); - u32 coordCount = in.readUint32Big(); + in.ReadLong(); + in.ReadLong(); + in.ReadLong(); + u32 coordCount = in.ReadLong(); rstl::reserved_vector coords; for (u32 i = 0; i < coordCount; ++i) - coords.push_back(zeus::CVector3f::ReadBig(in)); - u32 uvCount = in.readUint32Big(); + coords.push_back(in.Get()); + u32 uvCount = in.ReadLong(); rstl::reserved_vector uvs; for (u32 i = 0; i < uvCount; ++i) - uvs.push_back(zeus::CVector2f::ReadBig(in)); + uvs.push_back(in.Get()); std::shared_ptr ret = std::make_shared(parms, sp, -1, -1, std::move(coords), std::move(uvs), true); ret->ParseBaseInfo(frame, in, parms); diff --git a/Runtime/GuiSys/CAuiMeter.cpp b/Runtime/GuiSys/CAuiMeter.cpp index 5addf96dd..68e4c08d8 100644 --- a/Runtime/GuiSys/CAuiMeter.cpp +++ b/Runtime/GuiSys/CAuiMeter.cpp @@ -89,10 +89,10 @@ bool CAuiMeter::AddWorkerWidget(CGuiWidget* worker) { std::shared_ptr CAuiMeter::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - in.readBool(); - bool noRoundUp = in.readBool(); - u32 maxCapacity = in.readUint32Big(); - u32 workerCount = in.readUint32Big(); + in.ReadBool(); + bool noRoundUp = in.ReadBool(); + u32 maxCapacity = in.ReadLong(); + u32 workerCount = in.ReadLong(); std::shared_ptr ret = std::make_shared(parms, noRoundUp, maxCapacity, workerCount); ret->ParseBaseInfo(frame, in, parms); return ret; diff --git a/Runtime/GuiSys/CGuiCamera.cpp b/Runtime/GuiSys/CGuiCamera.cpp index b5ade0c7f..b173456df 100644 --- a/Runtime/GuiSys/CGuiCamera.cpp +++ b/Runtime/GuiSys/CGuiCamera.cpp @@ -38,24 +38,24 @@ void CGuiCamera::Draw(const CGuiWidgetDrawParms& parms) { std::shared_ptr CGuiCamera::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - EProjection proj = EProjection(in.readUint32Big()); + EProjection proj = EProjection(in.ReadLong()); std::shared_ptr ret = {}; switch (proj) { case EProjection::Perspective: { - float fov = in.readFloatBig(); - float aspect = in.readFloatBig(); - float znear = in.readFloatBig(); - float zfar = in.readFloatBig(); + float fov = in.ReadFloat(); + float aspect = in.ReadFloat(); + float znear = in.ReadFloat(); + float zfar = in.ReadFloat(); ret = std::make_shared(parms, fov, aspect, znear, zfar); break; } case EProjection::Orthographic: { - float left = in.readFloatBig(); - float right = in.readFloatBig(); - float top = in.readFloatBig(); - float bottom = in.readFloatBig(); - float znear = in.readFloatBig(); - float zfar = in.readFloatBig(); + float left = in.ReadFloat(); + float right = in.ReadFloat(); + float top = in.ReadFloat(); + float bottom = in.ReadFloat(); + float znear = in.ReadFloat(); + float zfar = in.ReadFloat(); ret = std::make_shared(parms, left, right, top, bottom, znear, zfar); break; } diff --git a/Runtime/GuiSys/CGuiFrame.cpp b/Runtime/GuiSys/CGuiFrame.cpp index fb93c4887..ce3bf264e 100644 --- a/Runtime/GuiSys/CGuiFrame.cpp +++ b/Runtime/GuiSys/CGuiFrame.cpp @@ -164,11 +164,11 @@ void CGuiFrame::Initialize() { } void CGuiFrame::LoadWidgetsInGame(CInputStream& in, CSimplePool* sp) { - u32 count = in.readUint32Big(); + u32 count = in.ReadLong(); x2c_widgets.reserve(count); for (u32 i = 0; i < count; ++i) { - DataSpec::DNAFourCC type; - type.read(in); + FourCC type; + in.Get(reinterpret_cast(&type), 4); std::shared_ptr widget = CGuiSys::CreateWidgetInGame(type.toUint32(), in, this, sp); switch (widget->GetWidgetTypeID().toUint32()) { case SBIG('CAMR'): @@ -263,10 +263,10 @@ void CGuiFrame::ResetMouseState() { } std::unique_ptr CGuiFrame::CreateFrame(CAssetId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp) { - in.readInt32Big(); - int a = in.readInt32Big(); - int b = in.readInt32Big(); - int c = in.readInt32Big(); + in.ReadLong(); + int a = in.ReadLong(); + int b = in.ReadLong(); + int c = in.ReadLong(); std::unique_ptr ret = std::make_unique(frmeId, sys, a, b, c, sp); ret->LoadWidgetsInGame(in, sp); diff --git a/Runtime/GuiSys/CGuiGroup.cpp b/Runtime/GuiSys/CGuiGroup.cpp index 105387c3d..ac8e31d8a 100644 --- a/Runtime/GuiSys/CGuiGroup.cpp +++ b/Runtime/GuiSys/CGuiGroup.cpp @@ -43,8 +43,8 @@ void CGuiGroup::OnActiveChange() { std::shared_ptr CGuiGroup::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - s16 defaultWorker = in.readInt16Big(); - bool b = in.readBool(); + s16 defaultWorker = in.ReadInt16(); + bool b = in.ReadBool(); std::shared_ptr ret = std::make_shared(parms, defaultWorker, b); ret->ParseBaseInfo(frame, in, parms); return ret; diff --git a/Runtime/GuiSys/CGuiLight.cpp b/Runtime/GuiSys/CGuiLight.cpp index c65166b55..d326f027e 100644 --- a/Runtime/GuiSys/CGuiLight.cpp +++ b/Runtime/GuiSys/CGuiLight.cpp @@ -50,19 +50,19 @@ void CGuiLight::SetIsVisible(bool vis) { std::shared_ptr CGuiLight::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - ELightType tp = ELightType(in.readUint32Big()); - float distC = in.readFloatBig(); - float distL = in.readFloatBig(); - float distQ = in.readFloatBig(); - float angC = in.readFloatBig(); - float angL = in.readFloatBig(); - float angQ = in.readFloatBig(); - u32 lightId = in.readUint32Big(); + ELightType tp = ELightType(in.ReadLong()); + float distC = in.ReadFloat(); + float distL = in.ReadFloat(); + float distQ = in.ReadFloat(); + float angC = in.ReadFloat(); + float angL = in.ReadFloat(); + float angQ = in.ReadFloat(); + u32 lightId = in.ReadLong(); std::shared_ptr ret = {}; switch (tp) { case ELightType::Spot: { - float cutoff = in.readFloatBig(); + float cutoff = in.ReadFloat(); CLight lt = CLight::BuildSpot(zeus::skZero3f, zeus::skZero3f, parms.x10_color, cutoff); lt.SetAttenuation(distC, distL, distQ); lt.SetAngleAttenuation(angC, angL, angQ); diff --git a/Runtime/GuiSys/CGuiModel.cpp b/Runtime/GuiSys/CGuiModel.cpp index a397356bf..a2b67640e 100644 --- a/Runtime/GuiSys/CGuiModel.cpp +++ b/Runtime/GuiSys/CGuiModel.cpp @@ -123,9 +123,9 @@ bool CGuiModel::TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2f& std::shared_ptr CGuiModel::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - CAssetId model = in.readUint32Big(); - in.readUint32Big(); - u32 lightMask = in.readUint32Big(); + CAssetId model = in.Get(); + in.ReadLong(); + u32 lightMask = in.ReadLong(); std::shared_ptr ret = std::make_shared(parms, sp, model, lightMask, true); ret->ParseBaseInfo(frame, in, parms); diff --git a/Runtime/GuiSys/CGuiPane.cpp b/Runtime/GuiSys/CGuiPane.cpp index 09b683af7..446d78002 100644 --- a/Runtime/GuiSys/CGuiPane.cpp +++ b/Runtime/GuiSys/CGuiPane.cpp @@ -54,8 +54,8 @@ void CGuiPane::WriteData(COutputStream& out, bool flag) const {} std::shared_ptr CGuiPane::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - zeus::CVector2f dim = zeus::CVector2f::ReadBig(in); - zeus::CVector3f scaleCenter = zeus::CVector3f::ReadBig(in); + zeus::CVector2f dim = in.Get(); + zeus::CVector3f scaleCenter = in.Get(); std::shared_ptr ret = std::make_shared(parms, dim, scaleCenter); ret->ParseBaseInfo(frame, in, parms); return ret; diff --git a/Runtime/GuiSys/CGuiSliderGroup.cpp b/Runtime/GuiSys/CGuiSliderGroup.cpp index df7aef83c..048276848 100644 --- a/Runtime/GuiSys/CGuiSliderGroup.cpp +++ b/Runtime/GuiSys/CGuiSliderGroup.cpp @@ -158,10 +158,10 @@ CGuiWidget* CGuiSliderGroup::GetWorkerWidget(int id) const { std::shared_ptr CGuiSliderGroup::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - float min = in.readFloatBig(); - float max = in.readFloatBig(); - float cur = in.readFloatBig(); - float increment = in.readFloatBig(); + float min = in.ReadFloat(); + float max = in.ReadFloat(); + float cur = in.ReadFloat(); + float increment = in.ReadFloat(); std::shared_ptr ret = std::make_shared(parms, min, max, cur, increment); ret->ParseBaseInfo(frame, in, parms); diff --git a/Runtime/GuiSys/CGuiTableGroup.cpp b/Runtime/GuiSys/CGuiTableGroup.cpp index 671188df9..19a3e152d 100644 --- a/Runtime/GuiSys/CGuiTableGroup.cpp +++ b/Runtime/GuiSys/CGuiTableGroup.cpp @@ -207,21 +207,21 @@ void CGuiTableGroup::DoIncrement() { std::shared_ptr CGuiTableGroup::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - int elementCount = in.readInt16Big(); - in.readInt16Big(); - in.readUint32Big(); - int defaultSel = in.readInt16Big(); - in.readInt16Big(); - bool selectWraparound = in.readBool(); - in.readBool(); - in.readFloatBig(); - in.readFloatBig(); - in.readBool(); - in.readFloatBig(); - in.readInt16Big(); - in.readInt16Big(); - in.readInt16Big(); - in.readInt16Big(); + int elementCount = in.ReadInt16(); + in.ReadInt16(); + in.ReadLong(); + int defaultSel = in.ReadInt16(); + in.ReadInt16(); + bool selectWraparound = in.ReadBool(); + in.ReadBool(); + in.ReadFloat(); + in.ReadFloat(); + in.ReadBool(); + in.ReadFloat(); + in.ReadInt16(); + in.ReadInt16(); + in.ReadInt16(); + in.ReadInt16(); std::shared_ptr ret = std::make_shared(parms, elementCount, defaultSel, selectWraparound); ret->ParseBaseInfo(frame, in, parms); diff --git a/Runtime/GuiSys/CGuiTextPane.cpp b/Runtime/GuiSys/CGuiTextPane.cpp index 4a5c6ebaa..9667c6395 100644 --- a/Runtime/GuiSys/CGuiTextPane.cpp +++ b/Runtime/GuiSys/CGuiTextPane.cpp @@ -135,20 +135,18 @@ bool CGuiTextPane::TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2 std::shared_ptr CGuiTextPane::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { const CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - const zeus::CVector2f dim = zeus::CVector2f::ReadBig(in); - const zeus::CVector3f vec = zeus::CVector3f::ReadBig(in); - const u32 fontId = in.readUint32Big(); - const bool wordWrap = in.readBool(); - const bool horizontal = in.readBool(); - const auto justification = EJustification(in.readUint32Big()); - const auto vJustification = EVerticalJustification(in.readUint32Big()); + const zeus::CVector2f dim = in.Get(); + const zeus::CVector3f vec = in.Get(); + const CAssetId fontId = in.Get(); + const bool wordWrap = in.ReadBool(); + const bool horizontal = in.ReadBool(); + const auto justification = EJustification(in.ReadLong()); + const auto vJustification = EVerticalJustification(in.ReadLong()); const CGuiTextProperties props(wordWrap, horizontal, justification, vJustification); - zeus::CColor fontCol; - fontCol.readRGBABig(in); - zeus::CColor outlineCol; - outlineCol.readRGBABig(in); - const int extentX = static_cast(in.readFloatBig()); - const int extentY = static_cast(in.readFloatBig()); + const zeus::CColor fontCol = in.Get(); + const zeus::CColor outlineCol = in.Get(); + const int extentX = static_cast(in.ReadFloat()); + const int extentY = static_cast(in.ReadFloat()); auto ret = std::make_shared(parms, sp, dim, vec, fontId, props, fontCol, outlineCol, extentX, extentY); ret->ParseBaseInfo(frame, in, parms); ret->InitializeBuffers(); diff --git a/Runtime/GuiSys/CGuiWidget.cpp b/Runtime/GuiSys/CGuiWidget.cpp index 775be6e3b..b13a9d33e 100644 --- a/Runtime/GuiSys/CGuiWidget.cpp +++ b/Runtime/GuiSys/CGuiWidget.cpp @@ -24,18 +24,17 @@ CGuiWidget::CGuiWidget(const CGuiWidgetParms& parms) } CGuiWidget::CGuiWidgetParms CGuiWidget::ReadWidgetHeader(CGuiFrame* frame, CInputStream& in) { - std::string name = in.readString(-1); + std::string name = in.Get(); s16 selfId = frame->GetWidgetIdDB().AddWidget(name); - std::string parent = in.readString(-1); + std::string parent = in.Get(); s16 parentId = frame->GetWidgetIdDB().AddWidget(parent); - bool useAnimController = in.readBool(); - bool defaultVis = in.readBool(); - bool defaultActive = in.readBool(); - bool cullFaces = in.readBool(); - zeus::CColor color; - color.readRGBABig(in); - EGuiModelDrawFlags df = EGuiModelDrawFlags(in.readUint32Big()); + bool useAnimController = in.ReadBool(); + bool defaultVis = in.ReadBool(); + bool defaultActive = in.ReadBool(); + bool cullFaces = in.ReadBool(); + zeus::CColor color = in.Get(); + EGuiModelDrawFlags df = EGuiModelDrawFlags(in.ReadLong()); return CGuiWidget::CGuiWidgetParms(frame, useAnimController, selfId, parentId, defaultVis, defaultActive, cullFaces, color, df, true, false, std::move(name)); @@ -52,17 +51,17 @@ void CGuiWidget::Initialize() {} void CGuiWidget::ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWidgetParms& parms) { CGuiWidget* parent = frame->FindWidget(parms.x8_parentId); - bool isWorker = in.readBool(); + bool isWorker = in.ReadBool(); if (isWorker) - xb4_workerId = in.readInt16Big(); - zeus::CVector3f trans = zeus::CVector3f::ReadBig(in); - zeus::CMatrix3f orient = zeus::CMatrix3f::ReadBig(in); + xb4_workerId = in.ReadInt16(); + zeus::CVector3f trans = in.Get(); + zeus::CMatrix3f orient = in.Get(); x74_transform = zeus::CTransform(orient, trans); m_initTransform = x74_transform; ReapplyXform(); - (void)zeus::CVector3f::ReadBig(in); // Unused - in.readUint32Big(); - in.readUint16Big(); + in.Get(); // Unused + in.ReadLong(); + in.ReadShort(); if (isWorker) { if (!parent->AddWorkerWidget(this)) { Log.report(logvisor::Warning, diff --git a/Runtime/GuiSys/CRasterFont.cpp b/Runtime/GuiSys/CRasterFont.cpp index 53e1d46b4..e04114745 100644 --- a/Runtime/GuiSys/CRasterFont.cpp +++ b/Runtime/GuiSys/CRasterFont.cpp @@ -10,61 +10,61 @@ namespace metaforce { CRasterFont::CRasterFont(metaforce::CInputStream& in, metaforce::IObjectStore& store) { u32 magic = 0; - in.readBytesToBuf(&magic, 4); + in.Get(reinterpret_cast(&magic), 4); if (magic != SBIG('FONT')) return; - u32 version = in.readUint32Big(); - x4_monoWidth = in.readUint32Big(); - x8_monoHeight = in.readUint32Big(); + u32 version = in.ReadLong(); + x4_monoWidth = in.ReadLong(); + x8_monoHeight = in.ReadLong(); if (version >= 1) - x8c_baseline = in.readUint32Big(); + x8c_baseline = in.ReadLong(); else x8c_baseline = x8_monoHeight; if (version >= 2) - x90_lineMargin = in.readUint32Big(); + x90_lineMargin = in.ReadLong(); - bool tmp1 = in.readBool(); - bool tmp2 = in.readBool(); + bool tmp1 = in.ReadBool(); + bool tmp2 = in.ReadBool(); - u32 tmp3 = in.readUint32Big(); - u32 tmp4 = in.readUint32Big(); - std::string name = in.readString(); - u32 txtrId = (version == 5 ? in.readUint64Big() : in.readUint32Big()); + u32 tmp3 = in.ReadLong(); + u32 tmp4 = in.ReadLong(); + std::string name = in.Get(); + u32 txtrId = (version == 5 ? in.ReadLongLong() : in.ReadLong()); x30_fontInfo = CFontInfo(tmp1, tmp2, tmp3, tmp4, name.c_str()); x80_texture = store.GetObj({FOURCC('TXTR'), txtrId}); - x2c_mode = CTexture::EFontType(in.readUint32Big()); + x2c_mode = CTexture::EFontType(in.ReadLong()); - u32 glyphCount = in.readUint32Big(); + u32 glyphCount = in.ReadLong(); xc_glyphs.reserve(glyphCount); for (u32 i = 0; i < glyphCount; ++i) { - char16_t chr = in.readUint16Big(); - float startU = in.readFloatBig(); - float startV = in.readFloatBig(); - float endU = in.readFloatBig(); - float endV = in.readFloatBig(); + char16_t chr = in.ReadShort(); + float startU = in.ReadFloat(); + float startV = in.ReadFloat(); + float endU = in.ReadFloat(); + float endV = in.ReadFloat(); s32 layer = 0; s32 a, b, c, cellWidth, cellHeight, baseline, kernStart; if (version < 4) { - a = in.readInt32Big(); - b = in.readInt32Big(); - c = in.readInt32Big(); - cellWidth = in.readInt32Big(); - cellHeight = in.readInt32Big(); - baseline = in.readInt32Big(); - kernStart = in.readInt32Big(); + a = in.ReadInt32(); + b = in.ReadInt32(); + c = in.ReadInt32(); + cellWidth = in.ReadInt32(); + cellHeight = in.ReadInt32(); + baseline = in.ReadInt32(); + kernStart = in.ReadInt32(); } else { - layer = in.readByte(); - a = in.readByte(); - b = in.readByte(); - c = in.readByte(); - cellWidth = in.readByte(); - cellHeight = in.readByte(); - baseline = in.readByte(); - kernStart = in.readInt16Big(); + layer = in.ReadInt8(); + a = in.ReadInt8(); + b = in.ReadInt8(); + c = in.ReadInt8(); + cellWidth = in.ReadInt8(); + cellHeight = in.ReadInt8(); + baseline = in.ReadInt8(); + kernStart = in.ReadInt16(); } xc_glyphs.emplace_back( chr, CGlyph(a, b, c, startU, startV, endU, endV, cellWidth, cellHeight, baseline, kernStart, layer)); @@ -72,13 +72,13 @@ CRasterFont::CRasterFont(metaforce::CInputStream& in, metaforce::IObjectStore& s std::sort(xc_glyphs.begin(), xc_glyphs.end(), [=](auto& a, auto& b) -> bool { return a.first < b.first; }); - u32 kernCount = in.readUint32Big(); + u32 kernCount = in.ReadLong(); x1c_kerning.reserve(kernCount); for (u32 i = 0; i < kernCount; ++i) { - char16_t first = in.readUint16Big(); - char16_t second = in.readUint16Big(); - s32 howMuch = in.readInt32Big(); + char16_t first = in.ReadShort(); + char16_t second = in.ReadShort(); + s32 howMuch = in.ReadInt32(); x1c_kerning.emplace_back(first, second, howMuch); } diff --git a/Runtime/GuiSys/CStringTable.cpp b/Runtime/GuiSys/CStringTable.cpp index c35914d73..eacefba90 100644 --- a/Runtime/GuiSys/CStringTable.cpp +++ b/Runtime/GuiSys/CStringTable.cpp @@ -1,9 +1,11 @@ #include "Runtime/GuiSys/CStringTable.hpp" -#include - +#include "Runtime/CBasics.hpp" +#include "Runtime/CInputStream.hpp" #include "Runtime/CToken.hpp" +#include + namespace metaforce { namespace { constexpr std::array languages{ @@ -16,14 +18,15 @@ FourCC CStringTable::mCurrentLanguage = languages[0]; CStringTable::CStringTable(CInputStream& in) { LoadStringTable(in); } void CStringTable::LoadStringTable(CInputStream& in) { - in.readUint32Big(); - in.readUint32Big(); - u32 langCount = in.readUint32Big(); - x0_stringCount = in.readUint32Big(); + in.ReadLong(); + in.ReadLong(); + u32 langCount = in.ReadLong(); + x0_stringCount = in.ReadLong(); std::vector> langOffsets; for (u32 i = 0; i < langCount; ++i) { - FourCC fcc(in.readUint32()); - u32 off = in.readUint32Big(); + FourCC fcc; + in.Get(reinterpret_cast(&fcc), 4); + u32 off = in.ReadLong(); langOffsets.emplace_back(fcc, off); } @@ -45,21 +48,26 @@ void CStringTable::LoadStringTable(CInputStream& in) { if (offset == UINT32_MAX) offset = langOffsets[0].second; - in.seek(offset); + for (u32 i = 0; i < offset; ++i) { + in.ReadChar(); + } - u32 dataLen = in.readUint32Big(); + u32 dataLen = in.ReadLong(); m_bufLen = dataLen; x4_data.reset(new u8[dataLen]); - in.readUBytesToBuf(x4_data.get(), dataLen); + in.Get(x4_data.get(), dataLen); +#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__ u32* off = reinterpret_cast(x4_data.get()); - for (u32 i = 0; i < x0_stringCount; ++i, ++off) - *off = SBig(*off); + for (u32 i = 0; i < x0_stringCount; ++i, ++off) { + *off = CBasics::SwapBytes(*off); + } for (u32 i = x0_stringCount * 4; i < dataLen; i += 2) { u16* chr = reinterpret_cast(x4_data.get() + i); - *chr = SBig(*chr); + *chr = CBasics::SwapBytes(*chr); } +#endif } const char16_t* CStringTable::GetString(s32 str) const { diff --git a/Runtime/GuiSys/CStringTable.hpp b/Runtime/GuiSys/CStringTable.hpp index d122958d3..d500270da 100644 --- a/Runtime/GuiSys/CStringTable.hpp +++ b/Runtime/GuiSys/CStringTable.hpp @@ -10,7 +10,7 @@ class CStringTable { static FourCC mCurrentLanguage; u32 x0_stringCount = 0; std::unique_ptr x4_data; - u32 m_bufLen; + u32 m_bufLen = 0; public: explicit CStringTable(CInputStream& in); diff --git a/Runtime/IOStreams.cpp b/Runtime/IOStreams.cpp index da890cd47..4ded1d7a4 100644 --- a/Runtime/IOStreams.cpp +++ b/Runtime/IOStreams.cpp @@ -1,140 +1,96 @@ #include "Runtime/IOStreams.hpp" -#include +#include namespace metaforce { - -#define DUMP_BITS 0 - -#if DUMP_BITS -static void PrintBinary(u32 val, u32 count) { - for (u32 i = 0; i < count; ++i) { - fmt::print(FMT_STRING("{}"), (val >> (count - i - 1)) & 0x1); - } +template <> +zeus::CVector2f cinput_stream_helper(CInputStream& in) { + zeus::CVector2f ret; + ret.x() = in.ReadFloat(); + ret.y() = in.ReadFloat(); + return ret; } -#endif - -/*! - * \brief CBitStreamReader::ReadBit - * Reads and decodes an encoded value from a bitstream. - * \param bitCount How many bits to read - * \return s32 The encoded value - */ -s32 CBitStreamReader::ReadEncoded(u32 bitCount) { -#if DUMP_BITS - const auto pos = position(); - const auto boff = x20_bitOffset; -#endif - - u32 ret = 0; - const s32 shiftAmt = x20_bitOffset - s32(bitCount); - if (shiftAmt < 0) { - /* OR in remaining bits of cached value */ - u32 mask = bitCount == 32 ? UINT32_MAX : ((1U << bitCount) - 1); - ret |= (x1c_val << u32(-shiftAmt)) & mask; - - /* Load in exact number of bytes remaining */ - auto loadDiv = std::div(-shiftAmt, 8); - if (loadDiv.rem) - ++loadDiv.quot; - readUBytesToBuf(reinterpret_cast(&x1c_val) + 4 - loadDiv.quot, loadDiv.quot); - x1c_val = hecl::SBig(x1c_val); - - /* New bit offset */ - x20_bitOffset = loadDiv.quot * 8 + shiftAmt; - - /* OR in next bits */ - mask = (1U << u32(-shiftAmt)) - 1; - ret |= (x1c_val >> x20_bitOffset) & mask; - } else { - /* OR in bits of cached value */ - const u32 mask = bitCount == 32 ? UINT32_MAX : ((1U << bitCount) - 1); - ret |= (x1c_val >> u32(shiftAmt)) & mask; - - /* New bit offset */ - x20_bitOffset -= bitCount; - } - -#if DUMP_BITS - std::fputs("READ ", stdout); - PrintBinary(ret, bitCount); - fmt::print(FMT_STRING(" {} {}\n"), pos, boff); -#endif - +template <> +zeus::CVector3f cinput_stream_helper(CInputStream& in) { + zeus::CVector3f ret; + ret.x() = in.ReadFloat(); + ret.y() = in.ReadFloat(); + ret.z() = in.ReadFloat(); + return ret; +} +template <> +zeus::CVector4f cinput_stream_helper(CInputStream& in) { + zeus::CVector4f ret; + ret.x() = in.ReadFloat(); + ret.y() = in.ReadFloat(); + ret.z() = in.ReadFloat(); + ret.w() = in.ReadFloat(); return ret; } -void CBitStreamWriter::WriteEncoded(u32 val, u32 bitCount) { -#if DUMP_BITS - std::fputs("WRITE ", stdout); - PrintBinary(val, bitCount); - fmt::print(FMT_STRING(" {} {}\n"), position(), x18_bitOffset); -#endif - - const s32 shiftAmt = x18_bitOffset - s32(bitCount); - if (shiftAmt < 0) { - /* OR remaining bits to cached value */ - const u32 mask = (1U << x18_bitOffset) - 1; - x14_val |= (val >> u32(-shiftAmt)) & mask; - - /* Write out 32-bits */ - x14_val = hecl::SBig(x14_val); - writeBytes(&x14_val, sizeof(x14_val)); - - /* Cache remaining bits */ - x18_bitOffset = 0x20 + shiftAmt; - x14_val = val << x18_bitOffset; - } else { - /* OR bits to cached value */ - const u32 mask = bitCount == 32 ? UINT32_MAX : ((1U << bitCount) - 1); - x14_val |= (val & mask) << u32(shiftAmt); - - /* New bit offset */ - x18_bitOffset -= bitCount; - } +template <> +zeus::CQuaternion cinput_stream_helper(CInputStream& in) { + zeus::CQuaternion ret; + ret.w() = in.ReadFloat(); + ret.x() = in.ReadFloat(); + ret.y() = in.ReadFloat(); + ret.z() = in.ReadFloat(); + return ret; } -void CBitStreamWriter::Flush() { - if (x18_bitOffset >= 0x20) { - return; - } - - auto pos = std::div(0x20 - s32(x18_bitOffset), 8); - if (pos.rem != 0) { - ++pos.quot; - } - - x14_val = hecl::SBig(x14_val); - writeBytes(&x14_val, pos.quot); - x18_bitOffset = 0x20; - x14_val = 0; +template <> +zeus::CAABox cinput_stream_helper(CInputStream& in) { + zeus::CAABox ret; + ret.min = in.Get(); + ret.max = in.Get(); + return ret; } -CZipInputStream::CZipInputStream(std::unique_ptr&& strm) -: x24_compBuf(new u8[4096]), x28_strm(std::move(strm)) { - x30_zstrm.next_in = x24_compBuf.get(); - x30_zstrm.avail_in = 0; - x30_zstrm.zalloc = [](void*, u32 c, u32 n) -> void* { return new u8[size_t{c} * size_t{n}]; }; - x30_zstrm.zfree = [](void*, void* buf) { delete[] static_cast(buf); }; - inflateInit(&x30_zstrm); + +template <> +zeus::COBBox cinput_stream_helper(CInputStream& in) { + zeus::COBBox ret; + ret.transform = in.Get(); + ret.extents = in.Get(); + return ret; +} +template <> +zeus::CColor cinput_stream_helper(CInputStream& in) { + zeus::CColor ret; + ret.r() = in.ReadFloat(); + ret.g() = in.ReadFloat(); + ret.b() = in.ReadFloat(); + ret.a() = in.ReadFloat(); + return ret; } -CZipInputStream::~CZipInputStream() { inflateEnd(&x30_zstrm); } - -atUint64 CZipInputStream::readUBytesToBuf(void* buf, atUint64 len) { - x30_zstrm.next_out = static_cast(buf); - x30_zstrm.avail_out = len; - x30_zstrm.total_out = 0; - while (x30_zstrm.avail_out != 0) { - if (x30_zstrm.avail_in == 0) { - atUint64 readSz = x28_strm->readUBytesToBuf(x24_compBuf.get(), 4096); - x30_zstrm.avail_in = readSz; - x30_zstrm.next_in = x24_compBuf.get(); - } - int inflateRet = inflate(&x30_zstrm, Z_NO_FLUSH); - if (inflateRet != Z_OK) - break; - } - return x30_zstrm.total_out; +template <> +zeus::CTransform cinput_stream_helper(CInputStream& in) { + zeus::CTransform ret; + auto r0 = in.Get(); + auto r1 = in.Get(); + auto r2 = in.Get(); + ret.basis = zeus::CMatrix3f(r0, r1, r2); + ret.basis.transpose(); + ret.origin = zeus::CVector3f(r0.w(), r1.w(), r2.w()); + return ret; } +template <> +zeus::CMatrix3f cinput_stream_helper(CInputStream& in) { + zeus::CMatrix3f ret; + ret.m[0] = in.Get(); + ret.m[1] = in.Get(); + ret.m[2] = in.Get(); + return ret.transposed(); +} + +template <> +zeus::CMatrix4f cinput_stream_helper(CInputStream& in) { + zeus::CMatrix4f ret; + ret.m[0] = in.Get(); + ret.m[1] = in.Get(); + ret.m[2] = in.Get(); + ret.m[3] = in.Get(); + return ret.transposed(); +} } // namespace metaforce diff --git a/Runtime/IOStreams.hpp b/Runtime/IOStreams.hpp index 6aef9d55c..3e079d211 100644 --- a/Runtime/IOStreams.hpp +++ b/Runtime/IOStreams.hpp @@ -1,74 +1,41 @@ #pragma once -#include - -#include "Runtime/GCNTypes.hpp" - -#include -#include -#include -#include -#ifdef URDE_ZIP_INPUT_STREAM -#include -#endif +#include "Runtime/CMemoryInStream.hpp" +#include "Runtime/CMemoryStreamOut.hpp" +#include "Runtime/CZipInputStream.hpp" +namespace zeus { +class CVector2f; +class CVector3f; +class CVector4f; +class CTransform; +class CMatrix3f; +class CMatrix4f; +class CAABox; +class COBBox; +class CQuaternion; +class CColor; +} namespace metaforce { -using CInputStream = athena::io::IStreamReader; -using COutputStream = athena::io::IStreamWriter; - -struct CBitStreamReader : athena::io::MemoryReader { - u32 x1c_val = 0; - u32 x20_bitOffset = 0; - -public: - static constexpr u32 GetBitCount(u32 maxVal) { - u32 ret = 0; - while (maxVal != 0) { - maxVal /= 2; - ret++; - } - - return ret; - } - - CBitStreamReader(const void* data, atUint64 length) : MemoryReader(data, length) {} - - s32 ReadEncoded(u32 key); -}; - -class CBitStreamWriter : public athena::io::MemoryWriter { - u32 x14_val = 0; - u32 x18_bitOffset = 0x20; - -public: - static constexpr u32 GetBitCount(u32 maxVal) { return CBitStreamReader::GetBitCount(maxVal); } - - explicit CBitStreamWriter(atUint8* data = nullptr, atUint64 length = 0x10) : MemoryWriter(data, length) {} - - void WriteEncoded(u32 val, u32 bitCount); - - void Flush(); - - ~CBitStreamWriter() override { Flush(); } -}; - -using CMemoryInStream = athena::io::MemoryReader; -using CMemoryOutStream = athena::io::MemoryWriter; - -#ifdef URDE_ZIP_INPUT_STREAM -class CZipInputStream : public CInputStream { - std::unique_ptr x24_compBuf; - std::unique_ptr x28_strm; - z_stream x30_zstrm = {}; - -public: - explicit CZipInputStream(std::unique_ptr&& strm); - ~CZipInputStream() override; - atUint64 readUBytesToBuf(void* buf, atUint64 len) override; - void seek(atInt64, athena::SeekOrigin) override {} - atUint64 position() const override { return 0; } - atUint64 length() const override { return 0; } -}; -#endif - -} // namespace metaforce +// Custom helpers for input/output +template <> +zeus::CVector2f cinput_stream_helper(CInputStream& in); +template <> +zeus::CVector3f cinput_stream_helper(CInputStream& in); +template <> +zeus::CVector4f cinput_stream_helper(CInputStream& in); +template <> +zeus::CQuaternion cinput_stream_helper(CInputStream& in); +template <> +zeus::CAABox cinput_stream_helper(CInputStream& in); +template <> +zeus::COBBox cinput_stream_helper(CInputStream& in); +template <> +zeus::CColor cinput_stream_helper(CInputStream& in); +template <> +zeus::CTransform cinput_stream_helper(CInputStream& in); +template <> +zeus::CMatrix3f cinput_stream_helper(CInputStream& in); +template <> +zeus::CMatrix4f cinput_stream_helper(CInputStream& in); +} \ No newline at end of file diff --git a/Runtime/MP1/CMemoryCardDriver.cpp b/Runtime/MP1/CMemoryCardDriver.cpp index eee2a05ea..203e0bddb 100644 --- a/Runtime/MP1/CMemoryCardDriver.cpp +++ b/Runtime/MP1/CMemoryCardDriver.cpp @@ -106,19 +106,19 @@ ECardResult CMemoryCardDriver::SFileInfo::GetSaveDataOffset(u32& offOut) const { CMemoryCardDriver::SGameFileSlot::SGameFileSlot() { InitializeFromGameState(); } CMemoryCardDriver::SGameFileSlot::SGameFileSlot(CMemoryInStream& in) { - in.readBytesToBuf(x0_saveBuffer.data(), x0_saveBuffer.size()); + in.ReadBytes(reinterpret_cast(x0_saveBuffer.data()), x0_saveBuffer.size()); x944_fileInfo = CGameState::LoadGameFileState(x0_saveBuffer.data()); } void CMemoryCardDriver::SGameFileSlot::InitializeFromGameState() { - CBitStreamWriter w(x0_saveBuffer.data(), x0_saveBuffer.size()); + CMemoryStreamOut w(x0_saveBuffer.data(), x0_saveBuffer.size()); g_GameState->PutTo(w); w.Flush(); x944_fileInfo = CGameState::LoadGameFileState(x0_saveBuffer.data()); } void CMemoryCardDriver::SGameFileSlot::LoadGameState(u32 idx) { - CBitStreamReader r(x0_saveBuffer.data(), x0_saveBuffer.size()); + CMemoryInStream r(x0_saveBuffer.data(), x0_saveBuffer.size(), CMemoryInStream::EOwnerShip::NotOwned); static_cast(g_Main)->StreamNewGameState(r, idx); } @@ -151,9 +151,9 @@ const CGameState::GameFileStateInfo* CMemoryCardDriver::GetGameFileStateInfo(int CMemoryCardDriver::SSaveHeader CMemoryCardDriver::LoadSaveHeader(CMemoryInStream& in) { SSaveHeader ret; - ret.x0_version = in.readUint32Big(); + ret.x0_version = in.ReadLong(); for (bool& present : ret.x4_savePresent) { - present = in.readBool(); + present = in.ReadBool(); } return ret; } @@ -174,7 +174,7 @@ void CMemoryCardDriver::ReadFinished() { x20_fileTime = stat.GetTime(); CMemoryInStream r(fileInfo.x34_saveData.data(), 3004); SSaveHeader header = LoadSaveHeader(r); - r.readBytesToBuf(x30_systemData.data(), x30_systemData.size()); + r.ReadBytes(reinterpret_cast(x30_systemData.data()), x30_systemData.size()); for (size_t i = 0; i < xe4_fileSlots.size(); ++i) { if (header.x4_savePresent[i]) { @@ -188,17 +188,17 @@ void CMemoryCardDriver::ReadFinished() { } void CMemoryCardDriver::ImportPersistentOptions() { - CBitStreamReader r(x30_systemData.data(), x30_systemData.size()); + CMemoryInStream r(x30_systemData.data(), x30_systemData.size(), CMemoryInStream::EOwnerShip::NotOwned); CPersistentOptions opts(r); g_GameState->ImportPersistentOptions(opts); } void CMemoryCardDriver::ExportPersistentOptions() { - CBitStreamReader r(x30_systemData.data(), x30_systemData.size()); + CMemoryInStream r(x30_systemData.data(), x30_systemData.size(), CMemoryInStream::EOwnerShip::NotOwned); CPersistentOptions opts(r); g_GameState->ExportPersistentOptions(opts); - CBitStreamWriter w(x30_systemData.data(), x30_systemData.size()); - opts.PutTo(w); + CMemoryStreamOut w(x30_systemData.data(), x30_systemData.size()); + w.Put(opts); } void CMemoryCardDriver::CheckCardCapacity() { @@ -645,7 +645,7 @@ void CMemoryCardDriver::BuildNewFileSlot(u32 saveIdx) { slot = std::make_unique(); slot->LoadGameState(saveIdx); - CBitStreamReader r(x30_systemData.data(), x30_systemData.size()); + CMemoryInStream r(x30_systemData.data(), x30_systemData.size()); g_GameState->ReadPersistentOptions(r); ImportPersistentOptions(); g_GameState->SetCardSerial(x28_cardSerial); @@ -663,7 +663,7 @@ void CMemoryCardDriver::BuildExistingFileSlot(u32 saveIdx) { else slot->InitializeFromGameState(); - CBitStreamWriter w(x30_systemData.data(), x30_systemData.size()); + CMemoryStreamOut w(x30_systemData.data(), x30_systemData.size()); g_GameState->PutTo(w); } @@ -680,7 +680,7 @@ void CMemoryCardDriver::InitializeFileInfo() { x198_fileInfo->LockBannerToken(x4_saveBanner, *g_SimplePool); x198_fileInfo->LockIconToken(x8_saveIcon0, kabufuda::EAnimationSpeed::Middle, *g_SimplePool); - CMemoryOutStream w = x198_fileInfo->BeginMemoryOut(3004); + CMemoryStreamOut w = x198_fileInfo->BeginMemoryOut(3004); SSaveHeader header; for (size_t i = 0; i < xe4_fileSlots.size(); ++i) { @@ -688,7 +688,7 @@ void CMemoryCardDriver::InitializeFileInfo() { } header.DoPut(w); - w.writeBytes(x30_systemData.data(), x30_systemData.size()); + w.Put(x30_systemData.data(), x30_systemData.size()); for (auto& fileSlot : xe4_fileSlots) { if (fileSlot) { diff --git a/Runtime/MP1/CMemoryCardDriver.hpp b/Runtime/MP1/CMemoryCardDriver.hpp index fec06aa25..c68ba45c9 100644 --- a/Runtime/MP1/CMemoryCardDriver.hpp +++ b/Runtime/MP1/CMemoryCardDriver.hpp @@ -90,10 +90,10 @@ private: u32 x0_version = 0; std::array x4_savePresent{}; - void DoPut(CMemoryOutStream& out) const { - out.writeUint32Big(x0_version); + void DoPut(CMemoryStreamOut& out) const { + out.WriteLong(x0_version); for (const bool savePresent : x4_savePresent) { - out.writeBool(savePresent); + out.Put(savePresent); } } }; @@ -106,7 +106,7 @@ private: explicit SGameFileSlot(CMemoryInStream& in); void InitializeFromGameState(); void LoadGameState(u32 idx); - void DoPut(CMemoryOutStream& w) const { w.writeBytes(x0_saveBuffer.data(), x0_saveBuffer.size()); } + void DoPut(CMemoryStreamOut& w) const { w.Put(x0_saveBuffer.data(), x0_saveBuffer.size()); } }; enum class EFileState { Unknown, NoFile, File, BadFile }; diff --git a/Runtime/MP1/CTweaks.cpp b/Runtime/MP1/CTweaks.cpp index d7767c3be..1bfdd8820 100644 --- a/Runtime/MP1/CTweaks.cpp +++ b/Runtime/MP1/CTweaks.cpp @@ -26,35 +26,41 @@ namespace metaforce::MP1 { static logvisor::Module Log("MP1::CTweaks"); void CTweaks::RegisterTweaks(hecl::CVarManager* cvarMgr) { +#if 0 // TODO: Migrate tweaks into metaforce std::optional strm; const SObjectTag* tag; /* Particle */ tag = g_ResFactory->GetResourceIdByName("Particle"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakParticle = new DataSpec::DNAMP1::CTweakParticle(*strm); g_tweakParticle->initCVars(cvarMgr); /* Player */ tag = g_ResFactory->GetResourceIdByName("Player"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakPlayer = new DataSpec::DNAMP1::CTweakPlayer(*strm); g_tweakPlayer->initCVars(cvarMgr); /* CameraBob */ tag = g_ResFactory->GetResourceIdByName("CameraBob"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); CPlayerCameraBob::ReadTweaks(*strm); /* Ball */ tag = g_ResFactory->GetResourceIdByName("Ball"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakBall = new DataSpec::DNAMP1::CTweakBall(*strm); g_tweakBall->initCVars(cvarMgr); /* PlayerGun */ tag = g_ResFactory->GetResourceIdByName("PlayerGun"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakPlayerGun = new DataSpec::DNAMP1::CTweakPlayerGun(*strm); g_tweakPlayerGun->initCVars(cvarMgr); @@ -73,59 +79,70 @@ void CTweaks::RegisterTweaks(hecl::CVarManager* cvarMgr) { /* Game */ tag = g_ResFactory->GetResourceIdByName("Game"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakGame = new DataSpec::DNAMP1::CTweakGame(*strm); g_tweakGame->initCVars(cvarMgr); /* GuiColors */ tag = g_ResFactory->GetResourceIdByName("GuiColors"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakGuiColors = new DataSpec::DNAMP1::CTweakGuiColors(*strm); g_tweakGuiColors->initCVars(cvarMgr); /* AutoMapper */ tag = g_ResFactory->GetResourceIdByName("AutoMapper"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakAutoMapper = new DataSpec::DNAMP1::CTweakAutoMapper(*strm); CMappableObject::ReadAutoMapperTweaks(*g_tweakAutoMapper); g_tweakAutoMapper->initCVars(cvarMgr); /* Gui */ tag = g_ResFactory->GetResourceIdByName("Gui"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakGui = new DataSpec::DNAMP1::CTweakGui(*strm); g_tweakPlayerGun->initCVars(cvarMgr); /* PlayerControls */ tag = g_ResFactory->GetResourceIdByName("PlayerControls"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakPlayerControl = new DataSpec::DNAMP1::CTweakPlayerControl(*strm); /* PlayerControls2 */ tag = g_ResFactory->GetResourceIdByName("PlayerControls2"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakPlayerControlAlt = new DataSpec::DNAMP1::CTweakPlayerControl(*strm); g_currentPlayerControl = g_tweakPlayerControl; /* SlideShow */ tag = g_ResFactory->GetResourceIdByName("SlideShow"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakSlideShow = new DataSpec::DNAMP1::CTweakSlideShow(*strm); g_tweakSlideShow->initCVars(cvarMgr); +#endif } void CTweaks::RegisterResourceTweaks(hecl::CVarManager* cvarMgr) { +#if 0 // TODO: Migrate tweaks into metaforce std::optional strm; const SObjectTag* tag = g_ResFactory->GetResourceIdByName("GunRes"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); g_tweakGunRes = new DataSpec::DNAMP1::CTweakGunRes(*strm); g_tweakGunRes->ResolveResources(*g_ResFactory); g_tweakGunRes->initCVars(cvarMgr); tag = g_ResFactory->GetResourceIdByName("PlayerRes"); - strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), true); + strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), + CMemoryInStream::EOwnerShip::Owned); if (g_Main->IsTrilogy() || g_Main->IsPAL() || g_Main->IsJapanese()) { g_tweakPlayerRes = new DataSpec::DNAMP1::CTweakPlayerRes(*strm); } else { @@ -134,6 +151,7 @@ void CTweaks::RegisterResourceTweaks(hecl::CVarManager* cvarMgr) { g_tweakPlayerRes->ResolveResources(*g_ResFactory); g_tweakPlayerRes->initCVars(cvarMgr); +#endif } } // namespace metaforce::MP1 diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index 8a4894d2b..6574b8499 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -452,7 +452,7 @@ void CMain::EnsureWorldPaksReady() {} void CMain::EnsureWorldPakReady(CAssetId mlvl) { /* TODO: Schedule resource list load for World Pak containing mlvl */ } -void CMain::StreamNewGameState(CBitStreamReader& r, u32 idx) { +void CMain::StreamNewGameState(CInputStream& r, u32 idx) { bool fusionBackup = g_GameState->SystemOptions().GetPlayerFusionSuitActive(); x128_globalObjects->x134_gameState = std::make_unique(r, idx); g_GameState = x128_globalObjects->x134_gameState.get(); @@ -466,7 +466,7 @@ void CMain::RefreshGameState() { u64 cardSerial = g_GameState->GetCardSerial(); std::vector saveData = g_GameState->BackupBuf(); CGameOptions gameOpts = g_GameState->GameOptions(); - CBitStreamReader r(saveData.data(), saveData.size()); + CMemoryInStream r(saveData.data(), saveData.size(), CMemoryInStream::EOwnerShip::NotOwned); x128_globalObjects->StreamInGameState(r, g_GameState->GetFileIdx()); g_GameState->SetPersistentOptions(sysOpts); g_GameState->SetGameOptions(gameOpts); @@ -558,6 +558,7 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarMana m_cvarCommons = std::make_unique(*m_cvarMgr); bool loadedVersion = false; +#if 0 if (CDvdFile::FileExists("version.yaml")) { CDvdFile file("version.yaml"); if (file) { @@ -570,7 +571,9 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarMana MainLog.report(logvisor::Level::Info, FMT_STRING("Loaded version info")); } } - } else if (CDvdFile::FileExists("default.dol")) { + } else +#endif + if (CDvdFile::FileExists("default.dol")) { CDvdFile file("default.dol"); if (file) { std::unique_ptr buf = std::make_unique(file.Length()); diff --git a/Runtime/MP1/MP1.hpp b/Runtime/MP1/MP1.hpp index 9edeb4ba9..3b88c403d 100644 --- a/Runtime/MP1/MP1.hpp +++ b/Runtime/MP1/MP1.hpp @@ -108,7 +108,7 @@ public: g_GameState = x134_gameState.get(); } - void StreamInGameState(CBitStreamReader& stream, u32 saveIdx) { + void StreamInGameState(CInputStream& stream, u32 saveIdx) { x134_gameState = std::make_unique(stream, saveIdx); g_GameState = x134_gameState.get(); } @@ -268,7 +268,7 @@ public: void AddWorldPaks(); void AddOverridePaks(); void ResetGameState(); - void StreamNewGameState(CBitStreamReader&, u32 idx); + void StreamNewGameState(CInputStream&, u32 idx); void RefreshGameState(); void CheckTweakManagerDebugOptions() {} void SetMFGameBuilt(bool b) { x160_25_mfGameBuilt = b; } diff --git a/Runtime/MP1/World/CBabygoth.cpp b/Runtime/MP1/World/CBabygoth.cpp index f8a8edef1..3595aa3a8 100644 --- a/Runtime/MP1/World/CBabygoth.cpp +++ b/Runtime/MP1/World/CBabygoth.cpp @@ -34,8 +34,8 @@ constexpr std::array skSphereJointList{{ }}; CBabygothData::CBabygothData(CInputStream& in) -: x0_fireballAttackTime(in.readFloatBig()) -, x4_fireballAttackTimeVariance(in.readFloatBig()) +: x0_fireballAttackTime(in.ReadFloat()) +, x4_fireballAttackTimeVariance(in.ReadFloat()) , x8_fireballWeapon(in) , xc_fireballDamage(in) , x28_attackContactDamage(in) @@ -46,20 +46,20 @@ CBabygothData::CBabygothData(CInputStream& in) , xd0_shellVulnerabilities(in) , x138_noShellModel(in) , x13c_noShellSkin(in) -, x140_shellHitPoints(in.readFloatBig()) -, x144_shellCrackSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) +, x140_shellHitPoints(in.ReadFloat()) +, x144_shellCrackSfx(CSfxManager::TranslateSFXID(in.ReadLong())) , x148_intermediateCrackParticle(in) , x14c_crackOneParticle(in) , x150_crackTwoParticle(in) , x154_destroyShellParticle(in) -, x158_crackOneSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) -, x15a_crackTwoSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) -, x15c_destroyShellSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) -, x160_timeUntilAttack(in.readFloatBig()) -, x164_attackCooldownTime(in.readFloatBig()) -, x168_interestTime(in.readFloatBig()) +, x158_crackOneSfx(CSfxManager::TranslateSFXID(in.ReadLong())) +, x15a_crackTwoSfx(CSfxManager::TranslateSFXID(in.ReadLong())) +, x15c_destroyShellSfx(CSfxManager::TranslateSFXID(in.ReadLong())) +, x160_timeUntilAttack(in.ReadFloat()) +, x164_attackCooldownTime(in.ReadFloat()) +, x168_interestTime(in.ReadFloat()) , x16c_flamePlayerSteamTxtr(in) -, x170_flamePlayerHitSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) +, x170_flamePlayerHitSfx(CSfxManager::TranslateSFXID(in.ReadLong())) , x174_flamePlayerIceTxtr(in) {} CBabygoth::CBabygoth(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, diff --git a/Runtime/MP1/World/CBouncyGrenade.hpp b/Runtime/MP1/World/CBouncyGrenade.hpp index 0a4893ddd..73ca6e750 100644 --- a/Runtime/MP1/World/CBouncyGrenade.hpp +++ b/Runtime/MP1/World/CBouncyGrenade.hpp @@ -15,7 +15,7 @@ private: float x4_speed; public: - explicit SGrenadeVelocityInfo(CInputStream& in) : x0_mass(in.readFloatBig()), x4_speed(in.readFloatBig()) {} + explicit SGrenadeVelocityInfo(CInputStream& in) : x0_mass(in.ReadFloat()), x4_speed(in.ReadFloat()) {} [[nodiscard]] float GetMass() const { return x0_mass; } [[nodiscard]] float GetSpeed() const { return x4_speed; } diff --git a/Runtime/MP1/World/CChozoGhost.cpp b/Runtime/MP1/World/CChozoGhost.cpp index 26b6cc759..b611ee221 100644 --- a/Runtime/MP1/World/CChozoGhost.cpp +++ b/Runtime/MP1/World/CChozoGhost.cpp @@ -15,14 +15,14 @@ namespace metaforce::MP1 { CChozoGhost::CBehaveChance::CBehaveChance(CInputStream& in) -: x0_propertyCount(in.readUint32Big()) -, x4_lurk(in.readFloatBig()) -, x8_taunt(in.readFloatBig()) -, xc_attack(in.readFloatBig()) -, x10_move(in.readFloatBig()) -, x14_lurkTime(in.readFloatBig()) -, x18_chargeAttack(x0_propertyCount < 6 ? 0.5f : in.readFloatBig() * .01f) -, x1c_numBolts(x0_propertyCount < 7 ? 2 : in.readUint32Big()) { +: x0_propertyCount(in.ReadLong()) +, x4_lurk(in.ReadFloat()) +, x8_taunt(in.ReadFloat()) +, xc_attack(in.ReadFloat()) +, x10_move(in.ReadFloat()) +, x14_lurkTime(in.ReadFloat()) +, x18_chargeAttack(x0_propertyCount < 6 ? 0.5f : in.ReadFloat() * .01f) +, x1c_numBolts(x0_propertyCount < 7 ? 2 : in.ReadLong()) { float f2 = 1.f / (x10_move + xc_attack + x4_lurk + x8_taunt); x4_lurk *= f2; x8_taunt *= f2; diff --git a/Runtime/MP1/World/CElitePirate.cpp b/Runtime/MP1/World/CElitePirate.cpp index 98fde2c44..d0849ccc2 100644 --- a/Runtime/MP1/World/CElitePirate.cpp +++ b/Runtime/MP1/World/CElitePirate.cpp @@ -60,38 +60,38 @@ bool IsArmClawCollider(TUniqueId uid, const rstl::reserved_vector& } // Anonymous namespace CElitePirateData::CElitePirateData(CInputStream& in, u32 propCount) -: x0_tauntInterval(in.readFloatBig()) -, x4_tauntVariance(in.readFloatBig()) -, x8_(in.readFloatBig()) -, xc_(in.readFloatBig()) -, x10_attackChance(in.readFloatBig()) -, x14_shotAtTime(in.readFloatBig()) -, x18_shotAtTimeVariance(in.readFloatBig()) -, x1c_projectileAttractionRadius(in.readFloatBig()) +: x0_tauntInterval(in.ReadFloat()) +, x4_tauntVariance(in.ReadFloat()) +, x8_(in.ReadFloat()) +, xc_(in.ReadFloat()) +, x10_attackChance(in.ReadFloat()) +, x14_shotAtTime(in.ReadFloat()) +, x18_shotAtTimeVariance(in.ReadFloat()) +, x1c_projectileAttractionRadius(in.ReadFloat()) , x20_energyAbsorbParticleDescId(in) -, x24_energyAbsorbSfxId(CSfxManager::TranslateSFXID(in.readUint32Big())) +, x24_energyAbsorbSfxId(CSfxManager::TranslateSFXID(in.ReadLong())) , x28_launcherActParams(ScriptLoader::LoadActorParameters(in)) , x90_launcherAnimParams(ScriptLoader::LoadAnimationParameters(in)) , x9c_launcherParticleGenDescId(in) -, xa0_launcherSfxId(CSfxManager::TranslateSFXID(in.readUint32Big())) +, xa0_launcherSfxId(CSfxManager::TranslateSFXID(in.ReadLong())) , xa4_grenadeModelId(in) , xa8_grenadeDamageInfo(in) -, xc4_launcherHp(in.readFloatBig()) +, xc4_launcherHp(in.ReadFloat()) , xc8_grenadeElementGenDescId1(in) , xcc_grenadeElementGenDescId2(in) , xd0_grenadeElementGenDescId3(in) , xd4_grenadeElementGenDescId4(in) , xd8_grenadeVelocityInfo(in) , xe0_grenadeTrajectoryInfo(in) -, xf0_grenadeNumBounces(in.readUint32Big()) -, xf4_grenadeBounceSfxId(CSfxManager::TranslateSFXID(in.readUint32Big())) -, xf6_grenadeExplodeSfxId(CSfxManager::TranslateSFXID(in.readUint32Big())) +, xf0_grenadeNumBounces(in.ReadLong()) +, xf4_grenadeBounceSfxId(CSfxManager::TranslateSFXID(in.ReadLong())) +, xf6_grenadeExplodeSfxId(CSfxManager::TranslateSFXID(in.ReadLong())) , xf8_shockwaveParticleDescId(in) , xfc_shockwaveDamageInfo(in) , x118_shockwaveWeaponDescId(in) -, x11c_shockwaveElectrocuteSfxId(CSfxManager::TranslateSFXID(in.readUint32Big())) -, x11e_canCallForBackup(in.readBool()) -, x11f_fastWhenAttractingEnergy(propCount < 42 ? true : in.readBool()) {} +, x11c_shockwaveElectrocuteSfxId(CSfxManager::TranslateSFXID(in.ReadLong())) +, x11e_canCallForBackup(in.ReadBool()) +, x11f_fastWhenAttractingEnergy(propCount < 42 ? true : in.ReadBool()) {} CElitePirate::CElitePirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, diff --git a/Runtime/MP1/World/CFlaahgra.cpp b/Runtime/MP1/World/CFlaahgra.cpp index 2ec9fd1c7..63c65963d 100644 --- a/Runtime/MP1/World/CFlaahgra.cpp +++ b/Runtime/MP1/World/CFlaahgra.cpp @@ -45,10 +45,10 @@ constexpr std::array skSphereJointList{{ }}; CFlaahgraData::CFlaahgraData(CInputStream& in) -: x0_(in.readFloatBig()) -, x4_(in.readFloatBig()) -, x8_(in.readFloatBig()) -, xc_faintDuration(in.readFloatBig()) +: x0_(in.ReadFloat()) +, x4_(in.ReadFloat()) +, x8_(in.ReadFloat()) +, xc_faintDuration(in.ReadFloat()) , x10_(in) , x78_(in) , x7c_(in) @@ -57,9 +57,9 @@ CFlaahgraData::CFlaahgraData(CInputStream& in) , xb8_plantsParticleGenDescId(in) , xbc_(in) , xd8_(ScriptLoader::LoadActorParameters(in)) -, x140_(in.readFloatBig()) -, x144_(in.readFloatBig()) -, x148_(in.readFloatBig()) +, x140_(in.ReadFloat()) +, x144_(in.ReadFloat()) +, x148_(in.ReadFloat()) , x14c_animationParameters(ScriptLoader::LoadAnimationParameters(in)) , x158_(in) {} diff --git a/Runtime/MP1/World/CFlyingPirate.cpp b/Runtime/MP1/World/CFlyingPirate.cpp index 4842f2411..ba90fc9b2 100644 --- a/Runtime/MP1/World/CFlyingPirate.cpp +++ b/Runtime/MP1/World/CFlyingPirate.cpp @@ -74,34 +74,34 @@ constexpr std::array skRadii{ } // namespace CFlyingPirate::CFlyingPirateData::CFlyingPirateData(CInputStream& in, u32 propCount) -: x0_maxCoverDistance(in.readFloatBig()) -, x4_hearingDistance(in.readFloatBig()) -, x8_type(EFlyingPirateType(in.readUint32Big())) +: x0_maxCoverDistance(in.ReadFloat()) +, x4_hearingDistance(in.ReadFloat()) +, x8_type(EFlyingPirateType(in.ReadLong())) , xc_gunProjectileInfo(in) -, x34_gunSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) +, x34_gunSfx(CSfxManager::TranslateSFXID(in.ReadLong())) , x38_altProjectileInfo1(in) , x60_altProjectileInfo2(CAssetId(in), {}) -, x88_knockBackDelay(in.readFloatBig()) -, x8c_flyingHeight(in.readFloatBig()) +, x88_knockBackDelay(in.ReadFloat()) +, x8c_flyingHeight(in.ReadFloat()) , x90_particleGenDesc(g_SimplePool->GetObj({SBIG('PART'), CAssetId(in)})) , x9c_dInfo(in) -, xb8_(in.readFloatBig()) -, xbc_(in.readFloatBig()) -, xc0_(in.readFloatBig()) -, xc4_(in.readFloatBig()) -, xc8_ragDollSfx1(CSfxManager::TranslateSFXID(in.readUint32Big())) -, xca_ragDollSfx2(CSfxManager::TranslateSFXID(in.readUint32Big())) -, xcc_coverCheckChance(in.readFloatBig()) -, xd0_(in.readFloatBig()) -, xd4_(in.readFloatBig()) +, xb8_(in.ReadFloat()) +, xbc_(in.ReadFloat()) +, xc0_(in.ReadFloat()) +, xc4_(in.ReadFloat()) +, xc8_ragDollSfx1(CSfxManager::TranslateSFXID(in.ReadLong())) +, xca_ragDollSfx2(CSfxManager::TranslateSFXID(in.ReadLong())) +, xcc_coverCheckChance(in.ReadFloat()) +, xd0_(in.ReadFloat()) +, xd4_(in.ReadFloat()) , xd8_particleGen1(in) , xdc_particleGen2(in) , xe0_particleGen3(in) -, xe4_knockBackSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) -, xe6_deathSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) -, xe8_aggressionChance(in.readFloatBig()) -, xec_(in.readFloatBig()) -, xf0_projectileHomingDistance(propCount < 36 ? 0.f : in.readFloatBig()) { +, xe4_knockBackSfx(CSfxManager::TranslateSFXID(in.ReadLong())) +, xe6_deathSfx(CSfxManager::TranslateSFXID(in.ReadLong())) +, xe8_aggressionChance(in.ReadFloat()) +, xec_(in.ReadFloat()) +, xf0_projectileHomingDistance(propCount < 36 ? 0.f : in.ReadFloat()) { xc_gunProjectileInfo.Token().Lock(); x38_altProjectileInfo1.Token().Lock(); x60_altProjectileInfo2.Token().Lock(); diff --git a/Runtime/MP1/World/CGrenadeLauncher.hpp b/Runtime/MP1/World/CGrenadeLauncher.hpp index f3dc57e69..ed0e9050e 100644 --- a/Runtime/MP1/World/CGrenadeLauncher.hpp +++ b/Runtime/MP1/World/CGrenadeLauncher.hpp @@ -29,10 +29,10 @@ private: public: explicit SGrenadeTrajectoryInfo(CInputStream& in) - : x0_velocityMin(in.readFloatBig()) - , x4_velocityMax(in.readFloatBig()) - , x8_angleMin(zeus::degToRad(in.readFloatBig())) - , xc_angleMax(zeus::degToRad(in.readFloatBig())) {} + : x0_velocityMin(in.ReadFloat()) + , x4_velocityMax(in.ReadFloat()) + , x8_angleMin(zeus::degToRad(in.ReadFloat())) + , xc_angleMax(zeus::degToRad(in.ReadFloat())) {} [[nodiscard]] float GetVelocityMin() const { return x0_velocityMin; } [[nodiscard]] float GetVelocityMax() const { return x4_velocityMax; } diff --git a/Runtime/MP1/World/CIceSheegoth.cpp b/Runtime/MP1/World/CIceSheegoth.cpp index df5da2bee..bfebf602c 100644 --- a/Runtime/MP1/World/CIceSheegoth.cpp +++ b/Runtime/MP1/World/CIceSheegoth.cpp @@ -46,17 +46,17 @@ constexpr std::array skRightLegJointList = {{ } // namespace CIceSheegothData::CIceSheegothData(CInputStream& in, [[maybe_unused]] s32 propertyCount) -: x0_(zeus::degToRad(in.readFloatBig())) -, x4_(zeus::degToRad(in.readFloatBig())) -, x8_(zeus::CVector3f::ReadBig(in)) -, x14_(in.readFloatBig()) +: x0_(zeus::degToRad(in.ReadFloat())) +, x4_(zeus::degToRad(in.ReadFloat())) +, x8_(in.Get()) +, x14_(in.ReadFloat()) , x18_(in) , x80_(in) , xe8_(in) , x150_(in) , x154_(in) -, x170_(in.readFloatBig()) -, x174_(in.readFloatBig()) +, x170_(in.ReadFloat()) +, x174_(in.ReadFloat()) , x178_(in) , x17c_fireBreathResId(in) , x180_fireBreathDamage(in) @@ -65,18 +65,18 @@ CIceSheegothData::CIceSheegothData(CInputStream& in, [[maybe_unused]] s32 proper , x1a4_(in) , x1a8_(in) , x1ac_(in) -, x1b0_(in.readFloatBig()) -, x1b4_(in.readFloatBig()) +, x1b0_(in.ReadFloat()) +, x1b4_(in.ReadFloat()) , x1b8_(in) -, x1d4_(CSfxManager::TranslateSFXID(in.readUint32Big())) -, x1d8_(in.readFloatBig()) -, x1dc_(in.readFloatBig()) -, x1e0_maxInterestTime(in.readFloatBig()) +, x1d4_(CSfxManager::TranslateSFXID(in.ReadLong())) +, x1d8_(in.ReadFloat()) +, x1dc_(in.ReadFloat()) +, x1e0_maxInterestTime(in.ReadFloat()) , x1e4_(in) -, x1e8_(CSfxManager::TranslateSFXID(in.readUint32Big())) +, x1e8_(CSfxManager::TranslateSFXID(in.ReadLong())) , x1ec_(in) -, x1f0_24_(in.readBool()) -, x1f0_25_(in.readBool()) {} +, x1f0_24_(in.ReadBool()) +, x1f0_25_(in.ReadBool()) {} CIceSheegoth::CIceSheegoth(TUniqueId uid, std::string_view name, const CEntityInfo& info, zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, diff --git a/Runtime/MP1/World/CMetroid.cpp b/Runtime/MP1/World/CMetroid.cpp index 2ef82e5ca..d5705d041 100644 --- a/Runtime/MP1/World/CMetroid.cpp +++ b/Runtime/MP1/World/CMetroid.cpp @@ -61,17 +61,17 @@ constexpr std::array skJointNameList = { CMetroidData::CMetroidData(CInputStream& in) : x0_frozenVulnerability(in) , x68_energyDrainVulnerability(in) -, xd0_energyDrainPerSec(in.readFloatBig()) -, xd4_maxEnergyDrainAllowed(in.readFloatBig()) -, xd8_telegraphAttackTime(in.readFloatBig()) -, xdc_stage2GrowthScale(in.readFloatBig()) -, xe0_stage2GrowthEnergy(in.readFloatBig()) -, xe4_explosionGrowthEnergy(in.readFloatBig()) { +, xd0_energyDrainPerSec(in.ReadFloat()) +, xd4_maxEnergyDrainAllowed(in.ReadFloat()) +, xd8_telegraphAttackTime(in.ReadFloat()) +, xdc_stage2GrowthScale(in.ReadFloat()) +, xe0_stage2GrowthEnergy(in.ReadFloat()) +, xe4_explosionGrowthEnergy(in.ReadFloat()) { xe8_animParms1 = ScriptLoader::LoadAnimationParameters(in); xf8_animParms2 = ScriptLoader::LoadAnimationParameters(in); x108_animParms3 = ScriptLoader::LoadAnimationParameters(in); x118_animParms4 = ScriptLoader::LoadAnimationParameters(in); - x128_24_startsInWall = in.readBool(); + x128_24_startsInWall = in.ReadBool(); } CMetroid::CMetroid(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info, diff --git a/Runtime/MP1/World/CMetroidBeta.cpp b/Runtime/MP1/World/CMetroidBeta.cpp index 2a6425daa..bd9a3a7de 100644 --- a/Runtime/MP1/World/CMetroidBeta.cpp +++ b/Runtime/MP1/World/CMetroidBeta.cpp @@ -20,21 +20,21 @@ namespace metaforce::MP1 { CMetroidBetaData::CMetroidBetaData(CInputStream& in) : x0_(in) , x68_(in) -, xd0_(in.readFloatBig()) -, xd4_(in.readFloatBig()) -, xd8_(in.readFloatBig()) -, xdc_(in.readFloatBig()) -, xe0_(in.readFloatBig()) -, xe4_(in.readFloatBig()) -, xe8_(in.readFloatBig()) -, xec_(in.readFloatBig()) -, xf0_(in.readFloatBig()) +, xd0_(in.ReadFloat()) +, xd4_(in.ReadFloat()) +, xd8_(in.ReadFloat()) +, xdc_(in.ReadFloat()) +, xe0_(in.ReadFloat()) +, xe4_(in.ReadFloat()) +, xe8_(in.ReadFloat()) +, xec_(in.ReadFloat()) +, xf0_(in.ReadFloat()) , xf4_(in) , xf8_(in) , xfc_(in) , x100_(in) , x104_(in) -, x108_24_(in.readBool()) {} +, x108_24_(in.ReadBool()) {} CMetroidBeta::CMetroidBeta(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& aParms, diff --git a/Runtime/MP1/World/CMetroidPrimeExo.cpp b/Runtime/MP1/World/CMetroidPrimeExo.cpp index 4d4da58a5..bab65f4c0 100644 --- a/Runtime/MP1/World/CMetroidPrimeExo.cpp +++ b/Runtime/MP1/World/CMetroidPrimeExo.cpp @@ -144,29 +144,29 @@ std::array, 14> skSomeValues2{{ }}; } // namespace SPrimeStruct2B::SPrimeStruct2B(CInputStream& in) -: x0_propertyCount(in.readUint32Big()) -, x4_particle1(in.readUint32Big()) -, x8_particle2(in.readUint32Big()) -, xc_particle3(in.readUint32Big()) +: x0_propertyCount(in.ReadLong()) +, x4_particle1(in.ReadLong()) +, x8_particle2(in.ReadLong()) +, xc_particle3(in.ReadLong()) , x10_dInfo(in) -, x2c_(in.readFloatBig()) -, x30_(in.readFloatBig()) -, x34_texture(in.readUint32Big()) -, x38_(CSfxManager::TranslateSFXID(u16(in.readUint32Big()))) -, x3a_(CSfxManager::TranslateSFXID(u16(in.readUint32Big()))) {} +, x2c_(in.ReadFloat()) +, x30_(in.ReadFloat()) +, x34_texture(in.ReadLong()) +, x38_(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) +, x3a_(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) {} SPrimeStruct4::SPrimeStruct4(CInputStream& in) : x0_beamInfo(in) -, x44_(in.readUint32Big()) +, x44_(in.ReadLong()) , x48_dInfo1(in) , x64_struct5(CPlasmaProjectile::LoadPlayerEffectResources(in)) -, x88_(in.readFloatBig()) +, x88_(in.ReadFloat()) , x8c_dInfo2(in) {} SPrimeStruct6::SPrimeStruct6(CInputStream& in) -: x0_propertyCount(in.readUint32Big()), x4_damageVulnerability(in), x6c_color(zeus::CColor::ReadRGBABig(in)) { - x70_[0] = in.readUint32Big(); - x70_[1] = in.readUint32Big(); +: x0_propertyCount(in.ReadLong()), x4_damageVulnerability(in), x6c_color(in.Get()) { + x70_[0] = in.ReadLong(); + x70_[1] = in.ReadLong(); } static CPatternedInfo LoadPatternedInfo(CInputStream& in) { @@ -185,12 +185,15 @@ static CCameraShakerComponent BuildCameraShakerComponent(CameraShakeData::Camera } static CCameraShakeData LoadCameraShakeData(CInputStream& in) { +#if 0 CameraShakeData shakeData; shakeData.read(in); return CCameraShakeData(shakeData.duration, shakeData.sfxDist, u32(shakeData.useSfx), zeus::skZero3f, BuildCameraShakerComponent(shakeData.shakerComponents[0]), BuildCameraShakerComponent(shakeData.shakerComponents[1]), BuildCameraShakerComponent(shakeData.shakerComponents[2])); +#endif + return {}; } static rstl::reserved_vector LoadPrimeStruct4s(CInputStream& in) { @@ -209,35 +212,35 @@ static rstl::reserved_vector LoadPrimeStruct6s(CInputStream& i } SPrimeExoParameters::SPrimeExoParameters(CInputStream& in) -: x0_propertyCount(in.readUint32Big()) +: x0_propertyCount(in.ReadLong()) , x4_patternedInfo(LoadPatternedInfo(in)) , x13c_actorParms(ScriptLoader::LoadActorParameters(in)) -, x1a4_(in.readUint32Big()) +, x1a4_(in.ReadLong()) , x1a8_(LoadCameraShakeData(in)) , x27c_(LoadCameraShakeData(in)) , x350_(LoadCameraShakeData(in)) , x424_(in) -, x460_particle1(in.readUint32Big()) +, x460_particle1(in.ReadLong()) , x464_(LoadPrimeStruct4s(in)) -, x708_wpsc1(in.readUint32Big()) +, x708_wpsc1(in.ReadLong()) , x70c_dInfo1(in) , x728_shakeData1(LoadCameraShakeData(in)) -, x7fc_wpsc2(in.readUint32Big()) +, x7fc_wpsc2(in.ReadLong()) , x800_dInfo2(in) , x81c_shakeData2(LoadCameraShakeData(in)) , x8f0_(in) , x92c_(in) , x948_(LoadCameraShakeData(in)) -, xa1c_particle2(in.readUint32Big()) -, xa20_swoosh(in.readUint32Big()) -, xa24_particle3(in.readUint32Big()) -, xa28_particle4(in.readUint32Big()) +, xa1c_particle2(in.ReadLong()) +, xa20_swoosh(in.ReadLong()) +, xa24_particle3(in.ReadLong()) +, xa28_particle4(in.ReadLong()) , xa2c_(LoadPrimeStruct6s(in)) {} SPrimeExoRoomParameters::SPrimeExoRoomParameters(CInputStream& in) { - u32 propCount = std::min(u32(14), in.readUint32Big()); + u32 propCount = std::min(14, in.ReadLong()); for (u32 i = 0; i < propCount; ++i) { - x0_.push_back(in.readFloatBig()); + x0_.push_back(in.ReadFloat()); } } diff --git a/Runtime/MP1/World/CMetroidPrimeProjectile.cpp b/Runtime/MP1/World/CMetroidPrimeProjectile.cpp index 6c7b1bf8d..23ab8512a 100644 --- a/Runtime/MP1/World/CMetroidPrimeProjectile.cpp +++ b/Runtime/MP1/World/CMetroidPrimeProjectile.cpp @@ -6,17 +6,17 @@ namespace metaforce::MP1 { SPrimeProjectileInfo::SPrimeProjectileInfo(CInputStream& in) -: x0_propertyCount(in.readUint32Big()) -, x4_particle(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), in.readUint32Big()})) +: x0_propertyCount(in.ReadLong()) +, x4_particle(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), in.ReadLong()})) , xc_dInfo(in) -, x28_(in.readFloatBig()) -, x2c_(in.readFloatBig()) -, x30_(in.readFloatBig()) -, x34_texture(in.readUint32Big()) { - x38_24_ = in.readBool(); - x38_25_ = in.readBool(); - x38_26_ = in.readBool(); - x38_27_ = in.readBool(); +, x28_(in.ReadFloat()) +, x2c_(in.ReadFloat()) +, x30_(in.ReadFloat()) +, x34_texture(in.ReadLong()) { + x38_24_ = in.ReadBool(); + x38_25_ = in.ReadBool(); + x38_26_ = in.ReadBool(); + x38_27_ = in.ReadBool(); } CMetroidPrimeProjectile::CMetroidPrimeProjectile(bool active, const TToken& desc, EWeaponType type, diff --git a/Runtime/MP1/World/CRidley.cpp b/Runtime/MP1/World/CRidley.cpp index 5114a3ab0..09f8f1ddd 100644 --- a/Runtime/MP1/World/CRidley.cpp +++ b/Runtime/MP1/World/CRidley.cpp @@ -208,34 +208,34 @@ CRidleyData::CRidleyData(CInputStream& in, u32 propCount) , x28_(in) , x2c_(in) , x30_(in) -, x34_(in.readFloatBig()) -, x38_(in.readFloatBig()) -, x3c_(in.readFloatBig()) -, x40_(in.readFloatBig()) +, x34_(in.ReadFloat()) +, x38_(in.ReadFloat()) +, x3c_(in.ReadFloat()) +, x40_(in.ReadFloat()) , x44_(in) , x48_(in) , x64_(in) -, xa8_(CSfxManager::TranslateSFXID(in.readUint32Big())) +, xa8_(CSfxManager::TranslateSFXID(in.ReadLong())) , xac_(in) , xb0_(in) , xcc_(in) , x1a0_(in) , x1a4_(in) , x1c0_(in) -, x294_(CSfxManager::TranslateSFXID(in.readUint32Big())) +, x294_(CSfxManager::TranslateSFXID(in.ReadLong())) , x298_(in) , x2b4_(in) -, x388_(in.readFloatBig()) -, x38c_(in.readFloatBig()) +, x388_(in.ReadFloat()) +, x38c_(in.ReadFloat()) , x390_(in) -, x3ac_(in.readFloatBig()) +, x3ac_(in.ReadFloat()) , x3b0_(in) -, x3cc_(in.readFloatBig()) +, x3cc_(in.ReadFloat()) , x3d0_(in) -, x3ec_(in.readFloatBig()) +, x3ec_(in.ReadFloat()) , x3f0_(in) -, x3f4_(in.readFloatBig()) -, x3f8_(CSfxManager::TranslateSFXID(in.readUint32Big())) +, x3f4_(in.ReadFloat()) +, x3f8_(CSfxManager::TranslateSFXID(in.ReadLong())) , x3fc_(propCount > 47 ? CDamageInfo(in) : x48_) {} CRidley::CRidley(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, diff --git a/Runtime/MP1/World/CSpacePirate.cpp b/Runtime/MP1/World/CSpacePirate.cpp index 24467e064..413c4c1aa 100644 --- a/Runtime/MP1/World/CSpacePirate.cpp +++ b/Runtime/MP1/World/CSpacePirate.cpp @@ -152,34 +152,34 @@ std::list mChargePlayerList; } // Anonymous namespace CSpacePirate::CSpacePirateData::CSpacePirateData(metaforce::CInputStream& in, u32 propCount) -: x0_AggressionCheck(in.readFloatBig()) -, x4_CoverCheck(in.readFloatBig()) -, x8_SearchRadius(in.readFloatBig()) -, xc_FallBackCheck(in.readFloatBig()) -, x10_FallBackRadius(in.readFloatBig()) -, x14_HearingRadius(in.readFloatBig()) -, x18_flags(in.readUint32Big()) -, x1c_(in.readBool()) +: x0_AggressionCheck(in.ReadFloat()) +, x4_CoverCheck(in.ReadFloat()) +, x8_SearchRadius(in.ReadFloat()) +, xc_FallBackCheck(in.ReadFloat()) +, x10_FallBackRadius(in.ReadFloat()) +, x14_HearingRadius(in.ReadFloat()) +, x18_flags(in.ReadLong()) +, x1c_(in.ReadBool()) , x20_Projectile(in) -, x48_Sound_Projectile(CSfxManager::TranslateSFXID(in.readUint32Big())) +, x48_Sound_Projectile(CSfxManager::TranslateSFXID(in.ReadLong())) , x4c_BladeDamage(in) -, x68_KneelAttackChance(in.readFloatBig()) +, x68_KneelAttackChance(in.ReadFloat()) , x6c_KneelAttackShot(in) -, x94_DodgeCheck(in.readFloatBig()) -, x98_Sound_Impact(CSfxManager::TranslateSFXID(in.readUint32Big())) -, x9c_averageNextShotTime(in.readFloatBig()) -, xa0_nextShotTimeVariation(in.readFloatBig()) -, xa4_Sound_Alert(CSfxManager::TranslateSFXID(in.readUint32Big())) -, xa8_GunTrackDelay(in.readFloatBig()) -, xac_firstBurstCount(in.readUint32Big()) -, xb0_CloakOpacity(in.readFloatBig()) -, xb4_MaxCloakOpacity(in.readFloatBig()) -, xb8_dodgeDelayTimeMin(in.readFloatBig()) -, xbc_dodgeDelayTimeMax(in.readFloatBig()) -, xc0_Sound_Hurled(CSfxManager::TranslateSFXID(in.readUint32Big())) -, xc2_Sound_Death(CSfxManager::TranslateSFXID(in.readUint32Big())) -, xc4_(propCount > 35 ? in.readFloatBig() : 0.2f) -, xc8_AvoidDistance(propCount > 36 ? in.readFloatBig() : 8.f) {} +, x94_DodgeCheck(in.ReadFloat()) +, x98_Sound_Impact(CSfxManager::TranslateSFXID(in.ReadLong())) +, x9c_averageNextShotTime(in.ReadFloat()) +, xa0_nextShotTimeVariation(in.ReadFloat()) +, xa4_Sound_Alert(CSfxManager::TranslateSFXID(in.ReadLong())) +, xa8_GunTrackDelay(in.ReadFloat()) +, xac_firstBurstCount(in.ReadLong()) +, xb0_CloakOpacity(in.ReadFloat()) +, xb4_MaxCloakOpacity(in.ReadFloat()) +, xb8_dodgeDelayTimeMin(in.ReadFloat()) +, xbc_dodgeDelayTimeMax(in.ReadFloat()) +, xc0_Sound_Hurled(CSfxManager::TranslateSFXID(in.ReadLong())) +, xc2_Sound_Death(CSfxManager::TranslateSFXID(in.ReadLong())) +, xc4_(propCount > 35 ? in.ReadFloat() : 0.2f) +, xc8_AvoidDistance(propCount > 36 ? in.ReadFloat() : 8.f) {} CPirateRagDoll::CPirateRagDoll(CStateManager& mgr, CSpacePirate* sp, u16 thudSfx, u32 flags) : CRagDoll(-sp->GetGravityConstant(), -3.f, 8.f, flags), x6c_spacePirate(sp), x70_thudSfx(thudSfx) { diff --git a/Runtime/Particle/CColorElement.cpp b/Runtime/Particle/CColorElement.cpp index 6650c97b0..f48954268 100644 --- a/Runtime/Particle/CColorElement.cpp +++ b/Runtime/Particle/CColorElement.cpp @@ -12,17 +12,17 @@ namespace metaforce { CCEKeyframeEmitter::CCEKeyframeEmitter(CInputStream& in) { - x4_percent = in.readUint32Big(); - x8_unk1 = in.readUint32Big(); - xc_loop = in.readBool(); - xd_unk2 = in.readBool(); - x10_loopEnd = in.readUint32Big(); - x14_loopStart = in.readUint32Big(); + x4_percent = in.ReadLong(); + x8_unk1 = in.ReadLong(); + xc_loop = in.ReadBool(); + xd_unk2 = in.ReadBool(); + x10_loopEnd = in.ReadLong(); + x14_loopStart = in.ReadLong(); - const u32 count = in.readUint32Big(); + const u32 count = in.ReadLong(); x18_keys.reserve(count); for (u32 i = 0; i < count; ++i) { - x18_keys.emplace_back(in.readVec4fBig()); + x18_keys.emplace_back(in.Get()); } } diff --git a/Runtime/Particle/CDecalDataFactory.cpp b/Runtime/Particle/CDecalDataFactory.cpp index 7500438b0..18a4a2668 100644 --- a/Runtime/Particle/CDecalDataFactory.cpp +++ b/Runtime/Particle/CDecalDataFactory.cpp @@ -82,7 +82,7 @@ bool CDecalDataFactory::CreateDPSM(CDecalDescription* desc, CInputStream& in, CS desc->x5c_25_DMOO = CPF::GetBool(in); break; default: { - Log.report(logvisor::Fatal, FMT_STRING("Unknown DPSC class {} @{}"), clsId, in.position()); + Log.report(logvisor::Fatal, FMT_STRING("Unknown DPSC class {} @{}"), clsId, in.GetReadPosition()); return false; } } diff --git a/Runtime/Particle/CIntElement.cpp b/Runtime/Particle/CIntElement.cpp index f061fccd9..4bc4c7a62 100644 --- a/Runtime/Particle/CIntElement.cpp +++ b/Runtime/Particle/CIntElement.cpp @@ -12,17 +12,17 @@ namespace metaforce { CIEKeyframeEmitter::CIEKeyframeEmitter(CInputStream& in) { - x4_percent = in.readUint32Big(); - x8_unk1 = in.readUint32Big(); - xc_loop = in.readBool(); - xd_unk2 = in.readBool(); - x10_loopEnd = in.readUint32Big(); - x14_loopStart = in.readUint32Big(); + x4_percent = in.ReadLong(); + x8_unk1 = in.ReadLong(); + xc_loop = in.ReadBool(); + xd_unk2 = in.ReadBool(); + x10_loopEnd = in.ReadLong(); + x14_loopStart = in.ReadLong(); - u32 count = in.readUint32Big(); + u32 count = in.ReadLong(); x18_keys.reserve(count); for (u32 i = 0; i < count; ++i) - x18_keys.push_back(in.readInt32Big()); + x18_keys.push_back(in.ReadInt32()); } bool CIEKeyframeEmitter::GetValue([[maybe_unused]] int frame, int& valOut) const { diff --git a/Runtime/Particle/CParticleDataFactory.cpp b/Runtime/Particle/CParticleDataFactory.cpp index 2613d4464..83b131520 100644 --- a/Runtime/Particle/CParticleDataFactory.cpp +++ b/Runtime/Particle/CParticleDataFactory.cpp @@ -11,20 +11,20 @@ namespace metaforce { static logvisor::Module Log("metaforce::CParticleDataFactory"); -float CParticleDataFactory::GetReal(CInputStream& in) { return in.readFloatBig(); } +float CParticleDataFactory::GetReal(CInputStream& in) { return in.ReadFloat(); } -s32 CParticleDataFactory::GetInt(CInputStream& in) { return in.readInt32Big(); } +s32 CParticleDataFactory::GetInt(CInputStream& in) { return in.ReadInt32(); } bool CParticleDataFactory::GetBool(CInputStream& in) { FourCC cid = GetClassID(in); if (cid != FOURCC('CNST')) Log.report(logvisor::Fatal, FMT_STRING("bool element does not begin with CNST")); - return in.readBool(); + return in.ReadBool(); } FourCC CParticleDataFactory::GetClassID(CInputStream& in) { u32 val = 0; - in.readBytesToBuf(&val, 4); + in.Get(reinterpret_cast(&val), 4); return val; } @@ -32,7 +32,7 @@ SParticleModel CParticleDataFactory::GetModel(CInputStream& in, CSimplePool* res FourCC clsId = GetClassID(in); if (clsId == SBIG('NONE')) return {}; - CAssetId id = in.readUint32Big(); + CAssetId id = in.Get(); if (!id.IsValid()) return {}; return {resPool->GetObj({FOURCC('CMDL'), id}), true}; @@ -50,7 +50,7 @@ SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(CInputStream& in FourCC clsId = GetClassID(in); if (clsId == SBIG('NONE')) return {}; - CAssetId id = in.readUint32Big(); + CAssetId id = in.Get(); if (!id.IsValid()) return {}; return GetChildGeneratorDesc(id, resPool, tracker); @@ -60,7 +60,7 @@ SSwooshGeneratorDesc CParticleDataFactory::GetSwooshGeneratorDesc(CInputStream& FourCC clsId = GetClassID(in); if (clsId == SBIG('NONE')) return {}; - CAssetId id = in.readUint32Big(); + CAssetId id = in.Get(); if (!id.IsValid()) return {}; return {resPool->GetObj({FOURCC('SWHC'), id}), true}; @@ -70,7 +70,7 @@ SElectricGeneratorDesc CParticleDataFactory::GetElectricGeneratorDesc(CInputStre FourCC clsId = GetClassID(in); if (clsId == SBIG('NONE')) return {}; - CAssetId id = in.readUint32Big(); + CAssetId id = in.Get(); if (!id.IsValid()) return {}; return {resPool->GetObj({FOURCC('ELSC'), id}), true}; @@ -83,7 +83,7 @@ std::unique_ptr CParticleDataFactory::GetTextureElement(CInputStream FourCC subId = GetClassID(in); if (subId == SBIG('NONE')) return nullptr; - CAssetId id = in.readUint32Big(); + CAssetId id = in.Get(); TToken txtr = resPool->GetObj({FOURCC('TXTR'), id}); return std::make_unique(std::move(txtr)); } @@ -92,7 +92,7 @@ std::unique_ptr CParticleDataFactory::GetTextureElement(CInputStream if (subId == SBIG('NONE')) { return nullptr; } - const CAssetId id = in.readUint32Big(); + const CAssetId id = in.Get(); auto a = GetIntElement(in); auto b = GetIntElement(in); auto c = GetIntElement(in); @@ -980,13 +980,13 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->xec_xd8_SELC = GetElectricGeneratorDesc(in, resPool); break; default: { - Log.report(logvisor::Fatal, FMT_STRING("Unknown GPSM class {} @{}"), clsId, in.position()); + Log.report(logvisor::Fatal, FMT_STRING("Unknown GPSM class {} @{}"), clsId, in.GetReadPosition()); return false; } } clsId = GetClassID(in); } - +#if 0 /* Now for our custom additions, if available */ if (!in.atEnd() && (in.position() + 4) < in.length()) { clsId = GetClassID(in); @@ -1004,6 +1004,8 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i clsId = GetClassID(in); } } +#endif + return true; } diff --git a/Runtime/Particle/CParticleElectricDataFactory.cpp b/Runtime/Particle/CParticleElectricDataFactory.cpp index dc6ef5f79..e2c849a1e 100644 --- a/Runtime/Particle/CParticleElectricDataFactory.cpp +++ b/Runtime/Particle/CParticleElectricDataFactory.cpp @@ -104,7 +104,7 @@ bool CParticleElectricDataFactory::CreateELSM(CElectricDescription* desc, CInput desc->x70_ZERY = CPF::GetBool(in); break; default: { - Log.report(logvisor::Fatal, FMT_STRING("Unknown ELSM class {} @{}"), clsId, in.position()); + Log.report(logvisor::Fatal, FMT_STRING("Unknown ELSM class {} @{}"), clsId, in.GetReadPosition()); return false; } } diff --git a/Runtime/Particle/CParticleSwooshDataFactory.cpp b/Runtime/Particle/CParticleSwooshDataFactory.cpp index 407f33ad6..eddd0faa5 100644 --- a/Runtime/Particle/CParticleSwooshDataFactory.cpp +++ b/Runtime/Particle/CParticleSwooshDataFactory.cpp @@ -122,7 +122,7 @@ bool CParticleSwooshDataFactory::CreateWPSM(CSwooshDescription* desc, CInputStre desc->x45_26_CRND = CPF::GetBool(in); break; default: { - Log.report(logvisor::Fatal, FMT_STRING("Unknown SWSH class {} @{}"), clsId, in.position()); + Log.report(logvisor::Fatal, FMT_STRING("Unknown SWSH class {} @{}"), clsId, in.GetReadPosition()); return false; } } diff --git a/Runtime/Particle/CProjectileWeaponDataFactory.cpp b/Runtime/Particle/CProjectileWeaponDataFactory.cpp index 554b54aeb..c388dfd82 100644 --- a/Runtime/Particle/CProjectileWeaponDataFactory.cpp +++ b/Runtime/Particle/CProjectileWeaponDataFactory.cpp @@ -158,7 +158,7 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt desc->x29_FC60 = CPF::GetBool(in); break; default: { - Log.report(logvisor::Fatal, FMT_STRING("Unknown WPSM class {} @{}"), clsId, in.position()); + Log.report(logvisor::Fatal, FMT_STRING("Unknown WPSM class {} @{}"), clsId, in.GetReadPosition()); return false; } } diff --git a/Runtime/Particle/CRealElement.cpp b/Runtime/Particle/CRealElement.cpp index e42ddd4fc..b5b313ea8 100644 --- a/Runtime/Particle/CRealElement.cpp +++ b/Runtime/Particle/CRealElement.cpp @@ -13,17 +13,17 @@ namespace metaforce { CREKeyframeEmitter::CREKeyframeEmitter(CInputStream& in) { - x4_percent = in.readUint32Big(); - x8_unk1 = in.readUint32Big(); - xc_loop = in.readBool(); - xd_unk2 = in.readBool(); - x10_loopEnd = in.readUint32Big(); - x14_loopStart = in.readUint32Big(); + x4_percent = in.ReadLong(); + x8_unk1 = in.ReadLong(); + xc_loop = in.ReadBool(); + xd_unk2 = in.ReadBool(); + x10_loopEnd = in.ReadLong(); + x14_loopStart = in.ReadLong(); - u32 count = in.readUint32Big(); + u32 count = in.ReadLong(); x18_keys.reserve(count); for (u32 i = 0; i < count; ++i) - x18_keys.push_back(in.readFloatBig()); + x18_keys.push_back(in.ReadFloat()); } bool CREKeyframeEmitter::GetValue([[maybe_unused]] int frame, float& valOut) const { diff --git a/Runtime/Particle/CSpawnSystemKeyframeData.cpp b/Runtime/Particle/CSpawnSystemKeyframeData.cpp index 4a039cc18..f75a2ae34 100644 --- a/Runtime/Particle/CSpawnSystemKeyframeData.cpp +++ b/Runtime/Particle/CSpawnSystemKeyframeData.cpp @@ -7,18 +7,18 @@ namespace metaforce { CSpawnSystemKeyframeData::CSpawnSystemKeyframeData(CInputStream& in) { - x0 = in.readUint32Big(); - x4 = in.readUint32Big(); - x8_endFrame = in.readUint32Big(); - xc = in.readUint32Big(); + x0 = in.ReadLong(); + x4 = in.ReadLong(); + x8_endFrame = in.ReadLong(); + xc = in.ReadLong(); - u32 count = in.readUint32Big(); + u32 count = in.ReadLong(); x10_spawns.reserve(count); for (u32 i = 0; i < count; ++i) { - u32 v1 = in.readUint32Big(); + u32 v1 = in.ReadLong(); x10_spawns.emplace_back(v1, std::vector()); std::vector& v2 = x10_spawns.back().second; - u32 v2c = in.readUint32Big(); + u32 v2c = in.ReadLong(); v2.reserve(v2c); for (u32 j = 0; j < v2c; ++j) v2.emplace_back(in); @@ -26,10 +26,10 @@ CSpawnSystemKeyframeData::CSpawnSystemKeyframeData(CInputStream& in) { } CSpawnSystemKeyframeData::CSpawnSystemKeyframeInfo::CSpawnSystemKeyframeInfo(CInputStream& in) { - x0_id = in.readUint32Big(); - x4 = in.readUint32Big(); - x8 = in.readUint32Big(); - xc = in.readUint32Big(); + x0_id = in.ReadLong(); + x4 = in.ReadLong(); + x8 = in.ReadLong(); + xc = in.ReadLong(); } void CSpawnSystemKeyframeData::LoadAllSpawnedSystemTokens(CSimplePool* pool) { diff --git a/Runtime/Particle/CVectorElement.cpp b/Runtime/Particle/CVectorElement.cpp index 32afa1541..ec36034c3 100644 --- a/Runtime/Particle/CVectorElement.cpp +++ b/Runtime/Particle/CVectorElement.cpp @@ -12,17 +12,17 @@ namespace metaforce { CVEKeyframeEmitter::CVEKeyframeEmitter(CInputStream& in) { - x4_percent = in.readUint32Big(); - x8_unk1 = in.readUint32Big(); - xc_loop = in.readBool(); - xd_unk2 = in.readBool(); - x10_loopEnd = in.readUint32Big(); - x14_loopStart = in.readUint32Big(); + x4_percent = in.ReadLong(); + x8_unk1 = in.ReadLong(); + xc_loop = in.ReadBool(); + xd_unk2 = in.ReadBool(); + x10_loopEnd = in.ReadLong(); + x14_loopStart = in.ReadLong(); - const u32 count = in.readUint32Big(); + const u32 count = in.ReadLong(); x18_keys.reserve(count); for (u32 i = 0; i < count; ++i) { - x18_keys.emplace_back(in.readVec3fBig()); + x18_keys.emplace_back(in.Get()); } } diff --git a/Runtime/RetroTypes.cpp b/Runtime/RetroTypes.cpp index 3cb13e09a..45ca652f8 100644 --- a/Runtime/RetroTypes.cpp +++ b/Runtime/RetroTypes.cpp @@ -1,5 +1,5 @@ #include "Runtime/RetroTypes.hpp" - +#include "Runtime/IOStreams.hpp" #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/IMain.hpp" @@ -8,28 +8,42 @@ namespace metaforce { logvisor::Module Log("metaforce::RetroTypes::CAssetId"); +SObjectTag::SObjectTag(CInputStream& in) { + in.ReadBytes(reinterpret_cast(&type), 4); + id = in.Get(); +} + +void SObjectTag::ReadMLVL(CInputStream& in) { + id = in.Get(); + in.ReadBytes(reinterpret_cast(&type), 4); +} + CAssetId::CAssetId(CInputStream& in) { - if (g_Main) { - if (g_Main->GetExpectedIdSize() == sizeof(u32)) - Assign(in.readUint32Big()); - else if (g_Main->GetExpectedIdSize() == sizeof(u64)) - Assign(in.readUint64Big()); - else + if (g_Main != nullptr) { + if (g_Main->GetExpectedIdSize() == sizeof(u32)) { + Assign(in.ReadLong()); + } else if (g_Main->GetExpectedIdSize() == sizeof(u64)) { + Assign(in.ReadLongLong()); + } else { Log.report(logvisor::Fatal, FMT_STRING("Unsupported id length {}"), g_Main->GetExpectedIdSize()); - } else + } + } else { Log.report(logvisor::Fatal, FMT_STRING("Input constructor called before runtime Main entered!")); + } } void CAssetId::PutTo(COutputStream& out) { - if (g_Main) { - if (g_Main->GetExpectedIdSize() == sizeof(u32)) - out.writeUint32Big(u32(id)); - else if (g_Main->GetExpectedIdSize() == sizeof(u64)) - out.writeUint64Big(id); - else + if (g_Main != nullptr) { + if (g_Main->GetExpectedIdSize() == sizeof(u32)) { + out.Put(u32(id)); + } else if (g_Main->GetExpectedIdSize() == sizeof(u64)) { + out.Put(id); + } else { Log.report(logvisor::Fatal, FMT_STRING("Unsupported id length {}"), g_Main->GetExpectedIdSize()); - } else + } + } else { Log.report(logvisor::Fatal, FMT_STRING("PutTo called before runtime Main entered!")); + } } } // namespace metaforce \ No newline at end of file diff --git a/Runtime/RetroTypes.hpp b/Runtime/RetroTypes.hpp index 2025461da..27746d15a 100644 --- a/Runtime/RetroTypes.hpp +++ b/Runtime/RetroTypes.hpp @@ -20,12 +20,9 @@ using namespace std::literals; -namespace athena::io { -class IStreamReader; -class IStreamWriter; -} // namespace athena::io - namespace metaforce { +class CInputStream; +class COutputStream; using kUniqueIdType = u16; static constexpr int kMaxEntities = 1024; constexpr kUniqueIdType kUniqueIdSize = sizeof(u16); @@ -194,9 +191,6 @@ public: }; #define FOURCC(chars) FourCC(SBIG(chars)) -using CInputStream = athena::io::IStreamReader; -using COutputStream = athena::io::IStreamWriter; - class CAssetId { u64 id = UINT64_MAX; @@ -226,14 +220,8 @@ struct SObjectTag { [[nodiscard]] constexpr bool operator<(const SObjectTag& other) const noexcept { return id < other.id; } constexpr SObjectTag() noexcept = default; constexpr SObjectTag(FourCC tp, CAssetId rid) noexcept : type(tp), id(rid) {} - explicit SObjectTag(CInputStream& in) { - in.readBytesToBuf(&type, 4); - id = CAssetId(in); - } - void readMLVL(CInputStream& in) { - id = CAssetId(in); - in.readBytesToBuf(&type, 4); - } + explicit SObjectTag(CInputStream& in); + void ReadMLVL(CInputStream& in); }; struct TEditorId { diff --git a/Runtime/Weapon/CBeamInfo.hpp b/Runtime/Weapon/CBeamInfo.hpp index d800a489f..80426dc45 100644 --- a/Runtime/Weapon/CBeamInfo.hpp +++ b/Runtime/Weapon/CBeamInfo.hpp @@ -32,23 +32,23 @@ class CBeamInfo { public: explicit CBeamInfo(CInputStream& in) - : x0_(in.readUint32Big()) - , x4_beamAttributes(in.readUint32Big()) - , x8_contactFxId(in.readUint32Big()) - , xc_pulseFxId(in.readUint32Big()) - , x10_textureId(in.readUint32Big()) - , x14_glowTextureId(in.readUint32Big()) - , x18_length(in.readFloatBig()) - , x1c_radius(in.readFloatBig()) - , x20_expansionSpeed(in.readFloatBig()) - , x24_lifeTime(in.readFloatBig()) - , x28_pulseSpeed(in.readFloatBig()) - , x2c_shutdownTime(in.readFloatBig()) - , x30_contactFxScale(in.readFloatBig()) - , x34_pulseFxScale(in.readFloatBig()) - , x38_travelSpeed(in.readFloatBig()) - , x3c_innerColor(zeus::CColor::ReadRGBABig(in)) - , x40_outerColor(zeus::CColor::ReadRGBABig(in)) {} + : x0_(in.ReadLong()) + , x4_beamAttributes(in.ReadLong()) + , x8_contactFxId(in.ReadLong()) + , xc_pulseFxId(in.ReadLong()) + , x10_textureId(in.ReadLong()) + , x14_glowTextureId(in.ReadLong()) + , x18_length(in.ReadFloat()) + , x1c_radius(in.ReadFloat()) + , x20_expansionSpeed(in.ReadFloat()) + , x24_lifeTime(in.ReadFloat()) + , x28_pulseSpeed(in.ReadFloat()) + , x2c_shutdownTime(in.ReadFloat()) + , x30_contactFxScale(in.ReadFloat()) + , x34_pulseFxScale(in.ReadFloat()) + , x38_travelSpeed(in.ReadFloat()) + , x3c_innerColor(in.Get()) + , x40_outerColor(in.Get()) {} CBeamInfo(s32 beamAttributes, CAssetId contactFxId, CAssetId pulseFxId, CAssetId textureId, CAssetId glowTextureId, s32 length, float radius, float expansionSpeed, float lifeTime, float pulseSpeed, float shutdownTime, diff --git a/Runtime/Weapon/CFlameInfo.cpp b/Runtime/Weapon/CFlameInfo.cpp index ff6ccd3ec..ee57308cb 100644 --- a/Runtime/Weapon/CFlameInfo.cpp +++ b/Runtime/Weapon/CFlameInfo.cpp @@ -6,11 +6,11 @@ CFlameInfo::CFlameInfo(s32 w1, s32 w2, CAssetId flameFxId, s32 w3, float f1, flo : x0_propertyCount(w1), x4_attributes(w2), x8_flameFxId(flameFxId), xc_length(w3), x10_(f1), x18_(f2), x1c_(f3) {} CFlameInfo::CFlameInfo(CInputStream& in) -: x0_propertyCount(in.readUint32Big()) -, x4_attributes(in.readUint32Big()) +: x0_propertyCount(in.ReadLong()) +, x4_attributes(in.ReadLong()) , x8_flameFxId(in) -, xc_length(in.readUint32Big()) -, x10_(in.readFloatBig()) -, x18_(in.readFloatBig()) -, x1c_(in.readFloatBig()) {} +, xc_length(in.ReadLong()) +, x10_(in.ReadFloat()) +, x18_(in.ReadFloat()) +, x1c_(in.ReadFloat()) {} } // namespace metaforce diff --git a/Runtime/Weapon/CPlasmaProjectile.hpp b/Runtime/Weapon/CPlasmaProjectile.hpp index 2dec40569..36082353a 100644 --- a/Runtime/Weapon/CPlasmaProjectile.hpp +++ b/Runtime/Weapon/CPlasmaProjectile.hpp @@ -24,7 +24,7 @@ public: : rstl::reserved_vector({a, b, c, d, e, f, g, h}) {} }; static PlayerEffectResources LoadPlayerEffectResources(CInputStream& in) { - u32 propCount = in.readUint32(); + u32 propCount = in.ReadLong(); CAssetId a{in}; CAssetId b{in}; CAssetId c{in}; diff --git a/Runtime/World/CAnimationParameters.hpp b/Runtime/World/CAnimationParameters.hpp index 486ca8708..9c7de3bd3 100644 --- a/Runtime/World/CAnimationParameters.hpp +++ b/Runtime/World/CAnimationParameters.hpp @@ -1,6 +1,7 @@ #pragma once #include "Runtime/RetroTypes.hpp" +#include "Runtime/CInputStream.hpp" namespace metaforce { @@ -14,7 +15,7 @@ public: CAnimationParameters(CAssetId ancs, u32 charIdx, u32 defaultAnim) : x0_ancs(ancs), x4_charIdx(charIdx), x8_defaultAnim(defaultAnim) {} explicit CAnimationParameters(CInputStream& in) - : x0_ancs(in.readUint32Big()), x4_charIdx(in.readUint32Big()), x8_defaultAnim(in.readUint32Big()) {} + : x0_ancs(in.ReadLong()), x4_charIdx(in.ReadLong()), x8_defaultAnim(in.ReadLong()) {} CAssetId GetACSFile() const { return x0_ancs; } u32 GetCharacter() const { return x4_charIdx; } diff --git a/Runtime/World/CDamageInfo.hpp b/Runtime/World/CDamageInfo.hpp index 40880fd05..2ea087dbb 100644 --- a/Runtime/World/CDamageInfo.hpp +++ b/Runtime/World/CDamageInfo.hpp @@ -21,12 +21,12 @@ class CDamageInfo { public: constexpr CDamageInfo() = default; explicit CDamageInfo(CInputStream& in) { - in.readUint32Big(); - x0_weaponMode = CWeaponMode(EWeaponType(in.readUint32Big())); - x8_damage = in.readFloatBig(); + in.ReadLong(); + x0_weaponMode = CWeaponMode(EWeaponType(in.ReadLong())); + x8_damage = in.ReadFloat(); xc_radiusDamage = x8_damage; - x10_radius = in.readFloatBig(); - x14_knockback = in.readFloatBig(); + x10_radius = in.ReadFloat(); + x14_knockback = in.ReadFloat(); } constexpr CDamageInfo(const CWeaponMode& mode, float damage, float radius, float knockback) : x0_weaponMode(mode), x8_damage(damage), xc_radiusDamage(damage), x10_radius(radius), x14_knockback(knockback) {} diff --git a/Runtime/World/CDamageVulnerability.cpp b/Runtime/World/CDamageVulnerability.cpp index 857012117..b1b9c8802 100644 --- a/Runtime/World/CDamageVulnerability.cpp +++ b/Runtime/World/CDamageVulnerability.cpp @@ -48,7 +48,7 @@ void CDamageVulnerability::ConstructNew(CInputStream& in, int propCount) { propCount -= 3; for (int i = 0; i < std::min(propCount, 15); ++i) { - x0_normal[i] = EVulnerability(in.readUint32Big()); + x0_normal[i] = EVulnerability(in.ReadLong()); } if (propCount < 15) { @@ -58,32 +58,32 @@ void CDamageVulnerability::ConstructNew(CInputStream& in, int propCount) { } for (int i = 15; i < propCount; ++i) { - in.readUint32Big(); + in.ReadLong(); } - x5c_deflected = EDeflectType(in.readUint32Big()); - in.readUint32Big(); + x5c_deflected = EDeflectType(in.ReadLong()); + in.ReadLong(); for (int i = 0; i < 4; ++i) { - x3c_charged[i] = EVulnerability(in.readUint32Big()); + x3c_charged[i] = EVulnerability(in.ReadLong()); } - x60_chargedDeflected = EDeflectType(in.readUint32Big()); - in.readUint32Big(); + x60_chargedDeflected = EDeflectType(in.ReadLong()); + in.ReadLong(); for (int i = 0; i < 4; ++i) { - x4c_combo[i] = EVulnerability(in.readUint32Big()); + x4c_combo[i] = EVulnerability(in.ReadLong()); } - x64_comboDeflected = EDeflectType(in.readUint32Big()); + x64_comboDeflected = EDeflectType(in.ReadLong()); } CDamageVulnerability::CDamageVulnerability(CInputStream& in) { - u32 propCount = in.readUint32Big(); + u32 propCount = in.ReadLong(); if (propCount == 11) { for (int i = 0; i < 15; ++i) { - x0_normal[i] = EVulnerability(in.readUint32Big()); + x0_normal[i] = EVulnerability(in.ReadLong()); } - x5c_deflected = EDeflectType(in.readUint32Big()); + x5c_deflected = EDeflectType(in.ReadLong()); x3c_charged[0] = x0_normal[0]; x4c_combo[0] = x0_normal[0]; x3c_charged[1] = x0_normal[1]; diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index 17b854979..8f27f16d1 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -20,11 +20,11 @@ static logvisor::Module Log("CGameArea"); CAreaRenderOctTree::CAreaRenderOctTree(const u8* buf) : x0_buf(buf) { CMemoryInStream r(x0_buf + 8, INT32_MAX); - x8_bitmapCount = r.readUint32Big(); - xc_meshCount = r.readUint32Big(); - x10_nodeCount = r.readUint32Big(); + x8_bitmapCount = r.ReadLong(); + xc_meshCount = r.ReadLong(); + x10_nodeCount = r.ReadLong(); x14_bitmapWordCount = (xc_meshCount + 31) / 32; - x18_aabb.readBoundingBoxBig(r); + x18_aabb = r.Get(); x30_bitmaps = reinterpret_cast(x0_buf + 64); u32 wc = x14_bitmapWordCount * x8_bitmapCount; @@ -239,10 +239,10 @@ void CGameArea::CAreaFog::DisableFog() { x0_fogMode = ERglFogMode::None; } static std::vector ReadDependencyList(CInputStream& in) { std::vector ret; - const u32 count = in.readUint32Big(); + const u32 count = in.ReadLong(); ret.reserve(count); for (u32 i = 0; i < count; ++i) { - ret.emplace_back().readMLVL(in); + ret.emplace_back().ReadMLVL(in); } return ret; } @@ -258,7 +258,7 @@ std::pair, s32> GetScriptingMemoryAlways(const IGameArea& } CMemoryInStream r(data.get() + 4, 96 - 4); - u32 version = r.readUint32Big(); + u32 version = r.ReadLong(); if ((version & 0x10000) == 0) { Log.report(logvisor::Fatal, FMT_STRING("Attempted to load non-URDE MREA")); } @@ -270,17 +270,17 @@ std::pair, s32> GetScriptingMemoryAlways(const IGameArea& return {}; } - header.xf.read34RowMajor(r); - header.modelCount = r.readUint32Big(); - header.secCount = r.readUint32Big(); - header.geomSecIdx = r.readUint32Big(); - header.sclySecIdx = r.readUint32Big(); - header.collisionSecIdx = r.readUint32Big(); - header.unkSecIdx = r.readUint32Big(); - header.lightSecIdx = r.readUint32Big(); - header.visiSecIdx = r.readUint32Big(); - header.pathSecIdx = r.readUint32Big(); - header.arotSecIdx = r.readUint32Big(); + header.xf = r.Get(); + header.modelCount = r.ReadLong(); + header.secCount = r.ReadLong(); + header.geomSecIdx = r.ReadLong(); + header.sclySecIdx = r.ReadLong(); + header.collisionSecIdx = r.ReadLong(); + header.unkSecIdx = r.ReadLong(); + header.lightSecIdx = r.ReadLong(); + header.visiSecIdx = r.ReadLong(); + header.pathSecIdx = r.ReadLong(); + header.arotSecIdx = r.ReadLong(); u32 dataLen = ROUND_UP_32(header.secCount * 4); @@ -291,7 +291,7 @@ std::pair, s32> GetScriptingMemoryAlways(const IGameArea& std::vector secSizes(header.secCount); u32 lastSize; for (u32 i = 0; i < header.secCount; ++i) { - lastSize = r.readUint32Big(); + lastSize = r.ReadLong(); secSizes.push_back(lastSize); } @@ -300,32 +300,31 @@ std::pair, s32> GetScriptingMemoryAlways(const IGameArea& } CDummyGameArea::CDummyGameArea(CInputStream& in, int idx, int mlvlVersion) { - x8_nameSTRG = in.readUint32Big(); - x14_transform.read34RowMajor(in); - zeus::CAABox aabb; - aabb.readBoundingBoxBig(in); - xc_mrea = in.readUint32Big(); + x8_nameSTRG = in.ReadLong(); + x14_transform = in.Get(); + zeus::CAABox aabb = in.Get(); + xc_mrea = in.ReadLong(); if (mlvlVersion > 15) { - x10_areaId = in.readUint32Big(); + x10_areaId = in.ReadLong(); } else { x10_areaId = -1; } - u32 attachAreaCount = in.readUint32Big(); + u32 attachAreaCount = in.ReadLong(); x44_attachedAreaIndices.reserve(attachAreaCount); for (u32 i = 0; i < attachAreaCount; ++i) - x44_attachedAreaIndices.push_back(in.readUint16Big()); + x44_attachedAreaIndices.push_back(in.ReadShort()); ::metaforce::ReadDependencyList(in); ::metaforce::ReadDependencyList(in); if (mlvlVersion > 13) { - u32 depCount = in.readUint32Big(); + u32 depCount = in.ReadLong(); for (u32 i = 0; i < depCount; ++i) - in.readUint32Big(); + in.ReadLong(); } - u32 dockCount = in.readUint32Big(); + u32 dockCount = in.ReadLong(); x54_docks.reserve(dockCount); for (u32 i = 0; i < dockCount; ++i) x54_docks.emplace_back(in, x14_transform); @@ -350,21 +349,21 @@ CAssetId CDummyGameArea::IGetStringTableAssetId() const { return x8_nameSTRG; } const zeus::CTransform& CDummyGameArea::IGetTM() const { return x14_transform; } CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion) : x4_selfIdx(idx) { - x8_nameSTRG = in.readUint32Big(); - xc_transform.read34RowMajor(in); + x8_nameSTRG = in.ReadLong(); + xc_transform = in.Get(); x3c_invTransform = xc_transform.inverse(); - x6c_aabb.readBoundingBoxBig(in); + x6c_aabb = in.Get(); - x84_mrea = in.readUint32Big(); + x84_mrea = in.ReadLong(); if (mlvlVersion > 15) - x88_areaId = in.readUint32Big(); + x88_areaId = in.ReadLong(); else x88_areaId = INT_MAX; - const u32 attachedCount = in.readUint32Big(); + const u32 attachedCount = in.ReadLong(); x8c_attachedAreaIndices.reserve(attachedCount); for (u32 i = 0; i < attachedCount; ++i) { - x8c_attachedAreaIndices.emplace_back(in.readUint16Big()); + x8c_attachedAreaIndices.emplace_back(in.ReadShort()); } x9c_deps1 = metaforce::ReadDependencyList(in); @@ -374,14 +373,14 @@ CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion) : x4_selfIdx(id x6c_aabb = aabb; if (mlvlVersion > 13) { - const u32 depCount = in.readUint32Big(); + const u32 depCount = in.ReadLong(); xbc_layerDepOffsets.reserve(depCount); for (u32 i = 0; i < depCount; ++i) { - xbc_layerDepOffsets.emplace_back(in.readUint32Big()); + xbc_layerDepOffsets.emplace_back(in.ReadLong()); } } - const u32 dockCount = in.readUint32Big(); + const u32 dockCount = in.ReadLong(); xcc_docks.reserve(dockCount); for (u32 i = 0; i < dockCount; ++i) { xcc_docks.emplace_back(in, xc_transform); @@ -415,7 +414,7 @@ CGameArea::CGameArea(CAssetId mreaId) : x84_mrea(mreaId), xf0_25_active{false} { CModelFlags defaultFlags; for (CMetroidModelInstance& inst : x12c_postConstructed->x4c_insts) { CGraphics::SetModelMatrix(zeus::CTransform::Translate(-inst.x34_aabb.center())); -// inst.m_instance->UpdateUniformData(defaultFlags, nullptr, nullptr); + // inst.m_instance->UpdateUniformData(defaultFlags, nullptr, nullptr); inst.m_instance->WarmupDrawSurfaces(); } CGraphics::SetProjectionState(backupProj); @@ -956,10 +955,10 @@ void CGameArea::PostConstructArea() { /* Lights section */ if (header.version > 6) { - athena::io::MemoryReader r(secIt->first, secIt->second); - u32 magic = r.readUint32Big(); + CMemoryInStream r(secIt->first, secIt->second, CMemoryInStream::EOwnerShip::NotOwned); + u32 magic = r.ReadLong(); if (magic == 0xBABEDEAD) { - u32 aCount = r.readUint32Big(); + u32 aCount = r.ReadLong(); x12c_postConstructed->x60_lightsA.reserve(aCount); x12c_postConstructed->x70_gfxLightsA.reserve(aCount); for (u32 i = 0; i < aCount; ++i) { @@ -967,7 +966,7 @@ void CGameArea::PostConstructArea() { x12c_postConstructed->x70_gfxLightsA.push_back(x12c_postConstructed->x60_lightsA.back().GetAsCGraphicsLight()); } - u32 bCount = r.readUint32Big(); + u32 bCount = r.ReadLong(); x12c_postConstructed->x80_lightsB.reserve(bCount); x12c_postConstructed->x90_gfxLightsB.reserve(bCount); for (u32 i = 0; i < bCount; ++i) { @@ -981,15 +980,15 @@ void CGameArea::PostConstructArea() { /* PVS section */ if (header.version > 7) { - athena::io::MemoryReader r(secIt->first, secIt->second); - u32 magic = r.readUint32Big(); + CMemoryInStream r(secIt->first, secIt->second, CMemoryInStream::EOwnerShip::NotOwned); + u32 magic = r.ReadLong(); if (magic == 'VISI') { - x12c_postConstructed->x10a8_pvsVersion = r.readUint32Big(); + x12c_postConstructed->x10a8_pvsVersion = r.ReadLong(); if (x12c_postConstructed->x10a8_pvsVersion == 2) { - x12c_postConstructed->x1108_29_pvsHasActors = r.readBool(); - x12c_postConstructed->x1108_30_ = r.readBool(); + x12c_postConstructed->x1108_29_pvsHasActors = r.ReadBool(); + x12c_postConstructed->x1108_30_ = r.ReadBool(); x12c_postConstructed->xa0_pvs = - std::make_unique(secIt->first + r.position(), secIt->second - r.position()); + std::make_unique(secIt->first + r.GetReadPosition(), secIt->second - r.GetReadPosition()); } } @@ -998,8 +997,8 @@ void CGameArea::PostConstructArea() { /* Pathfinding section */ if (header.version > 9) { - athena::io::MemoryReader r(secIt->first, secIt->second); - CAssetId pathId = r.readUint32Big(); + CMemoryInStream r(secIt->first, secIt->second, CMemoryInStream::EOwnerShip::NotOwned); + CAssetId pathId = r.ReadLong(); x12c_postConstructed->x10ac_pathToken = g_SimplePool->GetObj(SObjectTag{FOURCC('PATH'), pathId}); x12c_postConstructed->x10bc_pathArea = x12c_postConstructed->x10ac_pathToken.GetObj(); x12c_postConstructed->x10bc_pathArea->SetTransform(xc_transform); @@ -1017,16 +1016,17 @@ void CGameArea::PostConstructArea() { /* Resolve layer pointers */ if (x12c_postConstructed->x10c8_sclyBuf) { - athena::io::MemoryReader r(x12c_postConstructed->x10c8_sclyBuf, x12c_postConstructed->x10d0_sclySize); - hecl::DNAFourCC magic; - magic.read(r); - if (magic == hecl::FOURCC('SCLY')) { - r.readUint32Big(); - u32 layerCount = r.readUint32Big(); + CMemoryInStream r(x12c_postConstructed->x10c8_sclyBuf, x12c_postConstructed->x10d0_sclySize, + CMemoryInStream::EOwnerShip::NotOwned); + FourCC magic; + r.Get(reinterpret_cast(&magic), 4); + if (magic == FOURCC('SCLY')) { + r.ReadLong(); + u32 layerCount = r.ReadLong(); x12c_postConstructed->x110c_layerPtrs.resize(layerCount); for (u32 l = 0; l < layerCount; ++l) - x12c_postConstructed->x110c_layerPtrs[l].second = r.readUint32Big(); - const u8* ptr = x12c_postConstructed->x10c8_sclyBuf + r.position(); + x12c_postConstructed->x110c_layerPtrs[l].second = r.ReadLong(); + const u8* ptr = x12c_postConstructed->x10c8_sclyBuf + r.GetReadPosition(); for (u32 l = 0; l < layerCount; ++l) { x12c_postConstructed->x110c_layerPtrs[l].first = ptr; ptr += x12c_postConstructed->x110c_layerPtrs[l].second; @@ -1044,16 +1044,16 @@ void CGameArea::FillInStaticGeometry(bool textures) { SShader& matSet = x12c_postConstructed->m_materialSet; auto secIt = m_resolvedBufs.begin() + 2; { - athena::io::MemoryReader r(secIt->first, secIt->second); - matSet.m_matSet.read(r); + CMemoryInStream r(secIt->first, secIt->second, CMemoryInStream::EOwnerShip::NotOwned); + //matSet.m_matSet.read(r); if (textures) CBooModel::MakeTexturesFromMats(matSet.m_matSet, matSet.x0_textures, *g_SimplePool); -// matSet.InitializeLayout(nullptr); + // matSet.InitializeLayout(nullptr); ++secIt; } /* Reserve extra buffers for 16 cubemaps and shadow rendering */ -// matSet.m_geomLayout->ReserveSharedBuffers(ctx, 96 + int(EWorldShadowMode::MAX)); + // matSet.m_geomLayout->ReserveSharedBuffers(ctx, 96 + int(EWorldShadowMode::MAX)); /* Models */ for (CMetroidModelInstance& inst : x12c_postConstructed->x4c_insts) { @@ -1073,17 +1073,17 @@ void CGameArea::FillInStaticGeometry(bool textures) { } ++secIt; -// boo::ObjToken vbo; -// boo::ObjToken ibo; -// vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, secIt->first, inst.m_hmdlMeta.vertStride, -// inst.m_hmdlMeta.vertCount); + // boo::ObjToken vbo; + // boo::ObjToken ibo; + // vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, secIt->first, inst.m_hmdlMeta.vertStride, + // inst.m_hmdlMeta.vertCount); ++secIt; -// 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; const u32 surfCount = hecl::SBig(*reinterpret_cast(secIt->first)); inst.m_surfaces.reserve(surfCount); -// inst.m_shaders.reserve(surfCount); + // inst.m_shaders.reserve(surfCount); ++secIt; for (u32 j = 0; j < surfCount; ++j) { CBooSurface& surf = inst.m_surfaces.emplace_back(); @@ -1094,15 +1094,15 @@ void CGameArea::FillInStaticGeometry(bool textures) { } TToken nullModel; - inst.m_instance = std::make_unique(nullModel, nullptr, &inst.m_surfaces, matSet, //vbo, ibo, + inst.m_instance = std::make_unique(nullModel, nullptr, &inst.m_surfaces, matSet, // vbo, ibo, inst.x34_aabb, static_cast(inst.x0_visorFlags)); } for (CMetroidModelInstance& inst : x12c_postConstructed->x4c_insts) { for (CBooSurface& surf : inst.m_surfaces) { -// auto& shad = inst.m_shaders[surf.m_data.matIdx]; -// if (!shad) -// shad = matSet.BuildShader(inst.m_hmdlMeta, matSet.m_matSet.materials[surf.m_data.matIdx]); + // auto& shad = inst.m_shaders[surf.m_data.matIdx]; + // if (!shad) + // shad = matSet.BuildShader(inst.m_hmdlMeta, matSet.m_matSet.materials[surf.m_data.matIdx]); } inst.m_instance->RemapMaterialData(matSet); } @@ -1154,7 +1154,7 @@ SMREAHeader CGameArea::VerifyHeader() const { } CMemoryInStream r(x110_mreaSecBufs[0].first.get() + 4, x110_mreaSecBufs[0].second - 4); - u32 version = r.readUint32Big(); + u32 version = r.ReadLong(); if ((version & 0x10000) == 0) { Log.report(logvisor::Fatal, FMT_STRING("Attempted to load non-URDE MREA")); } @@ -1166,17 +1166,17 @@ SMREAHeader CGameArea::VerifyHeader() const { return {}; } - header.xf.read34RowMajor(r); - header.modelCount = r.readUint32Big(); - header.secCount = r.readUint32Big(); - header.geomSecIdx = r.readUint32Big(); - header.sclySecIdx = r.readUint32Big(); - header.collisionSecIdx = r.readUint32Big(); - header.unkSecIdx = r.readUint32Big(); - header.lightSecIdx = r.readUint32Big(); - header.visiSecIdx = r.readUint32Big(); - header.pathSecIdx = r.readUint32Big(); - header.arotSecIdx = r.readUint32Big(); + header.xf = r.Get(); + header.modelCount = r.ReadLong(); + header.secCount = r.ReadLong(); + header.geomSecIdx = r.ReadLong(); + header.sclySecIdx = r.ReadLong(); + header.collisionSecIdx = r.ReadLong(); + header.unkSecIdx = r.ReadLong(); + header.lightSecIdx = r.ReadLong(); + header.visiSecIdx = r.ReadLong(); + header.pathSecIdx = r.ReadLong(); + header.arotSecIdx = r.ReadLong(); return header; } diff --git a/Runtime/World/CHUDMemoParms.hpp b/Runtime/World/CHUDMemoParms.hpp index cceac81d7..2cd22bc0b 100644 --- a/Runtime/World/CHUDMemoParms.hpp +++ b/Runtime/World/CHUDMemoParms.hpp @@ -15,8 +15,8 @@ public: CHUDMemoParms(float dispTime, bool clearMemoWindow, bool fadeOutOnly, bool hintMemo) : x0_dispTime(dispTime), x4_clearMemoWindow(clearMemoWindow), x5_fadeOutOnly(fadeOutOnly), x6_hintMemo(hintMemo) {} explicit CHUDMemoParms(CInputStream& in) { - x0_dispTime = in.readFloatBig(); - x4_clearMemoWindow = in.readBool(); + x0_dispTime = in.ReadFloat(); + x4_clearMemoWindow = in.ReadBool(); } float GetDisplayTime() const { return x0_dispTime; } diff --git a/Runtime/World/CHealthInfo.cpp b/Runtime/World/CHealthInfo.cpp index efee7e7e9..54806ea22 100644 --- a/Runtime/World/CHealthInfo.cpp +++ b/Runtime/World/CHealthInfo.cpp @@ -1,11 +1,12 @@ #include "Runtime/World/CHealthInfo.hpp" +#include "Runtime/CInputStream.hpp" namespace metaforce { CHealthInfo::CHealthInfo(CInputStream& in) { - in.readUint32Big(); - x0_health = in.readFloatBig(); - x4_knockbackResistance = in.readFloatBig(); + in.ReadLong(); + x0_health = in.ReadFloat(); + x4_knockbackResistance = in.ReadFloat(); } } // namespace metaforce diff --git a/Runtime/World/CPathFindArea.cpp b/Runtime/World/CPathFindArea.cpp index d42cf8082..9829d29b1 100644 --- a/Runtime/World/CPathFindArea.cpp +++ b/Runtime/World/CPathFindArea.cpp @@ -10,13 +10,13 @@ namespace metaforce { static logvisor::Module Log("CPathFindArea"); CPFAreaOctree::CPFAreaOctree(CMemoryInStream& in) { - x0_isLeaf = in.readUint32Big(); - x4_aabb.readBoundingBoxBig(in); - x1c_center.readBig(in); + x0_isLeaf = in.ReadLong(); + x4_aabb = in.Get(); + x1c_center = in.Get(); for (auto& ptr : x28_children) - ptr = reinterpret_cast(in.readUint32Big()); - x48_regions.set_size(in.readUint32Big()); - x48_regions.set_data(reinterpret_cast(in.readUint32Big())); + ptr = reinterpret_cast(in.ReadLong()); + x48_regions.set_size(in.ReadLong()); + x48_regions.set_data(reinterpret_cast(in.ReadLong())); } void CPFAreaOctree::Fixup(CPFArea& area) { @@ -123,21 +123,21 @@ bool CPFOpenList::Test(const CPFRegion* reg) const { return x0_bitSet.Test(reg-> CPFArea::CPFArea(std::unique_ptr&& buf, u32 len) { CMemoryInStream r(buf.get(), len); - u32 version = r.readUint32Big(); + u32 version = r.ReadLong(); if (version != 4) Log.report(logvisor::Fatal, FMT_STRING("Unexpected PATH version {}, should be 4"), version); - u32 numNodes = r.readUint32Big(); + u32 numNodes = r.ReadLong(); x140_nodes.reserve(numNodes); for (u32 i = 0; i < numNodes; ++i) x140_nodes.emplace_back(r); - u32 numLinks = r.readUint32Big(); + u32 numLinks = r.ReadLong(); x148_links.reserve(numLinks); for (u32 i = 0; i < numLinks; ++i) x148_links.emplace_back(r); - u32 numRegions = r.readUint32Big(); + u32 numRegions = r.ReadLong(); x150_regions.reserve(numRegions); for (u32 i = 0; i < numRegions; ++i) x150_regions.emplace_back(r); @@ -154,22 +154,24 @@ CPFArea::CPFArea(std::unique_ptr&& buf, u32 len) { u32 numBitfieldWords = (numRegions * (numRegions - 1) / 2 + 31) / 32; x168_connectionsGround.reserve(numBitfieldWords); for (u32 i = 0; i < numBitfieldWords; ++i) - x168_connectionsGround.push_back(r.readUint32Big()); + x168_connectionsGround.push_back(r.ReadLong()); x170_connectionsFlyers.reserve(numBitfieldWords); for (u32 i = 0; i < numBitfieldWords; ++i) - x170_connectionsFlyers.push_back(r.readUint32Big()); + x170_connectionsFlyers.push_back(r.ReadLong()); - r.seek(((((numRegions * numRegions) + 31) / 32) - numBitfieldWords) * 2 * sizeof(u32)); + for (u32 i = 0; i < ((((numRegions * numRegions) + 31) / 32) - numBitfieldWords) * 2 * sizeof(u32); ++i) { + r.ReadChar(); + } - u32 numRegionLookups = r.readUint32Big(); + u32 numRegionLookups = r.ReadLong(); x160_octreeRegionLookup.reserve(numRegionLookups); for (u32 i = 0; i < numRegionLookups; ++i) - x160_octreeRegionLookup.push_back(reinterpret_cast(r.readUint32Big())); + x160_octreeRegionLookup.push_back(reinterpret_cast(r.ReadLong())); for (CPFRegion*& rl : x160_octreeRegionLookup) rl = &x150_regions[reinterpret_cast(rl)]; - u32 numOctreeNodes = r.readUint32Big(); + u32 numOctreeNodes = r.ReadLong(); x158_octree.reserve(numOctreeNodes); for (u32 i = 0; i < numOctreeNodes; ++i) x158_octree.emplace_back(r); diff --git a/Runtime/World/CPathFindRegion.cpp b/Runtime/World/CPathFindRegion.cpp index dc74b710d..26bf2195b 100644 --- a/Runtime/World/CPathFindRegion.cpp +++ b/Runtime/World/CPathFindRegion.cpp @@ -5,29 +5,29 @@ namespace metaforce { CPFNode::CPFNode(CMemoryInStream& in) { - x0_position.readBig(in); - xc_normal.readBig(in); + x0_position = in.Get(); + xc_normal = in.Get(); } CPFLink::CPFLink(CMemoryInStream& in) { - x0_node = in.readUint32Big(); - x4_region = in.readUint32Big(); - x8_2dWidth = in.readFloatBig(); - xc_oo2dWidth = in.readFloatBig(); + x0_node = in.ReadLong(); + x4_region = in.ReadLong(); + x8_2dWidth = in.ReadFloat(); + xc_oo2dWidth = in.ReadFloat(); } CPFRegion::CPFRegion(CMemoryInStream& in) { - x0_numNodes = in.readUint32Big(); - x4_startNode = reinterpret_cast(in.readUint32Big()); - x8_numLinks = in.readUint32Big(); - xc_startLink = reinterpret_cast(in.readUint32Big()); - x10_flags = in.readUint32Big(); - x14_height = in.readFloatBig(); - x18_normal.readBig(in); - x24_regionIdx = in.readUint32Big(); - x28_centroid.readBig(in); - x34_aabb.readBoundingBoxBig(in); - x4c_regionData = reinterpret_cast(in.readUint32Big()); + x0_numNodes = in.ReadLong(); + x4_startNode = reinterpret_cast(in.ReadLong()); + x8_numLinks = in.ReadLong(); + xc_startLink = reinterpret_cast(in.ReadLong()); + x10_flags = in.ReadLong(); + x14_height = in.ReadFloat(); + x18_normal = in.Get(); + x24_regionIdx = in.ReadLong(); + x28_centroid = in.Get(); + x34_aabb = in.Get(); + x4c_regionData = reinterpret_cast(in.ReadLong()); } const CPFLink* CPFRegion::GetPathLink() const { return &xc_startLink[x4c_regionData->GetPathLink()]; } diff --git a/Runtime/World/CPatternedInfo.cpp b/Runtime/World/CPatternedInfo.cpp index 48052d52a..57b839d5a 100644 --- a/Runtime/World/CPatternedInfo.cpp +++ b/Runtime/World/CPatternedInfo.cpp @@ -5,51 +5,51 @@ namespace metaforce { CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount) -: x0_mass(in.readFloatBig()) -, x4_speed(in.readFloatBig()) -, x8_turnSpeed(in.readFloatBig()) -, xc_detectionRange(in.readFloatBig()) -, x10_detectionHeightRange(in.readFloatBig()) -, x14_dectectionAngle(in.readFloatBig()) -, x18_minAttackRange(in.readFloatBig()) -, x1c_maxAttackRange(in.readFloatBig()) -, x20_averageAttackTime(in.readFloatBig()) -, x24_attackTimeVariation(in.readFloatBig()) -, x28_leashRadius(in.readFloatBig()) -, x2c_playerLeashRadius(in.readFloatBig()) -, x30_playerLeashTime(in.readFloatBig()) +: x0_mass(in.ReadFloat()) +, x4_speed(in.ReadFloat()) +, x8_turnSpeed(in.ReadFloat()) +, xc_detectionRange(in.ReadFloat()) +, x10_detectionHeightRange(in.ReadFloat()) +, x14_dectectionAngle(in.ReadFloat()) +, x18_minAttackRange(in.ReadFloat()) +, x1c_maxAttackRange(in.ReadFloat()) +, x20_averageAttackTime(in.ReadFloat()) +, x24_attackTimeVariation(in.ReadFloat()) +, x28_leashRadius(in.ReadFloat()) +, x2c_playerLeashRadius(in.ReadFloat()) +, x30_playerLeashTime(in.ReadFloat()) , x34_contactDamageInfo(in) -, x50_damageWaitTime(in.readFloatBig()) +, x50_damageWaitTime(in.ReadFloat()) , x54_healthInfo(in) , x5c_damageVulnerability(in) -, xc4_halfExtent(in.readFloatBig()) -, xc8_height(in.readFloatBig()) -, xcc_bodyOrigin(zeus::CVector3f::ReadBig(in)) -, xd8_stepUpHeight(in.readFloatBig()) -, xdc_xDamage(in.readFloatBig()) -, xe0_frozenXDamage(in.readFloatBig()) -, xe4_xDamageDelay(in.readFloatBig()) -, xe8_deathSfx(CSfxManager::TranslateSFXID(in.readUint32Big())) +, xc4_halfExtent(in.ReadFloat()) +, xc8_height(in.ReadFloat()) +, xcc_bodyOrigin(in.Get()) +, xd8_stepUpHeight(in.ReadFloat()) +, xdc_xDamage(in.ReadFloat()) +, xe0_frozenXDamage(in.ReadFloat()) +, xe4_xDamageDelay(in.ReadFloat()) +, xe8_deathSfx(CSfxManager::TranslateSFXID(in.ReadLong())) , xec_animParams(in) -, xf8_active(in.readBool()) -, xfc_stateMachineId(in.readUint32Big()) -, x100_intoFreezeDur(in.readFloatBig()) -, x104_outofFreezeDur(in.readFloatBig()) -, x108_freezeDur(in.readFloatBig()) -, x10c_pathfindingIndex(in.readUint32Big()) -, x110_particle1Scale(zeus::CVector3f::ReadBig(in)) +, xf8_active(in.ReadBool()) +, xfc_stateMachineId(in.ReadLong()) +, x100_intoFreezeDur(in.ReadFloat()) +, x104_outofFreezeDur(in.ReadFloat()) +, x108_freezeDur(in.ReadFloat()) +, x10c_pathfindingIndex(in.ReadLong()) +, x110_particle1Scale(in.Get()) , x11c_particle1(in) , x120_electric(in) { if (pcount >= 36) - x124_particle2Scale.readBig(in); + x124_particle2Scale = in.Get(); if (pcount >= 37) - x130_particle2 = CAssetId(in); + x130_particle2 = in.Get(); if (pcount >= 38) - x134_iceShatterSfx = CSfxManager::TranslateSFXID(in.readUint32Big()); + x134_iceShatterSfx = CSfxManager::TranslateSFXID(in.ReadLong()); } std::pair CPatternedInfo::HasCorrectParameterCount(CInputStream& in) { - u32 pcount = in.readUint32Big(); + u32 pcount = in.ReadLong(); return {(pcount >= 35 && pcount <= 38), pcount}; } } // namespace metaforce diff --git a/Runtime/World/CPlayerCameraBob.cpp b/Runtime/World/CPlayerCameraBob.cpp index f7516d96f..c3b429d64 100644 --- a/Runtime/World/CPlayerCameraBob.cpp +++ b/Runtime/World/CPlayerCameraBob.cpp @@ -206,22 +206,19 @@ zeus::CTransform CPlayerCameraBob::CalculateCameraBobTransformation() const { } void CPlayerCameraBob::ReadTweaks(CInputStream& in) { - if (in.hasError()) - return; - - kCameraBobExtentX = in.readFloatBig(); - kCameraBobExtentY = in.readFloatBig(); - kCameraBobPeriod = in.readFloatBig(); - kOrbitBobScale = in.readFloatBig(); - kMaxOrbitBobScale = in.readFloatBig(); - kSlowSpeedPeriodScale = in.readFloatBig(); - kTargetMagnitudeTrackingRate = in.readFloatBig(); - kLandingBobSpringConstant = in.readFloatBig(); - kViewWanderRadius = in.readFloatBig(); - kViewWanderSpeedMin = in.readFloatBig(); - kViewWanderSpeedMax = in.readFloatBig(); - kViewWanderRollVariation = in.readFloatBig(); - kGunBobMagnitude = in.readFloatBig(); - kHelmetBobMagnitude = in.readFloatBig(); + kCameraBobExtentX = in.ReadFloat(); + kCameraBobExtentY = in.ReadFloat(); + kCameraBobPeriod = in.ReadFloat(); + kOrbitBobScale = in.ReadFloat(); + kMaxOrbitBobScale = in.ReadFloat(); + kSlowSpeedPeriodScale = in.ReadFloat(); + kTargetMagnitudeTrackingRate = in.ReadFloat(); + kLandingBobSpringConstant = in.ReadFloat(); + kViewWanderRadius = in.ReadFloat(); + kViewWanderSpeedMin = in.ReadFloat(); + kViewWanderSpeedMax = in.ReadFloat(); + kViewWanderRollVariation = in.ReadFloat(); + kGunBobMagnitude = in.ReadFloat(); + kHelmetBobMagnitude = in.ReadFloat(); } } // namespace metaforce diff --git a/Runtime/World/CScriptGunTurret.cpp b/Runtime/World/CScriptGunTurret.cpp index 46038af36..c483bacda 100644 --- a/Runtime/World/CScriptGunTurret.cpp +++ b/Runtime/World/CScriptGunTurret.cpp @@ -102,43 +102,43 @@ constexpr std::array skStateToLocoTypeLookup{ } // Anonymous namespace CScriptGunTurretData::CScriptGunTurretData(CInputStream& in, s32 propCount) -: x0_intoDeactivateDelay(in.readFloatBig()) -, x4_intoActivateDelay(in.readFloatBig()) -, x8_reloadTime(in.readFloatBig()) -, xc_reloadTimeVariance(in.readFloatBig()) -, x10_panStartTime(in.readFloatBig()) -, x14_panHoldTime(in.readFloatBig()) -, x1c_leftMaxAngle(zeus::degToRad(in.readFloatBig())) -, x20_rightMaxAngle(zeus::degToRad(in.readFloatBig())) -, x24_downMaxAngle(zeus::degToRad(in.readFloatBig())) -, x28_turnSpeed(zeus::degToRad(in.readFloatBig())) -, x2c_detectionRange(in.readFloatBig()) -, x30_detectionZRange(in.readFloatBig()) -, x34_freezeDuration(in.readFloatBig()) -, x38_freezeVariance(in.readFloatBig()) -, x3c_freezeTimeout(propCount >= 48 ? in.readBool() : false) +: x0_intoDeactivateDelay(in.ReadFloat()) +, x4_intoActivateDelay(in.ReadFloat()) +, x8_reloadTime(in.ReadFloat()) +, xc_reloadTimeVariance(in.ReadFloat()) +, x10_panStartTime(in.ReadFloat()) +, x14_panHoldTime(in.ReadFloat()) +, x1c_leftMaxAngle(zeus::degToRad(in.ReadFloat())) +, x20_rightMaxAngle(zeus::degToRad(in.ReadFloat())) +, x24_downMaxAngle(zeus::degToRad(in.ReadFloat())) +, x28_turnSpeed(zeus::degToRad(in.ReadFloat())) +, x2c_detectionRange(in.ReadFloat()) +, x30_detectionZRange(in.ReadFloat()) +, x34_freezeDuration(in.ReadFloat()) +, x38_freezeVariance(in.ReadFloat()) +, x3c_freezeTimeout(propCount >= 48 ? in.ReadBool() : false) , x40_projectileRes(in) , x44_projectileDamage(in) -, x60_idleLightRes(in.readUint32Big()) -, x64_deactivateLightRes(in.readUint32Big()) -, x68_targettingLightRes(in.readUint32Big()) -, x6c_frozenEffectRes(in.readUint32Big()) -, x70_chargingEffectRes(in.readUint32Big()) -, x74_panningEffectRes(in.readUint32Big()) -, x78_visorEffectRes(propCount >= 44 ? in.readUint32Big() : -1) -, x7c_trackingSoundId(CSfxManager::TranslateSFXID(u16(in.readUint32Big()))) -, x7e_lockOnSoundId(CSfxManager::TranslateSFXID(u16(in.readUint32Big()))) -, x80_unfreezeSoundId(CSfxManager::TranslateSFXID(u16(in.readUint32Big()))) -, x82_stopClankSoundId(CSfxManager::TranslateSFXID(u16(in.readUint32Big()))) -, x84_chargingSoundId(CSfxManager::TranslateSFXID(u16(in.readUint32Big()))) -, x86_visorSoundId(propCount >= 45 ? CSfxManager::TranslateSFXID(u16(in.readUint32Big())) : u16(0xFFFF)) -, x88_extensionModelResId(in.readUint32Big()) -, x8c_extensionDropDownDist(in.readFloatBig()) -, x90_numInitialShots(in.readUint32Big()) -, x94_initialShotTableIndex(in.readUint32Big()) -, x98_numSubsequentShots(in.readUint32Big()) -, x9c_frenzyDuration(propCount >= 47 ? in.readFloatBig() : 3.f) -, xa0_scriptedStartOnly(propCount >= 46 ? in.readBool() : false) {} +, x60_idleLightRes(in.Get()) +, x64_deactivateLightRes(in.Get()) +, x68_targettingLightRes(in.Get()) +, x6c_frozenEffectRes(in.Get()) +, x70_chargingEffectRes(in.Get()) +, x74_panningEffectRes(in.Get()) +, x78_visorEffectRes(propCount >= 44 ? in.Get() : -1) +, x7c_trackingSoundId(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) +, x7e_lockOnSoundId(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) +, x80_unfreezeSoundId(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) +, x82_stopClankSoundId(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) +, x84_chargingSoundId(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) +, x86_visorSoundId(propCount >= 45 ? CSfxManager::TranslateSFXID(u16(in.ReadLong())) : u16(0xFFFF)) +, x88_extensionModelResId(in.ReadLong()) +, x8c_extensionDropDownDist(in.ReadFloat()) +, x90_numInitialShots(in.ReadLong()) +, x94_initialShotTableIndex(in.ReadLong()) +, x98_numSubsequentShots(in.ReadLong()) +, x9c_frenzyDuration(propCount >= 47 ? in.ReadFloat() : 3.f) +, xa0_scriptedStartOnly(propCount >= 46 ? in.ReadBool() : false) {} CScriptGunTurret::CScriptGunTurret(TUniqueId uid, std::string_view name, ETurretComponent comp, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData, const zeus::CAABox& aabb, diff --git a/Runtime/World/CScriptMazeNode.cpp b/Runtime/World/CScriptMazeNode.cpp index 2502d9662..87defbd79 100644 --- a/Runtime/World/CScriptMazeNode.cpp +++ b/Runtime/World/CScriptMazeNode.cpp @@ -200,7 +200,7 @@ void CScriptMazeNode::LoadMazeSeeds() { const std::unique_ptr buf = g_ResFactory->LoadResourceSync(*tag); CMemoryInStream in(buf.get(), resSize); for (auto& seed : sMazeSeeds) { - seed = in.readInt32Big(); + seed = in.ReadInt32(); } } diff --git a/Runtime/World/CScriptSpindleCamera.cpp b/Runtime/World/CScriptSpindleCamera.cpp index 9a3becedd..9bb3228e6 100644 --- a/Runtime/World/CScriptSpindleCamera.cpp +++ b/Runtime/World/CScriptSpindleCamera.cpp @@ -12,12 +12,12 @@ namespace metaforce { SSpindleProperty::SSpindleProperty(CInputStream& in) { - x4_input = ESpindleInput(in.readUint32Big()); + x4_input = ESpindleInput(in.ReadLong()); x0_flags = ScriptLoader::LoadParameterFlags(in); - x8_lowOut = in.readFloatBig(); - xc_highOut = in.readFloatBig(); - x10_lowIn = in.readFloatBig(); - x14_highIn = in.readFloatBig(); + x8_lowOut = in.ReadFloat(); + xc_highOut = in.ReadFloat(); + x10_lowIn = in.ReadFloat(); + x14_highIn = in.ReadFloat(); switch (x4_input) { case ESpindleInput::HintBallAngle: case ESpindleInput::HintBallRightAngle: diff --git a/Runtime/World/CStateMachine.cpp b/Runtime/World/CStateMachine.cpp index 2127ce4ca..5d7c82cfe 100644 --- a/Runtime/World/CStateMachine.cpp +++ b/Runtime/World/CStateMachine.cpp @@ -12,20 +12,27 @@ logvisor::Module Log("metaforce::CStateMachine"); CStateMachine::CStateMachine(CInputStream& in) { CAiTrigger* lastTrig = nullptr; - u32 stateCount = in.readUint32Big(); + u32 stateCount = in.ReadLong(); x0_states.reserve(stateCount); for (u32 i = 0; i < stateCount; ++i) { - std::string name = in.readString(31, false); + std::string name; + while (name.size() < 31) { + const auto chr = in.ReadChar(); + name += chr; + if (chr == '\0') { + break; + } + } CAiStateFunc func = CAi::GetStateFunc(name); x0_states.emplace_back(func, name.c_str()); } - x10_triggers.reserve(in.readUint32Big()); + x10_triggers.reserve(in.ReadLong()); for (u32 i = 0; i < stateCount; ++i) { - x0_states[i].SetNumTriggers(in.readUint32Big()); + x0_states[i].SetNumTriggers(in.ReadLong()); if (x0_states[i].GetNumTriggers() == 0) continue; CAiTrigger* firstTrig = x10_triggers.data() + x10_triggers.size(); @@ -33,13 +40,21 @@ CStateMachine::CStateMachine(CInputStream& in) { x10_triggers.resize(x10_triggers.size() + x0_states[i].GetNumTriggers()); for (s32 j = 0; j < x0_states[i].GetNumTriggers(); ++j) { - const u32 triggerCount = in.readUint32Big(); + const u32 triggerCount = in.ReadLong(); const u32 lastTriggerIdx = triggerCount - 1; for (u32 k = 0; k < triggerCount; ++k) { - std::string name = in.readString(31, false); + std::string name; + while (name.size() < 31) { + const auto chr = in.ReadChar(); + name += chr; + if (chr == '\0') { + break; + } + } + const bool isNot = name.front() == '!'; const CAiTriggerFunc func = CAi::GetTriggerFunc(isNot ? name.c_str() + 1 : name.c_str()); - const float arg = in.readFloatBig(); + const float arg = in.ReadFloat(); CAiTrigger* newTrig; if (k < lastTriggerIdx) { newTrig = &x10_triggers.emplace_back(); @@ -47,7 +62,7 @@ CStateMachine::CStateMachine(CInputStream& in) { newTrig = &firstTrig[j]; } if (k == 0) - newTrig->Setup(func, isNot, arg, &x0_states[in.readUint32Big()]); + newTrig->Setup(func, isNot, arg, &x0_states[in.ReadLong()]); else newTrig->Setup(func, isNot, arg, lastTrig); lastTrig = newTrig; diff --git a/Runtime/World/CTeamAiMgr.cpp b/Runtime/World/CTeamAiMgr.cpp index d3dad318c..852e3e407 100644 --- a/Runtime/World/CTeamAiMgr.cpp +++ b/Runtime/World/CTeamAiMgr.cpp @@ -38,15 +38,15 @@ struct TeamAiRoleSorter { }; CTeamAiData::CTeamAiData(CInputStream& in, s32 propCount) -: x0_aiCount(in.readUint32Big()) -, x4_meleeCount(in.readUint32Big()) -, x8_rangedCount(in.readUint32Big()) -, xc_unknownCount(in.readUint32Big()) -, x10_maxMeleeAttackerCount(in.readUint32Big()) -, x14_maxRangedAttackerCount(in.readUint32Big()) -, x18_positionMode(in.readUint32Big()) -, x1c_meleeTimeInterval(propCount > 8 ? in.readFloatBig() : 0.f) -, x20_rangedTimeInterval(propCount > 8 ? in.readFloatBig() : 0.f) {} +: x0_aiCount(in.ReadLong()) +, x4_meleeCount(in.ReadLong()) +, x8_rangedCount(in.ReadLong()) +, xc_unknownCount(in.ReadLong()) +, x10_maxMeleeAttackerCount(in.ReadLong()) +, x14_maxRangedAttackerCount(in.ReadLong()) +, x18_positionMode(in.ReadLong()) +, x1c_meleeTimeInterval(propCount > 8 ? in.ReadFloat() : 0.f) +, x20_rangedTimeInterval(propCount > 8 ? in.ReadFloat() : 0.f) {} CTeamAiMgr::CTeamAiMgr(TUniqueId uid, std::string_view name, const CEntityInfo& info, const CTeamAiData& data) : CEntity(uid, info, true, name), x34_data(data) { diff --git a/Runtime/World/CVisorFlare.cpp b/Runtime/World/CVisorFlare.cpp index 0e49a8630..d06ce9210 100644 --- a/Runtime/World/CVisorFlare.cpp +++ b/Runtime/World/CVisorFlare.cpp @@ -10,14 +10,14 @@ namespace metaforce { std::optional CVisorFlare::LoadFlareDef(CInputStream& in) { - u32 propCount = in.readUint32Big(); + u32 propCount = in.ReadLong(); if (propCount != 4) return std::nullopt; - CAssetId txtrId = in.readUint32Big(); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - zeus::CColor color = zeus::CColor::ReadRGBABig(in); + CAssetId txtrId = in.Get(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + zeus::CColor color = in.Get(); if (!txtrId.IsValid()) return std::nullopt; diff --git a/Runtime/World/CWorld.cpp b/Runtime/World/CWorld.cpp index b26688dbf..36c9d8c8f 100644 --- a/Runtime/World/CWorld.cpp +++ b/Runtime/World/CWorld.cpp @@ -61,46 +61,46 @@ TAreaId CDummyWorld::IGetAreaId(CAssetId id) const { } CWorld::CRelay::CRelay(CInputStream& in) { - x0_relay = in.readUint32Big(); - x4_target = in.readUint32Big(); - x8_msg = in.readUint16Big(); - xa_active = in.readBool(); + x0_relay = in.ReadLong(); + x4_target = in.ReadLong(); + x8_msg = in.ReadShort(); + xa_active = in.ReadBool(); } -std::vector CWorld::CRelay::ReadMemoryRelays(athena::io::MemoryReader& r) { +std::vector CWorld::CRelay::ReadMemoryRelays(CInputStream& r) { std::vector ret; - u32 count = r.readUint32Big(); + u32 count = r.ReadLong(); ret.reserve(count); for (u32 i = 0; i < count; ++i) ret.emplace_back(r); return ret; } -std::optional CWorldLayers::ReadWorldLayers(athena::io::MemoryReader& r, int version, CAssetId mlvlId) { +std::optional CWorldLayers::ReadWorldLayers(CInputStream& r, int version, CAssetId mlvlId) { if (version <= 14) { return std::nullopt; } CWorldLayers ret; - u32 areaCount = r.readUint32Big(); + u32 areaCount = r.ReadLong(); ret.m_areas.reserve(areaCount); for (u32 i = 0; i < areaCount; ++i) { auto& area = ret.m_areas.emplace_back(); - area.m_layerCount = r.readUint32Big(); - area.m_layerBits = r.readUint64Big(); + area.m_layerCount = r.ReadLong(); + area.m_layerBits = r.ReadLongLong(); } - const u32 nameCount = r.readUint32Big(); + const u32 nameCount = r.ReadLong(); ret.m_names.reserve(nameCount); for (u32 i = 0; i < nameCount; ++i) { - auto name = r.readString(); + auto name = r.Get(); ret.m_names.emplace_back(name); } - areaCount = r.readUint32Big(); + areaCount = r.ReadLong(); for (u32 i = 0; i < areaCount; ++i) { - ret.m_areas[i].m_startNameIdx = r.readUint32Big(); + ret.m_areas[i].m_startNameIdx = r.ReadLong(); } CWorldState& wldState = g_GameState->StateForWorld(mlvlId); @@ -114,42 +114,42 @@ bool CDummyWorld::ICheckWorldComplete() { case Phase::Loading: { if (!x30_loadToken->IsComplete()) return false; - athena::io::MemoryReader r(x34_loadBuf.get(), x38_bufSz); - r.readUint32Big(); - int version = r.readUint32Big(); - x10_strgId = r.readUint32Big(); + CMemoryInStream r(x34_loadBuf.get(), x38_bufSz, CMemoryInStream::EOwnerShip::NotOwned); + r.ReadLong(); + int version = r.ReadLong(); + x10_strgId = r.ReadLong(); if (version >= 15) - x14_savwId = r.readUint32Big(); + x14_savwId = r.ReadLong(); if (version >= 12) - r.readUint32Big(); + r.ReadLong(); if (version >= 17) CWorld::CRelay::ReadMemoryRelays(r); - u32 areaCount = r.readUint32Big(); - r.readUint32Big(); + u32 areaCount = r.ReadLong(); + r.ReadLong(); x18_areas.reserve(areaCount); for (u32 i = 0; i < areaCount; ++i) x18_areas.emplace_back(r, i, version); - x28_mapWorldId = r.readUint32Big(); + x28_mapWorldId = r.ReadLong(); if (x4_loadMap) x2c_mapWorld = g_SimplePool->GetObj(SObjectTag{FOURCC('MAPW'), x28_mapWorldId}); - r.readByte(); - r.readUint32Big(); + r.ReadInt8(); + r.ReadLong(); if (version > 10) { - u32 audioGroupCount = r.readUint32Big(); + u32 audioGroupCount = r.ReadLong(); for (u32 i = 0; i < audioGroupCount; ++i) { - r.readUint32Big(); - r.readUint32Big(); + r.ReadLong(); + r.ReadLong(); } } if (version > 12) - r.readString(); + r.Get(); m_worldLayers = CWorldLayers::ReadWorldLayers(r, version, xc_mlvlId); @@ -303,23 +303,23 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, CAssetId mreaId) case Phase::Loading: { if (!x3c_loadToken->IsComplete()) return false; - athena::io::MemoryReader r(x40_loadBuf.get(), x44_bufSz); - r.readUint32Big(); - int version = r.readUint32Big(); - xc_strgId = r.readUint32Big(); + CMemoryInStream r(x40_loadBuf.get(), x44_bufSz, CMemoryInStream::EOwnerShip::NotOwned); + r.ReadLong(); + int version = r.ReadLong(); + xc_strgId = r.ReadLong(); if (version >= 15) - x10_savwId = r.readUint32Big(); + x10_savwId = r.ReadLong(); if (version >= 12) { - CAssetId skyboxId = r.readUint32Big(); + CAssetId skyboxId = r.ReadLong(); if (skyboxId.IsValid() && mgr) x94_skyboxWorld = g_SimplePool->GetObj(SObjectTag{FOURCC('CMDL'), skyboxId}); } if (version >= 17) x2c_relays = CWorld::CRelay::ReadMemoryRelays(r); - u32 areaCount = r.readUint32Big(); - r.readUint32Big(); + u32 areaCount = r.ReadLong(); + r.ReadLong(); x18_areas.reserve(areaCount); for (u32 i = 0; i < areaCount; ++i) { @@ -336,7 +336,7 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, CAssetId mreaId) for (std::unique_ptr& area : x18_areas) MoveToChain(area.get(), EChain::Deallocated); - x24_mapwId = r.readUint32Big(); + x24_mapwId = r.ReadLong(); x28_mapWorld = g_SimplePool->GetObj(SObjectTag{FOURCC('MAPW'), x24_mapwId}); if (mgr) { @@ -346,17 +346,17 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, CAssetId mreaId) } if (version > 10) { - u32 audioGroupCount = r.readUint32Big(); + u32 audioGroupCount = r.ReadLong(); x74_soundGroupData.reserve(audioGroupCount); for (u32 i = 0; i < audioGroupCount; ++i) { - int grpId = r.readUint32Big(); - CAssetId agscId = r.readUint32Big(); + int grpId = r.ReadLong(); + CAssetId agscId = r.ReadLong(); x74_soundGroupData.emplace_back(grpId, agscId); } } if (version > 12) { - x84_defAudioTrack = r.readString(); + x84_defAudioTrack = r.Get(); std::string trackKey = fmt::format(FMT_STRING("WorldDefault: {}"), x8_mlvlId); if (g_TweakManager->HasTweakValue(trackKey)) x84_defAudioTrack = g_TweakManager->GetTweakValue(trackKey)->GetAudio().GetFileName(); diff --git a/Runtime/World/CWorld.hpp b/Runtime/World/CWorld.hpp index 5fa32f25c..bec6797fc 100644 --- a/Runtime/World/CWorld.hpp +++ b/Runtime/World/CWorld.hpp @@ -49,7 +49,7 @@ struct CWorldLayers { }; std::vector m_areas; std::vector m_names; - static std::optional ReadWorldLayers(athena::io::MemoryReader& r, int version, CAssetId mlvlId); + static std::optional ReadWorldLayers(CInputStream& r, int version, CAssetId mlvlId); }; class CDummyWorld : public IWorld { @@ -112,7 +112,7 @@ public: s16 GetMessage() const { return x8_msg; } bool GetActive() const { return xa_active; } - static std::vector ReadMemoryRelays(athena::io::MemoryReader& r); + static std::vector ReadMemoryRelays(CInputStream& r); }; struct CSoundGroupData { diff --git a/Runtime/World/CWorldLight.cpp b/Runtime/World/CWorldLight.cpp index 218a1d6c1..07034b7b6 100644 --- a/Runtime/World/CWorldLight.cpp +++ b/Runtime/World/CWorldLight.cpp @@ -1,20 +1,21 @@ #include "Runtime/World/CWorldLight.hpp" +#include "Runtime/IOStreams.hpp" #include namespace metaforce { CWorldLight::CWorldLight(CInputStream& in) -: x0_type(EWorldLightType(in.readUint32Big())) -, x4_color(zeus::CVector3f::ReadBig(in)) -, x10_position(zeus::CVector3f::ReadBig(in)) -, x1c_direction(zeus::CVector3f::ReadBig(in)) -, x28_q(in.readFloatBig()) -, x2c_cutoffAngle(in.readFloatBig()) -, x30_(in.readFloatBig()) -, x34_castShadows(in.readBool()) -, x38_(in.readFloatBig()) -, x3c_falloff(EFalloffType(in.readUint32Big())) -, x40_(in.readFloatBig()) {} +: x0_type(EWorldLightType(in.ReadLong())) +, x4_color(in.Get()) +, x10_position(in.Get()) +, x1c_direction(in.Get()) +, x28_q(in.ReadFloat()) +, x2c_cutoffAngle(in.ReadFloat()) +, x30_(in.ReadFloat()) +, x34_castShadows(in.ReadBool()) +, x38_(in.ReadFloat()) +, x3c_falloff(EFalloffType(in.ReadLong())) +, x40_(in.ReadFloat()) {} std::tuple CalculateLightFalloff(EFalloffType falloff, float q) { float constant = 0.f; diff --git a/Runtime/World/IGameArea.cpp b/Runtime/World/IGameArea.cpp index 82f98e1d9..283f16f0a 100644 --- a/Runtime/World/IGameArea.cpp +++ b/Runtime/World/IGameArea.cpp @@ -1,21 +1,21 @@ #include "Runtime/World/IGameArea.hpp" +#include "Runtime/IOStreams.hpp" namespace metaforce { IGameArea::Dock::Dock(metaforce::CInputStream& in, const zeus::CTransform& xf) { - u32 refCount = in.readUint32Big(); + u32 refCount = in.ReadLong(); x4_dockReferences.reserve(refCount); for (u32 i = 0; i < refCount; i++) { SDockReference ref; - ref.x0_area = in.readUint32Big(); - ref.x4_dock = in.readUint32Big(); + ref.x0_area = in.ReadLong(); + ref.x4_dock = in.ReadLong(); x4_dockReferences.push_back(ref); } - u32 vertCount = in.readUint32Big(); + u32 vertCount = in.ReadLong(); for (u32 i = 0; i < vertCount; i++) { - zeus::CVector3f vert; - vert.readBig(in); + zeus::CVector3f vert = in.Get(); x14_planeVertices.push_back(xf * vert); } } diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 3c59d0b25..235da747c 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -154,18 +154,14 @@ struct SScaledActorHead : SActorHead { }; static zeus::CTransform LoadEditorTransform(CInputStream& in) { - zeus::CVector3f position; - position.readBig(in); - zeus::CVector3f orientation; - orientation.readBig(in); + zeus::CVector3f position = in.Get(); + zeus::CVector3f orientation = in.Get(); return ScriptLoader::ConvertEditorEulerToTransform4f(orientation, position); } static zeus::CTransform LoadEditorTransformPivotOnly(CInputStream& in) { - zeus::CVector3f position; - position.readBig(in); - zeus::CVector3f orientation; - orientation.readBig(in); + zeus::CVector3f position = in.Get(); + zeus::CVector3f orientation = in.Get(); orientation.x() = 0.f; orientation.y() = 0.f; return ScriptLoader::ConvertEditorEulerToTransform4f(orientation, position); @@ -180,7 +176,7 @@ static SActorHead LoadActorHead(CInputStream& in, CStateManager& stateMgr) { static SScaledActorHead LoadScaledActorHead(CInputStream& in, CStateManager& stateMgr) { SScaledActorHead ret = LoadActorHead(in, stateMgr); - ret.x40_scale.readBig(in); + ret.x40_scale = in.Get(); return ret; } @@ -192,32 +188,32 @@ static zeus::CAABox GetCollisionBox(CStateManager& stateMgr, TAreaId id, const z } u32 ScriptLoader::LoadParameterFlags(CInputStream& in) { - u32 count = in.readUint32Big(); + u32 count = in.ReadLong(); u32 ret = 0; for (u32 i = 0; i < count; ++i) - if (in.readBool()) + if (in.ReadBool()) ret |= 1 << i; return ret; } CGrappleParameters ScriptLoader::LoadGrappleParameters(CInputStream& in) { - float a = in.readFloatBig(); - float b = in.readFloatBig(); - float c = in.readFloatBig(); - float d = in.readFloatBig(); - float e = in.readFloatBig(); - float f = in.readFloatBig(); - float g = in.readFloatBig(); - float h = in.readFloatBig(); - float i = in.readFloatBig(); - float j = in.readFloatBig(); - float k = in.readFloatBig(); - bool l = in.readBool(); + float a = in.ReadFloat(); + float b = in.ReadFloat(); + float c = in.ReadFloat(); + float d = in.ReadFloat(); + float e = in.ReadFloat(); + float f = in.ReadFloat(); + float g = in.ReadFloat(); + float h = in.ReadFloat(); + float i = in.ReadFloat(); + float j = in.ReadFloat(); + float k = in.ReadFloat(); + bool l = in.ReadBool(); return CGrappleParameters(a, b, c, d, e, f, g, h, i, j, k, l); } CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in) { - u32 propCount = in.readUint32Big(); + u32 propCount = in.ReadLong(); if (propCount >= 5 && propCount <= 0xe) { CLightParameters lParms = ScriptLoader::LoadLightParameters(in); @@ -225,22 +221,22 @@ CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in) { if (propCount > 5) sParams = LoadScannableParameters(in); - CAssetId xrayModel = in.readUint32Big(); - CAssetId xraySkin = in.readUint32Big(); - CAssetId infraModel = in.readUint32Big(); - CAssetId infraSkin = in.readUint32Big(); + CAssetId xrayModel = in.ReadLong(); + CAssetId xraySkin = in.ReadLong(); + CAssetId infraModel = in.ReadLong(); + CAssetId infraSkin = in.ReadLong(); bool globalTimeProvider = true; if (propCount > 7) - globalTimeProvider = in.readBool(); + globalTimeProvider = in.ReadBool(); float fadeInTime = 1.f; if (propCount > 8) - fadeInTime = in.readFloatBig(); + fadeInTime = in.ReadFloat(); float fadeOutTime = 1.f; if (propCount > 9) - fadeOutTime = in.readFloatBig(); + fadeOutTime = in.ReadFloat(); CVisorParameters vParms; if (propCount > 6) @@ -248,19 +244,19 @@ CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in) { bool thermalHeat = false; if (propCount > 10) - thermalHeat = in.readBool(); + thermalHeat = in.ReadBool(); bool renderUnsorted = false; if (propCount > 11) - renderUnsorted = in.readBool(); + renderUnsorted = in.ReadBool(); bool noSortThermal = false; if (propCount > 12) - noSortThermal = in.readBool(); + noSortThermal = in.ReadBool(); float thermalMag = 1.f; if (propCount > 13) - thermalMag = in.readFloatBig(); + thermalMag = in.ReadFloat(); std::pair xray = {}; if (g_ResFactory->GetResourceTypeById(xrayModel).IsValid()) @@ -277,61 +273,59 @@ CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in) { } CVisorParameters ScriptLoader::LoadVisorParameters(CInputStream& in) { - u32 propCount = in.readUint32Big(); + u32 propCount = in.ReadLong(); if (propCount >= 1 && propCount <= 3) { - bool b1 = in.readBool(); + bool b1 = in.ReadBool(); bool scanPassthrough = false; u8 mask = 0xf; if (propCount > 2) - scanPassthrough = in.readBool(); + scanPassthrough = in.ReadBool(); if (propCount >= 2) - mask = u8(in.readUint32Big()); + mask = u8(in.ReadLong()); return CVisorParameters(mask, b1, scanPassthrough); } return CVisorParameters(); } CScannableParameters ScriptLoader::LoadScannableParameters(CInputStream& in) { - u32 propCount = in.readUint32Big(); + u32 propCount = in.ReadLong(); if (propCount == 1) - return CScannableParameters(in.readUint32Big()); + return CScannableParameters(in.ReadLong()); return CScannableParameters(); } CLightParameters ScriptLoader::LoadLightParameters(CInputStream& in) { - u32 propCount = in.readUint32Big(); + u32 propCount = in.ReadLong(); if (propCount == 14) { - bool a = in.readBool(); - float b = in.readFloatBig(); - CLightParameters::EShadowTesselation shadowTess = CLightParameters::EShadowTesselation(in.readUint32Big()); - float d = in.readFloatBig(); - float e = in.readFloatBig(); + bool a = in.ReadBool(); + float b = in.ReadFloat(); + CLightParameters::EShadowTesselation shadowTess = CLightParameters::EShadowTesselation(in.ReadLong()); + float d = in.ReadFloat(); + float e = in.ReadFloat(); - zeus::CColor noLightsAmbient; - noLightsAmbient.readRGBABig(in); + zeus::CColor noLightsAmbient = in.Get(); - bool makeLights = in.readBool(); - CLightParameters::EWorldLightingOptions lightOpts = CLightParameters::EWorldLightingOptions(in.readUint32Big()); + bool makeLights = in.ReadBool(); + CLightParameters::EWorldLightingOptions lightOpts = CLightParameters::EWorldLightingOptions(in.ReadLong()); CLightParameters::ELightRecalculationOptions recalcOpts = - CLightParameters::ELightRecalculationOptions(in.readUint32Big()); + CLightParameters::ELightRecalculationOptions(in.ReadLong()); - zeus::CVector3f actorPosBias; - actorPosBias.readBig(in); + zeus::CVector3f actorPosBias = in.Get(); s32 maxDynamicLights = -1; s32 maxAreaLights = -1; if (propCount >= 12) { - maxDynamicLights = in.readUint32Big(); - maxAreaLights = in.readUint32Big(); + maxDynamicLights = in.ReadLong(); + maxAreaLights = in.ReadLong(); } bool ambientChannelOverflow = false; if (propCount >= 13) - ambientChannelOverflow = in.readBool(); + ambientChannelOverflow = in.ReadBool(); s32 layerIdx = 0; if (propCount >= 14) - layerIdx = in.readUint32Big(); + layerIdx = in.ReadLong(); return CLightParameters(a, b, shadowTess, d, e, noLightsAmbient, makeLights, lightOpts, recalcOpts, actorPosBias, maxDynamicLights, maxAreaLights, ambientChannelOverflow, layerIdx); @@ -340,39 +334,39 @@ CLightParameters ScriptLoader::LoadLightParameters(CInputStream& in) { } CAnimationParameters ScriptLoader::LoadAnimationParameters(CInputStream& in) { - CAssetId ancs = in.readUint32Big(); - s32 charIdx = in.readUint32Big(); - u32 defaultAnim = in.readUint32Big(); + CAssetId ancs = in.ReadLong(); + s32 charIdx = in.ReadLong(); + u32 defaultAnim = in.ReadLong(); return CAnimationParameters(ancs, charIdx, defaultAnim); } CFluidUVMotion ScriptLoader::LoadFluidUVMotion(CInputStream& in) { - auto motion = CFluidUVMotion::EFluidUVMotion(in.readUint32Big()); - float a = in.readFloatBig(); - float b = in.readFloatBig(); + auto motion = CFluidUVMotion::EFluidUVMotion(in.ReadLong()); + float a = in.ReadFloat(); + float b = in.ReadFloat(); b = zeus::degToRad(b) - M_PIF; - float c = in.readFloatBig(); - float d = in.readFloatBig(); + float c = in.ReadFloat(); + float d = in.ReadFloat(); CFluidUVMotion::SFluidLayerMotion pattern1Layer(motion, a, b, c, d); - motion = CFluidUVMotion::EFluidUVMotion(in.readUint32Big()); - a = in.readFloatBig(); - b = in.readFloatBig(); + motion = CFluidUVMotion::EFluidUVMotion(in.ReadLong()); + a = in.ReadFloat(); + b = in.ReadFloat(); b = zeus::degToRad(b) - M_PIF; - c = in.readFloatBig(); - d = in.readFloatBig(); + c = in.ReadFloat(); + d = in.ReadFloat(); CFluidUVMotion::SFluidLayerMotion pattern2Layer(motion, a, b, c, d); - motion = CFluidUVMotion::EFluidUVMotion(in.readUint32Big()); - a = in.readFloatBig(); - b = in.readFloatBig(); + motion = CFluidUVMotion::EFluidUVMotion(in.ReadLong()); + a = in.ReadFloat(); + b = in.ReadFloat(); b = zeus::degToRad(b) - M_PIF; - c = in.readFloatBig(); - d = in.readFloatBig(); + c = in.ReadFloat(); + d = in.ReadFloat(); CFluidUVMotion::SFluidLayerMotion colorLayer(motion, a, b, c, d); - a = in.readFloatBig(); - b = in.readFloatBig(); + a = in.ReadFloat(); + b = in.ReadFloat(); b = zeus::degToRad(b) - M_PIF; @@ -393,35 +387,33 @@ CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in, int propC SScaledActorHead head = LoadScaledActorHead(in, mgr); - zeus::CVector3f collisionExtent; - collisionExtent.readBig(in); + zeus::CVector3f collisionExtent = in.Get(); - zeus::CVector3f centroid; - centroid.readBig(in); + zeus::CVector3f centroid = in.Get(); - float mass = in.readFloatBig(); - float zMomentum = in.readFloatBig(); + float mass = in.ReadFloat(); + float zMomentum = in.ReadFloat(); CHealthInfo hInfo(in); CDamageVulnerability dVuln(in); - CAssetId staticId = in.readUint32Big(); + CAssetId staticId = in.ReadLong(); CAnimationParameters aParms = LoadAnimationParameters(in); CActorParameters actParms = LoadActorParameters(in); - bool looping = in.readBool(); - bool immovable = in.readBool(); - bool solid = in.readBool(); - bool cameraPassthrough = in.readBool(); - bool active = in.readBool(); - u32 shaderIdx = in.readUint32Big(); - float xrayAlpha = in.readFloatBig(); - bool noThermalHotZ = in.readBool(); - bool castsShadow = in.readBool(); - bool scaleAdvancementDelta = in.readBool(); - bool materialFlag54 = in.readBool(); + bool looping = in.ReadBool(); + bool immovable = in.ReadBool(); + bool solid = in.ReadBool(); + bool cameraPassthrough = in.ReadBool(); + bool active = in.ReadBool(); + u32 shaderIdx = in.ReadLong(); + float xrayAlpha = in.ReadFloat(); + bool noThermalHotZ = in.ReadBool(); + bool castsShadow = in.ReadBool(); + bool scaleAdvancementDelta = in.ReadBool(); + bool materialFlag54 = in.ReadBool(); FourCC animType = g_ResFactory->GetResourceTypeById(aParms.GetACSFile()); if (!g_ResFactory->GetResourceTypeById(staticId).IsValid() && !animType.IsValid()) @@ -461,16 +453,16 @@ CEntity* ScriptLoader::LoadWaypoint(CStateManager& mgr, CInputStream& in, int pr SActorHead head = LoadActorHead(in, mgr); - bool active = in.readBool(); - float speed = in.readFloatBig(); - float pause = in.readFloatBig(); - u32 patternTranslate = in.readUint32Big(); - u32 patternOrient = in.readUint32Big(); - u32 patternFit = in.readUint32Big(); - u32 behaviour = in.readUint32Big(); - u32 behaviourOrient = in.readUint32Big(); - u32 behaviourModifiers = in.readUint32Big(); - u32 animation = in.readUint32Big(); + bool active = in.ReadBool(); + float speed = in.ReadFloat(); + float pause = in.ReadFloat(); + u32 patternTranslate = in.ReadLong(); + u32 patternOrient = in.ReadLong(); + u32 patternFit = in.ReadLong(); + u32 behaviour = in.ReadLong(); + u32 behaviourOrient = in.ReadLong(); + u32 behaviourModifiers = in.ReadLong(); + u32 animation = in.ReadLong(); return new CScriptWaypoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, speed, pause, patternTranslate, patternOrient, patternFit, behaviour, behaviourOrient, @@ -485,17 +477,14 @@ CEntity* ScriptLoader::LoadDoor(CStateManager& mgr, CInputStream& in, int propCo CAnimationParameters aParms = LoadAnimationParameters(in); CActorParameters actParms = LoadActorParameters(in); - zeus::CVector3f orbitPos; - orbitPos.readBig(in); - zeus::CVector3f collisionExtent; - collisionExtent.readBig(in); - zeus::CVector3f offset; - offset.readBig(in); + zeus::CVector3f orbitPos = in.Get(); + zeus::CVector3f collisionExtent = in.Get(); + zeus::CVector3f offset = in.Get(); - bool active = in.readBool(); - bool open = in.readBool(); - bool projectilesCollide = in.readBool(); - float animationLength = in.readFloatBig(); + bool active = in.ReadBool(); + bool open = in.ReadBool(); + bool projectilesCollide = in.ReadBool(); + float animationLength = in.ReadFloat(); zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), collisionExtent, offset); @@ -511,7 +500,7 @@ CEntity* ScriptLoader::LoadDoor(CStateManager& mgr, CInputStream& in, int propCo if (aParms.GetACSFile() == MorphballDoorANCS.id) isMorphballDoor = true; } else if (propCount == 14) - isMorphballDoor = in.readBool(); + isMorphballDoor = in.ReadBool(); return new CScriptDoor(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, std::move(mData), actParms, orbitPos, aabb, active, open, projectilesCollide, animationLength, isMorphballDoor); @@ -523,18 +512,18 @@ CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int pro std::string name = mgr.HashInstanceName(in); - zeus::CVector3f position = zeus::CVector3f::ReadBig(in); + zeus::CVector3f position = in.Get(); - zeus::CVector3f extent = zeus::CVector3f::ReadBig(in); + zeus::CVector3f extent = in.Get(); CDamageInfo dInfo(in); - zeus::CVector3f forceVec = zeus::CVector3f::ReadBig(in); + zeus::CVector3f forceVec = in.Get(); - ETriggerFlags flags = ETriggerFlags(in.readUint32Big()); - bool active = in.readBool(); - bool b2 = in.readBool(); - bool b3 = in.readBool(); + ETriggerFlags flags = ETriggerFlags(in.ReadLong()); + bool active = in.ReadBool(); + bool b2 = in.ReadBool(); + bool b3 = in.ReadBool(); zeus::CAABox box(-extent * 0.5f, extent * 0.5f); @@ -551,11 +540,11 @@ CEntity* ScriptLoader::LoadTimer(CStateManager& mgr, CInputStream& in, int propC std::string name = mgr.HashInstanceName(in); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - bool b1 = in.readBool(); - bool b2 = in.readBool(); - bool b3 = in.readBool(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + bool b1 = in.ReadBool(); + bool b2 = in.ReadBool(); + bool b3 = in.ReadBool(); return new CScriptTimer(mgr.AllocateUniqueId(), name, info, f1, f2, b1, b2, b3); } @@ -566,10 +555,10 @@ CEntity* ScriptLoader::LoadCounter(CStateManager& mgr, CInputStream& in, int pro std::string name = mgr.HashInstanceName(in); - u32 initial = in.readUint32Big(); - u32 max = in.readUint32Big(); - bool autoReset = in.readBool(); - bool active = in.readBool(); + u32 initial = in.ReadLong(); + u32 max = in.ReadLong(); + bool autoReset = in.ReadBool(); + bool active = in.ReadBool(); return new CScriptCounter(mgr.AllocateUniqueId(), name, info, initial, max, autoReset, active); } @@ -582,10 +571,10 @@ CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, int prop CAssetId partId(in); CAssetId elscId(in); - bool hotInThermal = in.readBool(); - bool noTimerUnlessAreaOccluded = in.readBool(); - bool rebuildSystemsOnActivate = in.readBool(); - bool active = in.readBool(); + bool hotInThermal = in.ReadBool(); + bool noTimerUnlessAreaOccluded = in.ReadBool(); + bool rebuildSystemsOnActivate = in.ReadBool(); + bool active = in.ReadBool(); if (!partId.IsValid() && !elscId.IsValid()) return nullptr; @@ -593,19 +582,19 @@ CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, int prop if (!g_ResFactory->GetResourceTypeById(partId).IsValid() && !g_ResFactory->GetResourceTypeById(elscId).IsValid()) return nullptr; - bool useRateInverseCamDist = in.readBool(); - float rateInverseCamDist = in.readFloatBig(); - float rateInverseCamDistRate = in.readFloatBig(); - float duration = in.readFloatBig(); - float durationResetWhileVisible = in.readFloatBig(); - bool useRateCamDistRange = in.readBool(); - float rateCamDistRangeMin = in.readFloatBig(); - float rateCamDistRangeMax = in.readFloatBig(); - float rateCamDistRangeFarRate = in.readFloatBig(); - bool combatVisorVisible = in.readBool(); - bool thermalVisorVisible = in.readBool(); - bool xrayVisorVisible = in.readBool(); - bool dieWhenSystemsDone = in.readBool(); + bool useRateInverseCamDist = in.ReadBool(); + float rateInverseCamDist = in.ReadFloat(); + float rateInverseCamDistRate = in.ReadFloat(); + float duration = in.ReadFloat(); + float durationResetWhileVisible = in.ReadFloat(); + bool useRateCamDistRange = in.ReadBool(); + float rateCamDistRangeMin = in.ReadFloat(); + float rateCamDistRangeMax = in.ReadFloat(); + float rateCamDistRangeFarRate = in.ReadFloat(); + bool combatVisorVisible = in.ReadBool(); + bool thermalVisorVisible = in.ReadBool(); + bool xrayVisorVisible = in.ReadBool(); + bool dieWhenSystemsDone = in.ReadBool(); CLightParameters lParms = LoadLightParameters(in); @@ -623,30 +612,28 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int pr SScaledActorHead head = LoadScaledActorHead(in, mgr); - zeus::CVector3f extent; - extent.readBig(in); + zeus::CVector3f extent = in.Get(); - zeus::CVector3f centroid; - centroid.readBig(in); + zeus::CVector3f centroid = in.Get(); - CAssetId staticId = in.readUint32Big(); + CAssetId staticId = in.Get(); CAnimationParameters aParms = LoadAnimationParameters(in); CActorParameters actParms = LoadActorParameters(in); - float speed = in.readFloatBig(); - bool active = in.readBool(); - CAssetId dclnId = in.readUint32Big(); + float speed = in.ReadFloat(); + bool active = in.ReadBool(); + CAssetId dclnId = in.ReadLong(); CHealthInfo hInfo(in); CDamageVulnerability dInfo(in); - bool detectCollision = in.readBool(); - float xrayAlpha = in.readFloatBig(); - bool rainSplashes = in.readBool(); - u32 maxRainSplashes = in.readUint32Big(); - u32 rainGenRate = in.readUint32Big(); + bool detectCollision = in.ReadBool(); + float xrayAlpha = in.ReadFloat(); + bool rainSplashes = in.ReadBool(); + u32 maxRainSplashes = in.ReadLong(); + u32 rainGenRate = in.ReadLong(); FourCC animType = g_ResFactory->GetResourceTypeById(aParms.GetACSFile()); if (!g_ResFactory->GetResourceTypeById(staticId).IsValid() && !animType.IsValid()) @@ -682,23 +669,23 @@ CEntity* ScriptLoader::LoadSound(CStateManager& mgr, CInputStream& in, int propC return nullptr; SActorHead head = LoadActorHead(in, mgr); - s32 soundId = in.readInt32Big(); - bool active = in.readBool(); - float maxDist = in.readFloatBig(); - float distComp = in.readFloatBig(); - float startDelay = in.readFloatBig(); - u32 minVol = in.readUint32Big(); - u32 vol = in.readUint32Big(); - u32 prio = in.readUint32Big(); - u32 pan = in.readUint32Big(); - bool loop = in.readBool(); - bool nonEmitter = in.readBool(); - bool autoStart = in.readBool(); - bool occlusionTest = in.readBool(); - bool acoustics = in.readBool(); - bool worldSfx = in.readBool(); - bool allowDuplicates = in.readBool(); - s32 pitch = in.readInt32Big(); + s32 soundId = in.ReadInt32(); + bool active = in.ReadBool(); + float maxDist = in.ReadFloat(); + float distComp = in.ReadFloat(); + float startDelay = in.ReadFloat(); + u32 minVol = in.ReadLong(); + u32 vol = in.ReadLong(); + u32 prio = in.ReadLong(); + u32 pan = in.ReadLong(); + bool loop = in.ReadBool(); + bool nonEmitter = in.ReadBool(); + bool autoStart = in.ReadBool(); + bool occlusionTest = in.ReadBool(); + bool acoustics = in.ReadBool(); + bool worldSfx = in.ReadBool(); + bool allowDuplicates = in.ReadBool(); + s32 pitch = in.ReadInt32(); if (soundId < 0) { Log.report(logvisor::Warning, FMT_STRING("Invalid sound ID specified in Sound {} ({}), dropping..."), head.x0_name, @@ -717,15 +704,15 @@ CEntity* ScriptLoader::LoadGenerator(CStateManager& mgr, CInputStream& in, int p std::string name = mgr.HashInstanceName(in); - u32 spawnCount = in.readUint32Big(); - bool noReuseFollowers = in.readBool(); - bool noInheritXf = in.readBool(); + u32 spawnCount = in.ReadLong(); + bool noReuseFollowers = in.ReadBool(); + bool noInheritXf = in.ReadBool(); - zeus::CVector3f offset = zeus::CVector3f::ReadBig(in); + zeus::CVector3f offset = in.Get(); - bool active = in.readBool(); - float minScale = in.readFloatBig(); - float maxScale = in.readFloatBig(); + bool active = in.ReadBool(); + float minScale = in.ReadFloat(); + float maxScale = in.ReadFloat(); return new CScriptGenerator(mgr.AllocateUniqueId(), name, info, spawnCount, noReuseFollowers, offset, noInheritXf, active, minScale, maxScale); @@ -736,14 +723,12 @@ CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, int propCo return nullptr; std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - zeus::CVector3f position; - position.readBig(in); - zeus::CVector3f scale; - scale.readBig(in); - u32 dock = in.readUint32Big(); - TAreaId area = in.readUint32Big(); - bool loadConnected = in.readBool(); + bool active = in.ReadBool(); + zeus::CVector3f position = in.Get(); + zeus::CVector3f scale = in.Get(); + u32 dock = in.ReadLong(); + TAreaId area = in.ReadLong(); + bool loadConnected = in.ReadBool(); return new CScriptDock(mgr.AllocateUniqueId(), name, info, position, scale, dock, area, active, 0, loadConnected); } @@ -753,21 +738,21 @@ CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, int prop SActorHead head = LoadActorHead(in, mgr); - bool active = in.readBool(); - float shotDuration = in.readFloatBig(); - bool lookAtPlayer = in.readBool(); - bool outOfPlayerEye = in.readBool(); - bool intoPlayerEye = in.readBool(); - bool drawPlayer = in.readBool(); - bool disableInput = in.readBool(); - bool b7 = in.readBool(); - bool finishCineSkip = in.readBool(); - float fov = in.readFloatBig(); - bool checkFailsafe = in.readBool(); + bool active = in.ReadBool(); + float shotDuration = in.ReadFloat(); + bool lookAtPlayer = in.ReadBool(); + bool outOfPlayerEye = in.ReadBool(); + bool intoPlayerEye = in.ReadBool(); + bool drawPlayer = in.ReadBool(); + bool disableInput = in.ReadBool(); + bool b7 = in.ReadBool(); + bool finishCineSkip = in.ReadBool(); + float fov = in.ReadFloat(); + bool checkFailsafe = in.ReadBool(); bool disableOutOfInto = false; if (propCount > 14) - disableOutOfInto = in.readBool(); + disableOutOfInto = in.ReadBool(); s32 flags = s32(lookAtPlayer) | s32(outOfPlayerEye) << 1 | s32(intoPlayerEye) << 2 | s32(b7) << 3 | s32(finishCineSkip) << 4 | s32(disableInput) << 5 | s32(drawPlayer) << 6 | s32(checkFailsafe) << 7 | @@ -785,9 +770,9 @@ CEntity* ScriptLoader::LoadCameraWaypoint(CStateManager& mgr, CInputStream& in, SActorHead head = LoadActorHead(in, mgr); - bool active = in.readBool(); - float f1 = in.readFloatBig(); - u32 w1 = in.readUint32Big(); + bool active = in.ReadBool(); + float f1 = in.ReadFloat(); + u32 w1 = in.ReadLong(); return new CScriptCameraWaypoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, f1, w1); } @@ -806,7 +791,7 @@ CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, in CActorParameters actParms = LoadActorParameters(in); - float minTurnAngle = in.readFloatBig(); + float minTurnAngle = in.ReadFloat(); CAssetId projectile(in); CDamageInfo dInfo(in); @@ -834,22 +819,20 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int std::string name = mgr.HashInstanceName(in); - zeus::CVector3f position; - position.readBig(in); + zeus::CVector3f position = in.Get(); - zeus::CVector3f rotation; - rotation.readBig(in); + zeus::CVector3f rotation = in.Get(); rstl::reserved_vector itemCounts; itemCounts.resize(size_t(CPlayerState::EItemType::Max), 0); for (int i = 0; i < propCount - 6; ++i) - itemCounts[i] = in.readUint32Big(); + itemCounts[i] = in.ReadLong(); - bool defaultSpawn = in.readBool(); - bool active = in.readBool(); + bool defaultSpawn = in.ReadBool(); + bool active = in.ReadBool(); bool morphed = false; if (propCount > 34) - morphed = in.readBool(); + morphed = in.ReadBool(); return new CScriptSpawnPoint(mgr.AllocateUniqueId(), name, info, ConvertEditorEulerToTransform4f(rotation, position), itemCounts, defaultSpawn, active, morphed); @@ -863,39 +846,36 @@ CEntity* ScriptLoader::LoadCameraHint(CStateManager& mgr, CInputStream& in, int SActorHead head = LoadActorHead(in, mgr); - bool active = in.readBool(); - u32 prio = in.readUint32Big(); - auto behaviour = CBallCamera::EBallCameraBehaviour(in.readUint32Big()); + bool active = in.ReadBool(); + u32 prio = in.ReadLong(); + auto behaviour = CBallCamera::EBallCameraBehaviour(in.ReadLong()); u32 overrideFlags = LoadParameterFlags(in); - overrideFlags |= in.readBool() << 22; - float minDist = in.readFloatBig(); - overrideFlags |= in.readBool() << 23; - float maxDist = in.readFloatBig(); - overrideFlags |= in.readBool() << 24; - float backwardsDist = in.readFloatBig(); - overrideFlags |= in.readBool() << 25; - zeus::CVector3f lookAtOffset; - lookAtOffset.readBig(in); - overrideFlags |= in.readBool() << 26; - zeus::CVector3f chaseLookAtOffset; - chaseLookAtOffset.readBig(in); - zeus::CVector3f ballToCam; - ballToCam.readBig(in); - overrideFlags |= in.readBool() << 27; - float fov = in.readFloatBig(); - overrideFlags |= in.readBool() << 28; - float attitudeRange = zeus::degToRad(in.readFloatBig()); - overrideFlags |= in.readBool() << 29; - float azimuthRange = zeus::degToRad(in.readFloatBig()); - overrideFlags |= in.readBool() << 30; - float anglePerSecond = zeus::degToRad(in.readFloatBig()); - float clampVelRange = in.readFloatBig(); - float clampRotRange = zeus::degToRad(in.readFloatBig()); - overrideFlags |= in.readBool() << 31; - float elevation = in.readFloatBig(); - float interpolateTime = in.readFloatBig(); - float clampVelTime = in.readFloatBig(); - float controlInterpDur = in.readFloatBig(); + overrideFlags |= in.ReadBool() << 22; + float minDist = in.ReadFloat(); + overrideFlags |= in.ReadBool() << 23; + float maxDist = in.ReadFloat(); + overrideFlags |= in.ReadBool() << 24; + float backwardsDist = in.ReadFloat(); + overrideFlags |= in.ReadBool() << 25; + zeus::CVector3f lookAtOffset = in.Get(); + overrideFlags |= in.ReadBool() << 26; + zeus::CVector3f chaseLookAtOffset = in.Get(); + zeus::CVector3f ballToCam = in.Get(); + overrideFlags |= in.ReadBool() << 27; + float fov = in.ReadFloat(); + overrideFlags |= in.ReadBool() << 28; + float attitudeRange = zeus::degToRad(in.ReadFloat()); + overrideFlags |= in.ReadBool() << 29; + float azimuthRange = zeus::degToRad(in.ReadFloat()); + overrideFlags |= in.ReadBool() << 30; + float anglePerSecond = zeus::degToRad(in.ReadFloat()); + float clampVelRange = in.ReadFloat(); + float clampRotRange = zeus::degToRad(in.ReadFloat()); + overrideFlags |= in.ReadBool() << 31; + float elevation = in.ReadFloat(); + float interpolateTime = in.ReadFloat(); + float clampVelTime = in.ReadFloat(); + float controlInterpDur = in.ReadFloat(); return new CScriptCameraHint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, prio, behaviour, overrideFlags, minDist, maxDist, backwardsDist, lookAtOffset, chaseLookAtOffset, @@ -908,19 +888,19 @@ CEntity* ScriptLoader::LoadPickup(CStateManager& mgr, CInputStream& in, int prop return nullptr; SScaledActorHead head = LoadScaledActorHead(in, mgr); - zeus::CVector3f extent = zeus::CVector3f::ReadBig(in); - zeus::CVector3f offset = zeus::CVector3f::ReadBig(in); - CPlayerState::EItemType itemType = CPlayerState::EItemType(in.readUint32Big()); - u32 capacity = in.readUint32Big(); - u32 amount = in.readUint32Big(); - float possibility = in.readFloatBig(); - float lifeTime = in.readFloatBig(); - float fadeInTime = in.readFloatBig(); - CAssetId staticModel = in.readUint32Big(); + zeus::CVector3f extent = in.Get(); + zeus::CVector3f offset = in.Get(); + CPlayerState::EItemType itemType = CPlayerState::EItemType(in.ReadLong()); + u32 capacity = in.ReadLong(); + u32 amount = in.ReadLong(); + float possibility = in.ReadFloat(); + float lifeTime = in.ReadFloat(); + float fadeInTime = in.ReadFloat(); + CAssetId staticModel = in.ReadLong(); CAnimationParameters animParms = LoadAnimationParameters(in); CActorParameters actorParms = LoadActorParameters(in); - bool active = in.readBool(); - float startDelay = in.readFloatBig(); + bool active = in.ReadBool(); + float startDelay = in.ReadFloat(); CAssetId pickupEffect(in); FourCC acsType = g_ResFactory->GetResourceTypeById(animParms.GetACSFile()); @@ -952,11 +932,11 @@ CEntity* ScriptLoader::LoadMemoryRelay(CStateManager& mgr, CInputStream& in, int return nullptr; std::string name = mgr.HashInstanceName(in); - bool b1 = in.readBool(); - bool b2 = in.readBool(); + bool b1 = in.ReadBool(); + bool b2 = in.ReadBool(); bool b3 = false; if (propCount > 3) - b3 = in.readBool(); + b3 = in.ReadBool(); return new CScriptMemoryRelay(mgr.AllocateUniqueId(), name, info, b1, b2, b3); } @@ -965,10 +945,10 @@ CEntity* ScriptLoader::LoadRandomRelay(CStateManager& mgr, CInputStream& in, int if (!EnsurePropertyCount(propCount, 5, "RandomRelay")) return nullptr; std::string name = mgr.HashInstanceName(in); - u32 sendSetSize = in.readUint32Big(); - u32 sendSetVariance = in.readUint32Big(); - bool percentSize = in.readBool(); - bool active = in.readBool(); + u32 sendSetSize = in.ReadLong(); + u32 sendSetVariance = in.ReadLong(); + bool percentSize = in.ReadBool(); + bool active = in.ReadBool(); return new CScriptRandomRelay(mgr.AllocateUniqueId(), name, info, sendSetSize, sendSetVariance, percentSize, active); } @@ -979,8 +959,8 @@ CEntity* ScriptLoader::LoadRelay(CStateManager& mgr, CInputStream& in, int propC std::string name = mgr.HashInstanceName(in); if (propCount >= 3) - in.readUint32Big(); - bool b1 = in.readBool(); + in.ReadLong(); + bool b1 = in.ReadBool(); return new CScriptRelay(mgr.AllocateUniqueId(), name, info, b1); } @@ -989,9 +969,9 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int prop if (!EnsurePropertyCount(propCount, 16, "Beetle")) return nullptr; std::string name = mgr.HashInstanceName(in); - CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); + CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.ReadLong()); zeus::CTransform xfrm = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); std::pair pcount = CPatternedInfo::HasCorrectParameterCount(in); if (!pcount.first) return nullptr; @@ -999,14 +979,14 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int prop CPatternedInfo pInfo(in, pcount.second); CActorParameters aParams = LoadActorParameters(in); CDamageInfo touchDamage(in); - zeus::CVector3f tailAimReference = zeus::CVector3f::ReadBig(in); - float unused = in.readFloatBig(); + zeus::CVector3f tailAimReference = in.Get(); + float unused = in.ReadFloat(); CDamageVulnerability tailVuln(in); CDamageVulnerability platingVuln(in); - CAssetId tailModel = in.readUint32Big(); - MP1::CBeetle::EEntranceType entranceType = MP1::CBeetle::EEntranceType(in.readUint32Big()); - float initialAttackDelay = in.readFloatBig(); - float retreatTime = in.readFloatBig(); + CAssetId tailModel = in.ReadLong(); + MP1::CBeetle::EEntranceType entranceType = MP1::CBeetle::EEntranceType(in.ReadLong()); + float initialAttackDelay = in.ReadFloat(); + float retreatTime = in.ReadFloat(); FourCC animType = g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()); if (animType != SBIG('ANCS')) @@ -1033,10 +1013,10 @@ CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int pro const CHUDMemoParms hParms(in); auto displayType = CScriptHUDMemo::EDisplayType::MessageBox; if (propCount == 6) { - displayType = CScriptHUDMemo::EDisplayType(in.readUint32Big()); + displayType = CScriptHUDMemo::EDisplayType(in.ReadLong()); } - const CAssetId message = in.readUint32Big(); - const bool active = in.readBool(); + const CAssetId message = in.ReadLong(); + const bool active = in.ReadBool(); return new CScriptHUDMemo(mgr.AllocateUniqueId(), name, info, hParms, displayType, message, active); } @@ -1046,15 +1026,14 @@ CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream if (!EnsurePropertyCount(propCount, 10, "CameraFilterKeyframe")) return nullptr; std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - EFilterType ftype = EFilterType(in.readUint32Big()); - EFilterShape shape = EFilterShape(in.readUint32Big()); - u32 filterIdx = in.readUint32Big(); - u32 unk = in.readUint32Big(); - zeus::CColor color; - color.readRGBABig(in); - float timeIn = in.readFloatBig(); - float timeOut = in.readFloatBig(); + bool active = in.ReadBool(); + EFilterType ftype = EFilterType(in.ReadLong()); + EFilterShape shape = EFilterShape(in.ReadLong()); + u32 filterIdx = in.ReadLong(); + u32 unk = in.ReadLong(); + zeus::CColor color = in.Get(); + float timeIn = in.ReadFloat(); + float timeOut = in.ReadFloat(); CAssetId txtr(in); return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), name, info, ftype, shape, filterIdx, unk, color, @@ -1067,12 +1046,12 @@ CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream& return nullptr; std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - EBlurType type = EBlurType(in.readUint32Big()); - float amount = in.readFloatBig(); - u32 unk = in.readUint32Big(); - float timeIn = in.readFloatBig(); - float timeOut = in.readFloatBig(); + bool active = in.ReadBool(); + EBlurType type = EBlurType(in.ReadLong()); + float amount = in.ReadFloat(); + u32 unk = in.ReadLong(); + float timeIn = in.ReadFloat(); + float timeOut = in.ReadFloat(); return new CScriptCameraBlurKeyframe(mgr.AllocateUniqueId(), name, info, type, amount, unk, timeIn, timeOut, active); } @@ -1119,18 +1098,18 @@ CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& i return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f position(zeus::CVector3f::ReadBig(in)); - zeus::CVector3f volume(zeus::CVector3f::ReadBig(in)); + zeus::CVector3f position( in.Get()); + zeus::CVector3f volume( in.Get()); CHealthInfo hInfo(in); CDamageVulnerability dVuln(in); - u32 triggerFlags = in.readUint32Big(); + u32 triggerFlags = in.ReadLong(); triggerFlags = TransformDamagableTriggerFlags(mgr, info.GetAreaId(), triggerFlags); - CAssetId patternTex1 = in.readUint32Big(); - CAssetId patternTex2 = in.readUint32Big(); - CAssetId colorTex = in.readUint32Big(); - CScriptDamageableTrigger::ECanOrbit canOrbit = CScriptDamageableTrigger::ECanOrbit(in.readBool()); - bool active = in.readBool(); + CAssetId patternTex1 = in.ReadLong(); + CAssetId patternTex2 = in.ReadLong(); + CAssetId colorTex = in.ReadLong(); + CScriptDamageableTrigger::ECanOrbit canOrbit = CScriptDamageableTrigger::ECanOrbit(in.ReadBool()); + bool active = in.ReadBool(); CVisorParameters vParms = LoadVisorParameters(in); return new CScriptDamageableTrigger(mgr.AllocateUniqueId(), name, info, position, volume, hInfo, dVuln, triggerFlags, patternTex1, patternTex2, colorTex, canOrbit, active, vParms); @@ -1141,21 +1120,20 @@ CEntity* ScriptLoader::LoadDebris(CStateManager& mgr, CInputStream& in, int prop return nullptr; const SScaledActorHead head = LoadScaledActorHead(in, mgr); - const float zImpulse = in.readFloatBig(); - const zeus::CVector3f velocity = zeus::CVector3f::ReadBig(in); - zeus::CColor endsColor; - endsColor.readRGBABig(in); - const float mass = in.readFloatBig(); - const float restitution = in.readFloatBig(); - const float duration = in.readFloatBig(); - const auto scaleType = CScriptDebris::EScaleType(in.readUint32Big()); - const bool randomAngImpulse = in.readBool(); - const CAssetId model = in.readUint32Big(); + const float zImpulse = in.ReadFloat(); + const zeus::CVector3f velocity = in.Get(); + zeus::CColor endsColor = in.Get(); + const float mass = in.ReadFloat(); + const float restitution = in.ReadFloat(); + const float duration = in.ReadFloat(); + const auto scaleType = CScriptDebris::EScaleType(in.ReadLong()); + const bool randomAngImpulse = in.ReadBool(); + const CAssetId model = in.ReadLong(); const CActorParameters aParams = LoadActorParameters(in); - const CAssetId particleId = in.readUint32Big(); - const zeus::CVector3f particleScale = zeus::CVector3f::ReadBig(in); - const bool b1 = in.readBool(); - const bool active = in.readBool(); + const CAssetId particleId = in.ReadLong(); + const zeus::CVector3f particleScale = in.Get(); + const bool b1 = in.ReadBool(); + const bool active = in.ReadBool(); if (!g_ResFactory->GetResourceTypeById(model).IsValid()) { return nullptr; @@ -1172,7 +1150,7 @@ CEntity* ScriptLoader::LoadCameraShaker(CStateManager& mgr, CInputStream& in, in std::string name = mgr.HashInstanceName(in); CCameraShakeData shakeData = CCameraShakeData::LoadCameraShakeData(in); - bool active = in.readBool(); + bool active = in.ReadBool(); return new CScriptCameraShaker(mgr.AllocateUniqueId(), name, info, active, shakeData); } @@ -1182,12 +1160,12 @@ CEntity* ScriptLoader::LoadActorKeyframe(CStateManager& mgr, CInputStream& in, i return nullptr; std::string name = mgr.HashInstanceName(in); - s32 animId = in.readInt32Big(); - bool looping = in.readBool(); - float lifetime = in.readFloatBig(); - bool active = in.readBool(); - u32 fadeOut = in.readUint32Big(); - float totalPlayback = in.readFloatBig(); + s32 animId = in.ReadInt32(); + bool looping = in.ReadBool(); + float lifetime = in.ReadFloat(); + bool active = in.ReadBool(); + u32 fadeOut = in.ReadLong(); + float totalPlayback = in.ReadFloat(); if (animId == -1) return nullptr; @@ -1201,94 +1179,87 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f position; - position.readBig(in); - zeus::CVector3f extent; - extent.readBig(in); + zeus::CVector3f position = in.Get(); + zeus::CVector3f extent = in.Get(); CDamageInfo dInfo(in); - zeus::CVector3f orientedForce; - orientedForce.readBig(in); - ETriggerFlags triggerFlags = ETriggerFlags(in.readUint32Big()) | ETriggerFlags::DetectProjectiles1 | + zeus::CVector3f orientedForce = in.Get(); + ETriggerFlags triggerFlags = ETriggerFlags(in.ReadLong()) | ETriggerFlags::DetectProjectiles1 | ETriggerFlags::DetectProjectiles2 | ETriggerFlags::DetectProjectiles3 | ETriggerFlags::DetectProjectiles4 | ETriggerFlags::DetectBombs | ETriggerFlags::DetectPowerBombs | ETriggerFlags::DetectProjectiles5 | ETriggerFlags::DetectProjectiles6 | ETriggerFlags::DetectProjectiles7; - bool thermalCold = in.readBool(); - bool displaySurface = in.readBool(); - CAssetId patternMap1 = in.readUint32Big(); - CAssetId patternMap2 = in.readUint32Big(); - CAssetId colorMap = in.readUint32Big(); - CAssetId bumpMap = in.readUint32Big(); - CAssetId _envMap = in.readUint32Big(); - CAssetId _envBumpMap = in.readUint32Big(); - zeus::CVector3f _bumpLightDir; - _bumpLightDir.readBig(in); + bool thermalCold = in.ReadBool(); + bool displaySurface = in.ReadBool(); + CAssetId patternMap1 = in.ReadLong(); + CAssetId patternMap2 = in.ReadLong(); + CAssetId colorMap = in.ReadLong(); + CAssetId bumpMap = in.ReadLong(); + CAssetId _envMap = in.ReadLong(); + CAssetId _envBumpMap = in.ReadLong(); + zeus::CVector3f _bumpLightDir =in.Get(); zeus::CVector3f bumpLightDir = _bumpLightDir; if (!bumpLightDir.canBeNormalized()) bumpLightDir.assign(0.f, 0.f, -1.f); - float bumpScale = 1.f / in.readFloatBig(); - float morphInTime = in.readFloatBig(); - float morphOutTime = in.readFloatBig(); - bool active = in.readBool(); - auto fluidType = EFluidType(in.readUint32Big()); - bool b4 = in.readBool(); - float alpha = in.readFloatBig(); + float bumpScale = 1.f / in.ReadFloat(); + float morphInTime = in.ReadFloat(); + float morphOutTime = in.ReadFloat(); + bool active = in.ReadBool(); + auto fluidType = EFluidType(in.ReadLong()); + bool b4 = in.ReadBool(); + float alpha = in.ReadFloat(); CFluidUVMotion uvMotion = LoadFluidUVMotion(in); - float turbSpeed = in.readFloatBig(); - float turbDistance = in.readFloatBig(); - float turbFreqMax = in.readFloatBig(); - float turbFreqMin = in.readFloatBig(); - float turbPhaseMax = zeus::degToRad(in.readFloatBig()); - float turbPhaseMin = zeus::degToRad(in.readFloatBig()); - float turbAmplitudeMax = in.readFloatBig(); - float turbAmplitudeMin = in.readFloatBig(); - zeus::CColor splashColor; - splashColor.readRGBABig(in); - zeus::CColor insideFogColor; - insideFogColor.readRGBABig(in); - CAssetId splashParticle1 = in.readUint32Big(); - CAssetId splashParticle2 = in.readUint32Big(); - CAssetId splashParticle3 = in.readUint32Big(); - CAssetId visorRunoffParticle = in.readUint32Big(); - CAssetId unmorphVisorRunoffParticle = in.readUint32Big(); - u32 visorRunoffSfx = in.readUint32Big(); - u32 unmorphVisorRunoffSfx = in.readUint32Big(); - u32 splashSfx1 = in.readUint32Big(); - u32 splashSfx2 = in.readUint32Big(); - u32 splashSfx3 = in.readUint32Big(); - float tileSize = in.readFloatBig(); - u32 tileSubdivisions = in.readUint32Big(); - float specularMin = in.readFloatBig(); - float specularMax = in.readFloatBig(); - float reflectionSize = in.readFloatBig(); - float rippleIntensity = in.readFloatBig(); - float reflectionBlend = in.readFloatBig(); - float fogBias = in.readFloatBig(); - float fogMagnitude = in.readFloatBig(); - float fogSpeed = in.readFloatBig(); - zeus::CColor fogColor; - fogColor.readRGBABig(in); - CAssetId lightmap = in.readUint32Big(); - float unitsPerLightmapTexel = in.readFloatBig(); - float alphaInTime = in.readFloatBig(); - float alphaOutTime = in.readFloatBig(); - u32 w21 = in.readUint32Big(); - u32 w22 = in.readUint32Big(); - bool b5 = in.readBool(); + float turbSpeed = in.ReadFloat(); + float turbDistance = in.ReadFloat(); + float turbFreqMax = in.ReadFloat(); + float turbFreqMin = in.ReadFloat(); + float turbPhaseMax = zeus::degToRad(in.ReadFloat()); + float turbPhaseMin = zeus::degToRad(in.ReadFloat()); + float turbAmplitudeMax = in.ReadFloat(); + float turbAmplitudeMin = in.ReadFloat(); + zeus::CColor splashColor = in.Get(); + zeus::CColor insideFogColor = in.Get(); + CAssetId splashParticle1 = in.ReadLong(); + CAssetId splashParticle2 = in.ReadLong(); + CAssetId splashParticle3 = in.ReadLong(); + CAssetId visorRunoffParticle = in.ReadLong(); + CAssetId unmorphVisorRunoffParticle = in.ReadLong(); + u32 visorRunoffSfx = in.ReadLong(); + u32 unmorphVisorRunoffSfx = in.ReadLong(); + u32 splashSfx1 = in.ReadLong(); + u32 splashSfx2 = in.ReadLong(); + u32 splashSfx3 = in.ReadLong(); + float tileSize = in.ReadFloat(); + u32 tileSubdivisions = in.ReadLong(); + float specularMin = in.ReadFloat(); + float specularMax = in.ReadFloat(); + float reflectionSize = in.ReadFloat(); + float rippleIntensity = in.ReadFloat(); + float reflectionBlend = in.ReadFloat(); + float fogBias = in.ReadFloat(); + float fogMagnitude = in.ReadFloat(); + float fogSpeed = in.ReadFloat(); + zeus::CColor fogColor = in.Get(); + CAssetId lightmap = in.ReadLong(); + float unitsPerLightmapTexel = in.ReadFloat(); + float alphaInTime = in.ReadFloat(); + float alphaOutTime = in.ReadFloat(); + u32 w21 = in.ReadLong(); + u32 w22 = in.ReadLong(); + bool b5 = in.ReadBool(); std::unique_ptr bitset; u32 bitVal0 = 0; u32 bitVal1 = 0; if (b5) { - bitVal0 = in.readUint16Big(); - bitVal1 = in.readUint16Big(); + bitVal0 = in.ReadShort(); + bitVal1 = in.ReadShort(); u32 len = ((bitVal0 * bitVal1) + 31) / 31; bitset.reset(new u32[len]); - in.readBytesToBuf(bitset.get(), len * 4); + in.Get(reinterpret_cast(bitset.get()), len * 4); } zeus::CAABox box(-extent * 0.5f, extent * 0.5f); @@ -1318,10 +1289,9 @@ CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, int pro return nullptr; std::string name = mgr.HashInstanceName(in); - CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); + CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.ReadLong()); zeus::CTransform xf = LoadEditorTransformPivotOnly(in); - zeus::CVector3f scale; - scale.readBig(in); + zeus::CVector3f scale = in.Get(); std::pair verifyPair = CPatternedInfo::HasCorrectParameterCount(in); if (!verifyPair.first) @@ -1329,12 +1299,12 @@ CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, int pro CPatternedInfo pInfo(in, verifyPair.second); CActorParameters actorParms = LoadActorParameters(in); - CPatterned::EColliderType collider = CPatterned::EColliderType(in.readBool()); + CPatterned::EColliderType collider = CPatterned::EColliderType(in.ReadBool()); CDamageInfo damageInfo1(in); - CAssetId projectileWeapon = in.readUint32Big(); + CAssetId projectileWeapon = in.ReadLong(); CDamageInfo projectileDamage(in); - CAssetId projectileVisorParticle = in.readUint32Big(); - u32 projectileVisorSfx = in.readUint32Big(); + CAssetId projectileVisorParticle = in.ReadLong(); + u32 projectileVisorSfx = in.ReadLong(); const CAnimationParameters& aParms = pInfo.GetAnimationParameters(); FourCC animType = g_ResFactory->GetResourceTypeById(aParms.GetACSFile()); @@ -1430,7 +1400,7 @@ CEntity* ScriptLoader::LoadMetroidBeta(CStateManager& mgr, CInputStream& in, int #if 0 std::string name = mgr.HashInstanceName(in); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); auto pair = CPatternedInfo::HasCorrectParameterCount(in); if (!pair.first) return nullptr; @@ -1464,10 +1434,10 @@ CEntity* ScriptLoader::LoadChozoGhost(CStateManager& mgr, CInputStream& in, int CPatternedInfo pInfo(in, pair.second); CActorParameters actParms = LoadActorParameters(in); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); CAssetId wpsc1(in); CDamageInfo dInfo1(in); CAssetId wpsc2(in); @@ -1475,20 +1445,20 @@ CEntity* ScriptLoader::LoadChozoGhost(CStateManager& mgr, CInputStream& in, int MP1::CChozoGhost::CBehaveChance behaveChance1(in); MP1::CChozoGhost::CBehaveChance behaveChance2(in); MP1::CChozoGhost::CBehaveChance behaveChance3(in); - s16 sId1 = CSfxManager::TranslateSFXID(in.readUint32Big()); - float f5 = in.readFloatBig(); - s16 sId2 = CSfxManager::TranslateSFXID(in.readUint32Big()); - s16 sId3 = CSfxManager::TranslateSFXID(in.readUint32Big()); - u32 w1 = in.readUint32Big(); - float f6 = in.readFloatBig(); - u32 w2 = in.readUint32Big(); - float f7 = in.readFloatBig(); + s16 sId1 = CSfxManager::TranslateSFXID(in.ReadLong()); + float f5 = in.ReadFloat(); + s16 sId2 = CSfxManager::TranslateSFXID(in.ReadLong()); + s16 sId3 = CSfxManager::TranslateSFXID(in.ReadLong()); + u32 w1 = in.ReadLong(); + float f6 = in.ReadFloat(); + u32 w2 = in.ReadLong(); + float f7 = in.ReadFloat(); CAssetId partId(in); - s16 sId4 = CSfxManager::TranslateSFXID(in.readUint32Big()); - float f8 = in.readFloatBig(); - float f9 = in.readFloatBig(); - u32 w3 = in.readUint32Big(); - u32 w4 = in.readUint32Big(); + s16 sId4 = CSfxManager::TranslateSFXID(in.ReadLong()); + float f8 = in.ReadFloat(); + float f9 = in.ReadFloat(); + u32 w3 = in.ReadLong(); + u32 w4 = in.ReadLong(); const CAnimationParameters& animParms = pInfo.GetAnimationParameters(); if (g_ResFactory->GetResourceTypeById(animParms.GetACSFile()) != SBIG('ANCS')) @@ -1507,12 +1477,12 @@ CEntity* ScriptLoader::LoadCoverPoint(CStateManager& mgr, CInputStream& in, int return nullptr; SActorHead head = LoadActorHead(in, mgr); - bool active = in.readBool(); - u32 flags = in.readUint32Big(); - bool crouch = in.readBool(); - float horizontalAngle = in.readFloatBig(); - float verticalAngle = in.readFloatBig(); - float coverTime = in.readFloatBig(); + bool active = in.ReadBool(); + u32 flags = in.ReadLong(); + bool crouch = in.ReadBool(); + float horizontalAngle = in.ReadFloat(); + float verticalAngle = in.ReadFloat(); + float coverTime = in.ReadFloat(); return new CScriptCoverPoint(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, active, flags, crouch, horizontalAngle, verticalAngle, coverTime); @@ -1524,8 +1494,8 @@ CEntity* ScriptLoader::LoadSpiderBallWaypoint(CStateManager& mgr, CInputStream& return nullptr; SActorHead actHead = LoadActorHead(in, mgr); - bool active = in.readBool(); - u32 w1 = in.readUint32Big(); + bool active = in.ReadBool(); + u32 w1 = in.ReadLong(); return new CScriptSpiderBallWaypoint(mgr.AllocateUniqueId(), actHead.x0_name, info, actHead.x10_transform, active, w1); @@ -1551,9 +1521,9 @@ CEntity* ScriptLoader::LoadBloodFlower(CStateManager& mgr, CInputStream& in, int CAssetId partId2(in); CAssetId partId3(in); CAssetId partId4(in); - float f1 = in.readFloatBig(); + float f1 = in.ReadFloat(); CAssetId partId5(in); - u32 soundId = in.readUint32Big(); + u32 soundId = in.ReadLong(); if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS')) return nullptr; @@ -1571,18 +1541,18 @@ CEntity* ScriptLoader::LoadFlickerBat(CStateManager& mgr, CInputStream& in, int return nullptr; std::string name = mgr.HashInstanceName(in); - CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); + CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.ReadLong()); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); auto pair = CPatternedInfo::HasCorrectParameterCount(in); if (!pair.first) return nullptr; CPatternedInfo pInfo(in, pair.second); CActorParameters actParms = LoadActorParameters(in); - bool collider = in.readBool(); - bool excludePlayer = in.readBool(); - bool enableLineOfSight = in.readBool(); + bool collider = in.ReadBool(); + bool excludePlayer = in.ReadBool(); + bool enableLineOfSight = in.ReadBool(); if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS')) return nullptr; @@ -1600,14 +1570,14 @@ CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, int } SActorHead aHead = LoadActorHead(in, mgr); - bool active = in.readBool(); + bool active = in.ReadBool(); u32 flags = LoadParameterFlags(in); - float lengthExtent = in.readFloatBig(); - float filterMag = in.readFloatBig(); - float filterProportion = in.readFloatBig(); - CPathCamera::EInitialSplinePosition initPos = CPathCamera::EInitialSplinePosition(in.readUint32Big()); - float minEaseDist = in.readFloatBig(); - float maxEaseDist = in.readFloatBig(); + float lengthExtent = in.ReadFloat(); + float filterMag = in.ReadFloat(); + float filterProportion = in.ReadFloat(); + CPathCamera::EInitialSplinePosition initPos = CPathCamera::EInitialSplinePosition(in.ReadLong()); + float minEaseDist = in.ReadFloat(); + float maxEaseDist = in.ReadFloat(); return new CPathCamera(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, lengthExtent, filterMag, filterProportion, minEaseDist, maxEaseDist, flags, initPos); @@ -1619,7 +1589,7 @@ CEntity* ScriptLoader::LoadGrapplePoint(CStateManager& mgr, CInputStream& in, in std::string name = mgr.HashInstanceName(in); zeus::CTransform grappleXf = LoadEditorTransform(in); - bool active = in.readBool(); + bool active = in.ReadBool(); CGrappleParameters parameters = LoadGrappleParameters(in); return new CScriptGrapplePoint(mgr.AllocateUniqueId(), name, info, grappleXf, active, parameters); } @@ -1629,9 +1599,9 @@ CEntity* ScriptLoader::LoadPuddleSpore(CStateManager& mgr, CInputStream& in, int return nullptr; std::string name = mgr.HashInstanceName(in); - CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); + CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.ReadLong()); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); auto pair = CPatternedInfo::HasCorrectParameterCount(in); if (!pair.first) @@ -1639,13 +1609,13 @@ CEntity* ScriptLoader::LoadPuddleSpore(CStateManager& mgr, CInputStream& in, int CPatternedInfo pInfo(in, pair.second); CActorParameters actParms = LoadActorParameters(in); - bool b1 = in.readBool(); + bool b1 = in.ReadBool(); CAssetId w1(in); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); - float f5 = in.readFloatBig(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); + float f5 = in.ReadFloat(); CAssetId w2(in); CDamageInfo dInfo(in); @@ -1665,7 +1635,7 @@ CEntity* ScriptLoader::LoadDebugCameraWaypoint(CStateManager& mgr, CInputStream& return nullptr; SActorHead actHead = LoadActorHead(in, mgr); - u32 w1 = in.readUint32Big(); + u32 w1 = in.ReadLong(); return new CScriptDebugCameraWaypoint(mgr.AllocateUniqueId(), actHead.x0_name, info, actHead.x10_transform, w1); } @@ -1674,7 +1644,7 @@ CEntity* ScriptLoader::LoadSpiderBallAttractionSurface(CStateManager& mgr, CInpu if (!EnsurePropertyCount(propCount, 5, "SpiderBallAttractionSurface")) return nullptr; SScaledActorHead aHead = LoadScaledActorHead(in, mgr); - bool active = in.readBool(); + bool active = in.ReadBool(); return new CScriptSpiderBallAttractionSurface(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, aHead.x40_scale, active); } @@ -1685,22 +1655,22 @@ CEntity* ScriptLoader::LoadPuddleToadGamma(CStateManager& mgr, CInputStream& in, return nullptr; std::string name = mgr.HashInstanceName(in); - CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); + CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.ReadLong()); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); auto pair = CPatternedInfo::HasCorrectParameterCount(in); if (!pair.first) return nullptr; CPatternedInfo pInfo(in, pair.second); CActorParameters actParms = LoadActorParameters(in); - float suckForceMultiplier = in.readFloatBig(); - float suckAngle = in.readFloatBig(); - float playerSuckRange = in.readFloatBig(); - zeus::CVector3f localShootDir = zeus::CVector3f::ReadBig(in); - float playerShootSpeed = in.readFloatBig(); - float shouldAttackWaitTime = in.readFloatBig(); - float spotPlayerWaitTime = in.readFloatBig(); + float suckForceMultiplier = in.ReadFloat(); + float suckAngle = in.ReadFloat(); + float playerSuckRange = in.ReadFloat(); + zeus::CVector3f localShootDir = in.Get(); + float playerShootSpeed = in.ReadFloat(); + float shouldAttackWaitTime = in.ReadFloat(); + float spotPlayerWaitTime = in.ReadFloat(); CDamageInfo playerShootDamage(in); CDamageInfo dInfo2(in); CAssetId collisionData(in); @@ -1717,16 +1687,13 @@ CEntity* ScriptLoader::LoadDistanceFog(CStateManager& mgr, CInputStream& in, int return nullptr; std::string name = mgr.HashInstanceName(in); - u32 mode = in.readUint32Big(); - zeus::CColor color; - color.readRGBABig(in); - zeus::CVector2f range; - range.readBig(in); - float colorDelta = in.readFloatBig(); - zeus::CVector2f rangeDelta; - rangeDelta.readBig(in); - bool expl = in.readBool(); - bool active = in.readBool(); + u32 mode = in.ReadLong(); + zeus::CColor color = in.Get(); + zeus::CVector2f range = in.Get(); + float colorDelta = in.ReadFloat(); + zeus::CVector2f rangeDelta = in.Get(); + bool expl = in.ReadBool(); + bool active = in.ReadBool(); ERglFogMode realMode = ERglFogMode::None; if (mode == 0) @@ -1757,9 +1724,9 @@ CEntity* ScriptLoader::LoadFireFlea(CStateManager& mgr, CInputStream& in, int pr CPatternedInfo pInfo(in, pair.second); CActorParameters actParms = LoadActorParameters(in); - in.readBool(); - in.readBool(); - float f1 = in.readFloatBig(); + in.ReadBool(); + in.ReadBool(); + float f1 = in.ReadFloat(); if (!pInfo.GetAnimationParameters().GetACSFile().IsValid()) return nullptr; @@ -1777,7 +1744,7 @@ CEntity* ScriptLoader::LoadMetaree(CStateManager& mgr, CInputStream& in, int pro std::string name = mgr.HashInstanceName(in); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); auto pair = CPatternedInfo::HasCorrectParameterCount(in); if (!pair.first) @@ -1786,15 +1753,15 @@ CEntity* ScriptLoader::LoadMetaree(CStateManager& mgr, CInputStream& in, int pro CPatternedInfo pInfo(in, pair.second); CActorParameters aParms = LoadActorParameters(in); CDamageInfo dInfo(in); - float f1 = in.readFloatBig(); - zeus::CVector3f vec = zeus::CVector3f::ReadBig(in); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); + float f1 = in.ReadFloat(); + zeus::CVector3f vec = in.Get(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS')) return nullptr; - float f4 = in.readFloatBig(); + float f4 = in.ReadFloat(); CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true)); @@ -1808,8 +1775,8 @@ CEntity* ScriptLoader::LoadDockAreaChange(CStateManager& mgr, CInputStream& in, return nullptr; std::string name = mgr.HashInstanceName(in); - s32 w1 = in.readInt32Big(); - bool active = in.readBool(); + s32 w1 = in.ReadInt32(); + bool active = in.ReadBool(); return new CScriptDockAreaChange(mgr.AllocateUniqueId(), name, info, w1, active); } @@ -1819,11 +1786,11 @@ CEntity* ScriptLoader::LoadActorRotate(CStateManager& mgr, CInputStream& in, int return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f rotation = zeus::CVector3f::ReadBig(in); - float scale = in.readFloatBig(); - bool updateActors = in.readBool(); - bool updateOnCreation = in.readBool(); - bool active = in.readBool(); + zeus::CVector3f rotation = in.Get(); + float scale = in.ReadFloat(); + bool updateActors = in.ReadBool(); + bool updateOnCreation = in.ReadBool(); + bool active = in.ReadBool(); return new CScriptActorRotate(mgr.AllocateUniqueId(), name, info, rotation, scale, updateActors, updateOnCreation, active); @@ -1836,19 +1803,19 @@ CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in, SActorHead head = LoadActorHead(in, mgr); CScriptSpecialFunction::ESpecialFunction specialFunction = - CScriptSpecialFunction::ESpecialFunction(in.readUint32Big()); - std::string str = in.readString(); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - u32 w2 = in.readUint32Big(); - u32 w3 = in.readUint32Big(); - CPlayerState::EItemType w4 = CPlayerState::EItemType(in.readUint32Big()); - bool active1 = in.readBool(); - float f4 = in.readFloatBig(); - s16 w5 = in.readUint32Big() & 0xFFFF; - s16 w6 = in.readUint32Big() & 0xFFFF; - s16 w7 = in.readUint32Big() & 0xFFFF; + CScriptSpecialFunction::ESpecialFunction(in.ReadLong()); + std::string str = in.Get(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + u32 w2 = in.ReadLong(); + u32 w3 = in.ReadLong(); + CPlayerState::EItemType w4 = CPlayerState::EItemType(in.ReadLong()); + bool active1 = in.ReadBool(); + float f4 = in.ReadFloat(); + s16 w5 = in.ReadLong() & 0xFFFF; + s16 w6 = in.ReadLong() & 0xFFFF; + s16 w7 = in.ReadLong() & 0xFFFF; if (specialFunction == CScriptSpecialFunction::ESpecialFunction::FogVolume || specialFunction == CScriptSpecialFunction::ESpecialFunction::RadialDamage) return nullptr; @@ -1868,11 +1835,11 @@ CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, int p CPatternedInfo pInfo(in, pair.second); CActorParameters actParms = LoadActorParameters(in); - in.readBool(); - float maxDetectionRange = in.readFloatBig(); - float maxHearingRange = in.readFloatBig(); - float maxSightRange = in.readFloatBig(); - float hideTime = in.readFloatBig(); + in.ReadBool(); + float maxDetectionRange = in.ReadFloat(); + float maxHearingRange = in.ReadFloat(); + float maxSightRange = in.ReadFloat(); + float hideTime = in.ReadFloat(); const CAnimationParameters& animParms = pInfo.GetAnimationParameters(); if (!animParms.GetACSFile().IsValid()) @@ -1889,9 +1856,9 @@ CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int pr return nullptr; std::string name = mgr.HashInstanceName(in); - CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); + CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.ReadLong()); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); std::pair pcount = CPatternedInfo::HasCorrectParameterCount(in); if (!pcount.first) @@ -1899,24 +1866,24 @@ CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int pr CPatternedInfo pInfo(in, pcount.second); CActorParameters aParms = LoadActorParameters(in); - float maxTelegraphReactDist = in.readFloatBig(); - float advanceWpRadius = in.readFloatBig(); - float f3 = in.readFloatBig(); - float alignAngVel = in.readFloatBig(); - float f5 = in.readFloatBig(); - float stuckTimeThreshold = in.readFloatBig(); - float collisionCloseMargin = in.readFloatBig(); - float parasiteSearchRadius = in.readFloatBig(); - float parasiteSeparationDist = in.readFloatBig(); - float parasiteSeparationWeight = in.readFloatBig(); - float parasiteAlignmentWeight = in.readFloatBig(); - float parasiteCohesionWeight = in.readFloatBig(); - float destinationSeekWeight = in.readFloatBig(); - float forwardMoveWeight = in.readFloatBig(); - float playerSeparationDist = in.readFloatBig(); - float playerSeparationWeight = in.readFloatBig(); - float playerObstructionMinDist = in.readFloatBig(); - bool disableMove = in.readBool(); + float maxTelegraphReactDist = in.ReadFloat(); + float advanceWpRadius = in.ReadFloat(); + float f3 = in.ReadFloat(); + float alignAngVel = in.ReadFloat(); + float f5 = in.ReadFloat(); + float stuckTimeThreshold = in.ReadFloat(); + float collisionCloseMargin = in.ReadFloat(); + float parasiteSearchRadius = in.ReadFloat(); + float parasiteSeparationDist = in.ReadFloat(); + float parasiteSeparationWeight = in.ReadFloat(); + float parasiteAlignmentWeight = in.ReadFloat(); + float parasiteCohesionWeight = in.ReadFloat(); + float destinationSeekWeight = in.ReadFloat(); + float forwardMoveWeight = in.ReadFloat(); + float playerSeparationDist = in.ReadFloat(); + float playerSeparationWeight = in.ReadFloat(); + float playerObstructionMinDist = in.ReadFloat(); + bool disableMove = in.ReadBool(); if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS')) return nullptr; @@ -1937,9 +1904,9 @@ CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, int return nullptr; SActorHead aHead = LoadActorHead(in, mgr); - bool active = in.readBool(); + bool active = in.ReadBool(); u32 overrideFlags = LoadParameterFlags(in); - u32 priority = in.readUint32Big(); + u32 priority = in.ReadLong(); return new CScriptPlayerHint(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, priority, overrideFlags); @@ -1950,9 +1917,9 @@ CEntity* ScriptLoader::LoadRipper(CStateManager& mgr, CInputStream& in, int prop return nullptr; std::string name = mgr.HashInstanceName(in); - CPatterned::EFlavorType type = CPatterned::EFlavorType(in.readUint32Big()); + CPatterned::EFlavorType type = CPatterned::EFlavorType(in.ReadLong()); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); auto pair = CPatternedInfo::HasCorrectParameterCount(in); if (!pair.first) return nullptr; @@ -1977,9 +1944,9 @@ CEntity* ScriptLoader::LoadPickupGenerator(CStateManager& mgr, CInputStream& in, return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f pos = zeus::CVector3f::ReadBig(in); - bool active = in.readBool(); - float f1 = in.readFloatBig(); + zeus::CVector3f pos = in.Get(); + bool active = in.ReadBool(); + float f1 = in.ReadFloat(); return new CScriptPickupGenerator(mgr.AllocateUniqueId(), name, info, pos, f1, active); } @@ -1997,20 +1964,20 @@ CEntity* ScriptLoader::LoadPointOfInterest(CStateManager& mgr, CInputStream& in, return nullptr; SActorHead aHead = LoadActorHead(in, mgr); - bool active = in.readBool(); + bool active = in.ReadBool(); CScannableParameters sParms = LoadScannableParameters(in); - float pointSize = in.readFloatBig(); + float pointSize = in.ReadFloat(); return new CScriptPointOfInterest(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, sParms, pointSize); } std::optional LoadFlareDef(CInputStream& in) { - if (in.readUint32Big() == 4) { + if (in.ReadLong() == 4) { CAssetId textureId(in); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - zeus::CColor color = zeus::CColor::ReadRGBABig(in); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + zeus::CColor color = in.Get(); if (textureId.IsValid()) { return {CVisorFlare::CFlareDef(g_SimplePool->GetObj({SBIG('TXTR'), textureId}), f1, f2, color)}; } @@ -2024,20 +1991,20 @@ CEntity* ScriptLoader::LoadDrone(CStateManager& mgr, CInputStream& in, int propC return nullptr; std::string name = mgr.HashInstanceName(in); - CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); + CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.ReadLong()); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); - float f1 = in.readFloatBig(); + zeus::CVector3f scale = in.Get(); + float f1 = in.ReadFloat(); const auto [patternedValid, patternedPropCount] = CPatternedInfo::HasCorrectParameterCount(in); if (!patternedValid) return nullptr; CPatternedInfo pInfo(in, patternedPropCount); CActorParameters actParms = LoadActorParameters(in); CDamageInfo dInfo1(in); - u32 w1 = in.readUint32Big(); + u32 w1 = in.ReadLong(); CDamageInfo dInfo2(in); CAssetId aId1(in); - in.seek(4); // Unused + in.ReadLong(); CAssetId aId2(in); std::optional def1 = LoadFlareDef(in); std::optional def2 = LoadFlareDef(in); @@ -2060,32 +2027,32 @@ CEntity* ScriptLoader::LoadDrone(CStateManager& mgr, CInputStream& in, int propC if (g_ResFactory->GetResourceTypeById(animParms.GetACSFile()) != SBIG('ANCS')) return nullptr; - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); - float f5 = in.readFloatBig(); - float f6 = in.readFloatBig(); - float f7 = in.readFloatBig(); - float f8 = in.readFloatBig(); - float f9 = in.readFloatBig(); - float f10 = in.readFloatBig(); - float f11 = in.readFloatBig(); - float f12 = in.readFloatBig(); - float f13 = in.readFloatBig(); - float f14 = in.readFloatBig(); - float f15 = in.readFloatBig(); - float f16 = in.readFloatBig(); - float f17 = in.readFloatBig(); - float f18 = in.readFloatBig(); - float f19 = in.readFloatBig(); - float f20 = in.readFloatBig(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); + float f5 = in.ReadFloat(); + float f6 = in.ReadFloat(); + float f7 = in.ReadFloat(); + float f8 = in.ReadFloat(); + float f9 = in.ReadFloat(); + float f10 = in.ReadFloat(); + float f11 = in.ReadFloat(); + float f12 = in.ReadFloat(); + float f13 = in.ReadFloat(); + float f14 = in.ReadFloat(); + float f15 = in.ReadFloat(); + float f16 = in.ReadFloat(); + float f17 = in.ReadFloat(); + float f18 = in.ReadFloat(); + float f19 = in.ReadFloat(); + float f20 = in.ReadFloat(); CAssetId crscId(in); - float f21 = in.readFloatBig(); - float f22 = in.readFloatBig(); - float f23 = in.readFloatBig(); - float f24 = in.readFloatBig(); - s32 soundId = in.readUint32Big(); - bool b1 = in.readBool(); + float f21 = in.ReadFloat(); + float f22 = in.ReadFloat(); + float f23 = in.ReadFloat(); + float f24 = in.ReadFloat(); + s32 soundId = in.ReadLong(); + bool b1 = in.ReadBool(); CModelData mData( CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true)); return new MP1::CDrone(mgr.AllocateUniqueId(), name, flavor, info, xf, f1, std::move(mData), pInfo, actParms, @@ -2099,9 +2066,9 @@ CEntity* ScriptLoader::LoadMetroid(CStateManager& mgr, CInputStream& in, int pro return nullptr; std::string name = mgr.HashInstanceName(in); - CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); + CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.ReadLong()); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); auto pair = CPatternedInfo::HasCorrectParameterCount(in); if (!pair.first) return nullptr; @@ -2126,52 +2093,52 @@ CEntity* ScriptLoader::LoadDebrisExtended(CStateManager& mgr, CInputStream& in, SScaledActorHead aHead = LoadScaledActorHead(in, mgr); - float linConeAngle = in.readFloatBig(); - float linMinMag = in.readFloatBig(); - float linMaxMag = in.readFloatBig(); - float angMinMag = in.readFloatBig(); - float angMaxMag = in.readFloatBig(); - float minDuration = in.readFloatBig(); - float maxDuration = in.readFloatBig(); - float colorInT = in.readFloatBig(); - float colorOutT = in.readFloatBig(); + float linConeAngle = in.ReadFloat(); + float linMinMag = in.ReadFloat(); + float linMaxMag = in.ReadFloat(); + float angMinMag = in.ReadFloat(); + float angMaxMag = in.ReadFloat(); + float minDuration = in.ReadFloat(); + float maxDuration = in.ReadFloat(); + float colorInT = in.ReadFloat(); + float colorOutT = in.ReadFloat(); - zeus::CColor color = zeus::CColor::ReadRGBABig(in); - zeus::CColor endsColor = zeus::CColor::ReadRGBABig(in); + zeus::CColor color = in.Get(); + zeus::CColor endsColor = in.Get(); - float scaleOutT = in.readFloatBig(); + float scaleOutT = in.ReadFloat(); - zeus::CVector3f endScale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f endScale = in.Get(); - float restitution = in.readFloatBig(); - float downwardSpeed = in.readFloatBig(); + float restitution = in.ReadFloat(); + float downwardSpeed = in.ReadFloat(); - zeus::CVector3f localOffset = zeus::CVector3f::ReadBig(in); + zeus::CVector3f localOffset = in.Get(); - CAssetId model = in.readUint32Big(); + CAssetId model = in.ReadLong(); CActorParameters aParam = LoadActorParameters(in); - CAssetId particle1 = in.readUint32Big(); - zeus::CVector3f particle1Scale = zeus::CVector3f::ReadBig(in); - bool particle1GlobalTranslation = in.readBool(); - bool deferDeleteTillParticle1Done = in.readBool(); - CScriptDebris::EOrientationType particle1Or = CScriptDebris::EOrientationType(in.readUint32Big()); + CAssetId particle1 = in.ReadLong(); + zeus::CVector3f particle1Scale = in.Get(); + bool particle1GlobalTranslation = in.ReadBool(); + bool deferDeleteTillParticle1Done = in.ReadBool(); + CScriptDebris::EOrientationType particle1Or = CScriptDebris::EOrientationType(in.ReadLong()); - CAssetId particle2 = in.readUint32Big(); - zeus::CVector3f particle2Scale = zeus::CVector3f::ReadBig(in); - bool particle2GlobalTranslation = in.readBool(); - bool deferDeleteTillParticle2Done = in.readBool(); - CScriptDebris::EOrientationType particle2Or = CScriptDebris::EOrientationType(in.readUint32Big()); + CAssetId particle2 = in.ReadLong(); + zeus::CVector3f particle2Scale = in.Get(); + bool particle2GlobalTranslation = in.ReadBool(); + bool deferDeleteTillParticle2Done = in.ReadBool(); + CScriptDebris::EOrientationType particle2Or = CScriptDebris::EOrientationType(in.ReadLong()); - CAssetId particle3 = in.readUint32Big(); - /*zeus::CVector3f particle3Scale =*/(void)zeus::CVector3f::ReadBig(in); /* Not actually used, go figure */ - CScriptDebris::EOrientationType particle3Or = CScriptDebris::EOrientationType(in.readUint32Big()); + CAssetId particle3 = in.ReadLong(); + /*zeus::CVector3f particle3Scale =*/(void) in.Get(); /* Not actually used, go figure */ + CScriptDebris::EOrientationType particle3Or = CScriptDebris::EOrientationType(in.ReadLong()); - bool solid = in.readBool(); - bool dieOnProjectile = in.readBool(); - bool noBounce = in.readBool(); - bool active = in.readBool(); + bool solid = in.ReadBool(); + bool dieOnProjectile = in.ReadBool(); + bool noBounce = in.ReadBool(); + bool active = in.ReadBool(); CModelData modelData; if (g_ResFactory->GetResourceTypeById(model).IsValid()) @@ -2192,21 +2159,21 @@ CEntity* ScriptLoader::LoadSteam(CStateManager& mgr, CInputStream& in, int propC std::string name = mgr.HashInstanceName(in); - zeus::CVector3f v1 = zeus::CVector3f::ReadBig(in); - zeus::CVector3f v2 = zeus::CVector3f::ReadBig(in); + zeus::CVector3f v1 = in.Get(); + zeus::CVector3f v2 = in.Get(); CDamageInfo dInfo(in); - zeus::CVector3f v3 = zeus::CVector3f::ReadBig(in); + zeus::CVector3f v3 = in.Get(); - ETriggerFlags w1 = ETriggerFlags(in.readUint32Big()); - bool b1 = in.readBool(); - u32 w2 = in.readUint32Big(); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); - bool b2 = in.readBool(); + ETriggerFlags w1 = ETriggerFlags(in.ReadLong()); + bool b1 = in.ReadBool(); + u32 w2 = in.ReadLong(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); + bool b2 = in.ReadBool(); zeus::CAABox aabb(-v2 * 0.5f, v2 * 0.5f); @@ -2217,9 +2184,9 @@ CEntity* ScriptLoader::LoadRipple(CStateManager& mgr, CInputStream& in, int prop if (!EnsurePropertyCount(propCount, 4, "Ripple")) return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f center = zeus::CVector3f::ReadBig(in); - bool active = in.readBool(); - float mag = in.readFloatBig(); + zeus::CVector3f center = in.Get(); + bool active = in.ReadBool(); + float mag = in.ReadFloat(); return new CScriptRipple(mgr.AllocateUniqueId(), name, info, center, active, mag); } @@ -2227,16 +2194,16 @@ CEntity* ScriptLoader::LoadBallTrigger(CStateManager& mgr, CInputStream& in, int if (!EnsurePropertyCount(propCount, 9, "BallTrigger")) return nullptr; - std::string name = in.readString(); - zeus::CVector3f pos = zeus::CVector3f::ReadBig(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + std::string name = in.Get(); + zeus::CVector3f pos = in.Get(); + zeus::CVector3f scale = in.Get(); - bool b1 = in.readBool(); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - zeus::CVector3f vec = zeus::CVector3f::ReadBig(in); - bool b2 = in.readBool(); + bool b1 = in.ReadBool(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + zeus::CVector3f vec = in.Get(); + bool b2 = in.ReadBool(); return new CScriptBallTrigger(mgr.AllocateUniqueId(), name, info, pos, scale, b1, f1, f2, f3, vec, b2); } @@ -2246,7 +2213,7 @@ CEntity* ScriptLoader::LoadTargetingPoint(CStateManager& mgr, CInputStream& in, return nullptr; SActorHead aHead = LoadActorHead(in, mgr); - bool active = in.readBool(); + bool active = in.ReadBool(); return new CScriptTargetingPoint(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active); } @@ -2256,14 +2223,14 @@ CEntity* ScriptLoader::LoadEMPulse(CStateManager& mgr, CInputStream& in, int pro return nullptr; SActorHead actorHead = LoadActorHead(in, mgr); - bool active = in.readBool(); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); - float f5 = in.readFloatBig(); - float f6 = in.readFloatBig(); - float f7 = in.readFloatBig(); + bool active = in.ReadBool(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); + float f5 = in.ReadFloat(); + float f6 = in.ReadFloat(); + float f7 = in.ReadFloat(); CAssetId particleId(in); return new CScriptEMPulse(mgr.AllocateUniqueId(), actorHead.x0_name, info, actorHead.x10_transform, active, f1, f2, @@ -2297,21 +2264,21 @@ CEntity* ScriptLoader::LoadPlayerActor(CStateManager& mgr, CInputStream& in, int return nullptr; SScaledActorHead aHead = LoadScaledActorHead(in, mgr); - zeus::CVector3f extents = zeus::CVector3f::ReadBig(in); - zeus::CVector3f offset = zeus::CVector3f::ReadBig(in); - float mass = in.readFloatBig(); - float zMomentum = in.readFloatBig(); + zeus::CVector3f extents = in.Get(); + zeus::CVector3f offset = in.Get(); + float mass = in.ReadFloat(); + float zMomentum = in.ReadFloat(); CHealthInfo hInfo(in); CDamageVulnerability dVuln(in); - in.readUint32Big(); + in.ReadLong(); CAnimationParameters animParms = LoadAnimationParameters(in); CActorParameters actParms = LoadActorParameters(in); - bool loop = in.readBool(); - bool snow = in.readBool(); - bool solid = in.readBool(); - bool active = in.readBool(); + bool loop = in.ReadBool(); + bool snow = in.ReadBool(); + bool solid = in.ReadBool(); + bool active = in.ReadBool(); u32 flags = LoadParameterFlags(in); - CPlayerState::EBeamId beam = CPlayerState::EBeamId(in.readUint32Big() - 1); + CPlayerState::EBeamId beam = CPlayerState::EBeamId(in.ReadLong() - 1); FourCC fcc = g_ResFactory->GetResourceTypeById(animParms.GetACSFile()); if (!fcc.IsValid() || fcc != SBIG('ANCS')) @@ -2369,18 +2336,18 @@ CEntity* ScriptLoader::LoadAreaAttributes(CStateManager& mgr, CInputStream& in, if (!EnsurePropertyCount(propCount, 9, "AreaAttributes")) return nullptr; - bool load = in.readUint32Big() != 0; + bool load = in.ReadLong() != 0; if (!load) return nullptr; - bool showSkybox = in.readBool(); - EEnvFxType fxType = EEnvFxType(in.readUint32Big()); - float envFxDensity = in.readFloatBig(); - float thermalHeat = in.readFloatBig(); - float xrayFogDistance = in.readFloatBig(); - float worldLightingLevel = in.readFloatBig(); - CAssetId skybox = in.readUint32Big(); - EPhazonType phazonType = EPhazonType(in.readUint32Big()); + bool showSkybox = in.ReadBool(); + EEnvFxType fxType = EEnvFxType(in.ReadLong()); + float envFxDensity = in.ReadFloat(); + float thermalHeat = in.ReadFloat(); + float xrayFogDistance = in.ReadFloat(); + float worldLightingLevel = in.ReadFloat(); + CAssetId skybox = in.ReadLong(); + EPhazonType phazonType = EPhazonType(in.ReadLong()); return new CScriptAreaAttributes(mgr.AllocateUniqueId(), info, showSkybox, fxType, envFxDensity, thermalHeat, xrayFogDistance, worldLightingLevel, skybox, phazonType); @@ -2390,42 +2357,42 @@ CEntity* ScriptLoader::LoadFishCloud(CStateManager& mgr, CInputStream& in, int p if (!EnsurePropertyCount(propCount, 36, "FishCloud")) return nullptr; SScaledActorHead aHead = LoadScaledActorHead(in, mgr); - bool active = in.readBool(); + bool active = in.ReadBool(); CAssetId model(in); CAnimationParameters animParms(in); - u32 numBoids = u32(in.readFloatBig()); - float speed = in.readFloatBig(); - float separationRadius = in.readFloatBig(); - float cohesionMagnitude = in.readFloatBig(); - float alignmentWeight = in.readFloatBig(); - float separationMagnitude = in.readFloatBig(); - float weaponRepelMagnitude = in.readFloatBig(); - float playerRepelMagnitude = in.readFloatBig(); - float containmentMagnitude = in.readFloatBig(); - float scatterVel = in.readFloatBig(); - float maxScatterAngle = in.readFloatBig(); - float weaponRepelDampingSpeed = in.readFloatBig(); - float playerRepelDampingSpeed = in.readFloatBig(); - float containmentRadius = in.readFloatBig(); - u32 updateShift = in.readUint32Big(); + u32 numBoids = u32(in.ReadFloat()); + float speed = in.ReadFloat(); + float separationRadius = in.ReadFloat(); + float cohesionMagnitude = in.ReadFloat(); + float alignmentWeight = in.ReadFloat(); + float separationMagnitude = in.ReadFloat(); + float weaponRepelMagnitude = in.ReadFloat(); + float playerRepelMagnitude = in.ReadFloat(); + float containmentMagnitude = in.ReadFloat(); + float scatterVel = in.ReadFloat(); + float maxScatterAngle = in.ReadFloat(); + float weaponRepelDampingSpeed = in.ReadFloat(); + float playerRepelDampingSpeed = in.ReadFloat(); + float containmentRadius = in.ReadFloat(); + u32 updateShift = in.ReadLong(); if (!g_ResFactory->GetResourceTypeById(model).IsValid()) return nullptr; - zeus::CColor color = zeus::CColor::ReadRGBABig(in); - bool killable = in.readBool(); - float weaponKillRadius = in.readFloatBig(); - CAssetId part1 = in.readUint32Big(); - u32 partCount1 = in.readUint32Big(); - CAssetId part2 = in.readUint32Big(); - u32 partCount2 = in.readUint32Big(); - CAssetId part3 = in.readUint32Big(); - u32 partCount3 = in.readUint32Big(); - CAssetId part4 = in.readUint32Big(); - u32 partCount4 = in.readUint32Big(); - u32 deathSfx = in.readUint32Big(); - bool repelFromThreats = in.readBool(); - bool hotInThermal = in.readBool(); + zeus::CColor color = in.Get(); + bool killable = in.ReadBool(); + float weaponKillRadius = in.ReadFloat(); + CAssetId part1 = in.ReadLong(); + u32 partCount1 = in.ReadLong(); + CAssetId part2 = in.ReadLong(); + u32 partCount2 = in.ReadLong(); + CAssetId part3 = in.ReadLong(); + u32 partCount3 = in.ReadLong(); + CAssetId part4 = in.ReadLong(); + u32 partCount4 = in.ReadLong(); + u32 deathSfx = in.ReadLong(); + bool repelFromThreats = in.ReadBool(); + bool hotInThermal = in.ReadBool(); CModelData mData(CStaticRes(model, zeus::skOne3f)); CAnimRes animRes(animParms.GetACSFile(), animParms.GetCharacter(), zeus::skOne3f, animParms.GetInitialAnimation(), @@ -2445,12 +2412,12 @@ CEntity* ScriptLoader::LoadFishCloudModifier(CStateManager& mgr, CInputStream& i return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f pos = zeus::CVector3f::ReadBig(in); - bool active = in.readBool(); - bool repulsor = in.readBool(); - bool swirl = propCount > 6 ? in.readBool() : false; - float radius = in.readFloatBig(); - float priority = in.readFloatBig(); + zeus::CVector3f pos = in.Get(); + bool active = in.ReadBool(); + bool repulsor = in.ReadBool(); + bool swirl = propCount > 6 ? in.ReadBool() : false; + float radius = in.ReadFloat(); + float priority = in.ReadFloat(); return new CFishCloudModifier(mgr.AllocateUniqueId(), active, name, info, pos, repulsor, swirl, radius, priority); } @@ -2461,14 +2428,14 @@ CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, int } const std::string name = mgr.HashInstanceName(in); - const zeus::CVector3f pos = zeus::CVector3f::ReadBig(in); - const bool b1 = in.readBool(); - const auto w1 = CVisorFlare::EBlendMode(in.readUint32Big()); - const bool b2 = in.readBool(); - const float f1 = in.readFloatBig(); - const float f2 = in.readFloatBig(); - const float f3 = in.readFloatBig(); - const u32 w2 = in.readUint32Big(); + const zeus::CVector3f pos = in.Get(); + const bool b1 = in.ReadBool(); + const auto w1 = CVisorFlare::EBlendMode(in.ReadLong()); + const bool b2 = in.ReadBool(); + const float f1 = in.ReadFloat(); + const float f2 = in.ReadFloat(); + const float f3 = in.ReadFloat(); + const u32 w2 = in.ReadLong(); std::vector flares; flares.reserve(5); @@ -2490,36 +2457,36 @@ CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, } std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - CAssetId worldId = in.readUint32Big(); - CAssetId areaId = in.readUint32Big(); + bool active = in.ReadBool(); + CAssetId worldId = in.ReadLong(); + CAssetId areaId = in.ReadLong(); if (propCount == 4) return new CScriptWorldTeleporter(mgr.AllocateUniqueId(), name, info, active, worldId, areaId); CAnimationParameters animParms = LoadAnimationParameters(in); - zeus::CVector3f playerScale = zeus::CVector3f::ReadBig(in); - CAssetId platformModel = in.readUint32Big(); - zeus::CVector3f platformScale = zeus::CVector3f::ReadBig(in); - CAssetId backgroundModel = in.readUint32Big(); - zeus::CVector3f backgroundScale = zeus::CVector3f::ReadBig(in); - bool upElevator = in.readBool(); + zeus::CVector3f playerScale = in.Get(); + CAssetId platformModel = in.ReadLong(); + zeus::CVector3f platformScale = in.Get(); + CAssetId backgroundModel = in.ReadLong(); + zeus::CVector3f backgroundScale = in.Get(); + bool upElevator = in.ReadBool(); - s16 elevatorSound = (propCount < 12 ? s16(-1) : s16(in.readUint32Big())); - u8 volume = (propCount < 13 ? u8(127) : u8(in.readUint32Big())); - u8 panning = (propCount < 14 ? u8(64) : u8(in.readUint32Big())); - bool showText = (propCount < 15 ? false : in.readBool()); - CAssetId fontId = (propCount < 16 ? CAssetId() : in.readUint32Big()); - CAssetId stringId = (propCount < 17 ? CAssetId() : in.readUint32Big()); - bool fadeWhite = (propCount < 18 ? false : in.readBool()); - float charFadeInTime = (propCount < 19 ? 0.1f : in.readFloatBig()); - float charsPerSecond = (propCount < 20 ? 16.f : in.readFloatBig()); - float showDelay = (propCount < 21 ? 0.f : in.readFloatBig()); - std::string str1 = (propCount < 22 ? "" : in.readString()); - std::string str2 = (propCount < 23 ? "" : in.readString()); - /*float f1 =*/(propCount < 24 ? 0.f : in.readFloatBig()); - /*float f2 =*/(propCount < 25 ? 0.f : in.readFloatBig()); - /*float f3 =*/(propCount < 26 ? 0.f : in.readFloatBig()); + s16 elevatorSound = (propCount < 12 ? s16(-1) : s16(in.ReadLong())); + u8 volume = (propCount < 13 ? u8(127) : u8(in.ReadLong())); + u8 panning = (propCount < 14 ? u8(64) : u8(in.ReadLong())); + bool showText = (propCount < 15 ? false : in.ReadBool()); + CAssetId fontId = (propCount < 16 ? CAssetId() : in.ReadLong()); + CAssetId stringId = (propCount < 17 ? CAssetId() : in.ReadLong()); + bool fadeWhite = (propCount < 18 ? false : in.ReadBool()); + float charFadeInTime = (propCount < 19 ? 0.1f : in.ReadFloat()); + float charsPerSecond = (propCount < 20 ? 16.f : in.ReadFloat()); + float showDelay = (propCount < 21 ? 0.f : in.ReadFloat()); + std::string str1 = (propCount < 22 ? "" : in.Get()); + std::string str2 = (propCount < 23 ? "" : in.Get()); + /*float f1 =*/(propCount < 24 ? 0.f : in.ReadFloat()); + /*float f2 =*/(propCount < 25 ? 0.f : in.ReadFloat()); + /*float f3 =*/(propCount < 26 ? 0.f : in.ReadFloat()); if (showText) return new CScriptWorldTeleporter(mgr.AllocateUniqueId(), name, info, active, worldId, areaId, elevatorSound, @@ -2537,19 +2504,17 @@ CEntity* ScriptLoader::LoadVisorGoo(CStateManager& mgr, CInputStream& in, int pr return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f position; - position.readBig(in); + zeus::CVector3f position = in.Get(); zeus::CTransform xf = zeus::CTransform::Translate(position); CAssetId particle(in); CAssetId electric(in); - float minDist = in.readFloatBig(); - float maxDist = in.readFloatBig(); - float nearProb = in.readFloatBig(); - float farProb = in.readFloatBig(); - zeus::CColor color; - color.readRGBABig(in); - s32 sfx = in.readInt32Big(); - bool forceShow = in.readBool(); + float minDist = in.ReadFloat(); + float maxDist = in.ReadFloat(); + float nearProb = in.ReadFloat(); + float farProb = in.ReadFloat(); + zeus::CColor color = in.Get(); + s32 sfx = in.ReadInt32(); + bool forceShow = in.ReadBool(); if (!particle.IsValid() && !electric.IsValid()) return nullptr; @@ -2571,19 +2536,19 @@ CEntity* ScriptLoader::LoadJellyZap(CStateManager& mgr, CInputStream& in, int pr CPatternedInfo pInfo(in, pair.second); CActorParameters actParms = LoadActorParameters(in); CDamageInfo dInfo(in); - float attackRadius = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); - float f5 = in.readFloatBig(); - float f6 = in.readFloatBig(); - float f7 = in.readFloatBig(); - float f8 = in.readFloatBig(); - float priority = in.readFloatBig(); - float repulseRadius = in.readFloatBig(); - float attractRadius = in.readFloatBig(); - float f12 = in.readFloatBig(); - bool b1 = in.readBool(); + float attackRadius = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); + float f5 = in.ReadFloat(); + float f6 = in.ReadFloat(); + float f7 = in.ReadFloat(); + float f8 = in.ReadFloat(); + float priority = in.ReadFloat(); + float repulseRadius = in.ReadFloat(); + float attractRadius = in.ReadFloat(); + float f12 = in.ReadFloat(); + bool b1 = in.ReadBool(); const CAnimationParameters& animParms = pInfo.GetAnimationParameters(); if (g_ResFactory->GetResourceTypeById(animParms.GetACSFile()) != SBIG('ANCS')) { @@ -2603,15 +2568,15 @@ CEntity* ScriptLoader::LoadControllerAction(CStateManager& mgr, CInputStream& in return nullptr; std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - ControlMapper::ECommands w1 = ControlMapper::ECommands(in.readUint32Big()); + bool active = in.ReadBool(); + ControlMapper::ECommands w1 = ControlMapper::ECommands(in.ReadLong()); bool b1 = false; u32 w2 = 0; if (propCount == 6) { - b1 = in.readBool(); - w2 = in.readUint32Big(); + b1 = in.ReadBool(); + w2 = in.ReadLong(); } - bool b2 = in.readBool(); + bool b2 = in.ReadBool(); return new CScriptControllerAction(mgr.AllocateUniqueId(), name, info, active, w1, b1, w2, b2); } @@ -2621,9 +2586,9 @@ CEntity* ScriptLoader::LoadSwitch(CStateManager& mgr, CInputStream& in, int prop return nullptr; std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - bool b2 = in.readBool(); - bool b3 = in.readBool(); + bool active = in.ReadBool(); + bool b2 = in.ReadBool(); + bool b3 = in.ReadBool(); return new CScriptSwitch(mgr.AllocateUniqueId(), name, info, active, b2, b3); } @@ -2634,13 +2599,13 @@ CEntity* ScriptLoader::LoadPlayerStateChange(CStateManager& mgr, CInputStream& i return nullptr; std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - s32 itemType = in.readUint32Big(); - s32 itemCount = in.readInt32Big(); - s32 itemCapacity = in.readInt32Big(); - CScriptPlayerStateChange::EControl ctrl = CScriptPlayerStateChange::EControl(in.readUint32Big()); + bool active = in.ReadBool(); + s32 itemType = in.ReadLong(); + s32 itemCount = in.ReadInt32(); + s32 itemCapacity = in.ReadInt32(); + CScriptPlayerStateChange::EControl ctrl = CScriptPlayerStateChange::EControl(in.ReadLong()); CScriptPlayerStateChange::EControlCommandOption ctrlCmdOpt = - CScriptPlayerStateChange::EControlCommandOption(in.readUint32Big()); + CScriptPlayerStateChange::EControlCommandOption(in.ReadLong()); return new CScriptPlayerStateChange(mgr.AllocateUniqueId(), name, info, active, itemType, itemCount, itemCapacity, ctrl, ctrlCmdOpt); } @@ -2658,8 +2623,8 @@ CEntity* ScriptLoader::LoadThardus(CStateManager& mgr, CInputStream& in, int pro CPatternedInfo pInfo(in, patternedCount); CActorParameters actParms = LoadActorParameters(in); - in.readBool(); - in.readBool(); + in.ReadBool(); + in.ReadBool(); const CAnimationParameters& animParms = pInfo.GetAnimationParameters(); if (!animParms.GetACSFile().IsValid()) return nullptr; @@ -2688,18 +2653,18 @@ CEntity* ScriptLoader::LoadThardus(CStateManager& mgr, CInputStream& in, int pro CAssetId particle7(in); CAssetId particle8(in); CAssetId particle9(in); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); - float f5 = in.readFloatBig(); - float f6 = in.readFloatBig(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); + float f5 = in.ReadFloat(); + float f6 = in.ReadFloat(); CAssetId texture(in); - int sfxID1 = in.readUint32Big(); + int sfxID1 = in.ReadLong(); CAssetId particle10 = (propCount < 44) ? CAssetId() : CAssetId(in); - int sfxID2 = in.readUint32Big(); - int sfxID3 = in.readUint32Big(); - int sfxID4 = in.readUint32Big(); + int sfxID2 = in.ReadLong(); + int sfxID3 = in.ReadLong(); + int sfxID4 = in.ReadLong(); std::vector mData1(std::rbegin(staticRes[0]), std::rend(staticRes[0])); std::vector mData2(std::rbegin(staticRes[1]), std::rend(staticRes[1])); @@ -2716,43 +2681,43 @@ CEntity* ScriptLoader::LoadWallCrawlerSwarm(CStateManager& mgr, CInputStream& in return nullptr; SScaledActorHead aHead = LoadScaledActorHead(in, mgr); - bool active = in.readBool(); + bool active = in.ReadBool(); CActorParameters aParams = LoadActorParameters(in); - CWallCrawlerSwarm::EFlavor flavor = CWallCrawlerSwarm::EFlavor(in.readUint32Big()); - u32 actor = in.readUint32Big(); - u32 charIdx = in.readUint32Big(); - u32 defaultAnim = in.readUint32Big(); - u32 launchAnim = in.readUint32Big(); - u32 attractAnim = in.readUint32Big(); - u32 part1 = in.readUint32Big(); - u32 part2 = in.readUint32Big(); - u32 part3 = in.readUint32Big(); - u32 part4 = in.readUint32Big(); + CWallCrawlerSwarm::EFlavor flavor = CWallCrawlerSwarm::EFlavor(in.ReadLong()); + u32 actor = in.ReadLong(); + u32 charIdx = in.ReadLong(); + u32 defaultAnim = in.ReadLong(); + u32 launchAnim = in.ReadLong(); + u32 attractAnim = in.ReadLong(); + u32 part1 = in.ReadLong(); + u32 part2 = in.ReadLong(); + u32 part3 = in.ReadLong(); + u32 part4 = in.ReadLong(); CDamageInfo crabDamage(in); - float crabDamageCooldown = in.readFloatBig(); + float crabDamageCooldown = in.ReadFloat(); CDamageInfo scarabExplodeDamage(in); - float boidRadius = in.readFloatBig(); - float touchRadius = in.readFloatBig(); - float playerTouchRadius = in.readFloatBig(); - float animPlaybackSpeed = in.readFloatBig(); - u32 numBoids = in.readUint32Big(); - u32 maxCreatedBoids = in.readUint32Big(); - float separationRadius = in.readFloatBig(); - float cohesionMagnitude = in.readFloatBig(); - float alignmentWeight = in.readFloatBig(); - float separationMagnitude = in.readFloatBig(); - float moveToWaypointWeight = in.readFloatBig(); - float attractionMagnitude = in.readFloatBig(); - float attractionRadius = in.readFloatBig(); - float boidGenRate = in.readFloatBig(); - u32 maxLaunches = in.readUint32Big(); - float scarabBoxMargin = in.readFloatBig(); - float scarabScatterXYVelocity = in.readFloatBig(); - float scarabTimeToExplode = in.readFloatBig(); + float boidRadius = in.ReadFloat(); + float touchRadius = in.ReadFloat(); + float playerTouchRadius = in.ReadFloat(); + float animPlaybackSpeed = in.ReadFloat(); + u32 numBoids = in.ReadLong(); + u32 maxCreatedBoids = in.ReadLong(); + float separationRadius = in.ReadFloat(); + float cohesionMagnitude = in.ReadFloat(); + float alignmentWeight = in.ReadFloat(); + float separationMagnitude = in.ReadFloat(); + float moveToWaypointWeight = in.ReadFloat(); + float attractionMagnitude = in.ReadFloat(); + float attractionRadius = in.ReadFloat(); + float boidGenRate = in.ReadFloat(); + u32 maxLaunches = in.ReadLong(); + float scarabBoxMargin = in.ReadFloat(); + float scarabScatterXYVelocity = in.ReadFloat(); + float scarabTimeToExplode = in.ReadFloat(); CHealthInfo hInfo(in); CDamageVulnerability dVulns(in); - u32 launchSfx = in.readUint32Big(); - u32 scatterSfx = in.readUint32Big(); + u32 launchSfx = in.ReadLong(); + u32 scatterSfx = in.ReadLong(); return new CWallCrawlerSwarm( mgr.AllocateUniqueId(), active, aHead.x0_name, info, aHead.x40_scale, aHead.x10_transform, flavor, @@ -2768,8 +2733,8 @@ CEntity* ScriptLoader::LoadAiJumpPoint(CStateManager& mgr, CInputStream& in, int return nullptr; SActorHead aHead = LoadActorHead(in, mgr); - bool active = in.readBool(); - float apex = in.readFloat(); + bool active = in.ReadBool(); + float apex = in.ReadFloat(); return new CScriptAiJumpPoint(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, apex); } @@ -2803,37 +2768,37 @@ CEntity* ScriptLoader::LoadRoomAcoustics(CStateManager& mgr, CInputStream& in, i return nullptr; std::string name = mgr.HashInstanceName(in); - bool a = in.readBool(); - u32 b = in.readUint32Big(); - bool c = in.readBool(); - bool d = in.readBool(); - float e = in.readFloatBig(); - float f = in.readFloatBig(); - float g = in.readFloatBig(); - float h = in.readFloatBig(); - float i = in.readFloatBig(); - float j = in.readFloatBig(); - bool k = in.readBool(); - float l = in.readFloatBig(); - float m = in.readFloatBig(); - float n = in.readFloatBig(); - bool o = in.readBool(); - bool p = in.readBool(); - float q = in.readFloatBig(); - float r = in.readFloatBig(); - float s = in.readFloatBig(); - float t = in.readFloatBig(); - float u = in.readFloatBig(); - bool v = in.readBool(); - u32 w = in.readUint32Big(); - u32 x = in.readUint32Big(); - u32 y = in.readUint32Big(); - u32 z = in.readUint32Big(); - u32 _a = in.readUint32Big(); - u32 _b = in.readUint32Big(); - u32 _c = in.readUint32Big(); - u32 _d = in.readUint32Big(); - u32 _e = in.readUint32Big(); + bool a = in.ReadBool(); + u32 b = in.ReadLong(); + bool c = in.ReadBool(); + bool d = in.ReadBool(); + float e = in.ReadFloat(); + float f = in.ReadFloat(); + float g = in.ReadFloat(); + float h = in.ReadFloat(); + float i = in.ReadFloat(); + float j = in.ReadFloat(); + bool k = in.ReadBool(); + float l = in.ReadFloat(); + float m = in.ReadFloat(); + float n = in.ReadFloat(); + bool o = in.ReadBool(); + bool p = in.ReadBool(); + float q = in.ReadFloat(); + float r = in.ReadFloat(); + float s = in.ReadFloat(); + float t = in.ReadFloat(); + float u = in.ReadFloat(); + bool v = in.ReadBool(); + u32 w = in.ReadLong(); + u32 x = in.ReadLong(); + u32 y = in.ReadLong(); + u32 z = in.ReadLong(); + u32 _a = in.ReadLong(); + u32 _b = in.ReadLong(); + u32 _c = in.ReadLong(); + u32 _d = in.ReadLong(); + u32 _e = in.ReadLong(); return new CScriptRoomAcoustics(mgr.AllocateUniqueId(), name, info, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, _a, _b, _c, _d, _e); @@ -2844,19 +2809,17 @@ CEntity* ScriptLoader::LoadColorModulate(CStateManager& mgr, CInputStream& in, i return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CColor colorA; - colorA.readRGBABig(in); - zeus::CColor colorB; - colorB.readRGBABig(in); - CScriptColorModulate::EBlendMode blendMode = CScriptColorModulate::EBlendMode(in.readUint32Big()); - float timeA2B = in.readFloatBig(); - float timeB2A = in.readFloatBig(); - bool doReverse = in.readBool(); - bool resetTargetWhenDone = in.readBool(); - bool depthCompare = in.readBool(); - bool depthUpdate = in.readBool(); - bool depthBackwards = in.readBool(); - bool active = in.readBool(); + zeus::CColor colorA = in.Get(); + zeus::CColor colorB = in.Get(); + CScriptColorModulate::EBlendMode blendMode = CScriptColorModulate::EBlendMode(in.ReadLong()); + float timeA2B = in.ReadFloat(); + float timeB2A = in.ReadFloat(); + bool doReverse = in.ReadBool(); + bool resetTargetWhenDone = in.ReadBool(); + bool depthCompare = in.ReadBool(); + bool depthUpdate = in.ReadBool(); + bool depthBackwards = in.ReadBool(); + bool active = in.ReadBool(); return new CScriptColorModulate(mgr.AllocateUniqueId(), name, info, colorA, colorB, blendMode, timeA2B, timeB2A, doReverse, resetTargetWhenDone, depthCompare, depthUpdate, depthBackwards, active); } @@ -2873,9 +2836,9 @@ CEntity* ScriptLoader::LoadThardusRockProjectile(CStateManager& mgr, CInputStrea CPatternedInfo pInfo(in, pInfoCount); CActorParameters actParms = LoadActorParameters(in); - in.readBool(); - in.readBool(); - float f1 = in.readFloatBig(); + in.ReadBool(); + in.ReadBool(); + float f1 = in.ReadFloat(); CAssetId modelId(in); CAssetId stateMachine(in); if (!pInfo.GetAnimationParameters().GetACSFile().IsValid()) @@ -2895,11 +2858,11 @@ CEntity* ScriptLoader::LoadMidi(CStateManager& mgr, CInputStream& in, int propCo return nullptr; std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - u32 csng = in.readUint32Big(); - float fadeIn = in.readFloatBig(); - float fadeOut = in.readFloatBig(); - u32 vol = in.readUint32Big(); + bool active = in.ReadBool(); + u32 csng = in.ReadLong(); + float fadeIn = in.ReadFloat(); + float fadeOut = in.ReadFloat(); + u32 vol = in.ReadLong(); return new CScriptMidi(mgr.AllocateUniqueId(), info, name, active, csng, fadeIn, fadeOut, vol); } @@ -2908,14 +2871,14 @@ CEntity* ScriptLoader::LoadStreamedAudio(CStateManager& mgr, CInputStream& in, i return nullptr; const std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - std::string fileName = in.readString(); - bool noStopOnDeactivate = in.readBool(); - float fadeIn = in.readFloatBig(); - float fadeOut = in.readFloatBig(); - u32 volume = in.readUint32Big(); - u32 oneShot = in.readUint32Big(); - bool music = in.readBool(); + bool active = in.ReadBool(); + std::string fileName = in.Get(); + bool noStopOnDeactivate = in.ReadBool(); + float fadeIn = in.ReadFloat(); + float fadeOut = in.ReadFloat(); + u32 volume = in.ReadLong(); + u32 oneShot = in.ReadLong(); + bool music = in.ReadBool(); return new CScriptStreamedMusic(mgr.AllocateUniqueId(), info, name, active, fileName, noStopOnDeactivate, fadeIn, fadeOut, volume, !oneShot, music); @@ -2926,9 +2889,9 @@ CEntity* ScriptLoader::LoadRepulsor(CStateManager& mgr, CInputStream& in, int pr return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f center = in.readVec3fBig(); - bool active = in.readBool(); - float radius = in.readFloatBig(); + zeus::CVector3f center = in.Get(); + bool active = in.ReadBool(); + float radius = in.ReadFloat(); return new CRepulsor(mgr.AllocateUniqueId(), active, name, info, center, radius); } @@ -2938,11 +2901,11 @@ CEntity* ScriptLoader::LoadGunTurret(CStateManager& mgr, CInputStream& in, int p return nullptr; std::string name = mgr.HashInstanceName(in); - CScriptGunTurret::ETurretComponent component = CScriptGunTurret::ETurretComponent(in.readUint32Big()); + CScriptGunTurret::ETurretComponent component = CScriptGunTurret::ETurretComponent(in.ReadLong()); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); - zeus::CVector3f collisionExtent = zeus::CVector3f::ReadBig(in); - zeus::CVector3f collisionOffset = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); + zeus::CVector3f collisionExtent = in.Get(); + zeus::CVector3f collisionOffset = in.Get(); CAnimationParameters animParms = LoadAnimationParameters(in); CActorParameters actParms = LoadActorParameters(in); CHealthInfo hInfo(in); @@ -2968,12 +2931,12 @@ CEntity* ScriptLoader::LoadFogVolume(CStateManager& mgr, CInputStream& in, int p return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f center = zeus::CVector3f::ReadBig(in); - zeus::CVector3f volume = zeus::CVector3f::ReadBig(in); - float flickerSpeed = in.readFloatBig(); - float f2 = in.readFloatBig(); - zeus::CColor fogColor = zeus::CColor::ReadRGBABig(in); - bool active = in.readBool(); + zeus::CVector3f center = in.Get(); + zeus::CVector3f volume = in.Get(); + float flickerSpeed = in.ReadFloat(); + float f2 = in.ReadFloat(); + zeus::CColor fogColor = in.Get(); + bool active = in.ReadBool(); volume.x() = std::fabs(volume.x()); volume.y() = std::fabs(volume.y()); @@ -3012,9 +2975,9 @@ CEntity* ScriptLoader::LoadEyeball(CStateManager& mgr, CInputStream& in, int pro return nullptr; std::string name = mgr.HashInstanceName(in); - CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); + CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.ReadLong()); zeus::CTransform xf = LoadEditorTransform(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = in.Get(); auto pair = CPatternedInfo::HasCorrectParameterCount(in); if (!pair.first) @@ -3022,24 +2985,24 @@ CEntity* ScriptLoader::LoadEyeball(CStateManager& mgr, CInputStream& in, int pro CPatternedInfo pInfo(in, pair.second); CActorParameters actParms = LoadActorParameters(in); - float attackDelay = in.readFloatBig(); - float attackStartTime = in.readFloatBig(); + float attackDelay = in.ReadFloat(); + float attackStartTime = in.ReadFloat(); CAssetId wpsc(in); CDamageInfo dInfo(in); CAssetId beamContactFxId(in); CAssetId beamPulseFxId(in); CAssetId beamTextureId(in); CAssetId beamGlowTextureId(in); - u32 anim0 = in.readUint32Big(); - u32 anim1 = in.readUint32Big(); - u32 anim2 = in.readUint32Big(); - u32 anim3 = in.readUint32Big(); - u32 beamSfx = in.readUint32Big(); + u32 anim0 = in.ReadLong(); + u32 anim1 = in.ReadLong(); + u32 anim2 = in.ReadLong(); + u32 anim3 = in.ReadLong(); + u32 beamSfx = in.ReadLong(); if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS')) return nullptr; - bool attackDisabled = in.readBool(); + bool attackDisabled = in.ReadBool(); CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true)); @@ -3054,10 +3017,10 @@ CEntity* ScriptLoader::LoadRadialDamage(CStateManager& mgr, CInputStream& in, in return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f center = zeus::CVector3f::ReadBig(in); - bool active = in.readBool(); + zeus::CVector3f center = in.Get(); + bool active = in.ReadBool(); CDamageInfo dInfo(in); - float radius = in.readFloatBig(); + float radius = in.ReadFloat(); zeus::CTransform xf = ConvertEditorEulerToTransform4f(zeus::skZero3f, center); return new CScriptSpecialFunction( @@ -3071,10 +3034,10 @@ CEntity* ScriptLoader::LoadCameraPitchVolume(CStateManager& mgr, CInputStream& i return nullptr; SScaledActorHead aHead = LoadScaledActorHead(in, mgr); - bool active = in.readBool(); - zeus::CRelAngle upPitch = zeus::CRelAngle::FromDegrees(in.readFloatBig()); - zeus::CRelAngle downPitch = zeus::CRelAngle::FromDegrees(in.readFloatBig()); - float scale = in.readFloatBig(); + bool active = in.ReadBool(); + zeus::CRelAngle upPitch = zeus::CRelAngle::FromDegrees(in.ReadFloat()); + zeus::CRelAngle downPitch = zeus::CRelAngle::FromDegrees(in.ReadFloat()); + float scale = in.ReadFloat(); return new CScriptCameraPitchVolume(mgr.AllocateUniqueId(), active, aHead.x0_name, info, aHead.x40_scale, aHead.x10_transform, upPitch, downPitch, scale); @@ -3086,9 +3049,9 @@ CEntity* ScriptLoader::LoadEnvFxDensityController(CStateManager& mgr, CInputStre return nullptr; std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - float density = in.readFloatBig(); - u32 maxDensityDeltaSpeed = in.readUint32Big(); + bool active = in.ReadBool(); + float density = in.ReadFloat(); + u32 maxDensityDeltaSpeed = in.ReadLong(); return new CScriptSpecialFunction(mgr.AllocateUniqueId(), name, info, zeus::CTransform(), CScriptSpecialFunction::ESpecialFunction::EnvFxDensityController, "", density, @@ -3114,22 +3077,22 @@ CEntity* ScriptLoader::LoadMagdolite(CStateManager& mgr, CInputStream& in, int p return nullptr; } - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); CDamageInfo damageInfo1(in); CDamageInfo damageInfo2(in); CDamageVulnerability damageVulnerability1(in); CDamageVulnerability damageVulnerability2(in); CAssetId modelId(in); CAssetId skinId(in); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); - float f5 = in.readFloatBig(); - float f6 = in.readFloatBig(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); + float f5 = in.ReadFloat(); + float f6 = in.ReadFloat(); CFlameInfo flameInfo(in); - float f7 = in.readFloatBig(); - float f8 = in.readFloatBig(); - float f9 = in.readFloatBig(); + float f7 = in.ReadFloat(); + float f8 = in.ReadFloat(); + float f9 = in.ReadFloat(); CModelData modelData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), actorHead.x40_scale, @@ -3156,34 +3119,34 @@ CEntity* ScriptLoader::LoadSnakeWeedSwarm(CStateManager& mgr, CInputStream& in, return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f pos = zeus::CVector3f::ReadBig(in); - zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); - bool active = in.readBool(); + zeus::CVector3f pos = in.Get(); + zeus::CVector3f scale = in.Get(); + bool active = in.ReadBool(); CAnimationParameters animParms = LoadAnimationParameters(in); CActorParameters actParms = LoadActorParameters(in); - float spacing = in.readFloatBig(); - float height = in.readFloatBig(); - float f3 = in.readFloatBig(); - float weaponDamageRadius = in.readFloatBig(); - float maxPlayerDistance = in.readFloatBig(); - float loweredTime = in.readFloatBig(); - float loweredTimeVariation = in.readFloatBig(); - float maxZOffset = in.readFloatBig(); - float speed = in.readFloatBig(); - float speedVariation = in.readFloatBig(); - float f11 = in.readFloatBig(); - float scaleMin = in.readFloatBig(); - float scaleMax = in.readFloatBig(); - float distanceBelowGround = in.readFloatBig(); + float spacing = in.ReadFloat(); + float height = in.ReadFloat(); + float f3 = in.ReadFloat(); + float weaponDamageRadius = in.ReadFloat(); + float maxPlayerDistance = in.ReadFloat(); + float loweredTime = in.ReadFloat(); + float loweredTimeVariation = in.ReadFloat(); + float maxZOffset = in.ReadFloat(); + float speed = in.ReadFloat(); + float speedVariation = in.ReadFloat(); + float f11 = in.ReadFloat(); + float scaleMin = in.ReadFloat(); + float scaleMax = in.ReadFloat(); + float distanceBelowGround = in.ReadFloat(); CDamageInfo dInfo(in); - float unused = in.readFloatBig(); - u32 sfxId1 = in.readUint32Big(); - u32 sfxId2 = in.readUint32Big(); - u32 sfxId3 = in.readUint32Big(); + float unused = in.ReadFloat(); + u32 sfxId1 = in.ReadLong(); + u32 sfxId2 = in.ReadLong(); + u32 sfxId3 = in.ReadLong(); CAssetId particleGenDesc1 = (propCount < 29 ? CAssetId() : CAssetId(in)); - u32 w5 = (propCount < 29 ? 0 : in.readUint32Big()); + u32 w5 = (propCount < 29 ? 0 : in.ReadLong()); CAssetId particleGenDesc2 = (propCount < 29 ? CAssetId() : CAssetId(in)); - float f16 = (propCount < 29 ? 0.f : in.readFloatBig()); + float f16 = (propCount < 29 ? 0.f : in.ReadFloat()); CAnimRes animRes(animParms.GetACSFile(), animParms.GetCharacter(), zeus::skOne3f, animParms.GetInitialAnimation(), true); @@ -3199,17 +3162,17 @@ CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in return nullptr; SScaledActorHead head = LoadScaledActorHead(in, mgr); - zeus::CVector3f collisionExtent = zeus::CVector3f::ReadBig(in); - zeus::CVector3f collisionOrigin = zeus::CVector3f::ReadBig(in); - float mass = in.readFloatBig(); - float zMomentum = in.readFloatBig(); + zeus::CVector3f collisionExtent = in.Get(); + zeus::CVector3f collisionOrigin = in.Get(); + float mass = in.ReadFloat(); + float zMomentum = in.ReadFloat(); CHealthInfo hInfo(in); CDamageVulnerability dVuln(in); CAnimationParameters animParams(in); CActorParameters actParams = LoadActorParameters(in); - CAssetId flameFxId = in.readUint32Big(); + CAssetId flameFxId = in.ReadLong(); CDamageInfo dInfo(in); - bool active = in.readBool(); + bool active = in.ReadBool(); if (!g_ResFactory->GetResourceTypeById(animParams.GetACSFile()).IsValid()) return nullptr; @@ -3242,14 +3205,14 @@ CEntity* ScriptLoader::LoadOculus(CStateManager& mgr, CInputStream& in, int prop if (!pInfo.GetAnimationParameters().GetACSFile().IsValid()) return nullptr; - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); - float f5 = in.readFloatBig(); - float f6 = in.readFloatBig(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); + float f5 = in.ReadFloat(); + float f6 = in.ReadFloat(); CDamageVulnerability dVuln(in); - float f7 = in.readFloatBig(); + float f7 = in.ReadFloat(); CDamageInfo dInfo(in); const CAnimationParameters animParms = pInfo.GetAnimationParameters(); CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), aHead.x40_scale, @@ -3276,16 +3239,16 @@ CEntity* ScriptLoader::LoadGeemer(CStateManager& mgr, CInputStream& in, int prop if (pInfo.GetAnimationParameters().GetACSFile() == CAssetId()) return nullptr; - float advanceWpRadius = in.readFloatBig(); - float f2 = in.readFloatBig(); - float alignAngVel = in.readFloatBig(); - float f4 = in.readFloatBig(); - float playerObstructionMinDist = in.readFloatBig(); - float haltDelay = in.readFloatBig(); - float forwardMoveWeight = in.readFloatBig(); - u16 haltSfx = in.readUint32Big() & 0xFFFF; - u16 getUpSfx = in.readUint32Big() & 0xFFFF; - u16 crouchSfx = in.readUint32Big() & 0xFFFF; + float advanceWpRadius = in.ReadFloat(); + float f2 = in.ReadFloat(); + float alignAngVel = in.ReadFloat(); + float f4 = in.ReadFloat(); + float playerObstructionMinDist = in.ReadFloat(); + float haltDelay = in.ReadFloat(); + float forwardMoveWeight = in.ReadFloat(); + u16 haltSfx = in.ReadLong() & 0xFFFF; + u16 getUpSfx = in.ReadLong() & 0xFFFF; + u16 crouchSfx = in.ReadLong() & 0xFFFF; CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true)); @@ -3303,12 +3266,12 @@ CEntity* ScriptLoader::LoadSpindleCamera(CStateManager& mgr, CInputStream& in, i return nullptr; SActorHead aHead = LoadActorHead(in, mgr); - bool active = in.readBool(); + bool active = in.ReadBool(); u32 flags = LoadParameterFlags(in); - float hintToCamDistMin = in.readFloatBig(); - float hintToCamDistMax = in.readFloatBig(); - float hintToCamVOffMin = in.readFloatBig(); - float hintToCamVOffMax = in.readFloatBig(); + float hintToCamDistMin = in.ReadFloat(); + float hintToCamDistMax = in.ReadFloat(); + float hintToCamVOffMin = in.ReadFloat(); + float hintToCamVOffMax = in.ReadFloat(); SSpindleProperty targetHintToCamDeltaAngleVel(in); targetHintToCamDeltaAngleVel.FixupAngles(); @@ -3358,11 +3321,11 @@ CEntity* ScriptLoader::LoadAtomicAlpha(CStateManager& mgr, CInputStream& in, int CAssetId wpsc(in); CAssetId model(in); CDamageInfo dInfo(in); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - bool b1 = in.readBool(); - bool b2 = in.readBool(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + bool b1 = in.ReadBool(); + bool b2 = in.ReadBool(); CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true)); @@ -3377,10 +3340,10 @@ CEntity* ScriptLoader::LoadCameraHintTrigger(CStateManager& mgr, CInputStream& i return nullptr; SActorHead aHead = LoadActorHead(in, mgr); - zeus::CVector3f scale = 0.5f * zeus::CVector3f::ReadBig(in); - bool active = in.readBool(); - bool deactivateOnEnter = in.readBool(); - bool deactivateOnExit = in.readBool(); + zeus::CVector3f scale = 0.5f * in.Get(); + bool active = in.ReadBool(); + bool deactivateOnEnter = in.ReadBool(); + bool deactivateOnExit = in.ReadBool(); zeus::CTransform xfRot = aHead.x10_transform.getRotation(); if (xfRot == zeus::CTransform()) @@ -3397,11 +3360,10 @@ CEntity* ScriptLoader::LoadRumbleEffect(CStateManager& mgr, CInputStream& in, in return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f position; - position.readBig(in); - bool active = in.readBool(); - float f1 = in.readFloatBig(); - u32 w1 = in.readUint32Big(); + zeus::CVector3f position = in.Get(); + bool active = in.ReadBool(); + float f1 = in.ReadFloat(); + u32 w1 = in.ReadLong(); u32 pFlags = LoadParameterFlags(in); return new CScriptSpecialFunction( @@ -3415,18 +3377,18 @@ CEntity* ScriptLoader::LoadAmbientAI(CStateManager& mgr, CInputStream& in, int p return nullptr; SScaledActorHead head = LoadScaledActorHead(in, mgr); - zeus::CVector3f collisionExtent = zeus::CVector3f::ReadBig(in); - zeus::CVector3f collisionOffset = zeus::CVector3f::ReadBig(in); - float mass = in.readFloatBig(); + zeus::CVector3f collisionExtent = in.Get(); + zeus::CVector3f collisionOffset = in.Get(); + float mass = in.ReadFloat(); CHealthInfo hInfo(in); CDamageVulnerability dVuln(in); CAnimationParameters animParms = LoadAnimationParameters(in); CActorParameters actParms = LoadActorParameters(in); - float alertRange = in.readFloatBig(); - float impactRange = in.readFloatBig(); - s32 alertAnim = in.readInt32Big(); - s32 impactAnim = in.readInt32Big(); - bool active = in.readBool(); + float alertRange = in.ReadFloat(); + float impactRange = in.ReadFloat(); + s32 alertAnim = in.ReadInt32(); + s32 impactAnim = in.ReadInt32(); + bool active = in.ReadBool(); if (!g_ResFactory->GetResourceTypeById(animParms.GetACSFile()).IsValid()) return nullptr; @@ -3457,17 +3419,17 @@ CEntity* ScriptLoader::LoadAtomicBeta(CStateManager& mgr, CInputStream& in, int CAssetId weaponId(in); CDamageInfo dInfo(in); CAssetId particleId(in); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); CDamageVulnerability dVuln(in); - float f4 = in.readFloatBig(); - float f5 = in.readFloatBig(); - float f6 = in.readFloatBig(); - s16 sId1 = s16(in.readInt32Big() & 0xFFFF); - s16 sId2 = s16(in.readInt32Big() & 0xFFFF); - s16 sId3 = s16(in.readInt32Big() & 0xFFFF); - float f7 = in.readFloatBig(); + float f4 = in.ReadFloat(); + float f5 = in.ReadFloat(); + float f6 = in.ReadFloat(); + s16 sId1 = s16(in.ReadInt32() & 0xFFFF); + s16 sId2 = s16(in.ReadInt32() & 0xFFFF); + s16 sId3 = s16(in.ReadInt32() & 0xFFFF); + float f7 = in.ReadFloat(); const CAnimationParameters& animParms = pInfo.GetAnimationParameters(); CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), aHead.x40_scale, animParms.GetInitialAnimation(), true)); @@ -3490,16 +3452,16 @@ CEntity* ScriptLoader::LoadIceZoomer(CStateManager& mgr, CInputStream& in, int p if (!animParms.GetACSFile().IsValid()) return nullptr; - float advanceWpRadius = in.readFloatBig(); - float f2 = in.readFloatBig(); - float alignAngleVel = in.readFloatBig(); - float f4 = in.readFloatBig(); - float playerObstructionMinDist = in.readFloatBig(); - float moveFowardWeight = in.readFloatBig(); - CAssetId modelRes(in.readUint32Big()); - CAssetId skinRes(in.readUint32Big()); + float advanceWpRadius = in.ReadFloat(); + float f2 = in.ReadFloat(); + float alignAngleVel = in.ReadFloat(); + float f4 = in.ReadFloat(); + float playerObstructionMinDist = in.ReadFloat(); + float moveFowardWeight = in.ReadFloat(); + CAssetId modelRes(in.ReadLong()); + CAssetId skinRes(in.ReadLong()); CDamageVulnerability dVuln(in); - float iceZoomerJointHP = in.readFloatBig(); + float iceZoomerJointHP = in.ReadFloat(); CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), actHead.x40_scale, animParms.GetInitialAnimation(), true)); @@ -3524,16 +3486,16 @@ CEntity* ScriptLoader::LoadPuffer(CStateManager& mgr, CInputStream& in, int prop return nullptr; CActorParameters actorParameters = LoadActorParameters(in); - float hoverSpeed = in.readFloatBig(); + float hoverSpeed = in.ReadFloat(); CAssetId cloudEffect(in); CDamageInfo cloudDamage(in); CAssetId cloudSteam(in); - float f2 = in.readFloatBig(); - bool b1 = in.readBool(); - bool b2 = in.readBool(); - bool b3 = in.readBool(); + float f2 = in.ReadFloat(); + bool b1 = in.ReadBool(); + bool b2 = in.ReadBool(); + bool b3 = in.ReadBool(); CDamageInfo explosionDamage(in); - s16 sfxId = in.readUint16Big(); + s16 sfxId = in.ReadShort(); CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), aHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true)); @@ -3558,10 +3520,10 @@ CEntity* ScriptLoader::LoadTryclops(CStateManager& mgr, CInputStream& in, int pr return nullptr; CActorParameters actorParameters = LoadActorParameters(in); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), actorHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true)); @@ -3609,10 +3571,10 @@ CEntity* ScriptLoader::LoadSeedling(CStateManager& mgr, CInputStream& in, int pr CAssetId weaponId(in); CDamageInfo dInfo1(in); CDamageInfo dInfo2(in); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), aHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true)); @@ -3626,9 +3588,9 @@ CEntity* ScriptLoader::LoadThermalHeatFader(CStateManager& mgr, CInputStream& in return nullptr; std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - float fadedLevel = in.readFloatBig(); - float initialLevel = in.readFloatBig(); + bool active = in.ReadBool(); + float fadedLevel = in.ReadFloat(); + float initialLevel = in.ReadFloat(); return new CScriptDistanceFog(mgr.AllocateUniqueId(), name, info, ERglFogMode::None, zeus::skBlack, zeus::CVector2f(), 0.f, zeus::CVector2f(), false, active, fadedLevel, initialLevel, 0.f, 0.f); } @@ -3654,7 +3616,7 @@ CEntity* ScriptLoader::LoadBurrower(CStateManager& mgr, CInputStream& in, int pr CDamageInfo dInfo(in); CAssetId w4(in); - u32 w5 = in.readUint32Big(); + u32 w5 = in.ReadLong(); CAssetId w6(in); CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(), @@ -3669,8 +3631,8 @@ CEntity* ScriptLoader::LoadBeam(CStateManager& mgr, CInputStream& in, int propCo return nullptr; SActorHead aHead = LoadActorHead(in, mgr); - bool active = in.readBool(); - u32 weaponDescId = in.readUint32Big(); + bool active = in.ReadBool(); + u32 weaponDescId = in.ReadLong(); if (!g_ResFactory->GetResourceTypeById(weaponDescId).IsValid()) return nullptr; @@ -3688,9 +3650,9 @@ CEntity* ScriptLoader::LoadWorldLightFader(CStateManager& mgr, CInputStream& in, return nullptr; std::string name = mgr.HashInstanceName(in); - bool active = in.readBool(); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); + bool active = in.ReadBool(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); return new CScriptDistanceFog(mgr.AllocateUniqueId(), name, info, ERglFogMode::None, zeus::skBlack, zeus::skZero2f, 0.f, zeus::skZero2f, false, active, 0.f, 0.f, f1, f2); @@ -3712,7 +3674,7 @@ CEntity* ScriptLoader::LoadMetroidPrimeEssence(CStateManager& mgr, CInputStream& CAssetId particle1{in}; CDamageInfo dInfo{in}; CAssetId electric{in}; - u32 w3 = in.readUint32Big(); + u32 w3 = in.ReadLong(); CAssetId particle2{in}; const CAnimationParameters& animParms = pInfo.GetAnimationParameters(); @@ -3727,26 +3689,26 @@ CEntity* ScriptLoader::LoadMetroidPrimeStage1(CStateManager& mgr, CInputStream& const CEntityInfo& info) { if (!EnsurePropertyCount(propCount, 22, "MetroidPrimeStage1")) return nullptr; - u32 version = in.readUint32Big(); + u32 version = in.ReadLong(); if (version != 3) return nullptr; SScaledActorHead aHead = LoadScaledActorHead(in, mgr); - bool active = in.readBool(); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - u32 w1 = in.readUint32Big(); - bool b1 = in.readBool(); - u32 w2 = in.readUint32Big(); + bool active = in.ReadBool(); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + u32 w1 = in.ReadLong(); + bool b1 = in.ReadBool(); + u32 w2 = in.ReadLong(); CHealthInfo hInfo1(in); CHealthInfo hInfo2(in); - u32 w3 = in.readUint32Big(); + u32 w3 = in.ReadLong(); rstl::reserved_vector roomParms; for (int i = 0; i < 4; ++i) roomParms.emplace_back(in); - u32 w4 = in.readUint32Big(); - u32 w5 = in.readUint32Big(); + u32 w4 = in.ReadLong(); + u32 w5 = in.ReadLong(); MP1::SPrimeExoParameters primeParms(in); return new MP1::CMetroidPrimeRelay(mgr.AllocateUniqueId(), aHead.x0_name, info, active, aHead.x10_transform, @@ -3759,13 +3721,13 @@ CEntity* ScriptLoader::LoadMazeNode(CStateManager& mgr, CInputStream& in, int pr return nullptr; SActorHead aHead = LoadActorHead(in, mgr); - bool active = in.readBool(); - u32 col = in.readUint32Big(); - u32 row = in.readUint32Big(); - u32 side = in.readUint32Big(); - zeus::CVector3f actorPos = zeus::CVector3f::ReadBig(in); - zeus::CVector3f triggerPos = zeus::CVector3f::ReadBig(in); - zeus::CVector3f effectPos = zeus::CVector3f::ReadBig(in); + bool active = in.ReadBool(); + u32 col = in.ReadLong(); + u32 row = in.ReadLong(); + u32 side = in.ReadLong(); + zeus::CVector3f actorPos = in.Get(); + zeus::CVector3f triggerPos = in.Get(); + zeus::CVector3f effectPos = in.Get(); return new CScriptMazeNode(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, col, row, side, actorPos, triggerPos, effectPos); @@ -3806,20 +3768,20 @@ CEntity* ScriptLoader::LoadPhazonPool(CStateManager& mgr, CInputStream& in, int } SScaledActorHead actHead = LoadScaledActorHead(in, mgr); - bool active = in.readBool(); + bool active = in.ReadBool(); CAssetId w1{in}; CAssetId w2{in}; CAssetId w3{in}; CAssetId w4{in}; - u32 u1 = in.readUint32Big(); + u32 u1 = in.ReadLong(); CDamageInfo dInfo{in}; - zeus::CVector3f orientedForce{in.readVec3f()}; - ETriggerFlags triggerFlags = static_cast(in.readUint32Big()); - float f1 = in.readFloatBig(); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - bool b2 = in.readBool(); - float f4 = in.readFloatBig(); + zeus::CVector3f orientedForce = in.Get(); + ETriggerFlags triggerFlags = static_cast(in.ReadLong()); + float f1 = in.ReadFloat(); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + bool b2 = in.ReadBool(); + float f4 = in.ReadFloat(); return new MP1::CPhazonPool(mgr.AllocateUniqueId(), actHead.x0_name, info, zeus::CTransform::Translate(actHead.x10_transform.origin), actHead.x40_scale, active, w1, @@ -3841,9 +3803,9 @@ CEntity* ScriptLoader::LoadPhazonHealingNodule(CStateManager& mgr, CInputStream& CPatternedInfo pInfo(in, pair.second); CActorParameters actParms = LoadActorParameters(in); - in.readBool(); + in.ReadBool(); CAssetId w1{in}; - std::string w2 = in.readString(); + std::string w2 = in.Get(); if (!pInfo.GetAnimationParameters().GetACSFile().IsValid()) { return nullptr; @@ -3862,11 +3824,11 @@ CEntity* ScriptLoader::LoadNewCameraShaker(CStateManager& mgr, CInputStream& in, return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f sfxPos = zeus::CVector3f::ReadBig(in); - bool active = in.readBool(); + zeus::CVector3f sfxPos = in.Get(); + bool active = in.ReadBool(); u32 flags = LoadParameterFlags(in); - float duration = in.readFloatBig(); - float sfxDist = in.readFloatBig(); + float duration = in.ReadFloat(); + float sfxDist = in.ReadFloat(); CCameraShakerComponent shakerX = CCameraShakerComponent::LoadNewCameraShakerComponent(in); CCameraShakerComponent shakerY = CCameraShakerComponent::LoadNewCameraShakerComponent(in); CCameraShakerComponent shakerZ = CCameraShakerComponent::LoadNewCameraShakerComponent(in); @@ -3882,15 +3844,15 @@ CEntity* ScriptLoader::LoadShadowProjector(CStateManager& mgr, CInputStream& in, return nullptr; std::string name = mgr.HashInstanceName(in); - zeus::CVector3f position(zeus::CVector3f::ReadBig(in)); - bool b1 = in.readBool(); - float f1 = in.readFloatBig(); - zeus::CVector3f vec2(zeus::CVector3f::ReadBig(in)); - float f2 = in.readFloatBig(); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); - bool b2 = in.readBool(); - u32 w1 = in.readUint32Big(); + zeus::CVector3f position( in.Get()); + bool b1 = in.ReadBool(); + float f1 = in.ReadFloat(); + zeus::CVector3f vec2( in.Get()); + float f2 = in.ReadFloat(); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); + bool b2 = in.ReadBool(); + u32 w1 = in.ReadLong(); return new CScriptShadowProjector(mgr.AllocateUniqueId(), name, info, zeus::CTransform::Translate(position), b1, vec2, b2, f1, f2, f3, f4, w1); } @@ -3910,21 +3872,21 @@ CEntity* ScriptLoader::LoadEnergyBall(CStateManager& mgr, CInputStream& in, int return nullptr; CActorParameters actParms = LoadActorParameters(in); - u32 w1 = in.readUint32Big(); - float f1 = in.readFloatBig(); + u32 w1 = in.ReadLong(); + float f1 = in.ReadFloat(); CDamageInfo dInfo1(in); - float f2 = in.readFloatBig(); + float f2 = in.ReadFloat(); CAssetId a1(in); - s16 sfxId1 = CSfxManager::TranslateSFXID(in.readUint32Big()); + s16 sfxId1 = CSfxManager::TranslateSFXID(in.ReadLong()); CAssetId a2(in); CAssetId a3(in); - s16 sfxId2 = CSfxManager::TranslateSFXID(in.readUint32Big()); - float f3 = in.readFloatBig(); - float f4 = in.readFloatBig(); + s16 sfxId2 = CSfxManager::TranslateSFXID(in.ReadLong()); + float f3 = in.ReadFloat(); + float f4 = in.ReadFloat(); CAssetId a4(in); CDamageInfo dInfo2 = propCount >= 19 ? CDamageInfo(in) : CDamageInfo(); - float f5 = propCount >= 20 ? in.readFloatBig() : 3.0f; + float f5 = propCount >= 20 ? in.ReadFloat() : 3.0f; CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), actorHead.x40_scale, animParms.GetInitialAnimation(), true)); From ce23544a159b954158945976c1e5c70f333a94b3 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 18 Feb 2022 21:32:36 -0800 Subject: [PATCH 02/17] Fix CInputStream::Get/ReadBytes not properly updating position --- Runtime/CInputStream.cpp | 60 +++++++++++++++------------------ Runtime/RetroTypes.cpp | 4 +-- Runtime/World/CEnvFxManager.cpp | 4 +-- 3 files changed, 31 insertions(+), 37 deletions(-) diff --git a/Runtime/CInputStream.cpp b/Runtime/CInputStream.cpp index 1113bc7c8..2c0b450bf 100644 --- a/Runtime/CInputStream.cpp +++ b/Runtime/CInputStream.cpp @@ -31,30 +31,29 @@ bool CInputStream::InternalReadNext() { bool CInputStream::GrabAnotherBlock() { return InternalReadNext(); } void CInputStream::Get(u8* dest, u32 len) { + u32 readLen = 0; x20_bitOffset = 0; - u32 offset = 0; while (len != 0) { u32 blockLen = x8_blockLen - x4_blockOffset; if (len < blockLen) { blockLen = len; } - if (blockLen == 0) { - if (len <= 256) { - GrabAnotherBlock(); - } else { - u32 readLen = Read(dest + offset, len); - len -= readLen; - offset += readLen; - } - } else { - memcpy(dest + offset, x10_ptr + x4_blockOffset, blockLen); + if (blockLen != 0) { + memcpy(dest + readLen, x10_ptr + x4_blockOffset, blockLen); len -= blockLen; + readLen += blockLen; x4_blockOffset += blockLen; + } else if (len > 256) { + u32 tmp = Read(dest + readLen, len); + len -= tmp; + readLen += tmp; + } else { + GrabAnotherBlock(); } } - x18_readPosition += offset; + x18_readPosition += readLen; } u32 CInputStream::ReadBytes(void* dest, u32 len) { @@ -66,31 +65,26 @@ u32 CInputStream::ReadBytes(void* dest, u32 len) { GrabAnotherBlock(); } - u32 curReadLen = 0; u32 curLen = len; + u32 curReadLen = 0; - do { - while (true) { - if (len <= curReadLen) { - x18_readPosition += curReadLen; - return curReadLen; - } - - u32 readCount = x8_blockLen - x4_blockOffset; - if (readCount == 0) { - break; - } - - if (curLen < readCount) { - readCount = curLen; - } - - memcpy(reinterpret_cast(dest) + curReadLen, x10_ptr + x4_blockOffset, readCount); - curReadLen += readCount; - curLen -= readCount; + while (curReadLen < len) { + if ((x8_blockLen - x4_blockOffset) == 0 && !InternalReadNext()) { + break; } - } while (InternalReadNext()); + u32 readCount = x8_blockLen - x4_blockOffset; + if (curLen < (x8_blockLen - x4_blockOffset)) { + readCount = curLen; + } + + memcpy(reinterpret_cast(dest) + curReadLen, x10_ptr + x4_blockOffset, readCount); + curReadLen += readCount; + curLen -= readCount; + x4_blockOffset += readCount; + } + + x18_readPosition += curReadLen; return curReadLen; } diff --git a/Runtime/RetroTypes.cpp b/Runtime/RetroTypes.cpp index 45ca652f8..c05f36c11 100644 --- a/Runtime/RetroTypes.cpp +++ b/Runtime/RetroTypes.cpp @@ -9,13 +9,13 @@ namespace metaforce { logvisor::Module Log("metaforce::RetroTypes::CAssetId"); SObjectTag::SObjectTag(CInputStream& in) { - in.ReadBytes(reinterpret_cast(&type), 4); + in.Get(reinterpret_cast(&type), 4); id = in.Get(); } void SObjectTag::ReadMLVL(CInputStream& in) { id = in.Get(); - in.ReadBytes(reinterpret_cast(&type), 4); + in.Get(reinterpret_cast(&type), 4); } CAssetId::CAssetId(CInputStream& in) { diff --git a/Runtime/World/CEnvFxManager.cpp b/Runtime/World/CEnvFxManager.cpp index 53a9e1dce..5e79fd098 100644 --- a/Runtime/World/CEnvFxManager.cpp +++ b/Runtime/World/CEnvFxManager.cpp @@ -599,9 +599,9 @@ void CEnvFxManager::Cleanup() { void CEnvFxManager::Initialize() { const SObjectTag* tag = g_ResFactory->GetResourceIdByName("DUMB_SnowForces"); std::unique_ptr data = g_ResFactory->LoadResourceSync(*tag); - athena::io::MemoryReader r(data.get(), 2048); + CMemoryInStream r(data.get(), 2048, CMemoryInStream::EOwnerShip::NotOwned); for (int i = 0; i < 256; ++i) - g_SnowForces.push_back(r.readVec2fBig()); + g_SnowForces.push_back(r.Get()); } } // namespace metaforce From ad272f74683bab6007bc9b2a5827473b55c76958 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 19 Feb 2022 05:04:45 -0800 Subject: [PATCH 03/17] More refactoring, decouple tweaks from hecl --- DataSpec/DNACommon/Tweaks/ITweak.hpp | 8 +- .../DNACommon/Tweaks/ITweakAutoMapper.hpp | 55 - DataSpec/DNACommon/Tweaks/ITweakGame.hpp | 20 +- DataSpec/DNACommon/Tweaks/ITweakGui.hpp | 128 -- DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp | 136 +- .../DNACommon/Tweaks/ITweakPlayerControl.hpp | 4 +- DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp | 25 - DataSpec/DNAMP1/CMakeLists.txt | 3 +- DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp | 62 - DataSpec/DNAMP1/Tweaks/CTweakGame.hpp | 31 - DataSpec/DNAMP1/Tweaks/CTweakGui.hpp | 153 +- DataSpec/DNAMP1/Tweaks/CTweakPlayer.cpp | 783 +------- DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp | 142 -- .../DNAMP1/Tweaks/CTweakPlayerControl.hpp | 3 - DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp | 72 - DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp | 8 +- Runtime/Audio/CAudioGroupSet.hpp | 2 +- Runtime/Audio/CMidiManager.cpp | 4 +- Runtime/Audio/CSfxManager.cpp | 2 +- Runtime/AutoMapper/CAutoMapper.cpp | 2 +- Runtime/AutoMapper/CAutoMapper.hpp | 6 +- Runtime/AutoMapper/CMapArea.cpp | 2 +- Runtime/AutoMapper/CMapUniverse.cpp | 2 +- Runtime/AutoMapper/CMapWorld.cpp | 2 +- Runtime/AutoMapper/CMapWorldInfo.hpp | 2 +- Runtime/CFactoryMgr.hpp | 2 +- Runtime/CGameHintInfo.cpp | 8 +- Runtime/CGameOptions.cpp | 20 +- Runtime/CGameState.cpp | 4 +- Runtime/CMakeLists.txt | 28 +- Runtime/CMayaSpline.cpp | 2 +- Runtime/CMemoryCardSys.cpp | 2 +- Runtime/CMemoryCardSys.hpp | 2 +- Runtime/CPakFile.cpp | 2 +- Runtime/CPlayerState.cpp | 2 +- Runtime/CPlayerState.hpp | 2 +- Runtime/CResFactory.cpp | 8 +- Runtime/CResLoader.hpp | 2 +- Runtime/CScannableObjectInfo.cpp | 4 +- Runtime/CScriptMailbox.hpp | 2 +- Runtime/CStringExtras.cpp | 2 +- Runtime/CWorldSaveGameInfo.cpp | 2 +- Runtime/Camera/CCameraFilter.cpp | 2 +- Runtime/Camera/CFirstPersonCamera.cpp | 2 +- Runtime/Character/CAdditiveAnimPlayback.hpp | 2 +- Runtime/Character/CAnimData.cpp | 6 +- Runtime/Character/CAnimSource.cpp | 2 +- Runtime/Character/CAnimation.hpp | 2 +- Runtime/Character/CAnimationSet.cpp | 4 +- Runtime/Character/CAnimationSet.hpp | 2 +- Runtime/Character/CCharAnimTime.hpp | 2 +- Runtime/Character/CCharLayoutInfo.hpp | 2 +- Runtime/Character/CCharacterInfo.cpp | 12 +- Runtime/Character/CCharacterInfo.hpp | 6 +- Runtime/Character/CCharacterSet.hpp | 2 +- Runtime/Character/CEffectComponent.hpp | 2 +- Runtime/Character/CFBStreamedCompression.cpp | 2 +- Runtime/Character/CHalfTransition.hpp | 2 +- Runtime/Character/CMetaAnimBlend.hpp | 2 +- Runtime/Character/CMetaAnimFactory.hpp | 2 +- Runtime/Character/CMetaAnimPhaseBlend.hpp | 2 +- Runtime/Character/CMetaAnimPlay.hpp | 2 +- Runtime/Character/CMetaAnimRandom.hpp | 2 +- Runtime/Character/CMetaAnimSequence.hpp | 2 +- Runtime/Character/CMetaTransFactory.hpp | 2 +- Runtime/Character/CMetaTransMetaAnim.hpp | 2 +- Runtime/Character/CMetaTransPhaseTrans.hpp | 2 +- Runtime/Character/CMetaTransSnap.hpp | 2 +- Runtime/Character/CMetaTransTrans.hpp | 2 +- Runtime/Character/CModelData.hpp | 2 +- Runtime/Character/CPASAnimInfo.hpp | 2 +- Runtime/Character/CPASAnimState.hpp | 2 +- Runtime/Character/CPASDatabase.hpp | 2 +- Runtime/Character/CPASParmInfo.hpp | 2 +- Runtime/Character/CPOINode.hpp | 2 +- Runtime/Character/CParticleData.hpp | 2 +- Runtime/Character/CPrimitive.cpp | 2 +- Runtime/Character/CPrimitive.hpp | 2 +- Runtime/Character/CSegId.hpp | 2 +- Runtime/Character/CSegIdList.hpp | 2 +- Runtime/Character/CSkinBank.hpp | 2 +- Runtime/Character/CTransition.hpp | 2 +- Runtime/Collision/CAreaOctTree.cpp | 43 +- Runtime/Collision/CCollidableOBBTreeGroup.hpp | 2 +- Runtime/Collision/CCollisionEdge.cpp | 2 +- Runtime/Collision/CCollisionResponseData.hpp | 2 +- Runtime/GameGlobalObjects.hpp | 108 +- Runtime/Graphics/CModelBoo.cpp | 24 +- Runtime/Graphics/CPVSAreaSet.cpp | 2 +- Runtime/Graphics/CPVSVisOctree.cpp | 2 +- Runtime/Graphics/CTexture.hpp | 2 +- Runtime/Graphics/CTextureBoo.cpp | 23 +- Runtime/GuiSys/CAuiEnergyBarT01.cpp | 2 +- Runtime/GuiSys/CAuiImagePane.cpp | 2 +- Runtime/GuiSys/CGuiSys.hpp | 2 +- Runtime/GuiSys/CGuiWidget.hpp | 2 +- Runtime/GuiSys/CHudEnergyInterface.cpp | 6 +- Runtime/GuiSys/CRasterFont.hpp | 2 +- Runtime/GuiSys/CStringTable.cpp | 2 +- Runtime/ITweak.hpp | 8 - Runtime/MP1/CArtifactDoll.cpp | 26 +- Runtime/MP1/CFrontEndUI.cpp | 2 +- Runtime/MP1/CInGameGuiManager.cpp | 2 +- Runtime/MP1/CInGameGuiManager.hpp | 6 +- Runtime/MP1/CLogBookScreen.cpp | 2 +- Runtime/MP1/CMFGame.cpp | 4 +- Runtime/MP1/CMakeLists.txt | 13 + Runtime/MP1/CMemoryCardDriver.cpp | 2 +- Runtime/MP1/CPlayerVisor.cpp | 8 +- Runtime/MP1/CSamusHud.cpp | 6 +- Runtime/MP1/CSamusHud.hpp | 2 +- Runtime/MP1/CSlideShow.cpp | 2 +- Runtime/MP1/CTweaks.cpp | 73 +- Runtime/MP1/MP1.hpp | 2 +- .../MP1}/Tweaks/CTweakAutoMapper.cpp | 74 +- Runtime/MP1/Tweaks/CTweakAutoMapper.hpp | 143 ++ Runtime/MP1/Tweaks/CTweakBall.cpp | 462 +++++ Runtime/MP1/Tweaks/CTweakBall.hpp | 199 ++ .../MP1}/Tweaks/CTweakGame.cpp | 36 +- Runtime/MP1/Tweaks/CTweakGame.hpp | 86 + Runtime/MP1/Tweaks/CTweakGui.cpp | 183 ++ Runtime/MP1/Tweaks/CTweakGui.hpp | 332 ++++ Runtime/MP1/Tweaks/CTweakGuiColors.cpp | 132 ++ Runtime/MP1/Tweaks/CTweakGuiColors.hpp | 226 +++ Runtime/MP1/Tweaks/CTweakGunRes.cpp | 48 + Runtime/MP1/Tweaks/CTweakGunRes.hpp | 90 + Runtime/MP1/Tweaks/CTweakParticle.cpp | 10 + Runtime/MP1/Tweaks/CTweakParticle.hpp | 16 + Runtime/MP1/Tweaks/CTweakPlayer.cpp | 1667 +++++++++++++++++ Runtime/MP1/Tweaks/CTweakPlayer.hpp | 317 ++++ Runtime/MP1/Tweaks/CTweakPlayerControl.cpp | 10 + Runtime/MP1/Tweaks/CTweakPlayerControl.hpp | 13 + Runtime/MP1/Tweaks/CTweakPlayerGun.cpp | 42 + Runtime/MP1/Tweaks/CTweakPlayerGun.hpp | 103 + Runtime/MP1/Tweaks/CTweakPlayerRes.cpp | 72 + Runtime/MP1/Tweaks/CTweakPlayerRes.hpp | 104 + Runtime/MP1/Tweaks/CTweakSlideShow.cpp | 23 + Runtime/MP1/Tweaks/CTweakSlideShow.hpp | 36 + Runtime/MP1/Tweaks/CTweakTargeting.cpp | 150 ++ Runtime/MP1/Tweaks/CTweakTargeting.hpp | 282 +++ Runtime/MP1/World/CActorContraption.cpp | 2 +- Runtime/MP1/World/CMetroidPrimeExo.cpp | 22 +- Runtime/MP1/World/CMetroidPrimeProjectile.cpp | 4 +- Runtime/Particle/CDecalDataFactory.hpp | 2 +- Runtime/Particle/CDecalManager.cpp | 4 +- Runtime/Particle/CParticleDataFactory.cpp | 2 +- Runtime/Particle/CParticleDataFactory.hpp | 2 +- .../Particle/CParticleElectricDataFactory.hpp | 2 +- .../Particle/CParticleSwooshDataFactory.hpp | 2 +- .../Particle/CProjectileWeaponDataFactory.hpp | 2 +- Runtime/Particle/CSpawnSystemKeyframeData.hpp | 2 +- Runtime/Particle/IElement.hpp | 2 +- Runtime/RetroTypes.cpp | 10 +- Runtime/RetroTypes.hpp | 3 +- Runtime/{ => Streams}/CInputStream.cpp | 4 +- Runtime/{ => Streams}/CInputStream.hpp | 6 +- Runtime/{ => Streams}/CMemoryInStream.hpp | 2 +- Runtime/{ => Streams}/CMemoryStreamOut.cpp | 0 Runtime/{ => Streams}/CMemoryStreamOut.hpp | 2 +- Runtime/{ => Streams}/COutputStream.cpp | 0 Runtime/{ => Streams}/COutputStream.hpp | 0 Runtime/{ => Streams}/CZipInputStream.cpp | 19 +- Runtime/{ => Streams}/CZipInputStream.hpp | 0 Runtime/Streams/ContainerReaders.hpp | 14 + Runtime/{ => Streams}/IOStreams.cpp | 18 +- Runtime/{ => Streams}/IOStreams.hpp | 16 +- Runtime/Tweaks/ITweak.hpp | 19 + Runtime/Tweaks/ITweakAutoMapper.hpp | 62 + Runtime/Tweaks/ITweakBall.hpp | 69 + Runtime/Tweaks/ITweakGame.hpp | 26 + Runtime/Tweaks/ITweakGui.hpp | 140 ++ Runtime/Tweaks/ITweakGuiColors.hpp | 102 + Runtime/Tweaks/ITweakGunRes.hpp | 142 ++ Runtime/Tweaks/ITweakParticle.hpp | 9 + Runtime/Tweaks/ITweakPlayer.hpp | 144 ++ Runtime/Tweaks/ITweakPlayerControl.hpp | 12 + Runtime/Tweaks/ITweakPlayerGun.cpp | 14 + Runtime/Tweaks/ITweakPlayerGun.hpp | 73 + Runtime/Tweaks/ITweakPlayerRes.hpp | 176 ++ Runtime/Tweaks/ITweakSlideShow.hpp | 15 + Runtime/Tweaks/ITweakTargeting.hpp | 96 + Runtime/Weapon/CBeamInfo.hpp | 10 +- Runtime/Weapon/CFlameInfo.hpp | 2 +- Runtime/Weapon/CGunWeapon.cpp | 10 +- Runtime/Weapon/CGunWeapon.hpp | 6 +- Runtime/Weapon/CPowerBomb.cpp | 2 +- Runtime/Weapon/WeaponCommon.cpp | 4 +- Runtime/Weapon/WeaponCommon.hpp | 2 +- Runtime/World/CAnimationParameters.hpp | 4 +- Runtime/World/CDamageInfo.cpp | 29 +- Runtime/World/CDamageInfo.hpp | 9 +- Runtime/World/CGameArea.cpp | 30 +- Runtime/World/CHUDMemoParms.hpp | 2 +- Runtime/World/CHealthInfo.cpp | 2 +- Runtime/World/CPathFindArea.cpp | 3 +- Runtime/World/CPathFindRegion.hpp | 2 +- Runtime/World/CPatternedInfo.cpp | 2 +- Runtime/World/CScriptGunTurret.cpp | 4 +- Runtime/World/CStateMachine.hpp | 2 +- Runtime/World/CWorld.cpp | 18 +- Runtime/World/CWorldLight.cpp | 2 +- Runtime/World/IGameArea.cpp | 2 +- Runtime/World/ScriptLoader.cpp | 102 +- Runtime/World/ScriptLoader.hpp | 2 +- 204 files changed, 6475 insertions(+), 2110 deletions(-) delete mode 100644 Runtime/ITweak.hpp rename {DataSpec/DNAMP1 => Runtime/MP1}/Tweaks/CTweakAutoMapper.cpp (78%) create mode 100644 Runtime/MP1/Tweaks/CTweakAutoMapper.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakBall.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakBall.hpp rename {DataSpec/DNAMP1 => Runtime/MP1}/Tweaks/CTweakGame.cpp (83%) create mode 100644 Runtime/MP1/Tweaks/CTweakGame.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakGui.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakGui.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakGuiColors.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakGuiColors.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakGunRes.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakGunRes.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakParticle.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakParticle.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakPlayer.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakPlayer.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakPlayerControl.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakPlayerControl.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakPlayerGun.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakPlayerGun.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakPlayerRes.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakPlayerRes.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakSlideShow.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakSlideShow.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakTargeting.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakTargeting.hpp rename Runtime/{ => Streams}/CInputStream.cpp (97%) rename Runtime/{ => Streams}/CInputStream.hpp (94%) rename Runtime/{ => Streams}/CMemoryInStream.hpp (84%) rename Runtime/{ => Streams}/CMemoryStreamOut.cpp (100%) rename Runtime/{ => Streams}/CMemoryStreamOut.hpp (90%) rename Runtime/{ => Streams}/COutputStream.cpp (100%) rename Runtime/{ => Streams}/COutputStream.hpp (100%) rename Runtime/{ => Streams}/CZipInputStream.cpp (59%) rename Runtime/{ => Streams}/CZipInputStream.hpp (100%) create mode 100644 Runtime/Streams/ContainerReaders.hpp rename Runtime/{ => Streams}/IOStreams.cpp (86%) rename Runtime/{ => Streams}/IOStreams.hpp (72%) create mode 100644 Runtime/Tweaks/ITweak.hpp create mode 100644 Runtime/Tweaks/ITweakAutoMapper.hpp create mode 100644 Runtime/Tweaks/ITweakBall.hpp create mode 100644 Runtime/Tweaks/ITweakGame.hpp create mode 100644 Runtime/Tweaks/ITweakGui.hpp create mode 100644 Runtime/Tweaks/ITweakGuiColors.hpp create mode 100644 Runtime/Tweaks/ITweakGunRes.hpp create mode 100644 Runtime/Tweaks/ITweakParticle.hpp create mode 100644 Runtime/Tweaks/ITweakPlayer.hpp create mode 100644 Runtime/Tweaks/ITweakPlayerControl.hpp create mode 100644 Runtime/Tweaks/ITweakPlayerGun.cpp create mode 100644 Runtime/Tweaks/ITweakPlayerGun.hpp create mode 100644 Runtime/Tweaks/ITweakPlayerRes.hpp create mode 100644 Runtime/Tweaks/ITweakSlideShow.hpp create mode 100644 Runtime/Tweaks/ITweakTargeting.hpp diff --git a/DataSpec/DNACommon/Tweaks/ITweak.hpp b/DataSpec/DNACommon/Tweaks/ITweak.hpp index 7a3f04709..fb732c492 100644 --- a/DataSpec/DNACommon/Tweaks/ITweak.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweak.hpp @@ -2,12 +2,6 @@ #include "DataSpec/DNACommon/DNACommon.hpp" -namespace hecl { -class CVarManager; -} namespace DataSpec { -struct ITweak : BigDNA { - - virtual void initCVars(hecl::CVarManager*) {} -}; +struct ITweak : BigDNA {}; } // namespace DataSpec diff --git a/DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp b/DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp index eaf9397a6..0f38c8b7f 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp @@ -4,60 +4,5 @@ namespace DataSpec { struct ITweakAutoMapper : public ITweak { - virtual bool GetShowOneMiniMapArea() const = 0; - virtual bool GetScaleMoveSpeedWithCamDist() const = 0; - virtual float GetCamDist() const = 0; - virtual float GetMinCamDist() const = 0; - virtual float GetMaxCamDist() const = 0; - virtual float GetMinCamRotateX() const = 0; - virtual float GetMaxCamRotateX() const = 0; - virtual float GetCamAngle() const = 0; - virtual const zeus::CColor& GetAutomapperWidgetColor() const = 0; - virtual float GetMiniCamDist() const = 0; - virtual float GetMiniCamXAngle() const = 0; - virtual float GetMiniCamAngle() const = 0; - virtual const zeus::CColor& GetAutomapperWidgetMiniColor() const = 0; - virtual const zeus::CColor& GetSurfaceVisitedColor() const = 0; - virtual const zeus::CColor& GetOutlineVisitedColor() const = 0; - virtual const zeus::CColor& GetSurfaceUnvisitedColor() const = 0; - virtual const zeus::CColor& GetOutlineUnvisitedColor() const = 0; - virtual const zeus::CColor& GetSurfaceSelectVisitedColor() const = 0; - virtual const zeus::CColor& GetOutlineSelectVisitedColor() const = 0; - virtual float GetMapSurfaceNormColorLinear() const = 0; - virtual float GetMapSurfaceNormColorConstant() const = 0; - virtual float GetOpenMapScreenTime() const = 0; - virtual float GetCloseMapScreenTime() const = 0; - virtual float GetHintPanTime() const = 0; - virtual float GetCamZoomUnitsPerFrame() const = 0; - virtual float GetCamRotateDegreesPerFrame() const = 0; - virtual float GetBaseMapScreenCameraMoveSpeed() const = 0; - virtual const zeus::CColor& GetSurfaceSelectUnvisitedColor() const = 0; - virtual const zeus::CColor& GetOutlineSelectUnvisitedColor() const = 0; - virtual float GetMiniAlphaSurfaceVisited() const = 0; - virtual float GetAlphaSurfaceVisited() const = 0; - virtual float GetMiniAlphaOutlineVisited() const = 0; - virtual float GetAlphaOutlineVisited() const = 0; - virtual float GetMiniAlphaSurfaceUnvisited() const = 0; - virtual float GetAlphaSurfaceUnvisited() const = 0; - virtual float GetMiniAlphaOutlineUnvisited() const = 0; - virtual float GetAlphaOutlineUnvisited() const = 0; - virtual const zeus::CVector3f& GetDoorCenter() const = 0; - virtual float GetMiniMapViewportWidth() const = 0; - virtual float GetMiniMapViewportHeight() const = 0; - virtual float GetMiniMapCamDistScale() const = 0; - virtual float GetMapPlaneScaleX() const = 0; - virtual float GetMapPlaneScaleZ() const = 0; - virtual float GetUniverseCamDist() const = 0; - virtual float GetMinUniverseCamDist() const = 0; - virtual float GetMaxUniverseCamDist() const = 0; - virtual float GetSwitchToFromUniverseTime() const = 0; - virtual float GetCamPanUnitsPerFrame() const = 0; - virtual float GetAutomapperScaleX() const = 0; - virtual float GetAutomapperScaleZ() const = 0; - virtual float GetCamVerticalOffset() const = 0; - virtual const zeus::CColor& GetMiniMapSamusModColor() const = 0; - virtual const zeus::CColor& GetAreaFlashPulseColor() const = 0; - virtual const zeus::CColor& GetDoorColor(int idx) const = 0; - virtual const zeus::CColor& GetOpenDoorColor() const = 0; }; } // namespace DataSpec diff --git a/DataSpec/DNACommon/Tweaks/ITweakGame.hpp b/DataSpec/DNACommon/Tweaks/ITweakGame.hpp index 75364b2e8..494f92043 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakGame.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakGame.hpp @@ -4,23 +4,5 @@ namespace DataSpec { -struct ITweakGame : ITweak { - virtual std::string_view GetWorldPrefix() const = 0; - virtual bool GetSplashScreensDisabled() const = 0; - virtual float GetFirstPersonFOV() const = 0; - virtual float GetPressStartDelay() const = 0; - virtual float GetWavecapIntensityNormal() const = 0; - virtual float GetWavecapIntensityPoison() const = 0; - virtual float GetWavecapIntensityLava() const = 0; - virtual float GetRippleIntensityNormal() const = 0; - virtual float GetRippleIntensityPoison() const = 0; - virtual float GetRippleIntensityLava() const = 0; - virtual float GetFluidEnvBumpScale() const = 0; - virtual float GetWaterFogDistanceBase() const = 0; - virtual float GetWaterFogDistanceRange() const = 0; - virtual float GetGravityWaterFogDistanceBase() const = 0; - virtual float GetGravityWaterFogDistanceRange() const = 0; - virtual float GetHardModeDamageMultiplier() const = 0; - virtual float GetHardModeWeaponMultiplier() const = 0; -}; +struct ITweakGame : ITweak {}; } // namespace DataSpec diff --git a/DataSpec/DNACommon/Tweaks/ITweakGui.hpp b/DataSpec/DNACommon/Tweaks/ITweakGui.hpp index 9ea42cd27..5f3b260e7 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakGui.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakGui.hpp @@ -7,135 +7,7 @@ namespace DataSpec { struct ITweakGui : ITweak { enum class EHudVisMode : atUint32 { Zero, One, Two, Three }; - enum class EHelmetVisMode : atUint32 { ReducedUpdate, NotVisible, Deco, HelmetDeco, GlowHelmetDeco, HelmetOnly }; - - virtual float GetMapAlphaInterpolant() const = 0; - virtual float GetPauseBlurFactor() const = 0; - virtual float GetRadarXYRadius() const = 0; - virtual float GetRadarZRadius() const = 0; - virtual float GetRadarZCloseRadius() const = 0; - virtual float GetEnergyBarFilledSpeed() const = 0; - virtual float GetEnergyBarShadowSpeed() const = 0; - virtual float GetEnergyBarDrainDelay() const = 0; - virtual bool GetEnergyBarAlwaysResetDelay() const = 0; - virtual float GetHudDamagePracticalsGainConstant() const = 0; - virtual float GetHudDamagePracticalsGainLinear() const = 0; - virtual float GetHudDamagePracticalsInitConstant() const = 0; - virtual float GetHudDamagePracticalsInitLinear() const = 0; - virtual float GetHudDamageLightSpotAngle() const = 0; - virtual float GetDamageLightAngleC() const = 0; - virtual float GetDamageLightAngleL() const = 0; - virtual float GetDamageLightAngleQ() const = 0; - virtual atVec3f GetDamageLightPreTranslate() const = 0; - virtual atVec3f GetDamageLightCenterTranslate() const = 0; - virtual float GetDamageLightXfXAngle() const = 0; - virtual float GetDamageLightXfZAngle() const = 0; - virtual float GetHudDecoShakeTranslateVelConstant() const = 0; - virtual float GetHudDecoShakeTranslateVelLinear() const = 0; - virtual float GetMaxDecoDamageShakeTranslate() const = 0; - virtual float GetDecoDamageShakeDeceleration() const = 0; - virtual float GetDecoShakeGainConstant() const = 0; - virtual float GetDecoShakeGainLinear() const = 0; - virtual float GetDecoShakeInitConstant() const = 0; - virtual float GetDecoShakeInitLinear() const = 0; - virtual float GetMaxDecoDamageShakeRotate() const = 0; - virtual atUint32 GetHudCamFovTweak() const = 0; - virtual atUint32 GetHudCamYTweak() const = 0; - virtual atUint32 GetHudCamZTweak() const = 0; - virtual float GetBeamVisorMenuAnimTime() const = 0; - virtual float GetVisorBeamMenuItemActiveScale() const = 0; - virtual float GetVisorBeamMenuItemInactiveScale() const = 0; - virtual float GetVisorBeamMenuItemTranslate() const = 0; - virtual float GetThreatRange() const = 0; - virtual float GetRadarScopeCoordRadius() const = 0; - virtual float GetRadarPlayerPaintRadius() const = 0; - virtual float GetRadarEnemyPaintRadius() const = 0; - virtual float GetMissileArrowVisTime() const = 0; - virtual EHudVisMode GetHudVisMode() const = 0; - virtual EHelmetVisMode GetHelmetVisMode() const = 0; - virtual atUint32 GetEnableAutoMapper() const = 0; - virtual atUint32 GetEnableTargetingManager() const = 0; - virtual atUint32 GetEnablePlayerVisor() const = 0; - virtual float GetThreatWarningFraction() const = 0; - virtual float GetMissileWarningFraction() const = 0; - virtual float GetFreeLookFadeTime() const = 0; - virtual float GetFreeLookSfxPitchScale() const = 0; - virtual bool GetNoAbsoluteFreeLookSfxPitch() const = 0; - virtual float GetFaceReflectionOrthoWidth() const = 0; - virtual float GetFaceReflectionOrthoHeight() const = 0; - virtual float GetFaceReflectionDistance() const = 0; - virtual float GetFaceReflectionHeight() const = 0; - virtual float GetFaceReflectionAspect() const = 0; - virtual float GetMissileWarningPulseTime() const = 0; - virtual float GetExplosionLightFalloffMultConstant() const = 0; - virtual float GetExplosionLightFalloffMultLinear() const = 0; - virtual float GetExplosionLightFalloffMultQuadratic() const = 0; - virtual float GetHudDamagePeakFactor() const = 0; - virtual float GetHudDamageFilterGainConstant() const = 0; - virtual float GetHudDamageFilterGainLinear() const = 0; - virtual float GetHudDamageFilterInitConstant() const = 0; - virtual float GetHudDamageFilterInitLinear() const = 0; - virtual float GetEnergyDrainModPeriod() const = 0; - virtual bool GetEnergyDrainSinusoidalPulse() const = 0; - virtual bool GetEnergyDrainFilterAdditive() const = 0; - virtual float GetHudDamagePulseDuration() const = 0; - virtual float GetHudDamageColorGain() const = 0; - virtual float GetHudDecoShakeTranslateGain() const = 0; - virtual float GetHudLagOffsetScale() const = 0; - virtual float GetScanAppearanceDuration() const = 0; - virtual float GetScanPaneFlashFactor() const = 0; - virtual float GetScanPaneFadeInTime() const = 0; - virtual float GetScanPaneFadeOutTime() const = 0; - virtual float GetBallViewportYReduction() const = 0; - virtual float GetScanWindowIdleWidth() const = 0; - virtual float GetScanWindowIdleHeight() const = 0; - virtual float GetScanWindowActiveWidth() const = 0; - virtual float GetScanWindowActiveHeight() const = 0; - virtual float GetScanWindowMagnification() const = 0; - virtual float GetScanWindowScanningAspect() const = 0; - virtual float GetScanSpeed(int idx) const = 0; - virtual float GetXrayBlurScaleLinear() const = 0; - virtual float GetXrayBlurScaleQuadratic() const = 0; - virtual float GetScanSidesAngle() const = 0; - virtual float GetScanSidesXScale() const = 0; - virtual float GetScanSidesPositionEnd() const = 0; - virtual float GetScanSidesDuration() const = 0; - virtual float GetScanSidesStartTime() const = 0; - virtual float GetScanSidesEndTime() const = 0; - virtual float GetScanDataDotRadius() const = 0; - virtual float GetScanDataDotPosRandMagnitude() const = 0; - virtual float GetScanDataDotSeekDurationMin() const = 0; - virtual float GetScanDataDotSeekDurationMax() const = 0; - virtual float GetScanDataDotHoldDurationMin() const = 0; - virtual float GetScanDataDotHoldDurationMax() const = 0; - virtual float GetScanSidesPositionStart() const = 0; - virtual bool GetShowAutomapperInMorphball() const = 0; - virtual bool GetLatchArticleText() const = 0; - virtual float GetWorldTransManagerCharsPerSfx() const = 0; - virtual atUint32 GetXRayFogMode() const = 0; - virtual float GetXRayFogNearZ() const = 0; - virtual float GetXRayFogFarZ() const = 0; - virtual const zeus::CColor& GetXRayFogColor() const = 0; - virtual float GetThermalVisorLevel() const = 0; - virtual const zeus::CColor& GetThermalVisorColor() const = 0; - virtual const zeus::CColor& GetVisorHudLightAdd(int v) const = 0; - virtual const zeus::CColor& GetVisorHudLightMultiply(int v) const = 0; - virtual const zeus::CColor& GetHudReflectivityLightColor() const = 0; - virtual float GetHudLightAttMulConstant() const = 0; - virtual float GetHudLightAttMulLinear() const = 0; - virtual float GetHudLightAttMulQuadratic() const = 0; - virtual std::string_view GetCreditsTable() const = 0; - virtual std::string_view GetCreditsFont() const = 0; - virtual std::string_view GetJapaneseCreditsFont() const = 0; - virtual const zeus::CColor& GetCreditsTextFontColor() const = 0; - virtual const zeus::CColor& GetCreditsTextBorderColor() const = 0; - - static float FaceReflectionDistanceDebugValueToActualValue(float v) { return 0.015f * v + 0.2f; } - static float FaceReflectionHeightDebugValueToActualValue(float v) { return 0.005f * v - 0.05f; } - static float FaceReflectionAspectDebugValueToActualValue(float v) { return 0.05f * v + 1.f; } - static float FaceReflectionOrthoWidthDebugValueToActualValue(float v) { return 0.007f * v + 0.02f; } - static float FaceReflectionOrthoHeightDebugValueToActualValue(float v) { return 0.007f * v + 0.02f; } }; } // namespace DataSpec diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp index ca5592846..220cb5e8e 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp @@ -5,140 +5,6 @@ namespace DataSpec { -struct ITweakPlayer : ITweak { - virtual float GetMaxTranslationalAcceleration(int s) const = 0; - virtual float GetMaxRotationalAcceleration(int s) const = 0; - virtual float GetPlayerTranslationFriction(int s) const = 0; - virtual float GetPlayerRotationFriction(int s) const = 0; - virtual float GetPlayerRotationMaxSpeed(int s) const = 0; - virtual float GetPlayerTranslationMaxSpeed(int s) const = 0; - virtual float GetNormalGravAccel() const = 0; - virtual float GetFluidGravAccel() const = 0; - virtual float GetVerticalJumpAccel() const = 0; - virtual float GetHorizontalJumpAccel() const = 0; - virtual float GetVerticalDoubleJumpAccel() const = 0; - virtual float GetHorizontalDoubleJumpAccel() const = 0; - virtual float GetWaterJumpFactor() const = 0; - virtual float GetWaterBallJumpFactor() const = 0; - virtual float GetLavaJumpFactor() const = 0; - virtual float GetLavaBallJumpFactor() const = 0; - virtual float GetPhazonJumpFactor() const = 0; - virtual float GetPhazonBallJumpFactor() const = 0; - virtual float GetAllowedJumpTime() const = 0; - virtual float GetAllowedDoubleJumpTime() const = 0; - virtual float GetMinDoubleJumpWindow() const = 0; - virtual float GetMaxDoubleJumpWindow() const = 0; - virtual float GetMinJumpTime() const = 0; - virtual float GetMinDoubleJumpTime() const = 0; - virtual float GetAllowedLedgeTime() const = 0; - virtual float GetDoubleJumpImpulse() const = 0; - virtual float GetBackwardsForceMultiplier() const = 0; - virtual float GetBombJumpRadius() const = 0; - virtual float GetBombJumpHeight() const = 0; - virtual float GetEyeOffset() const = 0; - virtual float GetTurnSpeedMultiplier() const = 0; - virtual float GetFreeLookTurnSpeedMultiplier() const = 0; - virtual float GetFreeLookSpeed() const = 0; - virtual float GetFreeLookSnapSpeed() const = 0; - virtual float GetFreeLookCenteredThresholdAngle() const = 0; - virtual float GetFreeLookCenteredTime() const = 0; - virtual float GetOrbitModeTimer() const = 0; - virtual float GetOrbitUpperAngle() const = 0; - virtual float GetOrbitLowerAngle() const = 0; - virtual float GetOrbitHorizAngle() const = 0; - virtual float GetOrbitMaxTargetDistance() const = 0; - virtual float GetOrbitMaxLockDistance() const = 0; - virtual float GetOrbitDistanceThreshold() const = 0; - virtual uint32_t GetOrbitScreenBoxHalfExtentX(int zone) const = 0; - virtual uint32_t GetOrbitScreenBoxHalfExtentY(int zone) const = 0; - virtual uint32_t GetOrbitScreenBoxCenterX(int zone) const = 0; - virtual uint32_t GetOrbitScreenBoxCenterY(int zone) const = 0; - virtual uint32_t GetOrbitZoneIdealX(int zone) const = 0; - virtual uint32_t GetOrbitZoneIdealY(int zone) const = 0; - virtual float GetOrbitNearX() const = 0; - virtual float GetOrbitNearZ() const = 0; - virtual float GetOrbitFixedOffsetZDiff() const = 0; - virtual float GetOrbitZRange() const = 0; - virtual bool GetDashEnabled() const = 0; - virtual bool GetDashOnButtonRelease() const = 0; - virtual float GetDashButtonHoldCancelTime() const = 0; - virtual float GetDashStrafeInputThreshold() const = 0; - virtual float GetSidewaysDoubleJumpImpulse() const = 0; - virtual float GetSidewaysVerticalDoubleJumpAccel() const = 0; - virtual float GetSidewaysHorizontalDoubleJumpAccel() const = 0; - virtual float GetScanningRange() const = 0; // x218 - virtual bool GetScanRetention() const = 0; - virtual bool GetScanFreezesGame() const = 0; // x21c_25 - virtual bool GetOrbitWhileScanning() const = 0; - virtual bool GetFallingDoubleJump() const = 0; - virtual bool GetImpulseDoubleJump() const = 0; - virtual bool GetFiringCancelsCameraPitch() const = 0; - virtual bool GetAssistedAimingIgnoreHorizontal() const = 0; - virtual bool GetAssistedAimingIgnoreVertical() const = 0; - virtual float GetAimMaxDistance() const = 0; - virtual float GetAimThresholdDistance() const = 0; - virtual float GetAimBoxWidth() const = 0; - virtual float GetAimBoxHeight() const = 0; - virtual float GetAimTargetTimer() const = 0; - virtual float GetAimAssistHorizontalAngle() const = 0; - virtual float GetAimAssistVerticalAngle() const = 0; - virtual float GetScanMaxTargetDistance() const = 0; - virtual float GetScanMaxLockDistance() const = 0; - virtual bool GetMoveDuringFreeLook() const = 0; - virtual bool GetHoldButtonsForFreeLook() const = 0; - virtual bool GetTwoButtonsForFreeLook() const = 0; - virtual bool GetAimWhenOrbitingPoint() const = 0; - virtual bool GetStayInFreeLookWhileFiring() const = 0; - virtual bool GetOrbitFixedOffset() const = 0; - virtual bool GetGunButtonTogglesHolster() const = 0; - virtual bool GetGunNotFiringHolstersGun() const = 0; - virtual float GetPlayerHeight() const = 0; // x26c - virtual float GetPlayerXYHalfExtent() const = 0; // x270 - virtual bool GetFreeLookTurnsPlayer() const = 0; // x228_24 - virtual float GetStepUpHeight() const = 0; // x274 - virtual float GetStepDownHeight() const = 0; // x278 - virtual float GetPlayerBallHalfExtent() const = 0; // x27c - virtual float GetOrbitDistanceMax() const = 0; - virtual float GetGrappleSwingLength() const = 0; - virtual float GetGrappleSwingPeriod() const = 0; - virtual float GetGrapplePullSpeedMin() const = 0; - virtual float GetMaxGrappleLockedTurnAlignDistance() const = 0; - virtual float GetGrapplePullSpeedProportion() const = 0; - virtual float GetGrapplePullSpeedMax() const = 0; - virtual float GetGrappleLookCenterSpeed() const = 0; - virtual float GetMaxGrappleTurnSpeed() const = 0; - virtual float GetGrappleJumpForce() const = 0; - virtual float GetGrappleReleaseTime() const = 0; - virtual uint32_t GetGrappleJumpMode() const = 0; - virtual bool GetOrbitReleaseBreaksGrapple() const = 0; - virtual bool GetInvertGrappleTurn() const = 0; - virtual float GetGrappleBeamSpeed() const = 0; - virtual float GetGrappleBeamXWaveAmplitude() const = 0; - virtual float GetGrappleBeamZWaveAmplitude() const = 0; - virtual float GetGrappleBeamAnglePhaseDelta() const = 0; - virtual float GetHorizontalFreeLookAngleVel() const = 0; - virtual float GetVerticalFreeLookAngleVel() const = 0; // x134 - virtual float GetOrbitCameraSpeed() const = 0; // x184 - virtual float GetOrbitPreventionTime() const = 0; - virtual float GetJumpCameraPitchDownStart() const = 0; // x288 - virtual float GetJumpCameraPitchDownFull() const = 0; // x28c - virtual float GetJumpCameraPitchDownAngle() const = 0; // x290 - virtual float GetFallCameraPitchDownStart() const = 0; // x294 - virtual float GetFallCameraPitchDownFull() const = 0; // x298 - virtual float GetFallCameraPitchDownAngle() const = 0; // x29c - virtual float GetFirstPersonCameraSpeed() const = 0; // x280 - virtual float GetGrappleCameraSpeed() const = 0; // x2b0 - virtual float GetFreeLookDampenFactor() const = 0; // x14c - virtual float GetLeftLogicalThreshold() const = 0; - virtual float GetRightLogicalThreshold() const = 0; - virtual float GetOrbitMinDistance(int type) const = 0; - virtual float GetOrbitNormalDistance(int type) const = 0; - virtual float GetOrbitMaxDistance(int type) const = 0; - virtual float GetFrozenTimeout() const = 0; - virtual uint32_t GetIceBreakJumpCount() const = 0; - virtual float GetVariaDamageReduction() const = 0; - virtual float GetGravityDamageReduction() const = 0; - virtual float GetPhazonDamageReduction() const = 0; -}; +struct ITweakPlayer : ITweak {}; } // namespace DataSpec diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp index 6f523e10c..58b9c5c39 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp @@ -4,8 +4,6 @@ namespace DataSpec { -struct ITweakPlayerControl : ITweak { - virtual atUint32 GetMapping(atUint32) const = 0; -}; +struct ITweakPlayerControl : ITweak {}; } // namespace DataSpec diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp index 9f9ffa00f..1a4c3fbca 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp @@ -43,30 +43,5 @@ struct SWeaponInfo : BigDNA { struct ITweakPlayerGun : ITweak { AT_DECL_DNA_YAML - virtual float GetUpLookAngle() const = 0; - virtual float GetDownLookAngle() const = 0; - virtual float GetVerticalSpread() const = 0; - virtual float GetHorizontalSpread() const = 0; - virtual float GetHighVerticalSpread() const = 0; - virtual float GetHighHorizontalSpread() const = 0; - virtual float GetLowVerticalSpread() const = 0; - virtual float GetLowHorizontalSpread() const = 0; - virtual float GetAimVerticalSpeed() const = 0; // x24 - virtual float GetAimHorizontalSpeed() const = 0; // x28 - virtual float GetBombFuseTime() const = 0; // x2c - virtual float GetBombDropDelayTime() const = 0; // x30 - virtual float GetHoloHoldTime() const = 0; // x34 - virtual float GetGunTransformTime() const = 0; // x38 - virtual float GetGunHolsterTime() const = 0; - virtual float GetGunNotFiringTime() const = 0; - virtual float GetFixedVerticalAim() const = 0; - virtual float GetGunExtendDistance() const = 0; - virtual const zeus::CVector3f& GetGunPosition() const = 0; - virtual const zeus::CVector3f& GetGrapplingArmPosition() const = 0; - virtual float GetRichochetDamage(atUint32) const = 0; - virtual const SWeaponInfo& GetBeamInfo(atInt32 beam) const = 0; - virtual const SComboShotParam& GetComboShotInfo(atInt32 beam) const = 0; - virtual const SShotParam& GetBombInfo() const = 0; - virtual const SShotParam& GetPowerBombInfo() const = 0; }; } // namespace DataSpec diff --git a/DataSpec/DNAMP1/CMakeLists.txt b/DataSpec/DNAMP1/CMakeLists.txt index 4b16eaaca..9c28078fc 100644 --- a/DataSpec/DNAMP1/CMakeLists.txt +++ b/DataSpec/DNAMP1/CMakeLists.txt @@ -60,10 +60,9 @@ set(DNAMP1_SOURCES FRME.cpp SCAN.cpp DeafBabe.cpp - Tweaks/CTweakAutoMapper.cpp Tweaks/CTweakPlayer.cpp Tweaks/CTweakTargeting.cpp Tweaks/CTweakBall.cpp - Tweaks/CTweakGame.cpp) + ) dataspec_add_list(DNAMP1 DNAMP1_SOURCES) diff --git a/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp b/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp index 291e237ed..a0f9e6609 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp @@ -79,67 +79,5 @@ struct CTweakAutoMapper final : public ITweakAutoMapper { Vector x104_doorColors; DNAColor x118_doorBorderColor; DNAColor x11c_openDoorColor; - - CTweakAutoMapper() = default; - CTweakAutoMapper(athena::io::IStreamReader& r) { this->read(r); } - bool GetShowOneMiniMapArea() const override { return x4_24_showOneMiniMapArea; } - bool GetScaleMoveSpeedWithCamDist() const override { return x4_26_scaleMoveSpeedWithCamDist; } - float GetCamDist() const override { return x8_camDist; } - float GetMinCamDist() const override { return xc_minCamDist; } - float GetMaxCamDist() const override { return x10_maxCamDist; } - float GetMinCamRotateX() const override { return x14_minCamRotateX; } - float GetMaxCamRotateX() const override { return x18_maxCamRotateX; } - float GetCamAngle() const override { return x1c_camAngle; } - const zeus::CColor& GetAutomapperWidgetColor() const override { return x24_automapperWidgetColor; } - float GetMiniCamDist() const override { return x28_miniCamDist; } - float GetMiniCamXAngle() const override { return x2c_miniCamXAngle; } - float GetMiniCamAngle() const override { return x30_miniCamAngle; } - const zeus::CColor& GetAutomapperWidgetMiniColor() const override { return x38_automapperWidgetMiniColor; } - const zeus::CColor& GetSurfaceVisitedColor() const override { return x3c_surfColorVisited; } - const zeus::CColor& GetOutlineVisitedColor() const override { return x40_outlineColorVisited; } - const zeus::CColor& GetSurfaceUnvisitedColor() const override { return x44_surfColorUnvisited; } - const zeus::CColor& GetOutlineUnvisitedColor() const override { return x48_outlineColorUnvisited; } - const zeus::CColor& GetSurfaceSelectVisitedColor() const override { return x4c_surfaceSelectColorVisited; } - const zeus::CColor& GetOutlineSelectVisitedColor() const override { return x50_outlineSelectColorVisited; } - float GetMapSurfaceNormColorLinear() const override { return x54_mapSurfaceNormColorLinear; } - float GetMapSurfaceNormColorConstant() const override { return x58_mapSurfaceNormColorConstant; } - float GetOpenMapScreenTime() const override { return x64_openMapScreenTime; } - float GetCloseMapScreenTime() const override { return x68_closeMapScreenTime; } - float GetHintPanTime() const override { return x6c_hintPanTime; } - float GetCamZoomUnitsPerFrame() const override { return x70_zoomUnitsPerFrame; } - float GetCamRotateDegreesPerFrame() const override { return x74_rotateDegPerFrame; } - float GetBaseMapScreenCameraMoveSpeed() const override { return x78_baseMapScreenCameraMoveSpeed; } - const zeus::CColor& GetSurfaceSelectUnvisitedColor() const override { return x7c_surfaceSelectColorUnvisited; } - const zeus::CColor& GetOutlineSelectUnvisitedColor() const override { return x80_outlineSelectColorUnvisited; } - float GetMiniAlphaSurfaceVisited() const override { return x84_miniAlphaSurfaceVisited; } - float GetAlphaSurfaceVisited() const override { return x88_alphaSurfaceVisited; } - float GetMiniAlphaOutlineVisited() const override { return x8c_miniAlphaOutlineVisited; } - float GetAlphaOutlineVisited() const override { return x90_alphaOutlineVisited; } - float GetMiniAlphaSurfaceUnvisited() const override { return x94_miniAlphaSurfaceUnvisited; } - float GetAlphaSurfaceUnvisited() const override { return x98_alphaSurfaceUnvisited; } - float GetMiniAlphaOutlineUnvisited() const override { return x9c_miniAlphaOutlineUnvisited; } - float GetAlphaOutlineUnvisited() const override { return xa0_alphaOutlineUnvisited; } - const zeus::CVector3f& GetDoorCenter() const override { return xa4_doorCenter; } - float GetMiniMapViewportWidth() const override { return xb8_miniMapViewportWidth; } - float GetMiniMapViewportHeight() const override { return xbc_miniMapViewportHeight; } - float GetMiniMapCamDistScale() const override { return xc0_miniMapCamDistScale; } - float GetMapPlaneScaleX() const override { return xc4_mapPlaneScaleX; } - float GetMapPlaneScaleZ() const override { return xc8_mapPlaneScaleZ; } - float GetUniverseCamDist() const override { return xd0_universeCamDist; } - float GetMinUniverseCamDist() const override { return xd4_minUniverseCamDist; } - float GetMaxUniverseCamDist() const override { return xd8_maxUniverseCamDist; } - float GetSwitchToFromUniverseTime() const override { return xdc_switchToFromUniverseTime; } - float GetCamPanUnitsPerFrame() const override { return xe0_camPanUnitsPerFrame; } - float GetAutomapperScaleX() const override { return xe4_automapperScaleX; } - float GetAutomapperScaleZ() const override { return xe8_automapperScaleZ; } - float GetCamVerticalOffset() const override { return xec_camVerticalOffset; } - const zeus::CColor& GetMiniMapSamusModColor() const override { return xf0_miniMapSamusModColor; } - const zeus::CColor& GetAreaFlashPulseColor() const override { return xf4_areaFlashPulseColor; } - const zeus::CColor& GetDoorColor(int idx) const override { return x104_doorColors[idx]; } - const zeus::CColor& GetOpenDoorColor() const override { return x11c_openDoorColor; } - void initCVars(hecl::CVarManager*) override; - -private: - void _tweakListener(hecl::CVar* cv); }; } // namespace DataSpec::DNAMP1 diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp index af30301ef..da813167b 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp @@ -54,36 +54,5 @@ struct CTweakGame final : ITweakGame { Value x5c_gravityWaterFogDistanceRange; Value x60_hardmodeDamageMult; Value x64_hardmodeWeaponMult; - - std::string_view GetWorldPrefix() const override { return x4_worldPrefix; } - std::string_view GetDefaultRoom() const { return x14_defaultRoom; } - bool GetSplashScreensDisabled() const override { return x2b_splashScreensDisabled; } - float GetFirstPersonFOV() const override { return x24_fov; } - float GetPressStartDelay() const override { return x30_pressStartDelay; } - float GetWavecapIntensityNormal() const override { return x34_wavecapIntensityNormal; } - float GetWavecapIntensityPoison() const override { return x38_wavecapIntensityPoison; } - float GetWavecapIntensityLava() const override { return x3c_wavecapIntensityLava; } - float GetRippleIntensityNormal() const override { return x40_rippleIntensityNormal; } - float GetRippleIntensityPoison() const override { return x44_rippleIntensityPoison; } - float GetRippleIntensityLava() const override { return x48_rippleIntensityLava; } - float GetFluidEnvBumpScale() const override { return x4c_fluidEnvBumpScale; } - float GetWaterFogDistanceBase() const override { return x50_waterFogDistanceBase; } - float GetWaterFogDistanceRange() const override { return x54_waterFogDistanceRange; } - float GetGravityWaterFogDistanceBase() const override { return x58_gravityWaterFogDistanceBase; } - float GetGravityWaterFogDistanceRange() const override { return x5c_gravityWaterFogDistanceRange; } - float GetHardModeDamageMultiplier() const override { return x60_hardmodeDamageMult; } - float GetHardModeWeaponMultiplier() const override { return x64_hardmodeWeaponMult; } - CTweakGame() = default; - CTweakGame(athena::io::IStreamReader& in) { - this->read(in); -#ifdef NDEBUG - x2b_splashScreensDisabled = false; -#endif - } - - void initCVars(hecl::CVarManager* mgr) override; - -private: - void _tweakListener(hecl::CVar* cv); }; } // namespace DataSpec::DNAMP1 diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp index 557b97527..e6d6eac15 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp @@ -1,6 +1,6 @@ #pragma once -#include "../../DNACommon/Tweaks/ITweakGui.hpp" +#include "DataSpec/DNACommon/Tweaks/ITweakGui.hpp" namespace DataSpec::DNAMP1 { struct CTweakGui final : ITweakGui { @@ -182,157 +182,6 @@ struct CTweakGui final : ITweakGui { Value x364_; CTweakGui() = default; - CTweakGui(athena::io::IStreamReader& r) { - this->read(r); - FixupValues(); - } - - float GetMapAlphaInterpolant() const override { return x8_mapAlphaInterp; } - float GetPauseBlurFactor() const override { return xc_pauseBlurFactor; } - float GetRadarXYRadius() const override { return x10_radarXYRadius; } - float GetRadarZRadius() const override { return x24_radarZRadius; } - float GetRadarZCloseRadius() const override { return x28_radarZCloseRadius; } - float GetEnergyBarFilledSpeed() const override { return x34_energyBarFilledSpeed; } - float GetEnergyBarShadowSpeed() const override { return x38_energyBarShadowSpeed; } - float GetEnergyBarDrainDelay() const override { return x3c_energyBarDrainDelay; } - bool GetEnergyBarAlwaysResetDelay() const override { return x40_energyBarAlwaysResetDelay; } - float GetHudDamagePracticalsGainConstant() const override { return x44_hudDamagePracticalsGainConstant; } - float GetHudDamagePracticalsGainLinear() const override { return x48_hudDamagePracticalsGainLinear; } - float GetHudDamagePracticalsInitConstant() const override { return x4c_hudDamagePracticalsInitConstant; } - float GetHudDamagePracticalsInitLinear() const override { return x50_hudDamagePracticalsInitLinear; } - float GetHudDamageLightSpotAngle() const override { return x54_hudDamageLightSpotAngle; } - float GetDamageLightAngleC() const override { return x58_damageLightAngleC; } - float GetDamageLightAngleL() const override { return x5c_damageLightAngleL; } - float GetDamageLightAngleQ() const override { return x60_damageLightAngleQ; } - atVec3f GetDamageLightPreTranslate() const override { return x64_damageLightPreTranslate; } - atVec3f GetDamageLightCenterTranslate() const override { return x70_damageLightCenterTranslate; } - float GetDamageLightXfXAngle() const override { return x7c_damageLightXfXAngle; } - float GetDamageLightXfZAngle() const override { return x80_damageLightXfZAngle; } - float GetHudDecoShakeTranslateVelConstant() const override { return x84_hudDecoShakeTranslateVelConstant; } - float GetHudDecoShakeTranslateVelLinear() const override { return x88_hudDecoShakeTranslateVelLinear; } - float GetMaxDecoDamageShakeTranslate() const override { return x8c_maxDecoDamageShakeTranslate; } - float GetDecoDamageShakeDeceleration() const override { return x90_decoDamageShakeDeceleration; } - float GetDecoShakeGainConstant() const override { return x94_decoShakeGainConstant; } - float GetDecoShakeGainLinear() const override { return x98_decoShakeGainLinear; } - float GetDecoShakeInitConstant() const override { return x9c_decoShakeInitConstant; } - float GetDecoShakeInitLinear() const override { return xa0_decoShakeInitLinear; } - float GetMaxDecoDamageShakeRotate() const override { return xa4_maxDecoDamageShakeRotate; } - atUint32 GetHudCamFovTweak() const override { return xa8_hudCamFovTweak; } - atUint32 GetHudCamYTweak() const override { return xac_hudCamYTweak; } - atUint32 GetHudCamZTweak() const override { return xb0_hudCamZTweak; } - float GetBeamVisorMenuAnimTime() const override { return xc0_beamVisorMenuAnimTime; } - float GetVisorBeamMenuItemActiveScale() const override { return xc4_visorBeamMenuItemActiveScale; } - float GetVisorBeamMenuItemInactiveScale() const override { return xc8_visorBeamMenuItemInactiveScale; } - float GetVisorBeamMenuItemTranslate() const override { return xcc_visorBeamMenuItemTranslate; } - float GetThreatRange() const override { return xe4_threatRange; } - float GetRadarScopeCoordRadius() const override { return xe8_radarScopeCoordRadius; } - float GetRadarPlayerPaintRadius() const override { return xec_radarPlayerPaintRadius; } - float GetRadarEnemyPaintRadius() const override { return xf0_radarEnemyPaintRadius; } - float GetMissileArrowVisTime() const override { return xf4_missileArrowVisTime; } - EHudVisMode GetHudVisMode() const override { return xf8_hudVisMode; } - EHelmetVisMode GetHelmetVisMode() const override { return xfc_helmetVisMode; } - atUint32 GetEnableAutoMapper() const override { return x100_enableAutoMapper; } - atUint32 GetEnableTargetingManager() const override { return x108_enableTargetingManager; } - atUint32 GetEnablePlayerVisor() const override { return x10c_enablePlayerVisor; } - float GetThreatWarningFraction() const override { return x110_threatWarningFraction; } - float GetMissileWarningFraction() const override { return x114_missileWarningFraction; } - float GetFreeLookFadeTime() const override { return x118_freeLookFadeTime; } - float GetFreeLookSfxPitchScale() const override { return x12c_freeLookSfxPitchScale; } - bool GetNoAbsoluteFreeLookSfxPitch() const override { return x130_noAbsoluteFreeLookSfxPitch; } - float GetFaceReflectionOrthoWidth() const override { return x13c_faceReflectionOrthoWidth; } - float GetFaceReflectionOrthoHeight() const override { return x140_faceReflectionOrthoHeight; } - float GetFaceReflectionDistance() const override { return x144_faceReflectionDistance; } - float GetFaceReflectionHeight() const override { return x148_faceReflectionHeight; } - float GetFaceReflectionAspect() const override { return x14c_faceReflectionAspect; } - float GetMissileWarningPulseTime() const override { return x1a0_missileWarningPulseTime; } - float GetExplosionLightFalloffMultConstant() const override { return x1a4_explosionLightFalloffMultConstant; } - float GetExplosionLightFalloffMultLinear() const override { return x1a8_explosionLightFalloffMultLinear; } - float GetExplosionLightFalloffMultQuadratic() const override { return x1ac_explosionLightFalloffMultQuadratic; } - float GetHudDamagePeakFactor() const override { return x1b4_hudDamagePeakFactor; } - float GetHudDamageFilterGainConstant() const override { return x1b8_hudDamageFilterGainConstant; } - float GetHudDamageFilterGainLinear() const override { return x1bc_hudDamageFilterGainLinear; } - float GetHudDamageFilterInitConstant() const override { return x1c0_hudDamageFilterInitConstant; } - float GetHudDamageFilterInitLinear() const override { return x1c4_hudDamageFilterInitLinear; } - float GetEnergyDrainModPeriod() const override { return x1c8_energyDrainModPeriod; } - bool GetEnergyDrainSinusoidalPulse() const override { return x1cc_energyDrainSinusoidalPulse; } - bool GetEnergyDrainFilterAdditive() const override { return x1cd_energyDrainFilterAdditive; } - float GetHudDamagePulseDuration() const override { return x1d0_hudDamagePulseDuration; } - float GetHudDamageColorGain() const override { return x1d4_hudDamageColorGain; } - float GetHudDecoShakeTranslateGain() const override { return x1d8_hudDecoShakeTranslateGain; } - float GetHudLagOffsetScale() const override { return x1dc_hudLagOffsetScale; } - float GetXrayBlurScaleLinear() const override { return x204_xrayBlurScaleLinear; } - float GetXrayBlurScaleQuadratic() const override { return x208_xrayBlurScaleQuadratic; } - float GetScanSidesAngle() const override { return x210_scanSidesAngle; } - float GetScanSidesXScale() const override { return x214_scanSidesXScale; } - float GetScanSidesPositionEnd() const override { return x218_scanSidesPositionEnd; } - float GetScanSidesDuration() const override { return x220_scanSidesDuration; } - float GetScanSidesStartTime() const override { return x224_scanSidesStartTime; } - float GetScanSidesEndTime() const override { return x228_scanSidesEndTime; } - float GetScanDataDotRadius() const override { return x22c_scanDataDotRadius; } - float GetScanDataDotPosRandMagnitude() const override { return x230_scanDataDotPosRandMag; } - float GetScanDataDotSeekDurationMin() const override { return x234_scanDataDotSeekDurationMin; } - float GetScanDataDotSeekDurationMax() const override { return x238_scanDataDotSeekDurationMax; } - float GetScanDataDotHoldDurationMin() const override { return x23c_scanDataDotHoldDurationMin; } - float GetScanDataDotHoldDurationMax() const override { return x240_scanDataDotHoldDurationMax; } - float GetScanAppearanceDuration() const override { return x244_scanAppearanceDuration; } - float GetScanPaneFlashFactor() const override { return x248_scanPaneFlashFactor; } - float GetScanPaneFadeInTime() const override { return x24c_scanPaneFadeInTime; } - float GetScanPaneFadeOutTime() const override { return x250_scanPaneFadeOutTime; } - float GetBallViewportYReduction() const override { return x254_ballViewportYReduction; } - float GetScanWindowIdleWidth() const override { return x258_scanWindowIdleW; } - float GetScanWindowIdleHeight() const override { return x25c_scanWindowIdleH; } - float GetScanWindowActiveWidth() const override { return x260_scanWindowActiveW; } - float GetScanWindowActiveHeight() const override { return x264_scanWindowActiveH; } - float GetScanWindowMagnification() const override { return x268_scanWindowMagnification; } - float GetScanWindowScanningAspect() const override { return x26c_scanWindowScanningAspect; } - float GetScanSidesPositionStart() const override { return x270_scanSidesPositionStart; } - bool GetShowAutomapperInMorphball() const override { return x274_showAutomapperInMorphball; } - bool GetLatchArticleText() const override { return x275_latchArticleText; } - float GetWorldTransManagerCharsPerSfx() const override { return x278_wtMgrCharsPerSfx; } - atUint32 GetXRayFogMode() const override { return x27c_xrayFogMode; } - float GetXRayFogNearZ() const override { return x280_xrayFogNearZ; } - float GetXRayFogFarZ() const override { return x284_xrayFogFarZ; } - const zeus::CColor& GetXRayFogColor() const override { return x288_xrayFogColor; } - float GetThermalVisorLevel() const override { return x28c_thermalVisorLevel; } - const zeus::CColor& GetThermalVisorColor() const override { return x290_thermalVisorColor; } - const zeus::CColor& GetVisorHudLightAdd(int v) const override { return x294_hudLightAddPerVisor[v]; } - const zeus::CColor& GetVisorHudLightMultiply(int v) const override { return x2a4_hudLightMultiplyPerVisor[v]; } - const zeus::CColor& GetHudReflectivityLightColor() const override { return x2b4_hudReflectivityLightColor; } - float GetHudLightAttMulConstant() const override { return x2b8_hudLightAttMulConstant; } - float GetHudLightAttMulLinear() const override { return x2bc_hudLightAttMulLinear; } - float GetHudLightAttMulQuadratic() const override { return x2c0_hudLightAttMulQuadratic; } - std::string_view GetCreditsTable() const override { return x2d0_creditsTable; } - std::string_view GetCreditsFont() const override { return x2e0_creditsFont; } - std::string_view GetJapaneseCreditsFont() const override { return x2f0_japaneseCreditsFont; } - const zeus::CColor& GetCreditsTextFontColor() const override { return x300_; } - const zeus::CColor& GetCreditsTextBorderColor() const override { return x304_; } - - float GetScanSpeed(int idx) const override { - if (idx < 0 || size_t(idx) >= x2c4_scanSpeeds.size()) - return 0.f; - return x2c4_scanSpeeds[idx]; - } - - void FixupValues() { - xd8_ = zeus::degToRad(xd8_); - xdc_ = zeus::degToRad(xdc_); - - x200_ = zeus::CColor(x1f4_ * 0.25f, x1f8_ * 0.25f, x1fc_ * 0.25f, 1.f); - - x210_scanSidesAngle = zeus::degToRad(x210_scanSidesAngle); - x228_scanSidesEndTime = x220_scanSidesDuration + x224_scanSidesStartTime; - - if (x27c_xrayFogMode == 1) - x27c_xrayFogMode = 2; - else if (x27c_xrayFogMode == 2) - x27c_xrayFogMode = 4; - else if (x27c_xrayFogMode == 3) - x27c_xrayFogMode = 5; - else - x27c_xrayFogMode = 0; - - x84_hudDecoShakeTranslateVelConstant *= 2.0f; - } }; } // namespace DataSpec::DNAMP1 diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.cpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.cpp index e3fbea5c7..d16e5edaf 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.cpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.cpp @@ -1,261 +1,7 @@ -#include "CTweakPlayer.hpp" +#include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp" #include "zeus/Math.hpp" -#include -#include - -#define DEFINE_CVAR_GLOBAL(name) \ - constexpr std::string_view sk##name = std::string_view("tweak.player." #name); \ - hecl::CVar* tw_##name = nullptr; - -#define CREATE_CVAR(name, help, value, flags) \ - tw_##name = mgr->findOrMakeCVar(sk##name, help, value, flags); \ - if (tw_##name->wasDeserialized()) { \ - tw_##name->toValue(value); \ - } \ - tw_##name->addListener([this](hecl::CVar* cv) { _tweakListener(cv); }); - -#define CREATE_CVAR_BITFIELD(name, help, value, flags) \ - { \ - bool tmp = value; \ - CREATE_CVAR(name, help, tmp, flags) \ - } - -#define UPDATE_CVAR(name, cv, value) \ - if ((cv) == tw_##name) { \ - (cv)->toValue(value); \ - return; \ - } - -#define UPDATE_CVAR_BITFIELD(name, cv, value) \ - { \ - bool tmp = value; \ - UPDATE_CVAR(name, cv, tmp) \ - (value) = tmp; \ - } - namespace DataSpec::DNAMP1 { -namespace { -static constexpr hecl::CVar::EFlags skDefaultFlags = - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Cheat | hecl::CVar::EFlags::Archive; -DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationNormal); -DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationAir); -DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationIce); -DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationOrganic); -DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationWater); -DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationLava); -DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationPhazon); -DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationShrubbery); -DEFINE_CVAR_GLOBAL(MaxRotationAccelerationNormal); -DEFINE_CVAR_GLOBAL(MaxRotationAccelerationAir); -DEFINE_CVAR_GLOBAL(MaxRotationAccelerationIce); -DEFINE_CVAR_GLOBAL(MaxRotationAccelerationOrganic); -DEFINE_CVAR_GLOBAL(MaxRotationAccelerationWater); -DEFINE_CVAR_GLOBAL(MaxRotationAccelerationLava); -DEFINE_CVAR_GLOBAL(MaxRotationAccelerationPhazon); -DEFINE_CVAR_GLOBAL(MaxRotationAccelerationShrubbery); -DEFINE_CVAR_GLOBAL(TranslationFrictionNormal); -DEFINE_CVAR_GLOBAL(TranslationFrictionAir); -DEFINE_CVAR_GLOBAL(TranslationFrictionIce); -DEFINE_CVAR_GLOBAL(TranslationFrictionOrganic); -DEFINE_CVAR_GLOBAL(TranslationFrictionWater); -DEFINE_CVAR_GLOBAL(TranslationFrictionLava); -DEFINE_CVAR_GLOBAL(TranslationFrictionPhazon); -DEFINE_CVAR_GLOBAL(TranslationFrictionShrubbery); -DEFINE_CVAR_GLOBAL(RotationFrictionNormal); -DEFINE_CVAR_GLOBAL(RotationFrictionAir); -DEFINE_CVAR_GLOBAL(RotationFrictionIce); -DEFINE_CVAR_GLOBAL(RotationFrictionOrganic); -DEFINE_CVAR_GLOBAL(RotationFrictionWater); -DEFINE_CVAR_GLOBAL(RotationFrictionLava); -DEFINE_CVAR_GLOBAL(RotationFrictionPhazon); -DEFINE_CVAR_GLOBAL(RotationFrictionShrubbery); -DEFINE_CVAR_GLOBAL(RotationMaxSpeedNormal); -DEFINE_CVAR_GLOBAL(RotationMaxSpeedAir); -DEFINE_CVAR_GLOBAL(RotationMaxSpeedIce); -DEFINE_CVAR_GLOBAL(RotationMaxSpeedOrganic); -DEFINE_CVAR_GLOBAL(RotationMaxSpeedWater); -DEFINE_CVAR_GLOBAL(RotationMaxSpeedLava); -DEFINE_CVAR_GLOBAL(RotationMaxSpeedPhazon); -DEFINE_CVAR_GLOBAL(RotationMaxSpeedShrubbery); -DEFINE_CVAR_GLOBAL(TranslationMaxSpeedNormal); -DEFINE_CVAR_GLOBAL(TranslationMaxSpeedAir); -DEFINE_CVAR_GLOBAL(TranslationMaxSpeedIce); -DEFINE_CVAR_GLOBAL(TranslationMaxSpeedOrganic); -DEFINE_CVAR_GLOBAL(TranslationMaxSpeedWater); -DEFINE_CVAR_GLOBAL(TranslationMaxSpeedLava); -DEFINE_CVAR_GLOBAL(TranslationMaxSpeedPhazon); -DEFINE_CVAR_GLOBAL(TranslationMaxSpeedShrubbery); -DEFINE_CVAR_GLOBAL(NormalGravityAcceleration); -DEFINE_CVAR_GLOBAL(FluidGravityAcceleration); -DEFINE_CVAR_GLOBAL(VerticalJumpAcceleration); -DEFINE_CVAR_GLOBAL(HorizontalJumpAcceleration); -DEFINE_CVAR_GLOBAL(VerticalDoubleJumpAcceleration); -DEFINE_CVAR_GLOBAL(HorizontalDoubleJumpAcceleration); -DEFINE_CVAR_GLOBAL(WaterJumpFactor); -DEFINE_CVAR_GLOBAL(WaterBallJumpFactor); -DEFINE_CVAR_GLOBAL(LavaJumpFactor); -DEFINE_CVAR_GLOBAL(LavaBallJumpFactor); -DEFINE_CVAR_GLOBAL(PhazonJumpFactor); -DEFINE_CVAR_GLOBAL(PhazonBallJumpFactor); -DEFINE_CVAR_GLOBAL(AllowedJumpTime); -DEFINE_CVAR_GLOBAL(AllowedDoubleJumpTime); -DEFINE_CVAR_GLOBAL(MinDoubleJumpWindow); -DEFINE_CVAR_GLOBAL(MaxDoubleJumpWindow) -// DEFINE_CVAR_GLOBAL(); // x104_ -DEFINE_CVAR_GLOBAL(MinJumpTime); -DEFINE_CVAR_GLOBAL(MinDoubleJumpTime); -DEFINE_CVAR_GLOBAL(AllowedLedgeTime); -DEFINE_CVAR_GLOBAL(DoubleJumpImpulse); -DEFINE_CVAR_GLOBAL(BackwardsForceMultiplier); -DEFINE_CVAR_GLOBAL(BombJumpRadius); -DEFINE_CVAR_GLOBAL(BombJumpHeight); -DEFINE_CVAR_GLOBAL(EyeOffset); -DEFINE_CVAR_GLOBAL(TurnSpeedMultiplier); -DEFINE_CVAR_GLOBAL(FreeLookTurnSpeedMultiplier); -DEFINE_CVAR_GLOBAL(HorizontalFreeLookAngleVelocity); -DEFINE_CVAR_GLOBAL(VerticalFreeLookAngleVelocity); -DEFINE_CVAR_GLOBAL(FreeLookSpeed); -DEFINE_CVAR_GLOBAL(FreeLookSnapSpeed); -// DEFINE_CVAR_GLOBAL(); // x140_ -DEFINE_CVAR_GLOBAL(FreeLookCenteredThresholdAngle); -DEFINE_CVAR_GLOBAL(FreeLookCenteredTime); -DEFINE_CVAR_GLOBAL(FreeLookDampenFactor); -DEFINE_CVAR_GLOBAL(LeftDivisor); -DEFINE_CVAR_GLOBAL(RightDivisor); -DEFINE_CVAR_GLOBAL(OrbitMinDistanceClose); -DEFINE_CVAR_GLOBAL(OrbitMinDistanceFar); -DEFINE_CVAR_GLOBAL(OrbitMinDistanceDefault); -DEFINE_CVAR_GLOBAL(OrbitNormalDistanceClose); -DEFINE_CVAR_GLOBAL(OrbitNormalDistanceFar); -DEFINE_CVAR_GLOBAL(OrbitNormalDistanceDefault); -DEFINE_CVAR_GLOBAL(OrbitMaxDistanceClose); -DEFINE_CVAR_GLOBAL(OrbitMaxDistanceFar); -DEFINE_CVAR_GLOBAL(OrbitMaxDistanceDefault); -// DEFINE_CVAR_GLOBAL(); // x17c_ -DEFINE_CVAR_GLOBAL(OrbitmodeTimer); -DEFINE_CVAR_GLOBAL(OrbitCameraSpeed); -DEFINE_CVAR_GLOBAL(OrbitUpperAngle); -DEFINE_CVAR_GLOBAL(OrbitLowerAngle); -DEFINE_CVAR_GLOBAL(OrbitHorizontalAngle); -// DEFINE_CVAR_GLOBAL(); // x194_ -// DEFINE_CVAR_GLOBAL(); // x198_ -DEFINE_CVAR_GLOBAL(OrbitMaxTargetDistance); -DEFINE_CVAR_GLOBAL(OrbitMaxLockDistance); -DEFINE_CVAR_GLOBAL(OrbitDistanceThreshold); -DEFINE_CVAR_GLOBAL(OrbitScreenTargetingBoxHalfExtentX); -DEFINE_CVAR_GLOBAL(OrbitScreenScanBoxHalfExtentX); -DEFINE_CVAR_GLOBAL(OrbitScreenTargetingBoxHalfExtentY); -DEFINE_CVAR_GLOBAL(OrbitScreenScanBoxHalfExtentY); -DEFINE_CVAR_GLOBAL(OrbitScreenTargetingBoxCenterX); -DEFINE_CVAR_GLOBAL(OrbitScreenScanBoxCenterX); -DEFINE_CVAR_GLOBAL(OrbitScreenTargetingBoxCenterY); -DEFINE_CVAR_GLOBAL(OrbitScreenScanBoxCenterY); -DEFINE_CVAR_GLOBAL(OrbitZoneTargetingIdealX); -DEFINE_CVAR_GLOBAL(OrbitZoneScanIdealX); -DEFINE_CVAR_GLOBAL(OrbitZoneTargetingIdealY); -DEFINE_CVAR_GLOBAL(OrbitZoneScanIdealY); -DEFINE_CVAR_GLOBAL(OrbitNearX); -DEFINE_CVAR_GLOBAL(OrbitNearZ); -// DEFINE_CVAR_GLOBAL(); // x1e0_ -// DEFINE_CVAR_GLOBAL(); // x1e4_ -DEFINE_CVAR_GLOBAL(OrbitFixedOffsetZDiff); -DEFINE_CVAR_GLOBAL(OrbitZRange); -// DEFINE_CVAR_GLOBAL(); // x1f0_ -// DEFINE_CVAR_GLOBAL(); // x1f4_ -// DEFINE_CVAR_GLOBAL(); // x1f8_ -DEFINE_CVAR_GLOBAL(OrbitPreventionTime); -DEFINE_CVAR_GLOBAL(DashEnabled); -DEFINE_CVAR_GLOBAL(DashOnButtonRelease); -DEFINE_CVAR_GLOBAL(DashButtonHoldCancelTime); -DEFINE_CVAR_GLOBAL(DashStrafeInputThreshold); -DEFINE_CVAR_GLOBAL(SidewaysDoubleJumpImpulse); -DEFINE_CVAR_GLOBAL(SidewaysVerticalDoubleJumpAccel); -DEFINE_CVAR_GLOBAL(SidewaysHorizontalDoubleJumpAccel); -DEFINE_CVAR_GLOBAL(ScanningRange); -DEFINE_CVAR_GLOBAL(ScanRetention); -DEFINE_CVAR_GLOBAL(ScanFreezesGame); -DEFINE_CVAR_GLOBAL(OrbitWhileScanning); -DEFINE_CVAR_GLOBAL(ScanMaxTargetDistance); -DEFINE_CVAR_GLOBAL(ScanMaxLockDistance) -DEFINE_CVAR_GLOBAL(FreeLookTurnsPlayer); -// DEFINE_CVAR_GLOBAL(); // x228_25_ -// DEFINE_CVAR_GLOBAL(); // x228_26_ -DEFINE_CVAR_GLOBAL(MoveDuringFreelook); -DEFINE_CVAR_GLOBAL(HoldButtonsForFreeLook); -// DEFINE_CVAR_GLOBAL(); // x228_30_ -// DEFINE_CVAR_GLOBAL(); // x228_31_ -// DEFINE_CVAR_GLOBAL(); // x229_24_ -DEFINE_CVAR_GLOBAL(AimWhenOrbitingPoint); -DEFINE_CVAR_GLOBAL(StayInFreeLookWhileFiring); -// DEFINE_CVAR_GLOBAL(); // x229_27_ -// DEFINE_CVAR_GLOBAL(); // x229_28_ -DEFINE_CVAR_GLOBAL(OrbitFixedOffset); -DEFINE_CVAR_GLOBAL(GunButtonTogglesHolster); -DEFINE_CVAR_GLOBAL(GunNotFiringHolstersGun); -DEFINE_CVAR_GLOBAL(FallingDoubleJump); -DEFINE_CVAR_GLOBAL(ImpulseDoubleJump); -DEFINE_CVAR_GLOBAL(FiringCancelsCameraPitch); -DEFINE_CVAR_GLOBAL(AssistedAimingIgnoreHorizontal); -DEFINE_CVAR_GLOBAL(AssistedAimingIgnoreVertical); -// DEFINE_CVAR_GLOBAL(); // x22c -// DEFINE_CVAR_GLOBAL(); // x230_ -DEFINE_CVAR_GLOBAL(AimMaxDistance); -// DEFINE_CVAR_GLOBAL(); // x238_ -// DEFINE_CVAR_GLOBAL(); // x23c_ -// DEFINE_CVAR_GLOBAL(); // x240_ -// DEFINE_CVAR_GLOBAL(); // x244_ -// DEFINE_CVAR_GLOBAL(); // x248_ -DEFINE_CVAR_GLOBAL(AimThresholdDistance); -// DEFINE_CVAR_GLOBAL(); // x250_ -// DEFINE_CVAR_GLOBAL(); // x254_ -DEFINE_CVAR_GLOBAL(AimBoxWidth); -DEFINE_CVAR_GLOBAL(AimBoxHeight); -DEFINE_CVAR_GLOBAL(AimTargetTimer); -DEFINE_CVAR_GLOBAL(AimAssistHorizontalAngle); -DEFINE_CVAR_GLOBAL(AimAssistVerticalAngle); -DEFINE_CVAR_GLOBAL(PlayerHeight); -DEFINE_CVAR_GLOBAL(PlayerXYHalfExtent); -DEFINE_CVAR_GLOBAL(StepUpHeight); -DEFINE_CVAR_GLOBAL(StepDownHeight); -DEFINE_CVAR_GLOBAL(PlayerBallHalfExtent); -DEFINE_CVAR_GLOBAL(FirstPersonCameraSpeed); -// DEFINE_CVAR_GLOBAL(); // x284_ -DEFINE_CVAR_GLOBAL(JumpCameraPitchDownStart); -DEFINE_CVAR_GLOBAL(JumpCameraPitchDownFull); -DEFINE_CVAR_GLOBAL(JumpCameraPitchDownAngle); -DEFINE_CVAR_GLOBAL(FallCameraPitchDownStart); -DEFINE_CVAR_GLOBAL(FallCameraPitchDownFull); -DEFINE_CVAR_GLOBAL(FallCameraPitchDownAngle); -DEFINE_CVAR_GLOBAL(OrbitDistanceMax); -DEFINE_CVAR_GLOBAL(GrappleSwingLength); -DEFINE_CVAR_GLOBAL(GrappleSwingPeriod); -DEFINE_CVAR_GLOBAL(GrapplePullSpeedMin); -DEFINE_CVAR_GLOBAL(GrappleCameraSpeed); -DEFINE_CVAR_GLOBAL(MaxGrappleLockedTurnAlignDistance); -DEFINE_CVAR_GLOBAL(GrapplePullSpeedProportion); -DEFINE_CVAR_GLOBAL(GrapplePullSpeedMax); -DEFINE_CVAR_GLOBAL(GrappleLookCenterSpeed); -DEFINE_CVAR_GLOBAL(MaxGrappleTurnSpeed); -DEFINE_CVAR_GLOBAL(GrappleJumpForce); -DEFINE_CVAR_GLOBAL(GrappleReleaseTime); -DEFINE_CVAR_GLOBAL(GrappleJumpMode); -DEFINE_CVAR_GLOBAL(OrbitReleaseBreaksGrapple); -DEFINE_CVAR_GLOBAL(InvertGrappleTurn); -DEFINE_CVAR_GLOBAL(GrappleBeamSpeed); -DEFINE_CVAR_GLOBAL(GrappleBeamXWaveAmplitude); -DEFINE_CVAR_GLOBAL(GrappleBeamZWaveAmplitude); -DEFINE_CVAR_GLOBAL(GrappleBeamAnglePhaseDelta); -// DEFINE_CVAR_GLOBAL(); // x2e8_ -// DEFINE_CVAR_GLOBAL(); // x2ec_ -// DEFINE_CVAR_GLOBAL(); // x2f0_ -// DEFINE_CVAR_GLOBAL(); // x2f4_ -DEFINE_CVAR_GLOBAL(FrozenTimeout); -DEFINE_CVAR_GLOBAL(IceBreakJumpCount); -DEFINE_CVAR_GLOBAL(VariaDamageReduction); -DEFINE_CVAR_GLOBAL(GravityDamageReduction); -DEFINE_CVAR_GLOBAL(PhazonDamageReduction); -} // namespace template <> void CTweakPlayer::Enumerate(athena::io::IStreamReader& __dna_reader) { /* x4_maxTranslationalAcceleration[0] */ @@ -2121,536 +1867,9 @@ void CTweakPlayer::Enumerate(athena::io::YAMLDocWriter& __dna __dna_docout.writeFloat("x308_phazonDamageReduction", x308_phazonDamageReduction); } -void CTweakPlayer::FixupValues() { - x130_horizontalFreeLookAngleVel = zeus::degToRad(x130_horizontalFreeLookAngleVel); - x134_verticalFreeLookAngleVel = zeus::degToRad(x134_verticalFreeLookAngleVel); - x138_freeLookSpeed = zeus::degToRad(x138_freeLookSpeed); - x13c_freeLookSnapSpeed = zeus::degToRad(x13c_freeLookSnapSpeed); - x140_ = zeus::degToRad(x140_); - x144_freeLookCenteredThresholdAngle = zeus::degToRad(x144_freeLookCenteredThresholdAngle); - x23c_ = zeus::degToRad(x23c_); - x240_ = zeus::degToRad(x240_); - x244_ = zeus::degToRad(x244_); - x248_ = zeus::degToRad(x248_); - x250_ = zeus::degToRad(x250_); - x264_aimAssistHorizontalAngle = zeus::degToRad(x264_aimAssistHorizontalAngle); - x268_aimAssistVerticalAngle = zeus::degToRad(x268_aimAssistVerticalAngle); - x17c_ = zeus::degToRad(x17c_); - x184_orbitCameraSpeed = zeus::degToRad(x184_orbitCameraSpeed); - x188_orbitUpperAngle = zeus::degToRad(x188_orbitUpperAngle); - x18c_orbitLowerAngle = zeus::degToRad(x18c_orbitLowerAngle); - x190_orbitHorizAngle = zeus::degToRad(x190_orbitHorizAngle); - x194_ = zeus::degToRad(x194_); - x198_ = zeus::degToRad(x198_); - x1f0_ = zeus::degToRad(x1f0_); - x1f4_ = zeus::degToRad(x1f4_); - x2b0_grappleCameraSpeed = zeus::degToRad(x2b0_grappleCameraSpeed); - x2c0_grappleLookCenterSpeed = zeus::degToRad(x2c0_grappleLookCenterSpeed); - x280_firstPersonCameraSpeed = zeus::degToRad(x280_firstPersonCameraSpeed); - x284_ = zeus::degToRad(x284_); - x290_jumpCameraPitchDownAngle = zeus::degToRad(x290_jumpCameraPitchDownAngle); - x29c_fallCameraPitchDownAngle = zeus::degToRad(x29c_fallCameraPitchDownAngle); -} - std::string_view CTweakPlayer::DNAType() { return "DataSpec::DNAMP1::CTweakPlayer"sv; } template <> void CTweakPlayer::Enumerate(size_t& __isz) { __isz += 785; } - -void CTweakPlayer::_tweakListener(hecl::CVar* cv) { - UPDATE_CVAR(MaxTranslationAccelerationNormal, cv, x4_maxTranslationalAcceleration[0]); - UPDATE_CVAR(MaxTranslationAccelerationAir, cv, x4_maxTranslationalAcceleration[1]); - UPDATE_CVAR(MaxTranslationAccelerationIce, cv, x4_maxTranslationalAcceleration[2]); - UPDATE_CVAR(MaxTranslationAccelerationOrganic, cv, x4_maxTranslationalAcceleration[3]); - UPDATE_CVAR(MaxTranslationAccelerationWater, cv, x4_maxTranslationalAcceleration[4]); - UPDATE_CVAR(MaxTranslationAccelerationLava, cv, x4_maxTranslationalAcceleration[5]); - UPDATE_CVAR(MaxTranslationAccelerationPhazon, cv, x4_maxTranslationalAcceleration[6]); - UPDATE_CVAR(MaxRotationAccelerationShrubbery, cv, x24_maxRotationalAcceleration[7]); - UPDATE_CVAR(MaxRotationAccelerationNormal, cv, x24_maxRotationalAcceleration[0]); - UPDATE_CVAR(MaxRotationAccelerationAir, cv, x24_maxRotationalAcceleration[1]); - UPDATE_CVAR(MaxRotationAccelerationIce, cv, x24_maxRotationalAcceleration[2]); - UPDATE_CVAR(MaxRotationAccelerationOrganic, cv, x24_maxRotationalAcceleration[3]); - UPDATE_CVAR(MaxRotationAccelerationWater, cv, x24_maxRotationalAcceleration[4]); - UPDATE_CVAR(MaxRotationAccelerationLava, cv, x24_maxRotationalAcceleration[5]); - UPDATE_CVAR(MaxRotationAccelerationPhazon, cv, x24_maxRotationalAcceleration[6]); - UPDATE_CVAR(MaxRotationAccelerationShrubbery, cv, x24_maxRotationalAcceleration[7]); - UPDATE_CVAR(TranslationFrictionNormal, cv, x44_translationFriction[0]); - UPDATE_CVAR(TranslationFrictionAir, cv, x44_translationFriction[1]); - UPDATE_CVAR(TranslationFrictionIce, cv, x44_translationFriction[2]); - UPDATE_CVAR(TranslationFrictionOrganic, cv, x44_translationFriction[3]); - UPDATE_CVAR(TranslationFrictionWater, cv, x44_translationFriction[4]); - UPDATE_CVAR(TranslationFrictionLava, cv, x44_translationFriction[5]); - UPDATE_CVAR(TranslationFrictionPhazon, cv, x44_translationFriction[6]); - UPDATE_CVAR(TranslationFrictionShrubbery, cv, x44_translationFriction[7]); - UPDATE_CVAR(RotationFrictionNormal, cv, x44_translationFriction[2]); - UPDATE_CVAR(RotationFrictionIce, cv, x44_translationFriction[2]); - UPDATE_CVAR(RotationFrictionOrganic, cv, x44_translationFriction[3]); - UPDATE_CVAR(RotationFrictionWater, cv, x44_translationFriction[4]); - UPDATE_CVAR(RotationFrictionLava, cv, x44_translationFriction[5]); - UPDATE_CVAR(RotationFrictionPhazon, cv, x44_translationFriction[6]); - UPDATE_CVAR(RotationFrictionShrubbery, cv, x44_translationFriction[7]); - UPDATE_CVAR(RotationMaxSpeedNormal, cv, x84_rotationMaxSpeed[2]); - UPDATE_CVAR(RotationMaxSpeedIce, cv, x84_rotationMaxSpeed[2]); - UPDATE_CVAR(RotationMaxSpeedOrganic, cv, x84_rotationMaxSpeed[3]); - UPDATE_CVAR(RotationMaxSpeedWater, cv, x84_rotationMaxSpeed[4]); - UPDATE_CVAR(RotationMaxSpeedLava, cv, x84_rotationMaxSpeed[5]); - UPDATE_CVAR(RotationMaxSpeedPhazon, cv, x84_rotationMaxSpeed[6]); - UPDATE_CVAR(RotationMaxSpeedShrubbery, cv, x84_rotationMaxSpeed[7]); - UPDATE_CVAR(TranslationMaxSpeedNormal, cv, xa4_translationMaxSpeed[2]); - UPDATE_CVAR(TranslationMaxSpeedIce, cv, xa4_translationMaxSpeed[2]); - UPDATE_CVAR(TranslationMaxSpeedOrganic, cv, xa4_translationMaxSpeed[3]); - UPDATE_CVAR(TranslationMaxSpeedWater, cv, xa4_translationMaxSpeed[4]); - UPDATE_CVAR(TranslationMaxSpeedLava, cv, xa4_translationMaxSpeed[5]); - UPDATE_CVAR(TranslationMaxSpeedPhazon, cv, xa4_translationMaxSpeed[6]); - UPDATE_CVAR(TranslationMaxSpeedShrubbery, cv, xa4_translationMaxSpeed[7]); - UPDATE_CVAR(NormalGravityAcceleration, cv, xc4_normalGravAccel); - UPDATE_CVAR(FluidGravityAcceleration, cv, xc8_fluidGravAccel); - UPDATE_CVAR(VerticalJumpAcceleration, cv, xcc_verticalJumpAccel); - UPDATE_CVAR(HorizontalJumpAcceleration, cv, xd0_horizontalJumpAccel); - UPDATE_CVAR(VerticalDoubleJumpAcceleration, cv, xd4_verticalDoubleJumpAccel); - UPDATE_CVAR(HorizontalDoubleJumpAcceleration, cv, xd8_horizontalDoubleJumpAccel); - UPDATE_CVAR(WaterJumpFactor, cv, xdc_waterJumpFactor); - UPDATE_CVAR(WaterBallJumpFactor, cv, xe0_waterBallJumpFactor); - UPDATE_CVAR(LavaJumpFactor, cv, xe4_lavaJumpFactor); - UPDATE_CVAR(LavaBallJumpFactor, cv, xe8_lavaBallJumpFactor); - UPDATE_CVAR(PhazonJumpFactor, cv, xec_phazonJumpFactor); - UPDATE_CVAR(PhazonBallJumpFactor, cv, xf0_phazonBallJumpFactor); - UPDATE_CVAR(AllowedJumpTime, cv, xf4_allowedJumpTime); - UPDATE_CVAR(AllowedDoubleJumpTime, cv, xf8_allowedDoubleJumpTime); - UPDATE_CVAR(MinDoubleJumpWindow, cv, xfc_minDoubleJumpWindow); - UPDATE_CVAR(MaxDoubleJumpWindow, cv, x100_maxDoubleJumpWindow); - // UPDATE_CVAR(); // x104_ - UPDATE_CVAR(MinJumpTime, cv, x108_minJumpTime); - UPDATE_CVAR(MinDoubleJumpTime, cv, x10c_minDoubleJumpTime); - UPDATE_CVAR(AllowedLedgeTime, cv, x110_allowedLedgeTime); - UPDATE_CVAR(DoubleJumpImpulse, cv, x114_doubleJumpImpulse); - UPDATE_CVAR(BackwardsForceMultiplier, cv, x118_backwardsForceMultiplier); - UPDATE_CVAR(BombJumpRadius, cv, x11c_bombJumpRadius); - UPDATE_CVAR(BombJumpHeight, cv, x120_bombJumpHeight); - UPDATE_CVAR(EyeOffset, cv, x124_eyeOffset); - UPDATE_CVAR(TurnSpeedMultiplier, cv, x128_turnSpeedMultiplier); - UPDATE_CVAR(FreeLookTurnSpeedMultiplier, cv, x12c_freeLookTurnSpeedMultiplier); - UPDATE_CVAR(HorizontalFreeLookAngleVelocity, cv, x130_horizontalFreeLookAngleVel); - UPDATE_CVAR(VerticalFreeLookAngleVelocity, cv, x134_verticalFreeLookAngleVel); - UPDATE_CVAR(FreeLookSpeed, cv, x138_freeLookSpeed); - UPDATE_CVAR(FreeLookSnapSpeed, cv, x13c_freeLookSnapSpeed); - // UPDATE_CVAR(); // x140_ - UPDATE_CVAR(FreeLookCenteredThresholdAngle, cv, x144_freeLookCenteredThresholdAngle); - UPDATE_CVAR(FreeLookCenteredTime, cv, x148_freeLookCenteredTime); - UPDATE_CVAR(FreeLookDampenFactor, cv, x14c_freeLookDampenFactor); - UPDATE_CVAR(LeftDivisor, cv, x150_leftDiv); - UPDATE_CVAR(RightDivisor, cv, x154_rightDiv); - UPDATE_CVAR(OrbitMinDistanceClose, cv, x158_orbitMinDistance[0]); - UPDATE_CVAR(OrbitMinDistanceFar, cv, x158_orbitMinDistance[1]); - UPDATE_CVAR(OrbitMinDistanceDefault, cv, x158_orbitMinDistance[2]); - UPDATE_CVAR(OrbitNormalDistanceClose, cv, x164_orbitNormalDistance[0]); - UPDATE_CVAR(OrbitNormalDistanceFar, cv, x164_orbitNormalDistance[1]); - UPDATE_CVAR(OrbitNormalDistanceDefault, cv, x164_orbitNormalDistance[2]); - UPDATE_CVAR(OrbitMaxDistanceClose, cv, x170_orbitMaxDistance[0]); - UPDATE_CVAR(OrbitMaxDistanceFar, cv, x170_orbitMaxDistance[1]); - UPDATE_CVAR(OrbitMaxDistanceDefault, cv, x170_orbitMaxDistance[2]); - // UPDATE_CVAR(); // x17c_ - UPDATE_CVAR(OrbitmodeTimer, cv, x180_orbitModeTimer); - UPDATE_CVAR(OrbitCameraSpeed, cv, x184_orbitCameraSpeed); - UPDATE_CVAR(OrbitUpperAngle, cv, x188_orbitUpperAngle); - UPDATE_CVAR(OrbitLowerAngle, cv, x18c_orbitLowerAngle); - UPDATE_CVAR(OrbitHorizontalAngle, cv, x190_orbitHorizAngle); - // UPDATE_CVAR(); // x194_ - // UPDATE_CVAR(); // x198_ - UPDATE_CVAR(OrbitMaxTargetDistance, cv, x19c_orbitMaxTargetDistance); - UPDATE_CVAR(OrbitMaxLockDistance, cv, x1a0_orbitMaxLockDistance); - UPDATE_CVAR(OrbitDistanceThreshold, cv, x1a4_orbitDistanceThreshold); - UPDATE_CVAR(OrbitScreenTargetingBoxHalfExtentX, cv, x1a8_orbitScreenBoxHalfExtentX[0]); - UPDATE_CVAR(OrbitScreenScanBoxHalfExtentX, cv, x1a8_orbitScreenBoxHalfExtentX[1]); - UPDATE_CVAR(OrbitScreenTargetingBoxHalfExtentY, cv, x1b0_orbitScreenBoxHalfExtentY[0]); - UPDATE_CVAR(OrbitScreenScanBoxHalfExtentY, cv, x1b0_orbitScreenBoxHalfExtentY[1]); - UPDATE_CVAR(OrbitScreenTargetingBoxCenterX, cv, x1b8_orbitScreenBoxCenterX[0]); - UPDATE_CVAR(OrbitScreenScanBoxCenterX, cv, x1b8_orbitScreenBoxCenterX[1]); - UPDATE_CVAR(OrbitScreenTargetingBoxCenterY, cv, x1c0_orbitScreenBoxCenterY[0]); - UPDATE_CVAR(OrbitScreenScanBoxCenterY, cv, x1c0_orbitScreenBoxCenterY[1]); - UPDATE_CVAR(OrbitZoneTargetingIdealX, cv, x1c8_orbitZoneIdealX[0]); - UPDATE_CVAR(OrbitZoneScanIdealX, cv, x1c8_orbitZoneIdealX[1]); - UPDATE_CVAR(OrbitZoneTargetingIdealY, cv, x1d0_orbitZoneIdealY[0]); - UPDATE_CVAR(OrbitZoneScanIdealY, cv, x1d0_orbitZoneIdealY[1]); - UPDATE_CVAR(OrbitNearX, cv, x1d8_orbitNearX); - UPDATE_CVAR(OrbitNearZ, cv, x1dc_orbitNearZ); - // UPDATE_CVAR(); // x1e0_ - // UPDATE_CVAR(); // x1e4_ - UPDATE_CVAR(OrbitFixedOffsetZDiff, cv, x1e8_orbitFixedOffsetZDiff); - UPDATE_CVAR(OrbitZRange, cv, x1ec_orbitZRange); - // UPDATE_CVAR(); // x1f0_ - // UPDATE_CVAR(); // x1f4_ - // UPDATE_CVAR(); // x1f8_ - UPDATE_CVAR(OrbitPreventionTime, cv, x1fc_orbitPreventionTime); - UPDATE_CVAR_BITFIELD(DashEnabled, cv, x200_24_dashEnabled); - UPDATE_CVAR_BITFIELD(DashOnButtonRelease, cv, x200_25_dashOnButtonRelease); - UPDATE_CVAR(DashButtonHoldCancelTime, cv, x204_dashButtonHoldCancelTime); - UPDATE_CVAR(DashStrafeInputThreshold, cv, x208_dashStrafeInputThreshold); - UPDATE_CVAR(SidewaysDoubleJumpImpulse, cv, x20c_sidewaysDoubleJumpImpulse); - UPDATE_CVAR(SidewaysVerticalDoubleJumpAccel, cv, x210_sidewaysVerticalDoubleJumpAccel); - UPDATE_CVAR(SidewaysHorizontalDoubleJumpAccel, cv, x214_sidewaysHorizontalDoubleJumpAccel); - UPDATE_CVAR(ScanningRange, cv, x218_scanningRange); - UPDATE_CVAR_BITFIELD(ScanRetention, cv, x21c_24_scanRetention); - UPDATE_CVAR_BITFIELD(ScanFreezesGame, cv, x21c_25_scanFreezesGame); - UPDATE_CVAR_BITFIELD(OrbitWhileScanning, cv, x21c_26_orbitWhileScanning); - UPDATE_CVAR(ScanMaxTargetDistance, cv, x220_scanMaxTargetDistance); - UPDATE_CVAR(ScanMaxLockDistance, cv, x224_scanMaxLockDistance); - UPDATE_CVAR_BITFIELD(FreeLookTurnsPlayer, cv, x228_24_freelookTurnsPlayer); - // UPDATE_CVAR_BITFIELD(); // x228_25_ - // UPDATE_CVAR_BITFIELD(); // x228_26_ - UPDATE_CVAR_BITFIELD(MoveDuringFreelook, cv, x228_27_moveDuringFreeLook); - UPDATE_CVAR_BITFIELD(HoldButtonsForFreeLook, cv, x228_28_holdButtonsForFreeLook); - // UPDATE_CVAR_BITFIELD(); // x228_30_ - // UPDATE_CVAR_BITFIELD(); // x228_31_ - // UPDATE_CVAR_BITFIELD(); // x229_24_ - UPDATE_CVAR_BITFIELD(AimWhenOrbitingPoint, cv, x229_25_aimWhenOrbitingPoint); - UPDATE_CVAR_BITFIELD(StayInFreeLookWhileFiring, cv, x229_26_stayInFreeLookWhileFiring); - // UPDATE_CVAR_BITFIELD(); // x229_27_ - // UPDATE_CVAR_BITFIELD(); // x229_28_ - UPDATE_CVAR_BITFIELD(OrbitFixedOffset, cv, x229_29_orbitFixedOffset); - UPDATE_CVAR_BITFIELD(GunButtonTogglesHolster, cv, x229_30_gunButtonTogglesHolster); - UPDATE_CVAR_BITFIELD(GunNotFiringHolstersGun, cv, x229_31_gunNotFiringHolstersGun); - UPDATE_CVAR_BITFIELD(FallingDoubleJump, cv, x22a_24_fallingDoubleJump); - UPDATE_CVAR_BITFIELD(ImpulseDoubleJump, cv, x22a_25_impulseDoubleJump); - UPDATE_CVAR_BITFIELD(FiringCancelsCameraPitch, cv, x22a_26_firingCancelsCameraPitch); - UPDATE_CVAR_BITFIELD(AssistedAimingIgnoreHorizontal, cv, x22a_27_assistedAimingIgnoreHorizontal); - UPDATE_CVAR_BITFIELD(AssistedAimingIgnoreVertical, cv, x22a_28_assistedAimingIgnoreVertical); - // UPDATE_CVAR(); // x22c - // UPDATE_CVAR(); // x230_ - UPDATE_CVAR(AimMaxDistance, cv, x234_aimMaxDistance); - // UPDATE_CVAR(); // x238_ - // UPDATE_CVAR(); // x23c_ - // UPDATE_CVAR(); // x240_ - // UPDATE_CVAR(); // x244_ - // UPDATE_CVAR(); // x248_ - UPDATE_CVAR(AimThresholdDistance, cv, x24c_aimThresholdDistance); - // UPDATE_CVAR(); // x250_ - // UPDATE_CVAR(); // x254_ - UPDATE_CVAR(AimBoxWidth, cv, x258_aimBoxWidth); - UPDATE_CVAR(AimBoxHeight, cv, x25c_aimBoxHeight); - UPDATE_CVAR(AimTargetTimer, cv, x260_aimTargetTimer); - UPDATE_CVAR(AimAssistHorizontalAngle, cv, x264_aimAssistHorizontalAngle); - UPDATE_CVAR(AimAssistVerticalAngle, cv, x268_aimAssistVerticalAngle); - UPDATE_CVAR(PlayerHeight, cv, x26c_playerHeight); - UPDATE_CVAR(PlayerXYHalfExtent, cv, x270_playerXYHalfExtent); - UPDATE_CVAR(StepUpHeight, cv, x274_stepUpHeight); - UPDATE_CVAR(StepDownHeight, cv, x278_stepDownHeight); - UPDATE_CVAR(PlayerBallHalfExtent, cv, x27c_playerBallHalfExtent); - UPDATE_CVAR(FirstPersonCameraSpeed, cv, x280_firstPersonCameraSpeed); - // UPDATE_CVAR(); // x284_ - UPDATE_CVAR(JumpCameraPitchDownStart, cv, x288_jumpCameraPitchDownStart); - UPDATE_CVAR(JumpCameraPitchDownFull, cv, x28c_jumpCameraPitchDownFull); - UPDATE_CVAR(JumpCameraPitchDownAngle, cv, x290_jumpCameraPitchDownAngle); - UPDATE_CVAR(FallCameraPitchDownStart, cv, x294_fallCameraPitchDownStart); - UPDATE_CVAR(FallCameraPitchDownFull, cv, x298_fallCameraPitchDownFull); - UPDATE_CVAR(FallCameraPitchDownAngle, cv, x29c_fallCameraPitchDownAngle); - UPDATE_CVAR(OrbitDistanceMax, cv, x2a0_orbitDistanceMax); - UPDATE_CVAR(GrappleSwingLength, cv, x2a4_grappleSwingLength); - UPDATE_CVAR(GrappleSwingPeriod, cv, x2a8_grappleSwingPeriod); - UPDATE_CVAR(GrapplePullSpeedMin, cv, x2ac_grapplePullSpeedMin); - UPDATE_CVAR(GrappleCameraSpeed, cv, x2b0_grappleCameraSpeed); - UPDATE_CVAR(MaxGrappleLockedTurnAlignDistance, cv, x2b4_maxGrappleLockedTurnAlignDistance); - UPDATE_CVAR(GrapplePullSpeedProportion, cv, x2b8_grapplePullSpeedProportion); - UPDATE_CVAR(GrapplePullSpeedMax, cv, x2bc_grapplePullSpeedMax); - UPDATE_CVAR(GrappleLookCenterSpeed, cv, x2c0_grappleLookCenterSpeed); - UPDATE_CVAR(MaxGrappleTurnSpeed, cv, x2c4_maxGrappleTurnSpeed); - UPDATE_CVAR(GrappleJumpForce, cv, x2c8_grappleJumpForce); - UPDATE_CVAR(GrappleReleaseTime, cv, x2cc_grappleReleaseTime); - UPDATE_CVAR(GrappleJumpMode, cv, x2d0_grappleJumpMode); - UPDATE_CVAR(OrbitReleaseBreaksGrapple, cv, x2d4_orbitReleaseBreaksGrapple); - UPDATE_CVAR(InvertGrappleTurn, cv, x2d5_invertGrappleTurn); - UPDATE_CVAR(GrappleBeamSpeed, cv, x2d8_grappleBeamSpeed); - UPDATE_CVAR(GrappleBeamXWaveAmplitude, cv, x2dc_grappleBeamXWaveAmplitude); - UPDATE_CVAR(GrappleBeamZWaveAmplitude, cv, x2e0_grappleBeamZWaveAmplitude); - UPDATE_CVAR(GrappleBeamAnglePhaseDelta, cv, x2e4_grappleBeamAnglePhaseDelta); - // UPDATE_CVAR(); // x2e8_ - // UPDATE_CVAR(); // x2ec_ - // UPDATE_CVAR(); // x2f0_ - // UPDATE_CVAR(); // x2f4_ - UPDATE_CVAR(FrozenTimeout, cv, x2f8_frozenTimeout); - UPDATE_CVAR(IceBreakJumpCount, cv, x2fc_iceBreakJumpCount); - UPDATE_CVAR(VariaDamageReduction, cv, x300_variaDamageReduction); - UPDATE_CVAR(GravityDamageReduction, cv, x304_gravityDamageReduction); - UPDATE_CVAR(PhazonDamageReduction, cv, x308_phazonDamageReduction); -} - -void CTweakPlayer::initCVars(hecl::CVarManager* mgr) { - CREATE_CVAR(MaxTranslationAccelerationNormal, - "Max translation acceleration allowed to the player under normal circumstances", - x4_maxTranslationalAcceleration[0], skDefaultFlags); - CREATE_CVAR(MaxTranslationAccelerationAir, "Max translation acceleration allowed to the player while in air", - x4_maxTranslationalAcceleration[1], skDefaultFlags); - CREATE_CVAR(MaxTranslationAccelerationIce, "Max translation acceleration allowed to the player while on ice surfaces", - x4_maxTranslationalAcceleration[2], skDefaultFlags); - CREATE_CVAR(MaxTranslationAccelerationOrganic, - "Max translation acceleration allowed to the player while on organic surfaces", - x4_maxTranslationalAcceleration[3], skDefaultFlags); - CREATE_CVAR(MaxTranslationAccelerationWater, "Max translation acceleration allowed to the player while in water", - x4_maxTranslationalAcceleration[4], skDefaultFlags); - CREATE_CVAR(MaxTranslationAccelerationLava, "Max translation acceleration allowed to the player while in lava", - x4_maxTranslationalAcceleration[5], skDefaultFlags); - CREATE_CVAR(MaxTranslationAccelerationPhazon, "Max translation acceleration allowed to the player while in phazon", - x4_maxTranslationalAcceleration[6], skDefaultFlags); - CREATE_CVAR(MaxTranslationAccelerationShrubbery, - "Max translation acceleration allowed to the player while in shrubbery", - x4_maxTranslationalAcceleration[7], skDefaultFlags); - CREATE_CVAR(MaxRotationAccelerationNormal, - "Max rotation acceleration allowed to the player under normal circumstances", - x24_maxRotationalAcceleration[0], skDefaultFlags); - CREATE_CVAR(MaxRotationAccelerationAir, "Max rotation acceleration allowed to the player while in air", - x24_maxRotationalAcceleration[1], skDefaultFlags); - CREATE_CVAR(MaxRotationAccelerationIce, "Max rotation acceleration allowed to the player while on ice surfaces", - x24_maxRotationalAcceleration[2], skDefaultFlags); - CREATE_CVAR(MaxRotationAccelerationOrganic, - "Max rotation acceleration allowed to the player while on organic surfaces", - x24_maxRotationalAcceleration[3], skDefaultFlags); - CREATE_CVAR(MaxRotationAccelerationWater, "Max rotation acceleration allowed to the player while in water", - x24_maxRotationalAcceleration[4], skDefaultFlags); - CREATE_CVAR(MaxRotationAccelerationLava, "Max rotation acceleration allowed to the player while in lava", - x24_maxRotationalAcceleration[5], skDefaultFlags); - CREATE_CVAR(MaxRotationAccelerationPhazon, "Max rotation acceleration allowed to the player while in phazon", - x24_maxRotationalAcceleration[6], skDefaultFlags); - CREATE_CVAR(MaxRotationAccelerationShrubbery, "Max rotation acceleration allowed to the player while in shrubbery", - x24_maxRotationalAcceleration[7], skDefaultFlags); - CREATE_CVAR(TranslationFrictionNormal, "Translation friction allowed to the player under normal circumstances", - x44_translationFriction[0], skDefaultFlags); - CREATE_CVAR(TranslationFrictionAir, "Translation friction allowed to the player while in air", - x44_translationFriction[1], skDefaultFlags); - CREATE_CVAR(TranslationFrictionIce, "Translation friction allowed to the player while on ice surfaces", - x44_translationFriction[2], skDefaultFlags); - CREATE_CVAR(TranslationFrictionOrganic, "Translation friction allowed to the player while on organic surfaces", - x44_translationFriction[3], skDefaultFlags); - CREATE_CVAR(TranslationFrictionWater, "Translation friction allowed to the player while in water", - x44_translationFriction[4], skDefaultFlags); - CREATE_CVAR(TranslationFrictionLava, "Translation friction allowed to the player while in lava", - x44_translationFriction[5], skDefaultFlags); - CREATE_CVAR(TranslationFrictionPhazon, "Translation friction allowed to the player while in phazon", - x44_translationFriction[6], skDefaultFlags); - CREATE_CVAR(TranslationFrictionShrubbery, "Translation friction allowed to the player while in shrubbery", - x44_translationFriction[7], skDefaultFlags); - CREATE_CVAR(RotationFrictionNormal, "Rotation friction allowed to the player under normal circumstances", - x44_translationFriction[0], skDefaultFlags); - CREATE_CVAR(RotationFrictionAir, "Rotation friction allowed to the player while in air", x44_translationFriction[1], - skDefaultFlags); - CREATE_CVAR(RotationFrictionIce, "Rotation friction allowed to the player while on ice surfaces", - x44_translationFriction[2], skDefaultFlags); - CREATE_CVAR(RotationFrictionOrganic, "Rotation friction allowed to the player while on organic surfaces", - x44_translationFriction[3], skDefaultFlags); - CREATE_CVAR(RotationFrictionWater, "Rotation friction allowed to the player while in water", - x44_translationFriction[4], skDefaultFlags); - CREATE_CVAR(RotationFrictionLava, "Rotation friction allowed to the player while in lava", x44_translationFriction[5], - skDefaultFlags); - CREATE_CVAR(RotationFrictionPhazon, "Rotation friction allowed to the player while in phazon", - x44_translationFriction[6], skDefaultFlags); - CREATE_CVAR(RotationFrictionShrubbery, "Rotation friction allowed to the player while in shrubbery", - x44_translationFriction[7], skDefaultFlags); - CREATE_CVAR(RotationMaxSpeedNormal, "Rotation max speed allowed to the player under normal circumstances", - x84_rotationMaxSpeed[0], skDefaultFlags); - CREATE_CVAR(RotationMaxSpeedAir, "Rotation max speed allowed to the player while in air", x84_rotationMaxSpeed[1], - skDefaultFlags); - CREATE_CVAR(RotationMaxSpeedIce, "Rotation max speed allowed to the player while on ice surfaces", - x84_rotationMaxSpeed[2], skDefaultFlags); - CREATE_CVAR(RotationMaxSpeedOrganic, "Rotation max speed allowed to the player while on organic surfaces", - x84_rotationMaxSpeed[3], skDefaultFlags); - CREATE_CVAR(RotationMaxSpeedWater, "Rotation max speed allowed to the player while in water", x84_rotationMaxSpeed[4], - skDefaultFlags); - CREATE_CVAR(RotationMaxSpeedLava, "Rotation max speed allowed to the player while in lava", x84_rotationMaxSpeed[5], - skDefaultFlags); - CREATE_CVAR(RotationMaxSpeedPhazon, "Rotation max speed allowed to the player while in phazon", - x84_rotationMaxSpeed[6], skDefaultFlags); - CREATE_CVAR(RotationMaxSpeedShrubbery, "Rotation max speed allowed to the player while in shrubbery", - x84_rotationMaxSpeed[7], skDefaultFlags); - CREATE_CVAR(TranslationMaxSpeedNormal, "Translation max speed allowed to the player under normal circumstances", - xa4_translationMaxSpeed[0], skDefaultFlags); - CREATE_CVAR(TranslationMaxSpeedNormal, "Translation max speed allowed to the player under normal circumstances", - xa4_translationMaxSpeed[1], skDefaultFlags); - CREATE_CVAR(TranslationMaxSpeedIce, "Translation max speed allowed to the player while on ice surfaces", - xa4_translationMaxSpeed[2], skDefaultFlags); - CREATE_CVAR(TranslationMaxSpeedOrganic, "Translation max speed allowed to the player while on organic surfaces", - xa4_translationMaxSpeed[3], skDefaultFlags); - CREATE_CVAR(TranslationMaxSpeedWater, "Translation max speed allowed to the player while in water", - xa4_translationMaxSpeed[4], skDefaultFlags); - CREATE_CVAR(TranslationMaxSpeedLava, "Translation max speed allowed to the player while in lava", - xa4_translationMaxSpeed[5], skDefaultFlags); - CREATE_CVAR(TranslationMaxSpeedPhazon, "Translation max speed allowed to the player while in phazon", - xa4_translationMaxSpeed[6], skDefaultFlags); - CREATE_CVAR(TranslationMaxSpeedShrubbery, "Translation max speed allowed to the player while in shrubbery", - xa4_translationMaxSpeed[7], skDefaultFlags); - CREATE_CVAR(NormalGravityAcceleration, "Gravity applied to the player under normal circumstances", - xc4_normalGravAccel, skDefaultFlags); - CREATE_CVAR(FluidGravityAcceleration, "Gravity applied to the player while in water", xc8_fluidGravAccel, - skDefaultFlags); - CREATE_CVAR(VerticalJumpAcceleration, "Vertical acceleration applied while jumping", xcc_verticalJumpAccel, - skDefaultFlags); - CREATE_CVAR(HorizontalJumpAcceleration, "Horizontal acceleration while jumping", xd0_horizontalJumpAccel, - skDefaultFlags); - CREATE_CVAR(VerticalDoubleJumpAcceleration, "Vertical acceleration while double jumping", xd4_verticalDoubleJumpAccel, - skDefaultFlags); - CREATE_CVAR(HorizontalDoubleJumpAcceleration, "Horizontal acceleration while double jumping", - xd8_horizontalDoubleJumpAccel, skDefaultFlags); - CREATE_CVAR(WaterJumpFactor, "Jump Factor while in water", xdc_waterJumpFactor, skDefaultFlags); - CREATE_CVAR(WaterBallJumpFactor, "Jump Factor while morphed in water", xe0_waterBallJumpFactor, skDefaultFlags); - CREATE_CVAR(LavaJumpFactor, "Jump Factor while in lava", xe4_lavaJumpFactor, skDefaultFlags); - CREATE_CVAR(LavaBallJumpFactor, "Jump Factor while morphed in lava", xe8_lavaBallJumpFactor, skDefaultFlags); - CREATE_CVAR(PhazonJumpFactor, "Jump Factor while in phazon", xec_phazonJumpFactor, skDefaultFlags); - CREATE_CVAR(PhazonBallJumpFactor, "Jump Factor while morphed in phazon", xf0_phazonBallJumpFactor, skDefaultFlags); - CREATE_CVAR(AllowedJumpTime, "", xf4_allowedJumpTime, skDefaultFlags); - CREATE_CVAR(AllowedDoubleJumpTime, "", xf8_allowedDoubleJumpTime, skDefaultFlags); - CREATE_CVAR(MinDoubleJumpWindow, "", xfc_minDoubleJumpWindow, skDefaultFlags); - CREATE_CVAR(MaxDoubleJumpWindow, "", x100_maxDoubleJumpWindow, skDefaultFlags); - // CREATE_CVAR(); // x104_ - CREATE_CVAR(MinJumpTime, "", x108_minJumpTime, skDefaultFlags); - CREATE_CVAR(MinDoubleJumpTime, "", x10c_minDoubleJumpTime, skDefaultFlags); - CREATE_CVAR(AllowedLedgeTime, "", x110_allowedLedgeTime, skDefaultFlags); - CREATE_CVAR(DoubleJumpImpulse, "", x114_doubleJumpImpulse, skDefaultFlags); - CREATE_CVAR(BackwardsForceMultiplier, "", x118_backwardsForceMultiplier, skDefaultFlags); - CREATE_CVAR(BombJumpRadius, "", x11c_bombJumpRadius, skDefaultFlags); - CREATE_CVAR(BombJumpHeight, "", x120_bombJumpHeight, skDefaultFlags); - CREATE_CVAR(EyeOffset, "", x124_eyeOffset, skDefaultFlags); - CREATE_CVAR(TurnSpeedMultiplier, "", x128_turnSpeedMultiplier, skDefaultFlags); - CREATE_CVAR(FreeLookTurnSpeedMultiplier, "", x12c_freeLookTurnSpeedMultiplier, skDefaultFlags); - CREATE_CVAR(HorizontalFreeLookAngleVelocity, "", x130_horizontalFreeLookAngleVel, skDefaultFlags); - CREATE_CVAR(VerticalFreeLookAngleVelocity, "", x134_verticalFreeLookAngleVel, skDefaultFlags); - CREATE_CVAR(FreeLookSpeed, "", x138_freeLookSpeed, skDefaultFlags); - CREATE_CVAR(FreeLookSnapSpeed, "", x13c_freeLookSnapSpeed, skDefaultFlags); - // CREATE_CVAR(); // x140_ - CREATE_CVAR(FreeLookCenteredThresholdAngle, "", x144_freeLookCenteredThresholdAngle, skDefaultFlags); - CREATE_CVAR(FreeLookCenteredTime, "", x148_freeLookCenteredTime, skDefaultFlags); - CREATE_CVAR(FreeLookDampenFactor, "", x14c_freeLookDampenFactor, skDefaultFlags); - CREATE_CVAR(LeftDivisor, "", x150_leftDiv, skDefaultFlags); - CREATE_CVAR(RightDivisor, "", x154_rightDiv, skDefaultFlags); - CREATE_CVAR(OrbitMinDistanceClose, "", x158_orbitMinDistance[0], skDefaultFlags); - CREATE_CVAR(OrbitMinDistanceFar, "", x158_orbitMinDistance[1], skDefaultFlags); - CREATE_CVAR(OrbitMinDistanceDefault, "", x158_orbitMinDistance[2], skDefaultFlags); - CREATE_CVAR(OrbitNormalDistanceClose, "", x164_orbitNormalDistance[0], skDefaultFlags); - CREATE_CVAR(OrbitNormalDistanceFar, "", x164_orbitNormalDistance[1], skDefaultFlags); - CREATE_CVAR(OrbitNormalDistanceDefault, "", x164_orbitNormalDistance[2], skDefaultFlags); - CREATE_CVAR(OrbitMaxDistanceClose, "", x170_orbitMaxDistance[0], skDefaultFlags); - CREATE_CVAR(OrbitMaxDistanceFar, "", x170_orbitMaxDistance[1], skDefaultFlags); - CREATE_CVAR(OrbitMaxDistanceDefault, "", x170_orbitMaxDistance[2], skDefaultFlags); - // CREATE_CVAR(); // x17c_ - CREATE_CVAR(OrbitmodeTimer, "", x180_orbitModeTimer, skDefaultFlags); - CREATE_CVAR(OrbitCameraSpeed, "", x184_orbitCameraSpeed, skDefaultFlags); - CREATE_CVAR(OrbitUpperAngle, "", x184_orbitCameraSpeed, skDefaultFlags); - CREATE_CVAR(OrbitLowerAngle, "", x184_orbitCameraSpeed, skDefaultFlags); - CREATE_CVAR(OrbitHorizontalAngle, "", x184_orbitCameraSpeed, skDefaultFlags); - // CREATE_CVAR(); // x194_ - // CREATE_CVAR(); // x198_ - CREATE_CVAR(OrbitMaxTargetDistance, "", x19c_orbitMaxTargetDistance, skDefaultFlags); - CREATE_CVAR(OrbitMaxLockDistance, "", x1a0_orbitMaxLockDistance, skDefaultFlags); - CREATE_CVAR(OrbitDistanceThreshold, "", x1a4_orbitDistanceThreshold, skDefaultFlags); - CREATE_CVAR(OrbitScreenTargetingBoxHalfExtentX, "", x1a8_orbitScreenBoxHalfExtentX[0], skDefaultFlags); - CREATE_CVAR(OrbitScreenScanBoxHalfExtentX, "", x1a8_orbitScreenBoxHalfExtentX[1], skDefaultFlags); - CREATE_CVAR(OrbitScreenTargetingBoxHalfExtentY, "", x1b0_orbitScreenBoxHalfExtentY[0], skDefaultFlags); - CREATE_CVAR(OrbitScreenScanBoxHalfExtentY, "", x1b0_orbitScreenBoxHalfExtentY[1], skDefaultFlags); - CREATE_CVAR(OrbitScreenTargetingBoxCenterX, "", x1b8_orbitScreenBoxCenterX[0], skDefaultFlags); - CREATE_CVAR(OrbitScreenScanBoxCenterX, "", x1b8_orbitScreenBoxCenterX[1], skDefaultFlags); - CREATE_CVAR(OrbitScreenTargetingBoxCenterY, "", x1c0_orbitScreenBoxCenterY[0], skDefaultFlags); - CREATE_CVAR(OrbitScreenScanBoxCenterY, "", x1c0_orbitScreenBoxCenterY[1], skDefaultFlags); - CREATE_CVAR(OrbitZoneTargetingIdealX, "", x1c8_orbitZoneIdealX[0], skDefaultFlags); - CREATE_CVAR(OrbitZoneScanIdealX, "", x1c8_orbitZoneIdealX[1], skDefaultFlags); - CREATE_CVAR(OrbitZoneTargetingIdealY, "", x1d0_orbitZoneIdealY[0], skDefaultFlags); - CREATE_CVAR(OrbitZoneScanIdealY, "", x1d0_orbitZoneIdealY[1], skDefaultFlags); - CREATE_CVAR(OrbitNearX, "", x1d8_orbitNearX, skDefaultFlags); - CREATE_CVAR(OrbitNearZ, "", x1dc_orbitNearZ, skDefaultFlags); - // CREATE_CVAR(); // x1e0_ - // CREATE_CVAR(); // x1e4_ - CREATE_CVAR(OrbitFixedOffsetZDiff, "", x1e8_orbitFixedOffsetZDiff, skDefaultFlags); - CREATE_CVAR(OrbitZRange, "", x1ec_orbitZRange, skDefaultFlags); - // CREATE_CVAR(); // x1f0_ - // CREATE_CVAR(); // x1f4_ - // CREATE_CVAR(); // x1f8_ - CREATE_CVAR(OrbitPreventionTime, "", x1fc_orbitPreventionTime, skDefaultFlags); - CREATE_CVAR_BITFIELD(DashEnabled, "", x200_24_dashEnabled, skDefaultFlags); - CREATE_CVAR_BITFIELD(DashOnButtonRelease, "", x200_25_dashOnButtonRelease, skDefaultFlags); - CREATE_CVAR(DashButtonHoldCancelTime, "", x204_dashButtonHoldCancelTime, skDefaultFlags); - CREATE_CVAR(DashStrafeInputThreshold, "", x208_dashStrafeInputThreshold, skDefaultFlags); - CREATE_CVAR(SidewaysDoubleJumpImpulse, "", x20c_sidewaysDoubleJumpImpulse, skDefaultFlags); - CREATE_CVAR(SidewaysVerticalDoubleJumpAccel, "", x210_sidewaysVerticalDoubleJumpAccel, skDefaultFlags); - CREATE_CVAR(SidewaysHorizontalDoubleJumpAccel, "", x214_sidewaysHorizontalDoubleJumpAccel, skDefaultFlags); - CREATE_CVAR(ScanningRange, "", x218_scanningRange, skDefaultFlags); - CREATE_CVAR_BITFIELD(ScanRetention, "", x21c_24_scanRetention, skDefaultFlags); - CREATE_CVAR_BITFIELD(ScanFreezesGame, "", x21c_25_scanFreezesGame, skDefaultFlags); - CREATE_CVAR_BITFIELD(OrbitWhileScanning, "", x21c_26_orbitWhileScanning, skDefaultFlags); - CREATE_CVAR(ScanMaxTargetDistance, "", x220_scanMaxTargetDistance, skDefaultFlags); - CREATE_CVAR(ScanMaxLockDistance, "", x224_scanMaxLockDistance, skDefaultFlags); - CREATE_CVAR_BITFIELD(FreeLookTurnsPlayer, "", x228_24_freelookTurnsPlayer, skDefaultFlags); - // CREATE_CVAR_BITFIELD(); // x228_25_ - // CREATE_CVAR_BITFIELD(); // x228_26_ - CREATE_CVAR_BITFIELD(MoveDuringFreelook, "", x228_27_moveDuringFreeLook, skDefaultFlags); - CREATE_CVAR_BITFIELD(HoldButtonsForFreeLook, "", x228_28_holdButtonsForFreeLook, skDefaultFlags); - // CREATE_CVAR_BITFIELD(); // x228_30_ - // CREATE_CVAR_BITFIELD(); // x228_31_ - // CREATE_CVAR(); // x229_24_ - CREATE_CVAR_BITFIELD(AimWhenOrbitingPoint, "", x229_25_aimWhenOrbitingPoint, skDefaultFlags); - CREATE_CVAR_BITFIELD(StayInFreeLookWhileFiring, "", x229_26_stayInFreeLookWhileFiring, skDefaultFlags); - // CREATE_CVAR_BITFIELD(); // x229_27_ - // CREATE_CVAR_BITFIELD(); // x229_28_ - CREATE_CVAR_BITFIELD(OrbitFixedOffset, "", x229_29_orbitFixedOffset, skDefaultFlags); - CREATE_CVAR_BITFIELD(GunButtonTogglesHolster, "", x229_30_gunButtonTogglesHolster, skDefaultFlags); - CREATE_CVAR_BITFIELD(GunNotFiringHolstersGun, "", x229_31_gunNotFiringHolstersGun, skDefaultFlags); - CREATE_CVAR_BITFIELD(FallingDoubleJump, "", x22a_24_fallingDoubleJump, skDefaultFlags); - CREATE_CVAR_BITFIELD(ImpulseDoubleJump, "", x22a_25_impulseDoubleJump, skDefaultFlags); - CREATE_CVAR_BITFIELD(FiringCancelsCameraPitch, "", x22a_26_firingCancelsCameraPitch, skDefaultFlags); - CREATE_CVAR_BITFIELD(AssistedAimingIgnoreHorizontal, "", x22a_27_assistedAimingIgnoreHorizontal, skDefaultFlags); - CREATE_CVAR_BITFIELD(AssistedAimingIgnoreVertical, "", x22a_28_assistedAimingIgnoreVertical, skDefaultFlags); - // CREATE_CVAR(); // x22c - // CREATE_CVAR(); // x230_ - CREATE_CVAR(AimMaxDistance, "", x234_aimMaxDistance, skDefaultFlags); - // CREATE_CVAR(); // x238_ - // CREATE_CVAR(); // x23c_ - // CREATE_CVAR(); // x240_ - // CREATE_CVAR(); // x244_ - // CREATE_CVAR(); // x248_ - CREATE_CVAR(AimThresholdDistance, "", x24c_aimThresholdDistance, skDefaultFlags); - // CREATE_CVAR(); // x250_ - // CREATE_CVAR(); // x254_ - CREATE_CVAR(AimBoxWidth, "", x258_aimBoxWidth, skDefaultFlags); - CREATE_CVAR(AimBoxHeight, "", x25c_aimBoxHeight, skDefaultFlags); - CREATE_CVAR(AimTargetTimer, "", x260_aimTargetTimer, skDefaultFlags); - CREATE_CVAR(AimAssistHorizontalAngle, "", x264_aimAssistHorizontalAngle, skDefaultFlags); - CREATE_CVAR(AimAssistVerticalAngle, "", x268_aimAssistVerticalAngle, skDefaultFlags); - CREATE_CVAR(PlayerHeight, "", x26c_playerHeight, skDefaultFlags); - CREATE_CVAR(PlayerXYHalfExtent, "", x270_playerXYHalfExtent, skDefaultFlags); - CREATE_CVAR(StepUpHeight, "", x274_stepUpHeight, skDefaultFlags); - CREATE_CVAR(StepDownHeight, "", x278_stepDownHeight, skDefaultFlags); - CREATE_CVAR(PlayerBallHalfExtent, "", x27c_playerBallHalfExtent, skDefaultFlags); - CREATE_CVAR(FirstPersonCameraSpeed, "", x280_firstPersonCameraSpeed, skDefaultFlags); - // CREATE_CVAR(); // x284_ - CREATE_CVAR(JumpCameraPitchDownStart, "", x288_jumpCameraPitchDownStart, skDefaultFlags); - CREATE_CVAR(JumpCameraPitchDownFull, "", x28c_jumpCameraPitchDownFull, skDefaultFlags); - CREATE_CVAR(JumpCameraPitchDownAngle, "", x290_jumpCameraPitchDownAngle, skDefaultFlags); - CREATE_CVAR(FallCameraPitchDownStart, "", x294_fallCameraPitchDownStart, skDefaultFlags); - CREATE_CVAR(FallCameraPitchDownFull, "", x298_fallCameraPitchDownFull, skDefaultFlags); - CREATE_CVAR(FallCameraPitchDownAngle, "", x29c_fallCameraPitchDownAngle, skDefaultFlags); - CREATE_CVAR(OrbitDistanceMax, "", x2a0_orbitDistanceMax, skDefaultFlags); - CREATE_CVAR(GrappleSwingLength, "", x2a4_grappleSwingLength, skDefaultFlags); - CREATE_CVAR(GrappleSwingPeriod, "", x2a8_grappleSwingPeriod, skDefaultFlags); - CREATE_CVAR(GrapplePullSpeedMin, "", x2ac_grapplePullSpeedMin, skDefaultFlags); - CREATE_CVAR(GrappleCameraSpeed, "", x2b0_grappleCameraSpeed, skDefaultFlags); - CREATE_CVAR(MaxGrappleLockedTurnAlignDistance, "", x2b4_maxGrappleLockedTurnAlignDistance, skDefaultFlags); - CREATE_CVAR(GrapplePullSpeedProportion, "", x2b8_grapplePullSpeedProportion, skDefaultFlags); - CREATE_CVAR(GrapplePullSpeedMax, "", x2bc_grapplePullSpeedMax, skDefaultFlags); - CREATE_CVAR(GrappleLookCenterSpeed, "", x2c0_grappleLookCenterSpeed, skDefaultFlags); - CREATE_CVAR(MaxGrappleTurnSpeed, "", x2c4_maxGrappleTurnSpeed, skDefaultFlags); - CREATE_CVAR(GrappleJumpForce, "", x2c8_grappleJumpForce, skDefaultFlags); - CREATE_CVAR(GrappleReleaseTime, "", x2cc_grappleReleaseTime, skDefaultFlags); - CREATE_CVAR(GrappleJumpMode, "", x2d0_grappleJumpMode, skDefaultFlags); - CREATE_CVAR(OrbitReleaseBreaksGrapple, "", x2d4_orbitReleaseBreaksGrapple, skDefaultFlags); - CREATE_CVAR(InvertGrappleTurn, "", x2d5_invertGrappleTurn, skDefaultFlags); - CREATE_CVAR(GrappleBeamSpeed, "", x2d8_grappleBeamSpeed, skDefaultFlags); - CREATE_CVAR(GrappleBeamXWaveAmplitude, "", x2dc_grappleBeamXWaveAmplitude, skDefaultFlags); - CREATE_CVAR(GrappleBeamZWaveAmplitude, "", x2e0_grappleBeamZWaveAmplitude, skDefaultFlags); - CREATE_CVAR(GrappleBeamAnglePhaseDelta, "", x2e4_grappleBeamAnglePhaseDelta, skDefaultFlags); - // CREATE_CVAR(); // x2e8_ - // CREATE_CVAR(); // x2ec_ - // CREATE_CVAR(); // x2f0_ - // CREATE_CVAR(); // x2f4_ - CREATE_CVAR(FrozenTimeout, "", x2f8_frozenTimeout, skDefaultFlags); - CREATE_CVAR(IceBreakJumpCount, "", x2fc_iceBreakJumpCount, skDefaultFlags); - CREATE_CVAR(VariaDamageReduction, "", x300_variaDamageReduction, skDefaultFlags); - CREATE_CVAR(GravityDamageReduction, "", x304_gravityDamageReduction, skDefaultFlags); - CREATE_CVAR(PhazonDamageReduction, "", x308_phazonDamageReduction, skDefaultFlags); -} } // namespace DataSpec::DNAMP1 diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp index a68a1c9af..e5983db64 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp @@ -174,148 +174,6 @@ struct CTweakPlayer final : ITweakPlayer { Value x300_variaDamageReduction; Value x304_gravityDamageReduction; Value x308_phazonDamageReduction; - float GetMaxTranslationalAcceleration(int s) const override { return x4_maxTranslationalAcceleration[s]; } - float GetMaxRotationalAcceleration(int s) const override { return x24_maxRotationalAcceleration[s]; } - float GetPlayerTranslationFriction(int s) const override { return x44_translationFriction[s]; } - float GetPlayerRotationFriction(int s) const override { return x64_rotationFriction[s]; } - float GetPlayerRotationMaxSpeed(int s) const override { return x84_rotationMaxSpeed[s]; } - float GetPlayerTranslationMaxSpeed(int s) const override { return xa4_translationMaxSpeed[s]; } - float GetNormalGravAccel() const override { return xc4_normalGravAccel; } - float GetFluidGravAccel() const override { return xc8_fluidGravAccel; } - float GetVerticalJumpAccel() const override { return xcc_verticalJumpAccel; } - float GetHorizontalJumpAccel() const override { return xd0_horizontalJumpAccel; } - float GetVerticalDoubleJumpAccel() const override { return xd4_verticalDoubleJumpAccel; } - float GetHorizontalDoubleJumpAccel() const override { return xd8_horizontalDoubleJumpAccel; } - float GetWaterJumpFactor() const override { return xdc_waterJumpFactor; } - float GetWaterBallJumpFactor() const override { return xe0_waterBallJumpFactor; } - float GetLavaJumpFactor() const override { return xe4_lavaJumpFactor; } - float GetLavaBallJumpFactor() const override { return xe8_lavaBallJumpFactor; } - float GetPhazonJumpFactor() const override { return xec_phazonJumpFactor; } - float GetPhazonBallJumpFactor() const override { return xf0_phazonBallJumpFactor; } - float GetAllowedJumpTime() const override { return xf4_allowedJumpTime; } - float GetAllowedDoubleJumpTime() const override { return xf8_allowedDoubleJumpTime; } - float GetMinDoubleJumpWindow() const override { return xfc_minDoubleJumpWindow; } - float GetMaxDoubleJumpWindow() const override { return x100_maxDoubleJumpWindow; } - float GetMinJumpTime() const override { return x108_minJumpTime; } - float GetMinDoubleJumpTime() const override { return x10c_minDoubleJumpTime; } - float GetAllowedLedgeTime() const override { return x110_allowedLedgeTime; } - float GetDoubleJumpImpulse() const override { return x114_doubleJumpImpulse; } - float GetBackwardsForceMultiplier() const override { return x118_backwardsForceMultiplier; } - float GetBombJumpRadius() const override { return x11c_bombJumpRadius; } - float GetBombJumpHeight() const override { return x120_bombJumpHeight; } - float GetEyeOffset() const override { return x124_eyeOffset; } - float GetTurnSpeedMultiplier() const override { return x128_turnSpeedMultiplier; } - float GetFreeLookTurnSpeedMultiplier() const override { return x12c_freeLookTurnSpeedMultiplier; } - float GetFreeLookSpeed() const override { return x138_freeLookSpeed; } - float GetFreeLookSnapSpeed() const override { return x13c_freeLookSnapSpeed; } - float GetFreeLookCenteredThresholdAngle() const override { return x144_freeLookCenteredThresholdAngle; } - float GetFreeLookCenteredTime() const override { return x148_freeLookCenteredTime; } - float GetOrbitModeTimer() const override { return x180_orbitModeTimer; } - float GetOrbitUpperAngle() const override { return x188_orbitUpperAngle; } - float GetOrbitLowerAngle() const override { return x18c_orbitLowerAngle; } - float GetOrbitHorizAngle() const override { return x190_orbitHorizAngle; } - float GetOrbitMaxTargetDistance() const override { return x19c_orbitMaxTargetDistance; } - float GetOrbitMaxLockDistance() const override { return x1a0_orbitMaxLockDistance; } - float GetOrbitDistanceThreshold() const override { return x1a4_orbitDistanceThreshold; } - uint32_t GetOrbitScreenBoxHalfExtentX(int zone) const override { return x1a8_orbitScreenBoxHalfExtentX[zone]; } - uint32_t GetOrbitScreenBoxHalfExtentY(int zone) const override { return x1b0_orbitScreenBoxHalfExtentY[zone]; } - uint32_t GetOrbitScreenBoxCenterX(int zone) const override { return x1b8_orbitScreenBoxCenterX[zone]; } - uint32_t GetOrbitScreenBoxCenterY(int zone) const override { return x1c0_orbitScreenBoxCenterY[zone]; } - uint32_t GetOrbitZoneIdealX(int zone) const override { return x1c8_orbitZoneIdealX[zone]; } - uint32_t GetOrbitZoneIdealY(int zone) const override { return x1d0_orbitZoneIdealY[zone]; } - float GetOrbitNearX() const override { return x1d8_orbitNearX; } - float GetOrbitNearZ() const override { return x1dc_orbitNearZ; } - float GetOrbitFixedOffsetZDiff() const override { return x1e8_orbitFixedOffsetZDiff; } - float GetOrbitZRange() const override { return x1ec_orbitZRange; } - bool GetDashEnabled() const override { return x200_24_dashEnabled; } - bool GetDashOnButtonRelease() const override { return x200_25_dashOnButtonRelease; } - float GetDashButtonHoldCancelTime() const override { return x204_dashButtonHoldCancelTime; } - float GetDashStrafeInputThreshold() const override { return x208_dashStrafeInputThreshold; } - float GetSidewaysDoubleJumpImpulse() const override { return x20c_sidewaysDoubleJumpImpulse; } - float GetSidewaysVerticalDoubleJumpAccel() const override { return x210_sidewaysVerticalDoubleJumpAccel; } - float GetSidewaysHorizontalDoubleJumpAccel() const override { return x214_sidewaysHorizontalDoubleJumpAccel; } - float GetScanningRange() const override { return x218_scanningRange; } - bool GetScanRetention() const override { return x21c_24_scanRetention; } - bool GetScanFreezesGame() const override { return x21c_25_scanFreezesGame; } - bool GetOrbitWhileScanning() const override { return x21c_26_orbitWhileScanning; } - float GetScanMaxTargetDistance() const override { return x220_scanMaxTargetDistance; } - float GetScanMaxLockDistance() const override { return x224_scanMaxLockDistance; } - bool GetMoveDuringFreeLook() const override { return x228_27_moveDuringFreeLook; } - bool GetHoldButtonsForFreeLook() const override { return x228_28_holdButtonsForFreeLook; } - bool GetTwoButtonsForFreeLook() const override { return x228_29_twoButtonsForFreeLook; } - bool GetAimWhenOrbitingPoint() const override { return x229_25_aimWhenOrbitingPoint; } - bool GetStayInFreeLookWhileFiring() const override { return x229_26_stayInFreeLookWhileFiring; } - bool GetOrbitFixedOffset() const override { return x229_29_orbitFixedOffset; } - bool GetGunButtonTogglesHolster() const override { return x229_30_gunButtonTogglesHolster; } - bool GetGunNotFiringHolstersGun() const override { return x229_31_gunNotFiringHolstersGun; } - bool GetFallingDoubleJump() const override { return x22a_24_fallingDoubleJump; } - bool GetImpulseDoubleJump() const override { return x22a_25_impulseDoubleJump; } - bool GetFiringCancelsCameraPitch() const override { return x22a_26_firingCancelsCameraPitch; } - bool GetAssistedAimingIgnoreHorizontal() const override { return x22a_27_assistedAimingIgnoreHorizontal; } - bool GetAssistedAimingIgnoreVertical() const override { return x22a_28_assistedAimingIgnoreVertical; } - float GetAimMaxDistance() const override { return x234_aimMaxDistance; } - float GetAimThresholdDistance() const override { return x24c_aimThresholdDistance; } - float GetAimBoxWidth() const override { return x258_aimBoxWidth; } - float GetAimBoxHeight() const override { return x25c_aimBoxHeight; } - float GetAimTargetTimer() const override { return x260_aimTargetTimer; } - float GetAimAssistHorizontalAngle() const override { return x264_aimAssistHorizontalAngle; } - float GetAimAssistVerticalAngle() const override { return x268_aimAssistVerticalAngle; } - float GetPlayerHeight() const override { return x26c_playerHeight; } - float GetPlayerXYHalfExtent() const override { return x270_playerXYHalfExtent; } - float GetStepUpHeight() const override { return x274_stepUpHeight; } - float GetStepDownHeight() const override { return x278_stepDownHeight; } - float GetPlayerBallHalfExtent() const override { return x27c_playerBallHalfExtent; } - float GetOrbitDistanceMax() const override { return x2a0_orbitDistanceMax; } - float GetGrappleSwingLength() const override { return x2a4_grappleSwingLength; } - float GetGrappleSwingPeriod() const override { return x2a8_grappleSwingPeriod; } - float GetGrapplePullSpeedMin() const override { return x2ac_grapplePullSpeedMin; } - float GetMaxGrappleLockedTurnAlignDistance() const override { return x2b4_maxGrappleLockedTurnAlignDistance; } - float GetGrapplePullSpeedProportion() const override { return x2b8_grapplePullSpeedProportion; } - float GetGrapplePullSpeedMax() const override { return x2bc_grapplePullSpeedMax; } - float GetGrappleLookCenterSpeed() const override { return x2c0_grappleLookCenterSpeed; } - float GetMaxGrappleTurnSpeed() const override { return x2c4_maxGrappleTurnSpeed; } - float GetGrappleJumpForce() const override { return x2c8_grappleJumpForce; } - float GetGrappleReleaseTime() const override { return x2cc_grappleReleaseTime; } - uint32_t GetGrappleJumpMode() const override { return x2d0_grappleJumpMode; } - bool GetOrbitReleaseBreaksGrapple() const override { return x2d4_orbitReleaseBreaksGrapple; } - bool GetInvertGrappleTurn() const override { return x2d5_invertGrappleTurn; } - float GetGrappleBeamSpeed() const override { return x2d8_grappleBeamSpeed; } - float GetGrappleBeamXWaveAmplitude() const override { return x2dc_grappleBeamXWaveAmplitude; } - float GetGrappleBeamZWaveAmplitude() const override { return x2e0_grappleBeamZWaveAmplitude; } - float GetGrappleBeamAnglePhaseDelta() const override { return x2e4_grappleBeamAnglePhaseDelta; } - float GetHorizontalFreeLookAngleVel() const override { return x130_horizontalFreeLookAngleVel; } - float GetVerticalFreeLookAngleVel() const override { return x134_verticalFreeLookAngleVel; } - float GetOrbitCameraSpeed() const override { return x184_orbitCameraSpeed; } - float GetOrbitPreventionTime() const override { return x1fc_orbitPreventionTime; } - bool GetFreeLookTurnsPlayer() const override { return x228_24_freelookTurnsPlayer; } - float GetJumpCameraPitchDownStart() const override { return x288_jumpCameraPitchDownStart; } - float GetJumpCameraPitchDownFull() const override { return x28c_jumpCameraPitchDownFull; } - float GetJumpCameraPitchDownAngle() const override { return x290_jumpCameraPitchDownAngle; } - float GetFallCameraPitchDownStart() const override { return x294_fallCameraPitchDownStart; } - float GetFallCameraPitchDownFull() const override { return x298_fallCameraPitchDownFull; } - float GetFallCameraPitchDownAngle() const override { return x29c_fallCameraPitchDownAngle; } - float GetFirstPersonCameraSpeed() const override { return x280_firstPersonCameraSpeed; } - float GetGrappleCameraSpeed() const override { return x2b0_grappleCameraSpeed; } - float GetFreeLookDampenFactor() const override { return x14c_freeLookDampenFactor; } - float GetLeftLogicalThreshold() const override { return x150_leftDiv; } - float GetRightLogicalThreshold() const override { return x154_rightDiv; } - float GetOrbitMinDistance(int type) const override { return x158_orbitMinDistance[type]; } - float GetOrbitNormalDistance(int type) const override { return x164_orbitNormalDistance[type]; } - float GetOrbitMaxDistance(int type) const override { return x170_orbitMaxDistance[type]; } - float GetFrozenTimeout() const override { return x2f8_frozenTimeout; } - uint32_t GetIceBreakJumpCount() const override { return x2fc_iceBreakJumpCount; } - float GetVariaDamageReduction() const override { return x300_variaDamageReduction; } - float GetGravityDamageReduction() const override { return x304_gravityDamageReduction; } - float GetPhazonDamageReduction() const override { return x308_phazonDamageReduction; } - CTweakPlayer() = default; - CTweakPlayer(athena::io::IStreamReader& reader) { - read(reader); - FixupValues(); - } - - void FixupValues(); - void initCVars(hecl::CVarManager* mgr) override; - void _tweakListener(hecl::CVar* cv); }; } // namespace DataSpec::DNAMP1 diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp index 8488bcaaf..44968f908 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp @@ -7,9 +7,6 @@ namespace DataSpec::DNAMP1 { struct CTweakPlayerControl final : ITweakPlayerControl { AT_DECL_DNA_YAML Vector m_mappings; - atUint32 GetMapping(atUint32 command) const override { return m_mappings[command]; } - CTweakPlayerControl() = default; - CTweakPlayerControl(athena::io::IStreamReader& reader) { this->read(reader); } }; } // namespace DataSpec::DNAMP1 diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp index e9f821187..937fbde1d 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp @@ -33,77 +33,5 @@ struct CTweakPlayerGun final : ITweakPlayerGun { SWeaponInfo xa8_beams[5]; SComboShotParam x1f0_combos[5]; // Originally rstl::prereserved_vector Value x280_ricochetData[6]; // Originally rstl::prereserved_vector, extended to 6 to capture - // PhazonBeam's value - CTweakPlayerGun() = default; - CTweakPlayerGun(athena::io::IStreamReader& r) { - this->read(r); - x44_fixedVerticalAim = zeus::degToRad(x44_fixedVerticalAim); - } - - float GetUpLookAngle() const override { return x4_upLookAngle; } - float GetDownLookAngle() const override { return x8_downLookAngle; } - float GetVerticalSpread() const override { return xc_verticalSpread; } - float GetHorizontalSpread() const override { return x10_horizontalSpread; } - float GetHighVerticalSpread() const override { return x14_highVerticalSpread; } - float GetHighHorizontalSpread() const override { return x18_highHorizontalSpread; } - float GetLowVerticalSpread() const override { return x1c_lowVerticalSpread; } - float GetLowHorizontalSpread() const override { return x20_lowHorizontalSpread; } - float GetAimVerticalSpeed() const override { return x24_aimVerticalSpeed; } - float GetAimHorizontalSpeed() const override { return x28_aimHorizontalSpeed; } - float GetBombFuseTime() const override { return x2c_bombFuseTime; } - float GetBombDropDelayTime() const override { return x30_bombDropDelayTime; } - float GetHoloHoldTime() const override { return x34_holoHoldTime; } - float GetGunTransformTime() const override { return x38_gunTransformTime; } - float GetGunHolsterTime() const override { return x3c_gunHolsterTime; } - float GetGunNotFiringTime() const override { return x40_gunNotFiringTime; } - float GetFixedVerticalAim() const override { return x44_fixedVerticalAim; } - float GetGunExtendDistance() const override { return x48_gunExtendDistance; } - const zeus::CVector3f& GetGunPosition() const override { return x4c_gunPosition; } - const zeus::CVector3f& GetGrapplingArmPosition() const override { return x64_grapplingArmPosition; } - float GetRichochetDamage(atUint32 type) const override { - switch (type) { - case 0: // Power - return x280_ricochetData[0]; - case 1: // Ice - return x280_ricochetData[1]; - case 2: // Wave - return x280_ricochetData[2]; - case 3: // Plasma - return x280_ricochetData[3]; - case 6: // Missile - return x280_ricochetData[4]; - case 8: // Phazon - /* Note: In order to return the same value as retail we have to do a bit of a hack - * Retro accidentally forgot to load in PhazonBeam's richochet value, as a result, it loads the - * pointer to CTweakParticle's vtable. - */ -#if MP_v1088 - - return float(0x803D9CC4); -#else - return x280_ricochetData[5]; -#endif - default: - return 1.f; - } - } - - const SWeaponInfo& GetBeamInfo(atInt32 beam) const override { - if (beam < 0 || beam >= 5) { - return xa8_beams[0]; - } - return xa8_beams[beam]; - } - - const SComboShotParam& GetComboShotInfo(atInt32 beam) const override { - if (beam < 0 || beam >= 5) { - return x1f0_combos[0]; - } - return x1f0_combos[beam]; - } - - const SShotParam& GetBombInfo() const override { return x70_bomb; } - const SShotParam& GetPowerBombInfo() const override { return x8c_powerBomb; } - const SShotParam& GetMissileInfo() const { return x1d4_missile; } }; } // namespace DataSpec::DNAMP1 diff --git a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp index ed0fc2963..fd3bafce8 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp @@ -56,12 +56,12 @@ struct AT_SPECIALIZE_PARMS(true, false) CTweakTargeting final : public ITweakTar Value xf0_outerBeamSquaresScale; DNAColor xf4_outerBeamSquareColor; Value xf8_outerBeamSquareAngleCount; - struct UnkVec : BigDNA { + struct SSquareAngles : BigDNA { AT_DECL_DNA Value count; - Vector floats; + Vector angles; }; - Vector xf8_outerBeamSquareAngles; + Vector xf8_outerBeamSquareAngles; Value x108_chargeGaugeAngleCount; Vector x108_chargeGaugeAngles; Value x118_chargeGaugeScale; @@ -243,7 +243,7 @@ struct AT_SPECIALIZE_PARMS(true, false) CTweakTargeting final : public ITweakTar const zeus::CColor& GetInnerBeamColorIce() const override { return xdc_innerBeamColorIce; } const zeus::CColor& GetInnerBeamColorWave() const override { return xe0_innerBeamColorWave; } const zeus::CColor& GetInnerBeamColorPlasma() const override { return xe4_innerBeamColorPlasma; } - const float* GetOuterBeamSquareAngles(int i) const override { return xf8_outerBeamSquareAngles[i].floats.data(); } + const float* GetOuterBeamSquareAngles(int i) const override { return xf8_outerBeamSquareAngles[i].angles.data(); } float GetChargeGaugeAngle(int i) const override { return x108_chargeGaugeAngles[i]; } float GetChargeGaugeScale() const override { return x118_chargeGaugeScale; } const zeus::CColor& GetChargeGaugeNonFullColor() const override { return x11c_chargeGaugeNonFullColor; } diff --git a/Runtime/Audio/CAudioGroupSet.hpp b/Runtime/Audio/CAudioGroupSet.hpp index 4bbaf333e..444b547c7 100644 --- a/Runtime/Audio/CAudioGroupSet.hpp +++ b/Runtime/Audio/CAudioGroupSet.hpp @@ -5,7 +5,7 @@ #include "Runtime/CFactoryMgr.hpp" #include "Runtime/CToken.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/IObj.hpp" #include "Runtime/RetroTypes.hpp" diff --git a/Runtime/Audio/CMidiManager.cpp b/Runtime/Audio/CMidiManager.cpp index e996c957c..4ec45837a 100644 --- a/Runtime/Audio/CMidiManager.cpp +++ b/Runtime/Audio/CMidiManager.cpp @@ -1,6 +1,6 @@ #include "Runtime/Audio/CMidiManager.hpp" -#include "Runtime/CInputStream.hpp" +#include "Runtime/Streams/CInputStream.hpp" namespace metaforce { @@ -40,7 +40,7 @@ CMidiManager::CMidiData::CMidiData(CInputStream& in) { in.ReadLong(); x0_setupId = in.ReadLong(); x2_groupId = in.ReadLong(); - x4_agscId = in.ReadLong(); + x4_agscId = in.Get(); u32 length = in.ReadLong(); x8_arrData.reset(new u8[length]); in.ReadBytes(reinterpret_cast(x8_arrData.get()), length); diff --git a/Runtime/Audio/CSfxManager.cpp b/Runtime/Audio/CSfxManager.cpp index c6d94329d..f3d3f5d7c 100644 --- a/Runtime/Audio/CSfxManager.cpp +++ b/Runtime/Audio/CSfxManager.cpp @@ -1,5 +1,5 @@ #include "Runtime/Audio/CSfxManager.hpp" -#include "Runtime/CInputStream.hpp" +#include "Runtime/Streams/CInputStream.hpp" #include "Runtime/CSimplePool.hpp" diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp index f863f1806..33fb25fbe 100644 --- a/Runtime/AutoMapper/CAutoMapper.cpp +++ b/Runtime/AutoMapper/CAutoMapper.cpp @@ -1604,7 +1604,7 @@ CAssetId CAutoMapper::GetAreaHintDescriptionString(CAssetId mreaId) { } } } - return -1; + return {}; } void CAutoMapper::OnNewInGameGuiState(EInGameGuiState state, CStateManager& mgr) { diff --git a/Runtime/AutoMapper/CAutoMapper.hpp b/Runtime/AutoMapper/CAutoMapper.hpp index c564518a2..723552541 100644 --- a/Runtime/AutoMapper/CAutoMapper.hpp +++ b/Runtime/AutoMapper/CAutoMapper.hpp @@ -108,11 +108,11 @@ public: SAutoMapperHintStep(PanToArea, TAreaId areaId) : x0_type(Type::PanToArea), x4_areaId(areaId) {} SAutoMapperHintStep(PanToWorld, CAssetId worldId) : x0_type(Type::PanToWorld), x4_worldId(worldId) {} - SAutoMapperHintStep(SwitchToUniverse) : x0_type(Type::SwitchToUniverse), x4_worldId(0) {} + SAutoMapperHintStep(SwitchToUniverse) : x0_type(Type::SwitchToUniverse), x4_worldId(CAssetId()) {} SAutoMapperHintStep(SwitchToWorld, CAssetId worldId) : x0_type(Type::SwitchToWorld), x4_worldId(worldId) {} SAutoMapperHintStep(ShowBeacon, float val) : x0_type(Type::ShowBeacon), x4_float(val) {} - SAutoMapperHintStep(ZoomIn) : x0_type(Type::ZoomIn), x4_worldId(0) {} - SAutoMapperHintStep(ZoomOut) : x0_type(Type::ZoomOut), x4_worldId(0) {} + SAutoMapperHintStep(ZoomIn) : x0_type(Type::ZoomIn), x4_worldId(CAssetId()) {} + SAutoMapperHintStep(ZoomOut) : x0_type(Type::ZoomOut), x4_worldId(CAssetId()) {} }; struct SAutoMapperHintLocation { diff --git a/Runtime/AutoMapper/CMapArea.cpp b/Runtime/AutoMapper/CMapArea.cpp index ea017cd14..0b99daf0e 100644 --- a/Runtime/AutoMapper/CMapArea.cpp +++ b/Runtime/AutoMapper/CMapArea.cpp @@ -97,7 +97,7 @@ void CMapArea::PostConstruct() { float z; std::memcpy(&z, tmp + 8, sizeof(float)); - m_verts.emplace_back(hecl::SBig(x), hecl::SBig(y), hecl::SBig(z)); + m_verts.emplace_back(CBasics::SwapBytes(x), CBasics::SwapBytes(y), CBasics::SwapBytes(z)); tmp += 12; } diff --git a/Runtime/AutoMapper/CMapUniverse.cpp b/Runtime/AutoMapper/CMapUniverse.cpp index f1673f1a4..329738b06 100644 --- a/Runtime/AutoMapper/CMapUniverse.cpp +++ b/Runtime/AutoMapper/CMapUniverse.cpp @@ -15,7 +15,7 @@ CMapUniverse::CMapUniverse(CInputStream& in, u32 version) : x0_hexagonId(in.Get< } CMapUniverse::CMapWorldData::CMapWorldData(CInputStream& in, u32 version) -: x0_label(in.Get()), x10_worldAssetId(in.ReadLong()) { +: x0_label(in.Get()), x10_worldAssetId(in) { x14_transform = in.Get(); const u32 worldCount = in.ReadLong(); x44_hexagonXfs.reserve(worldCount); diff --git a/Runtime/AutoMapper/CMapWorld.cpp b/Runtime/AutoMapper/CMapWorld.cpp index 9ccede18d..612e15fd0 100644 --- a/Runtime/AutoMapper/CMapWorld.cpp +++ b/Runtime/AutoMapper/CMapWorld.cpp @@ -280,7 +280,7 @@ CMapWorld::CMapWorld(CInputStream& in) { x0_areas.reserve(areaCount); x20_traversed.resize(areaCount); for (u32 i = 0; i < areaCount; ++i) { - CAssetId mapaId = in.ReadLong(); + CAssetId mapaId = in.Get(); x0_areas.emplace_back(mapaId, EMapAreaList::Unloaded, x0_areas.empty() ? nullptr : &x0_areas.back()); } x10_listHeads[2] = &x0_areas.back(); diff --git a/Runtime/AutoMapper/CMapWorldInfo.hpp b/Runtime/AutoMapper/CMapWorldInfo.hpp index 642dfef99..7e6fdf614 100644 --- a/Runtime/AutoMapper/CMapWorldInfo.hpp +++ b/Runtime/AutoMapper/CMapWorldInfo.hpp @@ -4,7 +4,7 @@ #include #include "RetroTypes.hpp" -#include "IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" namespace metaforce { class CWorldSaveGameInfo; diff --git a/Runtime/CFactoryMgr.hpp b/Runtime/CFactoryMgr.hpp index 0f5b3e8b3..689dc719a 100644 --- a/Runtime/CFactoryMgr.hpp +++ b/Runtime/CFactoryMgr.hpp @@ -3,7 +3,7 @@ #include #include "Runtime/IFactory.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" namespace metaforce { diff --git a/Runtime/CGameHintInfo.cpp b/Runtime/CGameHintInfo.cpp index 02172e1fa..822c183de 100644 --- a/Runtime/CGameHintInfo.cpp +++ b/Runtime/CGameHintInfo.cpp @@ -17,7 +17,7 @@ CGameHintInfo::CGameHint::CGameHint(CInputStream& in, s32 version) : x0_name(in.Get()) , x10_immediateTime(in.ReadFloat()) , x14_normalTime(in.ReadFloat()) -, x18_stringId(in.ReadLong()) +, x18_stringId(in.Get()) , x1c_textTime(3.f * float(version <= 0 ? 1 : in.ReadLong())) { u32 locationCount = in.ReadLong(); x20_locations.reserve(locationCount); @@ -26,10 +26,10 @@ CGameHintInfo::CGameHint::CGameHint(CInputStream& in, s32 version) } CGameHintInfo::SHintLocation::SHintLocation(CInputStream& in, s32) -: x0_mlvlId(in.ReadLong()) -, x4_mreaId(in.ReadLong()) +: x0_mlvlId(in.Get()) +, x4_mreaId(in.Get()) , x8_areaId(in.ReadLong()) -, xc_stringId(in.ReadLong()) {} +, xc_stringId(in.Get()) {} int CGameHintInfo::FindHintIndex(std::string_view str) { const std::vector& gameHints = g_MemoryCardSys->GetHints(); diff --git a/Runtime/CGameOptions.cpp b/Runtime/CGameOptions.cpp index e7a366479..de25fdf50 100644 --- a/Runtime/CGameOptions.cpp +++ b/Runtime/CGameOptions.cpp @@ -384,19 +384,19 @@ void CGameOptions::SetControls(int controls) { } constexpr std::array, 5> CStickToDPadRemap{{ - {0x2A13C23E, 0xF13452F8}, - {0xA91A7703, 0xC042EC91}, - {0x12A12131, 0x5F556002}, - {0xA9798329, 0xB306E26F}, - {0xCD7B1ACA, 0x8ADA8184}, + {0x2A13C23Eu, 0xF13452F8u}, + {0xA91A7703u, 0xC042EC91u}, + {0x12A12131u, 0x5F556002u}, + {0xA9798329u, 0xB306E26Fu}, + {0xCD7B1ACAu, 0x8ADA8184u}, }}; constexpr std::array, 5> CStickOutlineToDPadRemap{{ - {0x1A29C0E6, 0xF13452F8}, - {0x5D9F9796, 0xC042EC91}, - {0x951546A8, 0x5F556002}, - {0x7946C4C5, 0xB306E26F}, - {0x409AA72E, 0x8ADA8184}, + {0x1A29C0E6u, 0xF13452F8u}, + {0x5D9F9796u, 0xC042EC91u}, + {0x951546A8u, 0x5F556002u}, + {0x7946C4C5u, 0xB306E26Fu}, + {0x409AA72Eu, 0x8ADA8184u}, }}; void CGameOptions::ResetControllerAssets(int controls) { diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index 012b679a3..5d6f163aa 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -4,7 +4,7 @@ #include "Runtime/CWorldSaveGameInfo.hpp" #include "Runtime/CSimplePool.hpp" #include "Runtime/GameGlobalObjects.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/MP1/MP1.hpp" #include @@ -122,7 +122,7 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data) { ret.xc_health = playerState.GetHealthInfo().GetHP(); u32 itemPercent; - if (origMLVL == 0x158EFE17) + if (origMLVL == 0x158EFE17u) itemPercent = 0; else itemPercent = playerState.CalculateItemCollectionRate() * 100 / playerState.GetPickupTotal(); diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index 1a85d9f78..986f9d63a 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -70,14 +70,29 @@ set(RUNTIME_SOURCES_B ${PARTICLE_SOURCES} ${WORLD_SOURCES} ${WEAPON_SOURCES} - ITweak.hpp + Tweaks/ITweak.hpp + Tweaks/ITweakAutoMapper.hpp + Tweaks/ITweakBall.hpp + Tweaks/ITweakGame.hpp + Tweaks/ITweakGui.hpp + Tweaks/ITweakGuiColors.hpp + Tweaks/ITweakGunRes.hpp + Tweaks/ITweakParticle.hpp + Tweaks/ITweakPlayer.hpp + Tweaks/ITweakPlayerControl.hpp + Tweaks/ITweakPlayerGun.hpp Tweaks/ITweakPlayerGun.cpp + Tweaks/ITweakPlayerRes.hpp + Tweaks/ITweakSlideShow.hpp + Tweaks/ITweakTargeting.hpp IMain.hpp CStopwatch.hpp - CMemoryStreamOut.hpp CMemoryStreamOut.cpp - CInputStream.hpp CInputStream.cpp - COutputStream.hpp COutputStream.cpp - CMemoryInStream.hpp - CZipInputStream.hpp CZipInputStream.cpp + Streams/IOStreams.hpp Streams/IOStreams.cpp + Streams/CMemoryStreamOut.hpp Streams/CMemoryStreamOut.cpp + Streams/CInputStream.hpp Streams/CInputStream.cpp + Streams/COutputStream.hpp Streams/COutputStream.cpp + Streams/CMemoryInStream.hpp + Streams/CZipInputStream.hpp Streams/CZipInputStream.cpp + Streams/ContainerReaders.hpp CGameAllocator.hpp CGameAllocator.cpp CMemoryCardSys.hpp CMemoryCardSys.cpp CScannableObjectInfo.hpp CScannableObjectInfo.cpp @@ -115,7 +130,6 @@ set(RUNTIME_SOURCES_B CFactoryMgr.hpp CFactoryMgr.cpp CPakFile.hpp CPakFile.cpp CStringExtras.hpp CStringExtras.cpp - IOStreams.hpp IOStreams.cpp CMainFlowBase.hpp CMainFlowBase.cpp CMFGameBase.hpp CInGameTweakManagerBase.hpp diff --git a/Runtime/CMayaSpline.cpp b/Runtime/CMayaSpline.cpp index ce42e11aa..583877a01 100644 --- a/Runtime/CMayaSpline.cpp +++ b/Runtime/CMayaSpline.cpp @@ -1,6 +1,6 @@ #include "Runtime/CMayaSpline.hpp" -#include "Runtime/CInputStream.hpp" +#include "Runtime/Streams/CInputStream.hpp" namespace metaforce { void ValidateTangent(zeus::CVector2f& tangent) { diff --git a/Runtime/CMemoryCardSys.cpp b/Runtime/CMemoryCardSys.cpp index 31a49efff..9a7a28831 100644 --- a/Runtime/CMemoryCardSys.cpp +++ b/Runtime/CMemoryCardSys.cpp @@ -225,7 +225,7 @@ void CMemoryCardSys::CCardFileInfo::BuildCardBuffer() { WriteIconData(w); memmove(x104_cardBuffer.data() + bannerSz, xf4_saveBuffer.data(), xf4_saveBuffer.size()); reinterpret_cast(*x104_cardBuffer.data()) = - hecl::SBig(CCRC32::Calculate(x104_cardBuffer.data() + 4, x104_cardBuffer.size() - 4)); + CBasics::SwapBytes(CCRC32::Calculate(x104_cardBuffer.data() + 4, x104_cardBuffer.size() - 4)); xf4_saveBuffer.clear(); } diff --git a/Runtime/CMemoryCardSys.hpp b/Runtime/CMemoryCardSys.hpp index eec4cec22..c6f9b48d0 100644 --- a/Runtime/CMemoryCardSys.hpp +++ b/Runtime/CMemoryCardSys.hpp @@ -6,7 +6,7 @@ #include #include "Runtime/CGameHintInfo.hpp" -#include "Runtime/CMemoryStreamOut.hpp" +#include "Runtime/Streams/CMemoryStreamOut.hpp" #include "Runtime/CToken.hpp" #include "Runtime/CWorldSaveGameInfo.hpp" #include "Runtime/GuiSys/CStringTable.hpp" diff --git a/Runtime/CPakFile.cpp b/Runtime/CPakFile.cpp index 068d804df..ba921a4b6 100644 --- a/Runtime/CPakFile.cpp +++ b/Runtime/CPakFile.cpp @@ -36,7 +36,7 @@ void CPakFile::LoadResourceTable(CInputStream& r) { u32 flags = r.ReadLong(); FourCC fcc; r.ReadBytes(reinterpret_cast(&fcc), 4); - CAssetId id = r.ReadLong(); + CAssetId id = r.Get(); u32 size = r.ReadLong(); u32 offset = r.ReadLong(); if (fcc == FOURCC('MLVL')) diff --git a/Runtime/CPlayerState.cpp b/Runtime/CPlayerState.cpp index 667e470e6..45313cc83 100644 --- a/Runtime/CPlayerState.cpp +++ b/Runtime/CPlayerState.cpp @@ -7,7 +7,7 @@ #include "Runtime/CMemoryCardSys.hpp" #include "Runtime/CStateManager.hpp" #include "Runtime/GameGlobalObjects.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Camera/CCameraManager.hpp" #include "Runtime/Camera/CFirstPersonCamera.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path diff --git a/Runtime/CPlayerState.hpp b/Runtime/CPlayerState.hpp index db9ce26b1..adc268e0d 100644 --- a/Runtime/CPlayerState.hpp +++ b/Runtime/CPlayerState.hpp @@ -4,7 +4,7 @@ #include #include "Runtime/CStaticInterference.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" #include "Runtime/rstl.hpp" #include "Runtime/World/CHealthInfo.hpp" diff --git a/Runtime/CResFactory.cpp b/Runtime/CResFactory.cpp index e0d446f36..459988fde 100644 --- a/Runtime/CResFactory.cpp +++ b/Runtime/CResFactory.cpp @@ -65,7 +65,7 @@ void CResFactory::BuildAsync(const SObjectTag& tag, const CVParamTransfer& xfer, if (search == m_loadMap.end()) { SLoadingData data(tag, target, xfer, x4_loader.GetResourceCompression(tag), selfRef); data.x14_resSize = x4_loader.ResourceSize(tag); - if (data.x14_resSize) { + if (data.x14_resSize != 0) { data.x10_loadBuffer = std::unique_ptr(new u8[data.x14_resSize]); data.x8_dvdReq = x4_loader.LoadResourceAsync(tag, data.x10_loadBuffer.get()); AddToLoadList(std::move(data)); @@ -107,9 +107,9 @@ void CResFactory::CancelBuild(const SObjectTag& tag) { void CResFactory::LoadPersistentResources(CSimplePool& sp) { const auto& paks = x4_loader.GetPaks(); - for (auto it = paks.begin(); it != paks.end(); ++it) { - if (!(*it)->IsWorldPak()) { - for (const CAssetId& id : (*it)->GetDepList()) { + for (const auto & pak : paks) { + if (!pak->IsWorldPak()) { + for (const CAssetId& id : pak->GetDepList()) { SObjectTag tag(GetResourceTypeById(id), id); m_nonWorldTokens.push_back(sp.GetObj(tag)); m_nonWorldTokens.back().Lock(); diff --git a/Runtime/CResLoader.hpp b/Runtime/CResLoader.hpp index 17fdc0e0d..b9cc41d82 100644 --- a/Runtime/CResLoader.hpp +++ b/Runtime/CResLoader.hpp @@ -7,7 +7,7 @@ #include #include "Runtime/CPakFile.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" namespace metaforce { diff --git a/Runtime/CScannableObjectInfo.cpp b/Runtime/CScannableObjectInfo.cpp index 838fe5a48..9cdbb1928 100644 --- a/Runtime/CScannableObjectInfo.cpp +++ b/Runtime/CScannableObjectInfo.cpp @@ -35,7 +35,7 @@ CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, CAssetId resId) : x void CScannableObjectInfo::Load(CInputStream& in, u32 version) { in.ReadLong(); in.ReadLong(); - x4_stringId = in.ReadLong(); + x4_stringId = in.Get(); if (version < 4) { x8_totalDownloadTime = in.ReadFloat(); } else { @@ -53,7 +53,7 @@ void CScannableObjectInfo::Load(CInputStream& in, u32 version) { } CScannableObjectInfo::SBucket::SBucket(CInputStream& in, u32 version) { - x0_texture = in.ReadLong(); + x0_texture = in.Get(); x4_appearanceRange = in.ReadFloat(); x8_imagePos = in.ReadLong(); if (version > 1) { diff --git a/Runtime/CScriptMailbox.hpp b/Runtime/CScriptMailbox.hpp index db02b3078..658a1b100 100644 --- a/Runtime/CScriptMailbox.hpp +++ b/Runtime/CScriptMailbox.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" #include "Runtime/World/ScriptObjectSupport.hpp" diff --git a/Runtime/CStringExtras.cpp b/Runtime/CStringExtras.cpp index 6d50ab1b0..ee2ee01e4 100644 --- a/Runtime/CStringExtras.cpp +++ b/Runtime/CStringExtras.cpp @@ -1,5 +1,5 @@ #include "Runtime/CStringExtras.hpp" -#include "Runtime/CInputStream.hpp" +#include "Runtime/Streams/CInputStream.hpp" namespace metaforce { std::string CStringExtras::ReadString(CInputStream& in) { diff --git a/Runtime/CWorldSaveGameInfo.cpp b/Runtime/CWorldSaveGameInfo.cpp index aec5b9cf9..43200231c 100644 --- a/Runtime/CWorldSaveGameInfo.cpp +++ b/Runtime/CWorldSaveGameInfo.cpp @@ -46,7 +46,7 @@ CWorldSaveGameInfo::CWorldSaveGameInfo(CInputStream& in) { x44_scans.reserve(scanCount); for (u32 i = 0; i < scanCount; ++i) { SScanState& st = x44_scans.emplace_back(); - st.x0_id = in.ReadLong(); + st.x0_id = in.Get(); st.x4_category = EScanCategory(in.ReadLong()); } } diff --git a/Runtime/Camera/CCameraFilter.cpp b/Runtime/Camera/CCameraFilter.cpp index f6028b113..e77d87b51 100644 --- a/Runtime/Camera/CCameraFilter.cpp +++ b/Runtime/Camera/CCameraFilter.cpp @@ -100,7 +100,7 @@ void CCameraFilterPass::SetFilter(EFilterType type, EFilterShape shape, float template void CCameraFilterPass::DisableFilter(float time) { - SetFilter(EFilterType::Passthru, x8_shape, time, zeus::skWhite, -1); + SetFilter(EFilterType::Passthru, x8_shape, time, zeus::skWhite, {}); } template diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index 70eec0884..85b6464f5 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -16,7 +16,7 @@ CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf nearz, farz, aspect, watchedObj, false, 0) , x188_orbitCameraSpeed(orbitCameraSpeed) , x190_gunFollowXf(xf) { - DataSpec::DNAMP1::tw_FieldOfView->addListener([this](hecl::CVar* cv) { _fovListener(cv); }); + MP1::tw_FieldOfView->addListener([this](hecl::CVar* cv) { _fovListener(cv); }); } void CFirstPersonCamera::Accept(IVisitor& visitor) { visitor.Visit(this); } diff --git a/Runtime/Character/CAdditiveAnimPlayback.hpp b/Runtime/Character/CAdditiveAnimPlayback.hpp index 80baee67d..27fb1ae68 100644 --- a/Runtime/Character/CAdditiveAnimPlayback.hpp +++ b/Runtime/Character/CAdditiveAnimPlayback.hpp @@ -2,7 +2,7 @@ #include #include "Runtime/RetroTypes.hpp" -#include "Runtime/CInputStream.hpp" +#include "Runtime/Streams/CInputStream.hpp" namespace metaforce { class CAdditiveAnimationInfo; diff --git a/Runtime/Character/CAnimData.cpp b/Runtime/Character/CAnimData.cpp index 151744995..c598a3f77 100644 --- a/Runtime/Character/CAnimData.cpp +++ b/Runtime/Character/CAnimData.cpp @@ -483,7 +483,7 @@ float CAnimData::GetAnimationDuration(int animIn) const { std::set prims; anim->GetUniquePrimitives(prims); - SObjectTag tag{FOURCC('ANIM'), 0}; + SObjectTag tag{FOURCC('ANIM'), {}}; float durAccum = 0.f; for (const CPrimitive& prim : prims) { tag.id = prim.GetAnimResId(); @@ -586,7 +586,7 @@ void CAnimData::PrimitiveSetToTokenVector(const std::set& primSet, s bool preLock) { tokensOut.reserve(primSet.size()); - SObjectTag tag{FOURCC('ANIM'), 0}; + SObjectTag tag{FOURCC('ANIM'), {}}; for (const CPrimitive& prim : primSet) { tag.id = prim.GetAnimResId(); tokensOut.push_back(g_SimplePool->GetObj(tag)); @@ -817,7 +817,7 @@ float CAnimData::GetAverageVelocity(int animIn) const { std::set prims; anim->GetUniquePrimitives(prims); - SObjectTag tag{FOURCC('ANIM'), 0}; + SObjectTag tag{FOURCC('ANIM'), {}}; float velAccum = 0.f; float durAccum = 0.f; for (const CPrimitive& prim : prims) { diff --git a/Runtime/Character/CAnimSource.cpp b/Runtime/Character/CAnimSource.cpp index fc9e18281..689bf6380 100644 --- a/Runtime/Character/CAnimSource.cpp +++ b/Runtime/Character/CAnimSource.cpp @@ -108,7 +108,7 @@ CAnimSource::CAnimSource(CInputStream& in, IObjectStore& store) , x20_rotationChannels(ReadIndexTable(in)) , x30_translationChannels(ReadIndexTable(in)) , x40_data(RotationAndOffsetStorage::CRotationAndOffsetVectors(in), x10_frameCount) -, x54_evntId(in.ReadLong()) { +, x54_evntId(in) { if (x54_evntId.IsValid()) { x58_evntData = store.GetObj({SBIG('EVNT'), x54_evntId}); x58_evntData.GetObj(); diff --git a/Runtime/Character/CAnimation.hpp b/Runtime/Character/CAnimation.hpp index 696d7e1cb..1c04f40e6 100644 --- a/Runtime/Character/CAnimation.hpp +++ b/Runtime/Character/CAnimation.hpp @@ -3,7 +3,7 @@ #include #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CMetaAnimFactory.hpp" namespace metaforce { diff --git a/Runtime/Character/CAnimationSet.cpp b/Runtime/Character/CAnimationSet.cpp index 68f5be3ee..135658004 100644 --- a/Runtime/Character/CAnimationSet.cpp +++ b/Runtime/Character/CAnimationSet.cpp @@ -38,8 +38,8 @@ CAnimationSet::CAnimationSet(CInputStream& in) : x0_tableCount(in.ReadShort()) { u32 animResourcesCount = in.ReadLong(); x50_animRes.reserve(animResourcesCount); for (u32 i = 0; i < animResourcesCount; ++i) { - CAssetId anim = in.ReadLong(); - CAssetId evnt = in.ReadLong(); + CAssetId anim = in.Get(); + CAssetId evnt = in.Get(); x50_animRes.emplace_back(anim, evnt); } } diff --git a/Runtime/Character/CAnimationSet.hpp b/Runtime/Character/CAnimationSet.hpp index 18cdd5e0a..10688dcc0 100644 --- a/Runtime/Character/CAnimationSet.hpp +++ b/Runtime/Character/CAnimationSet.hpp @@ -4,7 +4,7 @@ #include #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" #include "Runtime/Character/CAdditiveAnimPlayback.hpp" #include "Runtime/Character/CAnimation.hpp" diff --git a/Runtime/Character/CCharAnimTime.hpp b/Runtime/Character/CCharAnimTime.hpp index 0f38dc46e..e1ec7991f 100644 --- a/Runtime/Character/CCharAnimTime.hpp +++ b/Runtime/Character/CCharAnimTime.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #undef min #undef max diff --git a/Runtime/Character/CCharLayoutInfo.hpp b/Runtime/Character/CCharLayoutInfo.hpp index 1678f3281..70641e8b8 100644 --- a/Runtime/Character/CCharLayoutInfo.hpp +++ b/Runtime/Character/CCharLayoutInfo.hpp @@ -6,7 +6,7 @@ #include #include "Runtime/CFactoryMgr.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CSegId.hpp" #include "Runtime/Character/CSegIdList.hpp" #include "Runtime/Character/TSegIdMap.hpp" diff --git a/Runtime/Character/CCharacterInfo.cpp b/Runtime/Character/CCharacterInfo.cpp index 0ce8908a9..02b965a0e 100644 --- a/Runtime/Character/CCharacterInfo.cpp +++ b/Runtime/Character/CCharacterInfo.cpp @@ -1,5 +1,5 @@ #include "Runtime/Character/CCharacterInfo.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" namespace metaforce { @@ -47,9 +47,9 @@ static std::vector>> MakeAnim CCharacterInfo::CCharacterInfo(CInputStream& in) : x0_tableCount(in.ReadShort()) , x4_name(in.Get()) -, x14_cmdl(in.ReadLong()) -, x18_cskr(in.ReadLong()) -, x1c_cinf(in.ReadLong()) +, x14_cmdl(in) +, x18_cskr(in) +, x1c_cinf(in) , x20_animInfo(MakeAnimInfoVector(in)) , x30_pasDatabase(in) , x44_partRes(in, x0_tableCount) @@ -80,8 +80,8 @@ CCharacterInfo::CCharacterInfo(CInputStream& in) } if (x0_tableCount > 3) { - xa8_cmdlOverlay = in.ReadLong(); - xac_cskrOverlay = in.ReadLong(); + xa8_cmdlOverlay = in.Get(); + xac_cskrOverlay = in.Get(); } if (x0_tableCount > 4) { diff --git a/Runtime/Character/CCharacterInfo.hpp b/Runtime/Character/CCharacterInfo.hpp index 81dd92902..0ba54758c 100644 --- a/Runtime/Character/CCharacterInfo.hpp +++ b/Runtime/Character/CCharacterInfo.hpp @@ -4,7 +4,7 @@ #include #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" #include "Runtime/Character/CEffectComponent.hpp" #include "Runtime/Character/CPASDatabase.hpp" @@ -41,8 +41,8 @@ private: std::vector> x88_aabbs; std::vector>> x98_effects; - CAssetId xa8_cmdlOverlay = 0; - CAssetId xac_cskrOverlay = 0; + CAssetId xa8_cmdlOverlay; + CAssetId xac_cskrOverlay; std::vector xb0_animIdxs; diff --git a/Runtime/Character/CCharacterSet.hpp b/Runtime/Character/CCharacterSet.hpp index 2addb1bc7..fc1fc4ec3 100644 --- a/Runtime/Character/CCharacterSet.hpp +++ b/Runtime/Character/CCharacterSet.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/GCNTypes.hpp" #include "Runtime/Character/CCharacterInfo.hpp" diff --git a/Runtime/Character/CEffectComponent.hpp b/Runtime/Character/CEffectComponent.hpp index 856d33ab1..b691680ed 100644 --- a/Runtime/Character/CEffectComponent.hpp +++ b/Runtime/Character/CEffectComponent.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" #include "Runtime/Character/CParticleData.hpp" diff --git a/Runtime/Character/CFBStreamedCompression.cpp b/Runtime/Character/CFBStreamedCompression.cpp index 4b18c7afb..f1aaade56 100644 --- a/Runtime/Character/CFBStreamedCompression.cpp +++ b/Runtime/Character/CFBStreamedCompression.cpp @@ -24,7 +24,7 @@ void WriteValue(u8* data, T value) { CFBStreamedCompression::CFBStreamedCompression(CInputStream& in, IObjectStore& objStore, bool pc) : m_pc(pc) { x0_scratchSize = in.ReadLong(); - x4_evnt = in.ReadLong(); + x4_evnt = in.Get(); xc_rotsAndOffs = GetRotationsAndOffsets(x0_scratchSize / 4 + 1, in); diff --git a/Runtime/Character/CHalfTransition.hpp b/Runtime/Character/CHalfTransition.hpp index 6d6150fb3..f653ff1cf 100644 --- a/Runtime/Character/CHalfTransition.hpp +++ b/Runtime/Character/CHalfTransition.hpp @@ -3,7 +3,7 @@ #include #include "Runtime/GCNTypes.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/IMetaTrans.hpp" namespace metaforce { diff --git a/Runtime/Character/CMetaAnimBlend.hpp b/Runtime/Character/CMetaAnimBlend.hpp index 8b9997465..ef1d7de9b 100644 --- a/Runtime/Character/CMetaAnimBlend.hpp +++ b/Runtime/Character/CMetaAnimBlend.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/IMetaAnim.hpp" namespace metaforce { diff --git a/Runtime/Character/CMetaAnimFactory.hpp b/Runtime/Character/CMetaAnimFactory.hpp index 8f2d423ee..ea43d0683 100644 --- a/Runtime/Character/CMetaAnimFactory.hpp +++ b/Runtime/Character/CMetaAnimFactory.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/IMetaAnim.hpp" namespace metaforce { diff --git a/Runtime/Character/CMetaAnimPhaseBlend.hpp b/Runtime/Character/CMetaAnimPhaseBlend.hpp index df612b3c2..d798f745d 100644 --- a/Runtime/Character/CMetaAnimPhaseBlend.hpp +++ b/Runtime/Character/CMetaAnimPhaseBlend.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/IMetaAnim.hpp" namespace metaforce { diff --git a/Runtime/Character/CMetaAnimPlay.hpp b/Runtime/Character/CMetaAnimPlay.hpp index 0508ea1ee..2134bdfc4 100644 --- a/Runtime/Character/CMetaAnimPlay.hpp +++ b/Runtime/Character/CMetaAnimPlay.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CPrimitive.hpp" #include "Runtime/Character/IMetaAnim.hpp" diff --git a/Runtime/Character/CMetaAnimRandom.hpp b/Runtime/Character/CMetaAnimRandom.hpp index 272c01bb6..cf59ebfdc 100644 --- a/Runtime/Character/CMetaAnimRandom.hpp +++ b/Runtime/Character/CMetaAnimRandom.hpp @@ -4,7 +4,7 @@ #include #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/IMetaAnim.hpp" namespace metaforce { diff --git a/Runtime/Character/CMetaAnimSequence.hpp b/Runtime/Character/CMetaAnimSequence.hpp index f937cce8c..a4d176b9c 100644 --- a/Runtime/Character/CMetaAnimSequence.hpp +++ b/Runtime/Character/CMetaAnimSequence.hpp @@ -3,7 +3,7 @@ #include #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/IMetaAnim.hpp" namespace metaforce { diff --git a/Runtime/Character/CMetaTransFactory.hpp b/Runtime/Character/CMetaTransFactory.hpp index 503c8331f..b3a80159c 100644 --- a/Runtime/Character/CMetaTransFactory.hpp +++ b/Runtime/Character/CMetaTransFactory.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/IMetaTrans.hpp" namespace metaforce { diff --git a/Runtime/Character/CMetaTransMetaAnim.hpp b/Runtime/Character/CMetaTransMetaAnim.hpp index 55400a798..201bef08f 100644 --- a/Runtime/Character/CMetaTransMetaAnim.hpp +++ b/Runtime/Character/CMetaTransMetaAnim.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/IMetaAnim.hpp" #include "Runtime/Character/IMetaTrans.hpp" diff --git a/Runtime/Character/CMetaTransPhaseTrans.hpp b/Runtime/Character/CMetaTransPhaseTrans.hpp index 08fd2ba98..695824d0a 100644 --- a/Runtime/Character/CMetaTransPhaseTrans.hpp +++ b/Runtime/Character/CMetaTransPhaseTrans.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CCharAnimTime.hpp" #include "Runtime/Character/IMetaTrans.hpp" diff --git a/Runtime/Character/CMetaTransSnap.hpp b/Runtime/Character/CMetaTransSnap.hpp index 091b73f68..5a000bae4 100644 --- a/Runtime/Character/CMetaTransSnap.hpp +++ b/Runtime/Character/CMetaTransSnap.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/IMetaTrans.hpp" namespace metaforce { diff --git a/Runtime/Character/CMetaTransTrans.hpp b/Runtime/Character/CMetaTransTrans.hpp index 5a0b0f2a7..a2e5def1c 100644 --- a/Runtime/Character/CMetaTransTrans.hpp +++ b/Runtime/Character/CMetaTransTrans.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CCharAnimTime.hpp" #include "Runtime/Character/IMetaTrans.hpp" diff --git a/Runtime/Character/CModelData.hpp b/Runtime/Character/CModelData.hpp index 304dbfe82..54b1060b0 100644 --- a/Runtime/Character/CModelData.hpp +++ b/Runtime/Character/CModelData.hpp @@ -23,7 +23,7 @@ struct CModelFlags; struct SAdvancementDeltas; class CStaticRes { - CAssetId x0_cmdlId = 0; + CAssetId x0_cmdlId; zeus::CVector3f x4_scale; public: diff --git a/Runtime/Character/CPASAnimInfo.hpp b/Runtime/Character/CPASAnimInfo.hpp index bcf3f17fd..ff10e4edd 100644 --- a/Runtime/Character/CPASAnimInfo.hpp +++ b/Runtime/Character/CPASAnimInfo.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/rstl.hpp" #include "Runtime/Character/CPASAnimParm.hpp" diff --git a/Runtime/Character/CPASAnimState.hpp b/Runtime/Character/CPASAnimState.hpp index 98c258acc..c32329f14 100644 --- a/Runtime/Character/CPASAnimState.hpp +++ b/Runtime/Character/CPASAnimState.hpp @@ -3,7 +3,7 @@ #include #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CharacterCommon.hpp" #include "Runtime/Character/CPASAnimInfo.hpp" #include "Runtime/Character/CPASParmInfo.hpp" diff --git a/Runtime/Character/CPASDatabase.hpp b/Runtime/Character/CPASDatabase.hpp index ddd7d786d..377de5fab 100644 --- a/Runtime/Character/CPASDatabase.hpp +++ b/Runtime/Character/CPASDatabase.hpp @@ -4,7 +4,7 @@ #include #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CPASAnimState.hpp" namespace metaforce { diff --git a/Runtime/Character/CPASParmInfo.hpp b/Runtime/Character/CPASParmInfo.hpp index 6b10b5dd0..2254be364 100644 --- a/Runtime/Character/CPASParmInfo.hpp +++ b/Runtime/Character/CPASParmInfo.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CPASAnimParm.hpp" namespace metaforce { diff --git a/Runtime/Character/CPOINode.hpp b/Runtime/Character/CPOINode.hpp index c7e2bdbff..1ff7dd796 100644 --- a/Runtime/Character/CPOINode.hpp +++ b/Runtime/Character/CPOINode.hpp @@ -3,7 +3,7 @@ #include #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CCharAnimTime.hpp" namespace metaforce { diff --git a/Runtime/Character/CParticleData.hpp b/Runtime/Character/CParticleData.hpp index 80f14dbd7..c74836b2e 100644 --- a/Runtime/Character/CParticleData.hpp +++ b/Runtime/Character/CParticleData.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" #include diff --git a/Runtime/Character/CPrimitive.cpp b/Runtime/Character/CPrimitive.cpp index feb436ce0..8963e19f4 100644 --- a/Runtime/Character/CPrimitive.cpp +++ b/Runtime/Character/CPrimitive.cpp @@ -3,7 +3,7 @@ namespace metaforce { CPrimitive::CPrimitive(CInputStream& in) { - x0_animId = in.ReadLong(); + x0_animId = in.Get(); x4_animIdx = in.ReadLong(); x8_animName = in.Get(); } diff --git a/Runtime/Character/CPrimitive.hpp b/Runtime/Character/CPrimitive.hpp index 0fcf01c49..4ea7eefda 100644 --- a/Runtime/Character/CPrimitive.hpp +++ b/Runtime/Character/CPrimitive.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" namespace metaforce { diff --git a/Runtime/Character/CSegId.hpp b/Runtime/Character/CSegId.hpp index 2611e60ba..8b3d83828 100644 --- a/Runtime/Character/CSegId.hpp +++ b/Runtime/Character/CSegId.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" namespace metaforce { diff --git a/Runtime/Character/CSegIdList.hpp b/Runtime/Character/CSegIdList.hpp index 8ff76daa3..079973e6d 100644 --- a/Runtime/Character/CSegIdList.hpp +++ b/Runtime/Character/CSegIdList.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CSegId.hpp" namespace metaforce { diff --git a/Runtime/Character/CSkinBank.hpp b/Runtime/Character/CSkinBank.hpp index 843a12c1e..8d0236cd7 100644 --- a/Runtime/Character/CSkinBank.hpp +++ b/Runtime/Character/CSkinBank.hpp @@ -2,7 +2,7 @@ #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CSegId.hpp" namespace metaforce { diff --git a/Runtime/Character/CTransition.hpp b/Runtime/Character/CTransition.hpp index 8a062f03f..c79209a1b 100644 --- a/Runtime/Character/CTransition.hpp +++ b/Runtime/Character/CTransition.hpp @@ -3,7 +3,7 @@ #include #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Character/CMetaTransFactory.hpp" namespace metaforce { diff --git a/Runtime/Collision/CAreaOctTree.cpp b/Runtime/Collision/CAreaOctTree.cpp index 11804b718..7b700b963 100644 --- a/Runtime/Collision/CAreaOctTree.cpp +++ b/Runtime/Collision/CAreaOctTree.cpp @@ -1,7 +1,8 @@ #include "Runtime/Collision/CAreaOctTree.hpp" +#include "Runtime/CBasics.hpp" #include "Runtime/Collision/CMaterialFilter.hpp" -#include "IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include #include @@ -479,27 +480,27 @@ CAreaOctTree::Node CAreaOctTree::Node::GetChild(int idx) const { void CAreaOctTree::SwapTreeNode(u8* ptr, Node::ETreeType type) { if (type == Node::ETreeType::Branch) { u16* typeBits = reinterpret_cast(ptr); - *typeBits = hecl::SBig(*typeBits); + *typeBits = CBasics::SwapBytes(*typeBits); u32* offsets = reinterpret_cast(ptr + 4); for (int i = 0; i < 8; ++i) { Node::ETreeType ctype = Node::ETreeType((*typeBits >> (2 * i)) & 0x3); - offsets[i] = hecl::SBig(offsets[i]); + offsets[i] = CBasics::SwapBytes(offsets[i]); SwapTreeNode(ptr + offsets[i] + 36, ctype); } } else if (type == Node::ETreeType::Leaf) { float* aabb = reinterpret_cast(ptr); - aabb[0] = hecl::SBig(aabb[0]); - aabb[1] = hecl::SBig(aabb[1]); - aabb[2] = hecl::SBig(aabb[2]); - aabb[3] = hecl::SBig(aabb[3]); - aabb[4] = hecl::SBig(aabb[4]); - aabb[5] = hecl::SBig(aabb[5]); + aabb[0] = CBasics::SwapBytes(aabb[0]); + aabb[1] = CBasics::SwapBytes(aabb[1]); + aabb[2] = CBasics::SwapBytes(aabb[2]); + aabb[3] = CBasics::SwapBytes(aabb[3]); + aabb[4] = CBasics::SwapBytes(aabb[4]); + aabb[5] = CBasics::SwapBytes(aabb[5]); u16* countIdxs = reinterpret_cast(ptr + 24); - *countIdxs = hecl::SBig(*countIdxs); + *countIdxs = CBasics::SwapBytes(*countIdxs); for (u16 i = 0; i < *countIdxs; ++i) - countIdxs[i + 1] = hecl::SBig(countIdxs[i + 1]); + countIdxs[i + 1] = CBasics::SwapBytes(countIdxs[i + 1]); } } @@ -525,16 +526,16 @@ CAreaOctTree::CAreaOctTree(const zeus::CAABox& aabb, Node::ETreeType treeType, c SwapTreeNode(const_cast(x20_treeBuf), treeType); for (u32 i = 0; i < matCount; ++i) - const_cast(x28_materials)[i] = hecl::SBig(x28_materials[i]); + const_cast(x28_materials)[i] = CBasics::SwapBytes(x28_materials[i]); for (u32 i = 0; i < edgeCount; ++i) const_cast(x3c_edges)[i].swapBig(); for (u32 i = 0; i < polyCount; ++i) - const_cast(x44_polyEdges)[i] = hecl::SBig(x44_polyEdges[i]); + const_cast(x44_polyEdges)[i] = CBasics::SwapBytes(x44_polyEdges[i]); for (u32 i = 0; i < vertCount * 3; ++i) - const_cast(x4c_verts)[i] = hecl::SBig(x4c_verts[i]); + const_cast(x4c_verts)[i] = CBasics::SwapBytes(x4c_verts[i]); } std::unique_ptr CAreaOctTree::MakeFromMemory(const u8* buf, unsigned int size) { @@ -549,37 +550,37 @@ std::unique_ptr CAreaOctTree::MakeFromMemory(const u8* buf, unsign const u8* treeBuf = cur; cur += treeSize; - u32 matCount = hecl::SBig(*reinterpret_cast(cur)); + u32 matCount = CBasics::SwapBytes(*reinterpret_cast(cur)); cur += 4; const u32* matBuf = reinterpret_cast(cur); cur += 4 * matCount; - u32 vertMatsCount = hecl::SBig(*reinterpret_cast(cur)); + u32 vertMatsCount = CBasics::SwapBytes(*reinterpret_cast(cur)); cur += 4; const u8* vertMatsBuf = cur; cur += vertMatsCount; - u32 edgeMatsCount = hecl::SBig(*reinterpret_cast(cur)); + u32 edgeMatsCount = CBasics::SwapBytes(*reinterpret_cast(cur)); cur += 4; const u8* edgeMatsBuf = cur; cur += edgeMatsCount; - u32 polyMatsCount = hecl::SBig(*reinterpret_cast(cur)); + u32 polyMatsCount = CBasics::SwapBytes(*reinterpret_cast(cur)); cur += 4; const u8* polyMatsBuf = cur; cur += polyMatsCount; - u32 edgeCount = hecl::SBig(*reinterpret_cast(cur)); + u32 edgeCount = CBasics::SwapBytes(*reinterpret_cast(cur)); cur += 4; const CCollisionEdge* edgeBuf = reinterpret_cast(cur); cur += edgeCount * sizeof(edgeCount); - u32 polyCount = hecl::SBig(*reinterpret_cast(cur)); + u32 polyCount = CBasics::SwapBytes(*reinterpret_cast(cur)); cur += 4; const u16* polyBuf = reinterpret_cast(cur); cur += polyCount * 2; - u32 vertCount = hecl::SBig(*reinterpret_cast(cur)); + u32 vertCount = CBasics::SwapBytes(*reinterpret_cast(cur)); cur += 4; const float* vertBuf = reinterpret_cast(cur); diff --git a/Runtime/Collision/CCollidableOBBTreeGroup.hpp b/Runtime/Collision/CCollidableOBBTreeGroup.hpp index 27e43045b..8b445d69f 100644 --- a/Runtime/Collision/CCollidableOBBTreeGroup.hpp +++ b/Runtime/Collision/CCollidableOBBTreeGroup.hpp @@ -4,7 +4,7 @@ #include #include "Runtime/CFactoryMgr.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Collision/COBBTree.hpp" #include "Runtime/Collision/CCollisionPrimitive.hpp" diff --git a/Runtime/Collision/CCollisionEdge.cpp b/Runtime/Collision/CCollisionEdge.cpp index 368a6c359..aa107b558 100644 --- a/Runtime/Collision/CCollisionEdge.cpp +++ b/Runtime/Collision/CCollisionEdge.cpp @@ -1,5 +1,5 @@ #include "Runtime/Collision/CCollisionEdge.hpp" -#include "Runtime/CInputStream.hpp" +#include "Runtime/Streams/CInputStream.hpp" namespace metaforce { CCollisionEdge::CCollisionEdge(CInputStream& in) { diff --git a/Runtime/Collision/CCollisionResponseData.hpp b/Runtime/Collision/CCollisionResponseData.hpp index 351f367c4..4901e0c69 100644 --- a/Runtime/Collision/CCollisionResponseData.hpp +++ b/Runtime/Collision/CCollisionResponseData.hpp @@ -5,7 +5,7 @@ #include "Runtime/CFactoryMgr.hpp" #include "Runtime/CToken.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/IObj.hpp" #include "Runtime/RetroTypes.hpp" #include "Runtime/Collision/CMaterialList.hpp" diff --git a/Runtime/GameGlobalObjects.hpp b/Runtime/GameGlobalObjects.hpp index 7902647aa..d2774abbe 100644 --- a/Runtime/GameGlobalObjects.hpp +++ b/Runtime/GameGlobalObjects.hpp @@ -3,35 +3,37 @@ #define USE_DOWNCAST_TWEAKS 1 #if USE_DOWNCAST_TWEAKS -#include "../DataSpec/DNAMP1/Tweaks/CTweakGame.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakGui.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakGui.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakBall.hpp" -#include "../DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp" +#include "Runtime/MP1/Tweaks/CTweakAutoMapper.hpp" +#include "Runtime/MP1/Tweaks/CTweakBall.hpp" +#include "Runtime/MP1/Tweaks/CTweakGame.hpp" +#include "Runtime/MP1/Tweaks/CTweakGui.hpp" +#include "Runtime/MP1/Tweaks/CTweakGui.hpp" +#include "Runtime/MP1/Tweaks/CTweakGuiColors.hpp" +#include "Runtime/MP1/Tweaks/CTweakGunRes.hpp" +#include "Runtime/MP1/Tweaks/CTweakParticle.hpp" +#include "Runtime/MP1/Tweaks/CTweakPlayer.hpp" +#include "Runtime/MP1/Tweaks/CTweakPlayerControl.hpp" +#include "Runtime/MP1/Tweaks/CTweakPlayerGun.hpp" +#include "Runtime/MP1/Tweaks/CTweakPlayerRes.hpp" +#include "Runtime/MP1/Tweaks/CTweakSlideShow.hpp" +#include "Runtime/MP1/Tweaks/CTweakTargeting.hpp" +#include "Runtime/MP1/Tweaks/CTweakGuiColors.hpp" +#include "Runtime/MP1/Tweaks/CTweakTargeting.hpp" #else -#include "../DataSpec/DNACommon/Tweaks/ITweakGame.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakGui.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakGui.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakTargeting.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakAutoMapper.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakParticle.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakBall.hpp" -#include "../DataSpec/DNACommon/Tweaks/ITweakGuiColors.hpp" +#include "Runtime/Tweaks/ITweakAutoMapper.hpp" +#include "Runtime/Tweaks/ITweakBall.hpp" +#include "Runtime/Tweaks/ITweakGame.hpp" +#include "Runtime/Tweaks/ITweakGui.hpp" +#include "Runtime/Tweaks/ITweakGui.hpp" +#include "Runtime/Tweaks/ITweakGuiColors.hpp" +#include "Runtime/Tweaks/ITweakGunRes.hpp" +#include "Runtime/Tweaks/ITweakParticle.hpp" +#include "Runtime/Tweaks/ITweakPlayer.hpp" +#include "Runtime/Tweaks/ITweakPlayerControl.hpp" +#include "Runtime/Tweaks/ITweakPlayerGun.hpp" +#include "Runtime/Tweaks/ITweakPlayerRes.hpp" +#include "Runtime/Tweaks/ITweakSlideShow.hpp" +#include "Runtime/Tweaks/ITweakTargeting.hpp" #endif #include "Runtime/CTextureCache.hpp" @@ -55,32 +57,34 @@ extern class CInputGenerator* g_InputGenerator; extern class CStateManager* g_StateManager; #if USE_DOWNCAST_TWEAKS -using ITweakGame = DataSpec::DNAMP1::CTweakGame; -using ITweakPlayer = DataSpec::DNAMP1::CTweakPlayer; -using ITweakPlayerControl = DataSpec::DNAMP1::CTweakPlayerControl; -using ITweakPlayerGun = DataSpec::DNAMP1::CTweakPlayerGun; -using ITweakGunRes = DataSpec::DNAMP1::CTweakGunRes; -using ITweakAutoMapper = DataSpec::DNAMP1::CTweakAutoMapper; -using ITweakGui = DataSpec::DNAMP1::CTweakGui; -using ITweakSlideShow = DataSpec::DNAMP1::CTweakSlideShow; -using ITweakParticle = DataSpec::DNAMP1::CTweakParticle; -using ITweakBall = DataSpec::DNAMP1::CTweakBall; -using ITweakGuiColors = DataSpec::DNAMP1::CTweakGuiColors; +using ITweakGame = metaforce::MP1::CTweakGame; +using ITweakPlayer = metaforce::MP1::CTweakPlayer; +using ITweakPlayerControl = metaforce::MP1::CTweakPlayerControl; +using ITweakPlayerGun = metaforce::MP1::CTweakPlayerGun; +using ITweakGunRes = metaforce::MP1::CTweakGunRes; +using ITweakAutoMapper = metaforce::MP1::CTweakAutoMapper; +using ITweakGui = metaforce::MP1::CTweakGui; +using ITweakSlideShow = metaforce::MP1::CTweakSlideShow; +using ITweakParticle = metaforce::MP1::CTweakParticle; +using ITweakBall = metaforce::MP1::CTweakBall; +using ITweakGuiColors = metaforce::MP1::CTweakGuiColors; +using ITweakPlayerRes = metaforce::MP1::CTweakPlayerRes; +using ITweakTargeting = metaforce::MP1::CTweakTargeting; #else -using ITweakGame = DataSpec::ITweakGame; -using ITweakPlayer = DataSpec::ITweakPlayer; -using ITweakPlayerControl = DataSpec::ITweakPlayerControl; -using ITweakPlayerGun = DataSpec::ITweakPlayerGun; -using ITweakGunRes = DataSpec::ITweakGunRes; -using ITweakAutoMapper = DataSpec::ITweakAutoMapper; -using ITweakGui = DataSpec::ITweakGui; -using ITweakSlideShow = DataSpec::ITweakSlideShow; -using ITweakParticle = DataSpec::ITweakParticle; -using ITweakBall = DataSpec::ITweakBall; -using ITweakGuiColors = DataSpec::ITweakGuiColors; +using ITweakGame = metaforce::Tweaks::ITweakGame; +using ITweakPlayer = metaforce::Tweaks::ITweakPlayer; +using ITweakPlayerControl = metaforce::Tweaks::ITweakPlayerControl; +using ITweakPlayerGun = metaforce::Tweaks::ITweakPlayerGun; +using ITweakGunRes = metaforce::Tweaks::ITweakGunRes; +using ITweakAutoMapper = metaforce::Tweaks::ITweakAutoMapper; +using ITweakGui = metaforce::Tweaks::ITweakGui; +using ITweakSlideShow = metaforce::Tweaks::ITweakSlideShow; +using ITweakParticle = metaforce::Tweaks::ITweakParticle; +using ITweakBall = metaforce::Tweaks::ITweakBall; +using ITweakGuiColors = metaforce::Tweaks::ITweakGuiColors; +using ITweakPlayerRes = metaforce::Tweaks::ITweakPlayerRes; +using ITweakTargeting = metaforce::Tweaks::ITweakTargeting; #endif -using ITweakPlayerRes = DataSpec::ITweakPlayerRes; -using ITweakTargeting = DataSpec::ITweakTargeting; extern ITweakGame* g_tweakGame; extern ITweakPlayer* g_tweakPlayer; diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 39afbb727..4f24b4658 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -1,5 +1,6 @@ #include "Runtime/Graphics/CModel.hpp" +#include "Runtime/CBasics.hpp" #include "Runtime/CSimplePool.hpp" #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/Character/CSkinRules.hpp" @@ -13,7 +14,6 @@ #include #include -#include #include #include @@ -1118,7 +1118,7 @@ static const u8* MemoryFromPartData(const u8*& dataCur, const u32*& secSizeCur) else ret = nullptr; - dataCur += hecl::SBig(*secSizeCur); + dataCur += CBasics::SwapBytes(*secSizeCur); ++secSizeCur; return ret; } @@ -1160,20 +1160,20 @@ CModel::CModel(std::unique_ptr&& in, u32 /* dataLen */, IObjectStore* stor x38_lastFrame = CGraphics::GetFrameCounter() - 2; std::unique_ptr data = std::move(in); - u32 version = hecl::SBig(*reinterpret_cast(data.get() + 0x4)); - m_flags = hecl::SBig(*reinterpret_cast(data.get() + 0x8)); + u32 version = CBasics::SwapBytes(*reinterpret_cast(data.get() + 0x4)); + m_flags = CBasics::SwapBytes(*reinterpret_cast(data.get() + 0x8)); if (version != 0x10002) { Log.report(logvisor::Error, FMT_STRING("invalid CMDL for loading with boo")); return; } - u32 secCount = hecl::SBig(*reinterpret_cast(data.get() + 0x24)); - u32 matSetCount = hecl::SBig(*reinterpret_cast(data.get() + 0x28)); + u32 secCount = CBasics::SwapBytes(*reinterpret_cast(data.get() + 0x24)); + u32 matSetCount = CBasics::SwapBytes(*reinterpret_cast(data.get() + 0x28)); x18_matSets.reserve(matSetCount); const u8* dataCur = data.get() + ROUND_UP_32(0x2c + secCount * 4); const u32* secSizeCur = reinterpret_cast(data.get() + 0x2c); for (u32 i = 0; i < matSetCount; ++i) { - const u32 matSetSz = hecl::SBig(*secSizeCur); + const u32 matSetSz = CBasics::SwapBytes(*secSizeCur); const u8* sec = MemoryFromPartData(dataCur, secSizeCur); SShader& shader = x18_matSets.emplace_back(i); athena::io::MemoryReader r(sec, matSetSz); @@ -1182,7 +1182,7 @@ CModel::CModel(std::unique_ptr&& in, u32 /* dataLen */, IObjectStore* stor } { - u32 hmdlSz = hecl::SBig(*secSizeCur); + u32 hmdlSz = CBasics::SwapBytes(*secSizeCur); const u8* hmdlMetadata = MemoryFromPartData(dataCur, secSizeCur); athena::io::MemoryReader r(hmdlMetadata, hmdlSz); m_hmdlMeta.read(r); @@ -1218,10 +1218,10 @@ CModel::CModel(std::unique_ptr&& in, u32 /* dataLen */, IObjectStore* stor // return true; // } BooTrace); - const u32 surfCount = hecl::SBig(*reinterpret_cast(surfInfo)); + const u32 surfCount = CBasics::SwapBytes(*reinterpret_cast(surfInfo)); x8_surfaces.reserve(surfCount); for (u32 i = 0; i < surfCount; ++i) { - const u32 surfSz = hecl::SBig(*secSizeCur); + const u32 surfSz = CBasics::SwapBytes(*secSizeCur); const u8* sec = MemoryFromPartData(dataCur, secSizeCur); CBooSurface& surf = x8_surfaces.emplace_back(); surf.selfIdx = i; @@ -1230,8 +1230,8 @@ CModel::CModel(std::unique_ptr&& in, u32 /* dataLen */, IObjectStore* stor } const float* aabbPtr = reinterpret_cast(data.get() + 0xc); - m_aabb = zeus::CAABox(hecl::SBig(aabbPtr[0]), hecl::SBig(aabbPtr[1]), hecl::SBig(aabbPtr[2]), hecl::SBig(aabbPtr[3]), - hecl::SBig(aabbPtr[4]), hecl::SBig(aabbPtr[5])); + m_aabb = zeus::CAABox(CBasics::SwapBytes(aabbPtr[0]), CBasics::SwapBytes(aabbPtr[1]), CBasics::SwapBytes(aabbPtr[2]), CBasics::SwapBytes(aabbPtr[3]), + CBasics::SwapBytes(aabbPtr[4]), CBasics::SwapBytes(aabbPtr[5])); x28_modelInst = MakeNewInstance(0, false); } diff --git a/Runtime/Graphics/CPVSAreaSet.cpp b/Runtime/Graphics/CPVSAreaSet.cpp index cf51a1a2a..fd5bfc4bf 100644 --- a/Runtime/Graphics/CPVSAreaSet.cpp +++ b/Runtime/Graphics/CPVSAreaSet.cpp @@ -1,5 +1,5 @@ #include "Runtime/Graphics/CPVSAreaSet.hpp" -#include "IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" namespace metaforce { diff --git a/Runtime/Graphics/CPVSVisOctree.cpp b/Runtime/Graphics/CPVSVisOctree.cpp index 643407584..5f04fa6e4 100644 --- a/Runtime/Graphics/CPVSVisOctree.cpp +++ b/Runtime/Graphics/CPVSVisOctree.cpp @@ -1,5 +1,5 @@ #include "Runtime/Graphics/CPVSVisOctree.hpp" -#include "IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include diff --git a/Runtime/Graphics/CTexture.hpp b/Runtime/Graphics/CTexture.hpp index 7c2a87a02..9637d8141 100644 --- a/Runtime/Graphics/CTexture.hpp +++ b/Runtime/Graphics/CTexture.hpp @@ -6,7 +6,7 @@ #include "Runtime/CFactoryMgr.hpp" #include "Runtime/GCNTypes.hpp" #include "Runtime/IObj.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Graphics/CGraphics.hpp" //#include diff --git a/Runtime/Graphics/CTextureBoo.cpp b/Runtime/Graphics/CTextureBoo.cpp index b91255ecf..dae5cbf5f 100644 --- a/Runtime/Graphics/CTextureBoo.cpp +++ b/Runtime/Graphics/CTextureBoo.cpp @@ -2,11 +2,12 @@ #include +#include "Runtime/CBasics.hpp" #include "Runtime/CSimplePool.hpp" -#include "Runtime/CToken.hpp" -#include "Runtime/Graphics/CGraphics.hpp" #include "Runtime/CTextureCache.hpp" +#include "Runtime/CToken.hpp" #include "Runtime/GameGlobalObjects.hpp" +#include "Runtime/Graphics/CGraphics.hpp" namespace metaforce { namespace { @@ -507,8 +508,8 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in, aurora::zstring_view label) { std::array source; in.Get(reinterpret_cast(source.data()), sizeof(source)); for (size_t x = 0; x < source.size(); ++x) { - target[x].color1 = hecl::SBig(source[x].color1); - target[x].color2 = hecl::SBig(source[x].color2); + target[x].color1 = CBasics::SwapBytes(source[x].color1); + target[x].color2 = CBasics::SwapBytes(source[x].color2); for (size_t i = 0; i < 4; ++i) { std::array ind; const u8 packed = source[x].lines[i]; @@ -551,7 +552,7 @@ void CTexture::BuildC8(const void* data, size_t length, aurora::zstring_view lab if (texelCount > length) Log.report(logvisor::Fatal, FMT_STRING("insufficient TXTR length ({}/{})"), length, texelCount); - uint32_t nentries = hecl::SBig(*reinterpret_cast(data)); + uint32_t nentries = CBasics::SwapBytes(*reinterpret_cast(data)); const u8* paletteTexels = reinterpret_cast(data) + 4; const u8* texels = reinterpret_cast(data) + 4 + nentries * 4; m_paletteTex = aurora::gfx::new_static_texture_2d(nentries, 1, 1, aurora::gfx::TextureFormat::RGBA8, @@ -581,7 +582,7 @@ void CTexture::BuildC8Font(const void* data, EFontType ftype, aurora::zstring_vi break; } - const uint32_t nentries = hecl::SBig(*reinterpret_cast(data)); + const uint32_t nentries = CBasics::SwapBytes(*reinterpret_cast(data)); const u8* texels = reinterpret_cast(data) + 4 + nentries * 4; auto buf = std::make_unique(texelCount * layerCount); @@ -823,9 +824,9 @@ std::unique_ptr CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f const RGBA8* source = sourceMip + (x6_h - (baseY + y) - 1) * w + baseX; for (int x = 0; x < 4; ++x) { if (source[x].a == 0xff) { - *texel++ = hecl::SBig(u16((source[x].r >> 3 << 10) | (source[x].g >> 3 << 5) | (source[x].b >> 3))); + *texel++ = CBasics::SwapBytes(u16((source[x].r >> 3 << 10) | (source[x].g >> 3 << 5) | (source[x].b >> 3))); } else { - *texel++ = hecl::SBig(u16((source[x].r >> 4 << 8) | (source[x].g >> 4 << 4) | (source[x].b >> 4) | + *texel++ = CBasics::SwapBytes(u16((source[x].r >> 4 << 8) | (source[x].g >> 4 << 4) | (source[x].b >> 4) | (source[x].a >> 5 << 12))); } } @@ -843,7 +844,7 @@ std::unique_ptr CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f int w = x4_w; int h = x6_h; const u8* data = m_otex.get() + 12; - u32 nentries = hecl::SBig(*reinterpret_cast(data)); + u32 nentries = CBasics::SwapBytes(*reinterpret_cast(data)); const RGBA8* paletteTexels = reinterpret_cast(data + 4); const u8* sourceMip = data + 4 + nentries * 4; @@ -854,9 +855,9 @@ std::unique_ptr CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f } else { const RGBA8& colorIn = paletteTexels[i]; if (colorIn.a == 0xff) { - color = hecl::SBig(u16((colorIn.r >> 3 << 10) | (colorIn.g >> 3 << 5) | (colorIn.b >> 3) | 0x8000)); + color = CBasics::SwapBytes(u16((colorIn.r >> 3 << 10) | (colorIn.g >> 3 << 5) | (colorIn.b >> 3) | 0x8000)); } else { - color = hecl::SBig( + color = CBasics::SwapBytes( u16((colorIn.r >> 4 << 8) | (colorIn.g >> 4 << 4) | (colorIn.b >> 4) | (colorIn.a >> 5 << 12))); } } diff --git a/Runtime/GuiSys/CAuiEnergyBarT01.cpp b/Runtime/GuiSys/CAuiEnergyBarT01.cpp index d255a729b..10e474b98 100644 --- a/Runtime/GuiSys/CAuiEnergyBarT01.cpp +++ b/Runtime/GuiSys/CAuiEnergyBarT01.cpp @@ -142,7 +142,7 @@ void CAuiEnergyBarT01::SetMaxEnergy(float maxEnergy) { std::shared_ptr CAuiEnergyBarT01::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - CAssetId tex = in.ReadLong(); + CAssetId tex = in.Get(); std::shared_ptr ret = std::make_shared(parms, sp, tex); ret->ParseBaseInfo(frame, in, parms); return ret; diff --git a/Runtime/GuiSys/CAuiImagePane.cpp b/Runtime/GuiSys/CAuiImagePane.cpp index 43252d022..f823d1846 100644 --- a/Runtime/GuiSys/CAuiImagePane.cpp +++ b/Runtime/GuiSys/CAuiImagePane.cpp @@ -29,7 +29,7 @@ std::shared_ptr CAuiImagePane::Create(CGuiFrame* frame, CInputStream for (u32 i = 0; i < uvCount; ++i) uvs.push_back(in.Get()); std::shared_ptr ret = - std::make_shared(parms, sp, -1, -1, std::move(coords), std::move(uvs), true); + std::make_shared(parms, sp, CAssetId(), CAssetId(), std::move(coords), std::move(uvs), true); ret->ParseBaseInfo(frame, in, parms); return ret; } diff --git a/Runtime/GuiSys/CGuiSys.hpp b/Runtime/GuiSys/CGuiSys.hpp index 5ce5036d8..01549976e 100644 --- a/Runtime/GuiSys/CGuiSys.hpp +++ b/Runtime/GuiSys/CGuiSys.hpp @@ -5,7 +5,7 @@ #include #include -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/GuiSys/CSaveableState.hpp" #include diff --git a/Runtime/GuiSys/CGuiWidget.hpp b/Runtime/GuiSys/CGuiWidget.hpp index add4c810a..26a81889f 100644 --- a/Runtime/GuiSys/CGuiWidget.hpp +++ b/Runtime/GuiSys/CGuiWidget.hpp @@ -5,7 +5,7 @@ #include #include "Runtime/GCNTypes.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/GuiSys/CGuiObject.hpp" #include diff --git a/Runtime/GuiSys/CHudEnergyInterface.cpp b/Runtime/GuiSys/CHudEnergyInterface.cpp index abfeab6bd..f1587be8f 100644 --- a/Runtime/GuiSys/CHudEnergyInterface.cpp +++ b/Runtime/GuiSys/CHudEnergyInterface.cpp @@ -37,8 +37,8 @@ CHudEnergyInterface::CHudEnergyInterface(CGuiFrame& selHud, float tankEnergy, in x2c_energybart01_energybar->SetCoordFunc(CoordFuncs[size_t(hudType)]); x2c_energybart01_energybar->SetTesselation(Tesselations[size_t(hudType)]); - ITweakGuiColors::VisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(int(hudType)); - ITweakGuiColors::VisorEnergyInitColors initColors = g_tweakGuiColors->GetVisorEnergyInitColors(int(hudType)); + ITweakGuiColors::SVisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(int(hudType)); + ITweakGuiColors::SVisorEnergyInitColors initColors = g_tweakGuiColors->GetVisorEnergyInitColors(int(hudType)); x20_textpane_energydigits->TextSupport().SetFontColor(initColors.digitsFont); x20_textpane_energydigits->TextSupport().SetOutlineColor(initColors.digitsOutline); @@ -100,7 +100,7 @@ void CHudEnergyInterface::Update(float dt, float energyLowPulse) { x20_textpane_energydigits->TextSupport().SetText(string); } - ITweakGuiColors::VisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(int(x0_hudType)); + ITweakGuiColors::SVisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(int(x0_hudType)); zeus::CColor emptyColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarEmptyLowEnergy() : barColors.empty; zeus::CColor filledColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarFilledLowEnergy() : barColors.filled; zeus::CColor shadowColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarShadowLowEnergy() : barColors.shadow; diff --git a/Runtime/GuiSys/CRasterFont.hpp b/Runtime/GuiSys/CRasterFont.hpp index 23c71fd32..cd848d533 100644 --- a/Runtime/GuiSys/CRasterFont.hpp +++ b/Runtime/GuiSys/CRasterFont.hpp @@ -6,7 +6,7 @@ #include "Runtime/CToken.hpp" #include "Runtime/GCNTypes.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/Graphics/CTexture.hpp" #include diff --git a/Runtime/GuiSys/CStringTable.cpp b/Runtime/GuiSys/CStringTable.cpp index eacefba90..8857670ba 100644 --- a/Runtime/GuiSys/CStringTable.cpp +++ b/Runtime/GuiSys/CStringTable.cpp @@ -1,7 +1,7 @@ #include "Runtime/GuiSys/CStringTable.hpp" #include "Runtime/CBasics.hpp" -#include "Runtime/CInputStream.hpp" +#include "Runtime/Streams/CInputStream.hpp" #include "Runtime/CToken.hpp" #include diff --git a/Runtime/ITweak.hpp b/Runtime/ITweak.hpp deleted file mode 100644 index 160d9a046..000000000 --- a/Runtime/ITweak.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -namespace metaforce { -class ITweak { -public: - virtual ~ITweak() = default; -}; -} // namespace metaforce diff --git a/Runtime/MP1/CArtifactDoll.cpp b/Runtime/MP1/CArtifactDoll.cpp index 8107a458b..2e013a848 100644 --- a/Runtime/MP1/CArtifactDoll.cpp +++ b/Runtime/MP1/CArtifactDoll.cpp @@ -31,18 +31,18 @@ constexpr std::array ArtifactPieceModels{ }; constexpr std::array ArtifactHeadScans{ - 0x32C9DDCE, // Truth - 0xB45DAF60, // Strength - 0x7F017CC5, // Elder - 0x62044C7D, // Wild - 0xA9589FD8, // Lifegiver - 0x2FCCED76, // Warrior - 0xE4903ED3, // Chozo - 0x15C68C06, // Nature - 0xDE9A5FA3, // Sun - 0xFBBE9D9A, // World - 0x30E24E3F, // Spirit - 0xB6763C91 // Newborn + 0x32C9DDCEu, // Truth + 0xB45DAF60u, // Strength + 0x7F017CC5u, // Elder + 0x62044C7Du, // Wild + 0xA9589FD8u, // Lifegiver + 0x2FCCED76u, // Warrior + 0xE4903ED3u, // Chozo + 0x15C68C06u, // Nature + 0xDE9A5FA3u, // Sun + 0xFBBE9D9Au, // World + 0x30E24E3Fu, // Spirit + 0xB6763C91u // Newborn }; constexpr zeus::CColor ArtifactPreColor{0.4f, 0.68f, 0.88f, 0.8f}; @@ -70,7 +70,7 @@ int CArtifactDoll::GetArtifactHeadScanIndex(CAssetId scanId) { CAssetId CArtifactDoll::GetArtifactHeadScanFromItemType(CPlayerState::EItemType item) { if (item < CPlayerState::EItemType::Truth || item > CPlayerState::EItemType::Newborn) { - return -1; + return {}; } return ArtifactHeadScans[size_t(item) - 29]; diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index 094d49125..c1da61542 100644 --- a/Runtime/MP1/CFrontEndUI.cpp +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -67,7 +67,7 @@ constexpr std::array FEMovies{{ {"Video/08_GBA_fileselect.thp", false}, }}; -constexpr SObjectTag g_DefaultWorldTag = {FOURCC('MLVL'), 0x158efe17}; +constexpr SObjectTag g_DefaultWorldTag = {FOURCC('MLVL'), 0x158efe17u}; constexpr std::array AudioFadeTimeA{ 0.44f, diff --git a/Runtime/MP1/CInGameGuiManager.cpp b/Runtime/MP1/CInGameGuiManager.cpp index 546c1934e..2245b5f75 100644 --- a/Runtime/MP1/CInGameGuiManager.cpp +++ b/Runtime/MP1/CInGameGuiManager.cpp @@ -631,7 +631,7 @@ void CInGameGuiManager::PauseGame(CStateManager& stateMgr, EInGameGuiState state } void CInGameGuiManager::StartFadeIn() { - xf8_camFilter.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, zeus::skBlack, -1); + xf8_camFilter.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, zeus::skBlack, {}); xf8_camFilter.DisableFilter(0.5f); } diff --git a/Runtime/MP1/CInGameGuiManager.hpp b/Runtime/MP1/CInGameGuiManager.hpp index 2173ee038..5fd86f9f4 100644 --- a/Runtime/MP1/CInGameGuiManager.hpp +++ b/Runtime/MP1/CInGameGuiManager.hpp @@ -5,7 +5,7 @@ #include #include -#include "DataSpec/DNACommon/Tweaks/ITweakGui.hpp" +#include "Runtime/Tweaks/ITweakGui.hpp" #include "Runtime/CDependencyGroup.hpp" #include "Runtime/CRandom16.hpp" @@ -43,8 +43,8 @@ class CSamusHud; class CInGameGuiManager { public: - using EHelmetVisMode = DataSpec::ITweakGui::EHelmetVisMode; - using EHudVisMode = DataSpec::ITweakGui::EHudVisMode; + using EHelmetVisMode = Tweaks::ITweakGui::EHelmetVisMode; + using EHudVisMode = Tweaks::ITweakGui::EHudVisMode; private: enum class ELoadPhase { LoadDepsGroup = 0, PreLoadDeps, LoadDeps, Done }; diff --git a/Runtime/MP1/CLogBookScreen.cpp b/Runtime/MP1/CLogBookScreen.cpp index 88c2b63aa..208ba2abe 100644 --- a/Runtime/MP1/CLogBookScreen.cpp +++ b/Runtime/MP1/CLogBookScreen.cpp @@ -212,7 +212,7 @@ void CLogBookScreen::UpdateBodyText() { void CLogBookScreen::UpdateBodyImagesAndText() { const CScannableObjectInfo* scan = x1f0_curViewScans[x1c_rightSel].first.GetObj(); for (CAuiImagePane* pane : xf0_imagePanes) { - pane->SetTextureID0(-1, g_SimplePool); + pane->SetTextureID0({}, g_SimplePool); pane->SetAnimationParms(zeus::skZero2f, 0.f, 0.f); } diff --git a/Runtime/MP1/CMFGame.cpp b/Runtime/MP1/CMFGame.cpp index 7fe8de7b0..d9ef3997a 100644 --- a/Runtime/MP1/CMFGame.cpp +++ b/Runtime/MP1/CMFGame.cpp @@ -273,10 +273,10 @@ CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader") { break; } - if (g_GameState->CurrentWorldAssetId() == 0x158EFE17 && g_GameState->CurrentWorldState().GetCurrentAreaId() == 0) { + if (g_GameState->CurrentWorldAssetId() == 0x158EFE17u && g_GameState->CurrentWorldState().GetCurrentAreaId() == 0) { const SObjectTag* strgTag = g_ResFactory->GetResourceIdByName("STRG_IntroLevelLoad"); if (strgTag) - g_GameState->GetWorldTransitionManager()->EnableTransition(-1, strgTag->id, 0, false, 0.1f, 16.f, 1.f); + g_GameState->GetWorldTransitionManager()->EnableTransition({}, strgTag->id, 0, false, 0.1f, 16.f, 1.f); } } diff --git a/Runtime/MP1/CMakeLists.txt b/Runtime/MP1/CMakeLists.txt index 910dd755f..e43c01e42 100644 --- a/Runtime/MP1/CMakeLists.txt +++ b/Runtime/MP1/CMakeLists.txt @@ -7,6 +7,19 @@ add_subdirectory(World) #endif () set(MP1_SOURCES + Tweaks/CTweakAutoMapper.hpp Tweaks/CTweakAutoMapper.cpp + Tweaks/CTweakBall.hpp Tweaks/CTweakBall.cpp + Tweaks/CTweakGame.hpp Tweaks/CTweakGame.cpp + Tweaks/CTweakGui.hpp Tweaks/CTweakGui.cpp + Tweaks/CTweakGuiColors.hpp Tweaks/CTweakGuiColors.cpp + Tweaks/CTweakGunRes.hpp Tweaks/CTweakGunRes.cpp + Tweaks/CTweakParticle.hpp Tweaks/CTweakParticle.cpp + Tweaks/CTweakPlayer.hpp Tweaks/CTweakPlayer.cpp + Tweaks/CTweakPlayerControl.hpp Tweaks/CTweakPlayerControl.cpp + Tweaks/CTweakPlayerGun.hpp Tweaks/CTweakPlayerGun.cpp + Tweaks/CTweakPlayerRes.hpp Tweaks/CTweakPlayerRes.cpp + Tweaks/CTweakSlideShow.hpp Tweaks/CTweakSlideShow.cpp + Tweaks/CTweakTargeting.hpp Tweaks/CTweakTargeting.cpp CTweaks.hpp CTweaks.cpp CInGameTweakManager.hpp CGBASupport.hpp CGBASupport.cpp diff --git a/Runtime/MP1/CMemoryCardDriver.cpp b/Runtime/MP1/CMemoryCardDriver.cpp index 203e0bddb..fbcc9675b 100644 --- a/Runtime/MP1/CMemoryCardDriver.cpp +++ b/Runtime/MP1/CMemoryCardDriver.cpp @@ -43,7 +43,7 @@ ECardResult CMemoryCardDriver::SFileInfo::FileRead() { if (x24_saveFileData.empty()) { return ECardResult::CRC_MISMATCH; } - u32 existingCrc = hecl::SBig(*reinterpret_cast(x24_saveFileData.data())); + u32 existingCrc = CBasics::SwapBytes(*reinterpret_cast(x24_saveFileData.data())); u32 newCrc = CCRC32::Calculate(x24_saveFileData.data() + 4, x24_saveFileData.size() - 4); if (existingCrc == newCrc) { u32 saveDataOff; diff --git a/Runtime/MP1/CPlayerVisor.cpp b/Runtime/MP1/CPlayerVisor.cpp index 97d43b57f..bd0e18671 100644 --- a/Runtime/MP1/CPlayerVisor.cpp +++ b/Runtime/MP1/CPlayerVisor.cpp @@ -479,7 +479,7 @@ void CPlayerVisor::UpdateCurrentVisor(float transFactor) { case CPlayerState::EPlayerVisor::Scan: { zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorHudLightMultiply(), zeus::skWhite, 1.f - transFactor); - x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, -1); + x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, CAssetId()); break; } default: @@ -501,7 +501,7 @@ void CPlayerVisor::FinishTransitionIn() { case CPlayerState::EPlayerVisor::Scan: { zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorScreenDimColor(), g_tweakGuiColors->GetScanVisorHudLightMultiply(), x2c_scanDimInterp); - x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, -1); + x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, {}); if (!x5c_visorLoopSfx) x5c_visorLoopSfx = CSfxManager::SfxStart(SFXui_visor_scan_lp, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId); @@ -527,7 +527,7 @@ void CPlayerVisor::BeginTransitionIn(const CStateManager&) { break; case CPlayerState::EPlayerVisor::Scan: CSfxManager::SfxStart(SFXui_into_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); - x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, zeus::skWhite, -1); + x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, zeus::skWhite, {}); break; case CPlayerState::EPlayerVisor::Thermal: CSfxManager::SfxStart(SFXui_into_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); @@ -618,7 +618,7 @@ void CPlayerVisor::Update(float dt, const CStateManager& mgr) { } else if (curVisor == CPlayerState::EPlayerVisor::Scan) { zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorScreenDimColor(), g_tweakGuiColors->GetScanVisorHudLightMultiply(), x2c_scanDimInterp); - x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, -1); + x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, {}); } } diff --git a/Runtime/MP1/CSamusHud.cpp b/Runtime/MP1/CSamusHud.cpp index f331b89f7..66a90b85e 100644 --- a/Runtime/MP1/CSamusHud.cpp +++ b/Runtime/MP1/CSamusHud.cpp @@ -865,7 +865,7 @@ void CSamusHud::UpdateHudDynamicLights(float dt, const CStateManager& mgr) { } } -void CSamusHud::UpdateHudDamage(float dt, const CStateManager& mgr, DataSpec::ITweakGui::EHelmetVisMode helmetVis) { +void CSamusHud::UpdateHudDamage(float dt, const CStateManager& mgr, Tweaks::ITweakGui::EHelmetVisMode helmetVis) { CPlayer& player = mgr.GetPlayer(); if (player.WasDamaged() && mgr.GetGameState() == CStateManager::EGameState::Running) x3e8_damageTIme += dt; @@ -1008,7 +1008,7 @@ void CSamusHud::UpdateStaticInterference(float dt, const CStateManager& mgr) { if (x510_staticInterp > 0.f) { zeus::CColor color = zeus::skWhite; color.a() = x510_staticInterp; - x51c_camFilter2.SetFilter(EFilterType::Blend, EFilterShape::RandomStatic, 0.f, color, -1); + x51c_camFilter2.SetFilter(EFilterType::Blend, EFilterShape::RandomStatic, 0.f, color, {}); } else { x51c_camFilter2.DisableFilter(0.f); } @@ -1191,7 +1191,7 @@ void CSamusHud::Update(float dt, const CStateManager& mgr, CInGameGuiManager::EH UpdateStaticInterference(dt, mgr); - if (helmetVis != DataSpec::ITweakGui::EHelmetVisMode::ReducedUpdate) { + if (helmetVis != Tweaks::ITweakGui::EHelmetVisMode::ReducedUpdate) { if (x2bc_nextState != EHudState::None) { UpdateEnergy(dt, mgr, false); UpdateFreeLook(dt, mgr); diff --git a/Runtime/MP1/CSamusHud.hpp b/Runtime/MP1/CSamusHud.hpp index f8ca033bb..70350a87c 100644 --- a/Runtime/MP1/CSamusHud.hpp +++ b/Runtime/MP1/CSamusHud.hpp @@ -193,7 +193,7 @@ class CSamusHud { int FindEmptyHudLightSlot(const CLight& light) const; zeus::CColor GetVisorHudLightColor(const zeus::CColor& color, const CStateManager& mgr) const; void UpdateHudDynamicLights(float dt, const CStateManager& mgr); - void UpdateHudDamage(float dt, const CStateManager& mgr, DataSpec::ITweakGui::EHelmetVisMode helmetVis); + void UpdateHudDamage(float dt, const CStateManager& mgr, Tweaks::ITweakGui::EHelmetVisMode helmetVis); void UpdateStaticSfx(CSfxHandle& handle, float& cycleTimer, u16 sfxId, float dt, float oldStaticInterp, float staticThreshold); void UpdateStaticInterference(float dt, const CStateManager& mgr); diff --git a/Runtime/MP1/CSlideShow.cpp b/Runtime/MP1/CSlideShow.cpp index 0e39f11a3..f827c7d7d 100644 --- a/Runtime/MP1/CSlideShow.cpp +++ b/Runtime/MP1/CSlideShow.cpp @@ -30,7 +30,7 @@ CSlideShow::CSlideShow() : CIOWin("SlideShow"), x130_(g_tweakSlideShow->GetX54() xf8_stickTextures.reserve(18); x108_buttonTextures.reserve(8); - SObjectTag txtrTag(FOURCC('TXTR'), 0); + SObjectTag txtrTag(FOURCC('TXTR'), CAssetId()); for (const auto& lStickId : g_tweakPlayerRes->x24_lStick) { txtrTag.id = lStickId; xf8_stickTextures.emplace_back(g_SimplePool->GetObj(txtrTag)); diff --git a/Runtime/MP1/CTweaks.cpp b/Runtime/MP1/CTweaks.cpp index 1bfdd8820..899fb32df 100644 --- a/Runtime/MP1/CTweaks.cpp +++ b/Runtime/MP1/CTweaks.cpp @@ -1,18 +1,18 @@ #include "Runtime/MP1/CTweaks.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakGui.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakBall.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp" +#include "Runtime/MP1/Tweaks/CTweakGame.hpp" +#include "Runtime/MP1/Tweaks/CTweakPlayer.hpp" +#include "Runtime/MP1/Tweaks/CTweakPlayerControl.hpp" +#include "Runtime/MP1/Tweaks/CTweakGunRes.hpp" +#include "Runtime/MP1/Tweaks/CTweakPlayerRes.hpp" +#include "Runtime/MP1/Tweaks/CTweakSlideShow.hpp" +#include "Runtime/MP1/Tweaks/CTweakAutoMapper.hpp" +#include "Runtime/MP1/Tweaks/CTweakTargeting.hpp" +#include "Runtime/MP1/Tweaks/CTweakGui.hpp" +#include "Runtime/MP1/Tweaks/CTweakParticle.hpp" +#include "Runtime/MP1/Tweaks/CTweakBall.hpp" +#include "Runtime/MP1/Tweaks/CTweakGuiColors.hpp" +#include "Runtime/MP1/Tweaks/CTweakPlayerGun.hpp" #include "Runtime/IMain.hpp" #include "Runtime/GameGlobalObjects.hpp" @@ -26,7 +26,6 @@ namespace metaforce::MP1 { static logvisor::Module Log("MP1::CTweaks"); void CTweaks::RegisterTweaks(hecl::CVarManager* cvarMgr) { -#if 0 // TODO: Migrate tweaks into metaforce std::optional strm; const SObjectTag* tag; @@ -34,14 +33,14 @@ void CTweaks::RegisterTweaks(hecl::CVarManager* cvarMgr) { tag = g_ResFactory->GetResourceIdByName("Particle"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakParticle = new DataSpec::DNAMP1::CTweakParticle(*strm); + g_tweakParticle = new MP1::CTweakParticle(*strm); g_tweakParticle->initCVars(cvarMgr); /* Player */ tag = g_ResFactory->GetResourceIdByName("Player"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakPlayer = new DataSpec::DNAMP1::CTweakPlayer(*strm); + g_tweakPlayer = new MP1::CTweakPlayer(*strm); g_tweakPlayer->initCVars(cvarMgr); /* CameraBob */ @@ -54,48 +53,42 @@ void CTweaks::RegisterTweaks(hecl::CVarManager* cvarMgr) { tag = g_ResFactory->GetResourceIdByName("Ball"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakBall = new DataSpec::DNAMP1::CTweakBall(*strm); + g_tweakBall = new MP1::CTweakBall(*strm); g_tweakBall->initCVars(cvarMgr); /* PlayerGun */ tag = g_ResFactory->GetResourceIdByName("PlayerGun"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakPlayerGun = new DataSpec::DNAMP1::CTweakPlayerGun(*strm); + g_tweakPlayerGun = new MP1::CTweakPlayerGun(*strm); g_tweakPlayerGun->initCVars(cvarMgr); /* Targeting */ tag = g_ResFactory->GetResourceIdByName("Targeting"); u8* Args = g_ResFactory->LoadResourceSync(*tag).release(); u32 size = g_ResFactory->ResourceSize(*tag); - strm.emplace(Args, size, true); - if (g_Main->IsTrilogy() || g_Main->IsPAL() || g_Main->IsJapanese()) { - g_tweakTargeting = new DataSpec::DNAMP1::CTweakTargeting(*strm); - g_tweakTargeting->initCVars(cvarMgr); - } else { - g_tweakTargeting = new DataSpec::DNAMP1::CTweakTargeting(*strm); - g_tweakTargeting->initCVars(cvarMgr); - } - + strm.emplace(Args, size, CMemoryInStream::EOwnerShip::Owned); + g_tweakTargeting = new MP1::CTweakTargeting(*strm, g_Main->IsTrilogy() || g_Main->IsPAL() || g_Main->IsJapanese()); + g_tweakTargeting->initCVars(cvarMgr); /* Game */ tag = g_ResFactory->GetResourceIdByName("Game"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakGame = new DataSpec::DNAMP1::CTweakGame(*strm); + g_tweakGame = new MP1::CTweakGame(*strm); g_tweakGame->initCVars(cvarMgr); /* GuiColors */ tag = g_ResFactory->GetResourceIdByName("GuiColors"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakGuiColors = new DataSpec::DNAMP1::CTweakGuiColors(*strm); + g_tweakGuiColors = new MP1::CTweakGuiColors(*strm); g_tweakGuiColors->initCVars(cvarMgr); /* AutoMapper */ tag = g_ResFactory->GetResourceIdByName("AutoMapper"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakAutoMapper = new DataSpec::DNAMP1::CTweakAutoMapper(*strm); + g_tweakAutoMapper = new MP1::CTweakAutoMapper(*strm); CMappableObject::ReadAutoMapperTweaks(*g_tweakAutoMapper); g_tweakAutoMapper->initCVars(cvarMgr); @@ -103,20 +96,20 @@ void CTweaks::RegisterTweaks(hecl::CVarManager* cvarMgr) { tag = g_ResFactory->GetResourceIdByName("Gui"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakGui = new DataSpec::DNAMP1::CTweakGui(*strm); + g_tweakGui = new MP1::CTweakGui(*strm); g_tweakPlayerGun->initCVars(cvarMgr); /* PlayerControls */ tag = g_ResFactory->GetResourceIdByName("PlayerControls"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakPlayerControl = new DataSpec::DNAMP1::CTweakPlayerControl(*strm); + g_tweakPlayerControl = new MP1::CTweakPlayerControl(*strm); /* PlayerControls2 */ tag = g_ResFactory->GetResourceIdByName("PlayerControls2"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakPlayerControlAlt = new DataSpec::DNAMP1::CTweakPlayerControl(*strm); + g_tweakPlayerControlAlt = new MP1::CTweakPlayerControl(*strm); g_currentPlayerControl = g_tweakPlayerControl; @@ -124,34 +117,26 @@ void CTweaks::RegisterTweaks(hecl::CVarManager* cvarMgr) { tag = g_ResFactory->GetResourceIdByName("SlideShow"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakSlideShow = new DataSpec::DNAMP1::CTweakSlideShow(*strm); + g_tweakSlideShow = new MP1::CTweakSlideShow(*strm); g_tweakSlideShow->initCVars(cvarMgr); -#endif } void CTweaks::RegisterResourceTweaks(hecl::CVarManager* cvarMgr) { -#if 0 // TODO: Migrate tweaks into metaforce std::optional strm; const SObjectTag* tag = g_ResFactory->GetResourceIdByName("GunRes"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - g_tweakGunRes = new DataSpec::DNAMP1::CTweakGunRes(*strm); + g_tweakGunRes = new MP1::CTweakGunRes(*strm); g_tweakGunRes->ResolveResources(*g_ResFactory); g_tweakGunRes->initCVars(cvarMgr); tag = g_ResFactory->GetResourceIdByName("PlayerRes"); strm.emplace(g_ResFactory->LoadResourceSync(*tag).release(), g_ResFactory->ResourceSize(*tag), CMemoryInStream::EOwnerShip::Owned); - if (g_Main->IsTrilogy() || g_Main->IsPAL() || g_Main->IsJapanese()) { - g_tweakPlayerRes = new DataSpec::DNAMP1::CTweakPlayerRes(*strm); - } else { - g_tweakPlayerRes = new DataSpec::DNAMP1::CTweakPlayerRes(*strm); - } - + g_tweakPlayerRes = new MP1::CTweakPlayerRes(*strm, g_Main->IsTrilogy() || g_Main->IsPAL() || g_Main->IsJapanese()); g_tweakPlayerRes->ResolveResources(*g_ResFactory); g_tweakPlayerRes->initCVars(cvarMgr); -#endif } } // namespace metaforce::MP1 diff --git a/Runtime/MP1/MP1.hpp b/Runtime/MP1/MP1.hpp index 3b88c403d..98a5d99ed 100644 --- a/Runtime/MP1/MP1.hpp +++ b/Runtime/MP1/MP1.hpp @@ -7,7 +7,7 @@ #include "Runtime/IMain.hpp" #include "Runtime/MP1/CTweaks.hpp" #include "Runtime/MP1/CPlayMovie.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/CBasics.hpp" #include "Runtime/CMemoryCardSys.hpp" #include "Runtime/CResFactory.hpp" diff --git a/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.cpp b/Runtime/MP1/Tweaks/CTweakAutoMapper.cpp similarity index 78% rename from DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.cpp rename to Runtime/MP1/Tweaks/CTweakAutoMapper.cpp index ae93c7c1e..6701d4673 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.cpp +++ b/Runtime/MP1/Tweaks/CTweakAutoMapper.cpp @@ -1,10 +1,11 @@ -#include "DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp" +#include "Runtime/MP1/Tweaks/CTweakAutoMapper.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include #include #define PREFIX(v) std::string_view("tweak.automap." #v) -namespace DataSpec::DNAMP1 { +namespace metaforce::MP1 { namespace { constexpr std::string_view skShowOneMiniMapArea = PREFIX(ShowOneMiniMapArea); constexpr std::string_view skScaleMoveSpeedWithCamDist = PREFIX(ScaleMoveSpeedWithCamDist); @@ -48,6 +49,73 @@ hecl::CVar* tw_mapSurfaceNormColorLinear = nullptr; hecl::CVar* tw_mapSurfaceNormColorConstant = nullptr; } // namespace +CTweakAutoMapper::CTweakAutoMapper(CInputStream& in) { + x4_24_showOneMiniMapArea = in.ReadBool(); + x4_25_ = in.ReadBool(); + x4_26_scaleMoveSpeedWithCamDist = in.ReadBool(); + x8_camDist = in.ReadFloat(); + xc_minCamDist = in.ReadFloat(); + x10_maxCamDist = in.ReadFloat(); + x14_minCamRotateX = in.ReadFloat(); + x18_maxCamRotateX = in.ReadFloat(); + x1c_camAngle = in.ReadFloat(); + x20_ = in.ReadFloat(); + x24_automapperWidgetColor = in.Get(); + x28_miniCamDist = in.ReadFloat(); + x2c_miniCamXAngle = in.ReadFloat(); + x30_miniCamAngle = in.ReadFloat(); + x34_ = in.ReadFloat(); + x38_automapperWidgetMiniColor = in.Get(); + x3c_surfColorVisited = in.Get(); + x40_outlineColorVisited = in.Get(); + x44_surfColorUnvisited = in.Get(); + x48_outlineColorUnvisited = in.Get(); + x4c_surfaceSelectColorVisited = in.Get(); + x50_outlineSelectColorVisited = in.Get(); + x54_mapSurfaceNormColorLinear = in.ReadFloat(); + x58_mapSurfaceNormColorConstant = in.ReadFloat(); + x5c_ = in.ReadFloat(); + x64_openMapScreenTime = in.ReadFloat(); + x68_closeMapScreenTime = in.ReadFloat(); + x6c_hintPanTime = in.ReadFloat(); + x70_zoomUnitsPerFrame = in.ReadFloat(); + x74_rotateDegPerFrame = in.ReadFloat(); + x78_baseMapScreenCameraMoveSpeed = in.ReadFloat(); + x7c_surfaceSelectColorUnvisited = in.Get(); + x80_outlineSelectColorUnvisited = in.Get(); + x84_miniAlphaSurfaceVisited = in.ReadFloat(); + x88_alphaSurfaceVisited = in.ReadFloat(); + x8c_miniAlphaOutlineVisited = in.ReadFloat(); + x90_alphaOutlineVisited = in.ReadFloat(); + x94_miniAlphaSurfaceUnvisited = in.ReadFloat(); + x98_alphaSurfaceUnvisited = in.ReadFloat(); + x9c_miniAlphaOutlineUnvisited = in.ReadFloat(); + xa0_alphaOutlineUnvisited = in.ReadFloat(); + xa4_doorCenter = in.Get(); + xb0_ = in.ReadFloat(); + xb4_ = in.ReadFloat(); + xb8_miniMapViewportWidth = in.ReadFloat(); + xbc_miniMapViewportHeight = in.ReadFloat(); + xc0_miniMapCamDistScale = in.ReadFloat(); + xc4_mapPlaneScaleX = in.ReadFloat(); + xc8_mapPlaneScaleZ = in.ReadFloat(); + xcc_ = in.ReadBool(); + xd0_universeCamDist = in.ReadFloat(); + xd4_minUniverseCamDist = in.ReadFloat(); + xd8_maxUniverseCamDist = in.ReadFloat(); + xdc_switchToFromUniverseTime = in.ReadFloat(); + xe0_camPanUnitsPerFrame = in.ReadFloat(); + xe4_automapperScaleX = in.ReadFloat(); + xe8_automapperScaleZ = in.ReadFloat(); + xec_camVerticalOffset = in.ReadFloat(); + xf0_miniMapSamusModColor = in.Get(); + xf4_areaFlashPulseColor = in.Get(); + xf8_ = in.Get(); + xfc_ = in.Get(); + read_reserved_vector(x100_doorColors, in); + x118_doorBorderColor = in.Get(); + x11c_openDoorColor = in.Get(); +} void CTweakAutoMapper::_tweakListener(hecl::CVar* cv) { if (cv == tw_showOneMiniMapArea) { x4_24_showOneMiniMapArea = cv->toBoolean(); @@ -174,4 +242,4 @@ void CTweakAutoMapper::initCVars(hecl::CVarManager* mgr) { hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Color | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); } -} // namespace DataSpec::DNAMP1 \ No newline at end of file +} // namespace metaforce::MP1 \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakAutoMapper.hpp b/Runtime/MP1/Tweaks/CTweakAutoMapper.hpp new file mode 100644 index 000000000..e9eb143fa --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakAutoMapper.hpp @@ -0,0 +1,143 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakAutoMapper.hpp" + +#include "Runtime/rstl.hpp" + +namespace hecl { +class CVar; +} + +namespace metaforce::MP1 { +struct CTweakAutoMapper final : public Tweaks::ITweakAutoMapper { + bool x4_24_showOneMiniMapArea;// : 1; + bool x4_25_;// : 1; + bool x4_26_scaleMoveSpeedWithCamDist;// : 1; + float x8_camDist ; + float xc_minCamDist ; + float x10_maxCamDist; + float x14_minCamRotateX; + float x18_maxCamRotateX; + float x1c_camAngle; + float x20_; + zeus::CColor x24_automapperWidgetColor; + float x28_miniCamDist; + float x2c_miniCamXAngle; + float x30_miniCamAngle; + float x34_; + zeus::CColor x38_automapperWidgetMiniColor; + zeus::CColor x3c_surfColorVisited; + zeus::CColor x40_outlineColorVisited; + zeus::CColor x44_surfColorUnvisited; + zeus::CColor x48_outlineColorUnvisited; + zeus::CColor x4c_surfaceSelectColorVisited; + zeus::CColor x50_outlineSelectColorVisited; + float x54_mapSurfaceNormColorLinear; + float x58_mapSurfaceNormColorConstant; + float x5c_; + float x60_ = 0.4f; + float x64_openMapScreenTime; + float x68_closeMapScreenTime; + float x6c_hintPanTime; + float x70_zoomUnitsPerFrame; + float x74_rotateDegPerFrame; + float x78_baseMapScreenCameraMoveSpeed; + zeus::CColor x7c_surfaceSelectColorUnvisited; + zeus::CColor x80_outlineSelectColorUnvisited; + float x84_miniAlphaSurfaceVisited; + float x88_alphaSurfaceVisited; + float x8c_miniAlphaOutlineVisited; + float x90_alphaOutlineVisited; + float x94_miniAlphaSurfaceUnvisited; + float x98_alphaSurfaceUnvisited; + float x9c_miniAlphaOutlineUnvisited; + float xa0_alphaOutlineUnvisited; + /* Originally 4 separate floats */ + zeus::CVector3f xa4_doorCenter; + float xb0_; + float xb4_; + float xb8_miniMapViewportWidth; + float xbc_miniMapViewportHeight; + float xc0_miniMapCamDistScale; + float xc4_mapPlaneScaleX; + float xc8_mapPlaneScaleZ; + bool xcc_; + float xd0_universeCamDist; + float xd4_minUniverseCamDist; + float xd8_maxUniverseCamDist; + float xdc_switchToFromUniverseTime; + float xe0_camPanUnitsPerFrame; + float xe4_automapperScaleX; + float xe8_automapperScaleZ; + float xec_camVerticalOffset; + zeus::CColor xf0_miniMapSamusModColor; + zeus::CColor xf4_areaFlashPulseColor; + zeus::CColor xf8_; + zeus::CColor xfc_; + rstl::reserved_vector x100_doorColors; + zeus::CColor x118_doorBorderColor; + zeus::CColor x11c_openDoorColor; + + CTweakAutoMapper() = default; + CTweakAutoMapper(CInputStream& r); + bool GetShowOneMiniMapArea() const override { return x4_24_showOneMiniMapArea; } + bool GetScaleMoveSpeedWithCamDist() const override { return x4_26_scaleMoveSpeedWithCamDist; } + float GetCamDist() const override { return x8_camDist; } + float GetMinCamDist() const override { return xc_minCamDist; } + float GetMaxCamDist() const override { return x10_maxCamDist; } + float GetMinCamRotateX() const override { return x14_minCamRotateX; } + float GetMaxCamRotateX() const override { return x18_maxCamRotateX; } + float GetCamAngle() const override { return x1c_camAngle; } + const zeus::CColor& GetAutomapperWidgetColor() const override { return x24_automapperWidgetColor; } + float GetMiniCamDist() const override { return x28_miniCamDist; } + float GetMiniCamXAngle() const override { return x2c_miniCamXAngle; } + float GetMiniCamAngle() const override { return x30_miniCamAngle; } + const zeus::CColor& GetAutomapperWidgetMiniColor() const override { return x38_automapperWidgetMiniColor; } + const zeus::CColor& GetSurfaceVisitedColor() const override { return x3c_surfColorVisited; } + const zeus::CColor& GetOutlineVisitedColor() const override { return x40_outlineColorVisited; } + const zeus::CColor& GetSurfaceUnvisitedColor() const override { return x44_surfColorUnvisited; } + const zeus::CColor& GetOutlineUnvisitedColor() const override { return x48_outlineColorUnvisited; } + const zeus::CColor& GetSurfaceSelectVisitedColor() const override { return x4c_surfaceSelectColorVisited; } + const zeus::CColor& GetOutlineSelectVisitedColor() const override { return x50_outlineSelectColorVisited; } + float GetMapSurfaceNormColorLinear() const override { return x54_mapSurfaceNormColorLinear; } + float GetMapSurfaceNormColorConstant() const override { return x58_mapSurfaceNormColorConstant; } + float GetOpenMapScreenTime() const override { return x64_openMapScreenTime; } + float GetCloseMapScreenTime() const override { return x68_closeMapScreenTime; } + float GetHintPanTime() const override { return x6c_hintPanTime; } + float GetCamZoomUnitsPerFrame() const override { return x70_zoomUnitsPerFrame; } + float GetCamRotateDegreesPerFrame() const override { return x74_rotateDegPerFrame; } + float GetBaseMapScreenCameraMoveSpeed() const override { return x78_baseMapScreenCameraMoveSpeed; } + const zeus::CColor& GetSurfaceSelectUnvisitedColor() const override { return x7c_surfaceSelectColorUnvisited; } + const zeus::CColor& GetOutlineSelectUnvisitedColor() const override { return x80_outlineSelectColorUnvisited; } + float GetMiniAlphaSurfaceVisited() const override { return x84_miniAlphaSurfaceVisited; } + float GetAlphaSurfaceVisited() const override { return x88_alphaSurfaceVisited; } + float GetMiniAlphaOutlineVisited() const override { return x8c_miniAlphaOutlineVisited; } + float GetAlphaOutlineVisited() const override { return x90_alphaOutlineVisited; } + float GetMiniAlphaSurfaceUnvisited() const override { return x94_miniAlphaSurfaceUnvisited; } + float GetAlphaSurfaceUnvisited() const override { return x98_alphaSurfaceUnvisited; } + float GetMiniAlphaOutlineUnvisited() const override { return x9c_miniAlphaOutlineUnvisited; } + float GetAlphaOutlineUnvisited() const override { return xa0_alphaOutlineUnvisited; } + const zeus::CVector3f& GetDoorCenter() const override { return xa4_doorCenter; } + float GetMiniMapViewportWidth() const override { return xb8_miniMapViewportWidth; } + float GetMiniMapViewportHeight() const override { return xbc_miniMapViewportHeight; } + float GetMiniMapCamDistScale() const override { return xc0_miniMapCamDistScale; } + float GetMapPlaneScaleX() const override { return xc4_mapPlaneScaleX; } + float GetMapPlaneScaleZ() const override { return xc8_mapPlaneScaleZ; } + float GetUniverseCamDist() const override { return xd0_universeCamDist; } + float GetMinUniverseCamDist() const override { return xd4_minUniverseCamDist; } + float GetMaxUniverseCamDist() const override { return xd8_maxUniverseCamDist; } + float GetSwitchToFromUniverseTime() const override { return xdc_switchToFromUniverseTime; } + float GetCamPanUnitsPerFrame() const override { return xe0_camPanUnitsPerFrame; } + float GetAutomapperScaleX() const override { return xe4_automapperScaleX; } + float GetAutomapperScaleZ() const override { return xe8_automapperScaleZ; } + float GetCamVerticalOffset() const override { return xec_camVerticalOffset; } + const zeus::CColor& GetMiniMapSamusModColor() const override { return xf0_miniMapSamusModColor; } + const zeus::CColor& GetAreaFlashPulseColor() const override { return xf4_areaFlashPulseColor; } + const zeus::CColor& GetDoorColor(int idx) const override { return x100_doorColors[idx]; } + const zeus::CColor& GetOpenDoorColor() const override { return x11c_openDoorColor; } + void initCVars(hecl::CVarManager*) override; + +private: + void _tweakListener(hecl::CVar* cv); +}; +} // namespace DataSpec::DNAMP1 diff --git a/Runtime/MP1/Tweaks/CTweakBall.cpp b/Runtime/MP1/Tweaks/CTweakBall.cpp new file mode 100644 index 000000000..8c66ac43e --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakBall.cpp @@ -0,0 +1,462 @@ +#include "Runtime/MP1/Tweaks/CTweakBall.hpp" +#include "Runtime/Streams/IOStreams.hpp" + +namespace metaforce::MP1 { +CTweakBall::CTweakBall(CInputStream& in) { + LoadTweaks(in); + x6c_ = -x6c_; + x70_ = -x70_; + x74_ballCameraAnglePerSecond = zeus::degToRad(x74_ballCameraAnglePerSecond); + x90_ = zeus::degToRad(x90_); + xe4_ballGravity = -xe4_ballGravity; + xe8_ballWaterGravity = -xe8_ballWaterGravity; + x15c_ = zeus::degToRad(x15c_); + x16c_ = zeus::degToRad(x16c_); + x174_ = zeus::degToRad(x174_); + x17c_ballCameraChaseDampenAngle = zeus::degToRad(x17c_ballCameraChaseDampenAngle); + x184_ballCameraChaseYawSpeed = zeus::degToRad(x184_ballCameraChaseYawSpeed); + x188_ballCameraChaseAnglePerSecond = zeus::degToRad(x188_ballCameraChaseAnglePerSecond); + x1a8_ballCameraBoostDampenAngle = zeus::degToRad(x1a8_ballCameraBoostDampenAngle); + x1b0_ballCameraBoostYawSpeed = zeus::degToRad(x1b0_ballCameraBoostYawSpeed); + x1b4_ballCameraBoostAnglePerSecond = zeus::degToRad(x1b4_ballCameraBoostAnglePerSecond); + x1ec_maxLeanAngle = zeus::degToRad(x1ec_maxLeanAngle); +} + +void CTweakBall::LoadTweaks(CInputStream& in) { + /* x4_maxTranslationAcceleration[0] */ + x4_maxTranslationAcceleration[0] = in.ReadFloat(); + /* x4_maxTranslationAcceleration[1] */ + x4_maxTranslationAcceleration[1] = in.ReadFloat(); + /* x4_maxTranslationAcceleration[2] */ + x4_maxTranslationAcceleration[2] = in.ReadFloat(); + /* x4_maxTranslationAcceleration[3] */ + x4_maxTranslationAcceleration[3] = in.ReadFloat(); + /* x4_maxTranslationAcceleration[4] */ + x4_maxTranslationAcceleration[4] = in.ReadFloat(); + /* x4_maxTranslationAcceleration[5] */ + x4_maxTranslationAcceleration[5] = in.ReadFloat(); + /* x4_maxTranslationAcceleration[6] */ + x4_maxTranslationAcceleration[6] = in.ReadFloat(); + /* x4_maxTranslationAcceleration[7] */ + x4_maxTranslationAcceleration[7] = in.ReadFloat(); + /* x24_translationFriction[0] */ + x24_translationFriction[0] = in.ReadFloat(); + /* x24_translationFriction[1] */ + x24_translationFriction[1] = in.ReadFloat(); + /* x24_translationFriction[2] */ + x24_translationFriction[2] = in.ReadFloat(); + /* x24_translationFriction[3] */ + x24_translationFriction[3] = in.ReadFloat(); + /* x24_translationFriction[4] */ + x24_translationFriction[4] = in.ReadFloat(); + /* x24_translationFriction[5] */ + x24_translationFriction[5] = in.ReadFloat(); + /* x24_translationFriction[6] */ + x24_translationFriction[6] = in.ReadFloat(); + /* x24_translationFriction[7] */ + x24_translationFriction[7] = in.ReadFloat(); + /* x44_translationMaxSpeed[0] */ + x44_translationMaxSpeed[0] = in.ReadFloat(); + /* x44_translationMaxSpeed[1] */ + x44_translationMaxSpeed[1] = in.ReadFloat(); + /* x44_translationMaxSpeed[2] */ + x44_translationMaxSpeed[2] = in.ReadFloat(); + /* x44_translationMaxSpeed[3] */ + x44_translationMaxSpeed[3] = in.ReadFloat(); + /* x44_translationMaxSpeed[4] */ + x44_translationMaxSpeed[4] = in.ReadFloat(); + /* x44_translationMaxSpeed[5] */ + x44_translationMaxSpeed[5] = in.ReadFloat(); + /* x44_translationMaxSpeed[6] */ + x44_translationMaxSpeed[6] = in.ReadFloat(); + /* x44_translationMaxSpeed[7] */ + x44_translationMaxSpeed[7] = in.ReadFloat(); + /* x64_ */ + x64_ = in.ReadFloat(); + /* x68_ */ + x68_ = in.ReadFloat(); + /* x6c_ */ + x6c_ = in.ReadFloat(); + /* x70_ */ + x70_ = in.ReadFloat(); + /* xc4_ballForwardBrakingAcceleration[0] */ + xc4_ballForwardBrakingAcceleration[0] = in.ReadFloat(); + /* xc4_ballForwardBrakingAcceleration[1] */ + xc4_ballForwardBrakingAcceleration[1] = in.ReadFloat(); + /* xc4_ballForwardBrakingAcceleration[2] */ + xc4_ballForwardBrakingAcceleration[2] = in.ReadFloat(); + /* xc4_ballForwardBrakingAcceleration[3] */ + xc4_ballForwardBrakingAcceleration[3] = in.ReadFloat(); + /* xc4_ballForwardBrakingAcceleration[4] */ + xc4_ballForwardBrakingAcceleration[4] = in.ReadFloat(); + /* xc4_ballForwardBrakingAcceleration[5] */ + xc4_ballForwardBrakingAcceleration[5] = in.ReadFloat(); + /* xc4_ballForwardBrakingAcceleration[6] */ + xc4_ballForwardBrakingAcceleration[6] = in.ReadFloat(); + /* xc4_ballForwardBrakingAcceleration[7] */ + xc4_ballForwardBrakingAcceleration[7] = in.ReadFloat(); + /* xe4_ballGravity */ + xe4_ballGravity = in.ReadFloat(); + /* xe8_ballWaterGravity */ + xe8_ballWaterGravity = in.ReadFloat(); + /* x14c_ */ + x14c_ = in.ReadFloat(); + /* x150_ */ + x150_ = in.ReadFloat(); + /* x158_ */ + x158_ = in.ReadFloat(); + /* x1dc_minimumAlignmentSpeed */ + x1dc_minimumAlignmentSpeed = in.ReadFloat(); + /* x1e0_tireness */ + x1e0_tireness = in.ReadFloat(); + /* x1ec_maxLeanAngle */ + x1ec_maxLeanAngle = in.ReadFloat(); + /* x1f0_tireToMarbleThresholdSpeed */ + x1f0_tireToMarbleThresholdSpeed = in.ReadFloat(); + /* x1f4_marbleToTireThresholdSpeed */ + x1f4_marbleToTireThresholdSpeed = in.ReadFloat(); + /* x1f8_forceToLeanGain */ + x1f8_forceToLeanGain = in.ReadFloat(); + /* x1fc_leanTrackingGain */ + x1fc_leanTrackingGain = in.ReadFloat(); + /* x74_ballCameraAnglePerSecond */ + x74_ballCameraAnglePerSecond = in.ReadFloat(); + /* x78_ballCameraOffset */ + x78_ballCameraOffset = in.Get(); + /* x84_ballCameraMinSpeedDistance */ + x84_ballCameraMinSpeedDistance = in.ReadFloat(); + /* x88_ballCameraMaxSpeedDistance */ + x88_ballCameraMaxSpeedDistance = in.ReadFloat(); + /* x8c_ballCameraBackwardsDistance */ + x8c_ballCameraBackwardsDistance = in.ReadFloat(); + /* x90_ */ + x90_ = in.ReadFloat(); + /* x94_ballCameraSpringConstant */ + x94_ballCameraSpringConstant = in.ReadFloat(); + /* x98_ballCameraSpringMax */ + x98_ballCameraSpringMax = in.ReadFloat(); + /* x9c_ballCameraSpringTardis */ + x9c_ballCameraSpringTardis = in.ReadFloat(); + /* xa0_ballCameraCentroidSpringConstant */ + xa0_ballCameraCentroidSpringConstant = in.ReadFloat(); + /* xa4_ballCameraCentroidSpringMax */ + xa4_ballCameraCentroidSpringMax = in.ReadFloat(); + /* xa8_ballCameraCentroidSpringTardis */ + xa8_ballCameraCentroidSpringTardis = in.ReadFloat(); + /* xac_ballCameraCentroidDistanceSpringConstant */ + xac_ballCameraCentroidDistanceSpringConstant = in.ReadFloat(); + /* xb0_ballCameraCentroidDistanceSpringMax */ + xb0_ballCameraCentroidDistanceSpringMax = in.ReadFloat(); + /* xb4_ballCameraCentroidDistanceSpringTardis */ + xb4_ballCameraCentroidDistanceSpringTardis = in.ReadFloat(); + /* xb8_ballCameraLookAtSpringConstant */ + xb8_ballCameraLookAtSpringConstant = in.ReadFloat(); + /* xbc_ballCameraLookAtSpringMax */ + xbc_ballCameraLookAtSpringMax = in.ReadFloat(); + /* xc0_ballCameraLookAtSpringTardis */ + xc0_ballCameraLookAtSpringTardis = in.ReadFloat(); + /* x154_ */ + x154_ = in.ReadFloat(); + /* x15c_ */ + x15c_ = in.ReadFloat(); + /* x160_ */ + x160_ = in.ReadFloat(); + /* x164_ */ + x164_ = in.ReadFloat(); + /* x168_ */ + x168_ = in.ReadFloat(); + /* x16c_ */ + x16c_ = in.ReadFloat(); + /* x170_conservativeDoorCamDistance */ + x170_conservativeDoorCamDistance = in.ReadFloat(); + /* x174_ */ + x174_ = in.ReadFloat(); + /* x178_ballCameraChaseElevation */ + x178_ballCameraChaseElevation = in.ReadFloat(); + /* x17c_ballCameraChaseDampenAngle */ + x17c_ballCameraChaseDampenAngle = in.ReadFloat(); + /* x180_ballCameraChaseDistance */ + x180_ballCameraChaseDistance = in.ReadFloat(); + /* x184_ballCameraChaseYawSpeed */ + x184_ballCameraChaseYawSpeed = in.ReadFloat(); + /* x188_ballCameraChaseAnglePerSecond */ + x188_ballCameraChaseAnglePerSecond = in.ReadFloat(); + /* x18c_ballCameraChaseLookAtOffset */ + x18c_ballCameraChaseLookAtOffset = in.Get(); + /* x198_ballCameraChaseSpringConstant */ + x198_ballCameraChaseSpringConstant = in.ReadFloat(); + /* x19c_ballCameraChaseSpringMax */ + x19c_ballCameraChaseSpringMax = in.ReadFloat(); + /* x1a0_ballCameraChaseSpringTardis */ + x1a0_ballCameraChaseSpringTardis = in.ReadFloat(); + /* x1a4_ballCameraBoostElevation */ + x1a4_ballCameraBoostElevation = in.ReadFloat(); + /* x1a8_ballCameraBoostDampenAngle */ + x1a8_ballCameraBoostDampenAngle = in.ReadFloat(); + /* x1ac_ballCameraBoostDistance */ + x1ac_ballCameraBoostDistance = in.ReadFloat(); + /* x1b0_ballCameraBoostYawSpeed */ + x1b0_ballCameraBoostYawSpeed = in.ReadFloat(); + /* x1b4_ballCameraBoostAnglePerSecond */ + x1b4_ballCameraBoostAnglePerSecond = in.ReadFloat(); + /* x1b8_ballCameraBoostLookAtOffset */ + x1b8_ballCameraBoostLookAtOffset = in.Get(); + /* x1c4_ballCameraBoostSpringConstant */ + x1c4_ballCameraBoostSpringConstant = in.ReadFloat(); + /* x1c8_ballCameraBoostSpringMax */ + x1c8_ballCameraBoostSpringMax = in.ReadFloat(); + /* x1cc_ballCameraBoostSpringTardis */ + x1cc_ballCameraBoostSpringTardis = in.ReadFloat(); + /* x1d0_ballCameraControlDistance */ + x1d0_ballCameraControlDistance = in.ReadFloat(); + /* x1d4_ */ + x1d4_ = in.ReadFloat(); + /* x1d8_ */ + x1d8_ = in.ReadFloat(); + /* x1e4_leftStickDivisor */ + x1e4_leftStickDivisor = in.ReadFloat(); + /* x1e8_rightStickDivisor */ + x1e8_rightStickDivisor = in.ReadFloat(); + /* x200_ */ + x200_ = in.ReadFloat(); + /* x204_ballTouchRadius */ + x204_ballTouchRadius = in.ReadFloat(); + /* x20c_boostBallDrainTime */ + x20c_boostBallDrainTime = in.ReadFloat(); + /* x218_boostBallMinChargeTime */ + x218_boostBallMinChargeTime = in.ReadFloat(); + /* x21c_boostBallMinRelativeSpeedForDamage */ + x21c_boostBallMinRelativeSpeedForDamage = in.ReadFloat(); + /* x220_boostBallChargeTime0 */ + x220_boostBallChargeTime0 = in.ReadFloat(); + /* x224_boostBallChargeTime1 */ + x224_boostBallChargeTime1 = in.ReadFloat(); + /* x210_boostBallMaxChargeTime */ + x228_boostBallChargeTime2 = x210_boostBallMaxChargeTime = in.ReadFloat(); + /* x22c_boostBallIncrementalSpeed0 */ + x22c_boostBallIncrementalSpeed0 = in.ReadFloat(); + /* x230_boostBallIncrementalSpeed1 */ + x230_boostBallIncrementalSpeed1 = in.ReadFloat(); + /* x234_boostBallIncrementalSpeed2 */ + x234_boostBallIncrementalSpeed2 = in.ReadFloat(); +} + +void CTweakBall::PutTo(COutputStream& out) { + /* x4_maxTranslationAcceleration[0] */ + out.Put(x4_maxTranslationAcceleration[0]); + /* x4_maxTranslationAcceleration[1] */ + out.Put(x4_maxTranslationAcceleration[1]); + /* x4_maxTranslationAcceleration[2] */ + out.Put(x4_maxTranslationAcceleration[2]); + /* x4_maxTranslationAcceleration[3] */ + out.Put(x4_maxTranslationAcceleration[3]); + /* x4_maxTranslationAcceleration[4] */ + out.Put(x4_maxTranslationAcceleration[4]); + /* x4_maxTranslationAcceleration[5] */ + out.Put(x4_maxTranslationAcceleration[5]); + /* x4_maxTranslationAcceleration[6] */ + out.Put(x4_maxTranslationAcceleration[6]); + /* x4_maxTranslationAcceleration[7] */ + out.Put(x4_maxTranslationAcceleration[7]); + /* x24_translationFriction[0] */ + out.Put(x24_translationFriction[0]); + /* x24_translationFriction[1] */ + out.Put(x24_translationFriction[1]); + /* x24_translationFriction[2] */ + out.Put(x24_translationFriction[2]); + /* x24_translationFriction[3] */ + out.Put(x24_translationFriction[3]); + /* x24_translationFriction[4] */ + out.Put(x24_translationFriction[4]); + /* x24_translationFriction[5] */ + out.Put(x24_translationFriction[5]); + /* x24_translationFriction[6] */ + out.Put(x24_translationFriction[6]); + /* x24_translationFriction[7] */ + out.Put(x24_translationFriction[7]); + /* x44_translationMaxSpeed[0] */ + out.Put(x44_translationMaxSpeed[0]); + /* x44_translationMaxSpeed[1] */ + out.Put(x44_translationMaxSpeed[1]); + /* x44_translationMaxSpeed[2] */ + out.Put(x44_translationMaxSpeed[2]); + /* x44_translationMaxSpeed[3] */ + out.Put(x44_translationMaxSpeed[3]); + /* x44_translationMaxSpeed[4] */ + out.Put(x44_translationMaxSpeed[4]); + /* x44_translationMaxSpeed[5] */ + out.Put(x44_translationMaxSpeed[5]); + /* x44_translationMaxSpeed[6] */ + out.Put(x44_translationMaxSpeed[6]); + /* x44_translationMaxSpeed[7] */ + out.Put(x44_translationMaxSpeed[7]); + /* x64_ */ + out.Put(x64_); + /* x68_ */ + out.Put(x68_); + /* x6c_ */ + out.Put(x6c_); + /* x70_ */ + out.Put(x70_); + /* xc4_ballForwardBrakingAcceleration[0] */ + out.Put(xc4_ballForwardBrakingAcceleration[0]); + /* xc4_ballForwardBrakingAcceleration[1] */ + out.Put(xc4_ballForwardBrakingAcceleration[1]); + /* xc4_ballForwardBrakingAcceleration[2] */ + out.Put(xc4_ballForwardBrakingAcceleration[2]); + /* xc4_ballForwardBrakingAcceleration[3] */ + out.Put(xc4_ballForwardBrakingAcceleration[3]); + /* xc4_ballForwardBrakingAcceleration[4] */ + out.Put(xc4_ballForwardBrakingAcceleration[4]); + /* xc4_ballForwardBrakingAcceleration[5] */ + out.Put(xc4_ballForwardBrakingAcceleration[5]); + /* xc4_ballForwardBrakingAcceleration[6] */ + out.Put(xc4_ballForwardBrakingAcceleration[6]); + /* xc4_ballForwardBrakingAcceleration[7] */ + out.Put(xc4_ballForwardBrakingAcceleration[7]); + /* xe4_ballGravity */ + out.Put(xe4_ballGravity); + /* xe8_ballWaterGravity */ + out.Put(xe8_ballWaterGravity); + /* x14c_ */ + out.Put(x14c_); + /* x150_ */ + out.Put(x150_); + /* x158_ */ + out.Put(x158_); + /* x1dc_minimumAlignmentSpeed */ + out.Put(x1dc_minimumAlignmentSpeed); + /* x1e0_tireness */ + out.Put(x1e0_tireness); + /* x1ec_maxLeanAngle */ + out.Put(x1ec_maxLeanAngle); + /* x1f0_tireToMarbleThresholdSpeed */ + out.Put(x1f0_tireToMarbleThresholdSpeed); + /* x1f4_marbleToTireThresholdSpeed */ + out.Put(x1f4_marbleToTireThresholdSpeed); + /* x1f8_forceToLeanGain */ + out.Put(x1f8_forceToLeanGain); + /* x1fc_leanTrackingGain */ + out.Put(x1fc_leanTrackingGain); + /* x74_ballCameraAnglePerSecond */ + out.Put(x74_ballCameraAnglePerSecond); + /* x78_ballCameraOffset */ + out.Put(x78_ballCameraOffset); + /* x84_ballCameraMinSpeedDistance */ + out.Put(x84_ballCameraMinSpeedDistance); + /* x88_ballCameraMaxSpeedDistance */ + out.Put(x88_ballCameraMaxSpeedDistance); + /* x8c_ballCameraBackwardsDistance */ + out.Put(x8c_ballCameraBackwardsDistance); + /* x90_ */ + out.Put(x90_); + /* x94_ballCameraSpringConstant */ + out.Put(x94_ballCameraSpringConstant); + /* x98_ballCameraSpringMax */ + out.Put(x98_ballCameraSpringMax); + /* x9c_ballCameraSpringTardis */ + out.Put(x9c_ballCameraSpringTardis); + /* xa0_ballCameraCentroidSpringConstant */ + out.Put(xa0_ballCameraCentroidSpringConstant); + /* xa4_ballCameraCentroidSpringMax */ + out.Put(xa4_ballCameraCentroidSpringMax); + /* xa8_ballCameraCentroidSpringTardis */ + out.Put(xa8_ballCameraCentroidSpringTardis); + /* xac_ballCameraCentroidDistanceSpringConstant */ + out.Put(xac_ballCameraCentroidDistanceSpringConstant); + /* xb0_ballCameraCentroidDistanceSpringMax */ + out.Put(xb0_ballCameraCentroidDistanceSpringMax); + /* xb4_ballCameraCentroidDistanceSpringTardis */ + out.Put(xb4_ballCameraCentroidDistanceSpringTardis); + /* xb8_ballCameraLookAtSpringConstant */ + out.Put(xb8_ballCameraLookAtSpringConstant); + /* xbc_ballCameraLookAtSpringMax */ + out.Put(xbc_ballCameraLookAtSpringMax); + /* xc0_ballCameraLookAtSpringTardis */ + out.Put(xc0_ballCameraLookAtSpringTardis); + /* x154_ */ + out.Put(x154_); + /* x15c_ */ + out.Put(x15c_); + /* x160_ */ + out.Put(x160_); + /* x164_ */ + out.Put(x164_); + /* x168_ */ + out.Put(x168_); + /* x16c_ */ + out.Put(x16c_); + /* x170_conservativeDoorCamDistance */ + out.Put(x170_conservativeDoorCamDistance); + /* x174_ */ + out.Put(x174_); + /* x178_ballCameraChaseElevation */ + out.Put(x178_ballCameraChaseElevation); + /* x17c_ballCameraChaseDampenAngle */ + out.Put(x17c_ballCameraChaseDampenAngle); + /* x180_ballCameraChaseDistance */ + out.Put(x180_ballCameraChaseDistance); + /* x184_ballCameraChaseYawSpeed */ + out.Put(x184_ballCameraChaseYawSpeed); + /* x188_ballCameraChaseAnglePerSecond */ + out.Put(x188_ballCameraChaseAnglePerSecond); + /* x18c_ballCameraChaseLookAtOffset */ + out.Put(x18c_ballCameraChaseLookAtOffset); + /* x198_ballCameraChaseSpringConstant */ + out.Put(x198_ballCameraChaseSpringConstant); + /* x19c_ballCameraChaseSpringMax */ + out.Put(x19c_ballCameraChaseSpringMax); + /* x1a0_ballCameraChaseSpringTardis */ + out.Put(x1a0_ballCameraChaseSpringTardis); + /* x1a4_ballCameraBoostElevation */ + out.Put(x1a4_ballCameraBoostElevation); + /* x1a8_ballCameraBoostDampenAngle */ + out.Put(x1a8_ballCameraBoostDampenAngle); + /* x1ac_ballCameraBoostDistance */ + out.Put(x1ac_ballCameraBoostDistance); + /* x1b0_ballCameraBoostYawSpeed */ + out.Put(x1b0_ballCameraBoostYawSpeed); + /* x1b4_ballCameraBoostAnglePerSecond */ + out.Put(x1b4_ballCameraBoostAnglePerSecond); + /* x1b8_ballCameraBoostLookAtOffset */ + out.Put(x1b8_ballCameraBoostLookAtOffset); + /* x1c4_ballCameraBoostSpringConstant */ + out.Put(x1c4_ballCameraBoostSpringConstant); + /* x1c8_ballCameraBoostSpringMax */ + out.Put(x1c8_ballCameraBoostSpringMax); + /* x1cc_ballCameraBoostSpringTardis */ + out.Put(x1cc_ballCameraBoostSpringTardis); + /* x1d0_ballCameraControlDistance */ + out.Put(x1d0_ballCameraControlDistance); + /* x1d4_ */ + out.Put(x1d4_); + /* x1d8_ */ + out.Put(x1d8_); + /* x1e4_leftStickDivisor */ + out.Put(x1e4_leftStickDivisor); + /* x1e8_rightStickDivisor */ + out.Put(x1e8_rightStickDivisor); + /* x200_ */ + out.Put(x200_); + /* x204_ballTouchRadius */ + out.Put(x204_ballTouchRadius); + /* x20c_boostBallDrainTime */ + out.Put(x20c_boostBallDrainTime); + /* x218_boostBallMinChargeTime */ + out.Put(x218_boostBallMinChargeTime); + /* x21c_boostBallMinRelativeSpeedForDamage */ + out.Put(x21c_boostBallMinRelativeSpeedForDamage); + /* x220_boostBallChargeTime0 */ + out.Put(x220_boostBallChargeTime0); + /* x224_boostBallChargeTime1 */ + out.Put(x224_boostBallChargeTime1); + /* x210_boostBallMaxChargeTime */ + out.Put(x210_boostBallMaxChargeTime); + /* x22c_boostBallIncrementalSpeed0 */ + out.Put(x22c_boostBallIncrementalSpeed0); + /* x230_boostBallIncrementalSpeed1 */ + out.Put(x230_boostBallIncrementalSpeed1); + /* x234_boostBallIncrementalSpeed2 */ + out.Put(x234_boostBallIncrementalSpeed2); +} +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/Tweaks/CTweakBall.hpp b/Runtime/MP1/Tweaks/CTweakBall.hpp new file mode 100644 index 000000000..6a9c0f092 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakBall.hpp @@ -0,0 +1,199 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakBall.hpp" +#include "zeus/CVector3f.hpp" + +namespace metaforce::MP1 { +struct CTweakBall final : public Tweaks::ITweakBall { + float x4_maxTranslationAcceleration[8]; + float x24_translationFriction[8]; + float x44_translationMaxSpeed[8]; + float x64_; + float x68_; + float x6c_; + float x70_; + float x74_ballCameraAnglePerSecond; + zeus::CVector3f x78_ballCameraOffset; + float x84_ballCameraMinSpeedDistance; + float x88_ballCameraMaxSpeedDistance; + float x8c_ballCameraBackwardsDistance; + float x90_; + float x94_ballCameraSpringConstant; + float x98_ballCameraSpringMax; + float x9c_ballCameraSpringTardis; + float xa0_ballCameraCentroidSpringConstant; + float xa4_ballCameraCentroidSpringMax; + float xa8_ballCameraCentroidSpringTardis; + float xac_ballCameraCentroidDistanceSpringConstant; + float xb0_ballCameraCentroidDistanceSpringMax; + float xb4_ballCameraCentroidDistanceSpringTardis; + float xb8_ballCameraLookAtSpringConstant; + float xbc_ballCameraLookAtSpringMax; + float xc0_ballCameraLookAtSpringTardis; + float xc4_ballForwardBrakingAcceleration[8]; + float xe4_ballGravity; + float xe8_ballWaterGravity; + float xec_ = 10000.f; + float xf0_ = 1000.f; + float xf4_ = 40000.f; + float xf8_ = 40000.f; + float xfc_ = 40000.f; + float x100_ = 40000.f; + float x104_ = 40000.f; + float x108_ = 40000.f; + float x10c_ = 10000.f; + float x110_ = 1000.f; + float x114_ = 40000.f; + float x118_ = 40000.f; + float x11c_ = 40000.f; + float x120_ = 40000.f; + float x124_ = 40000.f; + float x128_ = 40000.f; + float x12c_ballSlipFactor[8] = {10000.f, 10000.f, 1000.f, 10000.f, 2000.f, 2000.f, 2000.f, 2000.f}; + float x14c_; + float x150_; + float x158_; + float x154_; + float x15c_; + float x160_; + float x164_; + float x168_; + float x16c_; + float x170_conservativeDoorCamDistance; + float x174_; + float x178_ballCameraChaseElevation; + float x17c_ballCameraChaseDampenAngle; + float x180_ballCameraChaseDistance; + float x184_ballCameraChaseYawSpeed; + float x188_ballCameraChaseAnglePerSecond; + zeus::CVector3f x18c_ballCameraChaseLookAtOffset; + float x198_ballCameraChaseSpringConstant; + float x19c_ballCameraChaseSpringMax; + float x1a0_ballCameraChaseSpringTardis; + float x1a4_ballCameraBoostElevation; + float x1a8_ballCameraBoostDampenAngle; + float x1ac_ballCameraBoostDistance; + float x1b0_ballCameraBoostYawSpeed; + float x1b4_ballCameraBoostAnglePerSecond; + zeus::CVector3f x1b8_ballCameraBoostLookAtOffset; + float x1c4_ballCameraBoostSpringConstant; + float x1c8_ballCameraBoostSpringMax; + float x1cc_ballCameraBoostSpringTardis; + float x1d0_ballCameraControlDistance; + float x1d4_; + float x1d8_; + float x1dc_minimumAlignmentSpeed; + float x1e0_tireness; + float x1ec_maxLeanAngle; + float x1f0_tireToMarbleThresholdSpeed; + float x1f4_marbleToTireThresholdSpeed; + float x1f8_forceToLeanGain; + float x1fc_leanTrackingGain; + float x1e4_leftStickDivisor; + float x1e8_rightStickDivisor; + float x200_; + float x204_ballTouchRadius; + float x208_; + float x20c_boostBallDrainTime; + float x218_boostBallMinChargeTime; + float x21c_boostBallMinRelativeSpeedForDamage; + float x220_boostBallChargeTime0; + float x224_boostBallChargeTime1; + float x228_boostBallChargeTime2; + float x210_boostBallMaxChargeTime; + float x22c_boostBallIncrementalSpeed0; + float x230_boostBallIncrementalSpeed1; + float x234_boostBallIncrementalSpeed2; + + CTweakBall() = default; + CTweakBall(CInputStream& r); + float GetMaxBallTranslationAcceleration(int s) const override { return x4_maxTranslationAcceleration[s]; } + float GetBallTranslationFriction(int s) const override { return x24_translationFriction[s]; } + float GetBallTranslationMaxSpeed(int s) const override { return x44_translationMaxSpeed[s]; } + float GetBallCameraElevation() const override { return 2.736f; } + float GetBallCameraAnglePerSecond() const override { return x74_ballCameraAnglePerSecond; } + const zeus::CVector3f& GetBallCameraOffset() const override { return x78_ballCameraOffset; } + float GetBallCameraMinSpeedDistance() const override { return x84_ballCameraMinSpeedDistance; } + float GetBallCameraMaxSpeedDistance() const override { return x88_ballCameraMaxSpeedDistance; } + float GetBallCameraBackwardsDistance() const override { return x8c_ballCameraBackwardsDistance; } + float GetBallCameraSpringConstant() const override { return x94_ballCameraSpringConstant; } + float GetBallCameraSpringMax() const override { return x98_ballCameraSpringMax; } + float GetBallCameraSpringTardis() const override { return x9c_ballCameraSpringTardis; } + float GetBallCameraCentroidSpringConstant() const override { return xa0_ballCameraCentroidSpringConstant; } + float GetBallCameraCentroidSpringMax() const override { return xa4_ballCameraCentroidSpringMax; } + float GetBallCameraCentroidSpringTardis() const override { return xa8_ballCameraCentroidSpringTardis; } + float GetBallCameraCentroidDistanceSpringConstant() const override { + return xac_ballCameraCentroidDistanceSpringConstant; + } + float GetBallCameraCentroidDistanceSpringMax() const override { return xb0_ballCameraCentroidDistanceSpringMax; } + float GetBallCameraCentroidDistanceSpringTardis() const override { + return xb4_ballCameraCentroidDistanceSpringTardis; + } + float GetBallCameraLookAtSpringConstant() const override { return xb8_ballCameraLookAtSpringConstant; } + float GetBallCameraLookAtSpringMax() const override { return xbc_ballCameraLookAtSpringMax; } + float GetBallCameraLookAtSpringTardis() const override { return xc0_ballCameraLookAtSpringTardis; } + float GetBallForwardBrakingAcceleration(int s) const override { return xc4_ballForwardBrakingAcceleration[s]; } + float GetBallGravity() const override { return xe4_ballGravity; } + float GetBallWaterGravity() const override { return xe8_ballWaterGravity; } + float GetBallSlipFactor(int s) const override { return x12c_ballSlipFactor[s]; } + float GetConservativeDoorCameraDistance() const override { return x170_conservativeDoorCamDistance; } + float GetBallCameraChaseElevation() const override { return x178_ballCameraChaseElevation; } + float GetBallCameraChaseDampenAngle() const override { return x17c_ballCameraChaseDampenAngle; } + float GetBallCameraChaseDistance() const override { return x180_ballCameraChaseDistance; } + float GetBallCameraChaseYawSpeed() const override { return x184_ballCameraChaseYawSpeed; } + float GetBallCameraChaseAnglePerSecond() const override { return x188_ballCameraChaseAnglePerSecond; } + const zeus::CVector3f& GetBallCameraChaseLookAtOffset() const override { return x18c_ballCameraChaseLookAtOffset; } + float GetBallCameraChaseSpringConstant() const override { return x198_ballCameraChaseSpringConstant; } + float GetBallCameraChaseSpringMax() const override { return x19c_ballCameraChaseSpringMax; } + float GetBallCameraChaseSpringTardis() const override { return x1a0_ballCameraChaseSpringTardis; } + float GetBallCameraBoostElevation() const override { return x1a4_ballCameraBoostElevation; } + float GetBallCameraBoostDampenAngle() const override { return x1a8_ballCameraBoostDampenAngle; } + float GetBallCameraBoostDistance() const override { return x1ac_ballCameraBoostDistance; } + float GetBallCameraBoostYawSpeed() const override { return x1b0_ballCameraBoostYawSpeed; } + float GetBallCameraBoostAnglePerSecond() const override { return x1b4_ballCameraBoostAnglePerSecond; } + const zeus::CVector3f& GetBallCameraBoostLookAtOffset() const override { return x1b8_ballCameraBoostLookAtOffset; } + float GetBallCameraBoostSpringConstant() const override { return x1c4_ballCameraBoostSpringConstant; } + float GetBallCameraBoostSpringMax() const override { return x1c8_ballCameraBoostSpringMax; } + float GetBallCameraBoostSpringTardis() const override { return x1cc_ballCameraBoostSpringTardis; } + float GetBallCameraControlDistance() const override { return x1d0_ballCameraControlDistance; } + float GetMinimumAlignmentSpeed() const override { return x1dc_minimumAlignmentSpeed; } + float GetTireness() const override { return x1e0_tireness; } + float GetMaxLeanAngle() const override { return x1ec_maxLeanAngle; } + float GetTireToMarbleThresholdSpeed() const override { return x1f0_tireToMarbleThresholdSpeed; } + float GetMarbleToTireThresholdSpeed() const override { return x1f4_marbleToTireThresholdSpeed; } + float GetForceToLeanGain() const override { return x1f8_forceToLeanGain; } + float GetLeanTrackingGain() const override { return x1fc_leanTrackingGain; } + float GetLeftStickDivisor() const override { return x1e4_leftStickDivisor; } + float GetRightStickDivisor() const override { return x1e8_rightStickDivisor; } + float GetBallTouchRadius() const override { return x204_ballTouchRadius; } + float GetBoostBallDrainTime() const override { return x20c_boostBallDrainTime; } + float GetBoostBallMaxChargeTime() const override { return x210_boostBallMaxChargeTime; } + float GetBoostBallMinChargeTime() const override { return x218_boostBallMinChargeTime; } + float GetBoostBallMinRelativeSpeedForDamage() const override { return x21c_boostBallMinRelativeSpeedForDamage; } + float GetBoostBallChargeTimeTable(int i) const override { + switch (i) { + default: + case 0: + return x220_boostBallChargeTime0; + case 1: + return x224_boostBallChargeTime1; + case 2: + return x228_boostBallChargeTime2; + } + } + float GetBoostBallIncrementalSpeedTable(int i) const override { + switch (i) { + default: + case 0: + return x22c_boostBallIncrementalSpeed0; + case 1: + return x230_boostBallIncrementalSpeed1; + case 2: + return x234_boostBallIncrementalSpeed2; + } + } + + void LoadTweaks(CInputStream& in); + void PutTo(COutputStream& out); +}; +} // namespace metaforce::MP1 diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGame.cpp b/Runtime/MP1/Tweaks/CTweakGame.cpp similarity index 83% rename from DataSpec/DNAMP1/Tweaks/CTweakGame.cpp rename to Runtime/MP1/Tweaks/CTweakGame.cpp index 8b30dbfa1..dc1a8db77 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGame.cpp +++ b/Runtime/MP1/Tweaks/CTweakGame.cpp @@ -1,6 +1,8 @@ -#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp" +#include "Runtime/MP1/Tweaks/CTweakGame.hpp" #include "Runtime/Camera/CCameraManager.hpp" +#include "Runtime/Streams/CInputStream.hpp" + #include #include @@ -34,7 +36,35 @@ (value) = tmp; \ } -namespace DataSpec::DNAMP1 { +namespace metaforce::MP1 { + +CTweakGame::CTweakGame(CInputStream& in) { + x4_worldPrefix = in.Get(); + x14_defaultRoom = in.Get(); + x24_fov = in.ReadFloat(); + x28_unknown1 = in.ReadBool(); + x29_unknown2 = in.ReadBool(); + x2a_unknown3 = in.ReadBool(); + x2b_splashScreensDisabled = in.ReadBool(); + x2c_unknown5 = in.ReadFloat(); + x30_pressStartDelay = in.ReadFloat(); + x34_wavecapIntensityNormal = in.ReadFloat(); + x38_wavecapIntensityPoison = in.ReadFloat(); + x3c_wavecapIntensityLava = in.ReadFloat(); + x40_rippleIntensityNormal = in.ReadFloat(); + x44_rippleIntensityPoison = in.ReadFloat(); + x48_rippleIntensityLava = in.ReadFloat(); + x4c_fluidEnvBumpScale = in.ReadFloat(); + x50_waterFogDistanceBase = in.ReadFloat(); + x54_waterFogDistanceRange = in.ReadFloat(); + x58_gravityWaterFogDistanceBase = in.ReadFloat(); + x5c_gravityWaterFogDistanceRange = in.ReadFloat(); + x60_hardmodeDamageMult = in.ReadFloat(); + x64_hardmodeWeaponMult = in.ReadFloat(); +#ifdef NDEBUG + x2b_splashScreensDisabled = false; +#endif +} DEFINE_CVAR_GLOBAL(WorldPrefix); DEFINE_CVAR_GLOBAL(FieldOfView); @@ -94,4 +124,4 @@ void CTweakGame::initCVars(hecl::CVarManager* mgr) { CREATE_CVAR(HardModeDamageMult, "", x60_hardmodeDamageMult, skDefaultFlags); CREATE_CVAR(HardModeWeaponMult, "", x64_hardmodeWeaponMult, skDefaultFlags); } -} // namespace DataSpec::DNAMP1 +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/Tweaks/CTweakGame.hpp b/Runtime/MP1/Tweaks/CTweakGame.hpp new file mode 100644 index 000000000..5eb15c8f1 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakGame.hpp @@ -0,0 +1,86 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakGame.hpp" + +namespace hecl { +class CVar; +} // namespace hecl + +namespace metaforce { +class CInputStream; +namespace MP1 { + +#define DEFINE_CVAR_GLOBAL(name) extern hecl::CVar* tw_##name; + +DEFINE_CVAR_GLOBAL(WorldPrefix); +DEFINE_CVAR_GLOBAL(FieldOfView); +DEFINE_CVAR_GLOBAL(SplashScreensDisabled); +DEFINE_CVAR_GLOBAL(PressStartDelay); +DEFINE_CVAR_GLOBAL(WavecapIntensityNormal); +DEFINE_CVAR_GLOBAL(WavecapIntensityPoison); +DEFINE_CVAR_GLOBAL(WavecapIntensityLava); +DEFINE_CVAR_GLOBAL(RippleIntensityNormal); +DEFINE_CVAR_GLOBAL(RippleIntensityPoison); +DEFINE_CVAR_GLOBAL(RippleIntensityLava); +DEFINE_CVAR_GLOBAL(FluidEnvBumpScale); +DEFINE_CVAR_GLOBAL(WaterFogDistanceBase); +DEFINE_CVAR_GLOBAL(WaterFogDistanceRange); +DEFINE_CVAR_GLOBAL(GravityWaterFogDistanceBase); +DEFINE_CVAR_GLOBAL(GravityWaterFogDistanceRange); +DEFINE_CVAR_GLOBAL(HardModeDamageMult); +DEFINE_CVAR_GLOBAL(HardModeWeaponMult); + +#undef DEFINE_CVAR_GLOBAL + +struct CTweakGame final : Tweaks::ITweakGame { + std::string x4_worldPrefix; + std::string x14_defaultRoom; + float x24_fov{}; + bool x28_unknown1{}; + bool x29_unknown2{}; + bool x2a_unknown3{}; + bool x2b_splashScreensDisabled{}; + float x2c_unknown5{}; + float x30_pressStartDelay{}; + float x34_wavecapIntensityNormal{}; + float x38_wavecapIntensityPoison{}; + float x3c_wavecapIntensityLava{}; + float x40_rippleIntensityNormal{}; + float x44_rippleIntensityPoison{}; + float x48_rippleIntensityLava{}; + float x4c_fluidEnvBumpScale{}; + float x50_waterFogDistanceBase{}; + float x54_waterFogDistanceRange{}; + float x58_gravityWaterFogDistanceBase{}; + float x5c_gravityWaterFogDistanceRange{}; + float x60_hardmodeDamageMult{}; + float x64_hardmodeWeaponMult{}; + + std::string_view GetWorldPrefix() const override { return x4_worldPrefix; } + std::string_view GetDefaultRoom() const { return x14_defaultRoom; } + bool GetSplashScreensDisabled() const override { return x2b_splashScreensDisabled; } + float GetFirstPersonFOV() const override { return x24_fov; } + float GetPressStartDelay() const override { return x30_pressStartDelay; } + float GetWavecapIntensityNormal() const override { return x34_wavecapIntensityNormal; } + float GetWavecapIntensityPoison() const override { return x38_wavecapIntensityPoison; } + float GetWavecapIntensityLava() const override { return x3c_wavecapIntensityLava; } + float GetRippleIntensityNormal() const override { return x40_rippleIntensityNormal; } + float GetRippleIntensityPoison() const override { return x44_rippleIntensityPoison; } + float GetRippleIntensityLava() const override { return x48_rippleIntensityLava; } + float GetFluidEnvBumpScale() const override { return x4c_fluidEnvBumpScale; } + float GetWaterFogDistanceBase() const override { return x50_waterFogDistanceBase; } + float GetWaterFogDistanceRange() const override { return x54_waterFogDistanceRange; } + float GetGravityWaterFogDistanceBase() const override { return x58_gravityWaterFogDistanceBase; } + float GetGravityWaterFogDistanceRange() const override { return x5c_gravityWaterFogDistanceRange; } + float GetHardModeDamageMultiplier() const override { return x60_hardmodeDamageMult; } + float GetHardModeWeaponMultiplier() const override { return x64_hardmodeWeaponMult; } + CTweakGame() = default; + CTweakGame(CInputStream& in); + + void initCVars(hecl::CVarManager* mgr) override; + +private: + void _tweakListener(hecl::CVar* cv); +}; +} // namespace MP1 +} // namespace metaforce diff --git a/Runtime/MP1/Tweaks/CTweakGui.cpp b/Runtime/MP1/Tweaks/CTweakGui.cpp new file mode 100644 index 000000000..3e47593af --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakGui.cpp @@ -0,0 +1,183 @@ +#include "Runtime/MP1/Tweaks/CTweakGui.hpp" +#include "Runtime/Streams/IOStreams.hpp" + +namespace metaforce::MP1 { +CTweakGui::CTweakGui(CInputStream& in) +: x4_(in.ReadBool()) +, x8_mapAlphaInterp(in.ReadFloat()) +, xc_pauseBlurFactor(in.ReadFloat()) +, x10_radarXYRadius(in.ReadFloat()) +, x14_(in.ReadFloat()) +, x18_(in.ReadFloat()) +, x1c_(in.ReadFloat()) +, x20_(in.ReadFloat()) +, x24_radarZRadius(in.ReadFloat()) +, x28_radarZCloseRadius(in.ReadFloat()) +, x30_(in.ReadFloat()) +, x34_energyBarFilledSpeed(in.ReadFloat()) +, x38_energyBarShadowSpeed(in.ReadFloat()) +, x3c_energyBarDrainDelay(in.ReadFloat()) +, x40_energyBarAlwaysResetDelay(in.ReadBool()) +, x44_hudDamagePracticalsGainConstant(in.ReadFloat()) +, x48_hudDamagePracticalsGainLinear(in.ReadFloat()) +, x4c_hudDamagePracticalsInitConstant(in.ReadFloat()) +, x50_hudDamagePracticalsInitLinear(in.ReadFloat()) +, x54_hudDamageLightSpotAngle(in.ReadFloat()) +, x58_damageLightAngleC(in.ReadFloat()) +, x5c_damageLightAngleL(in.ReadFloat()) +, x60_damageLightAngleQ(in.ReadFloat()) +, x64_damageLightPreTranslate(in.Get()) +, x70_damageLightCenterTranslate(in.Get()) +, x7c_damageLightXfXAngle(in.ReadFloat()) +, x80_damageLightXfZAngle(in.ReadFloat()) +, x84_hudDecoShakeTranslateVelConstant(in.ReadFloat()) +, x88_hudDecoShakeTranslateVelLinear(in.ReadFloat()) +, x8c_maxDecoDamageShakeTranslate(in.ReadFloat()) +, x90_decoDamageShakeDeceleration(in.ReadFloat()) +, x94_decoShakeGainConstant(in.ReadFloat()) +, x98_decoShakeGainLinear(in.ReadFloat()) +, x9c_decoShakeInitConstant(in.ReadFloat()) +, xa0_decoShakeInitLinear(in.ReadFloat()) +, xa4_maxDecoDamageShakeRotate(in.ReadFloat()) +, xa8_hudCamFovTweak(in.ReadLong()) +, xac_hudCamYTweak(in.ReadLong()) +, xb0_hudCamZTweak(in.ReadLong()) +, xb4_(in.ReadFloat()) +, xb8_(in.ReadFloat()) +, xbc_(in.ReadFloat()) +, xc0_beamVisorMenuAnimTime(in.ReadFloat()) +, xc4_visorBeamMenuItemActiveScale(in.ReadFloat()) +, xc8_visorBeamMenuItemInactiveScale(in.ReadFloat()) +, xcc_visorBeamMenuItemTranslate(in.ReadFloat()) +, xd0_(in.ReadFloat()) +, xd4_(in.ReadLong()) +, xd8_(in.ReadFloat()) +, xdc_(in.ReadFloat()) +, xe0_(in.ReadFloat()) +, xe4_threatRange(in.ReadFloat()) +, xe8_radarScopeCoordRadius(in.ReadFloat()) +, xec_radarPlayerPaintRadius(in.ReadFloat()) +, xf0_radarEnemyPaintRadius(in.ReadFloat()) +, xf4_missileArrowVisTime(in.ReadFloat()) +, xf8_hudVisMode(EHudVisMode(in.ReadLong())) +, xfc_helmetVisMode(EHelmetVisMode(in.ReadLong())) +, x100_enableAutoMapper(in.ReadLong()) +, x104_(in.ReadLong()) +, x108_enableTargetingManager(in.ReadLong()) +, x10c_enablePlayerVisor(in.ReadLong()) +, x110_threatWarningFraction(in.ReadFloat()) +, x114_missileWarningFraction(in.ReadFloat()) +, x118_freeLookFadeTime(in.ReadFloat()) +, x11c_(in.ReadFloat()) +, x120_(in.ReadFloat()) +, x124_(in.ReadFloat()) +, x128_(in.ReadFloat()) +, x12c_freeLookSfxPitchScale(in.ReadFloat()) +, x130_noAbsoluteFreeLookSfxPitch(in.ReadBool()) +, x134_(in.ReadFloat()) +, x138_(in.ReadFloat()) +, x13c_faceReflectionOrthoWidth(in.ReadLong()) +, x140_faceReflectionOrthoHeight(in.ReadLong()) +, x144_faceReflectionDistance(in.ReadLong()) +, x148_faceReflectionHeight(in.ReadLong()) +, x14c_faceReflectionAspect(in.ReadLong()) +, x150_(in.Get()) +, x160_(in.Get()) +, x170_(in.Get()) +, x180_(in.Get()) +, x190_(in.Get()) +, x1a0_missileWarningPulseTime(in.ReadFloat()) +, x1a4_explosionLightFalloffMultConstant(in.ReadFloat()) +, x1a8_explosionLightFalloffMultLinear(in.ReadFloat()) +, x1ac_explosionLightFalloffMultQuadratic(in.ReadFloat()) +, x1b0_(in.ReadFloat()) +, x1b4_hudDamagePeakFactor(in.ReadFloat()) +, x1b8_hudDamageFilterGainConstant(in.ReadFloat()) +, x1bc_hudDamageFilterGainLinear(in.ReadFloat()) +, x1c0_hudDamageFilterInitConstant(in.ReadFloat()) +, x1c4_hudDamageFilterInitLinear(in.ReadFloat()) +, x1c8_energyDrainModPeriod(in.ReadFloat()) +, x1cc_energyDrainSinusoidalPulse(in.ReadBool()) +, x1cd_energyDrainFilterAdditive(in.ReadBool()) +, x1d0_hudDamagePulseDuration(in.ReadFloat()) +, x1d4_hudDamageColorGain(in.ReadFloat()) +, x1d8_hudDecoShakeTranslateGain(in.ReadFloat()) +, x1dc_hudLagOffsetScale(in.ReadFloat()) +, x1e0_(in.ReadFloat()) +, x1e4_(in.ReadFloat()) +, x1e8_(in.ReadFloat()) +, x1ec_(in.ReadFloat()) +, x1f0_(in.ReadFloat()) +, x1f4_(in.ReadFloat()) +, x1f8_(in.ReadFloat()) +, x1fc_(in.ReadFloat()) +, x20c_(in.ReadFloat()) +, x210_scanSidesAngle(in.ReadFloat()) +, x214_scanSidesXScale(in.ReadFloat()) +, x218_scanSidesPositionEnd(in.ReadFloat()) +, x21c_(in.ReadFloat()) +, x220_scanSidesDuration(in.ReadFloat()) +, x224_scanSidesStartTime(in.ReadFloat()) +, x22c_scanDataDotRadius(in.ReadFloat()) +, x230_scanDataDotPosRandMag(in.ReadFloat()) +, x234_scanDataDotSeekDurationMin(in.ReadFloat()) +, x238_scanDataDotSeekDurationMax(in.ReadFloat()) +, x23c_scanDataDotHoldDurationMin(in.ReadFloat()) +, x240_scanDataDotHoldDurationMax(in.ReadFloat()) +, x244_scanAppearanceDuration(in.ReadFloat()) +, x248_scanPaneFlashFactor(in.ReadFloat()) +, x24c_scanPaneFadeInTime(in.ReadFloat()) +, x250_scanPaneFadeOutTime(in.ReadFloat()) +, x254_ballViewportYReduction(in.ReadFloat()) +, x258_scanWindowIdleW(in.ReadFloat()) +, x25c_scanWindowIdleH(in.ReadFloat()) +, x260_scanWindowActiveW(in.ReadFloat()) +, x264_scanWindowActiveH(in.ReadFloat()) +, x268_scanWindowMagnification(in.ReadFloat()) +, x26c_scanWindowScanningAspect(in.ReadFloat()) +, x270_scanSidesPositionStart(in.ReadFloat()) +, x274_showAutomapperInMorphball(in.ReadBool()) +, x278_wtMgrCharsPerSfx(in.ReadFloat()) +, x27c_xrayFogMode(in.ReadLong()) +, x280_xrayFogNearZ(in.ReadFloat()) +, x284_xrayFogFarZ(in.ReadFloat()) +, x288_xrayFogColor(in.Get()) +, x28c_thermalVisorLevel(in.ReadFloat()) +, x290_thermalVisorColor(in.Get()) { + for (u32 i = 0; i < 4; ++i) { + x294_hudLightAddPerVisor[i] = in.Get(); + } + for (u32 i = 0; i < 4; ++i) { + x2a4_hudLightMultiplyPerVisor[i] = in.Get(); + } + + x2b4_hudReflectivityLightColor = in.Get(); + x2b8_hudLightAttMulConstant = in.ReadFloat(); + x2bc_hudLightAttMulLinear = in.ReadFloat(); + x2c0_hudLightAttMulQuadratic = in.ReadFloat(); + read_reserved_vector(x2c4_scanSpeeds, in); + x2d0_creditsTable = in.Get(); + x2e0_creditsFont = in.Get(); + x2f0_japaneseCreditsFont = in.Get(); + x300_ = in.Get(); + x304_ = in.Get(); + x308_ = in.ReadFloat(); + x30c_ = in.ReadFloat(); + x310_ = in.ReadFloat(); + x314_ = in.Get(); + x324_ = in.Get(); + x334_ = in.Get(); + x344_ = in.Get(); + x348_ = in.Get(); + x34c_ = in.Get(); + x350_ = in.Get(); + x354_ = in.Get(); + x358_ = in.Get(); + x35c_ = in.ReadFloat(); + x360_ = in.ReadFloat(); + x364_ = in.ReadFloat(); + + FixupValues(); +} + +} // namespace metaforce::MP1 \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakGui.hpp b/Runtime/MP1/Tweaks/CTweakGui.hpp new file mode 100644 index 000000000..c4a7df872 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakGui.hpp @@ -0,0 +1,332 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakGui.hpp" +#include "rstl.hpp" + +namespace metaforce::MP1 { +struct CTweakGui final : Tweaks::ITweakGui { + bool x4_{}; + float x8_mapAlphaInterp{}; + float xc_pauseBlurFactor{}; + float x10_radarXYRadius{}; + float x14_{}; + float x18_{}; + float x1c_{}; + float x20_{}; + float x24_radarZRadius{}; + float x28_radarZCloseRadius{}; + u32 x2c_ = 0; + float x30_{}; + float x34_energyBarFilledSpeed{}; + float x38_energyBarShadowSpeed{}; + float x3c_energyBarDrainDelay{}; + bool x40_energyBarAlwaysResetDelay{}; + float x44_hudDamagePracticalsGainConstant{}; + float x48_hudDamagePracticalsGainLinear{}; + float x4c_hudDamagePracticalsInitConstant{}; + float x50_hudDamagePracticalsInitLinear{}; + float x54_hudDamageLightSpotAngle{}; + float x58_damageLightAngleC{}; + float x5c_damageLightAngleL{}; + float x60_damageLightAngleQ{}; + zeus::CVector3f x64_damageLightPreTranslate; + zeus::CVector3f x70_damageLightCenterTranslate; + float x7c_damageLightXfXAngle{}; + float x80_damageLightXfZAngle{}; + float x84_hudDecoShakeTranslateVelConstant{}; + float x88_hudDecoShakeTranslateVelLinear{}; + float x8c_maxDecoDamageShakeTranslate{}; + float x90_decoDamageShakeDeceleration{}; + float x94_decoShakeGainConstant{}; + float x98_decoShakeGainLinear{}; + float x9c_decoShakeInitConstant{}; + float xa0_decoShakeInitLinear{}; + float xa4_maxDecoDamageShakeRotate{}; + u32 xa8_hudCamFovTweak{}; + u32 xac_hudCamYTweak{}; + u32 xb0_hudCamZTweak{}; + float xb4_{}; + float xb8_{}; + float xbc_{}; + float xc0_beamVisorMenuAnimTime{}; + float xc4_visorBeamMenuItemActiveScale{}; + float xc8_visorBeamMenuItemInactiveScale{}; + float xcc_visorBeamMenuItemTranslate{}; + float xd0_{}; + u32 xd4_{}; + float xd8_{}; + float xdc_{}; + float xe0_{}; + float xe4_threatRange{}; + float xe8_radarScopeCoordRadius{}; + float xec_radarPlayerPaintRadius{}; + float xf0_radarEnemyPaintRadius{}; + float xf4_missileArrowVisTime{}; + EHudVisMode xf8_hudVisMode; + EHelmetVisMode xfc_helmetVisMode; + u32 x100_enableAutoMapper{}; + u32 x104_{}; + u32 x108_enableTargetingManager{}; + u32 x10c_enablePlayerVisor{}; + float x110_threatWarningFraction{}; + float x114_missileWarningFraction{}; + float x118_freeLookFadeTime{}; + float x11c_{}; + float x120_{}; + float x124_{}; + float x128_{}; + float x12c_freeLookSfxPitchScale{}; + bool x130_noAbsoluteFreeLookSfxPitch{}; + float x134_{}; + float x138_{}; + u32 x13c_faceReflectionOrthoWidth{}; + u32 x140_faceReflectionOrthoHeight{}; + u32 x144_faceReflectionDistance{}; + u32 x148_faceReflectionHeight{}; + u32 x14c_faceReflectionAspect{}; + std::string x150_; + std::string x160_; + std::string x170_; + std::string x180_; + std::string x190_; + float x1a0_missileWarningPulseTime{}; + float x1a4_explosionLightFalloffMultConstant{}; + float x1a8_explosionLightFalloffMultLinear{}; + float x1ac_explosionLightFalloffMultQuadratic{}; + float x1b0_{}; + float x1b4_hudDamagePeakFactor{}; + float x1b8_hudDamageFilterGainConstant{}; + float x1bc_hudDamageFilterGainLinear{}; + float x1c0_hudDamageFilterInitConstant{}; + float x1c4_hudDamageFilterInitLinear{}; + float x1c8_energyDrainModPeriod{}; + bool x1cc_energyDrainSinusoidalPulse{}; + bool x1cd_energyDrainFilterAdditive{}; + float x1d0_hudDamagePulseDuration{}; + float x1d4_hudDamageColorGain{}; + float x1d8_hudDecoShakeTranslateGain{}; + float x1dc_hudLagOffsetScale{}; + float x1e0_{}; + float x1e4_{}; + float x1e8_{}; + float x1ec_{}; + float x1f0_{}; + float x1f4_{}; + float x1f8_{}; + float x1fc_{}; + zeus::CColor x200_; + float x204_xrayBlurScaleLinear = 0.0014f; + float x208_xrayBlurScaleQuadratic = 0.0000525f; + float x20c_{}; + float x210_scanSidesAngle{}; + float x214_scanSidesXScale{}; + float x218_scanSidesPositionEnd{}; + float x21c_{}; + float x220_scanSidesDuration{}; + float x224_scanSidesStartTime{}; + float x228_scanSidesEndTime{}; + float x22c_scanDataDotRadius{}; + float x230_scanDataDotPosRandMag{}; + float x234_scanDataDotSeekDurationMin{}; + float x238_scanDataDotSeekDurationMax{}; + float x23c_scanDataDotHoldDurationMin{}; + float x240_scanDataDotHoldDurationMax{}; + float x244_scanAppearanceDuration{}; + float x248_scanPaneFlashFactor{}; + float x24c_scanPaneFadeInTime{}; + float x250_scanPaneFadeOutTime{}; + float x254_ballViewportYReduction{}; + float x258_scanWindowIdleW{}; + float x25c_scanWindowIdleH{}; + float x260_scanWindowActiveW{}; + float x264_scanWindowActiveH{}; + float x268_scanWindowMagnification{}; + float x26c_scanWindowScanningAspect{}; + float x270_scanSidesPositionStart{}; + bool x274_showAutomapperInMorphball{}; + bool x275_latchArticleText = true; + float x278_wtMgrCharsPerSfx{}; + u32 x27c_xrayFogMode{}; + float x280_xrayFogNearZ{}; + float x284_xrayFogFarZ{}; + zeus::CColor x288_xrayFogColor; + float x28c_thermalVisorLevel{}; + zeus::CColor x290_thermalVisorColor; + std::array x294_hudLightAddPerVisor; + std::array x2a4_hudLightMultiplyPerVisor; + zeus::CColor x2b4_hudReflectivityLightColor; + float x2b8_hudLightAttMulConstant{}; + float x2bc_hudLightAttMulLinear{}; + float x2c0_hudLightAttMulQuadratic{}; + rstl::reserved_vector x2c4_scanSpeeds; + std::string x2d0_creditsTable; + std::string x2e0_creditsFont; + std::string x2f0_japaneseCreditsFont; + zeus::CColor x300_; + zeus::CColor x304_; + float x308_{}; + float x30c_{}; + float x310_{}; + std::string x314_; + std::string x324_; + std::string x334_; + zeus::CColor x344_; + zeus::CColor x348_; + zeus::CColor x34c_; + zeus::CColor x350_; + zeus::CColor x354_; + zeus::CColor x358_; + float x35c_{}; + float x360_{}; + float x364_{}; + + CTweakGui() = default; + CTweakGui(CInputStream& r); + float GetMapAlphaInterpolant() const override { return x8_mapAlphaInterp; } + float GetPauseBlurFactor() const override { return xc_pauseBlurFactor; } + float GetRadarXYRadius() const override { return x10_radarXYRadius; } + float GetRadarZRadius() const override { return x24_radarZRadius; } + float GetRadarZCloseRadius() const override { return x28_radarZCloseRadius; } + float GetEnergyBarFilledSpeed() const override { return x34_energyBarFilledSpeed; } + float GetEnergyBarShadowSpeed() const override { return x38_energyBarShadowSpeed; } + float GetEnergyBarDrainDelay() const override { return x3c_energyBarDrainDelay; } + bool GetEnergyBarAlwaysResetDelay() const override { return x40_energyBarAlwaysResetDelay; } + float GetHudDamagePracticalsGainConstant() const override { return x44_hudDamagePracticalsGainConstant; } + float GetHudDamagePracticalsGainLinear() const override { return x48_hudDamagePracticalsGainLinear; } + float GetHudDamagePracticalsInitConstant() const override { return x4c_hudDamagePracticalsInitConstant; } + float GetHudDamagePracticalsInitLinear() const override { return x50_hudDamagePracticalsInitLinear; } + float GetHudDamageLightSpotAngle() const override { return x54_hudDamageLightSpotAngle; } + float GetDamageLightAngleC() const override { return x58_damageLightAngleC; } + float GetDamageLightAngleL() const override { return x5c_damageLightAngleL; } + float GetDamageLightAngleQ() const override { return x60_damageLightAngleQ; } + zeus::CVector3f GetDamageLightPreTranslate() const override { return x64_damageLightPreTranslate; } + zeus::CVector3f GetDamageLightCenterTranslate() const override { return x70_damageLightCenterTranslate; } + float GetDamageLightXfXAngle() const override { return x7c_damageLightXfXAngle; } + float GetDamageLightXfZAngle() const override { return x80_damageLightXfZAngle; } + float GetHudDecoShakeTranslateVelConstant() const override { return x84_hudDecoShakeTranslateVelConstant; } + float GetHudDecoShakeTranslateVelLinear() const override { return x88_hudDecoShakeTranslateVelLinear; } + float GetMaxDecoDamageShakeTranslate() const override { return x8c_maxDecoDamageShakeTranslate; } + float GetDecoDamageShakeDeceleration() const override { return x90_decoDamageShakeDeceleration; } + float GetDecoShakeGainConstant() const override { return x94_decoShakeGainConstant; } + float GetDecoShakeGainLinear() const override { return x98_decoShakeGainLinear; } + float GetDecoShakeInitConstant() const override { return x9c_decoShakeInitConstant; } + float GetDecoShakeInitLinear() const override { return xa0_decoShakeInitLinear; } + float GetMaxDecoDamageShakeRotate() const override { return xa4_maxDecoDamageShakeRotate; } + u32 GetHudCamFovTweak() const override { return xa8_hudCamFovTweak; } + u32 GetHudCamYTweak() const override { return xac_hudCamYTweak; } + u32 GetHudCamZTweak() const override { return xb0_hudCamZTweak; } + float GetBeamVisorMenuAnimTime() const override { return xc0_beamVisorMenuAnimTime; } + float GetVisorBeamMenuItemActiveScale() const override { return xc4_visorBeamMenuItemActiveScale; } + float GetVisorBeamMenuItemInactiveScale() const override { return xc8_visorBeamMenuItemInactiveScale; } + float GetVisorBeamMenuItemTranslate() const override { return xcc_visorBeamMenuItemTranslate; } + float GetThreatRange() const override { return xe4_threatRange; } + float GetRadarScopeCoordRadius() const override { return xe8_radarScopeCoordRadius; } + float GetRadarPlayerPaintRadius() const override { return xec_radarPlayerPaintRadius; } + float GetRadarEnemyPaintRadius() const override { return xf0_radarEnemyPaintRadius; } + float GetMissileArrowVisTime() const override { return xf4_missileArrowVisTime; } + EHudVisMode GetHudVisMode() const override { return xf8_hudVisMode; } + EHelmetVisMode GetHelmetVisMode() const override { return xfc_helmetVisMode; } + u32 GetEnableAutoMapper() const override { return x100_enableAutoMapper; } + u32 GetEnableTargetingManager() const override { return x108_enableTargetingManager; } + u32 GetEnablePlayerVisor() const override { return x10c_enablePlayerVisor; } + float GetThreatWarningFraction() const override { return x110_threatWarningFraction; } + float GetMissileWarningFraction() const override { return x114_missileWarningFraction; } + float GetFreeLookFadeTime() const override { return x118_freeLookFadeTime; } + float GetFreeLookSfxPitchScale() const override { return x12c_freeLookSfxPitchScale; } + bool GetNoAbsoluteFreeLookSfxPitch() const override { return x130_noAbsoluteFreeLookSfxPitch; } + float GetFaceReflectionOrthoWidth() const override { return x13c_faceReflectionOrthoWidth; } + float GetFaceReflectionOrthoHeight() const override { return x140_faceReflectionOrthoHeight; } + float GetFaceReflectionDistance() const override { return x144_faceReflectionDistance; } + float GetFaceReflectionHeight() const override { return x148_faceReflectionHeight; } + float GetFaceReflectionAspect() const override { return x14c_faceReflectionAspect; } + float GetMissileWarningPulseTime() const override { return x1a0_missileWarningPulseTime; } + float GetExplosionLightFalloffMultConstant() const override { return x1a4_explosionLightFalloffMultConstant; } + float GetExplosionLightFalloffMultLinear() const override { return x1a8_explosionLightFalloffMultLinear; } + float GetExplosionLightFalloffMultQuadratic() const override { return x1ac_explosionLightFalloffMultQuadratic; } + float GetHudDamagePeakFactor() const override { return x1b4_hudDamagePeakFactor; } + float GetHudDamageFilterGainConstant() const override { return x1b8_hudDamageFilterGainConstant; } + float GetHudDamageFilterGainLinear() const override { return x1bc_hudDamageFilterGainLinear; } + float GetHudDamageFilterInitConstant() const override { return x1c0_hudDamageFilterInitConstant; } + float GetHudDamageFilterInitLinear() const override { return x1c4_hudDamageFilterInitLinear; } + float GetEnergyDrainModPeriod() const override { return x1c8_energyDrainModPeriod; } + bool GetEnergyDrainSinusoidalPulse() const override { return x1cc_energyDrainSinusoidalPulse; } + bool GetEnergyDrainFilterAdditive() const override { return x1cd_energyDrainFilterAdditive; } + float GetHudDamagePulseDuration() const override { return x1d0_hudDamagePulseDuration; } + float GetHudDamageColorGain() const override { return x1d4_hudDamageColorGain; } + float GetHudDecoShakeTranslateGain() const override { return x1d8_hudDecoShakeTranslateGain; } + float GetHudLagOffsetScale() const override { return x1dc_hudLagOffsetScale; } + float GetXrayBlurScaleLinear() const override { return x204_xrayBlurScaleLinear; } + float GetXrayBlurScaleQuadratic() const override { return x208_xrayBlurScaleQuadratic; } + float GetScanSidesAngle() const override { return x210_scanSidesAngle; } + float GetScanSidesXScale() const override { return x214_scanSidesXScale; } + float GetScanSidesPositionEnd() const override { return x218_scanSidesPositionEnd; } + float GetScanSidesDuration() const override { return x220_scanSidesDuration; } + float GetScanSidesStartTime() const override { return x224_scanSidesStartTime; } + float GetScanSidesEndTime() const override { return x228_scanSidesEndTime; } + float GetScanDataDotRadius() const override { return x22c_scanDataDotRadius; } + float GetScanDataDotPosRandMagnitude() const override { return x230_scanDataDotPosRandMag; } + float GetScanDataDotSeekDurationMin() const override { return x234_scanDataDotSeekDurationMin; } + float GetScanDataDotSeekDurationMax() const override { return x238_scanDataDotSeekDurationMax; } + float GetScanDataDotHoldDurationMin() const override { return x23c_scanDataDotHoldDurationMin; } + float GetScanDataDotHoldDurationMax() const override { return x240_scanDataDotHoldDurationMax; } + float GetScanAppearanceDuration() const override { return x244_scanAppearanceDuration; } + float GetScanPaneFlashFactor() const override { return x248_scanPaneFlashFactor; } + float GetScanPaneFadeInTime() const override { return x24c_scanPaneFadeInTime; } + float GetScanPaneFadeOutTime() const override { return x250_scanPaneFadeOutTime; } + float GetBallViewportYReduction() const override { return x254_ballViewportYReduction; } + float GetScanWindowIdleWidth() const override { return x258_scanWindowIdleW; } + float GetScanWindowIdleHeight() const override { return x25c_scanWindowIdleH; } + float GetScanWindowActiveWidth() const override { return x260_scanWindowActiveW; } + float GetScanWindowActiveHeight() const override { return x264_scanWindowActiveH; } + float GetScanWindowMagnification() const override { return x268_scanWindowMagnification; } + float GetScanWindowScanningAspect() const override { return x26c_scanWindowScanningAspect; } + float GetScanSidesPositionStart() const override { return x270_scanSidesPositionStart; } + bool GetShowAutomapperInMorphball() const override { return x274_showAutomapperInMorphball; } + bool GetLatchArticleText() const override { return x275_latchArticleText; } + float GetWorldTransManagerCharsPerSfx() const override { return x278_wtMgrCharsPerSfx; } + u32 GetXRayFogMode() const override { return x27c_xrayFogMode; } + float GetXRayFogNearZ() const override { return x280_xrayFogNearZ; } + float GetXRayFogFarZ() const override { return x284_xrayFogFarZ; } + const zeus::CColor& GetXRayFogColor() const override { return x288_xrayFogColor; } + float GetThermalVisorLevel() const override { return x28c_thermalVisorLevel; } + const zeus::CColor& GetThermalVisorColor() const override { return x290_thermalVisorColor; } + const zeus::CColor& GetVisorHudLightAdd(int v) const override { return x294_hudLightAddPerVisor[v]; } + const zeus::CColor& GetVisorHudLightMultiply(int v) const override { return x2a4_hudLightMultiplyPerVisor[v]; } + const zeus::CColor& GetHudReflectivityLightColor() const override { return x2b4_hudReflectivityLightColor; } + float GetHudLightAttMulConstant() const override { return x2b8_hudLightAttMulConstant; } + float GetHudLightAttMulLinear() const override { return x2bc_hudLightAttMulLinear; } + float GetHudLightAttMulQuadratic() const override { return x2c0_hudLightAttMulQuadratic; } + std::string_view GetCreditsTable() const override { return x2d0_creditsTable; } + std::string_view GetCreditsFont() const override { return x2e0_creditsFont; } + std::string_view GetJapaneseCreditsFont() const override { return x2f0_japaneseCreditsFont; } + const zeus::CColor& GetCreditsTextFontColor() const override { return x300_; } + const zeus::CColor& GetCreditsTextBorderColor() const override { return x304_; } + + float GetScanSpeed(int idx) const override { + if (idx < 0 || size_t(idx) >= x2c4_scanSpeeds.size()) + return 0.f; + return x2c4_scanSpeeds[idx]; + } + + void FixupValues() { + xd8_ = zeus::degToRad(xd8_); + xdc_ = zeus::degToRad(xdc_); + + x200_ = zeus::CColor(x1f4_ * 0.25f, x1f8_ * 0.25f, x1fc_ * 0.25f, 1.f); + + x210_scanSidesAngle = zeus::degToRad(x210_scanSidesAngle); + x228_scanSidesEndTime = x220_scanSidesDuration + x224_scanSidesStartTime; + + if (x27c_xrayFogMode == 1) + x27c_xrayFogMode = 2; + else if (x27c_xrayFogMode == 2) + x27c_xrayFogMode = 4; + else if (x27c_xrayFogMode == 3) + x27c_xrayFogMode = 5; + else + x27c_xrayFogMode = 0; + + x84_hudDecoShakeTranslateVelConstant *= 2.0f; + } +}; +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/Tweaks/CTweakGuiColors.cpp b/Runtime/MP1/Tweaks/CTweakGuiColors.cpp new file mode 100644 index 000000000..6a06505ff --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakGuiColors.cpp @@ -0,0 +1,132 @@ +#include "Runtime/MP1/Tweaks/CTweakGuiColors.hpp" +#include "Runtime/Streams/IOStreams.hpp" + + +namespace metaforce::MP1 { + +CTweakGuiColors::SPerVisorColors::SPerVisorColors(CInputStream& in) { + x0_energyBarFilled = in.Get(); + x4_energyBarEmpty = in.Get(); + x8_energyBarShadow = in.Get(); + xc_energyTankFilled = in.Get(); + x10_energyTankEmpty = in.Get(); + x14_energyDigitsFont = in.Get(); + x18_energyDigitsOutline = in.Get(); +} + +CTweakGuiColors::CTweakGuiColors(CInputStream& in) { + x4_pauseBlurFilterColor = in.Get(); + x8_radarStuffColor = in.Get(); + xc_radarPlayerPaintColor = in.Get(); + x10_radarEnemyPaintColor = in.Get(); + x14_hudMessageFill = in.Get(); + x18_hudMessageOutline = in.Get(); + x1c_hudFrameColor = in.Get(); + x20_ = in.Get(); + x24_ = in.Get(); + x28_missileIconColorActive = in.Get(); + x2c_visorBeamMenuItemActive = in.Get(); + x30_visorBeamMenuColorInactive = in.Get(); + x34_energyBarFilledLowEnergy = in.Get(); + x38_energyBarShadowLowEnergy = in.Get(); + x3c_energyBarEmptyLowEnergy = in.Get(); + x40_hudDamageLightColor = in.Get(); + x44_ = in.Get(); + x48_ = in.Get(); + x4c_visorMenuTextFont = in.Get(); + x50_visorMenuTextOutline = in.Get(); + x54_beamMenuTextFont = in.Get(); + x58_beamMenuTextOutline = in.Get(); + x5c_energyWarningFont = in.Get(); + x60_threatWarningFont = in.Get(); + x64_missileWarningFont = in.Get(); + x68_threatBarFilled = in.Get(); + x6c_threatBarShadow = in.Get(); + x70_threatBarEmpty = in.Get(); + x74_missileBarFilled = in.Get(); + x78_missileBarShadow = in.Get(); + x7c_missileBarEmpty = in.Get(); + x80_threatIconColor = in.Get(); + x84_ = in.Get(); + x88_tickDecoColor = in.Get(); + x8c_helmetLightColor = in.Get(); + x90_threatIconSafeColor = in.Get(); + x94_missileIconColorInactive = in.Get(); + x98_missileIconColorChargedCanAlt = in.Get(); + x9c_missileIconColorChargedNoAlt = in.Get(); + xa0_missileIconColorDepleteAlt = in.Get(); + xa4_ = in.Get(); + xa8_ = in.Get(); + xac_ = in.Get(); + xb0_visorBeamMenuLozColor = in.Get(); + xb4_energyWarningOutline = in.Get(); + xb8_threatWarningOutline = in.Get(); + xbc_missileWarningOutline = in.Get(); + xc0_ = in.Get(); + xc4_damageAmbientColor = in.Get(); + xc8_scanFrameInactiveColor = in.Get(); + xcc_scanFrameActiveColor = in.Get(); + xd0_scanFrameImpulseColor = in.Get(); + xd4_scanVisorHudLightMultiply = in.Get(); + xd8_scanVisorScreenDimColor = in.Get(); + xdc_thermalVisorHudLightMultiply = in.Get(); + xe0_energyDrainFilterColor = in.Get(); + xe4_damageAmbientPulseColor = in.Get(); + xe8_energyBarFlashColor = in.Get(); + xec_ = in.Get(); + xf0_ = in.Get(); + xf4_ = in.Get(); + xf8_ = in.Get(); + xfc_ = in.Get(); + x100_xrayEnergyDecoColor = in.Get(); + x104_ = in.Get(); + x108_ = in.Get(); + x10c_ = in.Get(); + x110_ = in.Get(); + x114_ = in.Get(); + x118_ = in.Get(); + x11c_ = in.Get(); + x120_ = in.Get(); + x124_ = in.Get(); + x128_ = in.Get(); + x12c_ = in.Get(); + x130_ = in.Get(); + x134_ = in.Get(); + x138_scanDataDotColor = in.Get(); + x13c_powerBombDigitAvailableFont = in.Get(); + x140_powerBombDigitAvailableOutline = in.Get(); + x144_ = in.Get(); + x148_ballBombFilled = in.Get(); + x14c_ballBombEmpty = in.Get(); + x150_powerBombIconAvailable = in.Get(); + x154_ = in.Get(); + x158_ballEnergyDeco = in.Get(); + x15c_ballBombDeco = in.Get(); + x160_powerBombDigitDepletedFont = in.Get(); + x164_powerBombDigitDepletedOutline = in.Get(); + x168_powerBombIconUnavailable = in.Get(); + x16c_ = in.Get(); + x170_ = in.Get(); + x174_scanDisplayImagePaneColor = in.Get(); + x178_ = in.Get(); + x17c_threatIconWarningColor = in.Get(); + x180_hudCounterFill = in.Get(); + x184_hudCounterOutline = in.Get(); + x188_scanIconCriticalColor = in.Get(); + x18c_scanIconCriticalDimColor = in.Get(); + x190_scanIconNoncriticalColor = in.Get(); + x194_scanIconNoncriticalDimColor = in.Get(); + x198_scanReticuleColor = in.Get(); + x19c_threatDigitsFont = in.Get(); + x1a0_threatDigitsOutline = in.Get(); + x1a4_missileDigitsFont = in.Get(); + x1a8_missileDigitsOutline = in.Get(); + x1ac_thermalDecoColor = in.Get(); + x1b0_thermalOutlinesColor = in.Get(); + x1b4_ = in.Get(); + x1b8_thermalLockColor = in.Get(); + x1bc_pauseItemAmber = in.Get(); + x1c0_pauseItemBlue = in.Get(); + read_reserved_vector(x1c4_perVisorColors, in); +} +} \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakGuiColors.hpp b/Runtime/MP1/Tweaks/CTweakGuiColors.hpp new file mode 100644 index 000000000..7f6d79a7e --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakGuiColors.hpp @@ -0,0 +1,226 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakGuiColors.hpp" +#include "Runtime/rstl.hpp" + +namespace metaforce::MP1 { +struct CTweakGuiColors final : public Tweaks::ITweakGuiColors { + zeus::CColor x4_pauseBlurFilterColor; + zeus::CColor x8_radarStuffColor; + zeus::CColor xc_radarPlayerPaintColor; + zeus::CColor x10_radarEnemyPaintColor; + zeus::CColor x14_hudMessageFill; + zeus::CColor x18_hudMessageOutline; + zeus::CColor x1c_hudFrameColor; + zeus::CColor x20_; + zeus::CColor x24_; + zeus::CColor x28_missileIconColorActive; + zeus::CColor x2c_visorBeamMenuItemActive; + zeus::CColor x30_visorBeamMenuColorInactive; + zeus::CColor x34_energyBarFilledLowEnergy; + zeus::CColor x38_energyBarShadowLowEnergy; + zeus::CColor x3c_energyBarEmptyLowEnergy; + zeus::CColor x40_hudDamageLightColor; + zeus::CColor x44_; + zeus::CColor x48_; + zeus::CColor x4c_visorMenuTextFont; + zeus::CColor x50_visorMenuTextOutline; + zeus::CColor x54_beamMenuTextFont; + zeus::CColor x58_beamMenuTextOutline; + zeus::CColor x5c_energyWarningFont; + zeus::CColor x60_threatWarningFont; + zeus::CColor x64_missileWarningFont; + zeus::CColor x68_threatBarFilled; + zeus::CColor x6c_threatBarShadow; + zeus::CColor x70_threatBarEmpty; + zeus::CColor x74_missileBarFilled; + zeus::CColor x78_missileBarShadow; + zeus::CColor x7c_missileBarEmpty; + zeus::CColor x80_threatIconColor; + zeus::CColor x84_; + zeus::CColor x88_tickDecoColor; + zeus::CColor x8c_helmetLightColor; + zeus::CColor x90_threatIconSafeColor; + zeus::CColor x94_missileIconColorInactive; + zeus::CColor x98_missileIconColorChargedCanAlt; + zeus::CColor x9c_missileIconColorChargedNoAlt; + zeus::CColor xa0_missileIconColorDepleteAlt; + zeus::CColor xa4_; + zeus::CColor xa8_; + zeus::CColor xac_; + zeus::CColor xb0_visorBeamMenuLozColor; + zeus::CColor xb4_energyWarningOutline; + zeus::CColor xb8_threatWarningOutline; + zeus::CColor xbc_missileWarningOutline; + zeus::CColor xc0_; + zeus::CColor xc4_damageAmbientColor; + zeus::CColor xc8_scanFrameInactiveColor; + zeus::CColor xcc_scanFrameActiveColor; + zeus::CColor xd0_scanFrameImpulseColor; + zeus::CColor xd4_scanVisorHudLightMultiply; + zeus::CColor xd8_scanVisorScreenDimColor; + zeus::CColor xdc_thermalVisorHudLightMultiply; + zeus::CColor xe0_energyDrainFilterColor; + zeus::CColor xe4_damageAmbientPulseColor; + zeus::CColor xe8_energyBarFlashColor; + zeus::CColor xec_; + zeus::CColor xf0_; + zeus::CColor xf4_; + zeus::CColor xf8_; + zeus::CColor xfc_; + zeus::CColor x100_xrayEnergyDecoColor; + zeus::CColor x104_; + zeus::CColor x108_; + zeus::CColor x10c_; + zeus::CColor x110_; + zeus::CColor x114_; + zeus::CColor x118_; + zeus::CColor x11c_; + zeus::CColor x120_; + zeus::CColor x124_; + zeus::CColor x128_; + zeus::CColor x12c_; + zeus::CColor x130_; + zeus::CColor x134_; + zeus::CColor x138_scanDataDotColor; + zeus::CColor x13c_powerBombDigitAvailableFont; + zeus::CColor x140_powerBombDigitAvailableOutline; + zeus::CColor x144_; + zeus::CColor x148_ballBombFilled; + zeus::CColor x14c_ballBombEmpty; + zeus::CColor x150_powerBombIconAvailable; + zeus::CColor x154_; + zeus::CColor x158_ballEnergyDeco; + zeus::CColor x15c_ballBombDeco; + zeus::CColor x160_powerBombDigitDepletedFont; + zeus::CColor x164_powerBombDigitDepletedOutline; + zeus::CColor x168_powerBombIconUnavailable; + zeus::CColor x16c_; + zeus::CColor x170_; + zeus::CColor x174_scanDisplayImagePaneColor; + zeus::CColor x178_; + zeus::CColor x17c_threatIconWarningColor; + zeus::CColor x180_hudCounterFill; + zeus::CColor x184_hudCounterOutline; + zeus::CColor x188_scanIconCriticalColor; + zeus::CColor x18c_scanIconCriticalDimColor; + zeus::CColor x190_scanIconNoncriticalColor; + zeus::CColor x194_scanIconNoncriticalDimColor; + zeus::CColor x198_scanReticuleColor; + zeus::CColor x19c_threatDigitsFont; + zeus::CColor x1a0_threatDigitsOutline; + zeus::CColor x1a4_missileDigitsFont; + zeus::CColor x1a8_missileDigitsOutline; + zeus::CColor x1ac_thermalDecoColor; + zeus::CColor x1b0_thermalOutlinesColor; + zeus::CColor x1b4_; + zeus::CColor x1b8_thermalLockColor; + zeus::CColor x1bc_pauseItemAmber; + zeus::CColor x1c0_pauseItemBlue; + struct SPerVisorColors { + zeus::CColor x0_energyBarFilled; + zeus::CColor x4_energyBarEmpty; + zeus::CColor x8_energyBarShadow; + zeus::CColor xc_energyTankFilled; + zeus::CColor x10_energyTankEmpty; + zeus::CColor x14_energyDigitsFont; + zeus::CColor x18_energyDigitsOutline; + explicit SPerVisorColors() = default; + explicit SPerVisorColors(CInputStream& in); + }; + /* Combat, Scan, XRay, Thermal, Ball */ + rstl::reserved_vector x1c4_perVisorColors{}; + + CTweakGuiColors() = default; + CTweakGuiColors(CInputStream& r); + const zeus::CColor& GetPauseBlurFilterColor() const override { return x4_pauseBlurFilterColor; } + const zeus::CColor& GetRadarStuffColor() const override { return x8_radarStuffColor; } + const zeus::CColor& GetRadarPlayerPaintColor() const override { return xc_radarPlayerPaintColor; } + const zeus::CColor& GetRadarEnemyPaintColor() const override { return x10_radarEnemyPaintColor; } + const zeus::CColor& GetHudMessageFill() const override { return x14_hudMessageFill; } + const zeus::CColor& GetHudMessageOutline() const override { return x18_hudMessageOutline; } + const zeus::CColor& GetHudFrameColor() const override { return x1c_hudFrameColor; } + const zeus::CColor& GetMissileIconColorActive() const override { return x28_missileIconColorActive; } + const zeus::CColor& GetVisorBeamMenuItemActive() const override { return x2c_visorBeamMenuItemActive; } + const zeus::CColor& GetVisorBeamMenuItemInactive() const override { return x30_visorBeamMenuColorInactive; } + const zeus::CColor& GetEnergyBarFilledLowEnergy() const override { return x34_energyBarFilledLowEnergy; } + const zeus::CColor& GetEnergyBarShadowLowEnergy() const override { return x38_energyBarShadowLowEnergy; } + const zeus::CColor& GetEnergyBarEmptyLowEnergy() const override { return x3c_energyBarEmptyLowEnergy; } + const zeus::CColor& GetHudDamageLightColor() const override { return x40_hudDamageLightColor; } + const zeus::CColor& GetVisorMenuTextFont() const override { return x4c_visorMenuTextFont; } + const zeus::CColor& GetVisorMenuTextOutline() const override { return x50_visorMenuTextOutline; } + const zeus::CColor& GetBeamMenuTextFont() const override { return x54_beamMenuTextFont; } + const zeus::CColor& GetBeamMenuTextOutline() const override { return x58_beamMenuTextOutline; } + const zeus::CColor& GetEnergyWarningFont() const override { return x5c_energyWarningFont; } + const zeus::CColor& GetThreatWarningFont() const override { return x60_threatWarningFont; } + const zeus::CColor& GetMissileWarningFont() const override { return x64_missileWarningFont; } + const zeus::CColor& GetThreatBarFilled() const override { return x68_threatBarFilled; } + const zeus::CColor& GetThreatBarShadow() const override { return x6c_threatBarShadow; } + const zeus::CColor& GetThreatBarEmpty() const override { return x70_threatBarEmpty; } + const zeus::CColor& GetMissileBarFilled() const override { return x74_missileBarFilled; } + const zeus::CColor& GetMissileBarShadow() const override { return x78_missileBarShadow; } + const zeus::CColor& GetMissileBarEmpty() const override { return x7c_missileBarEmpty; } + const zeus::CColor& GetThreatIconColor() const override { return x80_threatIconColor; } + const zeus::CColor& GetTickDecoColor() const override { return x88_tickDecoColor; } + const zeus::CColor& GetHelmetLightColor() const override { return x8c_helmetLightColor; } + const zeus::CColor& GetThreatIconSafeColor() const override { return x90_threatIconSafeColor; } + const zeus::CColor& GetMissileIconColorInactive() const override { return x94_missileIconColorInactive; } + const zeus::CColor& GetMissileIconColorChargedCanAlt() const override { return x98_missileIconColorChargedCanAlt; } + const zeus::CColor& GetMissileIconColorChargedNoAlt() const override { return x9c_missileIconColorChargedNoAlt; } + const zeus::CColor& GetMissileIconColorDepleteAlt() const override { return xa0_missileIconColorDepleteAlt; } + const zeus::CColor& GetVisorBeamMenuLozColor() const override { return xb0_visorBeamMenuLozColor; } + const zeus::CColor& GetEnergyWarningOutline() const override { return xb4_energyWarningOutline; } + const zeus::CColor& GetThreatWarningOutline() const override { return xb8_threatWarningOutline; } + const zeus::CColor& GetMissileWarningOutline() const override { return xbc_missileWarningOutline; } + const zeus::CColor& GetDamageAmbientColor() const override { return xc4_damageAmbientColor; } + const zeus::CColor& GetScanFrameInactiveColor() const override { return xc8_scanFrameInactiveColor; } + const zeus::CColor& GetScanFrameActiveColor() const override { return xcc_scanFrameActiveColor; } + const zeus::CColor& GetScanFrameImpulseColor() const override { return xd0_scanFrameImpulseColor; } + const zeus::CColor& GetScanVisorHudLightMultiply() const override { return xd4_scanVisorHudLightMultiply; } + const zeus::CColor& GetScanVisorScreenDimColor() const override { return xd8_scanVisorScreenDimColor; } + const zeus::CColor& GetThermalVisorHudLightMultiply() const override { return xdc_thermalVisorHudLightMultiply; } + const zeus::CColor& GetEnergyDrainFilterColor() const override { return xe0_energyDrainFilterColor; } + const zeus::CColor& GetDamageAmbientPulseColor() const override { return xe4_damageAmbientPulseColor; } + const zeus::CColor& GetEnergyBarFlashColor() const override { return xe8_energyBarFlashColor; } + const zeus::CColor& GetXRayEnergyDecoColor() const override { return x100_xrayEnergyDecoColor; } + const zeus::CColor& GetScanDataDotColor() const override { return x138_scanDataDotColor; } + const zeus::CColor& GetPowerBombDigitAvailableFont() const override { return x13c_powerBombDigitAvailableFont; } + const zeus::CColor& GetPowerBombDigitAvailableOutline() const override { return x140_powerBombDigitAvailableOutline; } + const zeus::CColor& GetBallBombFilledColor() const override { return x148_ballBombFilled; } + const zeus::CColor& GetBallBombEmptyColor() const override { return x14c_ballBombEmpty; } + const zeus::CColor& GetPowerBombIconAvailableColor() const override { return x150_powerBombIconAvailable; } + const zeus::CColor& GetBallBombEnergyColor() const override { return x158_ballEnergyDeco; } + const zeus::CColor& GetBallBombDecoColor() const override { return x15c_ballBombDeco; } + const zeus::CColor& GetPowerBombDigitDelpetedFont() const override { return x160_powerBombDigitDepletedFont; } + const zeus::CColor& GetPowerBombDigitDelpetedOutline() const override { return x164_powerBombDigitDepletedOutline; } + const zeus::CColor& GetPowerBombIconDepletedColor() const override { return x168_powerBombIconUnavailable; } + const zeus::CColor& GetScanDisplayImagePaneColor() const override { return x174_scanDisplayImagePaneColor; } + const zeus::CColor& GetThreatIconWarningColor() const override { return x17c_threatIconWarningColor; } + const zeus::CColor& GetHudCounterFill() const override { return x180_hudCounterFill; } + const zeus::CColor& GetHudCounterOutline() const override { return x184_hudCounterOutline; } + const zeus::CColor& GetScanIconCriticalColor() const override { return x188_scanIconCriticalColor; } + const zeus::CColor& GetScanIconCriticalDimColor() const override { return x18c_scanIconCriticalDimColor; } + const zeus::CColor& GetScanIconNoncriticalColor() const override { return x190_scanIconNoncriticalColor; } + const zeus::CColor& GetScanIconNoncriticalDimColor() const override { return x194_scanIconNoncriticalDimColor; } + const zeus::CColor& GetScanReticuleColor() const override { return x198_scanReticuleColor; } + const zeus::CColor& GetThreatDigitsFont() const override { return x19c_threatDigitsFont; } + const zeus::CColor& GetThreatDigitsOutline() const override { return x1a0_threatDigitsOutline; } + const zeus::CColor& GetMissileDigitsFont() const override { return x1a4_missileDigitsFont; } + const zeus::CColor& GetMissileDigitsOutline() const override { return x1a8_missileDigitsOutline; } + const zeus::CColor& GetThermalDecoColor() const override { return x1ac_thermalDecoColor; } + const zeus::CColor& GetThermalOutlinesColor() const override { return x1b0_thermalOutlinesColor; } + const zeus::CColor& GetThermalLockColor() const override { return x1b8_thermalLockColor; } + const zeus::CColor& GetPauseItemAmberColor() const override { return x1bc_pauseItemAmber; } + const zeus::CColor& GetPauseItemBlueColor() const override { return x1c0_pauseItemBlue; } + + SVisorEnergyInitColors GetVisorEnergyInitColors(int idx) const override { + const SPerVisorColors& colors = x1c4_perVisorColors[idx]; + return {colors.xc_energyTankFilled, colors.x10_energyTankEmpty, colors.x14_energyDigitsFont, + colors.x18_energyDigitsOutline}; + } + SVisorEnergyBarColors GetVisorEnergyBarColors(int idx) const override { + const SPerVisorColors& colors = x1c4_perVisorColors[idx]; + return {colors.x0_energyBarFilled, colors.x4_energyBarEmpty, colors.x8_energyBarShadow}; + } +}; +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/Tweaks/CTweakGunRes.cpp b/Runtime/MP1/Tweaks/CTweakGunRes.cpp new file mode 100644 index 000000000..2a2453c0f --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakGunRes.cpp @@ -0,0 +1,48 @@ +#include "Runtime/MP1/Tweaks/CTweakGunRes.hpp" + +namespace metaforce::MP1 { +CTweakGunRes::CTweakGunRes(CInputStream& in) { + m_gunMotion = in.Get(); + m_grappleArm = in.Get(); + m_rightHand = in.Get(); + m_powerBeam = in.Get(); + m_iceBeam = in.Get(); + m_waveBeam = in.Get(); + m_plasmaBeam = in.Get(); + m_phazonBeam = in.Get(); + m_holoTransition = in.Get(); + m_bombSet = in.Get(); + m_bombExplode = in.Get(); + m_powerBombExplode = in.Get(); + m_powerBeamWp = in.Get(); + m_powerBallWp = in.Get(); + m_iceBeamWp = in.Get(); + m_iceBallWp = in.Get(); + m_waveBeamWp = in.Get(); + m_waveBallWp = in.Get(); + m_plasmaBeamWp = in.Get(); + m_plasmaBallWp = in.Get(); + m_phazonBeamWp = in.Get(); + m_phazonBallWp = in.Get(); + m_powerMuzzle = in.Get(); + m_iceMuzzle = in.Get(); + m_waveMuzzle = in.Get(); + m_plasmaMuzzle = in.Get(); + m_phazonMuzzle = in.Get(); + m_powerCharge = in.Get(); + m_iceCharge = in.Get(); + m_waveCharge = in.Get(); + m_plasmaCharge = in.Get(); + m_phazonCharge = in.Get(); + m_powerAuxMuzzle = in.Get(); + m_iceAuxMuzzle = in.Get(); + m_waveAuxMuzzle = in.Get(); + m_plasmaAuxMuzzle = in.Get(); + m_phazonAuxMuzzle = in.Get(); + m_grappleSegment = in.Get(); + m_grappleClaw = in.Get(); + m_grappleHit = in.Get(); + m_grappleMuzzle = in.Get(); + m_grappleSwoosh = in.Get(); +} +} // namespace metaforce::MP1 \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakGunRes.hpp b/Runtime/MP1/Tweaks/CTweakGunRes.hpp new file mode 100644 index 000000000..2b05be76f --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakGunRes.hpp @@ -0,0 +1,90 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakGunRes.hpp" + +namespace metaforce::MP1 { + +struct CTweakGunRes final : Tweaks::ITweakGunRes { + std::string m_gunMotion; + std::string m_grappleArm; + std::string m_rightHand; + + std::string m_powerBeam; + std::string m_iceBeam; + std::string m_waveBeam; + std::string m_plasmaBeam; + std::string m_phazonBeam; + + std::string m_holoTransition; + + std::string m_bombSet; + std::string m_bombExplode; + std::string m_powerBombExplode; + + std::string m_powerBeamWp; + std::string m_powerBallWp; + std::string m_iceBeamWp; + std::string m_iceBallWp; + std::string m_waveBeamWp; + std::string m_waveBallWp; + std::string m_plasmaBeamWp; + std::string m_plasmaBallWp; + std::string m_phazonBeamWp; + std::string m_phazonBallWp; + + std::string m_powerMuzzle; + std::string m_iceMuzzle; + std::string m_waveMuzzle; + std::string m_plasmaMuzzle; + std::string m_phazonMuzzle; + + std::string m_powerCharge; + std::string m_iceCharge; + std::string m_waveCharge; + std::string m_plasmaCharge; + std::string m_phazonCharge; + + std::string m_powerAuxMuzzle; + std::string m_iceAuxMuzzle; + std::string m_waveAuxMuzzle; + std::string m_plasmaAuxMuzzle; + std::string m_phazonAuxMuzzle; + + std::string m_grappleSegment; + std::string m_grappleClaw; + std::string m_grappleHit; + std::string m_grappleMuzzle; + std::string m_grappleSwoosh; + + const std::string& GetGunMotion() const override { return m_gunMotion; } + const std::string& GetGrappleArm() const override { return m_grappleArm; } + const std::string& GetRightHand() const override { return m_rightHand; } + + const std::string& GetPowerBeam() const override { return m_powerBeam; } + const std::string& GetIceBeam() const override { return m_iceBeam; } + const std::string& GetWaveBeam() const override { return m_waveBeam; } + const std::string& GetPlasmaBeam() const override { return m_plasmaBeam; } + const std::string& GetPhazonBeam() const override { return m_phazonBeam; } + + const std::string& GetHoloTransition() const override { return m_holoTransition; } + + const std::string& GetBombSet() const override { return m_bombSet; } + const std::string& GetBombExplode() const override { return m_bombExplode; } + const std::string& GetPowerBombExplode() const override { return m_powerBombExplode; } + + const std::string& GetWeapon(size_t idx, bool ball) const override { return (&m_powerBeamWp)[idx * 2 + ball]; } + const std::string& GetMuzzleParticle(size_t idx) const override { return (&m_powerMuzzle)[idx]; } + const std::string& GetChargeParticle(size_t idx) const override { return (&m_powerCharge)[idx]; } + const std::string& GetAuxMuzzleParticle(size_t idx) const override { return (&m_powerAuxMuzzle)[idx]; } + + const std::string& GetGrappleSegmentParticle() const override { return m_grappleSegment; } + const std::string& GetGrappleClawParticle() const override { return m_grappleClaw; } + const std::string& GetGrappleHitParticle() const override { return m_grappleHit; } + const std::string& GetGrappleMuzzleParticle() const override { return m_grappleMuzzle; } + const std::string& GetGrappleSwooshParticle() const override { return m_grappleSwoosh; } + + CTweakGunRes() = default; + CTweakGunRes(CInputStream& in); +}; + +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/Tweaks/CTweakParticle.cpp b/Runtime/MP1/Tweaks/CTweakParticle.cpp new file mode 100644 index 000000000..e86cb7b09 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakParticle.cpp @@ -0,0 +1,10 @@ +#include "Runtime/MP1/Tweaks/CTweakParticle.hpp" +#include "Runtime/Streams/IOStreams.hpp" + +namespace metaforce::MP1 { +CTweakParticle::CTweakParticle(CInputStream& in) { + m_particle = in.Get(); + m_powerBeam = in.Get(); + m_genThrust = in.Get(); +} +} // namespace metaforce::MP1 \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakParticle.hpp b/Runtime/MP1/Tweaks/CTweakParticle.hpp new file mode 100644 index 000000000..c6f86aea1 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakParticle.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakParticle.hpp" + +namespace metaforce::MP1 { + +struct CTweakParticle final : Tweaks::ITweakParticle { + std::string m_particle; + std::string m_powerBeam; + std::string m_genThrust; + + CTweakParticle() = default; + CTweakParticle(CInputStream& reader); +}; + +} // namespace DataSpec::DNAMP1 diff --git a/Runtime/MP1/Tweaks/CTweakPlayer.cpp b/Runtime/MP1/Tweaks/CTweakPlayer.cpp new file mode 100644 index 000000000..d5d6eff9c --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakPlayer.cpp @@ -0,0 +1,1667 @@ +#include "Runtime/MP1/Tweaks/CTweakPlayer.hpp" + +#include "Runtime/Streams/IOStreams.hpp" + +#include "zeus/Math.hpp" + +#include +#include + +#define DEFINE_CVAR_GLOBAL(name) \ + constexpr std::string_view sk##name = std::string_view("tweak.player." #name); \ + hecl::CVar* tw_##name = nullptr; + +#define CREATE_CVAR(name, help, value, flags) \ + tw_##name = mgr->findOrMakeCVar(sk##name, help, value, flags); \ + if (tw_##name->wasDeserialized()) { \ + tw_##name->toValue(value); \ + } \ + tw_##name->addListener([this](hecl::CVar* cv) { _tweakListener(cv); }); + +#define CREATE_CVAR_BITFIELD(name, help, value, flags) \ + { \ + bool tmp = value; \ + CREATE_CVAR(name, help, tmp, flags) \ + } + +#define UPDATE_CVAR(name, cv, value) \ + if ((cv) == tw_##name) { \ + (cv)->toValue(value); \ + return; \ + } + +#define UPDATE_CVAR_BITFIELD(name, cv, value) \ + { \ + bool tmp = value; \ + UPDATE_CVAR(name, cv, tmp) \ + (value) = tmp; \ + } + +namespace metaforce::MP1 { +namespace { +static constexpr hecl::CVar::EFlags skDefaultFlags = + hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Cheat | hecl::CVar::EFlags::Archive; +DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationNormal); +DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationAir); +DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationIce); +DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationOrganic); +DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationWater); +DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationLava); +DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationPhazon); +DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationShrubbery); +DEFINE_CVAR_GLOBAL(MaxRotationAccelerationNormal); +DEFINE_CVAR_GLOBAL(MaxRotationAccelerationAir); +DEFINE_CVAR_GLOBAL(MaxRotationAccelerationIce); +DEFINE_CVAR_GLOBAL(MaxRotationAccelerationOrganic); +DEFINE_CVAR_GLOBAL(MaxRotationAccelerationWater); +DEFINE_CVAR_GLOBAL(MaxRotationAccelerationLava); +DEFINE_CVAR_GLOBAL(MaxRotationAccelerationPhazon); +DEFINE_CVAR_GLOBAL(MaxRotationAccelerationShrubbery); +DEFINE_CVAR_GLOBAL(TranslationFrictionNormal); +DEFINE_CVAR_GLOBAL(TranslationFrictionAir); +DEFINE_CVAR_GLOBAL(TranslationFrictionIce); +DEFINE_CVAR_GLOBAL(TranslationFrictionOrganic); +DEFINE_CVAR_GLOBAL(TranslationFrictionWater); +DEFINE_CVAR_GLOBAL(TranslationFrictionLava); +DEFINE_CVAR_GLOBAL(TranslationFrictionPhazon); +DEFINE_CVAR_GLOBAL(TranslationFrictionShrubbery); +DEFINE_CVAR_GLOBAL(RotationFrictionNormal); +DEFINE_CVAR_GLOBAL(RotationFrictionAir); +DEFINE_CVAR_GLOBAL(RotationFrictionIce); +DEFINE_CVAR_GLOBAL(RotationFrictionOrganic); +DEFINE_CVAR_GLOBAL(RotationFrictionWater); +DEFINE_CVAR_GLOBAL(RotationFrictionLava); +DEFINE_CVAR_GLOBAL(RotationFrictionPhazon); +DEFINE_CVAR_GLOBAL(RotationFrictionShrubbery); +DEFINE_CVAR_GLOBAL(RotationMaxSpeedNormal); +DEFINE_CVAR_GLOBAL(RotationMaxSpeedAir); +DEFINE_CVAR_GLOBAL(RotationMaxSpeedIce); +DEFINE_CVAR_GLOBAL(RotationMaxSpeedOrganic); +DEFINE_CVAR_GLOBAL(RotationMaxSpeedWater); +DEFINE_CVAR_GLOBAL(RotationMaxSpeedLava); +DEFINE_CVAR_GLOBAL(RotationMaxSpeedPhazon); +DEFINE_CVAR_GLOBAL(RotationMaxSpeedShrubbery); +DEFINE_CVAR_GLOBAL(TranslationMaxSpeedNormal); +DEFINE_CVAR_GLOBAL(TranslationMaxSpeedAir); +DEFINE_CVAR_GLOBAL(TranslationMaxSpeedIce); +DEFINE_CVAR_GLOBAL(TranslationMaxSpeedOrganic); +DEFINE_CVAR_GLOBAL(TranslationMaxSpeedWater); +DEFINE_CVAR_GLOBAL(TranslationMaxSpeedLava); +DEFINE_CVAR_GLOBAL(TranslationMaxSpeedPhazon); +DEFINE_CVAR_GLOBAL(TranslationMaxSpeedShrubbery); +DEFINE_CVAR_GLOBAL(NormalGravityAcceleration); +DEFINE_CVAR_GLOBAL(FluidGravityAcceleration); +DEFINE_CVAR_GLOBAL(VerticalJumpAcceleration); +DEFINE_CVAR_GLOBAL(HorizontalJumpAcceleration); +DEFINE_CVAR_GLOBAL(VerticalDoubleJumpAcceleration); +DEFINE_CVAR_GLOBAL(HorizontalDoubleJumpAcceleration); +DEFINE_CVAR_GLOBAL(WaterJumpFactor); +DEFINE_CVAR_GLOBAL(WaterBallJumpFactor); +DEFINE_CVAR_GLOBAL(LavaJumpFactor); +DEFINE_CVAR_GLOBAL(LavaBallJumpFactor); +DEFINE_CVAR_GLOBAL(PhazonJumpFactor); +DEFINE_CVAR_GLOBAL(PhazonBallJumpFactor); +DEFINE_CVAR_GLOBAL(AllowedJumpTime); +DEFINE_CVAR_GLOBAL(AllowedDoubleJumpTime); +DEFINE_CVAR_GLOBAL(MinDoubleJumpWindow); +DEFINE_CVAR_GLOBAL(MaxDoubleJumpWindow) +// DEFINE_CVAR_GLOBAL(); // x104_ +DEFINE_CVAR_GLOBAL(MinJumpTime); +DEFINE_CVAR_GLOBAL(MinDoubleJumpTime); +DEFINE_CVAR_GLOBAL(AllowedLedgeTime); +DEFINE_CVAR_GLOBAL(DoubleJumpImpulse); +DEFINE_CVAR_GLOBAL(BackwardsForceMultiplier); +DEFINE_CVAR_GLOBAL(BombJumpRadius); +DEFINE_CVAR_GLOBAL(BombJumpHeight); +DEFINE_CVAR_GLOBAL(EyeOffset); +DEFINE_CVAR_GLOBAL(TurnSpeedMultiplier); +DEFINE_CVAR_GLOBAL(FreeLookTurnSpeedMultiplier); +DEFINE_CVAR_GLOBAL(HorizontalFreeLookAngleVelocity); +DEFINE_CVAR_GLOBAL(VerticalFreeLookAngleVelocity); +DEFINE_CVAR_GLOBAL(FreeLookSpeed); +DEFINE_CVAR_GLOBAL(FreeLookSnapSpeed); +// DEFINE_CVAR_GLOBAL(); // x140_ +DEFINE_CVAR_GLOBAL(FreeLookCenteredThresholdAngle); +DEFINE_CVAR_GLOBAL(FreeLookCenteredTime); +DEFINE_CVAR_GLOBAL(FreeLookDampenFactor); +DEFINE_CVAR_GLOBAL(LeftDivisor); +DEFINE_CVAR_GLOBAL(RightDivisor); +DEFINE_CVAR_GLOBAL(OrbitMinDistanceClose); +DEFINE_CVAR_GLOBAL(OrbitMinDistanceFar); +DEFINE_CVAR_GLOBAL(OrbitMinDistanceDefault); +DEFINE_CVAR_GLOBAL(OrbitNormalDistanceClose); +DEFINE_CVAR_GLOBAL(OrbitNormalDistanceFar); +DEFINE_CVAR_GLOBAL(OrbitNormalDistanceDefault); +DEFINE_CVAR_GLOBAL(OrbitMaxDistanceClose); +DEFINE_CVAR_GLOBAL(OrbitMaxDistanceFar); +DEFINE_CVAR_GLOBAL(OrbitMaxDistanceDefault); +// DEFINE_CVAR_GLOBAL(); // x17c_ +DEFINE_CVAR_GLOBAL(OrbitmodeTimer); +DEFINE_CVAR_GLOBAL(OrbitCameraSpeed); +DEFINE_CVAR_GLOBAL(OrbitUpperAngle); +DEFINE_CVAR_GLOBAL(OrbitLowerAngle); +DEFINE_CVAR_GLOBAL(OrbitHorizontalAngle); +// DEFINE_CVAR_GLOBAL(); // x194_ +// DEFINE_CVAR_GLOBAL(); // x198_ +DEFINE_CVAR_GLOBAL(OrbitMaxTargetDistance); +DEFINE_CVAR_GLOBAL(OrbitMaxLockDistance); +DEFINE_CVAR_GLOBAL(OrbitDistanceThreshold); +DEFINE_CVAR_GLOBAL(OrbitScreenTargetingBoxHalfExtentX); +DEFINE_CVAR_GLOBAL(OrbitScreenScanBoxHalfExtentX); +DEFINE_CVAR_GLOBAL(OrbitScreenTargetingBoxHalfExtentY); +DEFINE_CVAR_GLOBAL(OrbitScreenScanBoxHalfExtentY); +DEFINE_CVAR_GLOBAL(OrbitScreenTargetingBoxCenterX); +DEFINE_CVAR_GLOBAL(OrbitScreenScanBoxCenterX); +DEFINE_CVAR_GLOBAL(OrbitScreenTargetingBoxCenterY); +DEFINE_CVAR_GLOBAL(OrbitScreenScanBoxCenterY); +DEFINE_CVAR_GLOBAL(OrbitZoneTargetingIdealX); +DEFINE_CVAR_GLOBAL(OrbitZoneScanIdealX); +DEFINE_CVAR_GLOBAL(OrbitZoneTargetingIdealY); +DEFINE_CVAR_GLOBAL(OrbitZoneScanIdealY); +DEFINE_CVAR_GLOBAL(OrbitNearX); +DEFINE_CVAR_GLOBAL(OrbitNearZ); +// DEFINE_CVAR_GLOBAL(); // x1e0_ +// DEFINE_CVAR_GLOBAL(); // x1e4_ +DEFINE_CVAR_GLOBAL(OrbitFixedOffsetZDiff); +DEFINE_CVAR_GLOBAL(OrbitZRange); +// DEFINE_CVAR_GLOBAL(); // x1f0_ +// DEFINE_CVAR_GLOBAL(); // x1f4_ +// DEFINE_CVAR_GLOBAL(); // x1f8_ +DEFINE_CVAR_GLOBAL(OrbitPreventionTime); +DEFINE_CVAR_GLOBAL(DashEnabled); +DEFINE_CVAR_GLOBAL(DashOnButtonRelease); +DEFINE_CVAR_GLOBAL(DashButtonHoldCancelTime); +DEFINE_CVAR_GLOBAL(DashStrafeInputThreshold); +DEFINE_CVAR_GLOBAL(SidewaysDoubleJumpImpulse); +DEFINE_CVAR_GLOBAL(SidewaysVerticalDoubleJumpAccel); +DEFINE_CVAR_GLOBAL(SidewaysHorizontalDoubleJumpAccel); +DEFINE_CVAR_GLOBAL(ScanningRange); +DEFINE_CVAR_GLOBAL(ScanRetention); +DEFINE_CVAR_GLOBAL(ScanFreezesGame); +DEFINE_CVAR_GLOBAL(OrbitWhileScanning); +DEFINE_CVAR_GLOBAL(ScanMaxTargetDistance); +DEFINE_CVAR_GLOBAL(ScanMaxLockDistance) +DEFINE_CVAR_GLOBAL(FreeLookTurnsPlayer); +// DEFINE_CVAR_GLOBAL(); // x228_25_ +// DEFINE_CVAR_GLOBAL(); // x228_26_ +DEFINE_CVAR_GLOBAL(MoveDuringFreelook); +DEFINE_CVAR_GLOBAL(HoldButtonsForFreeLook); +// DEFINE_CVAR_GLOBAL(); // x228_30_ +// DEFINE_CVAR_GLOBAL(); // x228_31_ +// DEFINE_CVAR_GLOBAL(); // x229_24_ +DEFINE_CVAR_GLOBAL(AimWhenOrbitingPoint); +DEFINE_CVAR_GLOBAL(StayInFreeLookWhileFiring); +// DEFINE_CVAR_GLOBAL(); // x229_27_ +// DEFINE_CVAR_GLOBAL(); // x229_28_ +DEFINE_CVAR_GLOBAL(OrbitFixedOffset); +DEFINE_CVAR_GLOBAL(GunButtonTogglesHolster); +DEFINE_CVAR_GLOBAL(GunNotFiringHolstersGun); +DEFINE_CVAR_GLOBAL(FallingDoubleJump); +DEFINE_CVAR_GLOBAL(ImpulseDoubleJump); +DEFINE_CVAR_GLOBAL(FiringCancelsCameraPitch); +DEFINE_CVAR_GLOBAL(AssistedAimingIgnoreHorizontal); +DEFINE_CVAR_GLOBAL(AssistedAimingIgnoreVertical); +// DEFINE_CVAR_GLOBAL(); // x22c +// DEFINE_CVAR_GLOBAL(); // x230_ +DEFINE_CVAR_GLOBAL(AimMaxDistance); +// DEFINE_CVAR_GLOBAL(); // x238_ +// DEFINE_CVAR_GLOBAL(); // x23c_ +// DEFINE_CVAR_GLOBAL(); // x240_ +// DEFINE_CVAR_GLOBAL(); // x244_ +// DEFINE_CVAR_GLOBAL(); // x248_ +DEFINE_CVAR_GLOBAL(AimThresholdDistance); +// DEFINE_CVAR_GLOBAL(); // x250_ +// DEFINE_CVAR_GLOBAL(); // x254_ +DEFINE_CVAR_GLOBAL(AimBoxWidth); +DEFINE_CVAR_GLOBAL(AimBoxHeight); +DEFINE_CVAR_GLOBAL(AimTargetTimer); +DEFINE_CVAR_GLOBAL(AimAssistHorizontalAngle); +DEFINE_CVAR_GLOBAL(AimAssistVerticalAngle); +DEFINE_CVAR_GLOBAL(PlayerHeight); +DEFINE_CVAR_GLOBAL(PlayerXYHalfExtent); +DEFINE_CVAR_GLOBAL(StepUpHeight); +DEFINE_CVAR_GLOBAL(StepDownHeight); +DEFINE_CVAR_GLOBAL(PlayerBallHalfExtent); +DEFINE_CVAR_GLOBAL(FirstPersonCameraSpeed); +// DEFINE_CVAR_GLOBAL(); // x284_ +DEFINE_CVAR_GLOBAL(JumpCameraPitchDownStart); +DEFINE_CVAR_GLOBAL(JumpCameraPitchDownFull); +DEFINE_CVAR_GLOBAL(JumpCameraPitchDownAngle); +DEFINE_CVAR_GLOBAL(FallCameraPitchDownStart); +DEFINE_CVAR_GLOBAL(FallCameraPitchDownFull); +DEFINE_CVAR_GLOBAL(FallCameraPitchDownAngle); +DEFINE_CVAR_GLOBAL(OrbitDistanceMax); +DEFINE_CVAR_GLOBAL(GrappleSwingLength); +DEFINE_CVAR_GLOBAL(GrappleSwingPeriod); +DEFINE_CVAR_GLOBAL(GrapplePullSpeedMin); +DEFINE_CVAR_GLOBAL(GrappleCameraSpeed); +DEFINE_CVAR_GLOBAL(MaxGrappleLockedTurnAlignDistance); +DEFINE_CVAR_GLOBAL(GrapplePullSpeedProportion); +DEFINE_CVAR_GLOBAL(GrapplePullSpeedMax); +DEFINE_CVAR_GLOBAL(GrappleLookCenterSpeed); +DEFINE_CVAR_GLOBAL(MaxGrappleTurnSpeed); +DEFINE_CVAR_GLOBAL(GrappleJumpForce); +DEFINE_CVAR_GLOBAL(GrappleReleaseTime); +DEFINE_CVAR_GLOBAL(GrappleJumpMode); +DEFINE_CVAR_GLOBAL(OrbitReleaseBreaksGrapple); +DEFINE_CVAR_GLOBAL(InvertGrappleTurn); +DEFINE_CVAR_GLOBAL(GrappleBeamSpeed); +DEFINE_CVAR_GLOBAL(GrappleBeamXWaveAmplitude); +DEFINE_CVAR_GLOBAL(GrappleBeamZWaveAmplitude); +DEFINE_CVAR_GLOBAL(GrappleBeamAnglePhaseDelta); +// DEFINE_CVAR_GLOBAL(); // x2e8_ +// DEFINE_CVAR_GLOBAL(); // x2ec_ +// DEFINE_CVAR_GLOBAL(); // x2f0_ +// DEFINE_CVAR_GLOBAL(); // x2f4_ +DEFINE_CVAR_GLOBAL(FrozenTimeout); +DEFINE_CVAR_GLOBAL(IceBreakJumpCount); +DEFINE_CVAR_GLOBAL(VariaDamageReduction); +DEFINE_CVAR_GLOBAL(GravityDamageReduction); +DEFINE_CVAR_GLOBAL(PhazonDamageReduction); +} // namespace + +CTweakPlayer::CTweakPlayer(CInputStream& in) { + /* x4_maxTranslationalAcceleration[0] */ + x4_maxTranslationalAcceleration[0] = in.ReadFloat(); + /* x4_maxTranslationalAcceleration[1] */ + x4_maxTranslationalAcceleration[1] = in.ReadFloat(); + /* x4_maxTranslationalAcceleration[2] */ + x4_maxTranslationalAcceleration[2] = in.ReadFloat(); + /* x4_maxTranslationalAcceleration[3] */ + x4_maxTranslationalAcceleration[3] = in.ReadFloat(); + /* x4_maxTranslationalAcceleration[4] */ + x4_maxTranslationalAcceleration[4] = in.ReadFloat(); + /* x4_maxTranslationalAcceleration[5] */ + x4_maxTranslationalAcceleration[5] = in.ReadFloat(); + /* x4_maxTranslationalAcceleration[6] */ + x4_maxTranslationalAcceleration[6] = in.ReadFloat(); + /* x4_maxTranslationalAcceleration[7] */ + x4_maxTranslationalAcceleration[7] = in.ReadFloat(); + /* x24_maxRotationalAcceleration[0] */ + x24_maxRotationalAcceleration[0] = in.ReadFloat(); + /* x24_maxRotationalAcceleration[1] */ + x24_maxRotationalAcceleration[1] = in.ReadFloat(); + /* x24_maxRotationalAcceleration[2] */ + x24_maxRotationalAcceleration[2] = in.ReadFloat(); + /* x24_maxRotationalAcceleration[3] */ + x24_maxRotationalAcceleration[3] = in.ReadFloat(); + /* x24_maxRotationalAcceleration[4] */ + x24_maxRotationalAcceleration[4] = in.ReadFloat(); + /* x24_maxRotationalAcceleration[5] */ + x24_maxRotationalAcceleration[5] = in.ReadFloat(); + /* x24_maxRotationalAcceleration[6] */ + x24_maxRotationalAcceleration[6] = in.ReadFloat(); + /* x24_maxRotationalAcceleration[7] */ + x24_maxRotationalAcceleration[7] = in.ReadFloat(); + /* x44_translationFriction[0] */ + x44_translationFriction[0] = in.ReadFloat(); + /* x44_translationFriction[1] */ + x44_translationFriction[1] = in.ReadFloat(); + /* x44_translationFriction[2] */ + x44_translationFriction[2] = in.ReadFloat(); + /* x44_translationFriction[3] */ + x44_translationFriction[3] = in.ReadFloat(); + /* x44_translationFriction[4] */ + x44_translationFriction[4] = in.ReadFloat(); + /* x44_translationFriction[5] */ + x44_translationFriction[5] = in.ReadFloat(); + /* x44_translationFriction[6] */ + x44_translationFriction[6] = in.ReadFloat(); + /* x44_translationFriction[7] */ + x44_translationFriction[7] = in.ReadFloat(); + /* x64_rotationFriction[0] */ + x64_rotationFriction[0] = in.ReadFloat(); + /* x64_rotationFriction[1] */ + x64_rotationFriction[1] = in.ReadFloat(); + /* x64_rotationFriction[2] */ + x64_rotationFriction[2] = in.ReadFloat(); + /* x64_rotationFriction[3] */ + x64_rotationFriction[3] = in.ReadFloat(); + /* x64_rotationFriction[4] */ + x64_rotationFriction[4] = in.ReadFloat(); + /* x64_rotationFriction[5] */ + x64_rotationFriction[5] = in.ReadFloat(); + /* x64_rotationFriction[6] */ + x64_rotationFriction[6] = in.ReadFloat(); + /* x64_rotationFriction[7] */ + x64_rotationFriction[7] = in.ReadFloat(); + /* x84_rotationMaxSpeed[0] */ + x84_rotationMaxSpeed[0] = in.ReadFloat(); + /* x84_rotationMaxSpeed[1] */ + x84_rotationMaxSpeed[1] = in.ReadFloat(); + /* x84_rotationMaxSpeed[2] */ + x84_rotationMaxSpeed[2] = in.ReadFloat(); + /* x84_rotationMaxSpeed[3] */ + x84_rotationMaxSpeed[3] = in.ReadFloat(); + /* x84_rotationMaxSpeed[4] */ + x84_rotationMaxSpeed[4] = in.ReadFloat(); + /* x84_rotationMaxSpeed[5] */ + x84_rotationMaxSpeed[5] = in.ReadFloat(); + /* x84_rotationMaxSpeed[6] */ + x84_rotationMaxSpeed[6] = in.ReadFloat(); + /* x84_rotationMaxSpeed[7] */ + x84_rotationMaxSpeed[7] = in.ReadFloat(); + /* xa4_translationMaxSpeed[0] */ + xa4_translationMaxSpeed[0] = in.ReadFloat(); + /* xa4_translationMaxSpeed[1] */ + xa4_translationMaxSpeed[1] = in.ReadFloat(); + /* xa4_translationMaxSpeed[2] */ + xa4_translationMaxSpeed[2] = in.ReadFloat(); + /* xa4_translationMaxSpeed[3] */ + xa4_translationMaxSpeed[3] = in.ReadFloat(); + /* xa4_translationMaxSpeed[4] */ + xa4_translationMaxSpeed[4] = in.ReadFloat(); + /* xa4_translationMaxSpeed[5] */ + xa4_translationMaxSpeed[5] = in.ReadFloat(); + /* xa4_translationMaxSpeed[6] */ + xa4_translationMaxSpeed[6] = in.ReadFloat(); + /* xa4_translationMaxSpeed[7] */ + xa4_translationMaxSpeed[7] = in.ReadFloat(); + /* xc4_normalGravAccel */ + xc4_normalGravAccel = in.ReadFloat(); + /* xc8_fluidGravAccel */ + xc8_fluidGravAccel = in.ReadFloat(); + /* xcc_verticalJumpAccel */ + xcc_verticalJumpAccel = in.ReadFloat(); + /* xd0_horizontalJumpAccel */ + xd0_horizontalJumpAccel = in.ReadFloat(); + /* xd4_verticalDoubleJumpAccel */ + xd4_verticalDoubleJumpAccel = in.ReadFloat(); + /* xd8_horizontalDoubleJumpAccel */ + xd8_horizontalDoubleJumpAccel = in.ReadFloat(); + /* xdc_waterJumpFactor */ + xdc_waterJumpFactor = in.ReadFloat(); + /* xe0_waterBallJumpFactor */ + xe0_waterBallJumpFactor = in.ReadFloat(); + /* xe4_lavaJumpFactor */ + xe4_lavaJumpFactor = in.ReadFloat(); + /* xe8_lavaBallJumpFactor */ + xe8_lavaBallJumpFactor = in.ReadFloat(); + /* xec_phazonJumpFactor */ + xec_phazonJumpFactor = in.ReadFloat(); + /* xf0_phazonBallJumpFactor */ + xf0_phazonBallJumpFactor = in.ReadFloat(); + /* xf4_allowedJumpTime */ + xf4_allowedJumpTime = in.ReadFloat(); + /* xf8_allowedDoubleJumpTime */ + xf8_allowedDoubleJumpTime = in.ReadFloat(); + /* xfc_minDoubleJumpWindow */ + xfc_minDoubleJumpWindow = in.ReadFloat(); + /* x100_maxDoubleJumpWindow */ + x100_maxDoubleJumpWindow = in.ReadFloat(); + /* x104_ */ + x104_ = in.ReadFloat(); + /* x108_minJumpTime */ + x108_minJumpTime = in.ReadFloat(); + /* x10c_minDoubleJumpTime */ + x10c_minDoubleJumpTime = in.ReadFloat(); + /* x110_allowedLedgeTime */ + x110_allowedLedgeTime = in.ReadFloat(); + /* x114_doubleJumpImpulse */ + x114_doubleJumpImpulse = in.ReadFloat(); + /* x118_backwardsForceMultiplier */ + x118_backwardsForceMultiplier = in.ReadFloat(); + /* x11c_bombJumpRadius */ + x11c_bombJumpRadius = in.ReadFloat(); + /* x120_bombJumpHeight */ + x120_bombJumpHeight = in.ReadFloat(); + /* x124_eyeOffset */ + x124_eyeOffset = in.ReadFloat(); + /* x128_turnSpeedMultiplier */ + x128_turnSpeedMultiplier = in.ReadFloat(); + /* x12c_freeLookTurnSpeedMultiplier */ + x12c_freeLookTurnSpeedMultiplier = in.ReadFloat(); + /* x130_horizontalFreeLookAngleVel */ + x130_horizontalFreeLookAngleVel = in.ReadFloat(); + /* x134_verticalFreeLookAngleVel */ + x134_verticalFreeLookAngleVel = in.ReadFloat(); + /* x138_freeLookSpeed */ + x138_freeLookSpeed = in.ReadFloat(); + /* x13c_freeLookSnapSpeed */ + x13c_freeLookSnapSpeed = in.ReadFloat(); + /* x140_ */ + x140_ = in.ReadFloat(); + /* x144_freeLookCenteredThresholdAngle */ + x144_freeLookCenteredThresholdAngle = in.ReadFloat(); + /* x148_freeLookCenteredTime */ + x148_freeLookCenteredTime = in.ReadFloat(); + /* x14c_freeLookDampenFactor */ + x14c_freeLookDampenFactor = in.ReadFloat(); + /* x150_leftDiv */ + x150_leftDiv = in.ReadFloat(); + /* x154_rightDiv */ + x154_rightDiv = in.ReadFloat(); + /* x228_24_freelookTurnsPlayer */ + x228_24_freelookTurnsPlayer = in.ReadBool(); + /* x228_25_ */ + x228_25_ = in.ReadBool(); + /* x228_26_ */ + x228_26_ = in.ReadBool(); + /* x228_27_moveDuringFreeLook */ + x228_27_moveDuringFreeLook = in.ReadBool(); + /* x228_28_holdButtonsForFreeLook */ + x228_28_holdButtonsForFreeLook = in.ReadBool(); + /* x228_29_twoButtonsForFreeLook */ + x228_29_twoButtonsForFreeLook = in.ReadBool(); + /* x228_30_ */ + x228_30_ = in.ReadBool(); + /* x228_31_ */ + x228_31_ = in.ReadBool(); + /* x229_24_ */ + x229_24_ = in.ReadBool(); + /* x229_25_aimWhenOrbitingPoint */ + x229_25_aimWhenOrbitingPoint = in.ReadBool(); + /* x229_26_stayInFreeLookWhileFiring */ + x229_26_stayInFreeLookWhileFiring = in.ReadBool(); + /* x229_27_ */ + x229_27_ = in.ReadBool(); + /* x229_28_ */ + x229_28_ = in.ReadBool(); + /* x229_29_orbitFixedOffset */ + x229_29_orbitFixedOffset = in.ReadBool(); + /* x229_30_gunButtonTogglesHolster */ + x229_30_gunButtonTogglesHolster = in.ReadBool(); + /* x229_31_gunNotFiringHolstersGun */ + x229_31_gunNotFiringHolstersGun = in.ReadBool(); + /* x22a_24_fallingDoubleJump */ + x22a_24_fallingDoubleJump = in.ReadBool(); + /* x22a_25_impulseDoubleJump */ + x22a_25_impulseDoubleJump = in.ReadBool(); + /* x22a_26_firingCancelsCameraPitch */ + x22a_26_firingCancelsCameraPitch = in.ReadBool(); + /* x22a_27_assistedAimingIgnoreHorizontal */ + x22a_27_assistedAimingIgnoreHorizontal = in.ReadBool(); + /* x22a_28_assistedAimingIgnoreVertical */ + x22a_28_assistedAimingIgnoreVertical = in.ReadBool(); + /* x22c_ */ + x22c_ = in.ReadFloat(); + /* x230_ */ + x230_ = in.ReadFloat(); + /* x234_aimMaxDistance */ + x234_aimMaxDistance = in.ReadFloat(); + /* x238_ */ + x238_ = in.ReadFloat(); + /* x23c_ */ + x23c_ = in.ReadFloat(); + /* x240_ */ + x240_ = in.ReadFloat(); + /* x244_ */ + x244_ = in.ReadFloat(); + /* x248_ */ + x248_ = in.ReadFloat(); + /* x24c_aimThresholdDistance */ + x24c_aimThresholdDistance = in.ReadFloat(); + /* x250_ */ + x250_ = in.ReadFloat(); + /* x254_ */ + x254_ = in.ReadFloat(); + /* x258_aimBoxWidth */ + x258_aimBoxWidth = in.ReadFloat(); + /* x25c_aimBoxHeight */ + x25c_aimBoxHeight = in.ReadFloat(); + /* x260_aimTargetTimer */ + x260_aimTargetTimer = in.ReadFloat(); + /* x264_aimAssistHorizontalAngle */ + x264_aimAssistHorizontalAngle = in.ReadFloat(); + /* x268_aimAssistVerticalAngle */ + x268_aimAssistVerticalAngle = in.ReadFloat(); + /* x158_orbitMinDistance[0] */ + x158_orbitMinDistance[0] = in.ReadFloat(); + /* x164_orbitNormalDistance[0] */ + x164_orbitNormalDistance[0] = in.ReadFloat(); + /* x170_orbitMaxDistance[0] */ + x170_orbitMaxDistance[0] = in.ReadFloat(); + /* x158_orbitMinDistance[1] */ + x158_orbitMinDistance[1] = in.ReadFloat(); + /* x164_orbitNormalDistance[1] */ + x164_orbitNormalDistance[1] = in.ReadFloat(); + /* x170_orbitMaxDistance[1] */ + x170_orbitMaxDistance[1] = in.ReadFloat(); + /* x158_orbitMinDistance[2] */ + x158_orbitMinDistance[2] = in.ReadFloat(); + /* x164_orbitNormalDistance[2] */ + x164_orbitNormalDistance[2] = in.ReadFloat(); + /* x170_orbitMaxDistance[2] */ + x170_orbitMaxDistance[2] = in.ReadFloat(); + /* x17c_ */ + x17c_ = in.ReadFloat(); + /* x180_orbitModeTimer */ + x180_orbitModeTimer = in.ReadFloat(); + /* x184_orbitCameraSpeed */ + x184_orbitCameraSpeed = in.ReadFloat(); + /* x188_orbitUpperAngle */ + x188_orbitUpperAngle = in.ReadFloat(); + /* x18c_orbitLowerAngle */ + x18c_orbitLowerAngle = in.ReadFloat(); + /* x190_orbitHorizAngle */ + x190_orbitHorizAngle = in.ReadFloat(); + /* x194_ */ + x194_ = in.ReadFloat(); + /* x198_ */ + x198_ = in.ReadFloat(); + /* x19c_orbitMaxTargetDistance */ + x19c_orbitMaxTargetDistance = in.ReadFloat(); + /* x1a0_orbitMaxLockDistance */ + x1a0_orbitMaxLockDistance = in.ReadFloat(); + /* x1a4_orbitDistanceThreshold */ + x1a4_orbitDistanceThreshold = in.ReadFloat(); + /* x1a8_orbitScreenBoxHalfExtentX[0] */ + x1a8_orbitScreenBoxHalfExtentX[0] = in.ReadLong(); + /* x1b0_orbitScreenBoxHalfExtentY[0] */ + x1b0_orbitScreenBoxHalfExtentY[0] = in.ReadLong(); + /* x1b8_orbitScreenBoxCenterX[0] */ + x1b8_orbitScreenBoxCenterX[0] = in.ReadLong(); + /* x1c0_orbitScreenBoxCenterY[0] */ + x1c0_orbitScreenBoxCenterY[0] = in.ReadLong(); + /* x1c8_orbitZoneIdealX[0] */ + x1c8_orbitZoneIdealX[0] = in.ReadLong(); + /* x1d0_orbitZoneIdealY[0] */ + x1d0_orbitZoneIdealY[0] = in.ReadLong(); + /* x1a8_orbitScreenBoxHalfExtentX[1] */ + x1a8_orbitScreenBoxHalfExtentX[1] = in.ReadLong(); + /* x1b0_orbitScreenBoxHalfExtentY[1] */ + x1b0_orbitScreenBoxHalfExtentY[1] = in.ReadLong(); + /* x1b8_orbitScreenBoxCenterX[1] */ + x1b8_orbitScreenBoxCenterX[1] = in.ReadLong(); + /* x1c0_orbitScreenBoxCenterY[1] */ + x1c0_orbitScreenBoxCenterY[1] = in.ReadLong(); + /* x1c8_orbitZoneIdealX[1] */ + x1c8_orbitZoneIdealX[1] = in.ReadLong(); + /* x1d0_orbitZoneIdealY[1] */ + x1d0_orbitZoneIdealY[1] = in.ReadLong(); + /* x1d8_orbitNearX */ + x1d8_orbitNearX = in.ReadFloat(); + /* x1dc_orbitNearZ */ + x1dc_orbitNearZ = in.ReadFloat(); + /* x1e0_ */ + x1e0_ = in.ReadFloat(); + /* x1e4_ */ + x1e4_ = in.ReadFloat(); + /* x1e8_orbitFixedOffsetZDiff */ + x1e8_orbitFixedOffsetZDiff = in.ReadFloat(); + /* x1ec_orbitZRange */ + x1ec_orbitZRange = in.ReadFloat(); + /* x1f0_ */ + x1f0_ = in.ReadFloat(); + /* x1f4_ */ + x1f4_ = in.ReadFloat(); + /* x1f8_ */ + x1f8_ = in.ReadFloat(); + /* x1fc_orbitPreventionTime */ + x1fc_orbitPreventionTime = in.ReadFloat(); + /* x200_24_dashEnabled */ + x200_24_dashEnabled = in.ReadBool(); + /* x200_25_dashOnButtonRelease */ + x200_25_dashOnButtonRelease = in.ReadBool(); + /* x204_dashButtonHoldCancelTime */ + x204_dashButtonHoldCancelTime = in.ReadFloat(); + /* x208_dashStrafeInputThreshold */ + x208_dashStrafeInputThreshold = in.ReadFloat(); + /* x20c_sidewaysDoubleJumpImpulse */ + x20c_sidewaysDoubleJumpImpulse = in.ReadFloat(); + /* x210_sidewaysVerticalDoubleJumpAccel */ + x210_sidewaysVerticalDoubleJumpAccel = in.ReadFloat(); + /* x214_sidewaysHorizontalDoubleJumpAccel */ + x214_sidewaysHorizontalDoubleJumpAccel = in.ReadFloat(); + /* x218_scanningRange */ + x218_scanningRange = in.ReadFloat(); + /* x21c_24_scanRetention */ + x21c_24_scanRetention = in.ReadBool(); + /* x21c_25_scanFreezesGame */ + x21c_25_scanFreezesGame = in.ReadBool(); + /* x21c_26_orbitWhileScanning */ + x21c_26_orbitWhileScanning = in.ReadBool(); + /* x220_scanMaxTargetDistance */ + x220_scanMaxTargetDistance = in.ReadFloat(); + /* x224_scanMaxLockDistance */ + x224_scanMaxLockDistance = in.ReadFloat(); + /* x2a0_orbitDistanceMax */ + x2a0_orbitDistanceMax = in.ReadFloat(); + /* x2a4_grappleSwingLength */ + x2a4_grappleSwingLength = in.ReadFloat(); + /* x2a8_grappleSwingPeriod */ + x2a8_grappleSwingPeriod = in.ReadFloat(); + /* x2ac_grapplePullSpeedMin */ + x2ac_grapplePullSpeedMin = in.ReadFloat(); + /* x2b0_grappleCameraSpeed */ + x2b0_grappleCameraSpeed = in.ReadFloat(); + /* x2b4_maxGrappleLockedTurnAlignDistance */ + x2b4_maxGrappleLockedTurnAlignDistance = in.ReadFloat(); + /* x2b8_grapplePullSpeedProportion */ + x2b8_grapplePullSpeedProportion = in.ReadFloat(); + /* x2bc_grapplePullSpeedMax */ + x2bc_grapplePullSpeedMax = in.ReadFloat(); + /* x2c0_grappleLookCenterSpeed */ + x2c0_grappleLookCenterSpeed = in.ReadFloat(); + /* x2c4_maxGrappleTurnSpeed */ + x2c4_maxGrappleTurnSpeed = in.ReadFloat(); + /* x2c8_grappleJumpForce */ + x2c8_grappleJumpForce = in.ReadFloat(); + /* x2cc_grappleReleaseTime */ + x2cc_grappleReleaseTime = in.ReadFloat(); + /* x2d0_grappleJumpMode */ + x2d0_grappleJumpMode = in.ReadLong(); + /* x2d4_orbitReleaseBreaksGrapple */ + x2d4_orbitReleaseBreaksGrapple = in.ReadBool(); + /* x2d5_invertGrappleTurn */ + x2d5_invertGrappleTurn = in.ReadBool(); + /* x2d8_grappleBeamSpeed */ + x2d8_grappleBeamSpeed = in.ReadFloat(); + /* x2dc_grappleBeamXWaveAmplitude */ + x2dc_grappleBeamXWaveAmplitude = in.ReadFloat(); + /* x2e0_grappleBeamZWaveAmplitude */ + x2e0_grappleBeamZWaveAmplitude = in.ReadFloat(); + /* x2e4_grappleBeamAnglePhaseDelta */ + x2e4_grappleBeamAnglePhaseDelta = in.ReadFloat(); + /* x26c_playerHeight */ + x26c_playerHeight = in.ReadFloat(); + /* x270_playerXYHalfExtent */ + x270_playerXYHalfExtent = in.ReadFloat(); + /* x274_stepUpHeight */ + x274_stepUpHeight = in.ReadFloat(); + /* x278_stepDownHeight */ + x278_stepDownHeight = in.ReadFloat(); + /* x27c_playerBallHalfExtent */ + x27c_playerBallHalfExtent = in.ReadFloat(); + /* x280_ */ + x280_firstPersonCameraSpeed = in.ReadFloat(); + /* x284_ */ + x284_ = in.ReadFloat(); + /* x288_jumpCameraPitchDownStart */ + x288_jumpCameraPitchDownStart = in.ReadFloat(); + /* x28c_jumpCameraPitchDownFull */ + x28c_jumpCameraPitchDownFull = in.ReadFloat(); + /* x290_jumpCameraPitchDownAngle */ + x290_jumpCameraPitchDownAngle = in.ReadFloat(); + /* x294_fallCameraPitchDownStart */ + x294_fallCameraPitchDownStart = in.ReadFloat(); + /* x298_fallCameraPitchDownFull */ + x298_fallCameraPitchDownFull = in.ReadFloat(); + /* x29c_fallCameraPitchDownAngle */ + x29c_fallCameraPitchDownAngle = in.ReadFloat(); + /* x2e8_ */ + x2e8_ = in.ReadFloat(); + /* x2ec_ */ + x2ec_ = in.ReadFloat(); + /* x2f0_ */ + x2f0_ = in.ReadFloat(); + /* x2f4_ */ + x2f4_ = in.ReadBool(); + /* x2f8_frozenTimeout */ + x2f8_frozenTimeout = in.ReadFloat(); + /* x2fc_iceBreakJumpCount */ + x2fc_iceBreakJumpCount = in.ReadLong(); + /* x300_variaDamageReduction */ + x300_variaDamageReduction = in.ReadFloat(); + /* x304_gravityDamageReduction */ + x304_gravityDamageReduction = in.ReadFloat(); + /* x308_phazonDamageReduction */ + x308_phazonDamageReduction = in.ReadFloat(); +} + +void CTweakPlayer::PutTo(COutputStream& out) { + /* x4_maxTranslationalAcceleration[0] */ + out.Put(x4_maxTranslationalAcceleration[0]); + /* x4_maxTranslationalAcceleration[1] */ + out.Put(x4_maxTranslationalAcceleration[1]); + /* x4_maxTranslationalAcceleration[2] */ + out.Put(x4_maxTranslationalAcceleration[2]); + /* x4_maxTranslationalAcceleration[3] */ + out.Put(x4_maxTranslationalAcceleration[3]); + /* x4_maxTranslationalAcceleration[4] */ + out.Put(x4_maxTranslationalAcceleration[4]); + /* x4_maxTranslationalAcceleration[5] */ + out.Put(x4_maxTranslationalAcceleration[5]); + /* x4_maxTranslationalAcceleration[6] */ + out.Put(x4_maxTranslationalAcceleration[6]); + /* x4_maxTranslationalAcceleration[7] */ + out.Put(x4_maxTranslationalAcceleration[7]); + /* x24_maxRotationalAcceleration[0] */ + out.Put(x24_maxRotationalAcceleration[0]); + /* x24_maxRotationalAcceleration[1] */ + out.Put(x24_maxRotationalAcceleration[1]); + /* x24_maxRotationalAcceleration[2] */ + out.Put(x24_maxRotationalAcceleration[2]); + /* x24_maxRotationalAcceleration[3] */ + out.Put(x24_maxRotationalAcceleration[3]); + /* x24_maxRotationalAcceleration[4] */ + out.Put(x24_maxRotationalAcceleration[4]); + /* x24_maxRotationalAcceleration[5] */ + out.Put(x24_maxRotationalAcceleration[5]); + /* x24_maxRotationalAcceleration[6] */ + out.Put(x24_maxRotationalAcceleration[6]); + /* x24_maxRotationalAcceleration[7] */ + out.Put(x24_maxRotationalAcceleration[7]); + /* x44_translationFriction[0] */ + out.Put(x44_translationFriction[0]); + /* x44_translationFriction[1] */ + out.Put(x44_translationFriction[1]); + /* x44_translationFriction[2] */ + out.Put(x44_translationFriction[2]); + /* x44_translationFriction[3] */ + out.Put(x44_translationFriction[3]); + /* x44_translationFriction[4] */ + out.Put(x44_translationFriction[4]); + /* x44_translationFriction[5] */ + out.Put(x44_translationFriction[5]); + /* x44_translationFriction[6] */ + out.Put(x44_translationFriction[6]); + /* x44_translationFriction[7] */ + out.Put(x44_translationFriction[7]); + /* x64_rotationFriction[0] */ + out.Put(x64_rotationFriction[0]); + /* x64_rotationFriction[1] */ + out.Put(x64_rotationFriction[1]); + /* x64_rotationFriction[2] */ + out.Put(x64_rotationFriction[2]); + /* x64_rotationFriction[3] */ + out.Put(x64_rotationFriction[3]); + /* x64_rotationFriction[4] */ + out.Put(x64_rotationFriction[4]); + /* x64_rotationFriction[5] */ + out.Put(x64_rotationFriction[5]); + /* x64_rotationFriction[6] */ + out.Put(x64_rotationFriction[6]); + /* x64_rotationFriction[7] */ + out.Put(x64_rotationFriction[7]); + /* x84_rotationMaxSpeed[0] */ + out.Put(x84_rotationMaxSpeed[0]); + /* x84_rotationMaxSpeed[1] */ + out.Put(x84_rotationMaxSpeed[1]); + /* x84_rotationMaxSpeed[2] */ + out.Put(x84_rotationMaxSpeed[2]); + /* x84_rotationMaxSpeed[3] */ + out.Put(x84_rotationMaxSpeed[3]); + /* x84_rotationMaxSpeed[4] */ + out.Put(x84_rotationMaxSpeed[4]); + /* x84_rotationMaxSpeed[5] */ + out.Put(x84_rotationMaxSpeed[5]); + /* x84_rotationMaxSpeed[6] */ + out.Put(x84_rotationMaxSpeed[6]); + /* x84_rotationMaxSpeed[7] */ + out.Put(x84_rotationMaxSpeed[7]); + /* xa4_translationMaxSpeed[0] */ + out.Put(xa4_translationMaxSpeed[0]); + /* xa4_translationMaxSpeed[1] */ + out.Put(xa4_translationMaxSpeed[1]); + /* xa4_translationMaxSpeed[2] */ + out.Put(xa4_translationMaxSpeed[2]); + /* xa4_translationMaxSpeed[3] */ + out.Put(xa4_translationMaxSpeed[3]); + /* xa4_translationMaxSpeed[4] */ + out.Put(xa4_translationMaxSpeed[4]); + /* xa4_translationMaxSpeed[5] */ + out.Put(xa4_translationMaxSpeed[5]); + /* xa4_translationMaxSpeed[6] */ + out.Put(xa4_translationMaxSpeed[6]); + /* xa4_translationMaxSpeed[7] */ + out.Put(xa4_translationMaxSpeed[7]); + /* xc4_normalGravAccel */ + out.Put(xc4_normalGravAccel); + /* xc8_fluidGravAccel */ + out.Put(xc8_fluidGravAccel); + /* xcc_verticalJumpAccel */ + out.Put(xcc_verticalJumpAccel); + /* xd0_horizontalJumpAccel */ + out.Put(xd0_horizontalJumpAccel); + /* xd4_verticalDoubleJumpAccel */ + out.Put(xd4_verticalDoubleJumpAccel); + /* xd8_horizontalDoubleJumpAccel */ + out.Put(xd8_horizontalDoubleJumpAccel); + /* xdc_waterJumpFactor */ + out.Put(xdc_waterJumpFactor); + /* xe0_waterBallJumpFactor */ + out.Put(xe0_waterBallJumpFactor); + /* xe4_lavaJumpFactor */ + out.Put(xe4_lavaJumpFactor); + /* xe8_lavaBallJumpFactor */ + out.Put(xe8_lavaBallJumpFactor); + /* xec_phazonJumpFactor */ + out.Put(xec_phazonJumpFactor); + /* xf0_phazonBallJumpFactor */ + out.Put(xf0_phazonBallJumpFactor); + /* xf4_allowedJumpTime */ + out.Put(xf4_allowedJumpTime); + /* xf8_allowedDoubleJumpTime */ + out.Put(xf8_allowedDoubleJumpTime); + /* xfc_minDoubleJumpWindow */ + out.Put(xfc_minDoubleJumpWindow); + /* x100_maxDoubleJumpWindow */ + out.Put(x100_maxDoubleJumpWindow); + /* x104_ */ + out.Put(x104_); + /* x108_minJumpTime */ + out.Put(x108_minJumpTime); + /* x10c_minDoubleJumpTime */ + out.Put(x10c_minDoubleJumpTime); + /* x110_allowedLedgeTime */ + out.Put(x110_allowedLedgeTime); + /* x114_doubleJumpImpulse */ + out.Put(x114_doubleJumpImpulse); + /* x118_backwardsForceMultiplier */ + out.Put(x118_backwardsForceMultiplier); + /* x11c_bombJumpRadius */ + out.Put(x11c_bombJumpRadius); + /* x120_bombJumpHeight */ + out.Put(x120_bombJumpHeight); + /* x124_eyeOffset */ + out.Put(x124_eyeOffset); + /* x128_turnSpeedMultiplier */ + out.Put(x128_turnSpeedMultiplier); + /* x12c_freeLookTurnSpeedMultiplier */ + out.Put(x12c_freeLookTurnSpeedMultiplier); + /* x130_horizontalFreeLookAngleVel */ + out.Put(x130_horizontalFreeLookAngleVel); + /* x134_verticalFreeLookAngleVel */ + out.Put(x134_verticalFreeLookAngleVel); + /* x138_freeLookSpeed */ + out.Put(x138_freeLookSpeed); + /* x13c_freeLookSnapSpeed */ + out.Put(x13c_freeLookSnapSpeed); + /* x140_ */ + out.Put(x140_); + /* x144_freeLookCenteredThresholdAngle */ + out.Put(x144_freeLookCenteredThresholdAngle); + /* x148_freeLookCenteredTime */ + out.Put(x148_freeLookCenteredTime); + /* x14c_freeLookDampenFactor */ + out.Put(x14c_freeLookDampenFactor); + /* x150_leftDiv */ + out.Put(x150_leftDiv); + /* x154_rightDiv */ + out.Put(x154_rightDiv); + /* x228_24_freelookTurnsPlayer */ + out.Put(x228_24_freelookTurnsPlayer); + /* x228_25_ */ + out.Put(x228_25_); + /* x228_26_ */ + out.Put(x228_26_); + /* x228_27_moveDuringFreeLook */ + out.Put(x228_27_moveDuringFreeLook); + /* x228_28_holdButtonsForFreeLook */ + out.Put(x228_28_holdButtonsForFreeLook); + /* x228_29_twoButtonsForFreeLook */ + out.Put(x228_29_twoButtonsForFreeLook); + /* x228_30_ */ + out.Put(x228_30_); + /* x228_31_ */ + out.Put(x228_31_); + /* x229_24_ */ + out.Put(x229_24_); + /* x229_25_aimWhenOrbitingPoint */ + out.Put(x229_25_aimWhenOrbitingPoint); + /* x229_26_stayInFreeLookWhileFiring */ + out.Put(x229_26_stayInFreeLookWhileFiring); + /* x229_27_ */ + out.Put(x229_27_); + /* x229_28_ */ + out.Put(x229_28_); + /* x229_29_orbitFixedOffset */ + out.Put(x229_29_orbitFixedOffset); + /* x229_30_gunButtonTogglesHolster */ + out.Put(x229_30_gunButtonTogglesHolster); + /* x229_31_gunNotFiringHolstersGun */ + out.Put(x229_31_gunNotFiringHolstersGun); + /* x22a_24_fallingDoubleJump */ + out.Put(x22a_24_fallingDoubleJump); + /* x22a_25_impulseDoubleJump */ + out.Put(x22a_25_impulseDoubleJump); + /* x22a_26_firingCancelsCameraPitch */ + out.Put(x22a_26_firingCancelsCameraPitch); + /* x22a_27_assistedAimingIgnoreHorizontal */ + out.Put(x22a_27_assistedAimingIgnoreHorizontal); + /* x22a_28_assistedAimingIgnoreVertical */ + out.Put(x22a_28_assistedAimingIgnoreVertical); + /* x22c_ */ + out.Put(x22c_); + /* x230_ */ + out.Put(x230_); + /* x234_aimMaxDistance */ + out.Put(x234_aimMaxDistance); + /* x238_ */ + out.Put(x238_); + /* x23c_ */ + out.Put(x23c_); + /* x240_ */ + out.Put(x240_); + /* x244_ */ + out.Put(x244_); + /* x248_ */ + out.Put(x248_); + /* x24c_aimThresholdDistance */ + out.Put(x24c_aimThresholdDistance); + /* x250_ */ + out.Put(x250_); + /* x254_ */ + out.Put(x254_); + /* x258_aimBoxWidth */ + out.Put(x258_aimBoxWidth); + /* x25c_aimBoxHeight */ + out.Put(x25c_aimBoxHeight); + /* x260_aimTargetTimer */ + out.Put(x260_aimTargetTimer); + /* x264_aimAssistHorizontalAngle */ + out.Put(x264_aimAssistHorizontalAngle); + /* x268_aimAssistVerticalAngle */ + out.Put(x268_aimAssistVerticalAngle); + /* x158_orbitMinDistance[0] */ + out.Put(x158_orbitMinDistance[0]); + /* x164_orbitNormalDistance[0] */ + out.Put(x164_orbitNormalDistance[0]); + /* x170_orbitMaxDistance[0] */ + out.Put(x170_orbitMaxDistance[0]); + /* x158_orbitMinDistance[1] */ + out.Put(x158_orbitMinDistance[1]); + /* x164_orbitNormalDistance[1] */ + out.Put(x164_orbitNormalDistance[1]); + /* x170_orbitMaxDistance[1] */ + out.Put(x170_orbitMaxDistance[1]); + /* x158_orbitMinDistance[2] */ + out.Put(x158_orbitMinDistance[2]); + /* x164_orbitNormalDistance[2] */ + out.Put(x164_orbitNormalDistance[2]); + /* x170_orbitMaxDistance[2] */ + out.Put(x170_orbitMaxDistance[2]); + /* x17c_ */ + out.Put(x17c_); + /* x180_orbitModeTimer */ + out.Put(x180_orbitModeTimer); + /* x184_orbitCameraSpeed */ + out.Put(x184_orbitCameraSpeed); + /* x188_orbitUpperAngle */ + out.Put(x188_orbitUpperAngle); + /* x18c_orbitLowerAngle */ + out.Put(x18c_orbitLowerAngle); + /* x190_orbitHorizAngle */ + out.Put(x190_orbitHorizAngle); + /* x194_ */ + out.Put(x194_); + /* x198_ */ + out.Put(x198_); + /* x19c_orbitMaxTargetDistance */ + out.Put(x19c_orbitMaxTargetDistance); + /* x1a0_orbitMaxLockDistance */ + out.Put(x1a0_orbitMaxLockDistance); + /* x1a4_orbitDistanceThreshold */ + out.Put(x1a4_orbitDistanceThreshold); + /* x1a8_orbitScreenBoxHalfExtentX[0] */ + out.Put(x1a8_orbitScreenBoxHalfExtentX[0]); + /* x1b0_orbitScreenBoxHalfExtentY[0] */ + out.Put(x1b0_orbitScreenBoxHalfExtentY[0]); + /* x1b8_orbitScreenBoxCenterX[0] */ + out.Put(x1b8_orbitScreenBoxCenterX[0]); + /* x1c0_orbitScreenBoxCenterY[0] */ + out.Put(x1c0_orbitScreenBoxCenterY[0]); + /* x1c8_orbitZoneIdealX[0] */ + out.Put(x1c8_orbitZoneIdealX[0]); + /* x1d0_orbitZoneIdealY[0] */ + out.Put(x1d0_orbitZoneIdealY[0]); + /* x1a8_orbitScreenBoxHalfExtentX[1] */ + out.Put(x1a8_orbitScreenBoxHalfExtentX[1]); + /* x1b0_orbitScreenBoxHalfExtentY[1] */ + out.Put(x1b0_orbitScreenBoxHalfExtentY[1]); + /* x1b8_orbitScreenBoxCenterX[1] */ + out.Put(x1b8_orbitScreenBoxCenterX[1]); + /* x1c0_orbitScreenBoxCenterY[1] */ + out.Put(x1c0_orbitScreenBoxCenterY[1]); + /* x1c8_orbitZoneIdealX[1] */ + out.Put(x1c8_orbitZoneIdealX[1]); + /* x1d0_orbitZoneIdealY[1] */ + out.Put(x1d0_orbitZoneIdealY[1]); + /* x1d8_orbitNearX */ + out.Put(x1d8_orbitNearX); + /* x1dc_orbitNearZ */ + out.Put(x1dc_orbitNearZ); + /* x1e0_ */ + out.Put(x1e0_); + /* x1e4_ */ + out.Put(x1e4_); + /* x1e8_orbitFixedOffsetZDiff */ + out.Put(x1e8_orbitFixedOffsetZDiff); + /* x1ec_orbitZRange */ + out.Put(x1ec_orbitZRange); + /* x1f0_ */ + out.Put(x1f0_); + /* x1f4_ */ + out.Put(x1f4_); + /* x1f8_ */ + out.Put(x1f8_); + /* x1fc_orbitPreventionTime */ + out.Put(x1fc_orbitPreventionTime); + /* x200_24_dashEnabled */ + out.Put(x200_24_dashEnabled); + /* x200_25_dashOnButtonRelease */ + out.Put(x200_25_dashOnButtonRelease); + /* x204_dashButtonHoldCancelTime */ + out.Put(x204_dashButtonHoldCancelTime); + /* x208_dashStrafeInputThreshold */ + out.Put(x208_dashStrafeInputThreshold); + /* x20c_sidewaysDoubleJumpImpulse */ + out.Put(x20c_sidewaysDoubleJumpImpulse); + /* x210_sidewaysVerticalDoubleJumpAccel */ + out.Put(x210_sidewaysVerticalDoubleJumpAccel); + /* x214_sidewaysHorizontalDoubleJumpAccel */ + out.Put(x214_sidewaysHorizontalDoubleJumpAccel); + /* x218_scanningRange */ + out.Put(x218_scanningRange); + /* x21c_24_scanRetention */ + out.Put(x21c_24_scanRetention); + /* x21c_25_scanFreezesGame */ + out.Put(x21c_25_scanFreezesGame); + /* x21c_26_orbitWhileScanning */ + out.Put(x21c_26_orbitWhileScanning); + /* x220_scanMaxTargetDistance */ + out.Put(x220_scanMaxTargetDistance); + /* x224_scanMaxLockDistance */ + out.Put(x224_scanMaxLockDistance); + /* x2a0_orbitDistanceMax */ + out.Put(x2a0_orbitDistanceMax); + /* x2a4_grappleSwingLength */ + out.Put(x2a4_grappleSwingLength); + /* x2a8_grappleSwingPeriod */ + out.Put(x2a8_grappleSwingPeriod); + /* x2ac_grapplePullSpeedMin */ + out.Put(x2ac_grapplePullSpeedMin); + /* x2b0_grappleCameraSpeed */ + out.Put(x2b0_grappleCameraSpeed); + /* x2b4_maxGrappleLockedTurnAlignDistance */ + out.Put(x2b4_maxGrappleLockedTurnAlignDistance); + /* x2b8_grapplePullSpeedProportion */ + out.Put(x2b8_grapplePullSpeedProportion); + /* x2bc_grapplePullSpeedMax */ + out.Put(x2bc_grapplePullSpeedMax); + /* x2c0_grappleLookCenterSpeed */ + out.Put(x2c0_grappleLookCenterSpeed); + /* x2c4_maxGrappleTurnSpeed */ + out.Put(x2c4_maxGrappleTurnSpeed); + /* x2c8_grappleJumpForce */ + out.Put(x2c8_grappleJumpForce); + /* x2cc_grappleReleaseTime */ + out.Put(x2cc_grappleReleaseTime); + /* x2d0_grappleJumpMode */ + out.Put(x2d0_grappleJumpMode); + /* x2d4_orbitReleaseBreaksGrapple */ + out.Put(x2d4_orbitReleaseBreaksGrapple); + /* x2d5_invertGrappleTurn */ + out.Put(x2d5_invertGrappleTurn); + /* x2d8_grappleBeamSpeed */ + out.Put(x2d8_grappleBeamSpeed); + /* x2dc_grappleBeamXWaveAmplitude */ + out.Put(x2dc_grappleBeamXWaveAmplitude); + /* x2e0_grappleBeamZWaveAmplitude */ + out.Put(x2e0_grappleBeamZWaveAmplitude); + /* x2e4_grappleBeamAnglePhaseDelta */ + out.Put(x2e4_grappleBeamAnglePhaseDelta); + /* x26c_playerHeight */ + out.Put(x26c_playerHeight); + /* x270_playerXYHalfExtent */ + out.Put(x270_playerXYHalfExtent); + /* x274_stepUpHeight */ + out.Put(x274_stepUpHeight); + /* x278_stepDownHeight */ + out.Put(x278_stepDownHeight); + /* x27c_playerBallHalfExtent */ + out.Put(x27c_playerBallHalfExtent); + /* x280_ */ + out.Put(x280_firstPersonCameraSpeed); + /* x284_ */ + out.Put(x284_); + /* x288_jumpCameraPitchDownStart */ + out.Put(x288_jumpCameraPitchDownStart); + /* x28c_jumpCameraPitchDownFull */ + out.Put(x28c_jumpCameraPitchDownFull); + /* x290_jumpCameraPitchDownAngle */ + out.Put(x290_jumpCameraPitchDownAngle); + /* x294_fallCameraPitchDownStart */ + out.Put(x294_fallCameraPitchDownStart); + /* x298_fallCameraPitchDownFull */ + out.Put(x298_fallCameraPitchDownFull); + /* x29c_fallCameraPitchDownAngle */ + out.Put(x29c_fallCameraPitchDownAngle); + /* x2e8_ */ + out.Put(x2e8_); + /* x2ec_ */ + out.Put(x2ec_); + /* x2f0_ */ + out.Put(x2f0_); + /* x2f4_ */ + out.Put(x2f4_); + /* x2f8_frozenTimeout */ + out.Put(x2f8_frozenTimeout); + /* x2fc_iceBreakJumpCount */ + out.Put(x2fc_iceBreakJumpCount); + /* x300_variaDamageReduction */ + out.Put(x300_variaDamageReduction); + /* x304_gravityDamageReduction */ + out.Put(x304_gravityDamageReduction); + /* x308_phazonDamageReduction */ + out.Put(x308_phazonDamageReduction); +} + +void CTweakPlayer::FixupValues() { + x130_horizontalFreeLookAngleVel = zeus::degToRad(x130_horizontalFreeLookAngleVel); + x134_verticalFreeLookAngleVel = zeus::degToRad(x134_verticalFreeLookAngleVel); + x138_freeLookSpeed = zeus::degToRad(x138_freeLookSpeed); + x13c_freeLookSnapSpeed = zeus::degToRad(x13c_freeLookSnapSpeed); + x140_ = zeus::degToRad(x140_); + x144_freeLookCenteredThresholdAngle = zeus::degToRad(x144_freeLookCenteredThresholdAngle); + x23c_ = zeus::degToRad(x23c_); + x240_ = zeus::degToRad(x240_); + x244_ = zeus::degToRad(x244_); + x248_ = zeus::degToRad(x248_); + x250_ = zeus::degToRad(x250_); + x264_aimAssistHorizontalAngle = zeus::degToRad(x264_aimAssistHorizontalAngle); + x268_aimAssistVerticalAngle = zeus::degToRad(x268_aimAssistVerticalAngle); + x17c_ = zeus::degToRad(x17c_); + x184_orbitCameraSpeed = zeus::degToRad(x184_orbitCameraSpeed); + x188_orbitUpperAngle = zeus::degToRad(x188_orbitUpperAngle); + x18c_orbitLowerAngle = zeus::degToRad(x18c_orbitLowerAngle); + x190_orbitHorizAngle = zeus::degToRad(x190_orbitHorizAngle); + x194_ = zeus::degToRad(x194_); + x198_ = zeus::degToRad(x198_); + x1f0_ = zeus::degToRad(x1f0_); + x1f4_ = zeus::degToRad(x1f4_); + x2b0_grappleCameraSpeed = zeus::degToRad(x2b0_grappleCameraSpeed); + x2c0_grappleLookCenterSpeed = zeus::degToRad(x2c0_grappleLookCenterSpeed); + x280_firstPersonCameraSpeed = zeus::degToRad(x280_firstPersonCameraSpeed); + x284_ = zeus::degToRad(x284_); + x290_jumpCameraPitchDownAngle = zeus::degToRad(x290_jumpCameraPitchDownAngle); + x29c_fallCameraPitchDownAngle = zeus::degToRad(x29c_fallCameraPitchDownAngle); +} + +void CTweakPlayer::_tweakListener(hecl::CVar* cv) { + UPDATE_CVAR(MaxTranslationAccelerationNormal, cv, x4_maxTranslationalAcceleration[0]); + UPDATE_CVAR(MaxTranslationAccelerationAir, cv, x4_maxTranslationalAcceleration[1]); + UPDATE_CVAR(MaxTranslationAccelerationIce, cv, x4_maxTranslationalAcceleration[2]); + UPDATE_CVAR(MaxTranslationAccelerationOrganic, cv, x4_maxTranslationalAcceleration[3]); + UPDATE_CVAR(MaxTranslationAccelerationWater, cv, x4_maxTranslationalAcceleration[4]); + UPDATE_CVAR(MaxTranslationAccelerationLava, cv, x4_maxTranslationalAcceleration[5]); + UPDATE_CVAR(MaxTranslationAccelerationPhazon, cv, x4_maxTranslationalAcceleration[6]); + UPDATE_CVAR(MaxRotationAccelerationShrubbery, cv, x24_maxRotationalAcceleration[7]); + UPDATE_CVAR(MaxRotationAccelerationNormal, cv, x24_maxRotationalAcceleration[0]); + UPDATE_CVAR(MaxRotationAccelerationAir, cv, x24_maxRotationalAcceleration[1]); + UPDATE_CVAR(MaxRotationAccelerationIce, cv, x24_maxRotationalAcceleration[2]); + UPDATE_CVAR(MaxRotationAccelerationOrganic, cv, x24_maxRotationalAcceleration[3]); + UPDATE_CVAR(MaxRotationAccelerationWater, cv, x24_maxRotationalAcceleration[4]); + UPDATE_CVAR(MaxRotationAccelerationLava, cv, x24_maxRotationalAcceleration[5]); + UPDATE_CVAR(MaxRotationAccelerationPhazon, cv, x24_maxRotationalAcceleration[6]); + UPDATE_CVAR(MaxRotationAccelerationShrubbery, cv, x24_maxRotationalAcceleration[7]); + UPDATE_CVAR(TranslationFrictionNormal, cv, x44_translationFriction[0]); + UPDATE_CVAR(TranslationFrictionAir, cv, x44_translationFriction[1]); + UPDATE_CVAR(TranslationFrictionIce, cv, x44_translationFriction[2]); + UPDATE_CVAR(TranslationFrictionOrganic, cv, x44_translationFriction[3]); + UPDATE_CVAR(TranslationFrictionWater, cv, x44_translationFriction[4]); + UPDATE_CVAR(TranslationFrictionLava, cv, x44_translationFriction[5]); + UPDATE_CVAR(TranslationFrictionPhazon, cv, x44_translationFriction[6]); + UPDATE_CVAR(TranslationFrictionShrubbery, cv, x44_translationFriction[7]); + UPDATE_CVAR(RotationFrictionNormal, cv, x44_translationFriction[2]); + UPDATE_CVAR(RotationFrictionIce, cv, x44_translationFriction[2]); + UPDATE_CVAR(RotationFrictionOrganic, cv, x44_translationFriction[3]); + UPDATE_CVAR(RotationFrictionWater, cv, x44_translationFriction[4]); + UPDATE_CVAR(RotationFrictionLava, cv, x44_translationFriction[5]); + UPDATE_CVAR(RotationFrictionPhazon, cv, x44_translationFriction[6]); + UPDATE_CVAR(RotationFrictionShrubbery, cv, x44_translationFriction[7]); + UPDATE_CVAR(RotationMaxSpeedNormal, cv, x84_rotationMaxSpeed[2]); + UPDATE_CVAR(RotationMaxSpeedIce, cv, x84_rotationMaxSpeed[2]); + UPDATE_CVAR(RotationMaxSpeedOrganic, cv, x84_rotationMaxSpeed[3]); + UPDATE_CVAR(RotationMaxSpeedWater, cv, x84_rotationMaxSpeed[4]); + UPDATE_CVAR(RotationMaxSpeedLava, cv, x84_rotationMaxSpeed[5]); + UPDATE_CVAR(RotationMaxSpeedPhazon, cv, x84_rotationMaxSpeed[6]); + UPDATE_CVAR(RotationMaxSpeedShrubbery, cv, x84_rotationMaxSpeed[7]); + UPDATE_CVAR(TranslationMaxSpeedNormal, cv, xa4_translationMaxSpeed[2]); + UPDATE_CVAR(TranslationMaxSpeedIce, cv, xa4_translationMaxSpeed[2]); + UPDATE_CVAR(TranslationMaxSpeedOrganic, cv, xa4_translationMaxSpeed[3]); + UPDATE_CVAR(TranslationMaxSpeedWater, cv, xa4_translationMaxSpeed[4]); + UPDATE_CVAR(TranslationMaxSpeedLava, cv, xa4_translationMaxSpeed[5]); + UPDATE_CVAR(TranslationMaxSpeedPhazon, cv, xa4_translationMaxSpeed[6]); + UPDATE_CVAR(TranslationMaxSpeedShrubbery, cv, xa4_translationMaxSpeed[7]); + UPDATE_CVAR(NormalGravityAcceleration, cv, xc4_normalGravAccel); + UPDATE_CVAR(FluidGravityAcceleration, cv, xc8_fluidGravAccel); + UPDATE_CVAR(VerticalJumpAcceleration, cv, xcc_verticalJumpAccel); + UPDATE_CVAR(HorizontalJumpAcceleration, cv, xd0_horizontalJumpAccel); + UPDATE_CVAR(VerticalDoubleJumpAcceleration, cv, xd4_verticalDoubleJumpAccel); + UPDATE_CVAR(HorizontalDoubleJumpAcceleration, cv, xd8_horizontalDoubleJumpAccel); + UPDATE_CVAR(WaterJumpFactor, cv, xdc_waterJumpFactor); + UPDATE_CVAR(WaterBallJumpFactor, cv, xe0_waterBallJumpFactor); + UPDATE_CVAR(LavaJumpFactor, cv, xe4_lavaJumpFactor); + UPDATE_CVAR(LavaBallJumpFactor, cv, xe8_lavaBallJumpFactor); + UPDATE_CVAR(PhazonJumpFactor, cv, xec_phazonJumpFactor); + UPDATE_CVAR(PhazonBallJumpFactor, cv, xf0_phazonBallJumpFactor); + UPDATE_CVAR(AllowedJumpTime, cv, xf4_allowedJumpTime); + UPDATE_CVAR(AllowedDoubleJumpTime, cv, xf8_allowedDoubleJumpTime); + UPDATE_CVAR(MinDoubleJumpWindow, cv, xfc_minDoubleJumpWindow); + UPDATE_CVAR(MaxDoubleJumpWindow, cv, x100_maxDoubleJumpWindow); + // UPDATE_CVAR(); // x104_ + UPDATE_CVAR(MinJumpTime, cv, x108_minJumpTime); + UPDATE_CVAR(MinDoubleJumpTime, cv, x10c_minDoubleJumpTime); + UPDATE_CVAR(AllowedLedgeTime, cv, x110_allowedLedgeTime); + UPDATE_CVAR(DoubleJumpImpulse, cv, x114_doubleJumpImpulse); + UPDATE_CVAR(BackwardsForceMultiplier, cv, x118_backwardsForceMultiplier); + UPDATE_CVAR(BombJumpRadius, cv, x11c_bombJumpRadius); + UPDATE_CVAR(BombJumpHeight, cv, x120_bombJumpHeight); + UPDATE_CVAR(EyeOffset, cv, x124_eyeOffset); + UPDATE_CVAR(TurnSpeedMultiplier, cv, x128_turnSpeedMultiplier); + UPDATE_CVAR(FreeLookTurnSpeedMultiplier, cv, x12c_freeLookTurnSpeedMultiplier); + UPDATE_CVAR(HorizontalFreeLookAngleVelocity, cv, x130_horizontalFreeLookAngleVel); + UPDATE_CVAR(VerticalFreeLookAngleVelocity, cv, x134_verticalFreeLookAngleVel); + UPDATE_CVAR(FreeLookSpeed, cv, x138_freeLookSpeed); + UPDATE_CVAR(FreeLookSnapSpeed, cv, x13c_freeLookSnapSpeed); + // UPDATE_CVAR(); // x140_ + UPDATE_CVAR(FreeLookCenteredThresholdAngle, cv, x144_freeLookCenteredThresholdAngle); + UPDATE_CVAR(FreeLookCenteredTime, cv, x148_freeLookCenteredTime); + UPDATE_CVAR(FreeLookDampenFactor, cv, x14c_freeLookDampenFactor); + UPDATE_CVAR(LeftDivisor, cv, x150_leftDiv); + UPDATE_CVAR(RightDivisor, cv, x154_rightDiv); + UPDATE_CVAR(OrbitMinDistanceClose, cv, x158_orbitMinDistance[0]); + UPDATE_CVAR(OrbitMinDistanceFar, cv, x158_orbitMinDistance[1]); + UPDATE_CVAR(OrbitMinDistanceDefault, cv, x158_orbitMinDistance[2]); + UPDATE_CVAR(OrbitNormalDistanceClose, cv, x164_orbitNormalDistance[0]); + UPDATE_CVAR(OrbitNormalDistanceFar, cv, x164_orbitNormalDistance[1]); + UPDATE_CVAR(OrbitNormalDistanceDefault, cv, x164_orbitNormalDistance[2]); + UPDATE_CVAR(OrbitMaxDistanceClose, cv, x170_orbitMaxDistance[0]); + UPDATE_CVAR(OrbitMaxDistanceFar, cv, x170_orbitMaxDistance[1]); + UPDATE_CVAR(OrbitMaxDistanceDefault, cv, x170_orbitMaxDistance[2]); + // UPDATE_CVAR(); // x17c_ + UPDATE_CVAR(OrbitmodeTimer, cv, x180_orbitModeTimer); + UPDATE_CVAR(OrbitCameraSpeed, cv, x184_orbitCameraSpeed); + UPDATE_CVAR(OrbitUpperAngle, cv, x188_orbitUpperAngle); + UPDATE_CVAR(OrbitLowerAngle, cv, x18c_orbitLowerAngle); + UPDATE_CVAR(OrbitHorizontalAngle, cv, x190_orbitHorizAngle); + // UPDATE_CVAR(); // x194_ + // UPDATE_CVAR(); // x198_ + UPDATE_CVAR(OrbitMaxTargetDistance, cv, x19c_orbitMaxTargetDistance); + UPDATE_CVAR(OrbitMaxLockDistance, cv, x1a0_orbitMaxLockDistance); + UPDATE_CVAR(OrbitDistanceThreshold, cv, x1a4_orbitDistanceThreshold); + UPDATE_CVAR(OrbitScreenTargetingBoxHalfExtentX, cv, x1a8_orbitScreenBoxHalfExtentX[0]); + UPDATE_CVAR(OrbitScreenScanBoxHalfExtentX, cv, x1a8_orbitScreenBoxHalfExtentX[1]); + UPDATE_CVAR(OrbitScreenTargetingBoxHalfExtentY, cv, x1b0_orbitScreenBoxHalfExtentY[0]); + UPDATE_CVAR(OrbitScreenScanBoxHalfExtentY, cv, x1b0_orbitScreenBoxHalfExtentY[1]); + UPDATE_CVAR(OrbitScreenTargetingBoxCenterX, cv, x1b8_orbitScreenBoxCenterX[0]); + UPDATE_CVAR(OrbitScreenScanBoxCenterX, cv, x1b8_orbitScreenBoxCenterX[1]); + UPDATE_CVAR(OrbitScreenTargetingBoxCenterY, cv, x1c0_orbitScreenBoxCenterY[0]); + UPDATE_CVAR(OrbitScreenScanBoxCenterY, cv, x1c0_orbitScreenBoxCenterY[1]); + UPDATE_CVAR(OrbitZoneTargetingIdealX, cv, x1c8_orbitZoneIdealX[0]); + UPDATE_CVAR(OrbitZoneScanIdealX, cv, x1c8_orbitZoneIdealX[1]); + UPDATE_CVAR(OrbitZoneTargetingIdealY, cv, x1d0_orbitZoneIdealY[0]); + UPDATE_CVAR(OrbitZoneScanIdealY, cv, x1d0_orbitZoneIdealY[1]); + UPDATE_CVAR(OrbitNearX, cv, x1d8_orbitNearX); + UPDATE_CVAR(OrbitNearZ, cv, x1dc_orbitNearZ); + // UPDATE_CVAR(); // x1e0_ + // UPDATE_CVAR(); // x1e4_ + UPDATE_CVAR(OrbitFixedOffsetZDiff, cv, x1e8_orbitFixedOffsetZDiff); + UPDATE_CVAR(OrbitZRange, cv, x1ec_orbitZRange); + // UPDATE_CVAR(); // x1f0_ + // UPDATE_CVAR(); // x1f4_ + // UPDATE_CVAR(); // x1f8_ + UPDATE_CVAR(OrbitPreventionTime, cv, x1fc_orbitPreventionTime); + UPDATE_CVAR_BITFIELD(DashEnabled, cv, x200_24_dashEnabled); + UPDATE_CVAR_BITFIELD(DashOnButtonRelease, cv, x200_25_dashOnButtonRelease); + UPDATE_CVAR(DashButtonHoldCancelTime, cv, x204_dashButtonHoldCancelTime); + UPDATE_CVAR(DashStrafeInputThreshold, cv, x208_dashStrafeInputThreshold); + UPDATE_CVAR(SidewaysDoubleJumpImpulse, cv, x20c_sidewaysDoubleJumpImpulse); + UPDATE_CVAR(SidewaysVerticalDoubleJumpAccel, cv, x210_sidewaysVerticalDoubleJumpAccel); + UPDATE_CVAR(SidewaysHorizontalDoubleJumpAccel, cv, x214_sidewaysHorizontalDoubleJumpAccel); + UPDATE_CVAR(ScanningRange, cv, x218_scanningRange); + UPDATE_CVAR_BITFIELD(ScanRetention, cv, x21c_24_scanRetention); + UPDATE_CVAR_BITFIELD(ScanFreezesGame, cv, x21c_25_scanFreezesGame); + UPDATE_CVAR_BITFIELD(OrbitWhileScanning, cv, x21c_26_orbitWhileScanning); + UPDATE_CVAR(ScanMaxTargetDistance, cv, x220_scanMaxTargetDistance); + UPDATE_CVAR(ScanMaxLockDistance, cv, x224_scanMaxLockDistance); + UPDATE_CVAR_BITFIELD(FreeLookTurnsPlayer, cv, x228_24_freelookTurnsPlayer); + // UPDATE_CVAR_BITFIELD(); // x228_25_ + // UPDATE_CVAR_BITFIELD(); // x228_26_ + UPDATE_CVAR_BITFIELD(MoveDuringFreelook, cv, x228_27_moveDuringFreeLook); + UPDATE_CVAR_BITFIELD(HoldButtonsForFreeLook, cv, x228_28_holdButtonsForFreeLook); + // UPDATE_CVAR_BITFIELD(); // x228_30_ + // UPDATE_CVAR_BITFIELD(); // x228_31_ + // UPDATE_CVAR_BITFIELD(); // x229_24_ + UPDATE_CVAR_BITFIELD(AimWhenOrbitingPoint, cv, x229_25_aimWhenOrbitingPoint); + UPDATE_CVAR_BITFIELD(StayInFreeLookWhileFiring, cv, x229_26_stayInFreeLookWhileFiring); + // UPDATE_CVAR_BITFIELD(); // x229_27_ + // UPDATE_CVAR_BITFIELD(); // x229_28_ + UPDATE_CVAR_BITFIELD(OrbitFixedOffset, cv, x229_29_orbitFixedOffset); + UPDATE_CVAR_BITFIELD(GunButtonTogglesHolster, cv, x229_30_gunButtonTogglesHolster); + UPDATE_CVAR_BITFIELD(GunNotFiringHolstersGun, cv, x229_31_gunNotFiringHolstersGun); + UPDATE_CVAR_BITFIELD(FallingDoubleJump, cv, x22a_24_fallingDoubleJump); + UPDATE_CVAR_BITFIELD(ImpulseDoubleJump, cv, x22a_25_impulseDoubleJump); + UPDATE_CVAR_BITFIELD(FiringCancelsCameraPitch, cv, x22a_26_firingCancelsCameraPitch); + UPDATE_CVAR_BITFIELD(AssistedAimingIgnoreHorizontal, cv, x22a_27_assistedAimingIgnoreHorizontal); + UPDATE_CVAR_BITFIELD(AssistedAimingIgnoreVertical, cv, x22a_28_assistedAimingIgnoreVertical); + // UPDATE_CVAR(); // x22c + // UPDATE_CVAR(); // x230_ + UPDATE_CVAR(AimMaxDistance, cv, x234_aimMaxDistance); + // UPDATE_CVAR(); // x238_ + // UPDATE_CVAR(); // x23c_ + // UPDATE_CVAR(); // x240_ + // UPDATE_CVAR(); // x244_ + // UPDATE_CVAR(); // x248_ + UPDATE_CVAR(AimThresholdDistance, cv, x24c_aimThresholdDistance); + // UPDATE_CVAR(); // x250_ + // UPDATE_CVAR(); // x254_ + UPDATE_CVAR(AimBoxWidth, cv, x258_aimBoxWidth); + UPDATE_CVAR(AimBoxHeight, cv, x25c_aimBoxHeight); + UPDATE_CVAR(AimTargetTimer, cv, x260_aimTargetTimer); + UPDATE_CVAR(AimAssistHorizontalAngle, cv, x264_aimAssistHorizontalAngle); + UPDATE_CVAR(AimAssistVerticalAngle, cv, x268_aimAssistVerticalAngle); + UPDATE_CVAR(PlayerHeight, cv, x26c_playerHeight); + UPDATE_CVAR(PlayerXYHalfExtent, cv, x270_playerXYHalfExtent); + UPDATE_CVAR(StepUpHeight, cv, x274_stepUpHeight); + UPDATE_CVAR(StepDownHeight, cv, x278_stepDownHeight); + UPDATE_CVAR(PlayerBallHalfExtent, cv, x27c_playerBallHalfExtent); + UPDATE_CVAR(FirstPersonCameraSpeed, cv, x280_firstPersonCameraSpeed); + // UPDATE_CVAR(); // x284_ + UPDATE_CVAR(JumpCameraPitchDownStart, cv, x288_jumpCameraPitchDownStart); + UPDATE_CVAR(JumpCameraPitchDownFull, cv, x28c_jumpCameraPitchDownFull); + UPDATE_CVAR(JumpCameraPitchDownAngle, cv, x290_jumpCameraPitchDownAngle); + UPDATE_CVAR(FallCameraPitchDownStart, cv, x294_fallCameraPitchDownStart); + UPDATE_CVAR(FallCameraPitchDownFull, cv, x298_fallCameraPitchDownFull); + UPDATE_CVAR(FallCameraPitchDownAngle, cv, x29c_fallCameraPitchDownAngle); + UPDATE_CVAR(OrbitDistanceMax, cv, x2a0_orbitDistanceMax); + UPDATE_CVAR(GrappleSwingLength, cv, x2a4_grappleSwingLength); + UPDATE_CVAR(GrappleSwingPeriod, cv, x2a8_grappleSwingPeriod); + UPDATE_CVAR(GrapplePullSpeedMin, cv, x2ac_grapplePullSpeedMin); + UPDATE_CVAR(GrappleCameraSpeed, cv, x2b0_grappleCameraSpeed); + UPDATE_CVAR(MaxGrappleLockedTurnAlignDistance, cv, x2b4_maxGrappleLockedTurnAlignDistance); + UPDATE_CVAR(GrapplePullSpeedProportion, cv, x2b8_grapplePullSpeedProportion); + UPDATE_CVAR(GrapplePullSpeedMax, cv, x2bc_grapplePullSpeedMax); + UPDATE_CVAR(GrappleLookCenterSpeed, cv, x2c0_grappleLookCenterSpeed); + UPDATE_CVAR(MaxGrappleTurnSpeed, cv, x2c4_maxGrappleTurnSpeed); + UPDATE_CVAR(GrappleJumpForce, cv, x2c8_grappleJumpForce); + UPDATE_CVAR(GrappleReleaseTime, cv, x2cc_grappleReleaseTime); + UPDATE_CVAR(GrappleJumpMode, cv, x2d0_grappleJumpMode); + UPDATE_CVAR(OrbitReleaseBreaksGrapple, cv, x2d4_orbitReleaseBreaksGrapple); + UPDATE_CVAR(InvertGrappleTurn, cv, x2d5_invertGrappleTurn); + UPDATE_CVAR(GrappleBeamSpeed, cv, x2d8_grappleBeamSpeed); + UPDATE_CVAR(GrappleBeamXWaveAmplitude, cv, x2dc_grappleBeamXWaveAmplitude); + UPDATE_CVAR(GrappleBeamZWaveAmplitude, cv, x2e0_grappleBeamZWaveAmplitude); + UPDATE_CVAR(GrappleBeamAnglePhaseDelta, cv, x2e4_grappleBeamAnglePhaseDelta); + // UPDATE_CVAR(); // x2e8_ + // UPDATE_CVAR(); // x2ec_ + // UPDATE_CVAR(); // x2f0_ + // UPDATE_CVAR(); // x2f4_ + UPDATE_CVAR(FrozenTimeout, cv, x2f8_frozenTimeout); + UPDATE_CVAR(IceBreakJumpCount, cv, x2fc_iceBreakJumpCount); + UPDATE_CVAR(VariaDamageReduction, cv, x300_variaDamageReduction); + UPDATE_CVAR(GravityDamageReduction, cv, x304_gravityDamageReduction); + UPDATE_CVAR(PhazonDamageReduction, cv, x308_phazonDamageReduction); +} + +void CTweakPlayer::initCVars(hecl::CVarManager* mgr) { + CREATE_CVAR(MaxTranslationAccelerationNormal, + "Max translation acceleration allowed to the player under normal circumstances", + x4_maxTranslationalAcceleration[0], skDefaultFlags); + CREATE_CVAR(MaxTranslationAccelerationAir, "Max translation acceleration allowed to the player while in air", + x4_maxTranslationalAcceleration[1], skDefaultFlags); + CREATE_CVAR(MaxTranslationAccelerationIce, "Max translation acceleration allowed to the player while on ice surfaces", + x4_maxTranslationalAcceleration[2], skDefaultFlags); + CREATE_CVAR(MaxTranslationAccelerationOrganic, + "Max translation acceleration allowed to the player while on organic surfaces", + x4_maxTranslationalAcceleration[3], skDefaultFlags); + CREATE_CVAR(MaxTranslationAccelerationWater, "Max translation acceleration allowed to the player while in water", + x4_maxTranslationalAcceleration[4], skDefaultFlags); + CREATE_CVAR(MaxTranslationAccelerationLava, "Max translation acceleration allowed to the player while in lava", + x4_maxTranslationalAcceleration[5], skDefaultFlags); + CREATE_CVAR(MaxTranslationAccelerationPhazon, "Max translation acceleration allowed to the player while in phazon", + x4_maxTranslationalAcceleration[6], skDefaultFlags); + CREATE_CVAR(MaxTranslationAccelerationShrubbery, + "Max translation acceleration allowed to the player while in shrubbery", + x4_maxTranslationalAcceleration[7], skDefaultFlags); + CREATE_CVAR(MaxRotationAccelerationNormal, + "Max rotation acceleration allowed to the player under normal circumstances", + x24_maxRotationalAcceleration[0], skDefaultFlags); + CREATE_CVAR(MaxRotationAccelerationAir, "Max rotation acceleration allowed to the player while in air", + x24_maxRotationalAcceleration[1], skDefaultFlags); + CREATE_CVAR(MaxRotationAccelerationIce, "Max rotation acceleration allowed to the player while on ice surfaces", + x24_maxRotationalAcceleration[2], skDefaultFlags); + CREATE_CVAR(MaxRotationAccelerationOrganic, + "Max rotation acceleration allowed to the player while on organic surfaces", + x24_maxRotationalAcceleration[3], skDefaultFlags); + CREATE_CVAR(MaxRotationAccelerationWater, "Max rotation acceleration allowed to the player while in water", + x24_maxRotationalAcceleration[4], skDefaultFlags); + CREATE_CVAR(MaxRotationAccelerationLava, "Max rotation acceleration allowed to the player while in lava", + x24_maxRotationalAcceleration[5], skDefaultFlags); + CREATE_CVAR(MaxRotationAccelerationPhazon, "Max rotation acceleration allowed to the player while in phazon", + x24_maxRotationalAcceleration[6], skDefaultFlags); + CREATE_CVAR(MaxRotationAccelerationShrubbery, "Max rotation acceleration allowed to the player while in shrubbery", + x24_maxRotationalAcceleration[7], skDefaultFlags); + CREATE_CVAR(TranslationFrictionNormal, "Translation friction allowed to the player under normal circumstances", + x44_translationFriction[0], skDefaultFlags); + CREATE_CVAR(TranslationFrictionAir, "Translation friction allowed to the player while in air", + x44_translationFriction[1], skDefaultFlags); + CREATE_CVAR(TranslationFrictionIce, "Translation friction allowed to the player while on ice surfaces", + x44_translationFriction[2], skDefaultFlags); + CREATE_CVAR(TranslationFrictionOrganic, "Translation friction allowed to the player while on organic surfaces", + x44_translationFriction[3], skDefaultFlags); + CREATE_CVAR(TranslationFrictionWater, "Translation friction allowed to the player while in water", + x44_translationFriction[4], skDefaultFlags); + CREATE_CVAR(TranslationFrictionLava, "Translation friction allowed to the player while in lava", + x44_translationFriction[5], skDefaultFlags); + CREATE_CVAR(TranslationFrictionPhazon, "Translation friction allowed to the player while in phazon", + x44_translationFriction[6], skDefaultFlags); + CREATE_CVAR(TranslationFrictionShrubbery, "Translation friction allowed to the player while in shrubbery", + x44_translationFriction[7], skDefaultFlags); + CREATE_CVAR(RotationFrictionNormal, "Rotation friction allowed to the player under normal circumstances", + x44_translationFriction[0], skDefaultFlags); + CREATE_CVAR(RotationFrictionAir, "Rotation friction allowed to the player while in air", x44_translationFriction[1], + skDefaultFlags); + CREATE_CVAR(RotationFrictionIce, "Rotation friction allowed to the player while on ice surfaces", + x44_translationFriction[2], skDefaultFlags); + CREATE_CVAR(RotationFrictionOrganic, "Rotation friction allowed to the player while on organic surfaces", + x44_translationFriction[3], skDefaultFlags); + CREATE_CVAR(RotationFrictionWater, "Rotation friction allowed to the player while in water", + x44_translationFriction[4], skDefaultFlags); + CREATE_CVAR(RotationFrictionLava, "Rotation friction allowed to the player while in lava", x44_translationFriction[5], + skDefaultFlags); + CREATE_CVAR(RotationFrictionPhazon, "Rotation friction allowed to the player while in phazon", + x44_translationFriction[6], skDefaultFlags); + CREATE_CVAR(RotationFrictionShrubbery, "Rotation friction allowed to the player while in shrubbery", + x44_translationFriction[7], skDefaultFlags); + CREATE_CVAR(RotationMaxSpeedNormal, "Rotation max speed allowed to the player under normal circumstances", + x84_rotationMaxSpeed[0], skDefaultFlags); + CREATE_CVAR(RotationMaxSpeedAir, "Rotation max speed allowed to the player while in air", x84_rotationMaxSpeed[1], + skDefaultFlags); + CREATE_CVAR(RotationMaxSpeedIce, "Rotation max speed allowed to the player while on ice surfaces", + x84_rotationMaxSpeed[2], skDefaultFlags); + CREATE_CVAR(RotationMaxSpeedOrganic, "Rotation max speed allowed to the player while on organic surfaces", + x84_rotationMaxSpeed[3], skDefaultFlags); + CREATE_CVAR(RotationMaxSpeedWater, "Rotation max speed allowed to the player while in water", x84_rotationMaxSpeed[4], + skDefaultFlags); + CREATE_CVAR(RotationMaxSpeedLava, "Rotation max speed allowed to the player while in lava", x84_rotationMaxSpeed[5], + skDefaultFlags); + CREATE_CVAR(RotationMaxSpeedPhazon, "Rotation max speed allowed to the player while in phazon", + x84_rotationMaxSpeed[6], skDefaultFlags); + CREATE_CVAR(RotationMaxSpeedShrubbery, "Rotation max speed allowed to the player while in shrubbery", + x84_rotationMaxSpeed[7], skDefaultFlags); + CREATE_CVAR(TranslationMaxSpeedNormal, "Translation max speed allowed to the player under normal circumstances", + xa4_translationMaxSpeed[0], skDefaultFlags); + CREATE_CVAR(TranslationMaxSpeedNormal, "Translation max speed allowed to the player under normal circumstances", + xa4_translationMaxSpeed[1], skDefaultFlags); + CREATE_CVAR(TranslationMaxSpeedIce, "Translation max speed allowed to the player while on ice surfaces", + xa4_translationMaxSpeed[2], skDefaultFlags); + CREATE_CVAR(TranslationMaxSpeedOrganic, "Translation max speed allowed to the player while on organic surfaces", + xa4_translationMaxSpeed[3], skDefaultFlags); + CREATE_CVAR(TranslationMaxSpeedWater, "Translation max speed allowed to the player while in water", + xa4_translationMaxSpeed[4], skDefaultFlags); + CREATE_CVAR(TranslationMaxSpeedLava, "Translation max speed allowed to the player while in lava", + xa4_translationMaxSpeed[5], skDefaultFlags); + CREATE_CVAR(TranslationMaxSpeedPhazon, "Translation max speed allowed to the player while in phazon", + xa4_translationMaxSpeed[6], skDefaultFlags); + CREATE_CVAR(TranslationMaxSpeedShrubbery, "Translation max speed allowed to the player while in shrubbery", + xa4_translationMaxSpeed[7], skDefaultFlags); + CREATE_CVAR(NormalGravityAcceleration, "Gravity applied to the player under normal circumstances", + xc4_normalGravAccel, skDefaultFlags); + CREATE_CVAR(FluidGravityAcceleration, "Gravity applied to the player while in water", xc8_fluidGravAccel, + skDefaultFlags); + CREATE_CVAR(VerticalJumpAcceleration, "Vertical acceleration applied while jumping", xcc_verticalJumpAccel, + skDefaultFlags); + CREATE_CVAR(HorizontalJumpAcceleration, "Horizontal acceleration while jumping", xd0_horizontalJumpAccel, + skDefaultFlags); + CREATE_CVAR(VerticalDoubleJumpAcceleration, "Vertical acceleration while double jumping", xd4_verticalDoubleJumpAccel, + skDefaultFlags); + CREATE_CVAR(HorizontalDoubleJumpAcceleration, "Horizontal acceleration while double jumping", + xd8_horizontalDoubleJumpAccel, skDefaultFlags); + CREATE_CVAR(WaterJumpFactor, "Jump Factor while in water", xdc_waterJumpFactor, skDefaultFlags); + CREATE_CVAR(WaterBallJumpFactor, "Jump Factor while morphed in water", xe0_waterBallJumpFactor, skDefaultFlags); + CREATE_CVAR(LavaJumpFactor, "Jump Factor while in lava", xe4_lavaJumpFactor, skDefaultFlags); + CREATE_CVAR(LavaBallJumpFactor, "Jump Factor while morphed in lava", xe8_lavaBallJumpFactor, skDefaultFlags); + CREATE_CVAR(PhazonJumpFactor, "Jump Factor while in phazon", xec_phazonJumpFactor, skDefaultFlags); + CREATE_CVAR(PhazonBallJumpFactor, "Jump Factor while morphed in phazon", xf0_phazonBallJumpFactor, skDefaultFlags); + CREATE_CVAR(AllowedJumpTime, "", xf4_allowedJumpTime, skDefaultFlags); + CREATE_CVAR(AllowedDoubleJumpTime, "", xf8_allowedDoubleJumpTime, skDefaultFlags); + CREATE_CVAR(MinDoubleJumpWindow, "", xfc_minDoubleJumpWindow, skDefaultFlags); + CREATE_CVAR(MaxDoubleJumpWindow, "", x100_maxDoubleJumpWindow, skDefaultFlags); + // CREATE_CVAR(); // x104_ + CREATE_CVAR(MinJumpTime, "", x108_minJumpTime, skDefaultFlags); + CREATE_CVAR(MinDoubleJumpTime, "", x10c_minDoubleJumpTime, skDefaultFlags); + CREATE_CVAR(AllowedLedgeTime, "", x110_allowedLedgeTime, skDefaultFlags); + CREATE_CVAR(DoubleJumpImpulse, "", x114_doubleJumpImpulse, skDefaultFlags); + CREATE_CVAR(BackwardsForceMultiplier, "", x118_backwardsForceMultiplier, skDefaultFlags); + CREATE_CVAR(BombJumpRadius, "", x11c_bombJumpRadius, skDefaultFlags); + CREATE_CVAR(BombJumpHeight, "", x120_bombJumpHeight, skDefaultFlags); + CREATE_CVAR(EyeOffset, "", x124_eyeOffset, skDefaultFlags); + CREATE_CVAR(TurnSpeedMultiplier, "", x128_turnSpeedMultiplier, skDefaultFlags); + CREATE_CVAR(FreeLookTurnSpeedMultiplier, "", x12c_freeLookTurnSpeedMultiplier, skDefaultFlags); + CREATE_CVAR(HorizontalFreeLookAngleVelocity, "", x130_horizontalFreeLookAngleVel, skDefaultFlags); + CREATE_CVAR(VerticalFreeLookAngleVelocity, "", x134_verticalFreeLookAngleVel, skDefaultFlags); + CREATE_CVAR(FreeLookSpeed, "", x138_freeLookSpeed, skDefaultFlags); + CREATE_CVAR(FreeLookSnapSpeed, "", x13c_freeLookSnapSpeed, skDefaultFlags); + // CREATE_CVAR(); // x140_ + CREATE_CVAR(FreeLookCenteredThresholdAngle, "", x144_freeLookCenteredThresholdAngle, skDefaultFlags); + CREATE_CVAR(FreeLookCenteredTime, "", x148_freeLookCenteredTime, skDefaultFlags); + CREATE_CVAR(FreeLookDampenFactor, "", x14c_freeLookDampenFactor, skDefaultFlags); + CREATE_CVAR(LeftDivisor, "", x150_leftDiv, skDefaultFlags); + CREATE_CVAR(RightDivisor, "", x154_rightDiv, skDefaultFlags); + CREATE_CVAR(OrbitMinDistanceClose, "", x158_orbitMinDistance[0], skDefaultFlags); + CREATE_CVAR(OrbitMinDistanceFar, "", x158_orbitMinDistance[1], skDefaultFlags); + CREATE_CVAR(OrbitMinDistanceDefault, "", x158_orbitMinDistance[2], skDefaultFlags); + CREATE_CVAR(OrbitNormalDistanceClose, "", x164_orbitNormalDistance[0], skDefaultFlags); + CREATE_CVAR(OrbitNormalDistanceFar, "", x164_orbitNormalDistance[1], skDefaultFlags); + CREATE_CVAR(OrbitNormalDistanceDefault, "", x164_orbitNormalDistance[2], skDefaultFlags); + CREATE_CVAR(OrbitMaxDistanceClose, "", x170_orbitMaxDistance[0], skDefaultFlags); + CREATE_CVAR(OrbitMaxDistanceFar, "", x170_orbitMaxDistance[1], skDefaultFlags); + CREATE_CVAR(OrbitMaxDistanceDefault, "", x170_orbitMaxDistance[2], skDefaultFlags); + // CREATE_CVAR(); // x17c_ + CREATE_CVAR(OrbitmodeTimer, "", x180_orbitModeTimer, skDefaultFlags); + CREATE_CVAR(OrbitCameraSpeed, "", x184_orbitCameraSpeed, skDefaultFlags); + CREATE_CVAR(OrbitUpperAngle, "", x184_orbitCameraSpeed, skDefaultFlags); + CREATE_CVAR(OrbitLowerAngle, "", x184_orbitCameraSpeed, skDefaultFlags); + CREATE_CVAR(OrbitHorizontalAngle, "", x184_orbitCameraSpeed, skDefaultFlags); + // CREATE_CVAR(); // x194_ + // CREATE_CVAR(); // x198_ + CREATE_CVAR(OrbitMaxTargetDistance, "", x19c_orbitMaxTargetDistance, skDefaultFlags); + CREATE_CVAR(OrbitMaxLockDistance, "", x1a0_orbitMaxLockDistance, skDefaultFlags); + CREATE_CVAR(OrbitDistanceThreshold, "", x1a4_orbitDistanceThreshold, skDefaultFlags); + CREATE_CVAR(OrbitScreenTargetingBoxHalfExtentX, "", x1a8_orbitScreenBoxHalfExtentX[0], skDefaultFlags); + CREATE_CVAR(OrbitScreenScanBoxHalfExtentX, "", x1a8_orbitScreenBoxHalfExtentX[1], skDefaultFlags); + CREATE_CVAR(OrbitScreenTargetingBoxHalfExtentY, "", x1b0_orbitScreenBoxHalfExtentY[0], skDefaultFlags); + CREATE_CVAR(OrbitScreenScanBoxHalfExtentY, "", x1b0_orbitScreenBoxHalfExtentY[1], skDefaultFlags); + CREATE_CVAR(OrbitScreenTargetingBoxCenterX, "", x1b8_orbitScreenBoxCenterX[0], skDefaultFlags); + CREATE_CVAR(OrbitScreenScanBoxCenterX, "", x1b8_orbitScreenBoxCenterX[1], skDefaultFlags); + CREATE_CVAR(OrbitScreenTargetingBoxCenterY, "", x1c0_orbitScreenBoxCenterY[0], skDefaultFlags); + CREATE_CVAR(OrbitScreenScanBoxCenterY, "", x1c0_orbitScreenBoxCenterY[1], skDefaultFlags); + CREATE_CVAR(OrbitZoneTargetingIdealX, "", x1c8_orbitZoneIdealX[0], skDefaultFlags); + CREATE_CVAR(OrbitZoneScanIdealX, "", x1c8_orbitZoneIdealX[1], skDefaultFlags); + CREATE_CVAR(OrbitZoneTargetingIdealY, "", x1d0_orbitZoneIdealY[0], skDefaultFlags); + CREATE_CVAR(OrbitZoneScanIdealY, "", x1d0_orbitZoneIdealY[1], skDefaultFlags); + CREATE_CVAR(OrbitNearX, "", x1d8_orbitNearX, skDefaultFlags); + CREATE_CVAR(OrbitNearZ, "", x1dc_orbitNearZ, skDefaultFlags); + // CREATE_CVAR(); // x1e0_ + // CREATE_CVAR(); // x1e4_ + CREATE_CVAR(OrbitFixedOffsetZDiff, "", x1e8_orbitFixedOffsetZDiff, skDefaultFlags); + CREATE_CVAR(OrbitZRange, "", x1ec_orbitZRange, skDefaultFlags); + // CREATE_CVAR(); // x1f0_ + // CREATE_CVAR(); // x1f4_ + // CREATE_CVAR(); // x1f8_ + CREATE_CVAR(OrbitPreventionTime, "", x1fc_orbitPreventionTime, skDefaultFlags); + CREATE_CVAR_BITFIELD(DashEnabled, "", x200_24_dashEnabled, skDefaultFlags); + CREATE_CVAR_BITFIELD(DashOnButtonRelease, "", x200_25_dashOnButtonRelease, skDefaultFlags); + CREATE_CVAR(DashButtonHoldCancelTime, "", x204_dashButtonHoldCancelTime, skDefaultFlags); + CREATE_CVAR(DashStrafeInputThreshold, "", x208_dashStrafeInputThreshold, skDefaultFlags); + CREATE_CVAR(SidewaysDoubleJumpImpulse, "", x20c_sidewaysDoubleJumpImpulse, skDefaultFlags); + CREATE_CVAR(SidewaysVerticalDoubleJumpAccel, "", x210_sidewaysVerticalDoubleJumpAccel, skDefaultFlags); + CREATE_CVAR(SidewaysHorizontalDoubleJumpAccel, "", x214_sidewaysHorizontalDoubleJumpAccel, skDefaultFlags); + CREATE_CVAR(ScanningRange, "", x218_scanningRange, skDefaultFlags); + CREATE_CVAR_BITFIELD(ScanRetention, "", x21c_24_scanRetention, skDefaultFlags); + CREATE_CVAR_BITFIELD(ScanFreezesGame, "", x21c_25_scanFreezesGame, skDefaultFlags); + CREATE_CVAR_BITFIELD(OrbitWhileScanning, "", x21c_26_orbitWhileScanning, skDefaultFlags); + CREATE_CVAR(ScanMaxTargetDistance, "", x220_scanMaxTargetDistance, skDefaultFlags); + CREATE_CVAR(ScanMaxLockDistance, "", x224_scanMaxLockDistance, skDefaultFlags); + CREATE_CVAR_BITFIELD(FreeLookTurnsPlayer, "", x228_24_freelookTurnsPlayer, skDefaultFlags); + // CREATE_CVAR_BITFIELD(); // x228_25_ + // CREATE_CVAR_BITFIELD(); // x228_26_ + CREATE_CVAR_BITFIELD(MoveDuringFreelook, "", x228_27_moveDuringFreeLook, skDefaultFlags); + CREATE_CVAR_BITFIELD(HoldButtonsForFreeLook, "", x228_28_holdButtonsForFreeLook, skDefaultFlags); + // CREATE_CVAR_BITFIELD(); // x228_30_ + // CREATE_CVAR_BITFIELD(); // x228_31_ + // CREATE_CVAR(); // x229_24_ + CREATE_CVAR_BITFIELD(AimWhenOrbitingPoint, "", x229_25_aimWhenOrbitingPoint, skDefaultFlags); + CREATE_CVAR_BITFIELD(StayInFreeLookWhileFiring, "", x229_26_stayInFreeLookWhileFiring, skDefaultFlags); + // CREATE_CVAR_BITFIELD(); // x229_27_ + // CREATE_CVAR_BITFIELD(); // x229_28_ + CREATE_CVAR_BITFIELD(OrbitFixedOffset, "", x229_29_orbitFixedOffset, skDefaultFlags); + CREATE_CVAR_BITFIELD(GunButtonTogglesHolster, "", x229_30_gunButtonTogglesHolster, skDefaultFlags); + CREATE_CVAR_BITFIELD(GunNotFiringHolstersGun, "", x229_31_gunNotFiringHolstersGun, skDefaultFlags); + CREATE_CVAR_BITFIELD(FallingDoubleJump, "", x22a_24_fallingDoubleJump, skDefaultFlags); + CREATE_CVAR_BITFIELD(ImpulseDoubleJump, "", x22a_25_impulseDoubleJump, skDefaultFlags); + CREATE_CVAR_BITFIELD(FiringCancelsCameraPitch, "", x22a_26_firingCancelsCameraPitch, skDefaultFlags); + CREATE_CVAR_BITFIELD(AssistedAimingIgnoreHorizontal, "", x22a_27_assistedAimingIgnoreHorizontal, skDefaultFlags); + CREATE_CVAR_BITFIELD(AssistedAimingIgnoreVertical, "", x22a_28_assistedAimingIgnoreVertical, skDefaultFlags); + // CREATE_CVAR(); // x22c + // CREATE_CVAR(); // x230_ + CREATE_CVAR(AimMaxDistance, "", x234_aimMaxDistance, skDefaultFlags); + // CREATE_CVAR(); // x238_ + // CREATE_CVAR(); // x23c_ + // CREATE_CVAR(); // x240_ + // CREATE_CVAR(); // x244_ + // CREATE_CVAR(); // x248_ + CREATE_CVAR(AimThresholdDistance, "", x24c_aimThresholdDistance, skDefaultFlags); + // CREATE_CVAR(); // x250_ + // CREATE_CVAR(); // x254_ + CREATE_CVAR(AimBoxWidth, "", x258_aimBoxWidth, skDefaultFlags); + CREATE_CVAR(AimBoxHeight, "", x25c_aimBoxHeight, skDefaultFlags); + CREATE_CVAR(AimTargetTimer, "", x260_aimTargetTimer, skDefaultFlags); + CREATE_CVAR(AimAssistHorizontalAngle, "", x264_aimAssistHorizontalAngle, skDefaultFlags); + CREATE_CVAR(AimAssistVerticalAngle, "", x268_aimAssistVerticalAngle, skDefaultFlags); + CREATE_CVAR(PlayerHeight, "", x26c_playerHeight, skDefaultFlags); + CREATE_CVAR(PlayerXYHalfExtent, "", x270_playerXYHalfExtent, skDefaultFlags); + CREATE_CVAR(StepUpHeight, "", x274_stepUpHeight, skDefaultFlags); + CREATE_CVAR(StepDownHeight, "", x278_stepDownHeight, skDefaultFlags); + CREATE_CVAR(PlayerBallHalfExtent, "", x27c_playerBallHalfExtent, skDefaultFlags); + CREATE_CVAR(FirstPersonCameraSpeed, "", x280_firstPersonCameraSpeed, skDefaultFlags); + // CREATE_CVAR(); // x284_ + CREATE_CVAR(JumpCameraPitchDownStart, "", x288_jumpCameraPitchDownStart, skDefaultFlags); + CREATE_CVAR(JumpCameraPitchDownFull, "", x28c_jumpCameraPitchDownFull, skDefaultFlags); + CREATE_CVAR(JumpCameraPitchDownAngle, "", x290_jumpCameraPitchDownAngle, skDefaultFlags); + CREATE_CVAR(FallCameraPitchDownStart, "", x294_fallCameraPitchDownStart, skDefaultFlags); + CREATE_CVAR(FallCameraPitchDownFull, "", x298_fallCameraPitchDownFull, skDefaultFlags); + CREATE_CVAR(FallCameraPitchDownAngle, "", x29c_fallCameraPitchDownAngle, skDefaultFlags); + CREATE_CVAR(OrbitDistanceMax, "", x2a0_orbitDistanceMax, skDefaultFlags); + CREATE_CVAR(GrappleSwingLength, "", x2a4_grappleSwingLength, skDefaultFlags); + CREATE_CVAR(GrappleSwingPeriod, "", x2a8_grappleSwingPeriod, skDefaultFlags); + CREATE_CVAR(GrapplePullSpeedMin, "", x2ac_grapplePullSpeedMin, skDefaultFlags); + CREATE_CVAR(GrappleCameraSpeed, "", x2b0_grappleCameraSpeed, skDefaultFlags); + CREATE_CVAR(MaxGrappleLockedTurnAlignDistance, "", x2b4_maxGrappleLockedTurnAlignDistance, skDefaultFlags); + CREATE_CVAR(GrapplePullSpeedProportion, "", x2b8_grapplePullSpeedProportion, skDefaultFlags); + CREATE_CVAR(GrapplePullSpeedMax, "", x2bc_grapplePullSpeedMax, skDefaultFlags); + CREATE_CVAR(GrappleLookCenterSpeed, "", x2c0_grappleLookCenterSpeed, skDefaultFlags); + CREATE_CVAR(MaxGrappleTurnSpeed, "", x2c4_maxGrappleTurnSpeed, skDefaultFlags); + CREATE_CVAR(GrappleJumpForce, "", x2c8_grappleJumpForce, skDefaultFlags); + CREATE_CVAR(GrappleReleaseTime, "", x2cc_grappleReleaseTime, skDefaultFlags); + CREATE_CVAR(GrappleJumpMode, "", x2d0_grappleJumpMode, skDefaultFlags); + CREATE_CVAR(OrbitReleaseBreaksGrapple, "", x2d4_orbitReleaseBreaksGrapple, skDefaultFlags); + CREATE_CVAR(InvertGrappleTurn, "", x2d5_invertGrappleTurn, skDefaultFlags); + CREATE_CVAR(GrappleBeamSpeed, "", x2d8_grappleBeamSpeed, skDefaultFlags); + CREATE_CVAR(GrappleBeamXWaveAmplitude, "", x2dc_grappleBeamXWaveAmplitude, skDefaultFlags); + CREATE_CVAR(GrappleBeamZWaveAmplitude, "", x2e0_grappleBeamZWaveAmplitude, skDefaultFlags); + CREATE_CVAR(GrappleBeamAnglePhaseDelta, "", x2e4_grappleBeamAnglePhaseDelta, skDefaultFlags); + // CREATE_CVAR(); // x2e8_ + // CREATE_CVAR(); // x2ec_ + // CREATE_CVAR(); // x2f0_ + // CREATE_CVAR(); // x2f4_ + CREATE_CVAR(FrozenTimeout, "", x2f8_frozenTimeout, skDefaultFlags); + CREATE_CVAR(IceBreakJumpCount, "", x2fc_iceBreakJumpCount, skDefaultFlags); + CREATE_CVAR(VariaDamageReduction, "", x300_variaDamageReduction, skDefaultFlags); + CREATE_CVAR(GravityDamageReduction, "", x304_gravityDamageReduction, skDefaultFlags); + CREATE_CVAR(PhazonDamageReduction, "", x308_phazonDamageReduction, skDefaultFlags); +} +} // namespace DataSpec::DNAMP1 diff --git a/Runtime/MP1/Tweaks/CTweakPlayer.hpp b/Runtime/MP1/Tweaks/CTweakPlayer.hpp new file mode 100644 index 000000000..a02189bda --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakPlayer.hpp @@ -0,0 +1,317 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakPlayer.hpp" + +namespace hecl { +class CVar; +} + +namespace metaforce::MP1 { + +struct CTweakPlayer final : Tweaks::ITweakPlayer { + float x4_maxTranslationalAcceleration[8]{}; + float x24_maxRotationalAcceleration[8]{}; + float x44_translationFriction[8]{}; + float x64_rotationFriction[8]{}; + float x84_rotationMaxSpeed[8]{}; + float xa4_translationMaxSpeed[8]{}; + float xc4_normalGravAccel{}; + float xc8_fluidGravAccel{}; + float xcc_verticalJumpAccel{}; + float xd0_horizontalJumpAccel{}; + float xd4_verticalDoubleJumpAccel{}; + float xd8_horizontalDoubleJumpAccel{}; + float xdc_waterJumpFactor{}; + float xe0_waterBallJumpFactor{}; + float xe4_lavaJumpFactor{}; + float xe8_lavaBallJumpFactor{}; + float xec_phazonJumpFactor{}; + float xf0_phazonBallJumpFactor{}; + float xf4_allowedJumpTime{}; + float xf8_allowedDoubleJumpTime{}; + float xfc_minDoubleJumpWindow{}; + float x100_maxDoubleJumpWindow{}; + float x104_{}; + float x108_minJumpTime{}; + float x10c_minDoubleJumpTime{}; + float x110_allowedLedgeTime{}; + float x114_doubleJumpImpulse{}; + float x118_backwardsForceMultiplier{}; + float x11c_bombJumpRadius{}; + float x120_bombJumpHeight{}; + float x124_eyeOffset{}; + float x128_turnSpeedMultiplier{}; + float x12c_freeLookTurnSpeedMultiplier{}; + float x130_horizontalFreeLookAngleVel{}; + float x134_verticalFreeLookAngleVel{}; + float x138_freeLookSpeed{}; + float x13c_freeLookSnapSpeed{}; + float x140_{}; + float x144_freeLookCenteredThresholdAngle{}; + float x148_freeLookCenteredTime{}; + float x14c_freeLookDampenFactor{}; + float x150_leftDiv{}; + float x154_rightDiv{}; + float x158_orbitMinDistance[3]{}; + float x164_orbitNormalDistance[3]{}; + float x170_orbitMaxDistance[3]{}; + float x17c_{}; + float x180_orbitModeTimer{}; + float x184_orbitCameraSpeed{}; + float x188_orbitUpperAngle{}; + float x18c_orbitLowerAngle{}; + float x190_orbitHorizAngle{}; + float x194_{}; + float x198_{}; + float x19c_orbitMaxTargetDistance{}; + float x1a0_orbitMaxLockDistance{}; + float x1a4_orbitDistanceThreshold{}; + u32 x1a8_orbitScreenBoxHalfExtentX[2]{}; + u32 x1b0_orbitScreenBoxHalfExtentY[2]{}; + u32 x1b8_orbitScreenBoxCenterX[2]{}; + u32 x1c0_orbitScreenBoxCenterY[2]{}; + u32 x1c8_orbitZoneIdealX[2]{}; + u32 x1d0_orbitZoneIdealY[2]{}; + float x1d8_orbitNearX{}; + float x1dc_orbitNearZ{}; + float x1e0_{}; + float x1e4_{}; + float x1e8_orbitFixedOffsetZDiff{}; + float x1ec_orbitZRange{}; + float x1f0_{}; + float x1f4_{}; + float x1f8_{}; + float x1fc_orbitPreventionTime{}; + bool x200_24_dashEnabled : 1{}; + bool x200_25_dashOnButtonRelease : 1{}; + float x204_dashButtonHoldCancelTime{}; + float x208_dashStrafeInputThreshold{}; + float x20c_sidewaysDoubleJumpImpulse{}; + float x210_sidewaysVerticalDoubleJumpAccel{}; + float x214_sidewaysHorizontalDoubleJumpAccel{}; + float x218_scanningRange{}; + bool x21c_24_scanRetention : 1{}; + bool x21c_25_scanFreezesGame : 1{}; + bool x21c_26_orbitWhileScanning : 1{}; + float x220_scanMaxTargetDistance{}; + float x224_scanMaxLockDistance{}; + bool x228_24_freelookTurnsPlayer : 1{}; + bool x228_25_ : 1{}; + bool x228_26_ : 1{}; + bool x228_27_moveDuringFreeLook : 1{}; + bool x228_28_holdButtonsForFreeLook : 1{}; + bool x228_29_twoButtonsForFreeLook : 1{}; + bool x228_30_ : 1{}; + bool x228_31_ : 1{}; + bool x229_24_ : 1{}; + bool x229_25_aimWhenOrbitingPoint : 1{}; + bool x229_26_stayInFreeLookWhileFiring : 1{}; + bool x229_27_ : 1{}; + bool x229_28_ : 1{}; + bool x229_29_orbitFixedOffset : 1{}; + bool x229_30_gunButtonTogglesHolster : 1{}; + bool x229_31_gunNotFiringHolstersGun : 1{}; + bool x22a_24_fallingDoubleJump : 1{}; + bool x22a_25_impulseDoubleJump : 1{}; + bool x22a_26_firingCancelsCameraPitch : 1{}; + bool x22a_27_assistedAimingIgnoreHorizontal : 1{}; + bool x22a_28_assistedAimingIgnoreVertical : 1{}; + float x22c_{}; + float x230_{}; + float x234_aimMaxDistance{}; + float x238_{}; + float x23c_{}; + float x240_{}; + float x244_{}; + float x248_{}; + float x24c_aimThresholdDistance{}; + float x250_{}; + float x254_{}; + float x258_aimBoxWidth{}; + float x25c_aimBoxHeight{}; + float x260_aimTargetTimer{}; + float x264_aimAssistHorizontalAngle{}; + float x268_aimAssistVerticalAngle{}; + float x26c_playerHeight{}; + float x270_playerXYHalfExtent{}; + float x274_stepUpHeight{}; + float x278_stepDownHeight{}; + float x27c_playerBallHalfExtent{}; + float x280_firstPersonCameraSpeed{}; + float x284_{}; + float x288_jumpCameraPitchDownStart{}; + float x28c_jumpCameraPitchDownFull{}; + float x290_jumpCameraPitchDownAngle{}; + float x294_fallCameraPitchDownStart{}; + float x298_fallCameraPitchDownFull{}; + float x29c_fallCameraPitchDownAngle{}; + float x2a0_orbitDistanceMax{}; + float x2a4_grappleSwingLength{}; + float x2a8_grappleSwingPeriod{}; + float x2ac_grapplePullSpeedMin{}; + float x2b0_grappleCameraSpeed{}; + float x2b4_maxGrappleLockedTurnAlignDistance{}; + float x2b8_grapplePullSpeedProportion{}; + float x2bc_grapplePullSpeedMax{}; + float x2c0_grappleLookCenterSpeed{}; + float x2c4_maxGrappleTurnSpeed{}; + float x2c8_grappleJumpForce{}; + float x2cc_grappleReleaseTime{}; + u32 x2d0_grappleJumpMode{}; + bool x2d4_orbitReleaseBreaksGrapple{}; + bool x2d5_invertGrappleTurn{}; + float x2d8_grappleBeamSpeed{}; + float x2dc_grappleBeamXWaveAmplitude{}; + float x2e0_grappleBeamZWaveAmplitude{}; + float x2e4_grappleBeamAnglePhaseDelta{}; + float x2e8_{}; + float x2ec_{}; + float x2f0_{}; + bool x2f4_{}; + float x2f8_frozenTimeout{}; + u32 x2fc_iceBreakJumpCount{}; + float x300_variaDamageReduction{}; + float x304_gravityDamageReduction{}; + float x308_phazonDamageReduction{}; + float GetMaxTranslationalAcceleration(int s) const override { return x4_maxTranslationalAcceleration[s]; } + float GetMaxRotationalAcceleration(int s) const override { return x24_maxRotationalAcceleration[s]; } + float GetPlayerTranslationFriction(int s) const override { return x44_translationFriction[s]; } + float GetPlayerRotationFriction(int s) const override { return x64_rotationFriction[s]; } + float GetPlayerRotationMaxSpeed(int s) const override { return x84_rotationMaxSpeed[s]; } + float GetPlayerTranslationMaxSpeed(int s) const override { return xa4_translationMaxSpeed[s]; } + float GetNormalGravAccel() const override { return xc4_normalGravAccel; } + float GetFluidGravAccel() const override { return xc8_fluidGravAccel; } + float GetVerticalJumpAccel() const override { return xcc_verticalJumpAccel; } + float GetHorizontalJumpAccel() const override { return xd0_horizontalJumpAccel; } + float GetVerticalDoubleJumpAccel() const override { return xd4_verticalDoubleJumpAccel; } + float GetHorizontalDoubleJumpAccel() const override { return xd8_horizontalDoubleJumpAccel; } + float GetWaterJumpFactor() const override { return xdc_waterJumpFactor; } + float GetWaterBallJumpFactor() const override { return xe0_waterBallJumpFactor; } + float GetLavaJumpFactor() const override { return xe4_lavaJumpFactor; } + float GetLavaBallJumpFactor() const override { return xe8_lavaBallJumpFactor; } + float GetPhazonJumpFactor() const override { return xec_phazonJumpFactor; } + float GetPhazonBallJumpFactor() const override { return xf0_phazonBallJumpFactor; } + float GetAllowedJumpTime() const override { return xf4_allowedJumpTime; } + float GetAllowedDoubleJumpTime() const override { return xf8_allowedDoubleJumpTime; } + float GetMinDoubleJumpWindow() const override { return xfc_minDoubleJumpWindow; } + float GetMaxDoubleJumpWindow() const override { return x100_maxDoubleJumpWindow; } + float GetMinJumpTime() const override { return x108_minJumpTime; } + float GetMinDoubleJumpTime() const override { return x10c_minDoubleJumpTime; } + float GetAllowedLedgeTime() const override { return x110_allowedLedgeTime; } + float GetDoubleJumpImpulse() const override { return x114_doubleJumpImpulse; } + float GetBackwardsForceMultiplier() const override { return x118_backwardsForceMultiplier; } + float GetBombJumpRadius() const override { return x11c_bombJumpRadius; } + float GetBombJumpHeight() const override { return x120_bombJumpHeight; } + float GetEyeOffset() const override { return x124_eyeOffset; } + float GetTurnSpeedMultiplier() const override { return x128_turnSpeedMultiplier; } + float GetFreeLookTurnSpeedMultiplier() const override { return x12c_freeLookTurnSpeedMultiplier; } + float GetFreeLookSpeed() const override { return x138_freeLookSpeed; } + float GetFreeLookSnapSpeed() const override { return x13c_freeLookSnapSpeed; } + float GetFreeLookCenteredThresholdAngle() const override { return x144_freeLookCenteredThresholdAngle; } + float GetFreeLookCenteredTime() const override { return x148_freeLookCenteredTime; } + float GetOrbitModeTimer() const override { return x180_orbitModeTimer; } + float GetOrbitUpperAngle() const override { return x188_orbitUpperAngle; } + float GetOrbitLowerAngle() const override { return x18c_orbitLowerAngle; } + float GetOrbitHorizAngle() const override { return x190_orbitHorizAngle; } + float GetOrbitMaxTargetDistance() const override { return x19c_orbitMaxTargetDistance; } + float GetOrbitMaxLockDistance() const override { return x1a0_orbitMaxLockDistance; } + float GetOrbitDistanceThreshold() const override { return x1a4_orbitDistanceThreshold; } + uint32_t GetOrbitScreenBoxHalfExtentX(int zone) const override { return x1a8_orbitScreenBoxHalfExtentX[zone]; } + uint32_t GetOrbitScreenBoxHalfExtentY(int zone) const override { return x1b0_orbitScreenBoxHalfExtentY[zone]; } + uint32_t GetOrbitScreenBoxCenterX(int zone) const override { return x1b8_orbitScreenBoxCenterX[zone]; } + uint32_t GetOrbitScreenBoxCenterY(int zone) const override { return x1c0_orbitScreenBoxCenterY[zone]; } + uint32_t GetOrbitZoneIdealX(int zone) const override { return x1c8_orbitZoneIdealX[zone]; } + uint32_t GetOrbitZoneIdealY(int zone) const override { return x1d0_orbitZoneIdealY[zone]; } + float GetOrbitNearX() const override { return x1d8_orbitNearX; } + float GetOrbitNearZ() const override { return x1dc_orbitNearZ; } + float GetOrbitFixedOffsetZDiff() const override { return x1e8_orbitFixedOffsetZDiff; } + float GetOrbitZRange() const override { return x1ec_orbitZRange; } + bool GetDashEnabled() const override { return x200_24_dashEnabled; } + bool GetDashOnButtonRelease() const override { return x200_25_dashOnButtonRelease; } + float GetDashButtonHoldCancelTime() const override { return x204_dashButtonHoldCancelTime; } + float GetDashStrafeInputThreshold() const override { return x208_dashStrafeInputThreshold; } + float GetSidewaysDoubleJumpImpulse() const override { return x20c_sidewaysDoubleJumpImpulse; } + float GetSidewaysVerticalDoubleJumpAccel() const override { return x210_sidewaysVerticalDoubleJumpAccel; } + float GetSidewaysHorizontalDoubleJumpAccel() const override { return x214_sidewaysHorizontalDoubleJumpAccel; } + float GetScanningRange() const override { return x218_scanningRange; } + bool GetScanRetention() const override { return x21c_24_scanRetention; } + bool GetScanFreezesGame() const override { return x21c_25_scanFreezesGame; } + bool GetOrbitWhileScanning() const override { return x21c_26_orbitWhileScanning; } + float GetScanMaxTargetDistance() const override { return x220_scanMaxTargetDistance; } + float GetScanMaxLockDistance() const override { return x224_scanMaxLockDistance; } + bool GetMoveDuringFreeLook() const override { return x228_27_moveDuringFreeLook; } + bool GetHoldButtonsForFreeLook() const override { return x228_28_holdButtonsForFreeLook; } + bool GetTwoButtonsForFreeLook() const override { return x228_29_twoButtonsForFreeLook; } + bool GetAimWhenOrbitingPoint() const override { return x229_25_aimWhenOrbitingPoint; } + bool GetStayInFreeLookWhileFiring() const override { return x229_26_stayInFreeLookWhileFiring; } + bool GetOrbitFixedOffset() const override { return x229_29_orbitFixedOffset; } + bool GetGunButtonTogglesHolster() const override { return x229_30_gunButtonTogglesHolster; } + bool GetGunNotFiringHolstersGun() const override { return x229_31_gunNotFiringHolstersGun; } + bool GetFallingDoubleJump() const override { return x22a_24_fallingDoubleJump; } + bool GetImpulseDoubleJump() const override { return x22a_25_impulseDoubleJump; } + bool GetFiringCancelsCameraPitch() const override { return x22a_26_firingCancelsCameraPitch; } + bool GetAssistedAimingIgnoreHorizontal() const override { return x22a_27_assistedAimingIgnoreHorizontal; } + bool GetAssistedAimingIgnoreVertical() const override { return x22a_28_assistedAimingIgnoreVertical; } + float GetAimMaxDistance() const override { return x234_aimMaxDistance; } + float GetAimThresholdDistance() const override { return x24c_aimThresholdDistance; } + float GetAimBoxWidth() const override { return x258_aimBoxWidth; } + float GetAimBoxHeight() const override { return x25c_aimBoxHeight; } + float GetAimTargetTimer() const override { return x260_aimTargetTimer; } + float GetAimAssistHorizontalAngle() const override { return x264_aimAssistHorizontalAngle; } + float GetAimAssistVerticalAngle() const override { return x268_aimAssistVerticalAngle; } + float GetPlayerHeight() const override { return x26c_playerHeight; } + float GetPlayerXYHalfExtent() const override { return x270_playerXYHalfExtent; } + float GetStepUpHeight() const override { return x274_stepUpHeight; } + float GetStepDownHeight() const override { return x278_stepDownHeight; } + float GetPlayerBallHalfExtent() const override { return x27c_playerBallHalfExtent; } + float GetOrbitDistanceMax() const override { return x2a0_orbitDistanceMax; } + float GetGrappleSwingLength() const override { return x2a4_grappleSwingLength; } + float GetGrappleSwingPeriod() const override { return x2a8_grappleSwingPeriod; } + float GetGrapplePullSpeedMin() const override { return x2ac_grapplePullSpeedMin; } + float GetMaxGrappleLockedTurnAlignDistance() const override { return x2b4_maxGrappleLockedTurnAlignDistance; } + float GetGrapplePullSpeedProportion() const override { return x2b8_grapplePullSpeedProportion; } + float GetGrapplePullSpeedMax() const override { return x2bc_grapplePullSpeedMax; } + float GetGrappleLookCenterSpeed() const override { return x2c0_grappleLookCenterSpeed; } + float GetMaxGrappleTurnSpeed() const override { return x2c4_maxGrappleTurnSpeed; } + float GetGrappleJumpForce() const override { return x2c8_grappleJumpForce; } + float GetGrappleReleaseTime() const override { return x2cc_grappleReleaseTime; } + uint32_t GetGrappleJumpMode() const override { return x2d0_grappleJumpMode; } + bool GetOrbitReleaseBreaksGrapple() const override { return x2d4_orbitReleaseBreaksGrapple; } + bool GetInvertGrappleTurn() const override { return x2d5_invertGrappleTurn; } + float GetGrappleBeamSpeed() const override { return x2d8_grappleBeamSpeed; } + float GetGrappleBeamXWaveAmplitude() const override { return x2dc_grappleBeamXWaveAmplitude; } + float GetGrappleBeamZWaveAmplitude() const override { return x2e0_grappleBeamZWaveAmplitude; } + float GetGrappleBeamAnglePhaseDelta() const override { return x2e4_grappleBeamAnglePhaseDelta; } + float GetHorizontalFreeLookAngleVel() const override { return x130_horizontalFreeLookAngleVel; } + float GetVerticalFreeLookAngleVel() const override { return x134_verticalFreeLookAngleVel; } + float GetOrbitCameraSpeed() const override { return x184_orbitCameraSpeed; } + float GetOrbitPreventionTime() const override { return x1fc_orbitPreventionTime; } + bool GetFreeLookTurnsPlayer() const override { return x228_24_freelookTurnsPlayer; } + float GetJumpCameraPitchDownStart() const override { return x288_jumpCameraPitchDownStart; } + float GetJumpCameraPitchDownFull() const override { return x28c_jumpCameraPitchDownFull; } + float GetJumpCameraPitchDownAngle() const override { return x290_jumpCameraPitchDownAngle; } + float GetFallCameraPitchDownStart() const override { return x294_fallCameraPitchDownStart; } + float GetFallCameraPitchDownFull() const override { return x298_fallCameraPitchDownFull; } + float GetFallCameraPitchDownAngle() const override { return x29c_fallCameraPitchDownAngle; } + float GetFirstPersonCameraSpeed() const override { return x280_firstPersonCameraSpeed; } + float GetGrappleCameraSpeed() const override { return x2b0_grappleCameraSpeed; } + float GetFreeLookDampenFactor() const override { return x14c_freeLookDampenFactor; } + float GetLeftLogicalThreshold() const override { return x150_leftDiv; } + float GetRightLogicalThreshold() const override { return x154_rightDiv; } + float GetOrbitMinDistance(int type) const override { return x158_orbitMinDistance[type]; } + float GetOrbitNormalDistance(int type) const override { return x164_orbitNormalDistance[type]; } + float GetOrbitMaxDistance(int type) const override { return x170_orbitMaxDistance[type]; } + float GetFrozenTimeout() const override { return x2f8_frozenTimeout; } + uint32_t GetIceBreakJumpCount() const override { return x2fc_iceBreakJumpCount; } + float GetVariaDamageReduction() const override { return x300_variaDamageReduction; } + float GetGravityDamageReduction() const override { return x304_gravityDamageReduction; } + float GetPhazonDamageReduction() const override { return x308_phazonDamageReduction; } + CTweakPlayer() = default; + CTweakPlayer(CInputStream& in); + void PutTo(COutputStream& out); + void FixupValues(); + void initCVars(hecl::CVarManager* mgr) override; + void _tweakListener(hecl::CVar* cv); +}; + +} // namespace DataSpec::DNAMP1 diff --git a/Runtime/MP1/Tweaks/CTweakPlayerControl.cpp b/Runtime/MP1/Tweaks/CTweakPlayerControl.cpp new file mode 100644 index 000000000..95d901fbd --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakPlayerControl.cpp @@ -0,0 +1,10 @@ +#include "Runtime/MP1/Tweaks/CTweakPlayerControl.hpp" +#include "Runtime/Streams/IOStreams.hpp" + +namespace metaforce::MP1 { +CTweakPlayerControl::CTweakPlayerControl(CInputStream& in) { + for (u32 i = 0; i < m_mappings.size(); ++i) { + m_mappings[i] = ControlMapper::EFunctionList(in.ReadLong()); + } +} +} \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakPlayerControl.hpp b/Runtime/MP1/Tweaks/CTweakPlayerControl.hpp new file mode 100644 index 000000000..b6160ebf7 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakPlayerControl.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakPlayerControl.hpp" + +namespace metaforce::MP1 { +struct CTweakPlayerControl final : Tweaks::ITweakPlayerControl { + std::array m_mappings; + [[nodiscard]] ControlMapper::EFunctionList GetMapping(atUint32 command) const override { return m_mappings[command]; } + CTweakPlayerControl() = default; + CTweakPlayerControl(CInputStream& reader); +}; + +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/Tweaks/CTweakPlayerGun.cpp b/Runtime/MP1/Tweaks/CTweakPlayerGun.cpp new file mode 100644 index 000000000..97a43ab5a --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakPlayerGun.cpp @@ -0,0 +1,42 @@ +#include "Runtime/MP1/Tweaks/CTweakPlayerGun.hpp" +#include "Runtime/Streams/IOStreams.hpp" + +namespace metaforce::MP1 { +CTweakPlayerGun::CTweakPlayerGun(CInputStream& in) { + x4_upLookAngle = in.ReadFloat(); + x8_downLookAngle = in.ReadFloat(); + xc_verticalSpread = in.ReadFloat(); + x10_horizontalSpread = in.ReadFloat(); + x14_highVerticalSpread = in.ReadFloat(); + x18_highHorizontalSpread = in.ReadFloat(); + x1c_lowVerticalSpread = in.ReadFloat(); + x20_lowHorizontalSpread = in.ReadFloat(); + x24_aimVerticalSpeed = in.ReadFloat(); + x28_aimHorizontalSpeed = in.ReadFloat(); + x2c_bombFuseTime = in.ReadFloat(); + x30_bombDropDelayTime = in.ReadFloat(); + x34_holoHoldTime = in.ReadFloat(); + x38_gunTransformTime = in.ReadFloat(); + x3c_gunHolsterTime = in.ReadFloat(); + x40_gunNotFiringTime = in.ReadFloat(); + x44_fixedVerticalAim = in.ReadFloat(); + x48_gunExtendDistance = in.ReadFloat(); + x4c_gunPosition = in.Get(); + x58_ = in.Get(); + x64_grapplingArmPosition = in.Get(); + x70_bomb = in.Get(); + x8c_powerBomb = in.Get(); + x1d4_missile = in.Get(); + for (auto& beam : xa8_beams) { + beam = in.Get(); + } + for (auto& combo : x1f0_combos) { + combo = in.Get(); + } + + for (float& r : x280_ricochetData) { + r = in.ReadFloat(); + } + x44_fixedVerticalAim = zeus::degToRad(x44_fixedVerticalAim); +} +} // namespace metaforce::MP1 \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakPlayerGun.hpp b/Runtime/MP1/Tweaks/CTweakPlayerGun.hpp new file mode 100644 index 000000000..97e809efc --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakPlayerGun.hpp @@ -0,0 +1,103 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakPlayerGun.hpp" + +namespace metaforce::MP1 { +struct CTweakPlayerGun final : Tweaks::ITweakPlayerGun { + float x4_upLookAngle; + float x8_downLookAngle; + float xc_verticalSpread; + float x10_horizontalSpread; + float x14_highVerticalSpread; + float x18_highHorizontalSpread; + float x1c_lowVerticalSpread; + float x20_lowHorizontalSpread; + float x24_aimVerticalSpeed; + float x28_aimHorizontalSpeed; + float x2c_bombFuseTime; + float x30_bombDropDelayTime; + float x34_holoHoldTime; + float x38_gunTransformTime; + float x3c_gunHolsterTime; + float x40_gunNotFiringTime; + float x44_fixedVerticalAim; + float x48_gunExtendDistance; + zeus::CVector3f x4c_gunPosition; + zeus::CVector3f x58_; + zeus::CVector3f x64_grapplingArmPosition; + SShotParam x70_bomb; + SShotParam x8c_powerBomb; + SShotParam x1d4_missile; + SWeaponInfo xa8_beams[5]; + SComboShotParam x1f0_combos[5]; // Originally rstl::reserved_vector + float x280_ricochetData[6]; // Originally rstl::reserved_vector, extended to 6 to capture + // PhazonBeam's value + CTweakPlayerGun() = default; + CTweakPlayerGun(CInputStream& in); + float GetUpLookAngle() const override { return x4_upLookAngle; } + float GetDownLookAngle() const override { return x8_downLookAngle; } + float GetVerticalSpread() const override { return xc_verticalSpread; } + float GetHorizontalSpread() const override { return x10_horizontalSpread; } + float GetHighVerticalSpread() const override { return x14_highVerticalSpread; } + float GetHighHorizontalSpread() const override { return x18_highHorizontalSpread; } + float GetLowVerticalSpread() const override { return x1c_lowVerticalSpread; } + float GetLowHorizontalSpread() const override { return x20_lowHorizontalSpread; } + float GetAimVerticalSpeed() const override { return x24_aimVerticalSpeed; } + float GetAimHorizontalSpeed() const override { return x28_aimHorizontalSpeed; } + float GetBombFuseTime() const override { return x2c_bombFuseTime; } + float GetBombDropDelayTime() const override { return x30_bombDropDelayTime; } + float GetHoloHoldTime() const override { return x34_holoHoldTime; } + float GetGunTransformTime() const override { return x38_gunTransformTime; } + float GetGunHolsterTime() const override { return x3c_gunHolsterTime; } + float GetGunNotFiringTime() const override { return x40_gunNotFiringTime; } + float GetFixedVerticalAim() const override { return x44_fixedVerticalAim; } + float GetGunExtendDistance() const override { return x48_gunExtendDistance; } + const zeus::CVector3f& GetGunPosition() const override { return x4c_gunPosition; } + const zeus::CVector3f& GetGrapplingArmPosition() const override { return x64_grapplingArmPosition; } + float GetRichochetDamage(atUint32 type) const override { + switch (type) { + case 0: // Power + return x280_ricochetData[0]; + case 1: // Ice + return x280_ricochetData[1]; + case 2: // Wave + return x280_ricochetData[2]; + case 3: // Plasma + return x280_ricochetData[3]; + case 6: // Missile + return x280_ricochetData[4]; + case 8: // Phazon + /* Note: In order to return the same value as retail we have to do a bit of a hack + * Retro accidentally forgot to load in PhazonBeam's richochet value, as a result, it loads the + * pointer to CTweakParticle's vtable. + */ +#if MP_v1088 + + return float(0x803D9CC4); +#else + return x280_ricochetData[5]; +#endif + default: + return 1.f; + } + } + + const SWeaponInfo& GetBeamInfo(atInt32 beam) const override { + if (beam < 0 || beam >= 5) { + return xa8_beams[0]; + } + return xa8_beams[beam]; + } + + const SComboShotParam& GetComboShotInfo(atInt32 beam) const override { + if (beam < 0 || beam >= 5) { + return x1f0_combos[0]; + } + return x1f0_combos[beam]; + } + + const SShotParam& GetBombInfo() const override { return x70_bomb; } + const SShotParam& GetPowerBombInfo() const override { return x8c_powerBomb; } + const SShotParam& GetMissileInfo() const { return x1d4_missile; } +}; +} // namespace DataSpec::DNAMP1 diff --git a/Runtime/MP1/Tweaks/CTweakPlayerRes.cpp b/Runtime/MP1/Tweaks/CTweakPlayerRes.cpp new file mode 100644 index 000000000..a019766ff --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakPlayerRes.cpp @@ -0,0 +1,72 @@ +#include "Runtime/MP1/Tweaks/CTweakPlayerRes.hpp" + +namespace metaforce::MP1 { +CTweakPlayerRes::CTweakPlayerRes(CInputStream& in, bool hasNewFields) { + m_saveStationIcon = in.Get(); + m_missileStationIcon = in.Get(); + m_elevatorIcon = in.Get(); + + m_minesBreakFirstTopIcon = in.Get(); + m_minesBreakFirstBottomIcon = in.Get(); + m_minesBreakSecondTopIcon = in.Get(); + m_minesBreakSecondBottomIcon = in.Get(); + + /* ADDED IN JP/PAL/TRILOGY */ + if (hasNewFields) { + m_mapArrowDown = in.Get(); + m_mapArrowUp = in.Get(); + } + /* END */ + + m_lStickN = in.Get(); + m_lStickU = in.Get(); + m_lStickUL = in.Get(); + m_lStickL = in.Get(); + m_lStickDL = in.Get(); + m_lStickD = in.Get(); + m_lStickDR = in.Get(); + m_lStickR = in.Get(); + m_lStickUR = in.Get(); + + m_cStickN = in.Get(); + m_cStickU = in.Get(); + m_cStickUL = in.Get(); + m_cStickL = in.Get(); + m_cStickDL = in.Get(); + m_cStickD = in.Get(); + m_cStickDR = in.Get(); + m_cStickR = in.Get(); + m_cStickUR = in.Get(); + + m_lTriggerOut = in.Get(); + m_lTriggerIn = in.Get(); + m_rTriggerOut = in.Get(); + m_rTriggerIn = in.Get(); + + m_startButtonOut = in.Get(); + m_startButtonIn = in.Get(); + m_aButtonOut = in.Get(); + m_aButtonIn = in.Get(); + m_bButtonOut = in.Get(); + m_bButtonIn = in.Get(); + m_xButtonOut = in.Get(); + m_xButtonIn = in.Get(); + m_yButtonOut = in.Get(); + m_yButtonIn = in.Get(); + + m_ballTransitionsANCS = in.Get(); + m_ballTransitionsPower = in.Get(); + m_ballTransitionsIce = in.Get(); + m_ballTransitionsWave = in.Get(); + m_ballTransitionsPlasma = in.Get(); + m_ballTransitionsPhazon = in.Get(); + + m_cinePower = in.Get(); + m_cineIce = in.Get(); + m_cineWave = in.Get(); + m_cinePlasma = in.Get(); + m_cinePhazon = in.Get(); + + m_cinematicMoveOutofIntoPlayerDistance = in.ReadFloat(); +} +} // namespace metaforce::MP1 \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakPlayerRes.hpp b/Runtime/MP1/Tweaks/CTweakPlayerRes.hpp new file mode 100644 index 000000000..806389a74 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakPlayerRes.hpp @@ -0,0 +1,104 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakPlayerRes.hpp" + +namespace metaforce::MP1 { + +struct CTweakPlayerRes final : Tweaks::ITweakPlayerRes { + std::string m_saveStationIcon; + std::string m_missileStationIcon; + std::string m_elevatorIcon; + + std::string m_minesBreakFirstTopIcon; + std::string m_minesBreakFirstBottomIcon; + std::string m_minesBreakSecondTopIcon; + std::string m_minesBreakSecondBottomIcon; + + /* ADDED IN PAL/TRILOGY */ + std::string m_mapArrowDown; + std::string m_mapArrowUp; + /* END */ + + std::string m_lStickN; + std::string m_lStickU; + std::string m_lStickUL; + std::string m_lStickL; + std::string m_lStickDL; + std::string m_lStickD; + std::string m_lStickDR; + std::string m_lStickR; + std::string m_lStickUR; + + std::string m_cStickN; + std::string m_cStickU; + std::string m_cStickUL; + std::string m_cStickL; + std::string m_cStickDL; + std::string m_cStickD; + std::string m_cStickDR; + std::string m_cStickR; + std::string m_cStickUR; + + std::string m_lTriggerOut; + std::string m_lTriggerIn; + std::string m_rTriggerOut; + std::string m_rTriggerIn; + + std::string m_startButtonOut; + std::string m_startButtonIn; + std::string m_aButtonOut; + std::string m_aButtonIn; + std::string m_bButtonOut; + std::string m_bButtonIn; + std::string m_xButtonOut; + std::string m_xButtonIn; + std::string m_yButtonOut; + std::string m_yButtonIn; + + std::string m_ballTransitionsANCS; + std::string m_ballTransitionsPower; + std::string m_ballTransitionsIce; + std::string m_ballTransitionsWave; + std::string m_ballTransitionsPlasma; + std::string m_ballTransitionsPhazon; + + std::string m_cinePower; + std::string m_cineIce; + std::string m_cineWave; + std::string m_cinePlasma; + std::string m_cinePhazon; + + float m_cinematicMoveOutofIntoPlayerDistance; + + std::string_view _GetSaveStationIcon() const override { return m_saveStationIcon; } + std::string_view _GetMissileStationIcon() const override { return m_missileStationIcon; } + std::string_view _GetElevatorIcon() const override { return m_elevatorIcon; } + + std::string_view _GetMinesBreakFirstTopIcon() const override { return m_minesBreakFirstTopIcon; } + std::string_view _GetMinesBreakFirstBottomIcon() const override { return m_minesBreakFirstBottomIcon; } + std::string_view _GetMinesBreakSecondTopIcon() const override { return m_minesBreakSecondTopIcon; } + std::string_view _GetMinesBreakSecondBottomIcon() const override { return m_minesBreakSecondBottomIcon; } + + std::string_view _GetLStick(size_t idx) const override { return (&m_lStickN)[idx]; } + std::string_view _GetCStick(size_t idx) const override { return (&m_cStickN)[idx]; } + + std::string_view _GetLTrigger(size_t idx) const override { return (&m_lTriggerOut)[idx]; } + std::string_view _GetRTrigger(size_t idx) const override { return (&m_rTriggerOut)[idx]; } + std::string_view _GetStartButton(size_t idx) const override { return (&m_startButtonOut)[idx]; } + std::string_view _GetAButton(size_t idx) const override { return (&m_aButtonOut)[idx]; } + std::string_view _GetBButton(size_t idx) const override { return (&m_bButtonOut)[idx]; } + std::string_view _GetXButton(size_t idx) const override { return (&m_xButtonOut)[idx]; } + std::string_view _GetYButton(size_t idx) const override { return (&m_yButtonOut)[idx]; } + + std::string_view _GetBallTransitionsANCS() const override { return m_ballTransitionsANCS; } + + std::string_view _GetBallTransitionBeamRes(size_t idx) const override { return (&m_ballTransitionsPower)[idx]; } + std::string_view _GetBeamCineModel(size_t idx) const override { return (&m_cinePower)[idx]; } + + float _GetCinematicMoveOutofIntoPlayerDistance() const override { return m_cinematicMoveOutofIntoPlayerDistance; } + + CTweakPlayerRes() = default; + CTweakPlayerRes(CInputStream& in, bool hasNewFields); +}; + +} // namespace DataSpec::DNAMP1 diff --git a/Runtime/MP1/Tweaks/CTweakSlideShow.cpp b/Runtime/MP1/Tweaks/CTweakSlideShow.cpp new file mode 100644 index 000000000..9f4923d6d --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakSlideShow.cpp @@ -0,0 +1,23 @@ +#include "Runtime/MP1/Tweaks/CTweakSlideShow.hpp" +#include "Runtime/Streams/IOStreams.hpp" + +namespace metaforce::MP1 { +CTweakSlideShow::CTweakSlideShow(CInputStream& in) { + x4_pakName = in.Get(); + x14_fontAssetName = in.Get(); + x24_fontColor = in.Get(); + x28_outlineColor = in.Get(); + x2c_scanPercentInterval = in.ReadFloat(); + x30_ = in.ReadFloat(); + x34_ = in.ReadFloat(); + x38_ = in.ReadFloat(); + x3c_ = in.ReadFloat(); + x40_ = in.Get(); + x44_ = in.ReadFloat(); + x48_ = in.ReadFloat(); + x4c_ = in.ReadFloat(); + x50_ = in.ReadFloat(); + x54_ = in.ReadFloat(); + x58_ = in.ReadFloat(); +} +} // namespace metaforce::MP1 \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakSlideShow.hpp b/Runtime/MP1/Tweaks/CTweakSlideShow.hpp new file mode 100644 index 000000000..6960a7c27 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakSlideShow.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakSlideShow.hpp" +#include "zeus/CColor.hpp" + +namespace metaforce::MP1 { + +struct CTweakSlideShow final : Tweaks::ITweakSlideShow { + std::string x4_pakName; + std::string x14_fontAssetName; + zeus::CColor x24_fontColor; + zeus::CColor x28_outlineColor; + float x2c_scanPercentInterval; + float x30_; + float x34_; + float x38_; + float x3c_; + zeus::CColor x40_; + float x44_; + float x48_; + float x4c_; + float x50_; + float x54_; + float x58_; + + CTweakSlideShow() = default; + CTweakSlideShow(CInputStream& in); + + std::string_view GetFont() const override { return x14_fontAssetName; } + const zeus::CColor& GetFontColor() const override { return x24_fontColor; } + const zeus::CColor& GetOutlineColor() const override { return x28_outlineColor; } + float GetScanPercentInterval() const override { return x2c_scanPercentInterval; } + float GetX54() const override { return x54_; } +}; + +} // namespace DataSpec::DNAMP1 diff --git a/Runtime/MP1/Tweaks/CTweakTargeting.cpp b/Runtime/MP1/Tweaks/CTweakTargeting.cpp new file mode 100644 index 000000000..43c56a90f --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakTargeting.cpp @@ -0,0 +1,150 @@ +#include "Runtime/MP1/Tweaks/CTweakTargeting.hpp" +#include "Runtime/Streams/IOStreams.hpp" + +namespace metaforce::MP1 { +CTweakTargeting::CTweakTargeting(CInputStream& in, bool hasNewFields) { + x4_targetRadiusMode = in.ReadLong(); + x8_currLockOnExitDuration = in.ReadFloat(); + xc_currLockOnEnterDuration = in.ReadFloat(); + x10_currLockOnSwitchDuration = in.ReadFloat(); + x14_lockConfirmScale = in.ReadFloat(); + x18_nextLockOnEnterDuration = in.ReadFloat(); + x1c_nextLockOnExitDuration = in.ReadFloat(); + x20_nextLockOnSwitchDuration = in.ReadFloat(); + x24_seekerScale = in.ReadFloat(); + x28_seekerAngleSpeed = in.ReadFloat(); + x2c_xrayRetAngleSpeed = in.ReadFloat(); + x30_ = in.Get(); + x3c_ = in.Get(); + x48_ = in.ReadFloat(); + x4c_ = in.ReadFloat(); + x50_orbitPointZOffset = in.ReadFloat(); + x54_orbitPointInTime = in.ReadFloat(); + x58_orbitPointOutTime = in.ReadFloat(); + x5c_ = in.ReadFloat(); + x60_ = in.Get(); + x6c_ = in.Get(); + x78_ = in.Get(); + x84_ = in.Get(); + x90_ = in.ReadFloat(); + x94_ = in.ReadFloat(); + x98_ = in.ReadFloat(); + x9c_ = in.ReadFloat(); + xa0_ = in.ReadFloat(); + xa4_ = in.ReadFloat(); + xa8_ = in.ReadFloat(); + xac_ = in.ReadFloat(); + xb0_thermalReticuleColor = in.Get(); + xb4_targetFlowerScale = in.ReadFloat(); + xb8_targetFlowerColor = in.Get(); + xbc_missileBracketDuration = in.ReadFloat(); + xc0_missileBracketScaleStart = in.ReadFloat(); + xc4_missileBracketScaleEnd = in.ReadFloat(); + xc8_missileBracketScaleDuration = in.ReadFloat(); + xcc_missileBracketColor = in.Get(); + xd0_LockonDuration = in.ReadFloat(); + xd4_innerBeamScale = in.ReadFloat(); + xd8_innerBeamColorPower = in.Get(); + xdc_innerBeamColorIce = in.Get(); + xe0_innerBeamColorWave = in.Get(); + xe4_innerBeamColorPlasma = in.Get(); + xe8_chargeGaugeOvershootOffset = in.ReadFloat(); + xec_chargeGaugeOvershootDuration = in.ReadFloat(); + xf0_outerBeamSquaresScale = in.ReadFloat(); + xf4_outerBeamSquareColor = in.Get(); + u32 outerBeamCount = in.ReadLong(); + xf8_outerBeamSquareAngles.resize(outerBeamCount); + for (u32 i = 0; i < outerBeamCount; ++i) { + read_reserved_vector(xf8_outerBeamSquareAngles[i], in); + } + read_reserved_vector(x108_chargeGaugeAngles, in); + x118_chargeGaugeScale = in.ReadFloat(); + x11c_chargeGaugeNonFullColor = in.Get(); + x120_chargeTickCount = in.ReadLong(); + x124_chargeTickAnglePitch = in.ReadFloat(); + x128_lockFireScale = in.ReadFloat(); + x12c_lockFireDuration = in.ReadFloat(); + x130_lockFireColor = in.Get(); + x134_lockDaggerScaleStart = in.ReadFloat(); + x138_lockDaggerScaleEnd = in.ReadFloat(); + x13c_lockDaggerColor = in.Get(); + x140_lockDaggerAngle0 = in.ReadFloat(); + x144_lockDaggerAngle1 = in.ReadFloat(); + x148_lockDaggerAngle2 = in.ReadFloat(); + x14c_lockConfirmColor = in.Get(); + x150_seekerColor = in.Get(); + x154_lockConfirmClampMin = in.ReadFloat(); + x158_lockConfirmClampMax = in.ReadFloat(); + x15c_targetFlowerClampMin = in.ReadFloat(); + x160_targetFlowerClampMax = in.ReadFloat(); + x164_seekerClampMin = in.ReadFloat(); + x168_seekerClampMax = in.ReadFloat(); + x16c_missileBracketClampMin = in.ReadFloat(); + x170_missileBracketClampMax = in.ReadFloat(); + x174_innerBeamClampMin = in.ReadFloat(); + x178_innerBeamClampMax = in.ReadFloat(); + x17c_chargeGaugeClampMin = in.ReadFloat(); + x180_chargeGaugeClampMax = in.ReadFloat(); + x184_lockFireClampMin = in.ReadFloat(); + x188_lockFireClampMax = in.ReadFloat(); + x18c_lockDaggerClampMin = in.ReadFloat(); + x190_lockDaggerClampMax = in.ReadFloat(); + x194_grappleSelectScale = in.ReadFloat(); + x198_grappleScale = in.ReadFloat(); + x19c_grappleClampMin = in.ReadFloat(); + x1a0_grappleClampMax = in.ReadFloat(); + x1a4_grapplePointSelectColor = in.Get(); + x1a8_grapplePointColor = in.Get(); + x1ac_lockedGrapplePointSelectColor = in.Get(); + x1b0_grappleMinClampScale = in.ReadFloat(); + x1b4_chargeGaugePulseColorHigh = in.Get(); + x1b8_fullChargeFadeDuration = in.ReadFloat(); + x1bc_orbitPointColor = in.Get(); + x1c0_crosshairsColor = in.Get(); + x1c4_crosshairsScaleDur = in.ReadFloat(); + x1c8_drawOrbitPoint = in.ReadBool(); + x1cc_chargeGaugePulseColorLow = in.Get(); + x1d0_chargeGaugePulsePeriod = in.ReadFloat(); + x1d4_ = in.Get(); + x1d8_ = in.Get(); + x1dc_ = in.Get(); + x1e0_ = in.ReadFloat(); + x1e4_ = in.ReadFloat(); + x1e8_ = in.ReadFloat(); + x1ec_ = in.ReadFloat(); + x1f0_ = in.ReadFloat(); + x1f4_ = in.ReadFloat(); + x1f8_ = in.ReadFloat(); + x1fc_ = in.ReadFloat(); + x200_ = in.ReadFloat(); + x204_ = in.ReadFloat(); + x208_ = in.ReadFloat(); + x20c_reticuleClampMin = in.ReadFloat(); + x210_reticuleClampMax = in.ReadFloat(); + x214_xrayRetRingColor = in.Get(); + x218_reticuleScale = in.ReadFloat(); + x21c_scanTargetClampMin = in.ReadFloat(); + x220_scanTargetClampMax = in.ReadFloat(); + x224_angularLagSpeed = in.ReadFloat(); + + if (hasNewFields) { + x218_ = in.ReadFloat(); + x21c_ = in.ReadFloat(); + } + + x124_chargeTickAnglePitch = -zeus::degToRad(x124_chargeTickAnglePitch); + x140_lockDaggerAngle0 = zeus::degToRad(x140_lockDaggerAngle0); + x144_lockDaggerAngle1 = zeus::degToRad(x144_lockDaggerAngle1); + x148_lockDaggerAngle2 = zeus::degToRad(x148_lockDaggerAngle2); + x208_ = zeus::degToRad(x208_); + for (int i = 0; i < 4; ++i) { + for (float& f : xf8_outerBeamSquareAngles[i]) { + f = zeus::degToRad(f); + } + } + for (int i = 0; i < 4; ++i) { + x108_chargeGaugeAngles[i] = zeus::degToRad(x108_chargeGaugeAngles[i]); + } +} + +} // namespace metaforce::MP1 \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakTargeting.hpp b/Runtime/MP1/Tweaks/CTweakTargeting.hpp new file mode 100644 index 000000000..b85df050e --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakTargeting.hpp @@ -0,0 +1,282 @@ +#pragma once + +#include "Runtime/Tweaks/ITweakTargeting.hpp" +#include "Runtime/rstl.hpp" + +namespace metaforce::MP1 { +struct CTweakTargeting final : public Tweaks::ITweakTargeting { + u32 x4_targetRadiusMode{}; + float x8_currLockOnExitDuration{}; + float xc_currLockOnEnterDuration{}; + float x10_currLockOnSwitchDuration{}; + float x14_lockConfirmScale{}; + float x18_nextLockOnEnterDuration{}; + float x1c_nextLockOnExitDuration{}; + float x20_nextLockOnSwitchDuration{}; + float x24_seekerScale{}; + float x28_seekerAngleSpeed{}; + float x2c_xrayRetAngleSpeed{}; + zeus::CVector3f x30_; + zeus::CVector3f x3c_; + float x48_{}; + float x4c_{}; + float x50_orbitPointZOffset{}; + float x54_orbitPointInTime{}; + float x58_orbitPointOutTime{}; + float x5c_{}; + zeus::CVector3f x60_; + zeus::CVector3f x6c_; + zeus::CVector3f x78_; + zeus::CVector3f x84_; + float x90_{}; + float x94_{}; + float x98_{}; + float x9c_{}; + float xa0_{}; + float xa4_{}; + float xa8_{}; + float xac_{}; + zeus::CColor xb0_thermalReticuleColor; + float xb4_targetFlowerScale{}; + zeus::CColor xb8_targetFlowerColor; + float xbc_missileBracketDuration{}; + float xc0_missileBracketScaleStart{}; + float xc4_missileBracketScaleEnd{}; + float xc8_missileBracketScaleDuration{}; + zeus::CColor xcc_missileBracketColor; + float xd0_LockonDuration{}; + float xd4_innerBeamScale{}; + zeus::CColor xd8_innerBeamColorPower; + zeus::CColor xdc_innerBeamColorIce; + zeus::CColor xe0_innerBeamColorWave; + zeus::CColor xe4_innerBeamColorPlasma; + float xe8_chargeGaugeOvershootOffset{}; + float xec_chargeGaugeOvershootDuration{}; + float xf0_outerBeamSquaresScale{}; + zeus::CColor xf4_outerBeamSquareColor; + rstl::reserved_vector, 4> xf8_outerBeamSquareAngles; + rstl::reserved_vector x108_chargeGaugeAngles{}; + float x118_chargeGaugeScale{}; + zeus::CColor x11c_chargeGaugeNonFullColor; + u32 x120_chargeTickCount{}; + float x124_chargeTickAnglePitch{}; + float x128_lockFireScale{}; + float x12c_lockFireDuration{}; + zeus::CColor x130_lockFireColor; + float x134_lockDaggerScaleStart{}; + float x138_lockDaggerScaleEnd{}; + zeus::CColor x13c_lockDaggerColor; + float x140_lockDaggerAngle0{}; + float x144_lockDaggerAngle1{}; + float x148_lockDaggerAngle2{}; + zeus::CColor x14c_lockConfirmColor; + zeus::CColor x150_seekerColor; + float x154_lockConfirmClampMin{}; + float x158_lockConfirmClampMax{}; + float x15c_targetFlowerClampMin{}; + float x160_targetFlowerClampMax{}; + float x164_seekerClampMin{}; + float x168_seekerClampMax{}; + float x16c_missileBracketClampMin{}; + float x170_missileBracketClampMax{}; + float x174_innerBeamClampMin{}; + float x178_innerBeamClampMax{}; + float x17c_chargeGaugeClampMin{}; + float x180_chargeGaugeClampMax{}; + float x184_lockFireClampMin{}; + float x188_lockFireClampMax{}; + float x18c_lockDaggerClampMin{}; + float x190_lockDaggerClampMax{}; + float x194_grappleSelectScale{}; + float x198_grappleScale{}; + float x19c_grappleClampMin{}; + float x1a0_grappleClampMax{}; + zeus::CColor x1a4_grapplePointSelectColor; + zeus::CColor x1a8_grapplePointColor; + zeus::CColor x1ac_lockedGrapplePointSelectColor; + float x1b0_grappleMinClampScale{}; + zeus::CColor x1b4_chargeGaugePulseColorHigh; + float x1b8_fullChargeFadeDuration{}; + zeus::CColor x1bc_orbitPointColor; + zeus::CColor x1c0_crosshairsColor; + float x1c4_crosshairsScaleDur{}; + bool x1c8_drawOrbitPoint{}; + zeus::CColor x1cc_chargeGaugePulseColorLow; + float x1d0_chargeGaugePulsePeriod{}; + zeus::CColor x1d4_; + zeus::CColor x1d8_; + zeus::CColor x1dc_; + float x1e0_{}; + float x1e4_{}; + float x1e8_{}; + float x1ec_{}; + float x1f0_{}; + float x1f4_{}; + float x1f8_{}; + float x1fc_{}; + float x200_{}; + float x204_{}; + float x208_{}; + float x20c_reticuleClampMin{}; + float x210_reticuleClampMax{}; + zeus::CColor x214_xrayRetRingColor; + float x218_reticuleScale{}; + float x21c_scanTargetClampMin{}; + float x220_scanTargetClampMax{}; + float x224_angularLagSpeed{}; + + // RS5 + float x218_{}; + float x21c_{}; + bool x224_ = true; + bool x225_ = false; + bool x226_ = true; + bool x227_ = true; + bool x22c_ = true; + bool x22d_ = false; + bool x22e_ = true; + bool x22f_ = true; + bool x234_ = true; + bool x235_ = false; + bool x236_ = true; + bool x237_ = true; + zeus::CVector3f x23c_ = zeus::skZero3f; + + float x2c8_ = 0.25f; + float x2cc_ = 0.35f; + zeus::CColor x2d0_ = (zeus::Comp32)0xb6e6ffff; + float x2d4_ = 0.39215687f; + zeus::CColor x2d8_ = (zeus::Comp32)0xa82a00ff; + float x2dc_ = 0.78431374f; + zeus::CVector3f x2e0_ = zeus::CVector3f(0.f, 0.f, 0.46f); + float x2ec_ = 0.25f; + float x2f0_ = 0.25f; + float x2f4_ = 120.f; + float x2f8_ = 0.25f; + float x2fc_ = 3.5f; + float x300_ = 0.35f; + zeus::CColor x304_ = (zeus::Comp32)0xa82a00ff; + float x308_ = 0.78431374f; + zeus::CColor x30c_ = (zeus::Comp32)0x89d6ffff; + float x310_ = 0.5019608f; + float x314_ = 11.25f; + float x318_ = 0.25f; + float x31c_ = 0.125f; + zeus::CColor x320_ = (zeus::Comp32)0xffca28ff; + float x324_ = 0.78431374f; + zeus::CColor x328_ = (zeus::Comp32)0x89d6ffff; + float x32c_ = 0.19607843f; + float x330_ = 0.f; + float x334_ = 0.25f; + float x338_ = 3.f; + float x33c_ = 0.25f; + float x340_ = 0.25f; + float x344_ = 0.25f; + float x348_ = 0.25f; + float x34c_ = 45.f; + float x350_ = 0.5f; + float x354_ = 0.65f; + float x358_ = 1.5f; + float x35c_ = 0.18f; + float x360_ = 0.15f; + float x364_ = 0.25f; + zeus::CColor x368_ = static_cast(0x56c1fb9f); + zeus::CColor x36c_ = static_cast(0x49c3f6a0); + zeus::CColor x370_ = static_cast(0x49c3f631); + zeus::CColor x374_ = static_cast(0xff8930ff); + zeus::CColor x378_ = static_cast(0xff2f28ff); + zeus::CColor x37c_ = static_cast(0x93e9ffff); + zeus::CColor x380_ = static_cast(0xff6b60ff); + + CTweakTargeting() = default; + CTweakTargeting(CInputStream& r, bool hasNewFields); + u32 GetTargetRadiusMode() const override { return x4_targetRadiusMode; } + float GetCurrLockOnExitDuration() const override { return x8_currLockOnExitDuration; } + float GetCurrLockOnEnterDuration() const override { return xc_currLockOnEnterDuration; } + float GetCurrLockOnSwitchDuration() const override { return x10_currLockOnSwitchDuration; } + float GetLockConfirmScale() const override { return x14_lockConfirmScale; } + float GetNextLockOnEnterDuration() const override { return x18_nextLockOnEnterDuration; } + float GetNextLockOnExitDuration() const override { return x1c_nextLockOnExitDuration; } + float GetNextLockOnSwitchDuration() const override { return x20_nextLockOnSwitchDuration; } + float GetSeekerScale() const override { return x24_seekerScale; } + float GetSeekerAngleSpeed() const override { return x28_seekerAngleSpeed; } + float GetXRayRetAngleSpeed() const override { return x2c_xrayRetAngleSpeed; } + float GetOrbitPointZOffset() const override { return x50_orbitPointZOffset; } + float GetOrbitPointInTime() const override { return x54_orbitPointInTime; } + float GetOrbitPointOutTime() const override { return x58_orbitPointOutTime; } + const zeus::CColor& GetThermalReticuleColor() const override { return xb0_thermalReticuleColor; } + float GetTargetFlowerScale() const override { return xb4_targetFlowerScale; } + const zeus::CColor& GetTargetFlowerColor() const override { return xb8_targetFlowerColor; } + float GetMissileBracketDuration() const override { return xbc_missileBracketDuration; } + float GetMissileBracketScaleStart() const override { return xc0_missileBracketScaleStart; } + float GetMissileBracketScaleEnd() const override { return xc4_missileBracketScaleEnd; } + float GetMissileBracketScaleDuration() const override { return xc8_missileBracketScaleDuration; } + const zeus::CColor& GetMissileBracketColor() const override { return xcc_missileBracketColor; } + float GetChargeGaugeOvershootOffset() const override { return xe8_chargeGaugeOvershootOffset; } + float GetChargeGaugeOvershootDuration() const override { return xec_chargeGaugeOvershootDuration; } + float GetOuterBeamSquaresScale() const override { return xf0_outerBeamSquaresScale; } + const zeus::CColor& GetOuterBeamSquareColor() const override { return xf4_outerBeamSquareColor; } + float GetLockonDuration() const override { return xd0_LockonDuration; } + float GetInnerBeamScale() const override { return xd4_innerBeamScale; } + const zeus::CColor& GetInnerBeamColorPower() const override { return xd8_innerBeamColorPower; } + const zeus::CColor& GetInnerBeamColorIce() const override { return xdc_innerBeamColorIce; } + const zeus::CColor& GetInnerBeamColorWave() const override { return xe0_innerBeamColorWave; } + const zeus::CColor& GetInnerBeamColorPlasma() const override { return xe4_innerBeamColorPlasma; } + const float* GetOuterBeamSquareAngles(int i) const override { return xf8_outerBeamSquareAngles[i].data(); } + float GetChargeGaugeAngle(int i) const override { return x108_chargeGaugeAngles[i]; } + float GetChargeGaugeScale() const override { return x118_chargeGaugeScale; } + const zeus::CColor& GetChargeGaugeNonFullColor() const override { return x11c_chargeGaugeNonFullColor; } + u32 GetChargeTickCount() const override { return x120_chargeTickCount; } + float GetChargeTickAnglePitch() const override { return x124_chargeTickAnglePitch; } + float GetLockFireScale() const override { return x128_lockFireScale; } + float GetLockFireDuration() const override { return x12c_lockFireDuration; } + const zeus::CColor& GetLockFireColor() const override { return x130_lockFireColor; } + float GetLockDaggerScaleStart() const override { return x134_lockDaggerScaleStart; } + float GetLockDaggerScaleEnd() const override { return x138_lockDaggerScaleEnd; } + const zeus::CColor& GetLockDaggerColor() const override { return x13c_lockDaggerColor; } + float GetLockDaggerAngle0() const override { return x140_lockDaggerAngle0; } + float GetLockDaggerAngle1() const override { return x144_lockDaggerAngle1; } + float GetLockDaggerAngle2() const override { return x148_lockDaggerAngle2; } + const zeus::CColor& GetLockConfirmColor() const override { return x14c_lockConfirmColor; } + const zeus::CColor& GetSeekerColor() const override { return x150_seekerColor; } + float GetLockConfirmClampMin() const override { return x154_lockConfirmClampMin; } + float GetLockConfirmClampMax() const override { return x158_lockConfirmClampMax; } + float GetTargetFlowerClampMin() const override { return x15c_targetFlowerClampMin; } + float GetTargetFlowerClampMax() const override { return x160_targetFlowerClampMax; } + float GetSeekerClampMin() const override { return x164_seekerClampMin; } + float GetSeekerClampMax() const override { return x168_seekerClampMax; } + float GetMissileBracketClampMin() const override { return x16c_missileBracketClampMin; } + float GetMissileBracketClampMax() const override { return x170_missileBracketClampMax; } + float GetInnerBeamClampMin() const override { return x174_innerBeamClampMin; } + float GetInnerBeamClampMax() const override { return x178_innerBeamClampMax; } + float GetChargeGaugeClampMin() const override { return x17c_chargeGaugeClampMin; } + float GetChargeGaugeClampMax() const override { return x180_chargeGaugeClampMax; } + float GetLockFireClampMin() const override { return x184_lockFireClampMin; } + float GetLockFireClampMax() const override { return x188_lockFireClampMax; } + float GetLockDaggerClampMin() const override { return x18c_lockDaggerClampMin; } + float GetLockDaggerClampMax() const override { return x190_lockDaggerClampMax; } + float GetGrappleSelectScale() const override { return x194_grappleSelectScale; } + float GetGrappleScale() const override { return x198_grappleScale; } + float GetGrappleClampMin() const override { return x19c_grappleClampMin; } + float GetGrappleClampMax() const override { return x1a0_grappleClampMax; } + const zeus::CColor& GetGrapplePointSelectColor() const override { return x1a4_grapplePointSelectColor; } + const zeus::CColor& GetGrapplePointColor() const override { return x1a8_grapplePointColor; } + const zeus::CColor& GetLockedGrapplePointSelectColor() const override { return x1ac_lockedGrapplePointSelectColor; } + float GetGrappleMinClampScale() const override { return x1b0_grappleMinClampScale; } + const zeus::CColor& GetChargeGaugePulseColorHigh() const override { return x1b4_chargeGaugePulseColorHigh; } + float GetFullChargeFadeDuration() const override { return x1b8_fullChargeFadeDuration; } + const zeus::CColor& GetOrbitPointColor() const override { return x1bc_orbitPointColor; } + const zeus::CColor& GetCrosshairsColor() const override { return x1c0_crosshairsColor; } + float GetCrosshairsScaleDuration() const override { return x1c4_crosshairsScaleDur; } + bool DrawOrbitPoint() const override { return x1c8_drawOrbitPoint; } + const zeus::CColor& GetChargeGaugePulseColorLow() const override { return x1cc_chargeGaugePulseColorLow; } + float GetChargeGaugePulsePeriod() const override { return x1d0_chargeGaugePulsePeriod; } + float GetReticuleClampMin() const override { return x20c_reticuleClampMin; } + float GetReticuleClampMax() const override { return x210_reticuleClampMax; } + const zeus::CColor& GetXRayRetRingColor() const override { return x214_xrayRetRingColor; } + float GetReticuleScale() const override { return x218_reticuleScale; } + float GetScanTargetClampMin() const override { return x21c_scanTargetClampMin; } + float GetScanTargetClampMax() const override { return x220_scanTargetClampMax; } + float GetAngularLagSpeed() const override { return x224_angularLagSpeed; } +}; +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/World/CActorContraption.cpp b/Runtime/MP1/World/CActorContraption.cpp index 56377156c..3edd42ab3 100644 --- a/Runtime/MP1/World/CActorContraption.cpp +++ b/Runtime/MP1/World/CActorContraption.cpp @@ -94,7 +94,7 @@ CFlameThrower* MP1::CActorContraption::CreateFlameThrower(std::string_view name, const CFlameInfo flameInfo(6, 6, x308_flameFxId, 20, 0.5f, 1.f, 1.f); auto* ret = new CFlameThrower(x300_flameThrowerGen, name, EWeaponType::Missile, flameInfo, zeus::CTransform(), EMaterialTypes::CollisionActor, x30c_dInfo, id, GetAreaId(), GetUniqueId(), - EProjectileAttrib::None, -1, -1, -1); + EProjectileAttrib::None, CAssetId(), -1, CAssetId()); x2e8_children.emplace_back(id, name); diff --git a/Runtime/MP1/World/CMetroidPrimeExo.cpp b/Runtime/MP1/World/CMetroidPrimeExo.cpp index bab65f4c0..ff860a60e 100644 --- a/Runtime/MP1/World/CMetroidPrimeExo.cpp +++ b/Runtime/MP1/World/CMetroidPrimeExo.cpp @@ -145,13 +145,13 @@ std::array, 14> skSomeValues2{{ } // namespace SPrimeStruct2B::SPrimeStruct2B(CInputStream& in) : x0_propertyCount(in.ReadLong()) -, x4_particle1(in.ReadLong()) -, x8_particle2(in.ReadLong()) -, xc_particle3(in.ReadLong()) +, x4_particle1(in.Get()) +, x8_particle2(in.Get()) +, xc_particle3(in.Get()) , x10_dInfo(in) , x2c_(in.ReadFloat()) , x30_(in.ReadFloat()) -, x34_texture(in.ReadLong()) +, x34_texture(in.Get()) , x38_(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) , x3a_(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) {} @@ -220,21 +220,21 @@ SPrimeExoParameters::SPrimeExoParameters(CInputStream& in) , x27c_(LoadCameraShakeData(in)) , x350_(LoadCameraShakeData(in)) , x424_(in) -, x460_particle1(in.ReadLong()) +, x460_particle1(in.Get()) , x464_(LoadPrimeStruct4s(in)) -, x708_wpsc1(in.ReadLong()) +, x708_wpsc1(in.Get()) , x70c_dInfo1(in) , x728_shakeData1(LoadCameraShakeData(in)) -, x7fc_wpsc2(in.ReadLong()) +, x7fc_wpsc2(in.Get()) , x800_dInfo2(in) , x81c_shakeData2(LoadCameraShakeData(in)) , x8f0_(in) , x92c_(in) , x948_(LoadCameraShakeData(in)) -, xa1c_particle2(in.ReadLong()) -, xa20_swoosh(in.ReadLong()) -, xa24_particle3(in.ReadLong()) -, xa28_particle4(in.ReadLong()) +, xa1c_particle2(in.Get()) +, xa20_swoosh(in.Get()) +, xa24_particle3(in.Get()) +, xa28_particle4(in.Get()) , xa2c_(LoadPrimeStruct6s(in)) {} SPrimeExoRoomParameters::SPrimeExoRoomParameters(CInputStream& in) { diff --git a/Runtime/MP1/World/CMetroidPrimeProjectile.cpp b/Runtime/MP1/World/CMetroidPrimeProjectile.cpp index 23ab8512a..3c96b62f0 100644 --- a/Runtime/MP1/World/CMetroidPrimeProjectile.cpp +++ b/Runtime/MP1/World/CMetroidPrimeProjectile.cpp @@ -7,12 +7,12 @@ namespace metaforce::MP1 { SPrimeProjectileInfo::SPrimeProjectileInfo(CInputStream& in) : x0_propertyCount(in.ReadLong()) -, x4_particle(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), in.ReadLong()})) +, x4_particle(g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), CAssetId(in)})) , xc_dInfo(in) , x28_(in.ReadFloat()) , x2c_(in.ReadFloat()) , x30_(in.ReadFloat()) -, x34_texture(in.ReadLong()) { +, x34_texture(in) { x38_24_ = in.ReadBool(); x38_25_ = in.ReadBool(); x38_26_ = in.ReadBool(); diff --git a/Runtime/Particle/CDecalDataFactory.hpp b/Runtime/Particle/CDecalDataFactory.hpp index f4676af8d..528ce5232 100644 --- a/Runtime/Particle/CDecalDataFactory.hpp +++ b/Runtime/Particle/CDecalDataFactory.hpp @@ -5,7 +5,7 @@ #include "Runtime/CFactoryMgr.hpp" #include "Runtime/CToken.hpp" #include "Runtime/IObj.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" #include "Runtime/Particle/CDecalDescription.hpp" diff --git a/Runtime/Particle/CDecalManager.cpp b/Runtime/Particle/CDecalManager.cpp index 4880c4dc4..3526c0ca8 100644 --- a/Runtime/Particle/CDecalManager.cpp +++ b/Runtime/Particle/CDecalManager.cpp @@ -12,7 +12,7 @@ bool CDecalManager::m_PoolInitialized = false; s32 CDecalManager::m_FreeIndex = 63; float CDecalManager::m_DeltaTimeSinceLastDecalCreation = 0.f; s32 CDecalManager::m_LastDecalCreatedIndex = -1; -CAssetId CDecalManager::m_LastDecalCreatedAssetId = -1; +CAssetId CDecalManager::m_LastDecalCreatedAssetId = {}; rstl::reserved_vector CDecalManager::m_DecalPool; rstl::reserved_vector CDecalManager::m_ActiveIndexList; @@ -29,7 +29,7 @@ void CDecalManager::Initialize() { m_PoolInitialized = true; m_DeltaTimeSinceLastDecalCreation = 0.f; m_LastDecalCreatedIndex = -1; - m_LastDecalCreatedAssetId = -1; + m_LastDecalCreatedAssetId = {}; /* Compile shaders */ CDecalShaders::Initialize(); diff --git a/Runtime/Particle/CParticleDataFactory.cpp b/Runtime/Particle/CParticleDataFactory.cpp index 83b131520..3adf387e2 100644 --- a/Runtime/Particle/CParticleDataFactory.cpp +++ b/Runtime/Particle/CParticleDataFactory.cpp @@ -706,7 +706,7 @@ std::unique_ptr CParticleDataFactory::GetIntElement(CInputStream& i std::unique_ptr CParticleDataFactory::GetGeneratorDesc(CInputStream& in, CSimplePool* resPool) { std::vector tracker; tracker.reserve(8); - return CreateGeneratorDescription(in, tracker, 0, resPool); + return CreateGeneratorDescription(in, tracker, {}, resPool); } std::unique_ptr CParticleDataFactory::CreateGeneratorDescription(CInputStream& in, diff --git a/Runtime/Particle/CParticleDataFactory.hpp b/Runtime/Particle/CParticleDataFactory.hpp index b5ea0e839..b6dd56fac 100644 --- a/Runtime/Particle/CParticleDataFactory.hpp +++ b/Runtime/Particle/CParticleDataFactory.hpp @@ -5,7 +5,7 @@ #include "Runtime/CFactoryMgr.hpp" #include "Runtime/CToken.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/IObj.hpp" #include "Runtime/RetroTypes.hpp" #include "Runtime/Graphics/CModel.hpp" diff --git a/Runtime/Particle/CParticleElectricDataFactory.hpp b/Runtime/Particle/CParticleElectricDataFactory.hpp index 692a12741..4364b49a6 100644 --- a/Runtime/Particle/CParticleElectricDataFactory.hpp +++ b/Runtime/Particle/CParticleElectricDataFactory.hpp @@ -4,7 +4,7 @@ #include "Runtime/CFactoryMgr.hpp" #include "Runtime/CToken.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/IObj.hpp" #include "Runtime/RetroTypes.hpp" diff --git a/Runtime/Particle/CParticleSwooshDataFactory.hpp b/Runtime/Particle/CParticleSwooshDataFactory.hpp index d6d4a88fc..da3fb76ec 100644 --- a/Runtime/Particle/CParticleSwooshDataFactory.hpp +++ b/Runtime/Particle/CParticleSwooshDataFactory.hpp @@ -4,7 +4,7 @@ #include "Runtime/CFactoryMgr.hpp" #include "Runtime/CToken.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/IObj.hpp" #include "Runtime/RetroTypes.hpp" diff --git a/Runtime/Particle/CProjectileWeaponDataFactory.hpp b/Runtime/Particle/CProjectileWeaponDataFactory.hpp index 1ec523057..b3653875a 100644 --- a/Runtime/Particle/CProjectileWeaponDataFactory.hpp +++ b/Runtime/Particle/CProjectileWeaponDataFactory.hpp @@ -4,7 +4,7 @@ #include "Runtime/CFactoryMgr.hpp" #include "Runtime/CToken.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/IObj.hpp" #include "Runtime/RetroTypes.hpp" diff --git a/Runtime/Particle/CSpawnSystemKeyframeData.hpp b/Runtime/Particle/CSpawnSystemKeyframeData.hpp index b7b02bb18..19d551f45 100644 --- a/Runtime/Particle/CSpawnSystemKeyframeData.hpp +++ b/Runtime/Particle/CSpawnSystemKeyframeData.hpp @@ -4,7 +4,7 @@ #include #include "Runtime/CToken.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" namespace metaforce { diff --git a/Runtime/Particle/IElement.hpp b/Runtime/Particle/IElement.hpp index 9111f7b7c..f87b83861 100644 --- a/Runtime/Particle/IElement.hpp +++ b/Runtime/Particle/IElement.hpp @@ -3,7 +3,7 @@ #include #include "Runtime/GCNTypes.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include #include diff --git a/Runtime/RetroTypes.cpp b/Runtime/RetroTypes.cpp index c05f36c11..b07b11747 100644 --- a/Runtime/RetroTypes.cpp +++ b/Runtime/RetroTypes.cpp @@ -1,5 +1,5 @@ #include "Runtime/RetroTypes.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/IMain.hpp" @@ -9,19 +9,19 @@ namespace metaforce { logvisor::Module Log("metaforce::RetroTypes::CAssetId"); SObjectTag::SObjectTag(CInputStream& in) { - in.Get(reinterpret_cast(&type), 4); + in.ReadBytes(reinterpret_cast(&type), 4); id = in.Get(); } void SObjectTag::ReadMLVL(CInputStream& in) { id = in.Get(); - in.Get(reinterpret_cast(&type), 4); + in.ReadBytes(reinterpret_cast(&type), 4); } CAssetId::CAssetId(CInputStream& in) { if (g_Main != nullptr) { if (g_Main->GetExpectedIdSize() == sizeof(u32)) { - Assign(in.ReadLong()); + Assign(u32(in.ReadLong())); } else if (g_Main->GetExpectedIdSize() == sizeof(u64)) { Assign(in.ReadLongLong()); } else { @@ -32,7 +32,7 @@ CAssetId::CAssetId(CInputStream& in) { } } -void CAssetId::PutTo(COutputStream& out) { +void CAssetId::PutTo(COutputStream& out) const { if (g_Main != nullptr) { if (g_Main->GetExpectedIdSize() == sizeof(u32)) { out.Put(u32(id)); diff --git a/Runtime/RetroTypes.hpp b/Runtime/RetroTypes.hpp index 27746d15a..51897b976 100644 --- a/Runtime/RetroTypes.hpp +++ b/Runtime/RetroTypes.hpp @@ -196,13 +196,14 @@ class CAssetId { public: constexpr CAssetId() noexcept = default; + constexpr CAssetId(u32 v) noexcept { Assign(u32(v)); } constexpr CAssetId(u64 v) noexcept { Assign(v); } explicit CAssetId(CInputStream& in); [[nodiscard]] constexpr bool IsValid() const noexcept { return id != UINT64_MAX; } [[nodiscard]] constexpr u64 Value() const noexcept { return id; } constexpr void Assign(u64 v) noexcept { id = (v == UINT32_MAX ? UINT64_MAX : (v == 0 ? UINT64_MAX : v)); } constexpr void Reset() noexcept { id = UINT64_MAX; } - void PutTo(COutputStream& out); + void PutTo(COutputStream& out) const; [[nodiscard]] constexpr bool operator==(CAssetId other) const noexcept { return id == other.id; } [[nodiscard]] constexpr bool operator!=(CAssetId other) const noexcept { return !operator==(other); } [[nodiscard]] constexpr bool operator<(CAssetId other) const noexcept { return id < other.id; } diff --git a/Runtime/CInputStream.cpp b/Runtime/Streams/CInputStream.cpp similarity index 97% rename from Runtime/CInputStream.cpp rename to Runtime/Streams/CInputStream.cpp index 2c0b450bf..f6853ca23 100644 --- a/Runtime/CInputStream.cpp +++ b/Runtime/Streams/CInputStream.cpp @@ -14,7 +14,7 @@ static u32 min_containing_bytes(u32 v) { CInputStream::CInputStream(s32 len) : xc_len(len), x10_ptr(new u8[len]), x14_owned(true) {} CInputStream::CInputStream(const void* ptr, u32 len, bool owned) -: x8_blockLen(len), xc_len(len), x10_ptr(reinterpret_cast(ptr)), x14_owned(owned) {} +: x8_blockLen(len), xc_len(len), x10_ptr(reinterpret_cast(const_cast(ptr))), x14_owned(owned) {} CInputStream::~CInputStream() { if (x14_owned) { @@ -23,7 +23,7 @@ CInputStream::~CInputStream() { } bool CInputStream::InternalReadNext() { - x8_blockLen = Read(const_cast(x10_ptr), xc_len); + x8_blockLen = Read(x10_ptr, xc_len); x4_blockOffset = 0; return x8_blockLen != 0; } diff --git a/Runtime/CInputStream.hpp b/Runtime/Streams/CInputStream.hpp similarity index 94% rename from Runtime/CInputStream.hpp rename to Runtime/Streams/CInputStream.hpp index 21298e33a..8742061aa 100644 --- a/Runtime/CInputStream.hpp +++ b/Runtime/Streams/CInputStream.hpp @@ -7,7 +7,7 @@ class CInputStream { u32 x4_blockOffset = 0; u32 x8_blockLen = 0; u32 xc_len = 0; - const u8* x10_ptr = nullptr; + u8* x10_ptr = nullptr; bool x14_owned = false; u32 x18_readPosition = 0; u32 x1c_bitWord = 0; @@ -46,7 +46,7 @@ public: double ReadDouble(); void Get(u8* dest, u32 len); - template + template T Get() { return cinput_stream_helper(*this); } @@ -54,7 +54,7 @@ public: static u32 GetBitCount(u32 val); }; -template +template T cinput_stream_helper(CInputStream& in) { return T(in); } diff --git a/Runtime/CMemoryInStream.hpp b/Runtime/Streams/CMemoryInStream.hpp similarity index 84% rename from Runtime/CMemoryInStream.hpp rename to Runtime/Streams/CMemoryInStream.hpp index 3bb0e7ef1..7eda43ab1 100644 --- a/Runtime/CMemoryInStream.hpp +++ b/Runtime/Streams/CMemoryInStream.hpp @@ -1,5 +1,5 @@ #pragma once -#include "../../metaforce/Runtime/CInputStream.hpp" +#include "CInputStream.hpp" namespace metaforce { class CMemoryInStream final : public CInputStream { diff --git a/Runtime/CMemoryStreamOut.cpp b/Runtime/Streams/CMemoryStreamOut.cpp similarity index 100% rename from Runtime/CMemoryStreamOut.cpp rename to Runtime/Streams/CMemoryStreamOut.cpp diff --git a/Runtime/CMemoryStreamOut.hpp b/Runtime/Streams/CMemoryStreamOut.hpp similarity index 90% rename from Runtime/CMemoryStreamOut.hpp rename to Runtime/Streams/CMemoryStreamOut.hpp index 88ef2d20a..1cb115ed6 100644 --- a/Runtime/CMemoryStreamOut.hpp +++ b/Runtime/Streams/CMemoryStreamOut.hpp @@ -1,5 +1,5 @@ #pragma once -#include "Runtime/COutputStream.hpp" +#include "COutputStream.hpp" namespace metaforce { class CMemoryStreamOut final : public COutputStream { diff --git a/Runtime/COutputStream.cpp b/Runtime/Streams/COutputStream.cpp similarity index 100% rename from Runtime/COutputStream.cpp rename to Runtime/Streams/COutputStream.cpp diff --git a/Runtime/COutputStream.hpp b/Runtime/Streams/COutputStream.hpp similarity index 100% rename from Runtime/COutputStream.hpp rename to Runtime/Streams/COutputStream.hpp diff --git a/Runtime/CZipInputStream.cpp b/Runtime/Streams/CZipInputStream.cpp similarity index 59% rename from Runtime/CZipInputStream.cpp rename to Runtime/Streams/CZipInputStream.cpp index 337792f9a..3f6cbb715 100644 --- a/Runtime/CZipInputStream.cpp +++ b/Runtime/Streams/CZipInputStream.cpp @@ -14,21 +14,14 @@ CZipInputStream::CZipInputStream(std::unique_ptr&& strm) CZipInputStream::~CZipInputStream() { inflateEnd(x30_zstrm.get()); } u32 CZipInputStream::Read(void* buf, u32 len) { - x30_zstrm->next_out = static_cast(buf); + x30_zstrm->next_out = static_cast(buf); x30_zstrm->avail_out = len; - x30_zstrm->total_out = 0; - while (x30_zstrm->avail_out != 0) { - if (x30_zstrm->avail_in == 0) { - u32 readSz = x28_strm->ReadBytes(x24_compBuf.get(), 4096); - x30_zstrm->avail_in = readSz; - x30_zstrm->next_in = x24_compBuf.get(); - } - int inflateRet = inflate(x30_zstrm.get(), Z_NO_FLUSH); - if (inflateRet != Z_OK) { - break; - } + if (x30_zstrm->avail_in == 0) { + x30_zstrm->avail_in = x28_strm->ReadBytes(x24_compBuf.get(),4096); + x30_zstrm->next_in = x24_compBuf.get(); } - return x30_zstrm->total_out; + inflate(x30_zstrm.get(), Z_NO_FLUSH); + return len - x30_zstrm->avail_out; } } // namespace metaforce \ No newline at end of file diff --git a/Runtime/CZipInputStream.hpp b/Runtime/Streams/CZipInputStream.hpp similarity index 100% rename from Runtime/CZipInputStream.hpp rename to Runtime/Streams/CZipInputStream.hpp diff --git a/Runtime/Streams/ContainerReaders.hpp b/Runtime/Streams/ContainerReaders.hpp new file mode 100644 index 000000000..1080dfb2f --- /dev/null +++ b/Runtime/Streams/ContainerReaders.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "Runtime/rstl.hpp" +#include "Runtime/Streams/CInputStream.hpp" +namespace metaforce { +template +void read_reserved_vector(rstl::reserved_vector& v, CInputStream& in) { + u32 count = in.ReadLong(); + v.resize(count); + for (u32 i = 0; i < count; ++i) { + v[i] = in.Get(); + } +} +} // namespace metaforce \ No newline at end of file diff --git a/Runtime/IOStreams.cpp b/Runtime/Streams/IOStreams.cpp similarity index 86% rename from Runtime/IOStreams.cpp rename to Runtime/Streams/IOStreams.cpp index 4ded1d7a4..b5f7233ba 100644 --- a/Runtime/IOStreams.cpp +++ b/Runtime/Streams/IOStreams.cpp @@ -1,7 +1,8 @@ -#include "Runtime/IOStreams.hpp" -#include +#include "Runtime/Streams/IOStreams.hpp" +#include "zeus/zeus.hpp" namespace metaforce { +// Input template <> zeus::CVector2f cinput_stream_helper(CInputStream& in) { zeus::CVector2f ret; @@ -93,4 +94,17 @@ zeus::CMatrix4f cinput_stream_helper(CInputStream& in) { ret.m[3] = in.Get(); return ret.transposed(); } + +template +rstl::reserved_vector cinput_stream_helper(CInputStream& in) { + return rstl::reserved_vector(in); +} + +// Output +template<> +void coutput_stream_helper(const zeus::CVector3f& v, COutputStream& out) { + out.Put(v.x()); + out.Put(v.y()); + out.Put(v.z()); +} } // namespace metaforce diff --git a/Runtime/IOStreams.hpp b/Runtime/Streams/IOStreams.hpp similarity index 72% rename from Runtime/IOStreams.hpp rename to Runtime/Streams/IOStreams.hpp index 3e079d211..92d080f9a 100644 --- a/Runtime/IOStreams.hpp +++ b/Runtime/Streams/IOStreams.hpp @@ -1,8 +1,10 @@ #pragma once -#include "Runtime/CMemoryInStream.hpp" -#include "Runtime/CMemoryStreamOut.hpp" -#include "Runtime/CZipInputStream.hpp" +#include "Runtime/Streams/CMemoryInStream.hpp" +#include "Runtime/Streams/CMemoryStreamOut.hpp" +#include "Runtime/Streams/CZipInputStream.hpp" +#include "Runtime/Streams/ContainerReaders.hpp" +#include "Runtime/rstl.hpp" namespace zeus { class CVector2f; @@ -15,7 +17,7 @@ class CAABox; class COBBox; class CQuaternion; class CColor; -} +} // namespace zeus namespace metaforce { // Custom helpers for input/output template <> @@ -38,4 +40,8 @@ template <> zeus::CMatrix3f cinput_stream_helper(CInputStream& in); template <> zeus::CMatrix4f cinput_stream_helper(CInputStream& in); -} \ No newline at end of file + +template <> +void coutput_stream_helper(const zeus::CVector3f& v, COutputStream& out); + +} // namespace metaforce \ No newline at end of file diff --git a/Runtime/Tweaks/ITweak.hpp b/Runtime/Tweaks/ITweak.hpp new file mode 100644 index 000000000..1ea92dcb5 --- /dev/null +++ b/Runtime/Tweaks/ITweak.hpp @@ -0,0 +1,19 @@ +#pragma once + +// Gonna need these in all the tweaks anyway, so we'll include them here +#include "zeus/zeus.hpp" +#include "Runtime/GCNTypes.hpp" + +namespace hecl { +class CVarManager; +} + +namespace metaforce { +class CInputStream; +class COutputStream; +class ITweak { +public: + virtual ~ITweak() = default; + virtual void initCVars(hecl::CVarManager*) {} +}; +} // namespace metaforce diff --git a/Runtime/Tweaks/ITweakAutoMapper.hpp b/Runtime/Tweaks/ITweakAutoMapper.hpp new file mode 100644 index 000000000..1d5c4b74c --- /dev/null +++ b/Runtime/Tweaks/ITweakAutoMapper.hpp @@ -0,0 +1,62 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" +namespace metaforce::Tweaks { +struct ITweakAutoMapper : public ITweak { + virtual bool GetShowOneMiniMapArea() const = 0; + virtual bool GetScaleMoveSpeedWithCamDist() const = 0; + virtual float GetCamDist() const = 0; + virtual float GetMinCamDist() const = 0; + virtual float GetMaxCamDist() const = 0; + virtual float GetMinCamRotateX() const = 0; + virtual float GetMaxCamRotateX() const = 0; + virtual float GetCamAngle() const = 0; + virtual const zeus::CColor& GetAutomapperWidgetColor() const = 0; + virtual float GetMiniCamDist() const = 0; + virtual float GetMiniCamXAngle() const = 0; + virtual float GetMiniCamAngle() const = 0; + virtual const zeus::CColor& GetAutomapperWidgetMiniColor() const = 0; + virtual const zeus::CColor& GetSurfaceVisitedColor() const = 0; + virtual const zeus::CColor& GetOutlineVisitedColor() const = 0; + virtual const zeus::CColor& GetSurfaceUnvisitedColor() const = 0; + virtual const zeus::CColor& GetOutlineUnvisitedColor() const = 0; + virtual const zeus::CColor& GetSurfaceSelectVisitedColor() const = 0; + virtual const zeus::CColor& GetOutlineSelectVisitedColor() const = 0; + virtual float GetMapSurfaceNormColorLinear() const = 0; + virtual float GetMapSurfaceNormColorConstant() const = 0; + virtual float GetOpenMapScreenTime() const = 0; + virtual float GetCloseMapScreenTime() const = 0; + virtual float GetHintPanTime() const = 0; + virtual float GetCamZoomUnitsPerFrame() const = 0; + virtual float GetCamRotateDegreesPerFrame() const = 0; + virtual float GetBaseMapScreenCameraMoveSpeed() const = 0; + virtual const zeus::CColor& GetSurfaceSelectUnvisitedColor() const = 0; + virtual const zeus::CColor& GetOutlineSelectUnvisitedColor() const = 0; + virtual float GetMiniAlphaSurfaceVisited() const = 0; + virtual float GetAlphaSurfaceVisited() const = 0; + virtual float GetMiniAlphaOutlineVisited() const = 0; + virtual float GetAlphaOutlineVisited() const = 0; + virtual float GetMiniAlphaSurfaceUnvisited() const = 0; + virtual float GetAlphaSurfaceUnvisited() const = 0; + virtual float GetMiniAlphaOutlineUnvisited() const = 0; + virtual float GetAlphaOutlineUnvisited() const = 0; + virtual const zeus::CVector3f& GetDoorCenter() const = 0; + virtual float GetMiniMapViewportWidth() const = 0; + virtual float GetMiniMapViewportHeight() const = 0; + virtual float GetMiniMapCamDistScale() const = 0; + virtual float GetMapPlaneScaleX() const = 0; + virtual float GetMapPlaneScaleZ() const = 0; + virtual float GetUniverseCamDist() const = 0; + virtual float GetMinUniverseCamDist() const = 0; + virtual float GetMaxUniverseCamDist() const = 0; + virtual float GetSwitchToFromUniverseTime() const = 0; + virtual float GetCamPanUnitsPerFrame() const = 0; + virtual float GetAutomapperScaleX() const = 0; + virtual float GetAutomapperScaleZ() const = 0; + virtual float GetCamVerticalOffset() const = 0; + virtual const zeus::CColor& GetMiniMapSamusModColor() const = 0; + virtual const zeus::CColor& GetAreaFlashPulseColor() const = 0; + virtual const zeus::CColor& GetDoorColor(int idx) const = 0; + virtual const zeus::CColor& GetOpenDoorColor() const = 0; +}; +} // namespace DataSpec diff --git a/Runtime/Tweaks/ITweakBall.hpp b/Runtime/Tweaks/ITweakBall.hpp new file mode 100644 index 000000000..fcd814bd9 --- /dev/null +++ b/Runtime/Tweaks/ITweakBall.hpp @@ -0,0 +1,69 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" + +namespace metaforce::Tweaks { +struct ITweakBall : ITweak { + virtual float GetMaxBallTranslationAcceleration(int s) const = 0; + virtual float GetBallTranslationFriction(int s) const = 0; + virtual float GetBallTranslationMaxSpeed(int s) const = 0; + virtual float GetBallCameraElevation() const = 0; + virtual float GetBallCameraAnglePerSecond() const = 0; + virtual const zeus::CVector3f& GetBallCameraOffset() const = 0; + virtual float GetBallCameraMinSpeedDistance() const = 0; + virtual float GetBallCameraMaxSpeedDistance() const = 0; + virtual float GetBallCameraBackwardsDistance() const = 0; + virtual float GetBallCameraSpringConstant() const = 0; + virtual float GetBallCameraSpringMax() const = 0; + virtual float GetBallCameraSpringTardis() const = 0; + virtual float GetBallCameraCentroidSpringConstant() const = 0; + virtual float GetBallCameraCentroidSpringMax() const = 0; + virtual float GetBallCameraCentroidSpringTardis() const = 0; + virtual float GetBallCameraCentroidDistanceSpringConstant() const = 0; + virtual float GetBallCameraCentroidDistanceSpringMax() const = 0; + virtual float GetBallCameraCentroidDistanceSpringTardis() const = 0; + virtual float GetBallCameraLookAtSpringConstant() const = 0; + virtual float GetBallCameraLookAtSpringMax() const = 0; + virtual float GetBallCameraLookAtSpringTardis() const = 0; + virtual float GetBallForwardBrakingAcceleration(int s) const = 0; + virtual float GetBallGravity() const = 0; + virtual float GetBallWaterGravity() const = 0; + virtual float GetBallSlipFactor(int s) const = 0; + virtual float GetConservativeDoorCameraDistance() const = 0; + virtual float GetBallCameraChaseElevation() const = 0; + virtual float GetBallCameraChaseDampenAngle() const = 0; + virtual float GetBallCameraChaseDistance() const = 0; + virtual float GetBallCameraChaseYawSpeed() const = 0; + virtual float GetBallCameraChaseAnglePerSecond() const = 0; + virtual const zeus::CVector3f& GetBallCameraChaseLookAtOffset() const = 0; + virtual float GetBallCameraChaseSpringConstant() const = 0; + virtual float GetBallCameraChaseSpringMax() const = 0; + virtual float GetBallCameraChaseSpringTardis() const = 0; + virtual float GetBallCameraBoostElevation() const = 0; + virtual float GetBallCameraBoostDampenAngle() const = 0; + virtual float GetBallCameraBoostDistance() const = 0; + virtual float GetBallCameraBoostYawSpeed() const = 0; + virtual float GetBallCameraBoostAnglePerSecond() const = 0; + virtual const zeus::CVector3f& GetBallCameraBoostLookAtOffset() const = 0; + virtual float GetBallCameraBoostSpringConstant() const = 0; + virtual float GetBallCameraBoostSpringMax() const = 0; + virtual float GetBallCameraBoostSpringTardis() const = 0; + virtual float GetMinimumAlignmentSpeed() const = 0; + virtual float GetTireness() const = 0; + virtual float GetMaxLeanAngle() const = 0; + virtual float GetTireToMarbleThresholdSpeed() const = 0; + virtual float GetMarbleToTireThresholdSpeed() const = 0; + virtual float GetForceToLeanGain() const = 0; + virtual float GetLeanTrackingGain() const = 0; + virtual float GetBallCameraControlDistance() const = 0; + virtual float GetLeftStickDivisor() const = 0; + virtual float GetRightStickDivisor() const = 0; + virtual float GetBallTouchRadius() const = 0; + virtual float GetBoostBallDrainTime() const = 0; + virtual float GetBoostBallMaxChargeTime() const = 0; + virtual float GetBoostBallMinChargeTime() const = 0; + virtual float GetBoostBallMinRelativeSpeedForDamage() const = 0; + virtual float GetBoostBallChargeTimeTable(int i) const = 0; + virtual float GetBoostBallIncrementalSpeedTable(int i) const = 0; +}; +} // namespace metaforce diff --git a/Runtime/Tweaks/ITweakGame.hpp b/Runtime/Tweaks/ITweakGame.hpp new file mode 100644 index 000000000..078cbc1d1 --- /dev/null +++ b/Runtime/Tweaks/ITweakGame.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" + +namespace metaforce::Tweaks { + +struct ITweakGame : ITweak { + virtual std::string_view GetWorldPrefix() const = 0; + virtual bool GetSplashScreensDisabled() const = 0; + virtual float GetFirstPersonFOV() const = 0; + virtual float GetPressStartDelay() const = 0; + virtual float GetWavecapIntensityNormal() const = 0; + virtual float GetWavecapIntensityPoison() const = 0; + virtual float GetWavecapIntensityLava() const = 0; + virtual float GetRippleIntensityNormal() const = 0; + virtual float GetRippleIntensityPoison() const = 0; + virtual float GetRippleIntensityLava() const = 0; + virtual float GetFluidEnvBumpScale() const = 0; + virtual float GetWaterFogDistanceBase() const = 0; + virtual float GetWaterFogDistanceRange() const = 0; + virtual float GetGravityWaterFogDistanceBase() const = 0; + virtual float GetGravityWaterFogDistanceRange() const = 0; + virtual float GetHardModeDamageMultiplier() const = 0; + virtual float GetHardModeWeaponMultiplier() const = 0; +}; +} // namespace metaforce diff --git a/Runtime/Tweaks/ITweakGui.hpp b/Runtime/Tweaks/ITweakGui.hpp new file mode 100644 index 000000000..0a3f5916e --- /dev/null +++ b/Runtime/Tweaks/ITweakGui.hpp @@ -0,0 +1,140 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" + +namespace metaforce::Tweaks { + +struct ITweakGui : ITweak { + enum class EHudVisMode : atUint32 { Zero, One, Two, Three }; + + enum class EHelmetVisMode : atUint32 { ReducedUpdate, NotVisible, Deco, HelmetDeco, GlowHelmetDeco, HelmetOnly }; + + virtual float GetMapAlphaInterpolant() const = 0; + virtual float GetPauseBlurFactor() const = 0; + virtual float GetRadarXYRadius() const = 0; + virtual float GetRadarZRadius() const = 0; + virtual float GetRadarZCloseRadius() const = 0; + virtual float GetEnergyBarFilledSpeed() const = 0; + virtual float GetEnergyBarShadowSpeed() const = 0; + virtual float GetEnergyBarDrainDelay() const = 0; + virtual bool GetEnergyBarAlwaysResetDelay() const = 0; + virtual float GetHudDamagePracticalsGainConstant() const = 0; + virtual float GetHudDamagePracticalsGainLinear() const = 0; + virtual float GetHudDamagePracticalsInitConstant() const = 0; + virtual float GetHudDamagePracticalsInitLinear() const = 0; + virtual float GetHudDamageLightSpotAngle() const = 0; + virtual float GetDamageLightAngleC() const = 0; + virtual float GetDamageLightAngleL() const = 0; + virtual float GetDamageLightAngleQ() const = 0; + virtual zeus::CVector3f GetDamageLightPreTranslate() const = 0; + virtual zeus::CVector3f GetDamageLightCenterTranslate() const = 0; + virtual float GetDamageLightXfXAngle() const = 0; + virtual float GetDamageLightXfZAngle() const = 0; + virtual float GetHudDecoShakeTranslateVelConstant() const = 0; + virtual float GetHudDecoShakeTranslateVelLinear() const = 0; + virtual float GetMaxDecoDamageShakeTranslate() const = 0; + virtual float GetDecoDamageShakeDeceleration() const = 0; + virtual float GetDecoShakeGainConstant() const = 0; + virtual float GetDecoShakeGainLinear() const = 0; + virtual float GetDecoShakeInitConstant() const = 0; + virtual float GetDecoShakeInitLinear() const = 0; + virtual float GetMaxDecoDamageShakeRotate() const = 0; + virtual u32 GetHudCamFovTweak() const = 0; + virtual u32 GetHudCamYTweak() const = 0; + virtual u32 GetHudCamZTweak() const = 0; + virtual float GetBeamVisorMenuAnimTime() const = 0; + virtual float GetVisorBeamMenuItemActiveScale() const = 0; + virtual float GetVisorBeamMenuItemInactiveScale() const = 0; + virtual float GetVisorBeamMenuItemTranslate() const = 0; + virtual float GetThreatRange() const = 0; + virtual float GetRadarScopeCoordRadius() const = 0; + virtual float GetRadarPlayerPaintRadius() const = 0; + virtual float GetRadarEnemyPaintRadius() const = 0; + virtual float GetMissileArrowVisTime() const = 0; + virtual EHudVisMode GetHudVisMode() const = 0; + virtual EHelmetVisMode GetHelmetVisMode() const = 0; + virtual u32 GetEnableAutoMapper() const = 0; + virtual u32 GetEnableTargetingManager() const = 0; + virtual u32 GetEnablePlayerVisor() const = 0; + virtual float GetThreatWarningFraction() const = 0; + virtual float GetMissileWarningFraction() const = 0; + virtual float GetFreeLookFadeTime() const = 0; + virtual float GetFreeLookSfxPitchScale() const = 0; + virtual bool GetNoAbsoluteFreeLookSfxPitch() const = 0; + virtual float GetFaceReflectionOrthoWidth() const = 0; + virtual float GetFaceReflectionOrthoHeight() const = 0; + virtual float GetFaceReflectionDistance() const = 0; + virtual float GetFaceReflectionHeight() const = 0; + virtual float GetFaceReflectionAspect() const = 0; + virtual float GetMissileWarningPulseTime() const = 0; + virtual float GetExplosionLightFalloffMultConstant() const = 0; + virtual float GetExplosionLightFalloffMultLinear() const = 0; + virtual float GetExplosionLightFalloffMultQuadratic() const = 0; + virtual float GetHudDamagePeakFactor() const = 0; + virtual float GetHudDamageFilterGainConstant() const = 0; + virtual float GetHudDamageFilterGainLinear() const = 0; + virtual float GetHudDamageFilterInitConstant() const = 0; + virtual float GetHudDamageFilterInitLinear() const = 0; + virtual float GetEnergyDrainModPeriod() const = 0; + virtual bool GetEnergyDrainSinusoidalPulse() const = 0; + virtual bool GetEnergyDrainFilterAdditive() const = 0; + virtual float GetHudDamagePulseDuration() const = 0; + virtual float GetHudDamageColorGain() const = 0; + virtual float GetHudDecoShakeTranslateGain() const = 0; + virtual float GetHudLagOffsetScale() const = 0; + virtual float GetScanAppearanceDuration() const = 0; + virtual float GetScanPaneFlashFactor() const = 0; + virtual float GetScanPaneFadeInTime() const = 0; + virtual float GetScanPaneFadeOutTime() const = 0; + virtual float GetBallViewportYReduction() const = 0; + virtual float GetScanWindowIdleWidth() const = 0; + virtual float GetScanWindowIdleHeight() const = 0; + virtual float GetScanWindowActiveWidth() const = 0; + virtual float GetScanWindowActiveHeight() const = 0; + virtual float GetScanWindowMagnification() const = 0; + virtual float GetScanWindowScanningAspect() const = 0; + virtual float GetScanSpeed(int idx) const = 0; + virtual float GetXrayBlurScaleLinear() const = 0; + virtual float GetXrayBlurScaleQuadratic() const = 0; + virtual float GetScanSidesAngle() const = 0; + virtual float GetScanSidesXScale() const = 0; + virtual float GetScanSidesPositionEnd() const = 0; + virtual float GetScanSidesDuration() const = 0; + virtual float GetScanSidesStartTime() const = 0; + virtual float GetScanSidesEndTime() const = 0; + virtual float GetScanDataDotRadius() const = 0; + virtual float GetScanDataDotPosRandMagnitude() const = 0; + virtual float GetScanDataDotSeekDurationMin() const = 0; + virtual float GetScanDataDotSeekDurationMax() const = 0; + virtual float GetScanDataDotHoldDurationMin() const = 0; + virtual float GetScanDataDotHoldDurationMax() const = 0; + virtual float GetScanSidesPositionStart() const = 0; + virtual bool GetShowAutomapperInMorphball() const = 0; + virtual bool GetLatchArticleText() const = 0; + virtual float GetWorldTransManagerCharsPerSfx() const = 0; + virtual u32 GetXRayFogMode() const = 0; + virtual float GetXRayFogNearZ() const = 0; + virtual float GetXRayFogFarZ() const = 0; + virtual const zeus::CColor& GetXRayFogColor() const = 0; + virtual float GetThermalVisorLevel() const = 0; + virtual const zeus::CColor& GetThermalVisorColor() const = 0; + virtual const zeus::CColor& GetVisorHudLightAdd(int v) const = 0; + virtual const zeus::CColor& GetVisorHudLightMultiply(int v) const = 0; + virtual const zeus::CColor& GetHudReflectivityLightColor() const = 0; + virtual float GetHudLightAttMulConstant() const = 0; + virtual float GetHudLightAttMulLinear() const = 0; + virtual float GetHudLightAttMulQuadratic() const = 0; + virtual std::string_view GetCreditsTable() const = 0; + virtual std::string_view GetCreditsFont() const = 0; + virtual std::string_view GetJapaneseCreditsFont() const = 0; + virtual const zeus::CColor& GetCreditsTextFontColor() const = 0; + virtual const zeus::CColor& GetCreditsTextBorderColor() const = 0; + + static float FaceReflectionDistanceDebugValueToActualValue(float v) { return 0.015f * v + 0.2f; } + static float FaceReflectionHeightDebugValueToActualValue(float v) { return 0.005f * v - 0.05f; } + static float FaceReflectionAspectDebugValueToActualValue(float v) { return 0.05f * v + 1.f; } + static float FaceReflectionOrthoWidthDebugValueToActualValue(float v) { return 0.007f * v + 0.02f; } + static float FaceReflectionOrthoHeightDebugValueToActualValue(float v) { return 0.007f * v + 0.02f; } +}; + +} // namespace DataSpec diff --git a/Runtime/Tweaks/ITweakGuiColors.hpp b/Runtime/Tweaks/ITweakGuiColors.hpp new file mode 100644 index 000000000..c446f7da2 --- /dev/null +++ b/Runtime/Tweaks/ITweakGuiColors.hpp @@ -0,0 +1,102 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" + +namespace metaforce::Tweaks { +struct ITweakGuiColors : ITweak { + struct SVisorEnergyInitColors { + const zeus::CColor& tankFilled; + const zeus::CColor& tankEmpty; + const zeus::CColor& digitsFont; + const zeus::CColor& digitsOutline; + }; + + struct SVisorEnergyBarColors { + const zeus::CColor& filled; + const zeus::CColor& empty; + const zeus::CColor& shadow; + }; + + virtual const zeus::CColor& GetPauseBlurFilterColor() const = 0; + virtual const zeus::CColor& GetRadarStuffColor() const = 0; + virtual const zeus::CColor& GetRadarPlayerPaintColor() const = 0; + virtual const zeus::CColor& GetRadarEnemyPaintColor() const = 0; + virtual const zeus::CColor& GetHudMessageFill() const = 0; + virtual const zeus::CColor& GetHudMessageOutline() const = 0; + virtual const zeus::CColor& GetHudFrameColor() const = 0; + virtual const zeus::CColor& GetMissileIconColorActive() const = 0; + virtual const zeus::CColor& GetVisorBeamMenuItemActive() const = 0; + virtual const zeus::CColor& GetVisorBeamMenuItemInactive() const = 0; + virtual const zeus::CColor& GetEnergyBarFilledLowEnergy() const = 0; + virtual const zeus::CColor& GetEnergyBarShadowLowEnergy() const = 0; + virtual const zeus::CColor& GetEnergyBarEmptyLowEnergy() const = 0; + virtual const zeus::CColor& GetHudDamageLightColor() const = 0; + virtual const zeus::CColor& GetVisorMenuTextFont() const = 0; + virtual const zeus::CColor& GetVisorMenuTextOutline() const = 0; + virtual const zeus::CColor& GetBeamMenuTextFont() const = 0; + virtual const zeus::CColor& GetBeamMenuTextOutline() const = 0; + virtual const zeus::CColor& GetEnergyWarningFont() const = 0; + virtual const zeus::CColor& GetThreatWarningFont() const = 0; + virtual const zeus::CColor& GetMissileWarningFont() const = 0; + virtual const zeus::CColor& GetThreatBarFilled() const = 0; + virtual const zeus::CColor& GetThreatBarShadow() const = 0; + virtual const zeus::CColor& GetThreatBarEmpty() const = 0; + virtual const zeus::CColor& GetMissileBarFilled() const = 0; + virtual const zeus::CColor& GetMissileBarShadow() const = 0; + virtual const zeus::CColor& GetMissileBarEmpty() const = 0; + virtual const zeus::CColor& GetThreatIconColor() const = 0; + virtual const zeus::CColor& GetTickDecoColor() const = 0; + virtual const zeus::CColor& GetHelmetLightColor() const = 0; + virtual const zeus::CColor& GetThreatIconSafeColor() const = 0; + virtual const zeus::CColor& GetMissileIconColorInactive() const = 0; + virtual const zeus::CColor& GetMissileIconColorChargedCanAlt() const = 0; + virtual const zeus::CColor& GetMissileIconColorChargedNoAlt() const = 0; + virtual const zeus::CColor& GetMissileIconColorDepleteAlt() const = 0; + virtual const zeus::CColor& GetVisorBeamMenuLozColor() const = 0; + virtual const zeus::CColor& GetEnergyWarningOutline() const = 0; + virtual const zeus::CColor& GetThreatWarningOutline() const = 0; + virtual const zeus::CColor& GetMissileWarningOutline() const = 0; + virtual const zeus::CColor& GetDamageAmbientColor() const = 0; + virtual const zeus::CColor& GetScanFrameInactiveColor() const = 0; + virtual const zeus::CColor& GetScanFrameActiveColor() const = 0; + virtual const zeus::CColor& GetScanFrameImpulseColor() const = 0; + virtual const zeus::CColor& GetScanVisorHudLightMultiply() const = 0; + virtual const zeus::CColor& GetScanVisorScreenDimColor() const = 0; + virtual const zeus::CColor& GetThermalVisorHudLightMultiply() const = 0; + virtual const zeus::CColor& GetEnergyDrainFilterColor() const = 0; + virtual const zeus::CColor& GetDamageAmbientPulseColor() const = 0; + virtual const zeus::CColor& GetEnergyBarFlashColor() const = 0; + virtual const zeus::CColor& GetXRayEnergyDecoColor() const = 0; + virtual const zeus::CColor& GetScanDataDotColor() const = 0; + virtual const zeus::CColor& GetPowerBombDigitAvailableFont() const = 0; + virtual const zeus::CColor& GetPowerBombDigitAvailableOutline() const = 0; + virtual const zeus::CColor& GetBallBombFilledColor() const = 0; + virtual const zeus::CColor& GetBallBombEmptyColor() const = 0; + virtual const zeus::CColor& GetPowerBombIconAvailableColor() const = 0; + virtual const zeus::CColor& GetBallBombEnergyColor() const = 0; + virtual const zeus::CColor& GetBallBombDecoColor() const = 0; + virtual const zeus::CColor& GetPowerBombDigitDelpetedFont() const = 0; + virtual const zeus::CColor& GetPowerBombDigitDelpetedOutline() const = 0; + virtual const zeus::CColor& GetPowerBombIconDepletedColor() const = 0; + virtual const zeus::CColor& GetScanDisplayImagePaneColor() const = 0; + virtual const zeus::CColor& GetThreatIconWarningColor() const = 0; + virtual const zeus::CColor& GetHudCounterFill() const = 0; + virtual const zeus::CColor& GetHudCounterOutline() const = 0; + virtual const zeus::CColor& GetScanIconCriticalColor() const = 0; + virtual const zeus::CColor& GetScanIconCriticalDimColor() const = 0; + virtual const zeus::CColor& GetScanIconNoncriticalColor() const = 0; + virtual const zeus::CColor& GetScanIconNoncriticalDimColor() const = 0; + virtual const zeus::CColor& GetScanReticuleColor() const = 0; + virtual const zeus::CColor& GetThreatDigitsFont() const = 0; + virtual const zeus::CColor& GetThreatDigitsOutline() const = 0; + virtual const zeus::CColor& GetMissileDigitsFont() const = 0; + virtual const zeus::CColor& GetMissileDigitsOutline() const = 0; + virtual const zeus::CColor& GetThermalDecoColor() const = 0; + virtual const zeus::CColor& GetThermalOutlinesColor() const = 0; + virtual const zeus::CColor& GetThermalLockColor() const = 0; + virtual const zeus::CColor& GetPauseItemAmberColor() const = 0; + virtual const zeus::CColor& GetPauseItemBlueColor() const = 0; + virtual SVisorEnergyInitColors GetVisorEnergyInitColors(int idx) const = 0; + virtual SVisorEnergyBarColors GetVisorEnergyBarColors(int idx) const = 0; +}; +} // namespace DataSpec diff --git a/Runtime/Tweaks/ITweakGunRes.hpp b/Runtime/Tweaks/ITweakGunRes.hpp new file mode 100644 index 000000000..7becd4a99 --- /dev/null +++ b/Runtime/Tweaks/ITweakGunRes.hpp @@ -0,0 +1,142 @@ +#pragma once + +#include + +#include "Runtime/Tweaks/ITweak.hpp" +#include "Runtime/IFactory.hpp" +#include "Runtime/CPlayerState.hpp" + +namespace metaforce::Tweaks { + +struct ITweakGunRes : ITweak { + using ResId = metaforce::CAssetId; + using EBeamId = metaforce::CPlayerState::EBeamId; + + ResId x4_gunMotion; + ResId x8_grappleArm; + ResId xc_rightHand; + + ResId x10_powerBeam; + ResId x14_iceBeam; + ResId x18_waveBeam; + ResId x1c_plasmaBeam; + ResId x20_phazonBeam; + + ResId x24_holoTransition; + + ResId x28_bombSet; + ResId x2c_bombExplode; + ResId x30_powerBombExplode; + + /* Power, Ice, Wave, Plasma, Phazon / Beam, Ball */ + using WeaponPair = std::array; + std::array x34_weapons; + std::array x84_muzzle; + std::array x94_charge; + std::array xa4_auxMuzzle; + + ResId xb4_grappleSegment; + ResId xb8_grappleClaw; + ResId xbc_grappleHit; + ResId xc0_grappleMuzzle; + ResId xc4_grappleSwoosh; + + ResId GetBeamModel(EBeamId beam) const { + auto b = int(beam); + if (b < 0 || b > 4) + b = 0; + switch (EBeamId(b)) { + default: + case EBeamId::Power: + return x10_powerBeam; + case EBeamId::Ice: + return x14_iceBeam; + case EBeamId::Wave: + return x18_waveBeam; + case EBeamId::Plasma: + return x1c_plasmaBeam; + case EBeamId::Phazon: + return x20_phazonBeam; + } + } + + const WeaponPair& GetWeaponPair(EBeamId beam) const { + const auto b = int(beam); + if (b < 0 || b > 4) { + return x34_weapons[0]; + } + return x34_weapons[b]; + } + + void ResolveResources(const metaforce::IFactory& factory) { + x4_gunMotion = factory.GetResourceIdByName(GetGunMotion())->id; + x8_grappleArm = factory.GetResourceIdByName(GetGrappleArm())->id; + xc_rightHand = factory.GetResourceIdByName(GetRightHand())->id; + + x10_powerBeam = factory.GetResourceIdByName(GetPowerBeam())->id; + x14_iceBeam = factory.GetResourceIdByName(GetIceBeam())->id; + x18_waveBeam = factory.GetResourceIdByName(GetWaveBeam())->id; + x1c_plasmaBeam = factory.GetResourceIdByName(GetPlasmaBeam())->id; + x20_phazonBeam = factory.GetResourceIdByName(GetPhazonBeam())->id; + + x24_holoTransition = factory.GetResourceIdByName(GetHoloTransition())->id; + + x28_bombSet = factory.GetResourceIdByName(GetBombSet())->id; + x2c_bombExplode = factory.GetResourceIdByName(GetBombExplode())->id; + x30_powerBombExplode = factory.GetResourceIdByName(GetPowerBombExplode())->id; + + for (size_t i = 0; i < x34_weapons.size(); ++i) { + for (size_t j = 0; j < x34_weapons[i].size(); ++j) { + x34_weapons[i][j] = factory.GetResourceIdByName(GetWeapon(i, j != 0))->id; + } + } + + for (size_t i = 0; i < x84_muzzle.size(); ++i) { + x84_muzzle[i] = factory.GetResourceIdByName(GetMuzzleParticle(i))->id; + } + + for (size_t i = 0; i < x94_charge.size(); ++i) { + x94_charge[i] = factory.GetResourceIdByName(GetChargeParticle(i))->id; + } + + for (size_t i = 0; i < xa4_auxMuzzle.size(); ++i) { + xa4_auxMuzzle[i] = factory.GetResourceIdByName(GetAuxMuzzleParticle(i))->id; + } + + xb4_grappleSegment = factory.GetResourceIdByName(GetGrappleSegmentParticle())->id; + xb8_grappleClaw = factory.GetResourceIdByName(GetGrappleClawParticle())->id; + xbc_grappleHit = factory.GetResourceIdByName(GetGrappleHitParticle())->id; + xc0_grappleMuzzle = factory.GetResourceIdByName(GetGrappleMuzzleParticle())->id; + xc4_grappleSwoosh = factory.GetResourceIdByName(GetGrappleSwooshParticle())->id; + } + +protected: + virtual const std::string& GetGunMotion() const = 0; + virtual const std::string& GetGrappleArm() const = 0; + virtual const std::string& GetRightHand() const = 0; + + virtual const std::string& GetPowerBeam() const = 0; + virtual const std::string& GetIceBeam() const = 0; + virtual const std::string& GetWaveBeam() const = 0; + virtual const std::string& GetPlasmaBeam() const = 0; + virtual const std::string& GetPhazonBeam() const = 0; + + virtual const std::string& GetHoloTransition() const = 0; + + virtual const std::string& GetBombSet() const = 0; + virtual const std::string& GetBombExplode() const = 0; + virtual const std::string& GetPowerBombExplode() const = 0; + + virtual const std::string& GetWeapon(size_t idx, bool ball) const = 0; + virtual const std::string& GetMuzzleParticle(size_t idx) const = 0; + virtual const std::string& GetChargeParticle(size_t idx) const = 0; + virtual const std::string& GetAuxMuzzleParticle(size_t idx) const = 0; + + virtual const std::string& GetGrappleSegmentParticle() const = 0; + virtual const std::string& GetGrappleClawParticle() const = 0; + virtual const std::string& GetGrappleHitParticle() const = 0; + virtual const std::string& GetGrappleMuzzleParticle() const = 0; + virtual const std::string& GetGrappleSwooshParticle() const = 0; +}; + +} // namespace metaforce diff --git a/Runtime/Tweaks/ITweakParticle.hpp b/Runtime/Tweaks/ITweakParticle.hpp new file mode 100644 index 000000000..fafb8d838 --- /dev/null +++ b/Runtime/Tweaks/ITweakParticle.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" + +namespace metaforce::Tweaks { + +struct ITweakParticle : ITweak {}; + +} // namespace DataSpec diff --git a/Runtime/Tweaks/ITweakPlayer.hpp b/Runtime/Tweaks/ITweakPlayer.hpp new file mode 100644 index 000000000..c8f487420 --- /dev/null +++ b/Runtime/Tweaks/ITweakPlayer.hpp @@ -0,0 +1,144 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" +#include "zeus/CAABox.hpp" + +namespace metaforce::Tweaks { + +struct ITweakPlayer : ITweak { + virtual float GetMaxTranslationalAcceleration(int s) const = 0; + virtual float GetMaxRotationalAcceleration(int s) const = 0; + virtual float GetPlayerTranslationFriction(int s) const = 0; + virtual float GetPlayerRotationFriction(int s) const = 0; + virtual float GetPlayerRotationMaxSpeed(int s) const = 0; + virtual float GetPlayerTranslationMaxSpeed(int s) const = 0; + virtual float GetNormalGravAccel() const = 0; + virtual float GetFluidGravAccel() const = 0; + virtual float GetVerticalJumpAccel() const = 0; + virtual float GetHorizontalJumpAccel() const = 0; + virtual float GetVerticalDoubleJumpAccel() const = 0; + virtual float GetHorizontalDoubleJumpAccel() const = 0; + virtual float GetWaterJumpFactor() const = 0; + virtual float GetWaterBallJumpFactor() const = 0; + virtual float GetLavaJumpFactor() const = 0; + virtual float GetLavaBallJumpFactor() const = 0; + virtual float GetPhazonJumpFactor() const = 0; + virtual float GetPhazonBallJumpFactor() const = 0; + virtual float GetAllowedJumpTime() const = 0; + virtual float GetAllowedDoubleJumpTime() const = 0; + virtual float GetMinDoubleJumpWindow() const = 0; + virtual float GetMaxDoubleJumpWindow() const = 0; + virtual float GetMinJumpTime() const = 0; + virtual float GetMinDoubleJumpTime() const = 0; + virtual float GetAllowedLedgeTime() const = 0; + virtual float GetDoubleJumpImpulse() const = 0; + virtual float GetBackwardsForceMultiplier() const = 0; + virtual float GetBombJumpRadius() const = 0; + virtual float GetBombJumpHeight() const = 0; + virtual float GetEyeOffset() const = 0; + virtual float GetTurnSpeedMultiplier() const = 0; + virtual float GetFreeLookTurnSpeedMultiplier() const = 0; + virtual float GetFreeLookSpeed() const = 0; + virtual float GetFreeLookSnapSpeed() const = 0; + virtual float GetFreeLookCenteredThresholdAngle() const = 0; + virtual float GetFreeLookCenteredTime() const = 0; + virtual float GetOrbitModeTimer() const = 0; + virtual float GetOrbitUpperAngle() const = 0; + virtual float GetOrbitLowerAngle() const = 0; + virtual float GetOrbitHorizAngle() const = 0; + virtual float GetOrbitMaxTargetDistance() const = 0; + virtual float GetOrbitMaxLockDistance() const = 0; + virtual float GetOrbitDistanceThreshold() const = 0; + virtual u32 GetOrbitScreenBoxHalfExtentX(int zone) const = 0; + virtual u32 GetOrbitScreenBoxHalfExtentY(int zone) const = 0; + virtual u32 GetOrbitScreenBoxCenterX(int zone) const = 0; + virtual u32 GetOrbitScreenBoxCenterY(int zone) const = 0; + virtual u32 GetOrbitZoneIdealX(int zone) const = 0; + virtual u32 GetOrbitZoneIdealY(int zone) const = 0; + virtual float GetOrbitNearX() const = 0; + virtual float GetOrbitNearZ() const = 0; + virtual float GetOrbitFixedOffsetZDiff() const = 0; + virtual float GetOrbitZRange() const = 0; + virtual bool GetDashEnabled() const = 0; + virtual bool GetDashOnButtonRelease() const = 0; + virtual float GetDashButtonHoldCancelTime() const = 0; + virtual float GetDashStrafeInputThreshold() const = 0; + virtual float GetSidewaysDoubleJumpImpulse() const = 0; + virtual float GetSidewaysVerticalDoubleJumpAccel() const = 0; + virtual float GetSidewaysHorizontalDoubleJumpAccel() const = 0; + virtual float GetScanningRange() const = 0; // x218 + virtual bool GetScanRetention() const = 0; + virtual bool GetScanFreezesGame() const = 0; // x21c_25 + virtual bool GetOrbitWhileScanning() const = 0; + virtual bool GetFallingDoubleJump() const = 0; + virtual bool GetImpulseDoubleJump() const = 0; + virtual bool GetFiringCancelsCameraPitch() const = 0; + virtual bool GetAssistedAimingIgnoreHorizontal() const = 0; + virtual bool GetAssistedAimingIgnoreVertical() const = 0; + virtual float GetAimMaxDistance() const = 0; + virtual float GetAimThresholdDistance() const = 0; + virtual float GetAimBoxWidth() const = 0; + virtual float GetAimBoxHeight() const = 0; + virtual float GetAimTargetTimer() const = 0; + virtual float GetAimAssistHorizontalAngle() const = 0; + virtual float GetAimAssistVerticalAngle() const = 0; + virtual float GetScanMaxTargetDistance() const = 0; + virtual float GetScanMaxLockDistance() const = 0; + virtual bool GetMoveDuringFreeLook() const = 0; + virtual bool GetHoldButtonsForFreeLook() const = 0; + virtual bool GetTwoButtonsForFreeLook() const = 0; + virtual bool GetAimWhenOrbitingPoint() const = 0; + virtual bool GetStayInFreeLookWhileFiring() const = 0; + virtual bool GetOrbitFixedOffset() const = 0; + virtual bool GetGunButtonTogglesHolster() const = 0; + virtual bool GetGunNotFiringHolstersGun() const = 0; + virtual float GetPlayerHeight() const = 0; // x26c + virtual float GetPlayerXYHalfExtent() const = 0; // x270 + virtual bool GetFreeLookTurnsPlayer() const = 0; // x228_24 + virtual float GetStepUpHeight() const = 0; // x274 + virtual float GetStepDownHeight() const = 0; // x278 + virtual float GetPlayerBallHalfExtent() const = 0; // x27c + virtual float GetOrbitDistanceMax() const = 0; + virtual float GetGrappleSwingLength() const = 0; + virtual float GetGrappleSwingPeriod() const = 0; + virtual float GetGrapplePullSpeedMin() const = 0; + virtual float GetMaxGrappleLockedTurnAlignDistance() const = 0; + virtual float GetGrapplePullSpeedProportion() const = 0; + virtual float GetGrapplePullSpeedMax() const = 0; + virtual float GetGrappleLookCenterSpeed() const = 0; + virtual float GetMaxGrappleTurnSpeed() const = 0; + virtual float GetGrappleJumpForce() const = 0; + virtual float GetGrappleReleaseTime() const = 0; + virtual u32 GetGrappleJumpMode() const = 0; + virtual bool GetOrbitReleaseBreaksGrapple() const = 0; + virtual bool GetInvertGrappleTurn() const = 0; + virtual float GetGrappleBeamSpeed() const = 0; + virtual float GetGrappleBeamXWaveAmplitude() const = 0; + virtual float GetGrappleBeamZWaveAmplitude() const = 0; + virtual float GetGrappleBeamAnglePhaseDelta() const = 0; + virtual float GetHorizontalFreeLookAngleVel() const = 0; + virtual float GetVerticalFreeLookAngleVel() const = 0; // x134 + virtual float GetOrbitCameraSpeed() const = 0; // x184 + virtual float GetOrbitPreventionTime() const = 0; + virtual float GetJumpCameraPitchDownStart() const = 0; // x288 + virtual float GetJumpCameraPitchDownFull() const = 0; // x28c + virtual float GetJumpCameraPitchDownAngle() const = 0; // x290 + virtual float GetFallCameraPitchDownStart() const = 0; // x294 + virtual float GetFallCameraPitchDownFull() const = 0; // x298 + virtual float GetFallCameraPitchDownAngle() const = 0; // x29c + virtual float GetFirstPersonCameraSpeed() const = 0; // x280 + virtual float GetGrappleCameraSpeed() const = 0; // x2b0 + virtual float GetFreeLookDampenFactor() const = 0; // x14c + virtual float GetLeftLogicalThreshold() const = 0; + virtual float GetRightLogicalThreshold() const = 0; + virtual float GetOrbitMinDistance(int type) const = 0; + virtual float GetOrbitNormalDistance(int type) const = 0; + virtual float GetOrbitMaxDistance(int type) const = 0; + virtual float GetFrozenTimeout() const = 0; + virtual u32 GetIceBreakJumpCount() const = 0; + virtual float GetVariaDamageReduction() const = 0; + virtual float GetGravityDamageReduction() const = 0; + virtual float GetPhazonDamageReduction() const = 0; +}; + +} // namespace DataSpec diff --git a/Runtime/Tweaks/ITweakPlayerControl.hpp b/Runtime/Tweaks/ITweakPlayerControl.hpp new file mode 100644 index 000000000..9f55d6083 --- /dev/null +++ b/Runtime/Tweaks/ITweakPlayerControl.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" +#include "Runtime/Input/ControlMapper.hpp" + +namespace metaforce::Tweaks { + +struct ITweakPlayerControl : ITweak { + [[nodiscard]] virtual ControlMapper::EFunctionList GetMapping(atUint32) const = 0; +}; + +} // namespace DataSpec diff --git a/Runtime/Tweaks/ITweakPlayerGun.cpp b/Runtime/Tweaks/ITweakPlayerGun.cpp new file mode 100644 index 000000000..8148f573b --- /dev/null +++ b/Runtime/Tweaks/ITweakPlayerGun.cpp @@ -0,0 +1,14 @@ +#include "Runtime/Tweaks/ITweakPlayerGun.hpp" +#include "Runtime/Streams/IOStreams.hpp" + +namespace metaforce { +SShotParam::SShotParam(CInputStream& in) +: x0_weaponType(in.ReadLong()) +, x8_damage(in.ReadFloat()) +, xc_radiusDamage(in.ReadFloat()) +, x10_radius(in.ReadFloat()) +, x14_knockback(in.ReadFloat()) {} + +SWeaponInfo::SWeaponInfo(CInputStream& in) +: x0_coolDown(in.ReadFloat()), x4_normal(in.Get()), x20_charged(in.Get()) {} +} // namespace metaforce \ No newline at end of file diff --git a/Runtime/Tweaks/ITweakPlayerGun.hpp b/Runtime/Tweaks/ITweakPlayerGun.hpp new file mode 100644 index 000000000..ac0e384ba --- /dev/null +++ b/Runtime/Tweaks/ITweakPlayerGun.hpp @@ -0,0 +1,73 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" + +namespace metaforce { +/* Same as CDamageInfo */ +struct SShotParam { + atInt32 x0_weaponType = -1; + bool x4_24_charged : 1; + bool x4_25_combo : 1; + bool x4_26_instaKill : 1; + float x8_damage = 0.f; + float xc_radiusDamage = 0.f; + float x10_radius = 0.f; + float x14_knockback = 0.f; + bool x18_24_noImmunity : 1; + SShotParam() { + x4_24_charged = false; + x4_25_combo = false; + x4_26_instaKill = false; + x18_24_noImmunity = false; + } + explicit SShotParam(CInputStream& in); +}; + +struct SComboShotParam : SShotParam { + SComboShotParam() { x4_25_combo = true; } + explicit SComboShotParam(CInputStream& in) : SShotParam(in) { x4_25_combo = true; } +}; + +struct SChargedShotParam : SShotParam { + SChargedShotParam() { x4_24_charged = true; } + explicit SChargedShotParam(CInputStream& in) : SShotParam(in) { x4_24_charged = true; } +}; + +struct SWeaponInfo { + float x0_coolDown = 0.1f; + SShotParam x4_normal; + SChargedShotParam x20_charged; + SWeaponInfo() = default; + explicit SWeaponInfo(CInputStream& in); +}; + +namespace Tweaks { +struct ITweakPlayerGun : ITweak { + virtual float GetUpLookAngle() const = 0; + virtual float GetDownLookAngle() const = 0; + virtual float GetVerticalSpread() const = 0; + virtual float GetHorizontalSpread() const = 0; + virtual float GetHighVerticalSpread() const = 0; + virtual float GetHighHorizontalSpread() const = 0; + virtual float GetLowVerticalSpread() const = 0; + virtual float GetLowHorizontalSpread() const = 0; + virtual float GetAimVerticalSpeed() const = 0; // x24 + virtual float GetAimHorizontalSpeed() const = 0; // x28 + virtual float GetBombFuseTime() const = 0; // x2c + virtual float GetBombDropDelayTime() const = 0; // x30 + virtual float GetHoloHoldTime() const = 0; // x34 + virtual float GetGunTransformTime() const = 0; // x38 + virtual float GetGunHolsterTime() const = 0; + virtual float GetGunNotFiringTime() const = 0; + virtual float GetFixedVerticalAim() const = 0; + virtual float GetGunExtendDistance() const = 0; + virtual const zeus::CVector3f& GetGunPosition() const = 0; + virtual const zeus::CVector3f& GetGrapplingArmPosition() const = 0; + virtual float GetRichochetDamage(atUint32) const = 0; + virtual const SWeaponInfo& GetBeamInfo(atInt32 beam) const = 0; + virtual const SComboShotParam& GetComboShotInfo(atInt32 beam) const = 0; + virtual const SShotParam& GetBombInfo() const = 0; + virtual const SShotParam& GetPowerBombInfo() const = 0; +}; +} // namespace Tweaks +} // namespace metaforce diff --git a/Runtime/Tweaks/ITweakPlayerRes.hpp b/Runtime/Tweaks/ITweakPlayerRes.hpp new file mode 100644 index 000000000..2a09913cf --- /dev/null +++ b/Runtime/Tweaks/ITweakPlayerRes.hpp @@ -0,0 +1,176 @@ +#pragma once + +#include + +#include "Runtime/Tweaks/ITweak.hpp" +#include "Runtime/IFactory.hpp" +#include "Runtime/CPlayerState.hpp" + +namespace metaforce::Tweaks { + +struct ITweakPlayerRes : ITweak { + using ResId = metaforce::CAssetId; + using EBeamId = metaforce::CPlayerState::EBeamId; + + ResId x4_saveStationIcon; + ResId x8_missileStationIcon; + ResId xc_elevatorIcon; + + ResId x10_minesBreakFirstTopIcon; + ResId x14_minesBreakFirstBottomIcon; + ResId x18_minesBreakSecondTopIcon; + ResId x1c_minesBreakSecondBottomIcon; + + ResId rs5_mapArrowUp; + ResId rs5_mapArrowDown; + + /* N, U, UL, L, DL, D, DR, R, UR */ + std::array x24_lStick; + std::array x4c_cStick; + + /* Out, In */ + std::array x74_lTrigger; + std::array x80_rTrigger; + std::array x8c_startButton; + std::array x98_aButton; + std::array xa4_bButton; + std::array xb0_xButton; + std::array xbc_yButton; + + ResId xc4_ballTransitionsANCS; + + /* Power, Ice, Wave, Plasma, Phazon */ + std::array xc8_ballTransitions; + std::array xdc_cineGun; + + float xf0_cinematicMoveOutofIntoPlayerDistance; + + ResId GetBeamBallTransitionModel(EBeamId beam) const { + auto b = size_t(beam); + if (b >= xc8_ballTransitions.size()) { + b = 0; + } + switch (EBeamId(b)) { + case EBeamId::Power: + default: + return xc8_ballTransitions[0]; + case EBeamId::Ice: + return xc8_ballTransitions[1]; + case EBeamId::Wave: + return xc8_ballTransitions[2]; + case EBeamId::Plasma: + return xc8_ballTransitions[3]; + case EBeamId::Phazon: + return xc8_ballTransitions[4]; + } + } + + ResId GetBeamCineModel(EBeamId beam) const { + auto b = size_t(beam); + if (b >= xdc_cineGun.size()) { + b = 0; + } + switch (EBeamId(b)) { + case EBeamId::Power: + default: + return xdc_cineGun[0]; + case EBeamId::Ice: + return xdc_cineGun[1]; + case EBeamId::Wave: + return xdc_cineGun[2]; + case EBeamId::Plasma: + return xdc_cineGun[3]; + case EBeamId::Phazon: + return xdc_cineGun[4]; + } + } + + void ResolveResources(const metaforce::IFactory& factory) { + x4_saveStationIcon = factory.GetResourceIdByName(_GetSaveStationIcon())->id; + x8_missileStationIcon = factory.GetResourceIdByName(_GetMissileStationIcon())->id; + xc_elevatorIcon = factory.GetResourceIdByName(_GetElevatorIcon())->id; + + x10_minesBreakFirstTopIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon())->id; + x14_minesBreakFirstBottomIcon = factory.GetResourceIdByName(_GetMinesBreakFirstBottomIcon())->id; + x18_minesBreakSecondTopIcon = factory.GetResourceIdByName(_GetMinesBreakSecondTopIcon())->id; + x1c_minesBreakSecondBottomIcon = factory.GetResourceIdByName(_GetMinesBreakSecondBottomIcon())->id; + + for (size_t i = 0; i < x24_lStick.size(); ++i) { + x24_lStick[i] = factory.GetResourceIdByName(_GetLStick(i))->id; + } + + for (size_t i = 0; i < x4c_cStick.size(); ++i) { + x4c_cStick[i] = factory.GetResourceIdByName(_GetCStick(i))->id; + } + + for (size_t i = 0; i < x74_lTrigger.size(); ++i) { + x74_lTrigger[i] = factory.GetResourceIdByName(_GetLTrigger(i))->id; + } + + for (size_t i = 0; i < x80_rTrigger.size(); ++i) { + x80_rTrigger[i] = factory.GetResourceIdByName(_GetRTrigger(i))->id; + } + + for (size_t i = 0; i < x8c_startButton.size(); ++i) { + x8c_startButton[i] = factory.GetResourceIdByName(_GetStartButton(i))->id; + } + + for (size_t i = 0; i < x98_aButton.size(); ++i) { + x98_aButton[i] = factory.GetResourceIdByName(_GetAButton(i))->id; + } + + for (size_t i = 0; i < xa4_bButton.size(); ++i) { + xa4_bButton[i] = factory.GetResourceIdByName(_GetBButton(i))->id; + } + + for (size_t i = 0; i < xb0_xButton.size(); ++i) { + xb0_xButton[i] = factory.GetResourceIdByName(_GetXButton(i))->id; + } + + for (size_t i = 0; i < xbc_yButton.size(); ++i) { + xbc_yButton[i] = factory.GetResourceIdByName(_GetYButton(i))->id; + } + + xc4_ballTransitionsANCS = factory.GetResourceIdByName(_GetBallTransitionsANCS())->id; + + for (size_t i = 0; i < xc8_ballTransitions.size(); ++i) { + xc8_ballTransitions[i] = factory.GetResourceIdByName(_GetBallTransitionBeamRes(i))->id; + } + + for (size_t i = 0; i < xdc_cineGun.size(); ++i) { + xdc_cineGun[i] = factory.GetResourceIdByName(_GetBeamCineModel(i))->id; + } + + xf0_cinematicMoveOutofIntoPlayerDistance = _GetCinematicMoveOutofIntoPlayerDistance(); + } + +protected: + virtual std::string_view _GetSaveStationIcon() const = 0; + virtual std::string_view _GetMissileStationIcon() const = 0; + virtual std::string_view _GetElevatorIcon() const = 0; + + virtual std::string_view _GetMinesBreakFirstTopIcon() const = 0; + virtual std::string_view _GetMinesBreakFirstBottomIcon() const = 0; + virtual std::string_view _GetMinesBreakSecondTopIcon() const = 0; + virtual std::string_view _GetMinesBreakSecondBottomIcon() const = 0; + + virtual std::string_view _GetLStick(size_t idx) const = 0; + virtual std::string_view _GetCStick(size_t idx) const = 0; + + virtual std::string_view _GetLTrigger(size_t idx) const = 0; + virtual std::string_view _GetRTrigger(size_t idx) const = 0; + virtual std::string_view _GetStartButton(size_t idx) const = 0; + virtual std::string_view _GetAButton(size_t idx) const = 0; + virtual std::string_view _GetBButton(size_t idx) const = 0; + virtual std::string_view _GetXButton(size_t idx) const = 0; + virtual std::string_view _GetYButton(size_t idx) const = 0; + + virtual std::string_view _GetBallTransitionsANCS() const = 0; + + virtual std::string_view _GetBallTransitionBeamRes(size_t idx) const = 0; + virtual std::string_view _GetBeamCineModel(size_t idx) const = 0; + + virtual float _GetCinematicMoveOutofIntoPlayerDistance() const = 0; +}; + +} // namespace DataSpec diff --git a/Runtime/Tweaks/ITweakSlideShow.hpp b/Runtime/Tweaks/ITweakSlideShow.hpp new file mode 100644 index 000000000..4f9f8080d --- /dev/null +++ b/Runtime/Tweaks/ITweakSlideShow.hpp @@ -0,0 +1,15 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" + +namespace metaforce::Tweaks { + +struct ITweakSlideShow : ITweak { + virtual std::string_view GetFont() const = 0; + virtual const zeus::CColor& GetFontColor() const = 0; + virtual const zeus::CColor& GetOutlineColor() const = 0; + virtual float GetScanPercentInterval() const = 0; + virtual float GetX54() const = 0; +}; + +} // namespace DataSpec diff --git a/Runtime/Tweaks/ITweakTargeting.hpp b/Runtime/Tweaks/ITweakTargeting.hpp new file mode 100644 index 000000000..03510f9a0 --- /dev/null +++ b/Runtime/Tweaks/ITweakTargeting.hpp @@ -0,0 +1,96 @@ +#pragma once + +#include "Runtime/Tweaks/ITweak.hpp" + +namespace metaforce::Tweaks { +struct ITweakTargeting : public ITweak { + virtual atUint32 GetTargetRadiusMode() const = 0; + virtual float GetCurrLockOnExitDuration() const = 0; + virtual float GetCurrLockOnEnterDuration() const = 0; + virtual float GetCurrLockOnSwitchDuration() const = 0; + virtual float GetLockConfirmScale() const = 0; + virtual float GetNextLockOnEnterDuration() const = 0; + virtual float GetNextLockOnExitDuration() const = 0; + virtual float GetNextLockOnSwitchDuration() const = 0; + virtual float GetSeekerScale() const = 0; + virtual float GetSeekerAngleSpeed() const = 0; + virtual float GetXRayRetAngleSpeed() const = 0; + virtual float GetOrbitPointZOffset() const = 0; + virtual float GetOrbitPointInTime() const = 0; + virtual float GetOrbitPointOutTime() const = 0; + virtual const zeus::CColor& GetThermalReticuleColor() const = 0; + virtual float GetTargetFlowerScale() const = 0; + virtual const zeus::CColor& GetTargetFlowerColor() const = 0; + virtual float GetMissileBracketDuration() const = 0; + virtual float GetMissileBracketScaleStart() const = 0; + virtual float GetMissileBracketScaleEnd() const = 0; + virtual float GetMissileBracketScaleDuration() const = 0; + virtual const zeus::CColor& GetMissileBracketColor() const = 0; + virtual float GetChargeGaugeOvershootOffset() const = 0; + virtual float GetChargeGaugeOvershootDuration() const = 0; + virtual float GetOuterBeamSquaresScale() const = 0; + virtual const zeus::CColor& GetOuterBeamSquareColor() const = 0; + virtual float GetLockonDuration() const = 0; + virtual float GetInnerBeamScale() const = 0; + virtual const zeus::CColor& GetInnerBeamColorPower() const = 0; + virtual const zeus::CColor& GetInnerBeamColorIce() const = 0; + virtual const zeus::CColor& GetInnerBeamColorWave() const = 0; + virtual const zeus::CColor& GetInnerBeamColorPlasma() const = 0; + virtual const float* GetOuterBeamSquareAngles(int i) const = 0; + virtual float GetChargeGaugeAngle(int i) const = 0; + virtual float GetChargeGaugeScale() const = 0; + virtual const zeus::CColor& GetChargeGaugeNonFullColor() const = 0; + virtual atUint32 GetChargeTickCount() const = 0; + virtual float GetChargeTickAnglePitch() const = 0; + virtual float GetLockFireScale() const = 0; + virtual float GetLockFireDuration() const = 0; + virtual const zeus::CColor& GetLockFireColor() const = 0; + virtual float GetLockDaggerScaleStart() const = 0; + virtual float GetLockDaggerScaleEnd() const = 0; + virtual const zeus::CColor& GetLockDaggerColor() const = 0; + virtual float GetLockDaggerAngle0() const = 0; + virtual float GetLockDaggerAngle1() const = 0; + virtual float GetLockDaggerAngle2() const = 0; + virtual const zeus::CColor& GetLockConfirmColor() const = 0; + virtual const zeus::CColor& GetSeekerColor() const = 0; + virtual float GetLockConfirmClampMin() const = 0; + virtual float GetLockConfirmClampMax() const = 0; + virtual float GetTargetFlowerClampMin() const = 0; + virtual float GetTargetFlowerClampMax() const = 0; + virtual float GetSeekerClampMin() const = 0; + virtual float GetSeekerClampMax() const = 0; + virtual float GetMissileBracketClampMin() const = 0; + virtual float GetMissileBracketClampMax() const = 0; + virtual float GetInnerBeamClampMin() const = 0; + virtual float GetInnerBeamClampMax() const = 0; + virtual float GetChargeGaugeClampMin() const = 0; + virtual float GetChargeGaugeClampMax() const = 0; + virtual float GetLockFireClampMin() const = 0; + virtual float GetLockFireClampMax() const = 0; + virtual float GetLockDaggerClampMin() const = 0; + virtual float GetLockDaggerClampMax() const = 0; + virtual float GetGrappleSelectScale() const = 0; + virtual float GetGrappleScale() const = 0; + virtual float GetGrappleClampMin() const = 0; + virtual float GetGrappleClampMax() const = 0; + virtual const zeus::CColor& GetGrapplePointSelectColor() const = 0; + virtual const zeus::CColor& GetGrapplePointColor() const = 0; + virtual const zeus::CColor& GetLockedGrapplePointSelectColor() const = 0; + virtual float GetGrappleMinClampScale() const = 0; + virtual const zeus::CColor& GetChargeGaugePulseColorHigh() const = 0; + virtual float GetFullChargeFadeDuration() const = 0; + virtual const zeus::CColor& GetOrbitPointColor() const = 0; + virtual const zeus::CColor& GetCrosshairsColor() const = 0; + virtual float GetCrosshairsScaleDuration() const = 0; + virtual bool DrawOrbitPoint() const = 0; + virtual const zeus::CColor& GetChargeGaugePulseColorLow() const = 0; + virtual float GetChargeGaugePulsePeriod() const = 0; + virtual float GetReticuleClampMin() const = 0; + virtual float GetReticuleClampMax() const = 0; + virtual const zeus::CColor& GetXRayRetRingColor() const = 0; + virtual float GetReticuleScale() const = 0; + virtual float GetScanTargetClampMin() const = 0; + virtual float GetScanTargetClampMax() const = 0; + virtual float GetAngularLagSpeed() const = 0; +}; +} // namespace DataSpec diff --git a/Runtime/Weapon/CBeamInfo.hpp b/Runtime/Weapon/CBeamInfo.hpp index 80426dc45..f3db6fcb6 100644 --- a/Runtime/Weapon/CBeamInfo.hpp +++ b/Runtime/Weapon/CBeamInfo.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/RetroTypes.hpp" #include @@ -34,10 +34,10 @@ public: explicit CBeamInfo(CInputStream& in) : x0_(in.ReadLong()) , x4_beamAttributes(in.ReadLong()) - , x8_contactFxId(in.ReadLong()) - , xc_pulseFxId(in.ReadLong()) - , x10_textureId(in.ReadLong()) - , x14_glowTextureId(in.ReadLong()) + , x8_contactFxId(in) + , xc_pulseFxId(in) + , x10_textureId(in) + , x14_glowTextureId(in) , x18_length(in.ReadFloat()) , x1c_radius(in.ReadFloat()) , x20_expansionSpeed(in.ReadFloat()) diff --git a/Runtime/Weapon/CFlameInfo.hpp b/Runtime/Weapon/CFlameInfo.hpp index 3606f0e43..f2cde66b9 100644 --- a/Runtime/Weapon/CFlameInfo.hpp +++ b/Runtime/Weapon/CFlameInfo.hpp @@ -1,7 +1,7 @@ #pragma once #include "Runtime/Weapon/CGameProjectile.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" namespace metaforce { class CFlameInfo { diff --git a/Runtime/Weapon/CGunWeapon.cpp b/Runtime/Weapon/CGunWeapon.cpp index 7d179c288..100ec9eb6 100644 --- a/Runtime/Weapon/CGunWeapon.cpp +++ b/Runtime/Weapon/CGunWeapon.cpp @@ -565,11 +565,11 @@ CDamageInfo CGunWeapon::GetDamageInfo(CStateManager& mgr, EChargeState chargeSta return GetShotDamageInfo(wInfo.x4_normal, mgr); } else { SShotParam param = wInfo.x20_charged; - param.damage *= chargeFactor; - param.radiusDamage *= chargeFactor; - param.radius *= chargeFactor; - param.knockback *= chargeFactor; - param.noImmunity = false; + param.x8_damage *= chargeFactor; + param.xc_radiusDamage *= chargeFactor; + param.x10_radius *= chargeFactor; + param.x14_knockback *= chargeFactor; + param.x18_24_noImmunity = false; return GetShotDamageInfo(param, mgr); } } diff --git a/Runtime/Weapon/CGunWeapon.hpp b/Runtime/Weapon/CGunWeapon.hpp index 39ab12f20..6a2fa3aae 100644 --- a/Runtime/Weapon/CGunWeapon.hpp +++ b/Runtime/Weapon/CGunWeapon.hpp @@ -9,7 +9,6 @@ #include "Runtime/CPlayerState.hpp" #include "Runtime/CStateManager.hpp" #include "Runtime/CToken.hpp" -#include "Runtime/rstl.hpp" #include "Runtime/Character/CAnimCharacterSet.hpp" #include "Runtime/Collision/CMaterialList.hpp" #include "Runtime/Particle/CElementGen.hpp" @@ -19,6 +18,7 @@ #include "Runtime/Weapon/CWeaponMgr.hpp" #include "Runtime/Weapon/WeaponCommon.hpp" #include "Runtime/World/CDamageInfo.hpp" +#include "Runtime/rstl.hpp" #include @@ -29,10 +29,6 @@ struct CModelFlags; enum class EChargeState { Normal, Charged }; -using SWeaponInfo = DataSpec::SWeaponInfo; -using SShotParam = DataSpec::SShotParam; -using SChargedShotParam = DataSpec::SChargedShotParam; - class CVelocityInfo { friend class CGunWeapon; rstl::reserved_vector x0_vel; diff --git a/Runtime/Weapon/CPowerBomb.cpp b/Runtime/Weapon/CPowerBomb.cpp index 472aeeb7f..f90883520 100644 --- a/Runtime/Weapon/CPowerBomb.cpp +++ b/Runtime/Weapon/CPowerBomb.cpp @@ -56,7 +56,7 @@ void CPowerBomb::Think(float dt, CStateManager& mgr) { CWeapon::Think(dt, mgr); if (x158_24_canStartFilter) { if (x15c_curTime > 1.f && !x158_25_filterEnabled) { - mgr.GetCameraFilterPass(6).SetFilter(EFilterType::Add, EFilterShape::Fullscreen, 1.5f, kFadeColor, -1); + mgr.GetCameraFilterPass(6).SetFilter(EFilterType::Add, EFilterShape::Fullscreen, 1.5f, kFadeColor, {}); x158_25_filterEnabled = true; } diff --git a/Runtime/Weapon/WeaponCommon.cpp b/Runtime/Weapon/WeaponCommon.cpp index e20c4bbf9..5c23f3c50 100644 --- a/Runtime/Weapon/WeaponCommon.cpp +++ b/Runtime/Weapon/WeaponCommon.cpp @@ -19,8 +19,8 @@ void primitive_set_to_token_vector(const CAnimData& animData, const std::set #include -#include "DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp" +#include "Runtime/Tweaks/ITweakPlayerGun.hpp" #include "Runtime/CPlayerState.hpp" #include "Runtime/RetroTypes.hpp" diff --git a/Runtime/World/CAnimationParameters.hpp b/Runtime/World/CAnimationParameters.hpp index 9c7de3bd3..310717fb4 100644 --- a/Runtime/World/CAnimationParameters.hpp +++ b/Runtime/World/CAnimationParameters.hpp @@ -1,7 +1,7 @@ #pragma once #include "Runtime/RetroTypes.hpp" -#include "Runtime/CInputStream.hpp" +#include "Runtime/Streams/CInputStream.hpp" namespace metaforce { @@ -15,7 +15,7 @@ public: CAnimationParameters(CAssetId ancs, u32 charIdx, u32 defaultAnim) : x0_ancs(ancs), x4_charIdx(charIdx), x8_defaultAnim(defaultAnim) {} explicit CAnimationParameters(CInputStream& in) - : x0_ancs(in.ReadLong()), x4_charIdx(in.ReadLong()), x8_defaultAnim(in.ReadLong()) {} + : x0_ancs(in.Get()), x4_charIdx(in.ReadLong()), x8_defaultAnim(in.ReadLong()) {} CAssetId GetACSFile() const { return x0_ancs; } u32 GetCharacter() const { return x4_charIdx; } diff --git a/Runtime/World/CDamageInfo.cpp b/Runtime/World/CDamageInfo.cpp index 7e7228173..b1e60fc54 100644 --- a/Runtime/World/CDamageInfo.cpp +++ b/Runtime/World/CDamageInfo.cpp @@ -6,21 +6,22 @@ namespace metaforce { -CDamageInfo::CDamageInfo(const DataSpec::SShotParam& other) -: x0_weaponMode(CWeaponMode(EWeaponType(other.weaponType), other.charged, other.combo, other.instaKill)) -, x8_damage(other.damage) -, xc_radiusDamage(other.radiusDamage) -, x10_radius(other.radius) -, x14_knockback(other.knockback) -, x18_24_noImmunity(other.noImmunity) {} +CDamageInfo::CDamageInfo(const SShotParam& other) +: x0_weaponMode(CWeaponMode(EWeaponType(other.x0_weaponType), other.x4_24_charged, other.x4_25_combo, other.x4_26_instaKill)) +, x8_damage(other.x8_damage) +, xc_radiusDamage(other.xc_radiusDamage) +, x10_radius(other.x10_radius) +, x14_knockback(other.x14_knockback) +, x18_24_noImmunity(other.x18_24_noImmunity) {} -CDamageInfo& CDamageInfo::operator=(const DataSpec::SShotParam& other) { - x0_weaponMode = CWeaponMode(EWeaponType(other.weaponType), other.charged, other.combo, other.instaKill); - x8_damage = other.damage; - xc_radiusDamage = other.radiusDamage; - x10_radius = other.radius; - x14_knockback = other.knockback; - x18_24_noImmunity = other.noImmunity; +CDamageInfo& CDamageInfo::operator=(const SShotParam& other) { + x0_weaponMode = + CWeaponMode(EWeaponType(other.x0_weaponType), other.x4_24_charged, other.x4_25_combo, other.x4_26_instaKill); + x8_damage = other.x8_damage; + xc_radiusDamage = other.xc_radiusDamage; + x10_radius = other.x10_radius; + x14_knockback = other.x14_knockback; + x18_24_noImmunity = other.x18_24_noImmunity; return *this; } diff --git a/Runtime/World/CDamageInfo.hpp b/Runtime/World/CDamageInfo.hpp index 2ea087dbb..c0f568682 100644 --- a/Runtime/World/CDamageInfo.hpp +++ b/Runtime/World/CDamageInfo.hpp @@ -4,11 +4,8 @@ #include "Runtime/Weapon/CWeaponMgr.hpp" #include "Runtime/Weapon/CWeaponMode.hpp" -namespace DataSpec { -struct SShotParam; -} - namespace metaforce { +struct SShotParam; class CDamageVulnerability; class CDamageInfo { CWeaponMode x0_weaponMode; @@ -38,8 +35,8 @@ public: constexpr CDamageInfo& operator=(CDamageInfo&&) = default; CDamageInfo(const CDamageInfo&, float); - explicit CDamageInfo(const DataSpec::SShotParam& other); - CDamageInfo& operator=(const DataSpec::SShotParam& other); + explicit CDamageInfo(const SShotParam& other); + CDamageInfo& operator=(const SShotParam& other); const CWeaponMode& GetWeaponMode() const { return x0_weaponMode; } void SetWeaponMode(const CWeaponMode& mode) { x0_weaponMode = mode; } diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index 8f27f16d1..1f1f040de 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -29,19 +29,19 @@ CAreaRenderOctTree::CAreaRenderOctTree(const u8* buf) : x0_buf(buf) { x30_bitmaps = reinterpret_cast(x0_buf + 64); u32 wc = x14_bitmapWordCount * x8_bitmapCount; for (u32 i = 0; i < wc; ++i) - const_cast(x30_bitmaps)[i] = hecl::SBig(x30_bitmaps[i]); + const_cast(x30_bitmaps)[i] = CBasics::SwapBytes(x30_bitmaps[i]); x34_indirectionTable = x30_bitmaps + wc; x38_entries = reinterpret_cast(x34_indirectionTable + x10_nodeCount); for (u32 i = 0; i < x10_nodeCount; ++i) { - const_cast(x34_indirectionTable)[i] = hecl::SBig(x34_indirectionTable[i]); + const_cast(x34_indirectionTable)[i] = CBasics::SwapBytes(x34_indirectionTable[i]); Node* n = reinterpret_cast(const_cast(x38_entries) + x34_indirectionTable[i]); - n->x0_bitmapIdx = hecl::SBig(n->x0_bitmapIdx); - n->x2_flags = hecl::SBig(n->x2_flags); + n->x0_bitmapIdx = CBasics::SwapBytes(n->x0_bitmapIdx); + n->x2_flags = CBasics::SwapBytes(n->x2_flags); if (n->x2_flags) { u32 childCount = n->GetChildCount(); for (u32 c = 0; c < childCount; ++c) - n->x4_children[c] = hecl::SBig(n->x4_children[c]); + n->x4_children[c] = CBasics::SwapBytes(n->x4_children[c]); } } } @@ -300,10 +300,10 @@ std::pair, s32> GetScriptingMemoryAlways(const IGameArea& } CDummyGameArea::CDummyGameArea(CInputStream& in, int idx, int mlvlVersion) { - x8_nameSTRG = in.ReadLong(); + x8_nameSTRG = in.Get(); x14_transform = in.Get(); zeus::CAABox aabb = in.Get(); - xc_mrea = in.ReadLong(); + xc_mrea = in.Get(); if (mlvlVersion > 15) { x10_areaId = in.ReadLong(); } else { @@ -349,12 +349,12 @@ CAssetId CDummyGameArea::IGetStringTableAssetId() const { return x8_nameSTRG; } const zeus::CTransform& CDummyGameArea::IGetTM() const { return x14_transform; } CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion) : x4_selfIdx(idx) { - x8_nameSTRG = in.ReadLong(); + x8_nameSTRG = in.Get(); xc_transform = in.Get(); x3c_invTransform = xc_transform.inverse(); x6c_aabb = in.Get(); - x84_mrea = in.ReadLong(); + x84_mrea = in.Get(); if (mlvlVersion > 15) x88_areaId = in.ReadLong(); else @@ -717,7 +717,7 @@ bool CGameArea::StartStreamingMainArea() { u32 totalSz = 0; u32 secCount = GetNumPartSizes(); for (u32 i = 0; i < secCount; ++i) - totalSz += hecl::SBig(reinterpret_cast(x110_mreaSecBufs[1].first.get())[i]); + totalSz += CBasics::SwapBytes(reinterpret_cast(x110_mreaSecBufs[1].first.get())[i]); AllocNewAreaData(x128_mreaDataOffset, totalSz); @@ -727,7 +727,7 @@ bool CGameArea::StartStreamingMainArea() { u32 curOff = 0; for (u32 i = 0; i < secCount; ++i) { - u32 size = hecl::SBig(reinterpret_cast(x110_mreaSecBufs[1].first.get())[i]); + u32 size = CBasics::SwapBytes(reinterpret_cast(x110_mreaSecBufs[1].first.get())[i]); m_resolvedBufs.emplace_back(x110_mreaSecBufs[2].first.get() + curOff, size); curOff += size; } @@ -753,7 +753,7 @@ void CGameArea::ReloadAllUnloadedTextures() {} u32 CGameArea::GetNumPartSizes() const { u32 value{}; std::memcpy(&value, x110_mreaSecBufs[0].first.get() + 60, sizeof(u32)); - return hecl::SBig(value); + return CBasics::SwapBytes(value); } void CGameArea::AllocNewAreaData(int offset, int size) { @@ -926,7 +926,7 @@ void CGameArea::PostConstructArea() { /* Models */ x12c_postConstructed->x4c_insts.resize(header.modelCount); for (u32 i = 0; i < header.modelCount; ++i) { - u32 surfCount = hecl::SBig(*reinterpret_cast((secIt + 4)->first)); + u32 surfCount = CBasics::SwapBytes(*reinterpret_cast((secIt + 4)->first)); secIt += 5 + surfCount; sec += 5 + surfCount; } @@ -998,7 +998,7 @@ void CGameArea::PostConstructArea() { /* Pathfinding section */ if (header.version > 9) { CMemoryInStream r(secIt->first, secIt->second, CMemoryInStream::EOwnerShip::NotOwned); - CAssetId pathId = r.ReadLong(); + CAssetId pathId = r.Get(); x12c_postConstructed->x10ac_pathToken = g_SimplePool->GetObj(SObjectTag{FOURCC('PATH'), pathId}); x12c_postConstructed->x10bc_pathArea = x12c_postConstructed->x10ac_pathToken.GetObj(); x12c_postConstructed->x10bc_pathArea->SetTransform(xc_transform); @@ -1081,7 +1081,7 @@ void CGameArea::FillInStaticGeometry(bool textures) { // ibo = ctx.newStaticBuffer(boo::BufferUse::Index, secIt->first, 4, inst.m_hmdlMeta.indexCount); ++secIt; - const u32 surfCount = hecl::SBig(*reinterpret_cast(secIt->first)); + const u32 surfCount = CBasics::SwapBytes(*reinterpret_cast(secIt->first)); inst.m_surfaces.reserve(surfCount); // inst.m_shaders.reserve(surfCount); ++secIt; diff --git a/Runtime/World/CHUDMemoParms.hpp b/Runtime/World/CHUDMemoParms.hpp index 2cd22bc0b..876c0213f 100644 --- a/Runtime/World/CHUDMemoParms.hpp +++ b/Runtime/World/CHUDMemoParms.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" namespace metaforce { diff --git a/Runtime/World/CHealthInfo.cpp b/Runtime/World/CHealthInfo.cpp index 54806ea22..dd027af1a 100644 --- a/Runtime/World/CHealthInfo.cpp +++ b/Runtime/World/CHealthInfo.cpp @@ -1,6 +1,6 @@ #include "Runtime/World/CHealthInfo.hpp" -#include "Runtime/CInputStream.hpp" +#include "Runtime/Streams/CInputStream.hpp" namespace metaforce { CHealthInfo::CHealthInfo(CInputStream& in) { diff --git a/Runtime/World/CPathFindArea.cpp b/Runtime/World/CPathFindArea.cpp index 9829d29b1..525ae61b5 100644 --- a/Runtime/World/CPathFindArea.cpp +++ b/Runtime/World/CPathFindArea.cpp @@ -89,8 +89,9 @@ void CPFOpenList::Clear() { void CPFOpenList::Push(CPFRegion* reg) { x0_bitSet.Add(reg->GetIndex()); CPFRegion* other = x40_region.Data()->GetOpenMore(); - while (other != &x40_region && reg->Data()->GetCost() > other->Data()->GetCost()) + while (other != &x40_region && reg->Data()->GetCost() > other->Data()->GetCost()) { other = other->Data()->GetOpenMore(); + } other->Data()->GetOpenLess()->Data()->SetOpenMore(reg); reg->Data()->SetOpenLess(other->Data()->GetOpenLess()); other->Data()->SetOpenLess(reg); diff --git a/Runtime/World/CPathFindRegion.hpp b/Runtime/World/CPathFindRegion.hpp index 51b5e1416..16cd66657 100644 --- a/Runtime/World/CPathFindRegion.hpp +++ b/Runtime/World/CPathFindRegion.hpp @@ -3,7 +3,7 @@ #include #include "RetroTypes.hpp" -#include "IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include #include diff --git a/Runtime/World/CPatternedInfo.cpp b/Runtime/World/CPatternedInfo.cpp index 57b839d5a..9a18bfdb1 100644 --- a/Runtime/World/CPatternedInfo.cpp +++ b/Runtime/World/CPatternedInfo.cpp @@ -32,7 +32,7 @@ CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount) , xe8_deathSfx(CSfxManager::TranslateSFXID(in.ReadLong())) , xec_animParams(in) , xf8_active(in.ReadBool()) -, xfc_stateMachineId(in.ReadLong()) +, xfc_stateMachineId(in.Get()) , x100_intoFreezeDur(in.ReadFloat()) , x104_outofFreezeDur(in.ReadFloat()) , x108_freezeDur(in.ReadFloat()) diff --git a/Runtime/World/CScriptGunTurret.cpp b/Runtime/World/CScriptGunTurret.cpp index c483bacda..7dc1d397e 100644 --- a/Runtime/World/CScriptGunTurret.cpp +++ b/Runtime/World/CScriptGunTurret.cpp @@ -125,14 +125,14 @@ CScriptGunTurretData::CScriptGunTurretData(CInputStream& in, s32 propCount) , x6c_frozenEffectRes(in.Get()) , x70_chargingEffectRes(in.Get()) , x74_panningEffectRes(in.Get()) -, x78_visorEffectRes(propCount >= 44 ? in.Get() : -1) +, x78_visorEffectRes(propCount >= 44 ? in.Get() : CAssetId()) , x7c_trackingSoundId(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) , x7e_lockOnSoundId(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) , x80_unfreezeSoundId(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) , x82_stopClankSoundId(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) , x84_chargingSoundId(CSfxManager::TranslateSFXID(u16(in.ReadLong()))) , x86_visorSoundId(propCount >= 45 ? CSfxManager::TranslateSFXID(u16(in.ReadLong())) : u16(0xFFFF)) -, x88_extensionModelResId(in.ReadLong()) +, x88_extensionModelResId(in.Get()) , x8c_extensionDropDownDist(in.ReadFloat()) , x90_numInitialShots(in.ReadLong()) , x94_initialShotTableIndex(in.ReadLong()) diff --git a/Runtime/World/CStateMachine.hpp b/Runtime/World/CStateMachine.hpp index b2600f39d..3b9cccd4e 100644 --- a/Runtime/World/CStateMachine.hpp +++ b/Runtime/World/CStateMachine.hpp @@ -4,7 +4,7 @@ #include "Runtime/CToken.hpp" #include "Runtime/GCNTypes.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include "Runtime/IObj.hpp" #include "Runtime/IObjFactory.hpp" #include "Runtime/World/CAiFuncMap.hpp" diff --git a/Runtime/World/CWorld.cpp b/Runtime/World/CWorld.cpp index 36c9d8c8f..cf13f89b1 100644 --- a/Runtime/World/CWorld.cpp +++ b/Runtime/World/CWorld.cpp @@ -117,10 +117,10 @@ bool CDummyWorld::ICheckWorldComplete() { CMemoryInStream r(x34_loadBuf.get(), x38_bufSz, CMemoryInStream::EOwnerShip::NotOwned); r.ReadLong(); int version = r.ReadLong(); - x10_strgId = r.ReadLong(); + x10_strgId = r.Get(); if (version >= 15) - x14_savwId = r.ReadLong(); + x14_savwId = r.Get(); if (version >= 12) r.ReadLong(); if (version >= 17) @@ -133,7 +133,7 @@ bool CDummyWorld::ICheckWorldComplete() { for (u32 i = 0; i < areaCount; ++i) x18_areas.emplace_back(r, i, version); - x28_mapWorldId = r.ReadLong(); + x28_mapWorldId = r.Get(); if (x4_loadMap) x2c_mapWorld = g_SimplePool->GetObj(SObjectTag{FOURCC('MAPW'), x28_mapWorldId}); @@ -306,12 +306,12 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, CAssetId mreaId) CMemoryInStream r(x40_loadBuf.get(), x44_bufSz, CMemoryInStream::EOwnerShip::NotOwned); r.ReadLong(); int version = r.ReadLong(); - xc_strgId = r.ReadLong(); + xc_strgId = r.Get(); if (version >= 15) - x10_savwId = r.ReadLong(); + x10_savwId = r.Get(); if (version >= 12) { - CAssetId skyboxId = r.ReadLong(); + CAssetId skyboxId = r.Get(); if (skyboxId.IsValid() && mgr) x94_skyboxWorld = g_SimplePool->GetObj(SObjectTag{FOURCC('CMDL'), skyboxId}); } @@ -336,7 +336,7 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, CAssetId mreaId) for (std::unique_ptr& area : x18_areas) MoveToChain(area.get(), EChain::Deallocated); - x24_mapwId = r.ReadLong(); + x24_mapwId = r.Get(); x28_mapWorld = g_SimplePool->GetObj(SObjectTag{FOURCC('MAPW'), x24_mapwId}); if (mgr) { @@ -350,7 +350,7 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, CAssetId mreaId) x74_soundGroupData.reserve(audioGroupCount); for (u32 i = 0; i < audioGroupCount; ++i) { int grpId = r.ReadLong(); - CAssetId agscId = r.ReadLong(); + CAssetId agscId = r.Get(); x74_soundGroupData.emplace_back(grpId, agscId); } } @@ -543,7 +543,7 @@ void CWorld::CycleLoadPauseState() { } } -bool CWorld::ICheckWorldComplete() { return CheckWorldComplete(nullptr, kInvalidAreaId, -1); } +bool CWorld::ICheckWorldComplete() { return CheckWorldComplete(nullptr, kInvalidAreaId, {}); } std::string CWorld::IGetDefaultAudioTrack() const { return x84_defAudioTrack; } diff --git a/Runtime/World/CWorldLight.cpp b/Runtime/World/CWorldLight.cpp index 07034b7b6..0a96da65f 100644 --- a/Runtime/World/CWorldLight.cpp +++ b/Runtime/World/CWorldLight.cpp @@ -1,5 +1,5 @@ #include "Runtime/World/CWorldLight.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include diff --git a/Runtime/World/IGameArea.cpp b/Runtime/World/IGameArea.cpp index 283f16f0a..ade7a91cf 100644 --- a/Runtime/World/IGameArea.cpp +++ b/Runtime/World/IGameArea.cpp @@ -1,5 +1,5 @@ #include "Runtime/World/IGameArea.hpp" -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" namespace metaforce { IGameArea::Dock::Dock(metaforce::CInputStream& in, const zeus::CTransform& xf) { diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 235da747c..d5eecdc1f 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -129,7 +129,7 @@ namespace metaforce { static logvisor::Module Log("metaforce::ScriptLoader"); -constexpr SObjectTag MorphballDoorANCS = {FOURCC('ANCS'), 0x1F9DA858}; +constexpr SObjectTag MorphballDoorANCS = {FOURCC('ANCS'), 0x1F9DA858u}; constexpr int skElitePiratePropCount = 41; @@ -221,10 +221,10 @@ CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in) { if (propCount > 5) sParams = LoadScannableParameters(in); - CAssetId xrayModel = in.ReadLong(); - CAssetId xraySkin = in.ReadLong(); - CAssetId infraModel = in.ReadLong(); - CAssetId infraSkin = in.ReadLong(); + CAssetId xrayModel = in.Get(); + CAssetId xraySkin = in.Get(); + CAssetId infraModel = in.Get(); + CAssetId infraSkin = in.Get(); bool globalTimeProvider = true; if (propCount > 7) @@ -290,7 +290,7 @@ CVisorParameters ScriptLoader::LoadVisorParameters(CInputStream& in) { CScannableParameters ScriptLoader::LoadScannableParameters(CInputStream& in) { u32 propCount = in.ReadLong(); if (propCount == 1) - return CScannableParameters(in.ReadLong()); + return CScannableParameters(in.Get()); return CScannableParameters(); } @@ -334,7 +334,7 @@ CLightParameters ScriptLoader::LoadLightParameters(CInputStream& in) { } CAnimationParameters ScriptLoader::LoadAnimationParameters(CInputStream& in) { - CAssetId ancs = in.ReadLong(); + CAssetId ancs = in.Get(); s32 charIdx = in.ReadLong(); u32 defaultAnim = in.ReadLong(); return CAnimationParameters(ancs, charIdx, defaultAnim); @@ -398,7 +398,7 @@ CEntity* ScriptLoader::LoadActor(CStateManager& mgr, CInputStream& in, int propC CDamageVulnerability dVuln(in); - CAssetId staticId = in.ReadLong(); + CAssetId staticId = in.Get(); CAnimationParameters aParms = LoadAnimationParameters(in); CActorParameters actParms = LoadActorParameters(in); @@ -623,7 +623,7 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int pr float speed = in.ReadFloat(); bool active = in.ReadBool(); - CAssetId dclnId = in.ReadLong(); + CAssetId dclnId = in.Get(); CHealthInfo hInfo(in); @@ -896,7 +896,7 @@ CEntity* ScriptLoader::LoadPickup(CStateManager& mgr, CInputStream& in, int prop float possibility = in.ReadFloat(); float lifeTime = in.ReadFloat(); float fadeInTime = in.ReadFloat(); - CAssetId staticModel = in.ReadLong(); + CAssetId staticModel = in.Get(); CAnimationParameters animParms = LoadAnimationParameters(in); CActorParameters actorParms = LoadActorParameters(in); bool active = in.ReadBool(); @@ -983,7 +983,7 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int prop float unused = in.ReadFloat(); CDamageVulnerability tailVuln(in); CDamageVulnerability platingVuln(in); - CAssetId tailModel = in.ReadLong(); + CAssetId tailModel = in.Get(); MP1::CBeetle::EEntranceType entranceType = MP1::CBeetle::EEntranceType(in.ReadLong()); float initialAttackDelay = in.ReadFloat(); float retreatTime = in.ReadFloat(); @@ -1015,7 +1015,7 @@ CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int pro if (propCount == 6) { displayType = CScriptHUDMemo::EDisplayType(in.ReadLong()); } - const CAssetId message = in.ReadLong(); + const CAssetId message = in.Get(); const bool active = in.ReadBool(); return new CScriptHUDMemo(mgr.AllocateUniqueId(), name, info, hParms, displayType, message, active); @@ -1105,9 +1105,9 @@ CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& i CDamageVulnerability dVuln(in); u32 triggerFlags = in.ReadLong(); triggerFlags = TransformDamagableTriggerFlags(mgr, info.GetAreaId(), triggerFlags); - CAssetId patternTex1 = in.ReadLong(); - CAssetId patternTex2 = in.ReadLong(); - CAssetId colorTex = in.ReadLong(); + CAssetId patternTex1 = in.Get(); + CAssetId patternTex2 = in.Get(); + CAssetId colorTex = in.Get(); CScriptDamageableTrigger::ECanOrbit canOrbit = CScriptDamageableTrigger::ECanOrbit(in.ReadBool()); bool active = in.ReadBool(); CVisorParameters vParms = LoadVisorParameters(in); @@ -1128,9 +1128,9 @@ CEntity* ScriptLoader::LoadDebris(CStateManager& mgr, CInputStream& in, int prop const float duration = in.ReadFloat(); const auto scaleType = CScriptDebris::EScaleType(in.ReadLong()); const bool randomAngImpulse = in.ReadBool(); - const CAssetId model = in.ReadLong(); + const CAssetId model = in.Get(); const CActorParameters aParams = LoadActorParameters(in); - const CAssetId particleId = in.ReadLong(); + const CAssetId particleId = in.Get(); const zeus::CVector3f particleScale = in.Get(); const bool b1 = in.ReadBool(); const bool active = in.ReadBool(); @@ -1190,12 +1190,12 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC ETriggerFlags::DetectProjectiles6 | ETriggerFlags::DetectProjectiles7; bool thermalCold = in.ReadBool(); bool displaySurface = in.ReadBool(); - CAssetId patternMap1 = in.ReadLong(); - CAssetId patternMap2 = in.ReadLong(); - CAssetId colorMap = in.ReadLong(); - CAssetId bumpMap = in.ReadLong(); - CAssetId _envMap = in.ReadLong(); - CAssetId _envBumpMap = in.ReadLong(); + CAssetId patternMap1 = in.Get(); + CAssetId patternMap2 = in.Get(); + CAssetId colorMap = in.Get(); + CAssetId bumpMap = in.Get(); + CAssetId _envMap = in.Get(); + CAssetId _envBumpMap = in.Get(); zeus::CVector3f _bumpLightDir =in.Get(); zeus::CVector3f bumpLightDir = _bumpLightDir; @@ -1221,11 +1221,11 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC float turbAmplitudeMin = in.ReadFloat(); zeus::CColor splashColor = in.Get(); zeus::CColor insideFogColor = in.Get(); - CAssetId splashParticle1 = in.ReadLong(); - CAssetId splashParticle2 = in.ReadLong(); - CAssetId splashParticle3 = in.ReadLong(); - CAssetId visorRunoffParticle = in.ReadLong(); - CAssetId unmorphVisorRunoffParticle = in.ReadLong(); + CAssetId splashParticle1 = in.Get(); + CAssetId splashParticle2 = in.Get(); + CAssetId splashParticle3 = in.Get(); + CAssetId visorRunoffParticle = in.Get(); + CAssetId unmorphVisorRunoffParticle = in.Get(); u32 visorRunoffSfx = in.ReadLong(); u32 unmorphVisorRunoffSfx = in.ReadLong(); u32 splashSfx1 = in.ReadLong(); @@ -1242,7 +1242,7 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC float fogMagnitude = in.ReadFloat(); float fogSpeed = in.ReadFloat(); zeus::CColor fogColor = in.Get(); - CAssetId lightmap = in.ReadLong(); + CAssetId lightmap = in.Get(); float unitsPerLightmapTexel = in.ReadFloat(); float alphaInTime = in.ReadFloat(); float alphaOutTime = in.ReadFloat(); @@ -1301,9 +1301,9 @@ CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, int pro CActorParameters actorParms = LoadActorParameters(in); CPatterned::EColliderType collider = CPatterned::EColliderType(in.ReadBool()); CDamageInfo damageInfo1(in); - CAssetId projectileWeapon = in.ReadLong(); + CAssetId projectileWeapon = in.Get(); CDamageInfo projectileDamage(in); - CAssetId projectileVisorParticle = in.ReadLong(); + CAssetId projectileVisorParticle = in.Get(); u32 projectileVisorSfx = in.ReadLong(); const CAnimationParameters& aParms = pInfo.GetAnimationParameters(); @@ -2115,23 +2115,23 @@ CEntity* ScriptLoader::LoadDebrisExtended(CStateManager& mgr, CInputStream& in, zeus::CVector3f localOffset = in.Get(); - CAssetId model = in.ReadLong(); + CAssetId model = in.Get(); CActorParameters aParam = LoadActorParameters(in); - CAssetId particle1 = in.ReadLong(); + CAssetId particle1 = in.Get(); zeus::CVector3f particle1Scale = in.Get(); bool particle1GlobalTranslation = in.ReadBool(); bool deferDeleteTillParticle1Done = in.ReadBool(); CScriptDebris::EOrientationType particle1Or = CScriptDebris::EOrientationType(in.ReadLong()); - CAssetId particle2 = in.ReadLong(); + CAssetId particle2 = in.Get(); zeus::CVector3f particle2Scale = in.Get(); bool particle2GlobalTranslation = in.ReadBool(); bool deferDeleteTillParticle2Done = in.ReadBool(); CScriptDebris::EOrientationType particle2Or = CScriptDebris::EOrientationType(in.ReadLong()); - CAssetId particle3 = in.ReadLong(); + CAssetId particle3 = in.Get(); /*zeus::CVector3f particle3Scale =*/(void) in.Get(); /* Not actually used, go figure */ CScriptDebris::EOrientationType particle3Or = CScriptDebris::EOrientationType(in.ReadLong()); @@ -2346,7 +2346,7 @@ CEntity* ScriptLoader::LoadAreaAttributes(CStateManager& mgr, CInputStream& in, float thermalHeat = in.ReadFloat(); float xrayFogDistance = in.ReadFloat(); float worldLightingLevel = in.ReadFloat(); - CAssetId skybox = in.ReadLong(); + CAssetId skybox = in.Get(); EPhazonType phazonType = EPhazonType(in.ReadLong()); return new CScriptAreaAttributes(mgr.AllocateUniqueId(), info, showSkybox, fxType, envFxDensity, thermalHeat, @@ -2382,13 +2382,13 @@ CEntity* ScriptLoader::LoadFishCloud(CStateManager& mgr, CInputStream& in, int p zeus::CColor color = in.Get(); bool killable = in.ReadBool(); float weaponKillRadius = in.ReadFloat(); - CAssetId part1 = in.ReadLong(); + CAssetId part1 = in.Get(); u32 partCount1 = in.ReadLong(); - CAssetId part2 = in.ReadLong(); + CAssetId part2 = in.Get(); u32 partCount2 = in.ReadLong(); - CAssetId part3 = in.ReadLong(); + CAssetId part3 = in.Get(); u32 partCount3 = in.ReadLong(); - CAssetId part4 = in.ReadLong(); + CAssetId part4 = in.Get(); u32 partCount4 = in.ReadLong(); u32 deathSfx = in.ReadLong(); bool repelFromThreats = in.ReadBool(); @@ -2458,17 +2458,17 @@ CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, std::string name = mgr.HashInstanceName(in); bool active = in.ReadBool(); - CAssetId worldId = in.ReadLong(); - CAssetId areaId = in.ReadLong(); + CAssetId worldId = in.Get(); + CAssetId areaId = in.Get(); if (propCount == 4) return new CScriptWorldTeleporter(mgr.AllocateUniqueId(), name, info, active, worldId, areaId); CAnimationParameters animParms = LoadAnimationParameters(in); zeus::CVector3f playerScale = in.Get(); - CAssetId platformModel = in.ReadLong(); + CAssetId platformModel = in.Get(); zeus::CVector3f platformScale = in.Get(); - CAssetId backgroundModel = in.ReadLong(); + CAssetId backgroundModel = in.Get(); zeus::CVector3f backgroundScale = in.Get(); bool upElevator = in.ReadBool(); @@ -2476,8 +2476,8 @@ CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, u8 volume = (propCount < 13 ? u8(127) : u8(in.ReadLong())); u8 panning = (propCount < 14 ? u8(64) : u8(in.ReadLong())); bool showText = (propCount < 15 ? false : in.ReadBool()); - CAssetId fontId = (propCount < 16 ? CAssetId() : in.ReadLong()); - CAssetId stringId = (propCount < 17 ? CAssetId() : in.ReadLong()); + CAssetId fontId = (propCount < 16 ? CAssetId() : in.Get()); + CAssetId stringId = (propCount < 17 ? CAssetId() : in.Get()); bool fadeWhite = (propCount < 18 ? false : in.ReadBool()); float charFadeInTime = (propCount < 19 ? 0.1f : in.ReadFloat()); float charsPerSecond = (propCount < 20 ? 16.f : in.ReadFloat()); @@ -3170,7 +3170,7 @@ CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in CDamageVulnerability dVuln(in); CAnimationParameters animParams(in); CActorParameters actParams = LoadActorParameters(in); - CAssetId flameFxId = in.ReadLong(); + CAssetId flameFxId = in.Get(); CDamageInfo dInfo(in); bool active = in.ReadBool(); @@ -3257,8 +3257,8 @@ CEntity* ScriptLoader::LoadGeemer(CStateManager& mgr, CInputStream& in, int prop actHead.x10_transform, std::move(mData), pInfo, EBodyType::WallWalker, 0.f, advanceWpRadius, f2, alignAngVel, f4, 0.2f, 0.4f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, forwardMoveWeight, 0.f, 0.f, playerObstructionMinDist, haltDelay, false, CWallWalker::EWalkerType::Geemer, - CDamageVulnerability::NormalVulnerabilty(), CDamageInfo(), haltSfx, getUpSfx, crouchSfx, -1, - -1, 0.f, actParms); + CDamageVulnerability::NormalVulnerabilty(), CDamageInfo(), haltSfx, getUpSfx, crouchSfx, {}, + {}, 0.f, actParms); } CEntity* ScriptLoader::LoadSpindleCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { @@ -3458,8 +3458,8 @@ CEntity* ScriptLoader::LoadIceZoomer(CStateManager& mgr, CInputStream& in, int p float f4 = in.ReadFloat(); float playerObstructionMinDist = in.ReadFloat(); float moveFowardWeight = in.ReadFloat(); - CAssetId modelRes(in.ReadLong()); - CAssetId skinRes(in.ReadLong()); + CAssetId modelRes(in.Get()); + CAssetId skinRes(in.Get()); CDamageVulnerability dVuln(in); float iceZoomerJointHP = in.ReadFloat(); diff --git a/Runtime/World/ScriptLoader.hpp b/Runtime/World/ScriptLoader.hpp index c85134f92..23ec63d54 100644 --- a/Runtime/World/ScriptLoader.hpp +++ b/Runtime/World/ScriptLoader.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Runtime/IOStreams.hpp" +#include "Runtime/Streams/IOStreams.hpp" #include #include From 8afab438762b3be398d168e7eb5d25411207f697 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 20 Feb 2022 16:02:40 -0800 Subject: [PATCH 04/17] CSegId is 32 bits in files --- Runtime/Character/CSegId.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/Character/CSegId.hpp b/Runtime/Character/CSegId.hpp index 8b3d83828..2721df78d 100644 --- a/Runtime/Character/CSegId.hpp +++ b/Runtime/Character/CSegId.hpp @@ -11,7 +11,7 @@ class CSegId { public: constexpr CSegId() noexcept = default; constexpr CSegId(u8 id) noexcept : x0_segId(id) {} - explicit CSegId(CInputStream& in) : x0_segId(in.ReadUint8()) {} + explicit CSegId(CInputStream& in) : x0_segId(in.ReadLong()) {} constexpr CSegId& operator++() noexcept { ++x0_segId; return *this; From 1655d229cfdfbd5f792a7c3e84adc862653f70a7 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 20 Feb 2022 16:03:38 -0800 Subject: [PATCH 05/17] Fixes to get Metaforce booting again! --- Runtime/CFactoryMgr.cpp | 16 ++++++++-------- Runtime/CFactoryMgr.hpp | 8 ++++---- Runtime/Character/CSkinRules.cpp | 4 ++-- Runtime/Character/CSkinRules.hpp | 4 ++-- Runtime/Streams/CInputStream.cpp | 27 ++++++++++++++------------- 5 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Runtime/CFactoryMgr.cpp b/Runtime/CFactoryMgr.cpp index c391f9eb1..c140a039c 100644 --- a/Runtime/CFactoryMgr.cpp +++ b/Runtime/CFactoryMgr.cpp @@ -21,16 +21,16 @@ constexpr std::array TypeTable{ CFactoryFnReturn CFactoryMgr::MakeObject(const SObjectTag& tag, metaforce::CInputStream& in, const CVParamTransfer& paramXfer, CObjectReference* selfRef) { - auto search = m_factories.find(tag.type); - if (search == m_factories.end()) + auto search = x10_factories.find(tag.type); + if (search == x10_factories.end()) return {}; return search->second(tag, in, paramXfer, selfRef); } bool CFactoryMgr::CanMakeMemory(const metaforce::SObjectTag& tag) const { - auto search = m_memFactories.find(tag.type); - return search != m_memFactories.cend(); + auto search = x24_memFactories.find(tag.type); + return search != x24_memFactories.cend(); } CFactoryFnReturn CFactoryMgr::MakeObjectFromMemory(const SObjectTag& tag, std::unique_ptr&& buf, int size, @@ -39,8 +39,8 @@ CFactoryFnReturn CFactoryMgr::MakeObjectFromMemory(const SObjectTag& tag, std::u OPTICK_EVENT(); std::unique_ptr localBuf = std::move(buf); - const auto memFactoryIter = m_memFactories.find(tag.type); - if (memFactoryIter != m_memFactories.cend()) { + const auto memFactoryIter = x24_memFactories.find(tag.type); + if (memFactoryIter != x24_memFactories.cend()) { if (compressed) { std::unique_ptr compRead = std::make_unique(localBuf.get(), size, CMemoryInStream::EOwnerShip::NotOwned); @@ -53,8 +53,8 @@ CFactoryFnReturn CFactoryMgr::MakeObjectFromMemory(const SObjectTag& tag, std::u return memFactoryIter->second(tag, std::move(localBuf), size, paramXfer, selfRef); } } else { - const auto factoryIter = m_factories.find(tag.type); - if (factoryIter == m_factories.end()) { + const auto factoryIter = x10_factories.find(tag.type); + if (factoryIter == x10_factories.end()) { return {}; } diff --git a/Runtime/CFactoryMgr.hpp b/Runtime/CFactoryMgr.hpp index 689dc719a..058203051 100644 --- a/Runtime/CFactoryMgr.hpp +++ b/Runtime/CFactoryMgr.hpp @@ -12,8 +12,8 @@ class CVParamTransfer; class IObj; class CFactoryMgr { - std::unordered_map m_factories; - std::unordered_map m_memFactories; + std::unordered_map x10_factories; + std::unordered_map x24_memFactories; public: CFactoryFnReturn MakeObject(const SObjectTag& tag, metaforce::CInputStream& in, const CVParamTransfer& paramXfer, @@ -21,8 +21,8 @@ public: bool CanMakeMemory(const metaforce::SObjectTag& tag) const; CFactoryFnReturn MakeObjectFromMemory(const SObjectTag& tag, std::unique_ptr&& buf, int size, bool compressed, const CVParamTransfer& paramXfer, CObjectReference* selfRef); - void AddFactory(FourCC key, FFactoryFunc func) { m_factories.insert_or_assign(key, std::move(func)); } - void AddFactory(FourCC key, FMemFactoryFunc func) { m_memFactories.insert_or_assign(key, std::move(func)); } + void AddFactory(FourCC key, FFactoryFunc func) { x10_factories.insert_or_assign(key, std::move(func)); } + void AddFactory(FourCC key, FMemFactoryFunc func) { x24_memFactories.insert_or_assign(key, std::move(func)); } enum class ETypeTable : u8 { CLSN, diff --git a/Runtime/Character/CSkinRules.cpp b/Runtime/Character/CSkinRules.cpp index f05e1a21d..c2ae2c722 100644 --- a/Runtime/Character/CSkinRules.cpp +++ b/Runtime/Character/CSkinRules.cpp @@ -7,8 +7,8 @@ namespace metaforce { static u32 ReadCount(CInputStream& in) { - u32 result = in.ReadLong(); - if (result == UINT32_MAX) { + s32 result = in.ReadLong(); + if (result == -1) { return in.ReadLong(); } u8 junk[784]; diff --git a/Runtime/Character/CSkinRules.hpp b/Runtime/Character/CSkinRules.hpp index 732166a07..817c68df6 100644 --- a/Runtime/Character/CSkinRules.hpp +++ b/Runtime/Character/CSkinRules.hpp @@ -32,8 +32,8 @@ public: class CSkinRules { std::vector x0_bones; - u32 x10_vertexCount; - u32 x14_normalCount; + u32 x10_vertexCount = 0; + u32 x14_normalCount = 0; public: explicit CSkinRules(CInputStream& in); diff --git a/Runtime/Streams/CInputStream.cpp b/Runtime/Streams/CInputStream.cpp index f6853ca23..d3664a38b 100644 --- a/Runtime/Streams/CInputStream.cpp +++ b/Runtime/Streams/CInputStream.cpp @@ -31,29 +31,30 @@ bool CInputStream::InternalReadNext() { bool CInputStream::GrabAnotherBlock() { return InternalReadNext(); } void CInputStream::Get(u8* dest, u32 len) { - u32 readLen = 0; x20_bitOffset = 0; + u32 readCount = 0; while (len != 0) { u32 blockLen = x8_blockLen - x4_blockOffset; if (len < blockLen) { blockLen = len; } - - if (blockLen != 0) { - memcpy(dest + readLen, x10_ptr + x4_blockOffset, blockLen); - len -= blockLen; - readLen += blockLen; - x4_blockOffset += blockLen; - } else if (len > 256) { - u32 tmp = Read(dest + readLen, len); - len -= tmp; - readLen += tmp; + if (blockLen == 0) { + if (len <= 256) { + GrabAnotherBlock(); + } else { + u32 readLen = Read(dest + readCount, len); + len -= readLen; + readCount += readLen; + } } else { - GrabAnotherBlock(); + memcpy(dest + readCount, x10_ptr + x4_blockOffset, blockLen); + len -= blockLen; + readCount += blockLen; + x4_blockOffset += blockLen; } } - x18_readPosition += readLen; + x18_readPosition += readCount; } u32 CInputStream::ReadBytes(void* dest, u32 len) { From 64d4b0388c7664720954927acb5e4e1d44ea7662 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 20 Feb 2022 16:35:43 -0800 Subject: [PATCH 06/17] Get Exo off the DataSpec --- Runtime/MP1/World/CMetroidPrimeExo.cpp | 69 ++++++++++++++++++++------ 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/Runtime/MP1/World/CMetroidPrimeExo.cpp b/Runtime/MP1/World/CMetroidPrimeExo.cpp index ff860a60e..bcd13a71e 100644 --- a/Runtime/MP1/World/CMetroidPrimeExo.cpp +++ b/Runtime/MP1/World/CMetroidPrimeExo.cpp @@ -22,6 +22,8 @@ #include "Runtime/World/CWorld.hpp" #include "Runtime/World/ScriptLoader.hpp" +#include "Runtime/Streams/IOStreams.hpp" + #include "TCastTo.hpp" // Generated file, do not modify include path namespace metaforce::MP1 { @@ -174,26 +176,59 @@ static CPatternedInfo LoadPatternedInfo(CInputStream& in) { return CPatternedInfo(in, pcount.second); } -using CameraShakeData = DataSpec::DNAMP1::MetroidPrimeStage1::MassivePrimeStruct::CameraShakeData; +struct SExoCameraShakePoint { + float x0_attackTime{}; + float x4_sustainTime{}; + float x8_duration{}; + float xc_magnitude{}; + SExoCameraShakePoint() = default; + SExoCameraShakePoint(CInputStream& in) + : x0_attackTime(in.ReadFloat()) + , x4_sustainTime(in.ReadFloat()) + , x8_duration(in.ReadFloat()) + , xc_magnitude(in.ReadFloat()) {} +}; -static SCameraShakePoint BuildCameraShakePoint(CameraShakeData::CameraShakerComponent::CameraShakePoint& sp) { - return SCameraShakePoint(false, sp.attackTime, sp.sustainTime, sp.duration, sp.magnitude); +struct SExoCameraShakerComponent { + bool x0_useModulation{}; + SExoCameraShakePoint x4_am{}; + SExoCameraShakePoint x14_fm{}; + SExoCameraShakerComponent() = default; + explicit SExoCameraShakerComponent(CInputStream& in) + : x0_useModulation(in.ReadBool()), x4_am(in.Get()), x14_fm(in.Get()) {} +}; + +struct SExoCameraShakeData { + bool x0_useSfx{}; + float x4_duration{}; + float x8_sfxDist{}; + std::array xc_components{}; + SExoCameraShakeData() = default; + explicit SExoCameraShakeData(CInputStream& in) + : x0_useSfx(in.ReadBool()), x4_duration(in.ReadFloat()), x8_sfxDist(in.ReadFloat()) { + for (auto& component : xc_components) { + component = in.Get(); + } + } +}; + +static SCameraShakePoint BuildCameraShakePoint(SExoCameraShakePoint& sp) { + return {false, sp.x0_attackTime, sp.x4_sustainTime, sp.x8_duration, sp.xc_magnitude}; } -static CCameraShakerComponent BuildCameraShakerComponent(CameraShakeData::CameraShakerComponent& comp) { - return CCameraShakerComponent(comp.useModulation, BuildCameraShakePoint(comp.am), BuildCameraShakePoint(comp.fm)); +static CCameraShakerComponent BuildCameraShakerComponent(SExoCameraShakerComponent& comp) { + return {comp.x0_useModulation, BuildCameraShakePoint(comp.x4_am), BuildCameraShakePoint(comp.x14_fm)}; } static CCameraShakeData LoadCameraShakeData(CInputStream& in) { -#if 0 - CameraShakeData shakeData; - shakeData.read(in); - return CCameraShakeData(shakeData.duration, shakeData.sfxDist, u32(shakeData.useSfx), zeus::skZero3f, - BuildCameraShakerComponent(shakeData.shakerComponents[0]), - BuildCameraShakerComponent(shakeData.shakerComponents[1]), - BuildCameraShakerComponent(shakeData.shakerComponents[2])); -#endif - return {}; + auto shakeData = in.Get(); + return {shakeData.x4_duration, + shakeData.x8_sfxDist, + u32(shakeData.x0_useSfx), + zeus::skZero3f, + BuildCameraShakerComponent(shakeData.xc_components[0]), + BuildCameraShakerComponent(shakeData.xc_components[1]), + BuildCameraShakerComponent(shakeData.xc_components[2])}; } static rstl::reserved_vector LoadPrimeStruct4s(CInputStream& in) { @@ -206,8 +241,9 @@ static rstl::reserved_vector LoadPrimeStruct4s(CInputStream& i static rstl::reserved_vector LoadPrimeStruct6s(CInputStream& in) { rstl::reserved_vector ret; - for (int i = 0; i < 4; ++i) + for (int i = 0; i < 4; ++i) { ret.emplace_back(in); + } return ret; } @@ -1492,7 +1528,8 @@ TUniqueId CMetroidPrimeExo::GetNextAttackWaypoint(CStateManager& mgr, bool b1) { return lastUid; } -TUniqueId CMetroidPrimeExo::GetWaypointForBehavior(CStateManager& mgr, EScriptObjectState state, EScriptObjectMessage msg) { +TUniqueId CMetroidPrimeExo::GetWaypointForBehavior(CStateManager& mgr, EScriptObjectState state, + EScriptObjectMessage msg) { if (TCastToConstPtr relay = mgr.GetObjectById(x568_relayId)) { rstl::reserved_vector uids; for (const auto& conn : relay->GetConnectionList()) { From 6c92f0366442787446497b3a36c880a696eb1d03 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 20 Feb 2022 18:28:07 -0800 Subject: [PATCH 07/17] Move CVar* into Metaforce to begin removal of hecl's Dataspec --- Runtime/CBasics.hpp | 19 ++- Runtime/CBasicsPC.cpp | 149 ++++++++++++++++- Runtime/CGameOptions.cpp | 2 +- Runtime/CMain.cpp | 36 ++--- Runtime/CMakeLists.txt | 4 + Runtime/CMemoryCardSys.cpp | 18 +-- Runtime/CMemoryCardSys.hpp | 2 +- Runtime/CStateManager.cpp | 32 ++-- Runtime/CStateManager.hpp | 2 +- Runtime/Camera/CFirstPersonCamera.cpp | 4 +- Runtime/Camera/CFirstPersonCamera.hpp | 2 +- .../lib => Runtime/ConsoleVariables}/CVar.cpp | 117 ++++++-------- .../ConsoleVariables}/CVar.hpp | 132 +++++++++------ Runtime/ConsoleVariables/CVarCommons.cpp | 78 +++++++++ .../ConsoleVariables}/CVarCommons.hpp | 4 +- .../ConsoleVariables}/CVarManager.cpp | 26 +-- .../ConsoleVariables}/CVarManager.hpp | 36 ++--- .../ConsoleVariables}/FileStoreManager.cpp | 14 +- Runtime/ConsoleVariables/FileStoreManager.hpp | 22 +++ Runtime/Graphics/CGraphics.hpp | 4 +- Runtime/Graphics/CModelBoo.cpp | 4 +- Runtime/IMain.hpp | 30 ++-- Runtime/ImGuiConsole.cpp | 136 ++++++++-------- Runtime/ImGuiConsole.hpp | 12 +- Runtime/MP1/CTweaks.cpp | 4 +- Runtime/MP1/CTweaks.hpp | 9 +- Runtime/MP1/MP1.cpp | 10 +- Runtime/MP1/MP1.hpp | 16 +- Runtime/MP1/Tweaks/CTweakAutoMapper.cpp | 150 +++++++++--------- Runtime/MP1/Tweaks/CTweakAutoMapper.hpp | 20 +-- Runtime/MP1/Tweaks/CTweakGame.cpp | 14 +- Runtime/MP1/Tweaks/CTweakGame.hpp | 6 +- Runtime/MP1/Tweaks/CTweakPlayer.cpp | 17 +- Runtime/MP1/Tweaks/CTweakPlayer.hpp | 8 +- Runtime/Tweaks/ITweak.hpp | 9 +- Runtime/World/CActor.cpp | 2 +- Runtime/World/CMorphBall.cpp | 12 +- Runtime/World/CPatterned.cpp | 8 +- Runtime/World/CScriptSpecialFunction.cpp | 4 +- Runtime/World/CStateMachine.cpp | 2 +- Runtime/World/CWorldTransManager.cpp | 2 +- hecl/lib/CMakeLists.txt | 12 -- hecl/lib/CVarCommons.cpp | 87 ---------- hecl/lib/Runtime/CMakeLists.txt | 4 - metaforce-gui/MainWindow.hpp | 2 +- 45 files changed, 712 insertions(+), 571 deletions(-) rename {hecl/lib => Runtime/ConsoleVariables}/CVar.cpp (80%) rename {hecl/include/hecl => Runtime/ConsoleVariables}/CVar.hpp (55%) create mode 100644 Runtime/ConsoleVariables/CVarCommons.cpp rename {hecl/include/hecl => Runtime/ConsoleVariables}/CVarCommons.hpp (97%) rename {hecl/lib => Runtime/ConsoleVariables}/CVarManager.cpp (95%) rename {hecl/include/hecl => Runtime/ConsoleVariables}/CVarManager.hpp (78%) rename {hecl/lib/Runtime => Runtime/ConsoleVariables}/FileStoreManager.cpp (83%) create mode 100644 Runtime/ConsoleVariables/FileStoreManager.hpp delete mode 100644 hecl/lib/CVarCommons.cpp delete mode 100644 hecl/lib/Runtime/CMakeLists.txt diff --git a/Runtime/CBasics.hpp b/Runtime/CBasics.hpp index b760f00bf..a7ed0282a 100644 --- a/Runtime/CBasics.hpp +++ b/Runtime/CBasics.hpp @@ -1,8 +1,16 @@ #pragma once +#include #include #include -#include +#ifndef _WIN32 +#include +#else +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#endif #include "Runtime/GCNTypes.hpp" @@ -26,6 +34,12 @@ struct OSCalendarTime { class CBasics { public: +#if _WIN32 + using Sstat = struct ::_stat64; +#else + using Sstat = struct stat; +#endif + static void Initialize(); static const u64 SECONDS_TO_2000; @@ -48,6 +62,9 @@ public: static void Swap2Bytes(u8* v); static void Swap4Bytes(u8* v); static void Swap8Bytes(u8* v); + static int RecursiveMakeDir(const char* dir); + static void MakeDir(const char* dir); + static int Stat(const char* path, Sstat* statOut); }; } // namespace metaforce diff --git a/Runtime/CBasicsPC.cpp b/Runtime/CBasicsPC.cpp index 868006163..d1f257781 100644 --- a/Runtime/CBasicsPC.cpp +++ b/Runtime/CBasicsPC.cpp @@ -1,21 +1,26 @@ #ifndef _WIN32 -#include #include +#include #if __APPLE__ #include #endif -#else -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include #endif -#include +#include #include +#include +#include #include +#ifdef WIN32 +#include +#ifndef _WIN32_IE +#define _WIN32_IE 0x0400 +#endif +#include +#endif #include "Runtime/CBasics.hpp" +#include #if __APPLE__ static u64 MachToDolphinNum; @@ -25,7 +30,7 @@ static LARGE_INTEGER PerfFrequency; #endif namespace metaforce { - +static logvisor::Module LogModule("metaforce::CBasics"); void CBasics::Initialize() { #if __APPLE__ mach_timebase_info_data_t timebase; @@ -195,4 +200,132 @@ void CBasics::Swap8Bytes(u8* v) { #endif } +int CBasics::Stat(const char* path, Sstat* statOut) { +#if _WIN32 + size_t pos; + const nowide::wstackstring wpath(path); + const wchar_t* wpathP = wpath.get(); + for (pos = 0; pos < 3 && wpathP[pos] != L'\0'; ++pos) {} + if (pos == 2 && wpathP[1] == L':') { + wchar_t fixPath[4] = {wpathP[0], L':', L'/', L'\0'}; + return _wstat64(fixPath, statOut); + } + return _wstat64(wpath.get(), statOut); +#else + return stat(path, statOut); +#endif +} + +/* recursive mkdir */ +int CBasics::RecursiveMakeDir(const char* dir) { +#if _WIN32 + char tmp[1024]; + + /* copy path */ + std::strncpy(tmp, dir, std::size(tmp)); + const size_t len = std::strlen(tmp); + if (len >= std::size(tmp)) { + return -1; + } + + /* remove trailing slash */ + if (tmp[len - 1] == '/' || tmp[len - 1] == '\\') { + tmp[len - 1] = 0; + } + + /* recursive mkdir */ + char* p = nullptr; + Sstat sb; + for (p = tmp + 1; *p; p++) { + if (*p == '/' || *p == '\\') { + *p = 0; + /* test path */ + if (Stat(tmp, &sb) != 0) { + /* path does not exist - create directory */ + const nowide::wstackstring wtmp(tmp); + if (!CreateDirectoryW(wtmp.get(), nullptr)) { + return -1; + } + } else if (!S_ISDIR(sb.st_mode)) { + /* not a directory */ + return -1; + } + *p = '/'; + } + } + /* test path */ + if (Stat(tmp, &sb) != 0) { + /* path does not exist - create directory */ + const nowide::wstackstring wtmp(tmp); + if (!CreateDirectoryW(wtmp.get(), nullptr)) { + return -1; + } + } else if (!S_ISDIR(sb.st_mode)) { + /* not a directory */ + return -1; + } + return 0; +#else + char tmp[1024]; + + /* copy path */ + std::memset(tmp, 0, std::size(tmp)); + std::strncpy(tmp, dir, std::size(tmp) - 1); + const size_t len = std::strlen(tmp); + if (len >= std::size(tmp)) { + return -1; + } + + /* remove trailing slash */ + if (tmp[len - 1] == '/') { + tmp[len - 1] = 0; + } + + /* recursive mkdir */ + char* p = nullptr; + Sstat sb; + for (p = tmp + 1; *p; p++) { + if (*p == '/') { + *p = 0; + /* test path */ + if (Stat(tmp, &sb) != 0) { + /* path does not exist - create directory */ + if (mkdir(tmp, 0755) < 0) { + return -1; + } + } else if (!S_ISDIR(sb.st_mode)) { + /* not a directory */ + return -1; + } + *p = '/'; + } + } + /* test path */ + if (Stat(tmp, &sb) != 0) { + /* path does not exist - create directory */ + if (mkdir(tmp, 0755) < 0) { + return -1; + } + } else if (!S_ISDIR(sb.st_mode)) { + /* not a directory */ + return -1; + } + return 0; +#endif +} + +void CBasics::MakeDir(const char* dir) { +#if _WIN32 + HRESULT err; + const nowide::wstackstring wdir(dir); + if (!CreateDirectoryW(wdir.get(), NULL)) + if ((err = GetLastError()) != ERROR_ALREADY_EXISTS) + LogModule.report(logvisor::Fatal, FMT_STRING("MakeDir({})"), dir); +#else + if (mkdir(dir, 0755)) + if (errno != EEXIST) + LogModule.report(logvisor::Fatal, FMT_STRING("MakeDir({}): {}"), dir, strerror(errno)); +#endif +} + } // namespace metaforce diff --git a/Runtime/CGameOptions.cpp b/Runtime/CGameOptions.cpp index de25fdf50..691f25658 100644 --- a/Runtime/CGameOptions.cpp +++ b/Runtime/CGameOptions.cpp @@ -14,7 +14,7 @@ #include "Runtime/Graphics/CMoviePlayer.hpp" #include "Runtime/Input/CFinalInput.hpp" -#include +#include "ConsoleVariables/CVarManager.hpp" namespace metaforce { diff --git a/Runtime/CMain.cpp b/Runtime/CMain.cpp index 3a605cfd9..b01c8d5b3 100644 --- a/Runtime/CMain.cpp +++ b/Runtime/CMain.cpp @@ -8,17 +8,19 @@ #include "ImGuiEngine.hpp" #include "Runtime/Graphics/CGraphics.hpp" #include "Runtime/MP1/MP1.hpp" +#include "Runtime/ConsoleVariables/FileStoreManager.hpp" +#include "Runtime/ConsoleVariables/CVarManager.hpp" #include "amuse/BooBackend.hpp" #include "../version.h" -//#include -//#pragma STDC FENV_ACCESS ON - /* Static reference to dataspec additions * (used by MSVC to definitively link DataSpecs) */ #include "DataSpecRegistry.hpp" +//#include +//#pragma STDC FENV_ACCESS ON + #include using namespace std::literals; @@ -247,9 +249,9 @@ private: struct Application : aurora::AppDelegate { private: - hecl::Runtime::FileStoreManager& m_fileMgr; - hecl::CVarManager& m_cvarManager; - hecl::CVarCommons& m_cvarCommons; + FileStoreManager& m_fileMgr; + CVarManager& m_cvarManager; + CVarCommons& m_cvarCommons; ImGuiConsole m_imGuiConsole; std::string m_errorString; @@ -271,7 +273,7 @@ private: // is built, i.e during initialization public: - Application(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr, hecl::CVarCommons& cvarCmns) + Application(FileStoreManager& fileMgr, CVarManager& cvarMgr, CVarCommons& cvarCmns) : m_fileMgr(fileMgr), m_cvarManager(cvarMgr), m_cvarCommons(cvarCmns), m_imGuiConsole(cvarMgr, cvarCmns) {} void onAppLaunched() override { @@ -300,10 +302,6 @@ public: for (const auto& str : aurora::get_args()) { auto arg = static_cast(str); - if (arg.starts_with("--verbosity=") || arg.starts_with("-v=")) { - hecl::VerbosityLevel = atoi(arg.substr(arg.find_last_of('=') + 1).c_str()); - hecl::LogModule.report(logvisor::Info, FMT_STRING("Set verbosity level to {}"), hecl::VerbosityLevel); - } } const zeus::CPUInfo& cpuInf = zeus::cpuFeatures(); @@ -569,16 +567,18 @@ static void SetupBasics(bool logging) { atSetExceptionHandler(AthenaExc); #if SENTRY_ENABLED - hecl::Runtime::FileStoreManager fileMgr{"sentry-native-metaforce"}; + FileStoreManager fileMgr{"sentry-native-metaforce"}; std::string cacheDir{fileMgr.getStoreRoot()}; logvisor::RegisterSentry("metaforce", METAFORCE_WC_DESCRIBE, cacheDir.c_str()); #endif } static bool IsClientLoggingEnabled(int argc, char** argv) { - for (int i = 1; i < argc; ++i) - if (!hecl::StrNCmp(argv[i], "-l", 2)) + for (int i = 1; i < argc; ++i) { + if (!strncmp(argv[i], "-l", 2)) { return true; + } + } return false; } @@ -588,15 +588,15 @@ int main(int argc, char** argv) { // but breaks animations, need to research why this is the case // for now it's disabled // fesetround(FE_TOWARDZERO); - if (argc > 1 && !hecl::StrCmp(argv[1], "--dlpackage")) { + if (argc > 1 && !strcmp(argv[1], "--dlpackage")) { fmt::print(FMT_STRING("{}\n"), METAFORCE_DLPACKAGE); return 100; } SetupBasics(IsClientLoggingEnabled(argc, argv)); - hecl::Runtime::FileStoreManager fileMgr{"metaforce"}; - hecl::CVarManager cvarMgr{fileMgr}; - hecl::CVarCommons cvarCmns{cvarMgr}; + metaforce::FileStoreManager fileMgr{"metaforce"}; + metaforce::CVarManager cvarMgr{fileMgr}; + metaforce::CVarCommons cvarCmns{cvarMgr}; std::vector args; for (int i = 1; i < argc; ++i) diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index 986f9d63a..93a13e0f0 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -70,6 +70,10 @@ set(RUNTIME_SOURCES_B ${PARTICLE_SOURCES} ${WORLD_SOURCES} ${WEAPON_SOURCES} + ConsoleVariables/FileStoreManager.hpp ConsoleVariables/FileStoreManager.cpp + ConsoleVariables/CVar.hpp ConsoleVariables/CVar.cpp + ConsoleVariables/CVarManager.hpp ConsoleVariables/CVarManager.cpp + ConsoleVariables/CVarCommons.hpp ConsoleVariables/CVarCommons.cpp Tweaks/ITweak.hpp Tweaks/ITweakAutoMapper.hpp Tweaks/ITweakBall.hpp diff --git a/Runtime/CMemoryCardSys.cpp b/Runtime/CMemoryCardSys.cpp index 9a7a28831..6b29b12cf 100644 --- a/Runtime/CMemoryCardSys.cpp +++ b/Runtime/CMemoryCardSys.cpp @@ -6,8 +6,8 @@ #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/Graphics/CTexture.hpp" #include "Runtime/GuiSys/CStringTable.hpp" -#include -#include +#include "ConsoleVariables/CVar.hpp" +#include "ConsoleVariables/CVarManager.hpp" namespace metaforce { namespace { @@ -16,8 +16,8 @@ using ECardResult = kabufuda::ECardResult; static std::string g_CardImagePaths[2] = {}; static kabufuda::Card g_CardStates[2] = {kabufuda::Card{"GM8E", "01"}, kabufuda::Card{"GM8E", "01"}}; // static kabufuda::ECardResult g_OpResults[2] = {}; -hecl::CVar* mc_dolphinAPath = nullptr; -hecl::CVar* mc_dolphinBPath = nullptr; +CVar* mc_dolphinAPath = nullptr; +CVar* mc_dolphinBPath = nullptr; } // namespace CSaveWorldIntermediate::CSaveWorldIntermediate(CAssetId mlvl, CAssetId savw) : x0_mlvlId(mlvl), x8_savwId(savw) { if (!savw.IsValid()) @@ -71,12 +71,12 @@ const CSaveWorldMemory& CMemoryCardSys::GetSaveWorldMemory(CAssetId wldId) const } CMemoryCardSys::CMemoryCardSys() { - mc_dolphinAPath = hecl::CVarManager::instance()->findOrMakeCVar( + mc_dolphinAPath = CVarManager::instance()->findOrMakeCVar( "memcard.PathA"sv, "Path to the memory card image for SlotA"sv, ""sv, - (hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::System | hecl::CVar::EFlags::ModifyRestart)); - mc_dolphinBPath = hecl::CVarManager::instance()->findOrMakeCVar( + (CVar::EFlags::Archive | CVar::EFlags::System | CVar::EFlags::ModifyRestart)); + mc_dolphinBPath = CVarManager::instance()->findOrMakeCVar( "memcard.PathB"sv, "Path to the memory card image for SlotB"sv, ""sv, - (hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::System | hecl::CVar::EFlags::ModifyRestart)); + (CVar::EFlags::Archive | CVar::EFlags::System | CVar::EFlags::ModifyRestart)); x0_hints = g_SimplePool->GetObj("HINT_Hints"); xc_memoryWorlds.reserve(16); x1c_worldInter.emplace(); @@ -340,7 +340,7 @@ std::string CMemoryCardSys::_GetDolphinCardPath(kabufuda::ECardSlot slot) { return g_CardImagePaths[static_cast(slot)]; } -void CMemoryCardSys::_ResolveDolphinCardPath(const hecl::CVar* cv, kabufuda::ECardSlot slot) { +void CMemoryCardSys::_ResolveDolphinCardPath(const CVar* cv, kabufuda::ECardSlot slot) { if (cv != nullptr && cv->toLiteral().empty()) { g_CardImagePaths[int(slot)] = ResolveDolphinCardPath(slot); } else if (cv != nullptr) { diff --git a/Runtime/CMemoryCardSys.hpp b/Runtime/CMemoryCardSys.hpp index c6f9b48d0..8be8ddba1 100644 --- a/Runtime/CMemoryCardSys.hpp +++ b/Runtime/CMemoryCardSys.hpp @@ -69,7 +69,7 @@ class CMemoryCardSys { public: static void _ResetCVar(kabufuda::ECardSlot slot); - static void _ResolveDolphinCardPath(const hecl::CVar* cv, kabufuda::ECardSlot slot); + static void _ResolveDolphinCardPath(const CVar* cv, kabufuda::ECardSlot slot); static std::string ResolveDolphinCardPath(kabufuda::ECardSlot slot); static bool CreateDolphinCard(kabufuda::ECardSlot slot); static std::string _GetDolphinCardPath(kabufuda::ECardSlot slot); diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 670b8d3be..1d6012bb5 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -47,19 +47,19 @@ #include "Runtime/World/CSnakeWeedSwarm.hpp" #include "Runtime/World/CWallCrawlerSwarm.hpp" #include "Runtime/World/CWorld.hpp" -#include "TCastTo.hpp" // Generated file, do not modify include path +#include "Runtime/ConsoleVariables/CVarManager.hpp" -#include +#include "TCastTo.hpp" // Generated file, do not modify include path #include namespace metaforce { namespace { -hecl::CVar* debugToolDrawAiPath = nullptr; -hecl::CVar* debugToolDrawLighting = nullptr; -hecl::CVar* debugToolDrawCollisionActors = nullptr; -hecl::CVar* debugToolDrawMazePath = nullptr; -hecl::CVar* debugToolDrawPlatformCollision = nullptr; -hecl::CVar* sm_logScripting = nullptr; +CVar* debugToolDrawAiPath = nullptr; +CVar* debugToolDrawLighting = nullptr; +CVar* debugToolDrawCollisionActors = nullptr; +CVar* debugToolDrawMazePath = nullptr; +CVar* debugToolDrawPlatformCollision = nullptr; +CVar* sm_logScripting = nullptr; } // namespace logvisor::Module LogModule("metaforce::CStateManager"); CStateManager::CStateManager(const std::weak_ptr& mailbox, const std::weak_ptr& mwInfo, @@ -217,9 +217,9 @@ CStateManager::CStateManager(const std::weak_ptr& mailbox, const g_StateManager = this; if (sm_logScripting == nullptr) { - sm_logScripting = hecl::CVarManager::instance()->findOrMakeCVar( + sm_logScripting = CVarManager::instance()->findOrMakeCVar( "stateManager.logScripting"sv, "Prints object communication to the console", false, - hecl::CVar::EFlags::ReadOnly | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::Game); + CVar::EFlags::ReadOnly | CVar::EFlags::Archive | CVar::EFlags::Game); } m_logScriptingReference.emplace(&m_logScripting, sm_logScripting); } @@ -545,18 +545,18 @@ void CStateManager::BuildDynamicLightListForWorld() { } } void CStateManager::DrawDebugStuff() const { - if (hecl::com_developer != nullptr && !hecl::com_developer->toBoolean()) { + if (com_developer != nullptr && !com_developer->toBoolean()) { return; } // FIXME: Add proper globals for CVars if (debugToolDrawAiPath == nullptr || debugToolDrawCollisionActors == nullptr || debugToolDrawLighting == nullptr || debugToolDrawMazePath == nullptr || debugToolDrawPlatformCollision == nullptr) { - debugToolDrawAiPath = hecl::CVarManager::instance()->findCVar("debugTool.drawAiPath"); - debugToolDrawMazePath = hecl::CVarManager::instance()->findCVar("debugTool.drawMazePath"); - debugToolDrawCollisionActors = hecl::CVarManager::instance()->findCVar("debugTool.drawCollisionActors"); - debugToolDrawLighting = hecl::CVarManager::instance()->findCVar("debugTool.drawLighting"); - debugToolDrawPlatformCollision = hecl::CVarManager::instance()->findCVar("debugTool.drawPlatformCollision"); + debugToolDrawAiPath = CVarManager::instance()->findCVar("debugTool.drawAiPath"); + debugToolDrawMazePath = CVarManager::instance()->findCVar("debugTool.drawMazePath"); + debugToolDrawCollisionActors = CVarManager::instance()->findCVar("debugTool.drawCollisionActors"); + debugToolDrawLighting = CVarManager::instance()->findCVar("debugTool.drawLighting"); + debugToolDrawPlatformCollision = CVarManager::instance()->findCVar("debugTool.drawPlatformCollision"); return; } diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index 01da8f29d..bf4f0de47 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -217,7 +217,7 @@ private: std::map> m_incomingConnections; bool m_logScripting = false; - std::optional> m_logScriptingReference; + std::optional> m_logScriptingReference; void UpdateThermalVisor(); static void RendererDrawCallback(void*, void*, int); diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index 85b6464f5..2c3e26dbf 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -16,7 +16,7 @@ CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf nearz, farz, aspect, watchedObj, false, 0) , x188_orbitCameraSpeed(orbitCameraSpeed) , x190_gunFollowXf(xf) { - MP1::tw_FieldOfView->addListener([this](hecl::CVar* cv) { _fovListener(cv); }); + MP1::tw_FieldOfView->addListener([this](CVar* cv) { _fovListener(cv); }); } void CFirstPersonCamera::Accept(IVisitor& visitor) { visitor.Visit(this); } @@ -328,7 +328,7 @@ void CFirstPersonCamera::UpdateElevation(CStateManager& mgr) { } } -void CFirstPersonCamera::_fovListener(hecl::CVar* cv) { +void CFirstPersonCamera::_fovListener(CVar* cv) { x15c_currentFov = x180_perspInterpStartFov = x184_perspInterpEndFov = cv->toReal(); x170_24_perspDirty = true; } diff --git a/Runtime/Camera/CFirstPersonCamera.hpp b/Runtime/Camera/CFirstPersonCamera.hpp index 4493ff24e..3d0910953 100644 --- a/Runtime/Camera/CFirstPersonCamera.hpp +++ b/Runtime/Camera/CFirstPersonCamera.hpp @@ -17,7 +17,7 @@ class CFirstPersonCamera : public CGameCamera { bool x1c6_24_deferBallTransitionProcessing : 1 = false; zeus::CVector3f x1c8_closeInVec; float x1d4_closeInTimer = 0.f; - void _fovListener(hecl::CVar* cv); + void _fovListener(CVar* cv); public: DEFINE_ENTITY diff --git a/hecl/lib/CVar.cpp b/Runtime/ConsoleVariables/CVar.cpp similarity index 80% rename from hecl/lib/CVar.cpp rename to Runtime/ConsoleVariables/CVar.cpp index 6c7934285..d5d8499a4 100644 --- a/hecl/lib/CVar.cpp +++ b/Runtime/ConsoleVariables/CVar.cpp @@ -1,13 +1,10 @@ -#include "hecl/CVar.hpp" +#include "Runtime/ConsoleVariables/CVar.hpp" #include -#include "hecl/CVarManager.hpp" -#include "hecl/hecl.hpp" +#include "Runtime/ConsoleVariables/CVarManager.hpp" -#include - -namespace hecl { +namespace metaforce { extern CVar* com_developer; extern CVar* com_enableCheats; @@ -19,38 +16,38 @@ CVar::CVar(std::string_view name, std::string_view value, std::string_view help, init(flags); } -CVar::CVar(std::string_view name, const atVec2f& value, std::string_view help, EFlags flags) +CVar::CVar(std::string_view name, const zeus::CVector2f& value, std::string_view help, EFlags flags) : CVar(name, help, EType::Vec2f) { fromVec2f(value); init(flags); } -CVar::CVar(std::string_view name, const atVec2d& value, std::string_view help, EFlags flags) +CVar::CVar(std::string_view name, const zeus::CVector2d& value, std::string_view help, EFlags flags) : CVar(name, help, EType::Vec2d) { fromVec2d(value); init(flags); } -CVar::CVar(std::string_view name, const atVec3f& value, std::string_view help, EFlags flags) +CVar::CVar(std::string_view name, const zeus::CVector3f& value, std::string_view help, EFlags flags) : CVar(name, help, EType::Vec3f) { fromVec3f(value); init(flags, false); } -CVar::CVar(std::string_view name, const atVec3d& value, std::string_view help, EFlags flags) +CVar::CVar(std::string_view name, const zeus::CVector3d& value, std::string_view help, EFlags flags) : CVar(name, help, EType::Vec3d) { fromVec3d(value); init(flags, false); } -CVar::CVar(std::string_view name, const atVec4f& value, std::string_view help, EFlags flags) +CVar::CVar(std::string_view name, const zeus::CVector4f& value, std::string_view help, EFlags flags) : CVar(name, help, EType::Vec4f) { fromVec4f(value); init(flags, false); } -CVar::CVar(std::string_view name, const atVec4d& value, std::string_view help, EFlags flags) +CVar::CVar(std::string_view name, const zeus::CVector4d& value, std::string_view help, EFlags flags) : CVar(name, help, EType::Vec4d) { fromVec4d(value); init(flags, false); @@ -83,118 +80,100 @@ std::string CVar::help() const { return m_help + (m_defaultValue.empty() ? "" : "\ndefault: " + m_defaultValue) + (isReadOnly() ? " [ReadOnly]" : ""); } -atVec2f CVar::toVec2f(bool* isValid) const { +zeus::CVector2f CVar::toVec2f(bool* isValid) const { if (m_type != EType::Vec2f) { if (isValid != nullptr) *isValid = false; - return atVec2f{}; + return {}; } if (isValid != nullptr) *isValid = true; - atVec2f vec{}; - athena::simd_floats f; + std::array f; std::sscanf(m_value.c_str(), "%g %g", &f[0], &f[1]); - vec.simd.copy_from(f); - - return vec; + return {f[0], f[1]}; } -atVec2d CVar::toVec2d(bool* isValid) const { +zeus::CVector2d CVar::toVec2d(bool* isValid) const { if (m_type != EType::Vec2d) { if (isValid != nullptr) *isValid = false; - return atVec2d{}; + return {}; } if (isValid != nullptr) *isValid = true; - atVec2d vec{}; - athena::simd_doubles f; + std::array f; std::sscanf(m_value.c_str(), "%lg %lg", &f[0], &f[1]); - vec.simd.copy_from(f); - - return vec; + return {f[0], f[1]}; } -atVec3f CVar::toVec3f(bool* isValid) const { +zeus::CVector3f CVar::toVec3f(bool* isValid) const { if (m_type != EType::Vec3f) { if (isValid != nullptr) *isValid = false; - return atVec3f{}; + return {}; } if (isValid != nullptr) *isValid = true; - atVec3f vec{}; - athena::simd_floats f; + std::array f; std::sscanf(m_value.c_str(), "%g %g %g", &f[0], &f[1], &f[2]); - vec.simd.copy_from(f); - - return vec; + return {f[0], f[1], f[2]}; } -atVec3d CVar::toVec3d(bool* isValid) const { +zeus::CVector3d CVar::toVec3d(bool* isValid) const { if (m_type != EType::Vec3d) { if (isValid != nullptr) *isValid = false; - return atVec3d{}; + return {}; } if (isValid != nullptr) *isValid = true; - atVec3d vec{}; - athena::simd_doubles f; + std::array f; std::sscanf(m_value.c_str(), "%lg %lg %lg", &f[0], &f[1], &f[2]); - vec.simd.copy_from(f); - - return vec; + return {f[0], f[1], f[2]}; } -atVec4f CVar::toVec4f(bool* isValid) const { +zeus::CVector4f CVar::toVec4f(bool* isValid) const { if (m_type != EType::Vec4f) { if (isValid != nullptr) *isValid = false; - return atVec4f{}; + return {}; } if (isValid != nullptr) *isValid = true; - atVec4f vec{}; - athena::simd_floats f; + std::array f; std::sscanf(m_value.c_str(), "%g %g %g %g", &f[0], &f[1], &f[2], &f[3]); - vec.simd.copy_from(f); - - return vec; + return {f[0], f[1], f[2], f[3]}; } -atVec4d CVar::toVec4d(bool* isValid) const { +zeus::CVector4d CVar::toVec4d(bool* isValid) const { if (m_type != EType::Vec4d) { if (isValid != nullptr) *isValid = false; - return atVec4d{}; + return {}; } if (isValid != nullptr) *isValid = true; - atVec4d vec{}; - athena::simd_doubles f; + std::array f{}; std::sscanf(m_value.c_str(), "%lg %lg %lg %lg", &f[0], &f[1], &f[2], &f[3]); - vec.simd.copy_from(f); - - return vec; + return {f[0], f[1], f[2], f[3]}; } double CVar::toReal(bool* isValid) const { @@ -259,62 +238,56 @@ std::string CVar::toLiteral(bool* isValid) const { return m_value; } -bool CVar::fromVec2f(const atVec2f& val) { +bool CVar::fromVec2f(const zeus::CVector2f& val) { if (!safeToModify(EType::Vec2f)) return false; - athena::simd_floats f(val.simd); - m_value.assign(fmt::format(FMT_STRING("{} {}"), f[0], f[1])); + m_value.assign(fmt::format(FMT_STRING("{} {}"), val.x(), val.y())); m_flags |= EFlags::Modified; return true; } -bool CVar::fromVec2d(const atVec2d& val) { +bool CVar::fromVec2d(const zeus::CVector2d& val) { if (!safeToModify(EType::Vec2d)) return false; - athena::simd_doubles f(val.simd); - m_value.assign(fmt::format(FMT_STRING("{} {}"), f[0], f[1])); + m_value.assign(fmt::format(FMT_STRING("{} {}"), val.x(), val.y())); m_flags |= EFlags::Modified; return true; } -bool CVar::fromVec3f(const atVec3f& val) { +bool CVar::fromVec3f(const zeus::CVector3f& val) { if (!safeToModify(EType::Vec3f)) return false; - athena::simd_floats f(val.simd); - m_value.assign(fmt::format(FMT_STRING("{} {} {}"), f[0], f[1], f[2])); + m_value.assign(fmt::format(FMT_STRING("{} {} {}"), val.x(), val.y(), val.z())); m_flags |= EFlags::Modified; return true; } -bool CVar::fromVec3d(const atVec3d& val) { +bool CVar::fromVec3d(const zeus::CVector3d& val) { if (!safeToModify(EType::Vec3d)) return false; - athena::simd_doubles f(val.simd); - m_value.assign(fmt::format(FMT_STRING("{} {} {}"), f[0], f[1], f[2])); + m_value.assign(fmt::format(FMT_STRING("{} {} {}"), val.x(), val.y(), val.z())); m_flags |= EFlags::Modified; return true; } -bool CVar::fromVec4f(const atVec4f& val) { +bool CVar::fromVec4f(const zeus::CVector4f& val) { if (!safeToModify(EType::Vec4f)) return false; - athena::simd_floats f(val.simd); - m_value.assign(fmt::format(FMT_STRING("{} {} {} {}"), f[0], f[1], f[2], f[3])); + m_value.assign(fmt::format(FMT_STRING("{} {} {} {}"), val.x(), val.y(), val.z(), val.w())); m_flags |= EFlags::Modified; return true; } -bool CVar::fromVec4d(const atVec4d& val) { +bool CVar::fromVec4d(const zeus::CVector4d& val) { if (!safeToModify(EType::Vec4d)) return false; - athena::simd_doubles f(val.simd); - m_value.assign(fmt::format(FMT_STRING("{} {} {} {}"), f[0], f[1], f[2], f[3])); + m_value.assign(fmt::format(FMT_STRING("{} {} {} {}"), val.x(), val.y(), val.z(), val.w())); m_flags |= EFlags::Modified; return true; } diff --git a/hecl/include/hecl/CVar.hpp b/Runtime/ConsoleVariables/CVar.hpp similarity index 55% rename from hecl/include/hecl/CVar.hpp rename to Runtime/ConsoleVariables/CVar.hpp index a47b584fd..4a8d6d762 100644 --- a/hecl/include/hecl/CVar.hpp +++ b/Runtime/ConsoleVariables/CVar.hpp @@ -1,16 +1,48 @@ #pragma once +#include "Runtime/GCNTypes.hpp" +#include "zeus/zeus.hpp" + #include #include #include +#ifndef ENABLE_BITWISE_ENUM +#define ENABLE_BITWISE_ENUM(type) \ + constexpr type operator|(type a, type b) noexcept { \ + using T = std::underlying_type_t; \ + return type(static_cast(a) | static_cast(b)); \ + } \ + constexpr type operator&(type a, type b) noexcept { \ + using T = std::underlying_type_t; \ + return type(static_cast(a) & static_cast(b)); \ + } \ + constexpr type& operator|=(type& a, type b) noexcept { \ + using T = std::underlying_type_t; \ + a = type(static_cast(a) | static_cast(b)); \ + return a; \ + } \ + constexpr type& operator&=(type& a, type b) noexcept { \ + using T = std::underlying_type_t; \ + a = type(static_cast(a) & static_cast(b)); \ + return a; \ + } \ + constexpr type operator~(type key) noexcept { \ + using T = std::underlying_type_t; \ + return type(~static_cast(key)); \ + } \ + constexpr bool True(type key) noexcept { \ + using T = std::underlying_type_t; \ + return static_cast(key) != 0; \ + } \ + constexpr bool False(type key) noexcept { \ + using T = std::underlying_type_t; \ + return static_cast(key) == 0; \ + } +#endif -#include -#include -#include - -namespace hecl { -namespace DNACVAR { -enum class EType : atUint8 { Boolean, Signed, Unsigned, Real, Literal, Vec2f, Vec2d, Vec3f, Vec3d, Vec4f, Vec4d }; +namespace metaforce { +namespace StoreCVar { +enum class EType : uint32_t { Boolean, Signed, Unsigned, Real, Literal, Vec2f, Vec2d, Vec3f, Vec3d, Vec4f, Vec4d }; enum class EFlags { None = 0, System = (1 << 0), @@ -30,41 +62,37 @@ enum class EFlags { }; ENABLE_BITWISE_ENUM(EFlags) -class CVar : public athena::io::DNA { +class CVar { public: - AT_DECL_DNA - String<-1> m_name; - String<-1> m_value; + std::string m_name; + std::string m_value; }; -struct CVarContainer : public athena::io::DNA { - AT_DECL_DNA - Value magic = 'CVAR'; - Value cvarCount; - Vector cvars; +struct CVarContainer { + u32 magic = 'CVAR'; + std::vector cvars; }; -} // namespace DNACVAR +} // namespace StoreCVar class CVarManager; class ICVarValueReference; -class CVar : protected DNACVAR::CVar { +class CVar : protected StoreCVar::CVar { friend class CVarManager; - Delete _d; public: typedef std::function ListenerFunc; - using EType = DNACVAR::EType; - using EFlags = DNACVAR::EFlags; + using EType = StoreCVar::EType; + using EFlags = StoreCVar::EFlags; CVar(std::string_view name, std::string_view value, std::string_view help, EFlags flags); - CVar(std::string_view name, const atVec2f& value, std::string_view help, EFlags flags); - CVar(std::string_view name, const atVec2d& value, std::string_view help, EFlags flags); - CVar(std::string_view name, const atVec3f& value, std::string_view help, EFlags flags); - CVar(std::string_view name, const atVec3d& value, std::string_view help, EFlags flags); - CVar(std::string_view name, const atVec4f& value, std::string_view help, EFlags flags); - CVar(std::string_view name, const atVec4d& value, std::string_view help, EFlags flags); + CVar(std::string_view name, const zeus::CVector2f& value, std::string_view help, EFlags flags); + CVar(std::string_view name, const zeus::CVector2d& value, std::string_view help, EFlags flags); + CVar(std::string_view name, const zeus::CVector3f& value, std::string_view help, EFlags flags); + CVar(std::string_view name, const zeus::CVector3d& value, std::string_view help, EFlags flags); + CVar(std::string_view name, const zeus::CVector4f& value, std::string_view help, EFlags flags); + CVar(std::string_view name, const zeus::CVector4d& value, std::string_view help, EFlags flags); CVar(std::string_view name, double value, std::string_view help, EFlags flags); CVar(std::string_view name, bool value, std::string_view help, EFlags flags); CVar(std::string_view name, int32_t value, std::string_view help, EFlags flags); @@ -78,12 +106,12 @@ public: template inline bool toValue(T& value) const; - atVec2f toVec2f(bool* isValid = nullptr) const; - atVec2d toVec2d(bool* isValid = nullptr) const; - atVec3f toVec3f(bool* isValid = nullptr) const; - atVec3d toVec3d(bool* isValid = nullptr) const; - atVec4f toVec4f(bool* isValid = nullptr) const; - atVec4d toVec4d(bool* isValid = nullptr) const; + zeus::CVector2f toVec2f(bool* isValid = nullptr) const; + zeus::CVector2d toVec2d(bool* isValid = nullptr) const; + zeus::CVector3f toVec3f(bool* isValid = nullptr) const; + zeus::CVector3d toVec3d(bool* isValid = nullptr) const; + zeus::CVector4f toVec4f(bool* isValid = nullptr) const; + zeus::CVector4d toVec4d(bool* isValid = nullptr) const; double toReal(bool* isValid = nullptr) const; bool toBoolean(bool* isValid = nullptr) const; int32_t toSigned(bool* isValid = nullptr) const; @@ -94,12 +122,12 @@ public: inline bool fromValue(T value) { return false; } - bool fromVec2f(const atVec2f& val); - bool fromVec2d(const atVec2d& val); - bool fromVec3f(const atVec3f& val); - bool fromVec3d(const atVec3d& val); - bool fromVec4f(const atVec4f& val); - bool fromVec4d(const atVec4d& val); + bool fromVec2f(const zeus::CVector2f& val); + bool fromVec2d(const zeus::CVector2d& val); + bool fromVec3f(const zeus::CVector3f& val); + bool fromVec3d(const zeus::CVector3d& val); + bool fromVec4f(const zeus::CVector4f& val); + bool fromVec4d(const zeus::CVector4d& val); bool fromReal(double val); bool fromBoolean(bool val); bool fromInteger(int32_t val); @@ -177,37 +205,37 @@ private: }; template <> -inline bool CVar::toValue(atVec2f& value) const { +inline bool CVar::toValue(zeus::CVector2f& value) const { bool isValid = false; value = toVec2f(&isValid); return isValid; } template <> -inline bool CVar::toValue(atVec2d& value) const { +inline bool CVar::toValue(zeus::CVector2d& value) const { bool isValid = false; value = toVec2d(&isValid); return isValid; } template <> -inline bool CVar::toValue(atVec3f& value) const { +inline bool CVar::toValue(zeus::CVector3f& value) const { bool isValid = false; value = toVec3f(&isValid); return isValid; } template <> -inline bool CVar::toValue(atVec3d& value) const { +inline bool CVar::toValue(zeus::CVector3d& value) const { bool isValid = false; value = toVec3d(&isValid); return isValid; } template <> -inline bool CVar::toValue(atVec4f& value) const { +inline bool CVar::toValue(zeus::CVector4f& value) const { bool isValid = false; value = toVec4f(&isValid); return isValid; } template <> -inline bool CVar::toValue(atVec4d& value) const { +inline bool CVar::toValue(zeus::CVector4d& value) const { bool isValid = false; value = toVec4d(&isValid); return isValid; @@ -250,27 +278,27 @@ inline bool CVar::toValue(std::string& value) const { } template <> -inline bool CVar::fromValue(const atVec2f& val) { +inline bool CVar::fromValue(const zeus::CVector2f& val) { return fromVec2f(val); } template <> -inline bool CVar::fromValue(const atVec2d& val) { +inline bool CVar::fromValue(const zeus::CVector2d& val) { return fromVec2d(val); } template <> -inline bool CVar::fromValue(const atVec3f& val) { +inline bool CVar::fromValue(const zeus::CVector3f& val) { return fromVec3f(val); } template <> -inline bool CVar::fromValue(const atVec3d& val) { +inline bool CVar::fromValue(const zeus::CVector3d& val) { return fromVec3d(val); } template <> -inline bool CVar::fromValue(const atVec4f& val) { +inline bool CVar::fromValue(const zeus::CVector4f& val) { return fromVec4f(val); } template <> -inline bool CVar::fromValue(const atVec4d& val) { +inline bool CVar::fromValue(const zeus::CVector4d& val) { return fromVec4d(val); } template <> @@ -350,4 +378,4 @@ public: } } }; -} // namespace hecl +} // namespace metaforce diff --git a/Runtime/ConsoleVariables/CVarCommons.cpp b/Runtime/ConsoleVariables/CVarCommons.cpp new file mode 100644 index 000000000..df37061c7 --- /dev/null +++ b/Runtime/ConsoleVariables/CVarCommons.cpp @@ -0,0 +1,78 @@ +#include "Runtime/ConsoleVariables/CVarCommons.hpp" + +namespace metaforce { +namespace { +CVarCommons* m_instance = nullptr; +} + +CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) { + m_fullscreen = m_mgr.findOrMakeCVar("fullscreen"sv, "Start in fullscreen"sv, false, + CVar::EFlags::System | CVar::EFlags::Archive); + m_graphicsApi = m_mgr.findOrMakeCVar("graphicsApi"sv, "API to use for rendering graphics"sv, DEFAULT_GRAPHICS_API, + CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart); + m_drawSamples = m_mgr.findOrMakeCVar("drawSamples"sv, "Number of MSAA samples to use for render targets"sv, 1, + CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart); + m_texAnisotropy = + m_mgr.findOrMakeCVar("texAnisotropy"sv, "Number of anisotropic samples to use for sampling textures"sv, 1, + CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart); + m_deepColor = m_mgr.findOrMakeCVar("deepColor"sv, "Allow framebuffer with color depth greater-then 24-bits"sv, false, + CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart); + m_variableDt = m_mgr.findOrMakeCVar("variableDt", "Enable variable delta time (experimental)", false, + (CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart)); + m_lazyCommitResources = m_mgr.findOrMakeCVar("lazyCommitResources"sv, "Enable lazy commiting resources to GPU", true, + (CVar::EFlags::System | CVar::EFlags::Archive)); + + m_debugOverlayPlayerInfo = m_mgr.findOrMakeCVar( + "debugOverlay.playerInfo"sv, "Displays information about the player, such as location and orientation"sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugOverlayWorldInfo = m_mgr.findOrMakeCVar( + "debugOverlay.worldInfo"sv, "Displays information about the current world, such as world asset ID, and areaId"sv, + false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugOverlayAreaInfo = m_mgr.findOrMakeCVar( + "debugOverlay.areaInfo"sv, + "Displays information about the current area, such as asset ID, object/layer counts, and active layer bits"sv, + false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugOverlayLayerInfo = + m_mgr.findOrMakeCVar("debugOverlay.layerInfo"sv, "Displays information about the currently active area layers"sv, + false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugOverlayShowFrameCounter = + m_mgr.findOrMakeCVar("debugOverlay.showFrameCounter"sv, "Displays the current frame index"sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugOverlayShowFramerate = + m_mgr.findOrMakeCVar("debugOverlay.showFramerate"sv, "Displays the current framerate"sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugOverlayShowInGameTime = + m_mgr.findOrMakeCVar("debugOverlay.showInGameTime"sv, "Displays the current in game time"sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugOverlayShowRoomTimer = m_mgr.findOrMakeCVar( + "debugOverlay.showRoomTimer", "Displays the current/last room timers in seconds and frames"sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugOverlayShowResourceStats = m_mgr.findOrMakeCVar( + "debugOverlay.showResourceStats"sv, "Displays the current live resource object and token counts"sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugOverlayShowRandomStats = + m_mgr.findOrMakeCVar("debugOverlay.showRandomStats", "Displays the current number of random calls per frame"sv, + false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugOverlayShowInput = m_mgr.findOrMakeCVar("debugOverlay.showInput"sv, "Displays user input"sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugToolDrawAiPath = + m_mgr.findOrMakeCVar("debugTool.drawAiPath", "Draws the selected paths of any AI in the room"sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugToolDrawLighting = m_mgr.findOrMakeCVar("debugTool.drawLighting", "Draws the lighting setup in a room"sv, + false, CVar::EFlags::Game | CVar::EFlags::ReadOnly); + m_debugToolDrawCollisionActors = + m_mgr.findOrMakeCVar("debugTool.drawCollisionActors", "Draws the collision actors for enemies and objects"sv, + false, CVar::EFlags::Game | CVar::EFlags::ReadOnly); + m_debugToolDrawMazePath = m_mgr.findOrMakeCVar("debugTool.drawMazePath", "Draws the maze path in Dynamo"sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_debugToolDrawPlatformCollision = + m_mgr.findOrMakeCVar("debugTool.drawPlatformCollision", "Draws the bounding boxes of platforms"sv, false, + CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); + m_logFile = m_mgr.findOrMakeCVar("logFile"sv, "Any log prints will be stored to this file upon exit"sv, "app.log"sv, + CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::ModifyRestart); + + m_instance = this; +} + +CVarCommons* CVarCommons::instance() { return m_instance; } +} // namespace metaforce diff --git a/hecl/include/hecl/CVarCommons.hpp b/Runtime/ConsoleVariables/CVarCommons.hpp similarity index 97% rename from hecl/include/hecl/CVarCommons.hpp rename to Runtime/ConsoleVariables/CVarCommons.hpp index 5dc39170c..4a224ffc3 100644 --- a/hecl/include/hecl/CVarCommons.hpp +++ b/Runtime/ConsoleVariables/CVarCommons.hpp @@ -4,12 +4,12 @@ #include #include -#include "hecl/CVarManager.hpp" +#include "Runtime/ConsoleVariables/CVarManager.hpp" #undef min #undef max -namespace hecl { +namespace metaforce { using namespace std::literals; diff --git a/hecl/lib/CVarManager.cpp b/Runtime/ConsoleVariables/CVarManager.cpp similarity index 95% rename from hecl/lib/CVarManager.cpp rename to Runtime/ConsoleVariables/CVarManager.cpp index de5cd6a73..2d3033f58 100644 --- a/hecl/lib/CVarManager.cpp +++ b/Runtime/ConsoleVariables/CVarManager.cpp @@ -1,16 +1,13 @@ -#include "hecl/CVarManager.hpp" +#include "Runtime/ConsoleVariables/CVarManager.hpp" +#include "Runtime/ConsoleVariables/FileStoreManager.hpp" + +#include #include #include #include -#include "hecl/hecl.hpp" -#include "hecl/Runtime.hpp" - -#include -#include - -namespace hecl { +namespace metaforce { CVar* com_developer = nullptr; CVar* com_configfile = nullptr; @@ -21,7 +18,7 @@ static const std::regex cmdLineRegex(R"(\+([\w\.]+)([=])?([\/\\\s\w\.\-]+)?)"); CVarManager* CVarManager::m_instance = nullptr; static logvisor::Module CVarLog("CVarManager"); -CVarManager::CVarManager(hecl::Runtime::FileStoreManager& store, bool useBinary) +CVarManager::CVarManager(FileStoreManager& store, bool useBinary) : m_store(store), m_useBinary(useBinary) { m_instance = this; com_configfile = @@ -108,16 +105,16 @@ void CVarManager::deserialize(CVar* cvar) { if (!cvar->isArchive() && !cvar->isInternalArchivable()) { return; } - +#if 0 // TODO: Reimplement this /* We were either unable to find a deferred value or got an invalid value */ std::string filename = std::string(m_store.getStoreRoot()) + '/' + com_configfile->toLiteral(); - hecl::Sstat st; + CBascis::Sstat st; if (m_useBinary) { CVarContainer container; filename += ".bin"; - if (hecl::Stat(filename.c_str(), &st) || !S_ISREG(st.st_mode)) + if (CBascis::Stat(filename.c_str(), &st) || !S_ISREG(st.st_mode)) return; athena::io::FileReader reader(filename); if (reader.isOpen()) @@ -139,7 +136,7 @@ void CVarManager::deserialize(CVar* cvar) { } } else { filename += ".yaml"; - if (hecl::Stat(filename.c_str(), &st) || !S_ISREG(st.st_mode)) + if (Stat(filename.c_str(), &st) || !S_ISREG(st.st_mode)) return; athena::io::FileReader reader(filename); if (reader.isOpen()) { @@ -161,9 +158,11 @@ void CVarManager::deserialize(CVar* cvar) { } } } +#endif } void CVarManager::serialize() { +#if 0 // TODO: reimplement this std::string filename = std::string(m_store.getStoreRoot()) + '/' + com_configfile->toLiteral(); @@ -202,6 +201,7 @@ void CVarManager::serialize() { if (w.isOpen()) docWriter.finish(&w); } +#endif } CVarManager* CVarManager::instance() { return m_instance; } diff --git a/hecl/include/hecl/CVarManager.hpp b/Runtime/ConsoleVariables/CVarManager.hpp similarity index 78% rename from hecl/include/hecl/CVarManager.hpp rename to Runtime/ConsoleVariables/CVarManager.hpp index cc72f68ed..d2fad8599 100644 --- a/hecl/include/hecl/CVarManager.hpp +++ b/Runtime/ConsoleVariables/CVarManager.hpp @@ -5,18 +5,16 @@ #include #include -#include "hecl/CVar.hpp" +#include "Runtime/ConsoleVariables/CVar.hpp" -namespace hecl { -namespace Runtime { +namespace metaforce { class FileStoreManager; -} extern CVar* com_developer; extern CVar* com_configfile; extern CVar* com_enableCheats; extern CVar* com_cubemaps; class CVarManager final { - using CVarContainer = DNACVAR::CVarContainer; + using CVarContainer = StoreCVar::CVarContainer; template CVar* _newCVar(std::string_view name, std::string_view help, const T& value, CVar::EFlags flags) { if (CVar* ret = registerCVar(std::make_unique(name, value, help, flags))) { @@ -26,7 +24,7 @@ class CVarManager final { return nullptr; } - hecl::Runtime::FileStoreManager& m_store; + FileStoreManager& m_store; bool m_useBinary; static CVarManager* m_instance; @@ -35,26 +33,26 @@ public: CVarManager(const CVarManager&) = delete; CVarManager& operator=(const CVarManager&) = delete; CVarManager& operator=(const CVarManager&&) = delete; - CVarManager(hecl::Runtime::FileStoreManager& store, bool useBinary = false); + CVarManager(FileStoreManager& store, bool useBinary = false); ~CVarManager(); - CVar* newCVar(std::string_view name, std::string_view help, const atVec2f& value, CVar::EFlags flags) { - return _newCVar(name, help, value, flags); + CVar* newCVar(std::string_view name, std::string_view help, const zeus::CVector2f& value, CVar::EFlags flags) { + return _newCVar(name, help, value, flags); } - CVar* newCVar(std::string_view name, std::string_view help, const atVec2d& value, CVar::EFlags flags) { - return _newCVar(name, help, value, flags); + CVar* newCVar(std::string_view name, std::string_view help, const zeus::CVector2d& value, CVar::EFlags flags) { + return _newCVar(name, help, value, flags); } - CVar* newCVar(std::string_view name, std::string_view help, const atVec3f& value, CVar::EFlags flags) { - return _newCVar(name, help, value, flags); + CVar* newCVar(std::string_view name, std::string_view help, const zeus::CVector3f& value, CVar::EFlags flags) { + return _newCVar(name, help, value, flags); } - CVar* newCVar(std::string_view name, std::string_view help, const atVec3d& value, CVar::EFlags flags) { - return _newCVar(name, help, value, flags); + CVar* newCVar(std::string_view name, std::string_view help, const zeus::CVector3d& value, CVar::EFlags flags) { + return _newCVar(name, help, value, flags); } - CVar* newCVar(std::string_view name, std::string_view help, const atVec4f& value, CVar::EFlags flags) { - return _newCVar(name, help, value, flags); + CVar* newCVar(std::string_view name, std::string_view help, const zeus::CVector4f& value, CVar::EFlags flags) { + return _newCVar(name, help, value, flags); } - CVar* newCVar(std::string_view name, std::string_view help, const atVec4d& value, CVar::EFlags flags) { - return _newCVar(name, help, value, flags); + CVar* newCVar(std::string_view name, std::string_view help, const zeus::CVector4d& value, CVar::EFlags flags) { + return _newCVar(name, help, value, flags); } CVar* newCVar(std::string_view name, std::string_view help, std::string_view value, CVar::EFlags flags) { return _newCVar(name, help, value, flags); diff --git a/hecl/lib/Runtime/FileStoreManager.cpp b/Runtime/ConsoleVariables/FileStoreManager.cpp similarity index 83% rename from hecl/lib/Runtime/FileStoreManager.cpp rename to Runtime/ConsoleVariables/FileStoreManager.cpp index 91c585e0d..58b573689 100644 --- a/hecl/lib/Runtime/FileStoreManager.cpp +++ b/Runtime/ConsoleVariables/FileStoreManager.cpp @@ -1,8 +1,8 @@ -#include "hecl/Runtime.hpp" +#include "Runtime/ConsoleVariables/FileStoreManager.hpp" -#include "hecl/hecl.hpp" +#include "Runtime/CBasics.hpp" -#include +#include "logvisor/logvisor.hpp" #if _WIN32 #include @@ -12,7 +12,7 @@ using namespace Windows::Storage; #endif -namespace hecl::Runtime { +namespace metaforce { static logvisor::Module Log("FileStoreManager"); FileStoreManager::FileStoreManager(std::string_view domain) : m_domain(domain) { @@ -29,11 +29,11 @@ FileStoreManager::FileStoreManager(std::string_view domain) : m_domain(domain) { #endif path += "/.heclrun"; - hecl::MakeDir(path.c_str()); + CBasics::MakeDir(path.c_str()); path += '/'; path += domain.data(); - hecl::MakeDir(path.c_str()); + CBasics::MakeDir(path.c_str()); m_storeRoot = path; #else const char* xdg_data_home = getenv("XDG_DATA_HOME"); @@ -51,7 +51,7 @@ FileStoreManager::FileStoreManager(std::string_view domain) : m_domain(domain) { } path += "/hecl/"; path += domain.data(); - if (RecursiveMakeDir(path.c_str()) != 0) + if (CBasics::RecursiveMakeDir(path.c_str()) != 0) Log.report(logvisor::Fatal, FMT_STRING("unable to mkdir at {}"), path); m_storeRoot = path; #endif diff --git a/Runtime/ConsoleVariables/FileStoreManager.hpp b/Runtime/ConsoleVariables/FileStoreManager.hpp new file mode 100644 index 000000000..20dcf150c --- /dev/null +++ b/Runtime/ConsoleVariables/FileStoreManager.hpp @@ -0,0 +1,22 @@ +#pragma once +#include +#include + +namespace metaforce { +/** + * @brief Per-platform file store resolution + */ +class FileStoreManager { + std::string m_domain; + std::string m_storeRoot; + +public: + FileStoreManager(std::string_view domain); + std::string_view getDomain() const { return m_domain; } + /** + * @brief Returns the full path to the file store, including domain + * @return Full path to store e.g /home/foo/.hecl/bar + */ + std::string_view getStoreRoot() const { return m_storeRoot; } +}; +} \ No newline at end of file diff --git a/Runtime/Graphics/CGraphics.hpp b/Runtime/Graphics/CGraphics.hpp index 2791af843..e480ec8f1 100644 --- a/Runtime/Graphics/CGraphics.hpp +++ b/Runtime/Graphics/CGraphics.hpp @@ -12,7 +12,7 @@ //#include //#include -#include +#include "ConsoleVariables/CVar.hpp" #include #include @@ -25,7 +25,7 @@ using frame_clock = std::chrono::high_resolution_clock; namespace metaforce { -extern hecl::CVar* g_disableLighting; +extern CVar* g_disableLighting; class CLight; class CTimeProvider; diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 4f24b4658..d82c15ad9 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -12,7 +12,7 @@ #include -#include +#include "ConsoleVariables/CVarManager.hpp" #include #include #include @@ -554,7 +554,7 @@ static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data, /* Ensure cubemap extension shaders fall back to non-cubemap equivalents if necessary */ EExtendedShader intermediateExtended = flags.m_extendedShader; - if (!hecl::com_cubemaps->toBoolean() || g_Renderer->IsThermalVisorHotPass() || g_Renderer->IsThermalVisorActive()) { + if (!com_cubemaps->toBoolean() || g_Renderer->IsThermalVisorHotPass() || g_Renderer->IsThermalVisorActive()) { if (intermediateExtended == EExtendedShader::LightingCubeReflection) intermediateExtended = EExtendedShader::Lighting; else if (intermediateExtended == EExtendedShader::LightingCubeReflectionWorldShadow) diff --git a/Runtime/IMain.hpp b/Runtime/IMain.hpp index 3f99762b4..159c9677b 100644 --- a/Runtime/IMain.hpp +++ b/Runtime/IMain.hpp @@ -1,22 +1,30 @@ #pragma once #include "Runtime/RetroTypes.hpp" - -#include "DataSpec/DNACommon/MetaforceVersionInfo.hpp" #include "Runtime/CMainFlowBase.hpp" +#include "Runtime/ConsoleVariables/FileStoreManager.hpp" + #include #include #include -#include - -namespace hecl { -class Console; -class CVarManager; -} // namespace hecl namespace metaforce { -using ERegion = DataSpec::ERegion; -using EGame = DataSpec::EGame; +class Console; +class CVarManager; +enum class ERegion { Invalid = -1, NTSC_U = 'E', PAL = 'P', NTSC_J = 'J' }; +enum class EGame { + Invalid = 0, + MetroidPrime1, + MetroidPrime2, + MetroidPrime3, +}; + +struct MetaforceVersionInfo { + std::string version; + ERegion region; + EGame game; + bool isTrilogy; +}; class CStopwatch; enum class EGameplayResult { None, Win, Lose, Playing }; @@ -24,7 +32,7 @@ enum class EGameplayResult { None, Win, Lose, Playing }; class IMain { public: virtual ~IMain() = default; - virtual void Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarManager* cvarMgr, + virtual void Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) = 0; virtual void Draw() = 0; virtual bool Proc(float dt) = 0; diff --git a/Runtime/ImGuiConsole.cpp b/Runtime/ImGuiConsole.cpp index 93abfcc40..cf9d9bb66 100644 --- a/Runtime/ImGuiConsole.cpp +++ b/Runtime/ImGuiConsole.cpp @@ -379,14 +379,14 @@ void ImGuiConsole::ShowConsoleVariablesWindow() { } ImGui::SameLine(); ImGui::InputText("Filter", &m_cvarFiltersText); - auto cvars = m_cvarMgr.cvars(hecl::CVar::EFlags::Any & ~hecl::CVar::EFlags::Hidden); + auto cvars = m_cvarMgr.cvars(CVar::EFlags::Any & ~CVar::EFlags::Hidden); if (ImGui::Button("Reset to defaults")) { for (auto* cv : cvars) { if (cv->name() == "developer" || cv->name() == "cheats") { // don't reset developer or cheats to default continue; } - hecl::CVarUnlocker l(cv); + CVarUnlocker l(cv); cv->fromLiteralToType(cv->defaultValue()); } } @@ -405,7 +405,7 @@ void ImGuiConsole::ShowConsoleVariablesWindow() { bool hasSortSpec = sortSpecs != nullptr && // no multi-sort sortSpecs->SpecsCount == 1; - std::vector sortedList; + std::vector sortedList; sortedList.reserve(cvars.size()); for (auto* cvar : cvars) { @@ -422,12 +422,12 @@ void ImGuiConsole::ShowConsoleVariablesWindow() { if (hasSortSpec) { const auto& spec = sortSpecs->Specs[0]; if (spec.ColumnUserID == 'name') { - std::sort(sortedList.begin(), sortedList.end(), [&](hecl::CVar* a, hecl::CVar* b) { + std::sort(sortedList.begin(), sortedList.end(), [&](CVar* a, CVar* b) { int compare = a->name().compare(b->name()); return spec.SortDirection == ImGuiSortDirection_Ascending ? compare < 0 : compare > 0; }); } else if (spec.ColumnUserID == 'val') { - std::sort(sortedList.begin(), sortedList.end(), [&](hecl::CVar* a, hecl::CVar* b) { + std::sort(sortedList.begin(), sortedList.end(), [&](CVar* a, CVar* b) { int compare = a->value().compare(b->value()); return spec.SortDirection == ImGuiSortDirection_Ascending ? compare < 0 : compare > 0; }); @@ -447,35 +447,35 @@ void ImGuiConsole::ShowConsoleVariablesWindow() { // Value if (ImGui::TableNextColumn()) { switch (cv->type()) { - case hecl::CVar::EType::Boolean: { + case CVar::EType::Boolean: { bool b = cv->toBoolean(); if (ImGui::Checkbox("", &b)) { cv->fromBoolean(b); } break; } - case hecl::CVar::EType::Real: { + case CVar::EType::Real: { float f = cv->toReal(); if (ImGui::DragFloat("", &f)) { cv->fromReal(f); } break; } - case hecl::CVar::EType::Signed: { + case CVar::EType::Signed: { std::array i{cv->toSigned()}; if (ImGui::DragScalar("", ImGuiDataType_S32, i.data(), i.size())) { cv->fromInteger(i[0]); } break; } - case hecl::CVar::EType::Unsigned: { + case CVar::EType::Unsigned: { std::array i{cv->toUnsigned()}; if (ImGui::DragScalar("", ImGuiDataType_U32, i.data(), i.size())) { cv->fromInteger(i[0]); } break; } - case hecl::CVar::EType::Literal: { + case CVar::EType::Literal: { char buf[4096]; strcpy(buf, cv->value().c_str()); if (ImGui::InputText("", buf, 4096, ImGuiInputTextFlags_EnterReturnsTrue)) { @@ -483,102 +483,102 @@ void ImGuiConsole::ShowConsoleVariablesWindow() { } break; } - case hecl::CVar::EType::Vec2f: { + case CVar::EType::Vec2f: { auto vec = cv->toVec2f(); - std::array scalars = {vec.simd[0], vec.simd[1]}; + std::array scalars = {vec.x(), vec.y()}; if (ImGui::DragScalarN("", ImGuiDataType_Float, scalars.data(), scalars.size(), 0.1f)) { - vec.simd[0] = scalars[0]; - vec.simd[1] = scalars[1]; + vec.x() = scalars[0]; + vec.y() = scalars[1]; cv->fromVec2f(vec); } break; } - case hecl::CVar::EType::Vec2d: { + case CVar::EType::Vec2d: { auto vec = cv->toVec2d(); - std::array scalars = {vec.simd[0], vec.simd[1]}; + std::array scalars = {vec.x(), vec.y()}; if (ImGui::DragScalarN("", ImGuiDataType_Double, scalars.data(), scalars.size(), 0.1f)) { - vec.simd[0] = scalars[0]; - vec.simd[1] = scalars[1]; + vec.x() = scalars[0]; + vec.y() = scalars[1]; cv->fromVec2d(vec); } break; } - case hecl::CVar::EType::Vec3f: { + case CVar::EType::Vec3f: { auto vec = cv->toVec3f(); - std::array scalars = {vec.simd[0], vec.simd[1]}; + std::array scalars = {vec.x(), vec.y(), vec.z()}; if (cv->isColor()) { if (ImGui::ColorEdit3("", scalars.data())) { - vec.simd[0] = scalars[0]; - vec.simd[1] = scalars[1]; - vec.simd[2] = scalars[2]; + vec.x() = scalars[0]; + vec.y() = scalars[1]; + vec.z() = scalars[2]; cv->fromVec3f(vec); } } else if (ImGui::DragScalarN("", ImGuiDataType_Float, scalars.data(), scalars.size(), 0.1f)) { - vec.simd[0] = scalars[0]; - vec.simd[1] = scalars[1]; - vec.simd[2] = scalars[2]; + vec.x() = scalars[0]; + vec.y() = scalars[1]; + vec.z() = scalars[2]; cv->fromVec3f(vec); } break; } - case hecl::CVar::EType::Vec3d: { + case CVar::EType::Vec3d: { auto vec = cv->toVec3d(); - std::array scalars = {vec.simd[0], vec.simd[1], vec.simd[2]}; + std::array scalars = {vec.x(), vec.y(), vec.z()}; if (cv->isColor()) { std::array color{static_cast(scalars[0]), static_cast(scalars[1]), static_cast(scalars[2])}; if (ImGui::ColorEdit3("", color.data())) { - vec.simd[0] = color[0]; - vec.simd[1] = color[1]; - vec.simd[2] = color[2]; + vec.x() = scalars[0]; + vec.y() = scalars[1]; + vec.z() = scalars[2]; cv->fromVec3d(vec); } } else if (ImGui::DragScalarN("", ImGuiDataType_Double, scalars.data(), scalars.size(), 0.1f)) { - vec.simd[0] = scalars[0]; - vec.simd[1] = scalars[1]; - vec.simd[2] = scalars[2]; + vec.x() = scalars[0]; + vec.y() = scalars[1]; + vec.z() = scalars[2]; cv->fromVec3d(vec); } break; } - case hecl::CVar::EType::Vec4f: { + case CVar::EType::Vec4f: { auto vec = cv->toVec4f(); - std::array scalars = {vec.simd[0], vec.simd[1], vec.simd[2], vec.simd[3]}; + std::array scalars = {vec.x(), vec.y(), vec.z(), vec.w()}; if (cv->isColor()) { if (ImGui::ColorEdit4("", scalars.data())) { - vec.simd[0] = scalars[0]; - vec.simd[1] = scalars[1]; - vec.simd[2] = scalars[2]; - vec.simd[3] = scalars[3]; + vec.x() = scalars[0]; + vec.y() = scalars[1]; + vec.z() = scalars[2]; + vec.w() = scalars[2]; cv->fromVec4f(vec); } } else if (ImGui::DragScalarN("", ImGuiDataType_Float, scalars.data(), scalars.size(), 0.1f)) { - vec.simd[0] = scalars[0]; - vec.simd[1] = scalars[1]; - vec.simd[2] = scalars[2]; - vec.simd[3] = scalars[3]; + vec.x() = scalars[0]; + vec.y() = scalars[1]; + vec.z() = scalars[2]; + vec.w() = scalars[2]; cv->fromVec4f(vec); } break; } - case hecl::CVar::EType::Vec4d: { + case CVar::EType::Vec4d: { auto vec = cv->toVec4d(); - std::array scalars = {vec.simd[0], vec.simd[1], vec.simd[2], vec.simd[3]}; + std::array scalars = {vec.x(), vec.y(), vec.z(), vec.w()}; if (cv->isColor()) { std::array color{static_cast(scalars[0]), static_cast(scalars[1]), static_cast(scalars[2]), static_cast(scalars[3])}; if (ImGui::ColorEdit4("", color.data())) { - vec.simd[0] = color[0]; - vec.simd[1] = color[1]; - vec.simd[2] = color[2]; - vec.simd[3] = color[3]; + vec.x() = scalars[0]; + vec.y() = scalars[1]; + vec.z() = scalars[2]; + vec.w() = scalars[2]; cv->fromVec4d(vec); } } else if (ImGui::DragScalarN("", ImGuiDataType_Double, scalars.data(), scalars.size(), 0.1f)) { - vec.simd[0] = scalars[0]; - vec.simd[1] = scalars[1]; - vec.simd[2] = scalars[2]; - vec.simd[3] = scalars[3]; + vec.x() = scalars[0]; + vec.y() = scalars[1]; + vec.z() = scalars[2]; + vec.w() = scalars[2]; cv->fromVec4d(vec); } break; @@ -1156,21 +1156,19 @@ void ImGuiConsole::PreUpdate() { OPTICK_EVENT(); if (!m_isInitialized) { m_isInitialized = true; - m_cvarCommons.m_debugOverlayShowFrameCounter->addListener( - [this](hecl::CVar* c) { m_frameCounter = c->toBoolean(); }); - m_cvarCommons.m_debugOverlayShowFramerate->addListener([this](hecl::CVar* c) { m_frameRate = c->toBoolean(); }); - m_cvarCommons.m_debugOverlayShowInGameTime->addListener([this](hecl::CVar* c) { m_inGameTime = c->toBoolean(); }); - m_cvarCommons.m_debugOverlayShowRoomTimer->addListener([this](hecl::CVar* c) { m_roomTimer = c->toBoolean(); }); - m_cvarCommons.m_debugOverlayPlayerInfo->addListener([this](hecl::CVar* c) { m_playerInfo = c->toBoolean(); }); - m_cvarCommons.m_debugOverlayWorldInfo->addListener([this](hecl::CVar* c) { m_worldInfo = c->toBoolean(); }); - m_cvarCommons.m_debugOverlayAreaInfo->addListener([this](hecl::CVar* c) { m_areaInfo = c->toBoolean(); }); - m_cvarCommons.m_debugOverlayLayerInfo->addListener([this](hecl::CVar* c) { m_layerInfo = c->toBoolean(); }); - m_cvarCommons.m_debugOverlayShowRandomStats->addListener([this](hecl::CVar* c) { m_randomStats = c->toBoolean(); }); - m_cvarCommons.m_debugOverlayShowResourceStats->addListener( - [this](hecl::CVar* c) { m_resourceStats = c->toBoolean(); }); - m_cvarCommons.m_debugOverlayShowInput->addListener([this](hecl::CVar* c) { m_showInput = c->toBoolean(); }); - m_cvarMgr.findCVar("developer")->addListener([this](hecl::CVar* c) { m_developer = c->toBoolean(); }); - m_cvarMgr.findCVar("cheats")->addListener([this](hecl::CVar* c) { m_cheats = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowFrameCounter->addListener([this](CVar* c) { m_frameCounter = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowFramerate->addListener([this](CVar* c) { m_frameRate = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowInGameTime->addListener([this](CVar* c) { m_inGameTime = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowRoomTimer->addListener([this](CVar* c) { m_roomTimer = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayPlayerInfo->addListener([this](CVar* c) { m_playerInfo = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayWorldInfo->addListener([this](CVar* c) { m_worldInfo = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayAreaInfo->addListener([this](CVar* c) { m_areaInfo = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayLayerInfo->addListener([this](CVar* c) { m_layerInfo = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowRandomStats->addListener([this](CVar* c) { m_randomStats = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowResourceStats->addListener([this](CVar* c) { m_resourceStats = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowInput->addListener([this](CVar* c) { m_showInput = c->toBoolean(); }); + m_cvarMgr.findCVar("developer")->addListener([this](CVar* c) { m_developer = c->toBoolean(); }); + m_cvarMgr.findCVar("cheats")->addListener([this](CVar* c) { m_cheats = c->toBoolean(); }); } // We ned to make sure we have a valid CRandom16 at all times, so lets do that here if (g_StateManager != nullptr && g_StateManager->GetActiveRandom() == nullptr) { diff --git a/Runtime/ImGuiConsole.hpp b/Runtime/ImGuiConsole.hpp index a34de864c..1df6321ea 100644 --- a/Runtime/ImGuiConsole.hpp +++ b/Runtime/ImGuiConsole.hpp @@ -3,13 +3,13 @@ #include #include -#include "RetroTypes.hpp" +#include "Runtime/RetroTypes.hpp" #include "Runtime/World/CActor.hpp" #include "Runtime/World/CEntity.hpp" #include "Runtime/ImGuiPlayerLoadouts.hpp" -#include "hecl/CVarCommons.hpp" -#include "hecl/CVarManager.hpp" +#include "Runtime/ConsoleVariables/CVarCommons.hpp" +#include "Runtime/ConsoleVariables/CVarManager.hpp" #include @@ -39,7 +39,7 @@ public: static std::array entities; static ImGuiPlayerLoadouts loadouts; - ImGuiConsole(hecl::CVarManager& cvarMgr, hecl::CVarCommons& cvarCommons) + ImGuiConsole(CVarManager& cvarMgr, CVarCommons& cvarCommons) : m_cvarMgr(cvarMgr), m_cvarCommons(cvarCommons) {} void PreUpdate(); void PostUpdate(); @@ -50,8 +50,8 @@ public: static void EndEntityRow(const ImGuiEntityEntry& entry); private: - hecl::CVarManager& m_cvarMgr; - hecl::CVarCommons& m_cvarCommons; + CVarManager& m_cvarMgr; + CVarCommons& m_cvarCommons; bool m_showInspectWindow = false; bool m_showDemoWindow = false; diff --git a/Runtime/MP1/CTweaks.cpp b/Runtime/MP1/CTweaks.cpp index 899fb32df..7a8485c5e 100644 --- a/Runtime/MP1/CTweaks.cpp +++ b/Runtime/MP1/CTweaks.cpp @@ -25,7 +25,7 @@ namespace metaforce::MP1 { static logvisor::Module Log("MP1::CTweaks"); -void CTweaks::RegisterTweaks(hecl::CVarManager* cvarMgr) { +void CTweaks::RegisterTweaks(CVarManager* cvarMgr) { std::optional strm; const SObjectTag* tag; @@ -121,7 +121,7 @@ void CTweaks::RegisterTweaks(hecl::CVarManager* cvarMgr) { g_tweakSlideShow->initCVars(cvarMgr); } -void CTweaks::RegisterResourceTweaks(hecl::CVarManager* cvarMgr) { +void CTweaks::RegisterResourceTweaks(CVarManager* cvarMgr) { std::optional strm; const SObjectTag* tag = g_ResFactory->GetResourceIdByName("GunRes"); diff --git a/Runtime/MP1/CTweaks.hpp b/Runtime/MP1/CTweaks.hpp index 0a0770fa9..7bd4d3ca1 100644 --- a/Runtime/MP1/CTweaks.hpp +++ b/Runtime/MP1/CTweaks.hpp @@ -2,18 +2,15 @@ #include "Runtime/RetroTypes.hpp" -namespace hecl { -class CVarManager; -} - namespace metaforce { +class CVarManager; namespace MP1 { class CTweaks { public: - void RegisterTweaks(hecl::CVarManager* cvarMgr); - void RegisterResourceTweaks(hecl::CVarManager* cvarMgr); + void RegisterTweaks(CVarManager* cvarMgr); + void RegisterResourceTweaks(CVarManager* cvarMgr); }; } // namespace MP1 diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index 6574b8499..ff18c425f 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -551,11 +551,11 @@ void CMain::HandleDiscordErrored(int errorCode, const char* message) { DiscordLog.report(logvisor::Error, FMT_STRING("Discord Error: {}"), message); } -void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarManager* cvarMgr, +void CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) { InitializeDiscord(); m_cvarMgr = cvarMgr; - m_cvarCommons = std::make_unique(*m_cvarMgr); + m_cvarCommons = std::make_unique(*m_cvarMgr); bool loadedVersion = false; #if 0 @@ -582,10 +582,10 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarMana static_cast(memmem(buf.get(), readLen, "MetroidBuildInfo", 16)) + 19; if (buildInfo != nullptr) { // TODO - m_version = DataSpec::MetaforceVersionInfo{ + m_version = MetaforceVersionInfo{ .version = std::string(buildInfo), - .region = DataSpec::ERegion::NTSC_U, - .game = DataSpec::EGame::MetroidPrime1, + .region = ERegion::NTSC_U, + .game = EGame::MetroidPrime1, .isTrilogy = false, }; loadedVersion = true; diff --git a/Runtime/MP1/MP1.hpp b/Runtime/MP1/MP1.hpp index 98a5d99ed..173fef321 100644 --- a/Runtime/MP1/MP1.hpp +++ b/Runtime/MP1/MP1.hpp @@ -36,9 +36,9 @@ #include "Runtime/CArchitectureQueue.hpp" #include "Runtime/CTimeProvider.hpp" #include "Runtime/GuiSys/CTextExecuteBuffer.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp" -#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp" -#include "hecl/CVarCommons.hpp" +#include "Runtime/MP1/Tweaks/CTweakPlayer.hpp" +#include "Runtime/MP1/Tweaks/CTweakGame.hpp" +#include "Runtime/ConsoleVariables/CVarCommons.hpp" struct DiscordUser; @@ -243,9 +243,9 @@ private: std::unique_ptr x164_archSupport; // boo::IWindow* m_mainWindow = nullptr; - hecl::CVarManager* m_cvarMgr = nullptr; - std::unique_ptr m_cvarCommons; -// std::unique_ptr m_console; + CVarManager* m_cvarMgr = nullptr; + std::unique_ptr m_cvarCommons; +// std::unique_ptr m_console; // Warmup state std::vector m_warmupTags; std::vector::iterator m_warmupIt; @@ -253,7 +253,7 @@ private: bool m_loadedPersistentResources = false; bool m_doQuit = false; bool m_paused = false; - DataSpec::MetaforceVersionInfo m_version; + MetaforceVersionInfo m_version; void InitializeSubsystems(); static void InitializeDiscord(); @@ -279,7 +279,7 @@ public: // int RsMain(int argc, char** argv, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& // backend); - void Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarManager* cvarManager, + void Init(const FileStoreManager& storeMgr, CVarManager* cvarManager, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) override; void WarmupShaders() override; bool Proc(float dt) override; diff --git a/Runtime/MP1/Tweaks/CTweakAutoMapper.cpp b/Runtime/MP1/Tweaks/CTweakAutoMapper.cpp index 6701d4673..d8d52890c 100644 --- a/Runtime/MP1/Tweaks/CTweakAutoMapper.cpp +++ b/Runtime/MP1/Tweaks/CTweakAutoMapper.cpp @@ -1,8 +1,8 @@ #include "Runtime/MP1/Tweaks/CTweakAutoMapper.hpp" #include "Runtime/Streams/IOStreams.hpp" -#include -#include +#include "Runtime/ConsoleVariables/CVar.hpp" +#include "Runtime/ConsoleVariables/CVarManager.hpp" #define PREFIX(v) std::string_view("tweak.automap." #v) namespace metaforce::MP1 { @@ -27,26 +27,26 @@ constexpr std::string_view skSelectedVisitedSurfaceColor = PREFIX(SelectedVisite constexpr std::string_view skSelectedVisitedOutlineColor = PREFIX(SelectedVisitedOutlineColor); constexpr std::string_view skMapSurfaceNormalColorLinear = PREFIX(MapSurfaceNormalColorLinear); constexpr std::string_view skMapSurfaceNormalColorConstant = PREFIX(MapSurfaceNormalColorConstant); -hecl::CVar* tw_showOneMiniMapArea = nullptr; -hecl::CVar* tw_scaleMoveSpeedWithCamDist = nullptr; -hecl::CVar* tw_camDist = nullptr; -hecl::CVar* tw_minCamDist = nullptr; -hecl::CVar* tw_maxCamDist = nullptr; -hecl::CVar* tw_minCamRotX = nullptr; -hecl::CVar* tw_maxCamRotX = nullptr; -hecl::CVar* tw_camAngle = nullptr; -hecl::CVar* tw_widgetColor = nullptr; -hecl::CVar* tw_miniCamDist = nullptr; -hecl::CVar* tw_miniCamXAngle = nullptr; -hecl::CVar* tw_miniCamAngle = nullptr; -hecl::CVar* tw_visitedsurfaceColor = nullptr; -hecl::CVar* tw_visitedOutlineColor = nullptr; -hecl::CVar* tw_unvisitedSurfaceColor = nullptr; -hecl::CVar* tw_unvisitedOutlineColor = nullptr; -hecl::CVar* tw_selectedVisitedSurfaceColor = nullptr; -hecl::CVar* tw_selectedVisitedOutlineColor = nullptr; -hecl::CVar* tw_mapSurfaceNormColorLinear = nullptr; -hecl::CVar* tw_mapSurfaceNormColorConstant = nullptr; +CVar* tw_showOneMiniMapArea = nullptr; +CVar* tw_scaleMoveSpeedWithCamDist = nullptr; +CVar* tw_camDist = nullptr; +CVar* tw_minCamDist = nullptr; +CVar* tw_maxCamDist = nullptr; +CVar* tw_minCamRotX = nullptr; +CVar* tw_maxCamRotX = nullptr; +CVar* tw_camAngle = nullptr; +CVar* tw_widgetColor = nullptr; +CVar* tw_miniCamDist = nullptr; +CVar* tw_miniCamXAngle = nullptr; +CVar* tw_miniCamAngle = nullptr; +CVar* tw_visitedsurfaceColor = nullptr; +CVar* tw_visitedOutlineColor = nullptr; +CVar* tw_unvisitedSurfaceColor = nullptr; +CVar* tw_unvisitedOutlineColor = nullptr; +CVar* tw_selectedVisitedSurfaceColor = nullptr; +CVar* tw_selectedVisitedOutlineColor = nullptr; +CVar* tw_mapSurfaceNormColorLinear = nullptr; +CVar* tw_mapSurfaceNormColorConstant = nullptr; } // namespace CTweakAutoMapper::CTweakAutoMapper(CInputStream& in) { @@ -116,7 +116,7 @@ CTweakAutoMapper::CTweakAutoMapper(CInputStream& in) { x118_doorBorderColor = in.Get(); x11c_openDoorColor = in.Get(); } -void CTweakAutoMapper::_tweakListener(hecl::CVar* cv) { +void CTweakAutoMapper::_tweakListener(CVar* cv) { if (cv == tw_showOneMiniMapArea) { x4_24_showOneMiniMapArea = cv->toBoolean(); } else if (cv == tw_scaleMoveSpeedWithCamDist) { @@ -160,86 +160,84 @@ void CTweakAutoMapper::_tweakListener(hecl::CVar* cv) { } } -void CTweakAutoMapper::initCVars(hecl::CVarManager* mgr) { - auto assignBool = [this, mgr](std::string_view name, std::string_view desc, bool& v, hecl::CVar::EFlags flags) { - hecl::CVar* cv = mgr->findOrMakeCVar(name, desc, v, flags); +void CTweakAutoMapper::initCVars(CVarManager* mgr) { + auto assignBool = [this, mgr](std::string_view name, std::string_view desc, bool& v, CVar::EFlags flags) { + CVar* cv = mgr->findOrMakeCVar(name, desc, v, flags); // Check if the CVar was deserialized, this avoid an unnecessary conversion if (cv->wasDeserialized()) v = cv->toBoolean(); - cv->addListener([this](hecl::CVar* cv) { _tweakListener(cv); }); + cv->addListener([this](CVar* cv) { _tweakListener(cv); }); return cv; }; - auto assignRealValue = [this, mgr](std::string_view name, std::string_view desc, float& v, hecl::CVar::EFlags flags) { - hecl::CVar* cv = mgr->findOrMakeCVar(name, desc, v, flags); + auto assignRealValue = [this, mgr](std::string_view name, std::string_view desc, float& v, CVar::EFlags flags) { + CVar* cv = mgr->findOrMakeCVar(name, desc, v, flags); // Check if the CVar was deserialized, this avoid an unnecessary conversion if (cv->wasDeserialized()) v = cv->toReal(); - cv->addListener([this](hecl::CVar* cv) { _tweakListener(cv); }); + cv->addListener([this](CVar* cv) { _tweakListener(cv); }); return cv; }; auto assignColorValue = [this, mgr](std::string_view name, std::string_view desc, zeus::CColor& v, - hecl::CVar::EFlags flags) { - atVec4f vec{v.mSimd}; - hecl::CVar* cv = mgr->findOrMakeCVar(name, desc, vec, flags | hecl::CVar::EFlags::Color); + CVar::EFlags flags) { + zeus::CVector4f vec = v; + CVar* cv = mgr->findOrMakeCVar(name, desc, vec, flags | CVar::EFlags::Color); // Check if the CVar was deserialized, this avoid an unnecessary conversion if (cv->wasDeserialized()) v = zeus::CColor(cv->toVec4f()); - cv->addListener([this](hecl::CVar* cv) { _tweakListener(cv); }); + cv->addListener([this](CVar* cv) { _tweakListener(cv); }); return cv; }; tw_showOneMiniMapArea = assignBool(skShowOneMiniMapArea, "", x4_24_showOneMiniMapArea, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_scaleMoveSpeedWithCamDist = - assignBool(skScaleMoveSpeedWithCamDist, "", x4_26_scaleMoveSpeedWithCamDist, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_camDist = assignRealValue(skCamDist, "", x8_camDist, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_scaleMoveSpeedWithCamDist = assignBool(skScaleMoveSpeedWithCamDist, "", x4_26_scaleMoveSpeedWithCamDist, + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_camDist = + assignRealValue(skCamDist, "", x8_camDist, CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); tw_minCamDist = assignRealValue(skMinCameraDist, "", xc_minCamDist, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_maxCamDist = assignRealValue(skMaxCamDist, "", x10_maxCamDist, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_maxCamDist = + assignRealValue(skMaxCamDist, "", x10_maxCamDist, CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); tw_minCamRotX = assignRealValue(skMinCamRotX, "", x14_minCamRotateX, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); tw_maxCamRotX = assignRealValue(skMaxCamRotX, "", x18_maxCamRotateX, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_camAngle = assignRealValue(skCamAngle, "", x1c_camAngle, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_camAngle = + assignRealValue(skCamAngle, "", x1c_camAngle, CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); tw_widgetColor = assignColorValue(skWidgetColor, "", x24_automapperWidgetColor, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); tw_miniCamDist = assignRealValue(skMiniCamDist, "", x28_miniCamDist, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); tw_miniCamXAngle = assignRealValue(skMiniCamXAngle, "", x2c_miniCamXAngle, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); tw_miniCamAngle = assignRealValue(skMiniCamAngle, "", x30_miniCamAngle, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); tw_widgetColor = assignColorValue(skWidgetColor, "", x38_automapperWidgetMiniColor, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_visitedsurfaceColor = assignColorValue(skVisitedSurfaceColor, "", x3c_surfColorVisited, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Color | - hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_visitedOutlineColor = assignColorValue(skVisitedOutlineColor, "", x40_outlineColorVisited, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Color | - hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_unvisitedSurfaceColor = assignColorValue(skUnvisitedSurfaceColor, "", x44_surfColorUnvisited, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Color | - hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_unvisitedOutlineColor = - assignColorValue(skUnvisitedOutlineColor, "", x48_outlineColorUnvisited, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_selectedVisitedSurfaceColor = assignColorValue(skSelectedVisitedSurfaceColor, "", x4c_surfaceSelectColorVisited, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Color | - hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_selectedVisitedOutlineColor = assignColorValue(skSelectedVisitedOutlineColor, "", x50_outlineSelectColorVisited, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Color | - hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_mapSurfaceNormColorLinear = assignRealValue(skMapSurfaceNormalColorLinear, "", x54_mapSurfaceNormColorLinear, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Color | - hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); - tw_mapSurfaceNormColorConstant = assignRealValue(skMapSurfaceNormalColorConstant, "", x58_mapSurfaceNormColorConstant, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Color | - hecl::CVar::EFlags::Gui | hecl::CVar::EFlags::Archive); + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_visitedsurfaceColor = + assignColorValue(skVisitedSurfaceColor, "", x3c_surfColorVisited, + CVar::EFlags::Game | CVar::EFlags::Color | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_visitedOutlineColor = + assignColorValue(skVisitedOutlineColor, "", x40_outlineColorVisited, + CVar::EFlags::Game | CVar::EFlags::Color | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_unvisitedSurfaceColor = + assignColorValue(skUnvisitedSurfaceColor, "", x44_surfColorUnvisited, + CVar::EFlags::Game | CVar::EFlags::Color | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_unvisitedOutlineColor = assignColorValue(skUnvisitedOutlineColor, "", x48_outlineColorUnvisited, + CVar::EFlags::Game | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_selectedVisitedSurfaceColor = + assignColorValue(skSelectedVisitedSurfaceColor, "", x4c_surfaceSelectColorVisited, + CVar::EFlags::Game | CVar::EFlags::Color | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_selectedVisitedOutlineColor = + assignColorValue(skSelectedVisitedOutlineColor, "", x50_outlineSelectColorVisited, + CVar::EFlags::Game | CVar::EFlags::Color | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_mapSurfaceNormColorLinear = + assignRealValue(skMapSurfaceNormalColorLinear, "", x54_mapSurfaceNormColorLinear, + CVar::EFlags::Game | CVar::EFlags::Color | CVar::EFlags::Gui | CVar::EFlags::Archive); + tw_mapSurfaceNormColorConstant = + assignRealValue(skMapSurfaceNormalColorConstant, "", x58_mapSurfaceNormColorConstant, + CVar::EFlags::Game | CVar::EFlags::Color | CVar::EFlags::Gui | CVar::EFlags::Archive); } } // namespace metaforce::MP1 \ No newline at end of file diff --git a/Runtime/MP1/Tweaks/CTweakAutoMapper.hpp b/Runtime/MP1/Tweaks/CTweakAutoMapper.hpp index e9eb143fa..1952aed91 100644 --- a/Runtime/MP1/Tweaks/CTweakAutoMapper.hpp +++ b/Runtime/MP1/Tweaks/CTweakAutoMapper.hpp @@ -4,17 +4,13 @@ #include "Runtime/rstl.hpp" -namespace hecl { -class CVar; -} - namespace metaforce::MP1 { struct CTweakAutoMapper final : public Tweaks::ITweakAutoMapper { - bool x4_24_showOneMiniMapArea;// : 1; - bool x4_25_;// : 1; - bool x4_26_scaleMoveSpeedWithCamDist;// : 1; - float x8_camDist ; - float xc_minCamDist ; + bool x4_24_showOneMiniMapArea; // : 1; + bool x4_25_; // : 1; + bool x4_26_scaleMoveSpeedWithCamDist; // : 1; + float x8_camDist; + float xc_minCamDist; float x10_maxCamDist; float x14_minCamRotateX; float x18_maxCamRotateX; @@ -135,9 +131,9 @@ struct CTweakAutoMapper final : public Tweaks::ITweakAutoMapper { const zeus::CColor& GetAreaFlashPulseColor() const override { return xf4_areaFlashPulseColor; } const zeus::CColor& GetDoorColor(int idx) const override { return x100_doorColors[idx]; } const zeus::CColor& GetOpenDoorColor() const override { return x11c_openDoorColor; } - void initCVars(hecl::CVarManager*) override; + void initCVars(CVarManager*) override; private: - void _tweakListener(hecl::CVar* cv); + void _tweakListener(CVar* cv); }; -} // namespace DataSpec::DNAMP1 +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/Tweaks/CTweakGame.cpp b/Runtime/MP1/Tweaks/CTweakGame.cpp index dc1a8db77..9fc2b778c 100644 --- a/Runtime/MP1/Tweaks/CTweakGame.cpp +++ b/Runtime/MP1/Tweaks/CTweakGame.cpp @@ -3,19 +3,19 @@ #include "Runtime/Streams/CInputStream.hpp" -#include -#include +#include "ConsoleVariables/CVar.hpp" +#include "ConsoleVariables/CVarManager.hpp" #define DEFINE_CVAR_GLOBAL(name) \ constexpr std::string_view sk##name = std::string_view("tweak.game." #name); \ - hecl::CVar* tw_##name = nullptr; + CVar* tw_##name = nullptr; #define CREATE_CVAR(name, help, value, flags) \ tw_##name = mgr->findOrMakeCVar(sk##name, help, value, flags); \ if (tw_##name->wasDeserialized()) { \ tw_##name->toValue(value); \ } \ - tw_##name->addListener([this](hecl::CVar* cv) { _tweakListener(cv); }); + tw_##name->addListener([this](CVar* cv) { _tweakListener(cv); }); #define CREATE_CVAR_BITFIELD(name, help, value, flags) \ { \ @@ -84,7 +84,7 @@ DEFINE_CVAR_GLOBAL(GravityWaterFogDistanceRange); DEFINE_CVAR_GLOBAL(HardModeDamageMult); DEFINE_CVAR_GLOBAL(HardModeWeaponMult); -void CTweakGame::_tweakListener(hecl::CVar* cv) { +void CTweakGame::_tweakListener(CVar* cv) { UPDATE_CVAR(WorldPrefix, cv, x4_worldPrefix); UPDATE_CVAR(FieldOfView, cv, x24_fov); UPDATE_CVAR(SplashScreensDisabled, cv, x2b_splashScreensDisabled); @@ -104,8 +104,8 @@ void CTweakGame::_tweakListener(hecl::CVar* cv) { UPDATE_CVAR(HardModeWeaponMult, cv, x64_hardmodeWeaponMult); } -void CTweakGame::initCVars(hecl::CVarManager* mgr) { - constexpr hecl::CVar::EFlags skDefaultFlags = hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive; +void CTweakGame::initCVars(CVarManager* mgr) { + constexpr CVar::EFlags skDefaultFlags = CVar::EFlags::Game | CVar::EFlags::Archive; CREATE_CVAR(WorldPrefix, "", x4_worldPrefix, skDefaultFlags); CREATE_CVAR(FieldOfView, "", x24_fov, skDefaultFlags); CREATE_CVAR(SplashScreensDisabled, "", x2b_splashScreensDisabled, skDefaultFlags); diff --git a/Runtime/MP1/Tweaks/CTweakGame.hpp b/Runtime/MP1/Tweaks/CTweakGame.hpp index 5eb15c8f1..44010f962 100644 --- a/Runtime/MP1/Tweaks/CTweakGame.hpp +++ b/Runtime/MP1/Tweaks/CTweakGame.hpp @@ -10,7 +10,7 @@ namespace metaforce { class CInputStream; namespace MP1 { -#define DEFINE_CVAR_GLOBAL(name) extern hecl::CVar* tw_##name; +#define DEFINE_CVAR_GLOBAL(name) extern CVar* tw_##name; DEFINE_CVAR_GLOBAL(WorldPrefix); DEFINE_CVAR_GLOBAL(FieldOfView); @@ -77,10 +77,10 @@ struct CTweakGame final : Tweaks::ITweakGame { CTweakGame() = default; CTweakGame(CInputStream& in); - void initCVars(hecl::CVarManager* mgr) override; + void initCVars(CVarManager* mgr) override; private: - void _tweakListener(hecl::CVar* cv); + void _tweakListener(CVar* cv); }; } // namespace MP1 } // namespace metaforce diff --git a/Runtime/MP1/Tweaks/CTweakPlayer.cpp b/Runtime/MP1/Tweaks/CTweakPlayer.cpp index d5d6eff9c..8af0e93c5 100644 --- a/Runtime/MP1/Tweaks/CTweakPlayer.cpp +++ b/Runtime/MP1/Tweaks/CTweakPlayer.cpp @@ -4,19 +4,19 @@ #include "zeus/Math.hpp" -#include -#include +#include "Runtime/ConsoleVariables/CVar.hpp" +#include "Runtime/ConsoleVariables/CVarManager.hpp" #define DEFINE_CVAR_GLOBAL(name) \ constexpr std::string_view sk##name = std::string_view("tweak.player." #name); \ - hecl::CVar* tw_##name = nullptr; + CVar* tw_##name = nullptr; #define CREATE_CVAR(name, help, value, flags) \ tw_##name = mgr->findOrMakeCVar(sk##name, help, value, flags); \ if (tw_##name->wasDeserialized()) { \ tw_##name->toValue(value); \ } \ - tw_##name->addListener([this](hecl::CVar* cv) { _tweakListener(cv); }); + tw_##name->addListener([this](CVar* cv) { _tweakListener(cv); }); #define CREATE_CVAR_BITFIELD(name, help, value, flags) \ { \ @@ -39,8 +39,7 @@ namespace metaforce::MP1 { namespace { -static constexpr hecl::CVar::EFlags skDefaultFlags = - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Cheat | hecl::CVar::EFlags::Archive; +static constexpr CVar::EFlags skDefaultFlags = CVar::EFlags::Game | CVar::EFlags::Cheat | CVar::EFlags::Archive; DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationNormal); DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationAir); DEFINE_CVAR_GLOBAL(MaxTranslationAccelerationIce); @@ -1169,7 +1168,7 @@ void CTweakPlayer::FixupValues() { x29c_fallCameraPitchDownAngle = zeus::degToRad(x29c_fallCameraPitchDownAngle); } -void CTweakPlayer::_tweakListener(hecl::CVar* cv) { +void CTweakPlayer::_tweakListener(CVar* cv) { UPDATE_CVAR(MaxTranslationAccelerationNormal, cv, x4_maxTranslationalAcceleration[0]); UPDATE_CVAR(MaxTranslationAccelerationAir, cv, x4_maxTranslationalAcceleration[1]); UPDATE_CVAR(MaxTranslationAccelerationIce, cv, x4_maxTranslationalAcceleration[2]); @@ -1386,7 +1385,7 @@ void CTweakPlayer::_tweakListener(hecl::CVar* cv) { UPDATE_CVAR(PhazonDamageReduction, cv, x308_phazonDamageReduction); } -void CTweakPlayer::initCVars(hecl::CVarManager* mgr) { +void CTweakPlayer::initCVars(CVarManager* mgr) { CREATE_CVAR(MaxTranslationAccelerationNormal, "Max translation acceleration allowed to the player under normal circumstances", x4_maxTranslationalAcceleration[0], skDefaultFlags); @@ -1664,4 +1663,4 @@ void CTweakPlayer::initCVars(hecl::CVarManager* mgr) { CREATE_CVAR(GravityDamageReduction, "", x304_gravityDamageReduction, skDefaultFlags); CREATE_CVAR(PhazonDamageReduction, "", x308_phazonDamageReduction, skDefaultFlags); } -} // namespace DataSpec::DNAMP1 +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/Tweaks/CTweakPlayer.hpp b/Runtime/MP1/Tweaks/CTweakPlayer.hpp index a02189bda..f8e701d09 100644 --- a/Runtime/MP1/Tweaks/CTweakPlayer.hpp +++ b/Runtime/MP1/Tweaks/CTweakPlayer.hpp @@ -2,10 +2,6 @@ #include "Runtime/Tweaks/ITweakPlayer.hpp" -namespace hecl { -class CVar; -} - namespace metaforce::MP1 { struct CTweakPlayer final : Tweaks::ITweakPlayer { @@ -310,8 +306,8 @@ struct CTweakPlayer final : Tweaks::ITweakPlayer { CTweakPlayer(CInputStream& in); void PutTo(COutputStream& out); void FixupValues(); - void initCVars(hecl::CVarManager* mgr) override; - void _tweakListener(hecl::CVar* cv); + void initCVars(CVarManager* mgr) override; + void _tweakListener(CVar* cv); }; } // namespace DataSpec::DNAMP1 diff --git a/Runtime/Tweaks/ITweak.hpp b/Runtime/Tweaks/ITweak.hpp index 1ea92dcb5..bc6817d67 100644 --- a/Runtime/Tweaks/ITweak.hpp +++ b/Runtime/Tweaks/ITweak.hpp @@ -1,19 +1,18 @@ #pragma once // Gonna need these in all the tweaks anyway, so we'll include them here -#include "zeus/zeus.hpp" #include "Runtime/GCNTypes.hpp" -namespace hecl { -class CVarManager; -} +#include "zeus/zeus.hpp" namespace metaforce { +class CVar; +class CVarManager; class CInputStream; class COutputStream; class ITweak { public: virtual ~ITweak() = default; - virtual void initCVars(hecl::CVarManager*) {} + virtual void initCVars(CVarManager*) {} }; } // namespace metaforce diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index 0ed646434..5a0c8eb82 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -16,7 +16,7 @@ #include "TCastTo.hpp" // Generated file, do not modify include path -#include +#include "ConsoleVariables/CVarManager.hpp" namespace metaforce { static CMaterialList MakeActorMaterialList(const CMaterialList& materialList, const CActorParameters& params) { diff --git a/Runtime/World/CMorphBall.cpp b/Runtime/World/CMorphBall.cpp index 853ae91fd..af28c32e2 100644 --- a/Runtime/World/CMorphBall.cpp +++ b/Runtime/World/CMorphBall.cpp @@ -17,13 +17,13 @@ #include "Runtime/World/CScriptSpiderBallWaypoint.hpp" #include "Runtime/World/CScriptWater.hpp" #include "Runtime/World/CWorld.hpp" -#include -#include +#include "Runtime/ConsoleVariables/CVar.hpp" +#include "Runtime/ConsoleVariables/CVarManager.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path namespace metaforce { namespace { -hecl::CVar* mb_spooderBall = nullptr; +CVar* mb_spooderBall = nullptr; bool mb_spooderBallCached = false; float kSpiderBallCollisionRadius; @@ -287,11 +287,11 @@ CMorphBall::CMorphBall(CPlayer& player, float radius) LoadAnimationTokens("SamusBallANCS"); InitializeWakeEffects(); if (mb_spooderBall == nullptr) { - mb_spooderBall = hecl::CVarManager::instance()->findOrMakeCVar( + mb_spooderBall = CVarManager::instance()->findOrMakeCVar( "morphball.enableSpooderBall", "Enables the ability to spiderball everywhere after touch a spiderball track with spiderball enabled", false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Cheat); - mb_spooderBall->addListener([](hecl::CVar* cv) { mb_spooderBallCached = cv->toBoolean(); }); + CVar::EFlags::Game | CVar::EFlags::Cheat); + mb_spooderBall->addListener([](CVar* cv) { mb_spooderBallCached = cv->toBoolean(); }); } } diff --git a/Runtime/World/CPatterned.cpp b/Runtime/World/CPatterned.cpp index 94c71bd1d..8294a9a6d 100644 --- a/Runtime/World/CPatterned.cpp +++ b/Runtime/World/CPatterned.cpp @@ -19,14 +19,14 @@ #include "Runtime/World/CScriptWaypoint.hpp" #include "Runtime/World/CStateMachine.hpp" -#include +#include "Runtime/ConsoleVariables/CVarManager.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path #include namespace metaforce { namespace { -hecl::CVar* cv_disableAi = nullptr; +CVar* cv_disableAi = nullptr; } // namespace constexpr CMaterialList skPatternedGroundMaterialList(EMaterialTypes::Character, EMaterialTypes::Solid, @@ -1830,8 +1830,8 @@ bool CPatterned::ApplyBoneTracking() const { void CPatterned::Initialize() { if (cv_disableAi == nullptr) { - cv_disableAi = hecl::CVarManager::instance()->findOrMakeCVar("disableAi"sv, "Disables AI state machines", false, - hecl::CVar::EFlags::Cheat | hecl::CVar::EFlags::Game); + cv_disableAi = CVarManager::instance()->findOrMakeCVar("disableAi"sv, "Disables AI state machines", false, + CVar::EFlags::Cheat | CVar::EFlags::Game); } } diff --git a/Runtime/World/CScriptSpecialFunction.cpp b/Runtime/World/CScriptSpecialFunction.cpp index e83881a00..89abb5c51 100644 --- a/Runtime/World/CScriptSpecialFunction.cpp +++ b/Runtime/World/CScriptSpecialFunction.cpp @@ -20,7 +20,7 @@ #include "TCastTo.hpp" // Generated file, do not modify include path -#include +#include "ConsoleVariables/CVarManager.hpp" namespace metaforce { @@ -969,7 +969,7 @@ void CScriptSpecialFunction::ThinkPlayerInArea(float dt, CStateManager& mgr) { } bool CScriptSpecialFunction::ShouldSkipCinematic(CStateManager& stateMgr) const { - if (hecl::com_developer->toBoolean()) { + if (com_developer->toBoolean()) { return true; } return g_GameState->SystemOptions().GetCinematicState(stateMgr.GetWorld()->IGetWorldAssetId(), GetEditorId()); diff --git a/Runtime/World/CStateMachine.cpp b/Runtime/World/CStateMachine.cpp index 5d7c82cfe..4586d30bb 100644 --- a/Runtime/World/CStateMachine.cpp +++ b/Runtime/World/CStateMachine.cpp @@ -3,7 +3,7 @@ #include "Runtime/CStateManager.hpp" #include "Runtime/World/CAi.hpp" -#include +#include "ConsoleVariables/CVarManager.hpp" namespace metaforce { namespace { diff --git a/Runtime/World/CWorldTransManager.cpp b/Runtime/World/CWorldTransManager.cpp index da2557424..16fca7d21 100644 --- a/Runtime/World/CWorldTransManager.cpp +++ b/Runtime/World/CWorldTransManager.cpp @@ -16,7 +16,7 @@ #include "Runtime/GuiSys/CGuiTextSupport.hpp" #include "Runtime/GuiSys/CStringTable.hpp" -#include +#include "ConsoleVariables/CVarManager.hpp" namespace metaforce { diff --git a/hecl/lib/CMakeLists.txt b/hecl/lib/CMakeLists.txt index 0a60312fd..3c4c302d0 100644 --- a/hecl/lib/CMakeLists.txt +++ b/hecl/lib/CMakeLists.txt @@ -7,8 +7,6 @@ macro(hecl_add_list rel_path a_list) endmacro(hecl_add_list) add_subdirectory(Blender) -add_subdirectory(Runtime) - if(WIN32) list(APPEND PLAT_SRCS ../include/hecl/winsupport.hpp) endif() @@ -18,10 +16,6 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "R endif() set(HECL_HEADERS - ../include/hecl/CVar.hpp - ../include/hecl/CVarManager.hpp -# ../include/hecl/Console.hpp - ../include/hecl/CVarCommons.hpp ../include/hecl/hecl.hpp ../include/hecl/MultiProgressPrinter.hpp ../include/hecl/FourCC.hpp @@ -46,9 +40,6 @@ set(COMMON_SOURCES Project.cpp ProjectPath.cpp HumanizeNumber.cpp - CVar.cpp - CVarCommons.cpp - CVarManager.cpp # Console.cpp ClientProcess.cpp SteamFinder.cpp @@ -60,7 +51,6 @@ endif() add_library(hecl-full ${FRONTEND_SOURCES} - ${RUNTIME_SOURCES} ${BLENDER_SOURCES} ${COMMON_SOURCES} ${HECL_HEADERS} @@ -70,7 +60,6 @@ target_include_directories(hecl-full PUBLIC ../include) target_link_libraries(hecl-full PUBLIC ${HECL_APPLICATION_REPS_TARGETS_LIST} hecl-blender-addon boo athena-core logvisor xxhash) target_atdna(hecl-full atdna_HMDLMeta_full.cpp ../include/hecl/HMDLMeta.hpp) -target_atdna(hecl-full atdna_CVar_full.cpp ../include/hecl/CVar.hpp) target_atdna(hecl-full atdna_SDNARead_full.cpp ../include/hecl/Blender/SDNARead.hpp) add_library(hecl-light @@ -86,7 +75,6 @@ if (WIN32) target_link_libraries(hecl-light PUBLIC Version) endif () target_atdna(hecl-light atdna_HMDLMeta_light.cpp ../include/hecl/HMDLMeta.hpp) -target_atdna(hecl-light atdna_CVar_light.cpp ../include/hecl/CVar.hpp) if(COMMAND add_sanitizers) add_sanitizers(hecl-full) diff --git a/hecl/lib/CVarCommons.cpp b/hecl/lib/CVarCommons.cpp deleted file mode 100644 index 8d1c1d367..000000000 --- a/hecl/lib/CVarCommons.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "hecl/CVarCommons.hpp" - -namespace hecl { - -namespace { -CVarCommons* m_instance = nullptr; -} - -CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) { - m_fullscreen = m_mgr.findOrMakeCVar("fullscreen"sv, "Start in fullscreen"sv, false, - hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive); - m_graphicsApi = m_mgr.findOrMakeCVar("graphicsApi"sv, "API to use for rendering graphics"sv, DEFAULT_GRAPHICS_API, - hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive | - hecl::CVar::EFlags::ModifyRestart); - m_drawSamples = m_mgr.findOrMakeCVar("drawSamples"sv, "Number of MSAA samples to use for render targets"sv, 1, - hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive | - hecl::CVar::EFlags::ModifyRestart); - m_texAnisotropy = m_mgr.findOrMakeCVar( - "texAnisotropy"sv, "Number of anisotropic samples to use for sampling textures"sv, 1, - hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ModifyRestart); - m_deepColor = m_mgr.findOrMakeCVar("deepColor"sv, "Allow framebuffer with color depth greater-then 24-bits"sv, false, - hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive | - hecl::CVar::EFlags::ModifyRestart); - m_variableDt = m_mgr.findOrMakeCVar( - "variableDt", "Enable variable delta time (experimental)", false, - (hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ModifyRestart)); - m_lazyCommitResources = m_mgr.findOrMakeCVar( - "lazyCommitResources"sv, "Enable lazy commiting resources to GPU", true, - (hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive)); - - m_debugOverlayPlayerInfo = m_mgr.findOrMakeCVar( - "debugOverlay.playerInfo"sv, "Displays information about the player, such as location and orientation"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugOverlayWorldInfo = m_mgr.findOrMakeCVar( - "debugOverlay.worldInfo"sv, "Displays information about the current world, such as world asset ID, and areaId"sv, - false, hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugOverlayAreaInfo = m_mgr.findOrMakeCVar( - "debugOverlay.areaInfo"sv, - "Displays information about the current area, such as asset ID, object/layer counts, and active layer bits"sv, - false, hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugOverlayLayerInfo = m_mgr.findOrMakeCVar( - "debugOverlay.layerInfo"sv, "Displays information about the currently active area layers"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugOverlayShowFrameCounter = - m_mgr.findOrMakeCVar("debugOverlay.showFrameCounter"sv, "Displays the current frame index"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugOverlayShowFramerate = - m_mgr.findOrMakeCVar("debugOverlay.showFramerate"sv, "Displays the current framerate"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugOverlayShowInGameTime = - m_mgr.findOrMakeCVar("debugOverlay.showInGameTime"sv, "Displays the current in game time"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugOverlayShowRoomTimer = m_mgr.findOrMakeCVar( - "debugOverlay.showRoomTimer", "Displays the current/last room timers in seconds and frames"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugOverlayShowResourceStats = m_mgr.findOrMakeCVar( - "debugOverlay.showResourceStats"sv, "Displays the current live resource object and token counts"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugOverlayShowRandomStats = m_mgr.findOrMakeCVar( - "debugOverlay.showRandomStats", "Displays the current number of random calls per frame"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugOverlayShowInput = - m_mgr.findOrMakeCVar("debugOverlay.showInput"sv, "Displays user input"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugToolDrawAiPath = - m_mgr.findOrMakeCVar("debugTool.drawAiPath", "Draws the selected paths of any AI in the room"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugToolDrawLighting = m_mgr.findOrMakeCVar("debugTool.drawLighting", "Draws the lighting setup in a room"sv, - false, hecl::CVar::EFlags::Game | hecl::CVar::EFlags::ReadOnly); - m_debugToolDrawCollisionActors = - m_mgr.findOrMakeCVar("debugTool.drawCollisionActors", "Draws the collision actors for enemies and objects"sv, - false, hecl::CVar::EFlags::Game | hecl::CVar::EFlags::ReadOnly); - m_debugToolDrawMazePath = - m_mgr.findOrMakeCVar("debugTool.drawMazePath", "Draws the maze path in Dynamo"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_debugToolDrawPlatformCollision = - m_mgr.findOrMakeCVar("debugTool.drawPlatformCollision", "Draws the bounding boxes of platforms"sv, false, - hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ReadOnly); - m_logFile = m_mgr.findOrMakeCVar("logFile"sv, "Any log prints will be stored to this file upon exit"sv, "app.log"sv, - hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive | - hecl::CVar::EFlags::ModifyRestart); - - m_instance = this; -} - -CVarCommons* CVarCommons::instance() { return m_instance; } -} // namespace hecl diff --git a/hecl/lib/Runtime/CMakeLists.txt b/hecl/lib/Runtime/CMakeLists.txt deleted file mode 100644 index 409a62c83..000000000 --- a/hecl/lib/Runtime/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(RUNTIME_SOURCES - FileStoreManager.cpp) - -hecl_add_list(Runtime RUNTIME_SOURCES) diff --git a/metaforce-gui/MainWindow.hpp b/metaforce-gui/MainWindow.hpp index 1c431b0d1..917656812 100644 --- a/metaforce-gui/MainWindow.hpp +++ b/metaforce-gui/MainWindow.hpp @@ -12,7 +12,7 @@ #include "Common.hpp" #include "DownloadManager.hpp" -#include +#include "ConsoleVariables/CVarCommons.hpp" #include class QPushButton; From 57d96dbb17367bd0da29caa4d0f2c02312aa2e14 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 21 Feb 2022 04:04:16 -0500 Subject: [PATCH 08/17] Fully decouple hecl from Metaforce - Added CStringExtras Convert functions (and UTF-compatible versions) - GX header copied into Runtime - SFX headers copied into Runtime/Audio --- CMakeLists.txt | 2 +- NESEmulator/CMakeLists.txt | 4 +- Runtime/Audio/CSfxManager.hpp | 2 +- Runtime/Audio/SFX/Atomic.h | 27 + Runtime/Audio/SFX/BetaBeetle.h | 41 ++ Runtime/Audio/SFX/Bird.h | 16 + Runtime/Audio/SFX/BloodFlower.h | 30 + Runtime/Audio/SFX/Burrower.h | 29 + Runtime/Audio/SFX/ChozoGhost.h | 61 ++ Runtime/Audio/SFX/ChubbWeed.h | 16 + Runtime/Audio/SFX/CineBoots.h | 29 + Runtime/Audio/SFX/CineGeneral.h | 50 ++ Runtime/Audio/SFX/CineGun.h | 23 + Runtime/Audio/SFX/CineMorphball.h | 19 + Runtime/Audio/SFX/CineSuit.h | 34 + Runtime/Audio/SFX/CineVisor.h | 21 + Runtime/Audio/SFX/Crater.h | 39 ++ Runtime/Audio/SFX/Crystallite.h | 19 + Runtime/Audio/SFX/Drones.h | 69 ++ Runtime/Audio/SFX/EliteSpacePirate.h | 63 ++ Runtime/Audio/SFX/FireFlea.h | 22 + Runtime/Audio/SFX/Flaaghra.h | 90 +++ Runtime/Audio/SFX/FlickerBat.h | 21 + Runtime/Audio/SFX/FlyingPirate.h | 68 ++ Runtime/Audio/SFX/FrontEnd.h | 47 ++ Runtime/Audio/SFX/GagantuanBeatle.h | 61 ++ Runtime/Audio/SFX/Gnats.h | 16 + Runtime/Audio/SFX/Gryzbee.h | 21 + Runtime/Audio/SFX/IceCrack.h | 29 + Runtime/Audio/SFX/IceWorld.h | 129 ++++ Runtime/Audio/SFX/InjuredPirates.h | 39 ++ Runtime/Audio/SFX/IntroBoss.h | 51 ++ Runtime/Audio/SFX/IntroWorld.h | 148 +++++ Runtime/Audio/SFX/JellyZap.h | 19 + Runtime/Audio/SFX/LavaWorld.h | 112 ++++ Runtime/Audio/SFX/Magdolite.h | 39 ++ Runtime/Audio/SFX/Metaree.h | 20 + Runtime/Audio/SFX/Metroid.h | 74 +++ Runtime/Audio/SFX/MetroidPrime.h | 90 +++ Runtime/Audio/SFX/MinesWorld.h | 90 +++ Runtime/Audio/SFX/Misc.h | 256 ++++++++ Runtime/Audio/SFX/MiscSamus.h | 268 ++++++++ Runtime/Audio/SFX/OmegaPirate.h | 69 ++ Runtime/Audio/SFX/OverWorld.h | 81 +++ Runtime/Audio/SFX/Parasite.h | 33 + Runtime/Audio/SFX/Phazon.h | 16 + Runtime/Audio/SFX/PhazonGun.h | 11 + Runtime/Audio/SFX/PuddleSpore.h | 36 ++ Runtime/Audio/SFX/PuddleToad.h | 38 ++ Runtime/Audio/SFX/Puffer.h | 16 + Runtime/Audio/SFX/ReactorDoor.h | 22 + Runtime/Audio/SFX/Ridley.h | 69 ++ Runtime/Audio/SFX/Ripper.h | 19 + Runtime/Audio/SFX/RuinsWorld.h | 159 +++++ Runtime/Audio/SFX/SFX.h | 77 +++ Runtime/Audio/SFX/SamusShip.h | 41 ++ Runtime/Audio/SFX/Scarab.h | 17 + Runtime/Audio/SFX/Seedling.h | 29 + Runtime/Audio/SFX/SheeGoth.h | 66 ++ Runtime/Audio/SFX/SnakeWeed.h | 15 + Runtime/Audio/SFX/Sova.h | 28 + Runtime/Audio/SFX/SpacePirate.h | 93 +++ Runtime/Audio/SFX/SpankWeed.h | 54 ++ Runtime/Audio/SFX/Thardus.h | 77 +++ Runtime/Audio/SFX/TheEnd.h | 27 + Runtime/Audio/SFX/Torobyte.h | 28 + Runtime/Audio/SFX/Triclops.h | 30 + Runtime/Audio/SFX/Turret.h | 36 ++ Runtime/Audio/SFX/UI.h | 99 +++ Runtime/Audio/SFX/WarWasp.h | 72 +++ Runtime/Audio/SFX/Weapons.h | 145 +++++ Runtime/Audio/SFX/ZZZ.h | 29 + Runtime/Audio/SFX/Zoomer.h | 31 + Runtime/Audio/SFX/lumigek.h | 15 + Runtime/Audio/SFX/test.h | 13 + Runtime/CDvdFile.hpp | 2 +- Runtime/CGameState.cpp | 15 + Runtime/CGameState.hpp | 67 +- Runtime/CMain.cpp | 19 - Runtime/CMakeLists.txt | 7 +- Runtime/CMemoryCardSysNix.cpp | 77 ++- Runtime/CStringExtras.cpp | 78 ++- Runtime/CStringExtras.hpp | 6 + Runtime/CWorldSaveGameInfo.hpp | 5 +- Runtime/Collision/CAreaOctTree.cpp | 1 - Runtime/Graphics/CBooRenderer.cpp | 4 +- Runtime/Graphics/CGraphics.hpp | 4 +- Runtime/Graphics/CMetroidModelInstance.hpp | 6 +- Runtime/Graphics/CModel.hpp | 43 +- Runtime/Graphics/CModelBoo.cpp | 592 +++++++++--------- Runtime/Graphics/CTextureBoo.cpp | 2 + Runtime/Graphics/GX.hpp | 296 +++++++++ Runtime/Graphics/Shaders/CModelShaders.cpp | 42 +- Runtime/GuiSys/CGuiSys.hpp | 2 - Runtime/GuiSys/CGuiTextSupport.cpp | 5 +- Runtime/ImGuiConsole.cpp | 2 +- Runtime/Input/ControlMapper.cpp | 2 - Runtime/MP1/MP1.cpp | 16 +- Runtime/MP1/World/CDrone.cpp | 2 +- Runtime/MP1/World/CMetaree.hpp | 2 +- Runtime/MP1/World/CMetroidPrimeEssence.cpp | 4 +- Runtime/MP1/World/CMetroidPrimeExo.cpp | 2 - Runtime/MP1/World/CThardus.cpp | 4 +- Runtime/Particle/CDecalDataFactory.cpp | 2 + Runtime/Particle/CParticleDataFactory.cpp | 2 + .../Particle/CParticleElectricDataFactory.cpp | 2 + Runtime/Particle/CParticleSwoosh.hpp | 2 - .../Particle/CParticleSwooshDataFactory.cpp | 2 + .../Particle/CProjectileWeaponDataFactory.cpp | 2 + Runtime/Weapon/CBomb.cpp | 2 +- Runtime/Weapon/CPowerBomb.cpp | 2 +- Runtime/Weapon/CWaveBuster.cpp | 2 +- Runtime/World/CDamageInfo.cpp | 2 - Runtime/World/CGameArea.cpp | 28 +- Runtime/World/CGameArea.hpp | 1 - Runtime/World/CScriptBallTrigger.cpp | 2 - Shaders/shader_CFluidPlaneShader.hpp | 4 +- aurora/lib/gpu.cpp | 2 +- hecl/ApplicationTools.cmake | 122 ++-- imgui/CMakeLists.txt | 2 +- 120 files changed, 4865 insertions(+), 518 deletions(-) create mode 100644 Runtime/Audio/SFX/Atomic.h create mode 100644 Runtime/Audio/SFX/BetaBeetle.h create mode 100644 Runtime/Audio/SFX/Bird.h create mode 100644 Runtime/Audio/SFX/BloodFlower.h create mode 100644 Runtime/Audio/SFX/Burrower.h create mode 100644 Runtime/Audio/SFX/ChozoGhost.h create mode 100644 Runtime/Audio/SFX/ChubbWeed.h create mode 100644 Runtime/Audio/SFX/CineBoots.h create mode 100644 Runtime/Audio/SFX/CineGeneral.h create mode 100644 Runtime/Audio/SFX/CineGun.h create mode 100644 Runtime/Audio/SFX/CineMorphball.h create mode 100644 Runtime/Audio/SFX/CineSuit.h create mode 100644 Runtime/Audio/SFX/CineVisor.h create mode 100644 Runtime/Audio/SFX/Crater.h create mode 100644 Runtime/Audio/SFX/Crystallite.h create mode 100644 Runtime/Audio/SFX/Drones.h create mode 100644 Runtime/Audio/SFX/EliteSpacePirate.h create mode 100644 Runtime/Audio/SFX/FireFlea.h create mode 100644 Runtime/Audio/SFX/Flaaghra.h create mode 100644 Runtime/Audio/SFX/FlickerBat.h create mode 100644 Runtime/Audio/SFX/FlyingPirate.h create mode 100644 Runtime/Audio/SFX/FrontEnd.h create mode 100644 Runtime/Audio/SFX/GagantuanBeatle.h create mode 100644 Runtime/Audio/SFX/Gnats.h create mode 100644 Runtime/Audio/SFX/Gryzbee.h create mode 100644 Runtime/Audio/SFX/IceCrack.h create mode 100644 Runtime/Audio/SFX/IceWorld.h create mode 100644 Runtime/Audio/SFX/InjuredPirates.h create mode 100644 Runtime/Audio/SFX/IntroBoss.h create mode 100644 Runtime/Audio/SFX/IntroWorld.h create mode 100644 Runtime/Audio/SFX/JellyZap.h create mode 100644 Runtime/Audio/SFX/LavaWorld.h create mode 100644 Runtime/Audio/SFX/Magdolite.h create mode 100644 Runtime/Audio/SFX/Metaree.h create mode 100644 Runtime/Audio/SFX/Metroid.h create mode 100644 Runtime/Audio/SFX/MetroidPrime.h create mode 100644 Runtime/Audio/SFX/MinesWorld.h create mode 100644 Runtime/Audio/SFX/Misc.h create mode 100644 Runtime/Audio/SFX/MiscSamus.h create mode 100644 Runtime/Audio/SFX/OmegaPirate.h create mode 100644 Runtime/Audio/SFX/OverWorld.h create mode 100644 Runtime/Audio/SFX/Parasite.h create mode 100644 Runtime/Audio/SFX/Phazon.h create mode 100644 Runtime/Audio/SFX/PhazonGun.h create mode 100644 Runtime/Audio/SFX/PuddleSpore.h create mode 100644 Runtime/Audio/SFX/PuddleToad.h create mode 100644 Runtime/Audio/SFX/Puffer.h create mode 100644 Runtime/Audio/SFX/ReactorDoor.h create mode 100644 Runtime/Audio/SFX/Ridley.h create mode 100644 Runtime/Audio/SFX/Ripper.h create mode 100644 Runtime/Audio/SFX/RuinsWorld.h create mode 100644 Runtime/Audio/SFX/SFX.h create mode 100644 Runtime/Audio/SFX/SamusShip.h create mode 100644 Runtime/Audio/SFX/Scarab.h create mode 100644 Runtime/Audio/SFX/Seedling.h create mode 100644 Runtime/Audio/SFX/SheeGoth.h create mode 100644 Runtime/Audio/SFX/SnakeWeed.h create mode 100644 Runtime/Audio/SFX/Sova.h create mode 100644 Runtime/Audio/SFX/SpacePirate.h create mode 100644 Runtime/Audio/SFX/SpankWeed.h create mode 100644 Runtime/Audio/SFX/Thardus.h create mode 100644 Runtime/Audio/SFX/TheEnd.h create mode 100644 Runtime/Audio/SFX/Torobyte.h create mode 100644 Runtime/Audio/SFX/Triclops.h create mode 100644 Runtime/Audio/SFX/Turret.h create mode 100644 Runtime/Audio/SFX/UI.h create mode 100644 Runtime/Audio/SFX/WarWasp.h create mode 100644 Runtime/Audio/SFX/Weapons.h create mode 100644 Runtime/Audio/SFX/ZZZ.h create mode 100644 Runtime/Audio/SFX/Zoomer.h create mode 100644 Runtime/Audio/SFX/lumigek.h create mode 100644 Runtime/Audio/SFX/test.h create mode 100644 Runtime/Graphics/GX.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index f5117c7ad..5ff11d76c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -540,7 +540,7 @@ endif() configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h) # Packaging logic -list(APPEND BINARY_TARGETS metaforce hecl) # visigen +list(APPEND BINARY_TARGETS metaforce) # hecl visigen set(DSYM_ONLY_TARGETS "") if (TARGET crashpad_handler) list(APPEND BINARY_TARGETS crashpad_handler) diff --git a/NESEmulator/CMakeLists.txt b/NESEmulator/CMakeLists.txt index c7e17ef23..7f04a9d94 100644 --- a/NESEmulator/CMakeLists.txt +++ b/NESEmulator/CMakeLists.txt @@ -10,8 +10,8 @@ target_include_directories(NESEmulator PRIVATE ${CMAKE_SOURCE_DIR}/extern PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_compile_definitions(NESEmulator PRIVATE COL_32BIT=1 COL_TEX_BSWAP=1) -target_link_libraries(NESEmulator boo hecl-full RuntimeCommon ${HECL_APPLICATION_REPS_TARGETS_LIST}) +target_link_libraries(NESEmulator RuntimeCommon) if (NOT MSVC) target_compile_options(NESEmulator PRIVATE -Wno-implicit-fallthrough -Wno-format -Wno-pointer-compare -Wno-memset-elt-size) -endif () \ No newline at end of file +endif () diff --git a/Runtime/Audio/CSfxManager.hpp b/Runtime/Audio/CSfxManager.hpp index 9c237c302..5da3a371f 100644 --- a/Runtime/Audio/CSfxManager.hpp +++ b/Runtime/Audio/CSfxManager.hpp @@ -5,7 +5,7 @@ #include #include -#include "DNAMP1/SFX/SFX.h" +#include "SFX/SFX.h" #include "Runtime/RetroTypes.hpp" #include "Runtime/Audio/CAudioSys.hpp" diff --git a/Runtime/Audio/SFX/Atomic.h b/Runtime/Audio/SFX/Atomic.h new file mode 100644 index 000000000..055d91c43 --- /dev/null +++ b/Runtime/Audio/SFX/Atomic.h @@ -0,0 +1,27 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Atomic + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPAtomic 1 + +#define SFXelu_a_elec_lp_00 42 +#define SFXat2_b_fly_lp_00 43 +#define SFXatm_b_fly_lp_00 44 +#define SFXatm_b_fly_lp_01 45 +#define SFXatm_a_bombdrp_00 46 +#define SFXsfx002F 47 +#define SFXsfx0030 48 +#define SFXsfx0031 49 +#define SFXsfx0032 50 +#define SFXsfx0033 51 +#define SFXsfx0034 52 +#define SFXsfx0035 53 +#define SFXsfx0036 54 +#define SFXsfx0037 55 +#define SFXsfx0038 56 +#define SFXsfx0039 57 +#define SFXsfx003A 58 +#define SFXsfx003B 59 diff --git a/Runtime/Audio/SFX/BetaBeetle.h b/Runtime/Audio/SFX/BetaBeetle.h new file mode 100644 index 000000000..5bc2728cf --- /dev/null +++ b/Runtime/Audio/SFX/BetaBeetle.h @@ -0,0 +1,41 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: BetaBeetle + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPBetaBeetle 2 + +#define SFXsfx003C 60 +#define SFXsfx003D 61 +#define SFXsfx003E 62 +#define SFXsfx003F 63 +#define SFXsfx0040 64 +#define SFXsfx0041 65 +#define SFXsfx0042 66 +#define SFXsfx0043 67 +#define SFXsfx0044 68 +#define SFXsfx0045 69 +#define SFXsfx0046 70 +#define SFXsfx0047 71 +#define SFXsfx0048 72 +#define SFXsfx0049 73 +#define SFXsfx004A 74 +#define SFXsfx004B 75 +#define SFXsfx004C 76 +#define SFXsfx004D 77 +#define SFXsfx004E 78 +#define SFXsfx004F 79 +#define SFXsfx0050 80 +#define SFXsfx0051 81 +#define SFXsfx0052 82 +#define SFXsfx0053 83 +#define SFXsfx0054 84 +#define SFXsfx0055 85 +#define SFXsfx0056 86 +#define SFXsfx0057 87 +#define SFXsfx0058 88 +#define SFXsfx0059 89 +#define SFXsfx005A 90 +#define SFXsfx005B 91 diff --git a/Runtime/Audio/SFX/Bird.h b/Runtime/Audio/SFX/Bird.h new file mode 100644 index 000000000..c58f7c470 --- /dev/null +++ b/Runtime/Audio/SFX/Bird.h @@ -0,0 +1,16 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Bird + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPBird 3 + +#define SFXsfx005C 92 +#define SFXsfx005D 93 +#define SFXsfx005E 94 +#define SFXsfx005F 95 +#define SFXsfx0060 96 +#define SFXsfx0061 97 +#define SFXsfx0062 98 diff --git a/Runtime/Audio/SFX/BloodFlower.h b/Runtime/Audio/SFX/BloodFlower.h new file mode 100644 index 000000000..3fa8e974c --- /dev/null +++ b/Runtime/Audio/SFX/BloodFlower.h @@ -0,0 +1,30 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: BloodFlower + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPBloodFlower 4 + +#define SFXblf_a_btmspit_00 99 +#define SFXblf_a_bulb_00 100 +#define SFXsfx0065 101 +#define SFXsfx0066 102 +#define SFXsfx0067 103 +#define SFXblf_b_active_00 104 +#define SFXblf_b_active_01 105 +#define SFXsfx006A 106 +#define SFXblf_b_breathe_00 107 +#define SFXsfx006C 108 +#define SFXsfx006D 109 +#define SFXsfx006E 110 +#define SFXsfx006F 111 +#define SFXblf_r_death_00 112 +#define SFXblf_r_death_01 113 +#define SFXblf_r_impact_00 114 +#define SFXfir_x_crispfire6voice_lp_00 115 +#define SFXsfx0074 116 +#define SFXsfx0075 117 +#define SFXsfx0076 118 +#define SFXsfx0077 119 diff --git a/Runtime/Audio/SFX/Burrower.h b/Runtime/Audio/SFX/Burrower.h new file mode 100644 index 000000000..b7cb10005 --- /dev/null +++ b/Runtime/Audio/SFX/Burrower.h @@ -0,0 +1,29 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Burrower + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPBurrower 5 + +#define SFXbur_a_attack_00 120 +#define SFXbur_b_burrow_lp_00 121 +#define SFXbur_b_idle_00 122 +#define SFXbur_b_idle_01 123 +#define SFXbur_b_walk_00 124 +#define SFXbur_b_walk_01 125 +#define SFXbur_b_walk_02 126 +#define SFXbur_r_death_00 127 +#define SFXsfx0080 128 +#define SFXsfx0081 129 +#define SFXsfx0082 130 +#define SFXsfx0083 131 +#define SFXsfx0084 132 +#define SFXsfx0085 133 +#define SFXsfx0086 134 +#define SFXsfx0087 135 +#define SFXsfx0088 136 +#define SFXsfx0089 137 +#define SFXsfx008A 138 +#define SFXsfx008B 139 diff --git a/Runtime/Audio/SFX/ChozoGhost.h b/Runtime/Audio/SFX/ChozoGhost.h new file mode 100644 index 000000000..33bddf359 --- /dev/null +++ b/Runtime/Audio/SFX/ChozoGhost.h @@ -0,0 +1,61 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: ChozoGhost + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPChozoGhost 6 + +#define SFXchg_a_dball_00 140 +#define SFXchg_a_dcharge_00 141 +#define SFXchg_a_dfire_00 142 +#define SFXsfx008F 143 +#define SFXsfx0090 144 +#define SFXsfx0091 145 +#define SFXsfx0092 146 +#define SFXsfx0093 147 +#define SFXsfx0094 148 +#define SFXchg_a_pball_00 149 +#define SFXchg_a_pfire_00 150 +#define SFXsfx0097 151 +#define SFXsfx0098 152 +#define SFXsfx0099 153 +#define SFXsfx009A 154 +#define SFXchg_b_fadein_00 155 +#define SFXsfx009C 156 +#define SFXchg_b_float_00 157 +#define SFXchg_b_growl_00 158 +#define SFXchg_b_jump_00 159 +#define SFXsfx00A0 160 +#define SFXsfx00A1 161 +#define SFXsfx00A2 162 +#define SFXsfx00A3 163 +#define SFXsfx00A4 164 +#define SFXchg_r_death_00 165 +#define SFXchg_r_hit_00 166 +#define SFXchg_a_pcharge_00 167 +#define SFXsfx00A8 168 +#define SFXsfx00A9 169 +#define SFXchg_b_growl_01 170 +#define SFXchg_b_scrape_00 171 +#define SFXchg_r_death_01 172 +#define SFXsfx00AD 173 +#define SFXchg_b_growl_03 174 +#define SFXchg_b_growl_04 175 +#define SFXsfx00B0 176 +#define SFXchg_b_voxalert_00 177 +#define SFXsfx00B2 178 +#define SFXchg_b_warpin_00 179 +#define SFXsfx00B4 180 +#define SFXsfx00B5 181 +#define SFXsfx00B6 182 +#define SFXsfx00B7 183 +#define SFXsfx00B8 184 +#define SFXsfx00B9 185 +#define SFXsfx00BA 186 +#define SFXsfx00BB 187 +#define SFXsfx00BC 188 +#define SFXsfx00BD 189 +#define SFXsfx00BE 190 +#define SFXsfx00BF 191 diff --git a/Runtime/Audio/SFX/ChubbWeed.h b/Runtime/Audio/SFX/ChubbWeed.h new file mode 100644 index 000000000..3f33f7989 --- /dev/null +++ b/Runtime/Audio/SFX/ChubbWeed.h @@ -0,0 +1,16 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: ChubbWeed + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPChubbWeed 7 + +#define SFXchb_r_scream_00 192 +#define SFXchb_r_alert_00_lp 193 +#define SFXsfx00C2 194 +#define SFXsfx00C3 195 +#define SFXsfx00C4 196 +#define SFXsfx00C5 197 +#define SFXsfx00C6 198 diff --git a/Runtime/Audio/SFX/CineBoots.h b/Runtime/Audio/SFX/CineBoots.h new file mode 100644 index 000000000..5109d62ad --- /dev/null +++ b/Runtime/Audio/SFX/CineBoots.h @@ -0,0 +1,29 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: CineBoots + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPCineBoots 59 + +#define SFXci7_x_jump_00 2972 +#define SFXsja_c_electric_lp_00 2973 +#define SFXsfx0B9E 2974 +#define SFXsfx0B9F 2975 +#define SFXsfx0BA0 2976 +#define SFXsfx0BA1 2977 +#define SFXsfx0BA2 2978 +#define SFXsfx0BA3 2979 +#define SFXsfx0BA4 2980 +#define SFXsfx0BA5 2981 +#define SFXsfx0BA6 2982 +#define SFXsfx0BA7 2983 +#define SFXsfx0BA8 2984 +#define SFXsfx0BA9 2985 +#define SFXsfx0BAA 2986 +#define SFXsfx0BAB 2987 +#define SFXsfx0BAC 2988 +#define SFXsfx0BAD 2989 +#define SFXsfx0BAE 2990 +#define SFXsfx0BAF 2991 diff --git a/Runtime/Audio/SFX/CineGeneral.h b/Runtime/Audio/SFX/CineGeneral.h new file mode 100644 index 000000000..6edef7c24 --- /dev/null +++ b/Runtime/Audio/SFX/CineGeneral.h @@ -0,0 +1,50 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: CineGeneral + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPCineGeneral 60 + +#define SFXsfx0BB0 2992 +#define SFXsfx0BB1 2993 +#define SFXci5_x_mapdown_00 2994 +#define SFXci5_x_mapload_lp_00 2995 +#define SFXci5_x_mapspin_lp_00 2996 +#define SFXci5_x_mapup_00 2997 +#define SFXepr_b_grenup_00 2998 +#define SFXpi2_x_missile_00 2999 +#define SFXpi2_x_healthsm_00 3000 +#define SFXpi2_x_smissile_00 3001 +#define SFXsfx0BBA 3002 +#define SFXsfx0BBB 3003 +#define SFXsfx0BBC 3004 +#define SFXsfx0BBD 3005 +#define SFXci9_x_nrg_lp_00 3006 +#define SFXsfx0BBF 3007 +#define SFXci9_x_insert_00 3008 +#define SFXsfx0BC1 3009 +#define SFXsfx0BC2 3010 +#define SFXsfx0BC3 3011 +#define SFXsfx0BC4 3012 +#define SFXsfx0BC5 3013 +#define SFXsfx0BC6 3014 +#define SFXsfx0BC7 3015 +#define SFXsfx0BC8 3016 +#define SFXsfx0BC9 3017 +#define SFXsfx0BCA 3018 +#define SFXsfx0BCB 3019 +#define SFXsfx0BCC 3020 +#define SFXsfx0BCD 3021 +#define SFXsfx0BCE 3022 +#define SFXsfx0BCF 3023 +#define SFXsfx0BD0 3024 +#define SFXsfx0BD1 3025 +#define SFXsfx0BD2 3026 +#define SFXsfx0BD3 3027 +#define SFXsfx0BD4 3028 +#define SFXsfx0BD5 3029 +#define SFXsfx0BD6 3030 +#define SFXsfx0BD7 3031 +#define SFXsfx0BD8 3032 diff --git a/Runtime/Audio/SFX/CineGun.h b/Runtime/Audio/SFX/CineGun.h new file mode 100644 index 000000000..37e176a80 --- /dev/null +++ b/Runtime/Audio/SFX/CineGun.h @@ -0,0 +1,23 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: CineGun + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPCineGun 62 + +#define SFXsfx0BE5 3045 +#define SFXci3_x_clank_00 3046 +#define SFXci4_x_clank_00 3047 +#define SFXsfx0BE8 3048 +#define SFXci3_c_ridiclaw_00 3049 +#define SFXsfx0BEA 3050 +#define SFXsfx0BEB 3051 +#define SFXsfx0BEC 3052 +#define SFXsfx0BED 3053 +#define SFXsfx0BEE 3054 +#define SFXsfx0BEF 3055 +#define SFXsfx0BF0 3056 +#define SFXsfx0BF1 3057 +#define SFXsfx0BF2 3058 diff --git a/Runtime/Audio/SFX/CineMorphball.h b/Runtime/Audio/SFX/CineMorphball.h new file mode 100644 index 000000000..862a9be10 --- /dev/null +++ b/Runtime/Audio/SFX/CineMorphball.h @@ -0,0 +1,19 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: CineMorphball + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPCineMorphball 63 + +#define SFXsfx0BF3 3059 +#define SFXsfx0BF4 3060 +#define SFXsfx0BF5 3061 +#define SFXsfx0BF6 3062 +#define SFXsfx0BF7 3063 +#define SFXsfx0BF8 3064 +#define SFXsfx0BF9 3065 +#define SFXsfx0BFA 3066 +#define SFXsfx0BFB 3067 +#define SFXsfx0BFC 3068 diff --git a/Runtime/Audio/SFX/CineSuit.h b/Runtime/Audio/SFX/CineSuit.h new file mode 100644 index 000000000..fda09dc9c --- /dev/null +++ b/Runtime/Audio/SFX/CineSuit.h @@ -0,0 +1,34 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: CineSuit + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPCineSuit 64 + +#define SFXci2_x_energy_lp_00 3069 +#define SFXci2_x_energy_lp_01 3070 +#define SFXsfx0BFF 3071 +#define SFXsfx0C00 3072 +#define SFXci2_x_jump_00 3073 +#define SFXsfx0C02 3074 +#define SFXci2_x_lights_lp_00 3075 +#define SFXci2_x_pad_lp_00 3076 +#define SFXsfx0C05 3077 +#define SFXsfx0C06 3078 +#define SFXci3_x_energy_02 3079 +#define SFXsfx0C08 3080 +#define SFXsfx0C09 3081 +#define SFXci3_x_whoosh_00 3082 +#define SFXsfx0C0B 3083 +#define SFXsfx0C0C 3084 +#define SFXsfx0C0D 3085 +#define SFXsfx0C0E 3086 +#define SFXsfx0C0F 3087 +#define SFXsfx0C10 3088 +#define SFXsfx0C11 3089 +#define SFXsfx0C12 3090 +#define SFXsfx0C13 3091 +#define SFXsfx0C14 3092 +#define SFXsfx0C15 3093 diff --git a/Runtime/Audio/SFX/CineVisor.h b/Runtime/Audio/SFX/CineVisor.h new file mode 100644 index 000000000..ad8fe85ac --- /dev/null +++ b/Runtime/Audio/SFX/CineVisor.h @@ -0,0 +1,21 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: CineVisor + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPCineVisor 61 + +#define SFXcin_x_visor_00 3033 +#define SFXsfx0BDA 3034 +#define SFXsfx0BDB 3035 +#define SFXsfx0BDC 3036 +#define SFXsfx0BDD 3037 +#define SFXsfx0BDE 3038 +#define SFXsfx0BDF 3039 +#define SFXsfx0BE0 3040 +#define SFXsfx0BE1 3041 +#define SFXsfx0BE2 3042 +#define SFXsfx0BE3 3043 +#define SFXsfx0BE4 3044 diff --git a/Runtime/Audio/SFX/Crater.h b/Runtime/Audio/SFX/Crater.h new file mode 100644 index 000000000..c7d0d97d5 --- /dev/null +++ b/Runtime/Audio/SFX/Crater.h @@ -0,0 +1,39 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Crater + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPCrater 44 + +#define SFXsfx0764 1892 +#define SFXsfx0765 1893 +#define SFXsfx0766 1894 +#define SFXsfx0767 1895 +#define SFXsfx0768 1896 +#define SFXsfx0769 1897 +#define SFXsfx076A 1898 +#define SFXsfx076B 1899 +#define SFXsfx076C 1900 +#define SFXsfx076D 1901 +#define SFXsfx076E 1902 +#define SFXsfx076F 1903 +#define SFXsfx0770 1904 +#define SFXsfx0771 1905 +#define SFXsfx0772 1906 +#define SFXsfx0773 1907 +#define SFXsfx0774 1908 +#define SFXsfx0775 1909 +#define SFXsfx0776 1910 +#define SFXsfx0777 1911 +#define SFXsfx0778 1912 +#define SFXsfx0779 1913 +#define SFXsfx077A 1914 +#define SFXsfx077B 1915 +#define SFXsfx077C 1916 +#define SFXsfx077D 1917 +#define SFXsfx077E 1918 +#define SFXsfx077F 1919 +#define SFXsfx0780 1920 +#define SFXsfx0781 1921 diff --git a/Runtime/Audio/SFX/Crystallite.h b/Runtime/Audio/SFX/Crystallite.h new file mode 100644 index 000000000..f142471ce --- /dev/null +++ b/Runtime/Audio/SFX/Crystallite.h @@ -0,0 +1,19 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Crystallite + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPCrystallite 8 + +#define SFXcry_b_idle_00 199 +#define SFXsfx00C8 200 +#define SFXsfx00C9 201 +#define SFXsfx00CA 202 +#define SFXsfx00CB 203 +#define SFXsfx00CC 204 +#define SFXsfx00CD 205 +#define SFXsfx00CE 206 +#define SFXsfx00CF 207 +#define SFXsfx00D0 208 diff --git a/Runtime/Audio/SFX/Drones.h b/Runtime/Audio/SFX/Drones.h new file mode 100644 index 000000000..8f05c4963 --- /dev/null +++ b/Runtime/Audio/SFX/Drones.h @@ -0,0 +1,69 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Drones + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPDrones 9 + +#define SFXepr_a_shockhit_00 209 +#define SFXsfx00D2 210 +#define SFXdrn_b_burst_00 211 +#define SFXsfx00D4 212 +#define SFXsfx00D5 213 +#define SFXsfx00D6 214 +#define SFXsfx00D7 215 +#define SFXdrn_b_patrol_lp_00 216 +#define SFXdrn_b_henshin_00 217 +#define SFXdrn_b_rocket_lp_00 218 +#define SFXdrn_b_rocket_lp_01 219 +#define SFXdrn_b_rocket_lp_02 220 +#define SFXsfx00DD 221 +#define SFXdrn_r_death_00 222 +#define SFXsfx00DF 223 +#define SFXsfx00E0 224 +#define SFXdrn_r_impact_00 225 +#define SFXsfx00E2 226 +#define SFXdrn_a_blast_00 227 +#define SFXsfx00E4 228 +#define SFXdrn_r_death_lp_00 229 +#define SFXsfx00E6 230 +#define SFXdrn_b_alert_00 231 +#define SFXsfx00E8 232 +#define SFXdrn_a_laser_00 233 +#define SFXsfx00EA 234 +#define SFXsfx00EB 235 +#define SFXsfx00EC 236 +#define SFXsfx00ED 237 +#define SFXdrn_r_impact_01 238 +#define SFXsfx00EF 239 +#define SFXdrn_a_blast_01 240 +#define SFXsfx00F1 241 +#define SFXsfx00F2 242 +#define SFXdrn_b_henshin_01 243 +#define SFXdrn_b_talk_00 244 +#define SFXsfx00F5 245 +#define SFXdrn_r_death_lp_01 246 +#define SFXdrn_a_charge_00 247 +#define SFXdrn_b_beep_03 248 +#define SFXsfx00F9 249 +#define SFXdrn_r_empblast_01 250 +#define SFXsfx00FB 251 +#define SFXsfx00FC 252 +#define SFXdrn_b_patrolun_lp_00 253 +#define SFXdrn_a_laserun_00 254 +#define SFXopr_a_shockhit_00 255 +#define SFXsfx0100 256 +#define SFXsfx0101 257 +#define SFXsfx0102 258 +#define SFXsfx0103 259 +#define SFXsfx0104 260 +#define SFXsfx0105 261 +#define SFXsfx0106 262 +#define SFXsfx0107 263 +#define SFXsfx0108 264 +#define SFXsfx0109 265 +#define SFXsfx010A 266 +#define SFXsfx010B 267 +#define SFXsfx010C 268 diff --git a/Runtime/Audio/SFX/EliteSpacePirate.h b/Runtime/Audio/SFX/EliteSpacePirate.h new file mode 100644 index 000000000..41e0e69aa --- /dev/null +++ b/Runtime/Audio/SFX/EliteSpacePirate.h @@ -0,0 +1,63 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: EliteSpacePirate + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPEliteSpacePirate 10 + +#define SFXepr_a_grenade_00 269 +#define SFXsfx010E 270 +#define SFXsfx010F 271 +#define SFXepr_b_hitglass_00 272 +#define SFXepr_a_swoosh_00 273 +#define SFXepr_b_run_00 274 +#define SFXepr_b_run_01 275 +#define SFXepr_a_shokwave_00 276 +#define SFXsfx0115 277 +#define SFXepr_a_attack_00 278 +#define SFXepr_a_attack_01 279 +#define SFXepr_b_land_00 280 +#define SFXepr_b_alert_00 281 +#define SFXepr_b_walk_00 282 +#define SFXepr_b_walk_01 283 +#define SFXepr_b_alert_01 284 +#define SFXepr_b_absorb_lp_00 285 +#define SFXepr_b_idle_00 286 +#define SFXepr_b_idle_01 287 +#define SFXepr_a_hitgrnd_00 288 +#define SFXepr_b_walklite_00 289 +#define SFXepr_b_walklite_01 290 +#define SFXepr_r_pissed_00 291 +#define SFXsfx0124 292 +#define SFXsfx0125 293 +#define SFXepr_a_swoosh_01 294 +#define SFXepr_b_taunt_00 295 +#define SFXopr_a_swoosh_00 296 +#define SFXopr_a_swoosh_01 297 +#define SFXepr_b_blokvox_00 298 +#define SFXsfx012B 299 +#define SFXopr_a_shokwave_00 300 +#define SFXsfx012D 301 +#define SFXopr_b_absorb_lp_00 302 +#define SFXsfx012F 303 +#define SFXsfx0130 304 +#define SFXsfx0131 305 +#define SFXsfx0132 306 +#define SFXsfx0133 307 +#define SFXsfx0134 308 +#define SFXsfx0135 309 +#define SFXsfx0136 310 +#define SFXsfx0137 311 +#define SFXsfx0138 312 +#define SFXsfx0139 313 +#define SFXsfx013A 314 +#define SFXsfx013B 315 +#define SFXsfx013C 316 +#define SFXsfx013D 317 +#define SFXsfx013E 318 +#define SFXsfx013F 319 +#define SFXsfx0140 320 +#define SFXsfx0141 321 +#define SFXsfx0142 322 diff --git a/Runtime/Audio/SFX/FireFlea.h b/Runtime/Audio/SFX/FireFlea.h new file mode 100644 index 000000000..9657afe45 --- /dev/null +++ b/Runtime/Audio/SFX/FireFlea.h @@ -0,0 +1,22 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: FireFlea + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPFireFlea 11 + +#define SFXfif_b_idle_lp_00 323 +#define SFXsfx0144 324 +#define SFXfif_b_light_00 325 +#define SFXfif_r_death_00 326 +#define SFXfif_r_death_01 327 +#define SFXfif_r_explode_00 328 +#define SFXfif_r_impact_00 329 +#define SFXsfx014A 330 +#define SFXsfx014B 331 +#define SFXsfx014C 332 +#define SFXsfx014D 333 +#define SFXsfx014E 334 +#define SFXsfx014F 335 diff --git a/Runtime/Audio/SFX/Flaaghra.h b/Runtime/Audio/SFX/Flaaghra.h new file mode 100644 index 000000000..c7d328a51 --- /dev/null +++ b/Runtime/Audio/SFX/Flaaghra.h @@ -0,0 +1,90 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Flaaghra + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPFlaaghra 52 + +#define SFXfla_a_hitgrnd_00 2600 +#define SFXfla_a_swoosh_00 2601 +#define SFXfla_a_swoosh_01 2602 +#define SFXfla_a_voxattak_00 2603 +#define SFXfla_a_voxattak_01 2604 +#define SFXfla_b_grow_00 2605 +#define SFXfla_b_idle_00 2606 +#define SFXsfx0A2F 2607 +#define SFXfla_b_voxangry_00 2608 +#define SFXfla_b_voxangry_01 2609 +#define SFXfla_r_death_00 2610 +#define SFXfla_r_death_01 2611 +#define SFXfla_r_death_02 2612 +#define SFXsfx0A35 2613 +#define SFXfla_r_faint_01 2614 +#define SFXfla_r_pain_00 2615 +#define SFXsfx0A38 2616 +#define SFXfla_a_shoot_00 2617 +#define SFXfla_a_spit_00 2618 +#define SFXfla_a_spit_01 2619 +#define SFXsfx0A3C 2620 +#define SFXsfx0A3D 2621 +#define SFXfla_a_charge_00 2622 +#define SFXsfx0A3F 2623 +#define SFXsfx0A40 2624 +#define SFXfla_b_idlesm_00 2625 +#define SFXfla_a_chargevox_00 2626 +#define SFXsfx0A43 2627 +#define SFXsfx0A44 2628 +#define SFXsfx0A45 2629 +#define SFXfla_a_shootvox_00 2630 +#define SFXsfx0A47 2631 +#define SFXsfx0A48 2632 +#define SFXsfx0A49 2633 +#define SFXsfx0A4A 2634 +#define SFXsfx0A4B 2635 +#define SFXfla_a_spitvox_00 2636 +#define SFXfla_a_spitvox_01 2637 +#define SFXsfx0A4E 2638 +#define SFXsfx0A4F 2639 +#define SFXsfx0A50 2640 +#define SFXsfx0A51 2641 +#define SFXsfx0A52 2642 +#define SFXfla_a_sporevox_01 2643 +#define SFXfla_a_hitgrnd_01 2644 +#define SFXsfx0A55 2645 +#define SFXfla_r_landgrnd_00 2646 +#define SFXsfx0A57 2647 +#define SFXsfx0A58 2648 +#define SFXfla_b_grow_01 2649 +#define SFXfla_b_rise_lp_00 2650 +#define SFXsfx0A5B 2651 +#define SFXfla_b_dizzy_00 2652 +#define SFXsfx0A5D 2653 +#define SFXsfx0A5E 2654 +#define SFXfla_r_painsh_00 2655 +#define SFXsfx0A60 2656 +#define SFXfla_b_humor_00 2657 +#define SFXfla_r_painbig_00 2658 +#define SFXfla_b_dizzyout_00 2659 +#define SFXfla_b_faintout_00 2660 +#define SFXsfx0A65 2661 +#define SFXfla_b_dizzy_lp_01 2662 +#define SFXsfx0A67 2663 +#define SFXsfx0A68 2664 +#define SFXsfx0A69 2665 +#define SFXsfx0A6A 2666 +#define SFXfla_b_voxshrnk_00 2667 +#define SFXsfx0A6C 2668 +#define SFXsfx0A6D 2669 +#define SFXfla_b_voxshrnk_03 2670 +#define SFXsfx0A6F 2671 +#define SFXsfx0A70 2672 +#define SFXsfx0A71 2673 +#define SFXsfx0A72 2674 +#define SFXsfx0A73 2675 +#define SFXsfx0A74 2676 +#define SFXsfx0A75 2677 +#define SFXsfx0A76 2678 +#define SFXsfx0A77 2679 +#define SFXsfx0A78 2680 diff --git a/Runtime/Audio/SFX/FlickerBat.h b/Runtime/Audio/SFX/FlickerBat.h new file mode 100644 index 000000000..cd0b38c6e --- /dev/null +++ b/Runtime/Audio/SFX/FlickerBat.h @@ -0,0 +1,21 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: FlickerBat + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPFlickerBat 12 + +#define SFXflk_b_flicker_00 336 +#define SFXflk_b_talk_00 337 +#define SFXflk_b_talk_01 338 +#define SFXsfx0153 339 +#define SFXsfx0154 340 +#define SFXflk_r_impact_00 341 +#define SFXsfx0156 342 +#define SFXsfx0157 343 +#define SFXsfx0158 344 +#define SFXsfx0159 345 +#define SFXsfx015A 346 +#define SFXsfx015B 347 diff --git a/Runtime/Audio/SFX/FlyingPirate.h b/Runtime/Audio/SFX/FlyingPirate.h new file mode 100644 index 000000000..183c0f297 --- /dev/null +++ b/Runtime/Audio/SFX/FlyingPirate.h @@ -0,0 +1,68 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: FlyingPirate + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPFlyingPirate 13 + +#define SFXsfx015C 348 +#define SFXfpr_a_chaff_00 349 +#define SFXsfx015E 350 +#define SFXupr_a_mislfire_00 351 +#define SFXsfx0160 352 +#define SFXsfx0161 353 +#define SFXfpr_a_mislfire_00 354 +#define SFXfpr_b_thrust_01 355 +#define SFXsfx0164 356 +#define SFXfpr_b_engine_lp_00 357 +#define SFXfpr_b_engine_lp_01 358 +#define SFXfpr_b_engine_lp_02 359 +#define SFXfpr_b_voxangry_02 360 +#define SFXfpr_b_thrust_00 361 +#define SFXsfx016A 362 +#define SFXfpr_r_die_00 363 +#define SFXfpr_b_intruder_00 364 +#define SFXfpr_b_voxalert_00 365 +#define SFXfpr_a_mislload_00 366 +#define SFXfpr_b_voxangry_00 367 +#define SFXsfx0170 368 +#define SFXfpr_r_impact_00 369 +#define SFXsfx0172 370 +#define SFXsfx0173 371 +#define SFXsfx0174 372 +#define SFXfpr_b_engidle_lp_00 373 +#define SFXsfx0176 374 +#define SFXfpr_b_blastoff_lp_00 375 +#define SFXfpr_b_blastoff_01 376 +#define SFXupr_a_mislload_00 377 +#define SFXupr_b_engidle_lp_00 378 +#define SFXupr_b_engine_lp_00 379 +#define SFXupr_b_engine_lp_01 380 +#define SFXupr_b_engine_lp_02 381 +#define SFXsfx017E 382 +#define SFXsfx017F 383 +#define SFXupr_b_voxalert_00 384 +#define SFXsfx0181 385 +#define SFXupr_b_voxangry_00 386 +#define SFXsfx0183 387 +#define SFXupr_b_voxangry_02 388 +#define SFXupr_r_die_00 389 +#define SFXupr_r_impact_00 390 +#define SFXsfx0187 391 +#define SFXsfx0188 392 +#define SFXsfx0189 393 +#define SFXsfx018A 394 +#define SFXsfx018B 395 +#define SFXsfx018C 396 +#define SFXsfx018D 397 +#define SFXsfx018E 398 +#define SFXsfx018F 399 +#define SFXsfx0190 400 +#define SFXsfx0191 401 +#define SFXsfx0192 402 +#define SFXsfx0193 403 +#define SFXsfx0194 404 +#define SFXsfx0195 405 +#define SFXsfx0196 406 diff --git a/Runtime/Audio/SFX/FrontEnd.h b/Runtime/Audio/SFX/FrontEnd.h new file mode 100644 index 000000000..7aa483660 --- /dev/null +++ b/Runtime/Audio/SFX/FrontEnd.h @@ -0,0 +1,47 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: FrontEnd + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPFrontEnd 38 + +#define SFXfnt_transfore_00L 1090 +#define SFXfnt_advance_R 1091 +#define SFXsfx0444 1092 +#define SFXfnt_selection_change 1093 +#define SFXfnt_back 1094 +#define SFXfnt_enum_change 1095 +#define SFXfnt_advance_L 1096 +#define SFXfnt_transfore_00R 1097 +#define SFXfnt_transfore_01L 1098 +#define SFXfnt_transfore_01R 1099 +#define SFXfnt_transfore_02L 1100 +#define SFXfnt_transfore_02R 1101 +#define SFXfnt_transback_00L 1102 +#define SFXfnt_transback_00R 1103 +#define SFXfnt_transback_01L 1104 +#define SFXfnt_transback_01R 1105 +#define SFXfnt_transback_02L 1106 +#define SFXfnt_transback_02R 1107 +#define SFXfnt_tofusion_L 1108 +#define SFXfnt_tofusion_R 1109 +#define SFXfnt_fromfusion_L 1110 +#define SFXfnt_fromfusion_R 1111 +#define SFXsfx0458 1112 +#define SFXsfx0459 1113 +#define SFXsfx045A 1114 +#define SFXsfx045B 1115 +#define SFXsfx045C 1116 +#define SFXsfx045D 1117 +#define SFXsfx045E 1118 +#define SFXsfx045F 1119 +#define SFXsfx0460 1120 +#define SFXsfx0461 1121 +#define SFXsfx0462 1122 +#define SFXsfx0463 1123 +#define SFXsfx0464 1124 +#define SFXsfx0465 1125 +#define SFXsfx0466 1126 +#define SFXsfx0467 1127 diff --git a/Runtime/Audio/SFX/GagantuanBeatle.h b/Runtime/Audio/SFX/GagantuanBeatle.h new file mode 100644 index 000000000..3c29321d1 --- /dev/null +++ b/Runtime/Audio/SFX/GagantuanBeatle.h @@ -0,0 +1,61 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: GagantuanBeatle + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPGagantuanBeatle 14 + +#define SFXgab_r_hitlight_01 407 +#define SFXga2_b_digexplod_00 408 +#define SFXga2_b_digscream_00 409 +#define SFXga2_b_idle_01 410 +#define SFXga2_b_scrapedirt_00 411 +#define SFXgab_b_walkdirt_02 412 +#define SFXgab_b_rundirt_00 413 +#define SFXgab_b_rundirt_01 414 +#define SFXsfx019F 415 +#define SFXgab_a_attack_00 416 +#define SFXgab_a_attack_01 417 +#define SFXgab_b_idle_03 418 +#define SFXgab_b_digexplod_00 419 +#define SFXfla_b_scrapedirt_00 420 +#define SFXgab_b_idle_02 421 +#define SFXgab_b_idle_00 422 +#define SFXgab_b_idle_01 423 +#define SFXgab_b_walkdirt_00 424 +#define SFXgab_b_walkdirt_01 425 +#define SFXgab_r_collide_00 426 +#define SFXsfx01AB 427 +#define SFXgab_r_death_01 428 +#define SFXgab_r_detect_00 429 +#define SFXgab_r_hitlight_00 430 +#define SFXgab_b_digscream_00 431 +#define SFXgab_b_scrapedirt_00 432 +#define SFXga2_b_dig_lp_00 433 +#define SFXga2_b_rundirt_00 434 +#define SFXgab_b_dig_lp_00 435 +#define SFXga2_b_rundirt_01 436 +#define SFXga2_b_rundirt_02 437 +#define SFXga2_b_walkdirt_00 438 +#define SFXga2_b_walkdirt_01 439 +#define SFXga2_b_walkdirt_02 440 +#define SFXga2_r_collide_00 441 +#define SFXga2_a_attack_00 442 +#define SFXsfx01BB 443 +#define SFXsfx01BC 444 +#define SFXsfx01BD 445 +#define SFXsfx01BE 446 +#define SFXsfx01BF 447 +#define SFXsfx01C0 448 +#define SFXsfx01C1 449 +#define SFXsfx01C2 450 +#define SFXsfx01C3 451 +#define SFXsfx01C4 452 +#define SFXsfx01C5 453 +#define SFXsfx01C6 454 +#define SFXsfx01C7 455 +#define SFXsfx01C8 456 +#define SFXsfx01C9 457 +#define SFXsfx01CA 458 diff --git a/Runtime/Audio/SFX/Gnats.h b/Runtime/Audio/SFX/Gnats.h new file mode 100644 index 000000000..a704da839 --- /dev/null +++ b/Runtime/Audio/SFX/Gnats.h @@ -0,0 +1,16 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Gnats + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPGnats 15 + +#define SFXsfx01CB 459 +#define SFXsfx01CC 460 +#define SFXsfx01CD 461 +#define SFXsfx01CE 462 +#define SFXsfx01CF 463 +#define SFXsfx01D0 464 +#define SFXsfx01D1 465 diff --git a/Runtime/Audio/SFX/Gryzbee.h b/Runtime/Audio/SFX/Gryzbee.h new file mode 100644 index 000000000..f525e1a01 --- /dev/null +++ b/Runtime/Audio/SFX/Gryzbee.h @@ -0,0 +1,21 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Gryzbee + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPGryzbee 16 + +#define SFXgrz_b_idle_00 466 +#define SFXsfx01D3 467 +#define SFXsfx01D4 468 +#define SFXsfx01D5 469 +#define SFXsfx01D6 470 +#define SFXsfx01D7 471 +#define SFXsfx01D8 472 +#define SFXsfx01D9 473 +#define SFXsfx01DA 474 +#define SFXsfx01DB 475 +#define SFXsfx01DC 476 +#define SFXsfx01DD 477 diff --git a/Runtime/Audio/SFX/IceCrack.h b/Runtime/Audio/SFX/IceCrack.h new file mode 100644 index 000000000..8ba2aef58 --- /dev/null +++ b/Runtime/Audio/SFX/IceCrack.h @@ -0,0 +1,29 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: IceCrack + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPIceCrack 67 + +#define SFXsfx0C31 3121 +#define SFXsfx0C32 3122 +#define SFXsfx0C33 3123 +#define SFXsfx0C34 3124 +#define SFXsfx0C35 3125 +#define SFXsfx0C36 3126 +#define SFXcrk_break_subsequent 3127 +#define SFXcrk_break_initial 3128 +#define SFXcrk_break_final 3129 +#define SFXsfx0C3A 3130 +#define SFXsfx0C3B 3131 +#define SFXsfx0C3C 3132 +#define SFXsfx0C3D 3133 +#define SFXsfx0C3E 3134 +#define SFXsfx0C3F 3135 +#define SFXsfx0C40 3136 +#define SFXsfx0C41 3137 +#define SFXsfx0C42 3138 +#define SFXsfx0C43 3139 +#define SFXsfx0C44 3140 diff --git a/Runtime/Audio/SFX/IceWorld.h b/Runtime/Audio/SFX/IceWorld.h new file mode 100644 index 000000000..138ec27c6 --- /dev/null +++ b/Runtime/Audio/SFX/IceWorld.h @@ -0,0 +1,129 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: IceWorld + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPIceWorld 45 + +#define SFXice_x_gateopen_lp_00 1922 +#define SFXice_x_gatestop_00 1923 +#define SFXsfx0784 1924 +#define SFXice_x_towercrk_00 1925 +#define SFXice_ballroll_ice 1926 +#define SFXice_ballroll_snow 1927 +#define SFXsfx0788 1928 +#define SFXice_x_towerlnd_00 1929 +#define SFXsfx078A 1930 +#define SFXice_x_towerlnd_01 1931 +#define SFXice_x_towercrk_01 1932 +#define SFXice_x_towercrk_02 1933 +#define SFXsfx078E 1934 +#define SFXsfx078F 1935 +#define SFXsfx0790 1936 +#define SFXsfx0791 1937 +#define SFXsfx0792 1938 +#define SFXsfx0793 1939 +#define SFXsfx0794 1940 +#define SFXsfx0795 1941 +#define SFXsfx0796 1942 +#define SFXsfx0797 1943 +#define SFXsfx0798 1944 +#define SFXsfx0799 1945 +#define SFXsfx079A 1946 +#define SFXsfx079B 1947 +#define SFXsfx079C 1948 +#define SFXsfx079D 1949 +#define SFXsfx079E 1950 +#define SFXsfx079F 1951 +#define SFXsfx07A0 1952 +#define SFXsfx07A1 1953 +#define SFXsfx07A2 1954 +#define SFXsfx07A3 1955 +#define SFXsfx07A4 1956 +#define SFXsfx07A5 1957 +#define SFXsfx07A6 1958 +#define SFXsfx07A7 1959 +#define SFXsfx07A8 1960 +#define SFXsfx07A9 1961 +#define SFXsfx07AA 1962 +#define SFXsfx07AB 1963 +#define SFXsfx07AC 1964 +#define SFXsfx07AD 1965 +#define SFXsfx07AE 1966 +#define SFXsfx07AF 1967 +#define SFXtha_b_rockup_lp_00 1968 +#define SFXsfx07B1 1969 +#define SFXsfx07B2 1970 +#define SFXice_x_ridflap_00 1971 +#define SFXsfx07B4 1972 +#define SFXsfx07B5 1973 +#define SFXsfx07B6 1974 +#define SFXice_x_pump_00 1975 +#define SFXsfx07B8 1976 +#define SFXsfx07B9 1977 +#define SFXsfx07BA 1978 +#define SFXsfx07BB 1979 +#define SFXsfx07BC 1980 +#define SFXsfx07BD 1981 +#define SFXice_x_piston_00 1982 +#define SFXice_x_piston_lp_00 1983 +#define SFXsfx07C0 1984 +#define SFXsfx07C1 1985 +#define SFXsfx07C2 1986 +#define SFXsfx07C3 1987 +#define SFXsfx07C4 1988 +#define SFXsfx07C5 1989 +#define SFXsfx07C6 1990 +#define SFXsfx07C7 1991 +#define SFXsfx07C8 1992 +#define SFXsfx07C9 1993 +#define SFXtha_b_debris_00 1994 +#define SFXtha_b_debris_01 1995 +#define SFXsfx07CC 1996 +#define SFXsfx07CD 1997 +#define SFXsfx07CE 1998 +#define SFXsfx07CF 1999 +#define SFXsfx07D0 2000 +#define SFXsfx07D1 2001 +#define SFXsfx07D2 2002 +#define SFXsfx07D3 2003 +#define SFXsfx07D4 2004 +#define SFXsfx07D5 2005 +#define SFXsfx07D6 2006 +#define SFXsfx07D7 2007 +#define SFXsfx07D8 2008 +#define SFXsfx07D9 2009 +#define SFXsfx07DA 2010 +#define SFXsfx07DB 2011 +#define SFXsfx07DC 2012 +#define SFXsfx07DD 2013 +#define SFXsfx07DE 2014 +#define SFXsfx07DF 2015 +#define SFXsfx07E0 2016 +#define SFXsfx07E1 2017 +#define SFXsfx07E2 2018 +#define SFXsfx07E3 2019 +#define SFXsfx07E4 2020 +#define SFXsfx07E5 2021 +#define SFXsfx07E6 2022 +#define SFXsfx07E7 2023 +#define SFXsfx07E8 2024 +#define SFXsfx07E9 2025 +#define SFXsfx07EA 2026 +#define SFXsfx07EB 2027 +#define SFXsfx07EC 2028 +#define SFXsfx07ED 2029 +#define SFXsfx07EE 2030 +#define SFXsfx07EF 2031 +#define SFXsfx07F0 2032 +#define SFXsfx07F1 2033 +#define SFXsfx07F2 2034 +#define SFXsfx07F3 2035 +#define SFXsfx07F4 2036 +#define SFXsfx07F5 2037 +#define SFXsfx07F6 2038 +#define SFXsfx07F7 2039 +#define SFXsfx07F8 2040 +#define SFXsfx07F9 2041 diff --git a/Runtime/Audio/SFX/InjuredPirates.h b/Runtime/Audio/SFX/InjuredPirates.h new file mode 100644 index 000000000..3ffa19559 --- /dev/null +++ b/Runtime/Audio/SFX/InjuredPirates.h @@ -0,0 +1,39 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: InjuredPirates + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPInjuredPirates 17 + +#define SFXsfx01DE 478 +#define SFXsfx01DF 479 +#define SFXspr_b_exhale_00 480 +#define SFXsfx01E1 481 +#define SFXspr_b_moan_00 482 +#define SFXsfx01E3 483 +#define SFXsfx01E4 484 +#define SFXsfx01E5 485 +#define SFXsfx01E6 486 +#define SFXsfx01E7 487 +#define SFXsfx01E8 488 +#define SFXsfx01E9 489 +#define SFXsfx01EA 490 +#define SFXsfx01EB 491 +#define SFXsfx01EC 492 +#define SFXsfx01ED 493 +#define SFXsfx01EE 494 +#define SFXsfx01EF 495 +#define SFXsfx01F0 496 +#define SFXsfx01F1 497 +#define SFXsfx01F2 498 +#define SFXsfx01F3 499 +#define SFXsfx01F4 500 +#define SFXsfx01F5 501 +#define SFXsfx01F6 502 +#define SFXsfx01F7 503 +#define SFXsfx01F8 504 +#define SFXsfx01F9 505 +#define SFXsfx01FA 506 +#define SFXsfx01FB 507 diff --git a/Runtime/Audio/SFX/IntroBoss.h b/Runtime/Audio/SFX/IntroBoss.h new file mode 100644 index 000000000..2f52833bd --- /dev/null +++ b/Runtime/Audio/SFX/IntroBoss.h @@ -0,0 +1,51 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: IntroBoss + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPIntroBoss 0 + +#define SFXsfx0000 0 +#define SFXsfx0001 1 +#define SFXsfx0002 2 +#define SFXpaq_a_spit_lp_00 3 +#define SFXpaq_b_squawk_00 4 +#define SFXpaq_b_creak_00 5 +#define SFXpaq_b_creak_01 6 +#define SFXpaq_b_growl_00 7 +#define SFXpaq_b_growl_01 8 +#define SFXpaq_b_land_00 9 +#define SFXpaq_b_roar_00 10 +#define SFXpaq_b_roar_01 11 +#define SFXsfx000C 12 +#define SFXpaq_b_walk_00 13 +#define SFXpaq_b_walk_01 14 +#define SFXpaq_r_impact_00 15 +#define SFXpaq_r_impact_01 16 +#define SFXpaq_r_ldeath_00 17 +#define SFXpaq_r_sdeath_01 18 +#define SFXpaq_b_swish_00 19 +#define SFXsfx0014 20 +#define SFXsfx0015 21 +#define SFXsfx0016 22 +#define SFXpaq_b_land_01 23 +#define SFXpaq_b_run_00 24 +#define SFXpaq_b_run_01 25 +#define SFXsfx001A 26 +#define SFXsfx001B 27 +#define SFXsfx001C 28 +#define SFXsfx001D 29 +#define SFXsfx001E 30 +#define SFXsfx001F 31 +#define SFXsfx0020 32 +#define SFXsfx0021 33 +#define SFXsfx0022 34 +#define SFXsfx0023 35 +#define SFXsfx0024 36 +#define SFXsfx0025 37 +#define SFXsfx0026 38 +#define SFXsfx0027 39 +#define SFXsfx0028 40 +#define SFXsfx0029 41 diff --git a/Runtime/Audio/SFX/IntroWorld.h b/Runtime/Audio/SFX/IntroWorld.h new file mode 100644 index 000000000..02121538d --- /dev/null +++ b/Runtime/Audio/SFX/IntroWorld.h @@ -0,0 +1,148 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: IntroWorld + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPIntroWorld 46 + +#define SFXsfx07FA 2042 +#define SFXsfx07FB 2043 +#define SFXsfx07FC 2044 +#define SFXsfx07FD 2045 +#define SFXsfx07FE 2046 +#define SFXint_c_suitsprk_lp_01 2047 +#define SFXsfx0800 2048 +#define SFXsfx0801 2049 +#define SFXsfx0802 2050 +#define SFXsfx0803 2051 +#define SFXsfx0804 2052 +#define SFXsfx0805 2053 +#define SFXsfx0806 2054 +#define SFXsfx0807 2055 +#define SFXsfx0808 2056 +#define SFXsfx0809 2057 +#define SFXsfx080A 2058 +#define SFXsfx080B 2059 +#define SFXsfx080C 2060 +#define SFXsfx080D 2061 +#define SFXsfx080E 2062 +#define SFXsfx080F 2063 +#define SFXsfx0810 2064 +#define SFXsfx0811 2065 +#define SFXsfx0812 2066 +#define SFXsfx0813 2067 +#define SFXsfx0814 2068 +#define SFXsfx0815 2069 +#define SFXsfx0816 2070 +#define SFXsfx0817 2071 +#define SFXsfx0818 2072 +#define SFXsfx0819 2073 +#define SFXsfx081A 2074 +#define SFXsfx081B 2075 +#define SFXsfx081C 2076 +#define SFXsfx081D 2077 +#define SFXsfx081E 2078 +#define SFXsfx081F 2079 +#define SFXsfx0820 2080 +#define SFXsfx0821 2081 +#define SFXsfx0822 2082 +#define SFXsfx0823 2083 +#define SFXsfx0824 2084 +#define SFXsfx0825 2085 +#define SFXsfx0826 2086 +#define SFXsfx0827 2087 +#define SFXsfx0828 2088 +#define SFXsfx0829 2089 +#define SFXsfx082A 2090 +#define SFXsfx082B 2091 +#define SFXsfx082C 2092 +#define SFXsfx082D 2093 +#define SFXsfx082E 2094 +#define SFXsfx082F 2095 +#define SFXsfx0830 2096 +#define SFXsfx0831 2097 +#define SFXsfx0832 2098 +#define SFXsfx0833 2099 +#define SFXsfx0834 2100 +#define SFXsfx0835 2101 +#define SFXsfx0836 2102 +#define SFXsfx0837 2103 +#define SFXsfx0838 2104 +#define SFXsfx0839 2105 +#define SFXsfx083A 2106 +#define SFXsfx083B 2107 +#define SFXsfx083C 2108 +#define SFXint_x_frtdoor_00 2109 +#define SFXint_x_frtdoor_01 2110 +#define SFXsfx083F 2111 +#define SFXsfx0840 2112 +#define SFXsfx0841 2113 +#define SFXsfx0842 2114 +#define SFXsfx0843 2115 +#define SFXsfx0844 2116 +#define SFXsfx0845 2117 +#define SFXsfx0846 2118 +#define SFXsfx0847 2119 +#define SFXsfx0848 2120 +#define SFXsfx0849 2121 +#define SFXsfx084A 2122 +#define SFXsfx084B 2123 +#define SFXsfx084C 2124 +#define SFXsfx084D 2125 +#define SFXint_c_suitbrst_01 2126 +#define SFXsfx084F 2127 +#define SFXsfx0850 2128 +#define SFXsfx0851 2129 +#define SFXint_c_shipthst_00 2130 +#define SFXsfx0853 2131 +#define SFXsfx0854 2132 +#define SFXsfx0855 2133 +#define SFXsfx0856 2134 +#define SFXsfx0857 2135 +#define SFXsfx0858 2136 +#define SFXsfx0859 2137 +#define SFXsfx085A 2138 +#define SFXsfx085B 2139 +#define SFXsfx085C 2140 +#define SFXsfx085D 2141 +#define SFXsfx085E 2142 +#define SFXsfx085F 2143 +#define SFXsfx0860 2144 +#define SFXsfx0861 2145 +#define SFXsfx0862 2146 +#define SFXsfx0863 2147 +#define SFXsfx0864 2148 +#define SFXsfx0865 2149 +#define SFXsfx0866 2150 +#define SFXsfx0867 2151 +#define SFXsfx0868 2152 +#define SFXsfx0869 2153 +#define SFXsfx086A 2154 +#define SFXsfx086B 2155 +#define SFXsfx086C 2156 +#define SFXsfx086D 2157 +#define SFXsfx086E 2158 +#define SFXsfx086F 2159 +#define SFXsfx0870 2160 +#define SFXint_x_clampstp_00 2161 +#define SFXint_x_clamp_00 2162 +#define SFXint_x_clamp_01 2163 +#define SFXsfx0874 2164 +#define SFXsfx0875 2165 +#define SFXsfx0876 2166 +#define SFXsfx0877 2167 +#define SFXsfx0878 2168 +#define SFXsfx0879 2169 +#define SFXsfx087A 2170 +#define SFXsfx087B 2171 +#define SFXsfx087C 2172 +#define SFXsfx087D 2173 +#define SFXsfx087E 2174 +#define SFXsfx087F 2175 +#define SFXsfx0880 2176 +#define SFXsfx0881 2177 +#define SFXsfx0882 2178 +#define SFXsfx0883 2179 +#define SFXsfx0884 2180 diff --git a/Runtime/Audio/SFX/JellyZap.h b/Runtime/Audio/SFX/JellyZap.h new file mode 100644 index 000000000..7d89c7bec --- /dev/null +++ b/Runtime/Audio/SFX/JellyZap.h @@ -0,0 +1,19 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: JellyZap + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPJellyZap 18 + +#define SFXjzp_a_shock_00 508 +#define SFXjzp_a_suck_lp_00 509 +#define SFXjzp_b_bubbles_00 510 +#define SFXjzp_b_growl_00 511 +#define SFXsfx0200 512 +#define SFXsfx0201 513 +#define SFXsfx0202 514 +#define SFXsfx0203 515 +#define SFXsfx0204 516 +#define SFXsfx0205 517 diff --git a/Runtime/Audio/SFX/LavaWorld.h b/Runtime/Audio/SFX/LavaWorld.h new file mode 100644 index 000000000..c8acf9d9d --- /dev/null +++ b/Runtime/Audio/SFX/LavaWorld.h @@ -0,0 +1,112 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: LavaWorld + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPLavaWorld 47 + +#define SFXsfx0885 2181 +#define SFXsfx0886 2182 +#define SFXlav_wlklava_00 2183 +#define SFXlav_wlklava_01 2184 +#define SFXsfx0889 2185 +#define SFXlav_ballroll_lava 2186 +#define SFXsfx088B 2187 +#define SFXsfx088C 2188 +#define SFXsfx088D 2189 +#define SFXlav_landlava_00 2190 +#define SFXsfx088F 2191 +#define SFXsfx0890 2192 +#define SFXsfx0891 2193 +#define SFXsfx0892 2194 +#define SFXsfx0893 2195 +#define SFXsfx0894 2196 +#define SFXsfx0895 2197 +#define SFXsfx0896 2198 +#define SFXsfx0897 2199 +#define SFXsfx0898 2200 +#define SFXsfx0899 2201 +#define SFXsfx089A 2202 +#define SFXsfx089B 2203 +#define SFXsfx089C 2204 +#define SFXsfx089D 2205 +#define SFXsfx089E 2206 +#define SFXsfx089F 2207 +#define SFXsfx08A0 2208 +#define SFXsfx08A1 2209 +#define SFXsfx08A2 2210 +#define SFXsfx08A3 2211 +#define SFXsfx08A4 2212 +#define SFXsfx08A5 2213 +#define SFXsfx08A6 2214 +#define SFXsfx08A7 2215 +#define SFXlav_x_piston_lp_00 2216 +#define SFXsfx08A9 2217 +#define SFXlav_x_piststop_00 2218 +#define SFXlav_x_piststop_01 2219 +#define SFXsfx08AC 2220 +#define SFXsfx08AD 2221 +#define SFXswp_x_03bridgestop_00 2222 +#define SFXsfx08AF 2223 +#define SFXsfx08B0 2224 +#define SFXsfx08B1 2225 +#define SFXsfx08B2 2226 +#define SFXsfx08B3 2227 +#define SFXsfx08B4 2228 +#define SFXsfx08B5 2229 +#define SFXsfx08B6 2230 +#define SFXsfx08B7 2231 +#define SFXsfx08B8 2232 +#define SFXsfx08B9 2233 +#define SFXsfx08BA 2234 +#define SFXsfx08BB 2235 +#define SFXsfx08BC 2236 +#define SFXsfx08BD 2237 +#define SFXsfx08BE 2238 +#define SFXmag_b_rise_00 2239 +#define SFXsfx08C0 2240 +#define SFXsfx08C1 2241 +#define SFXsfx08C2 2242 +#define SFXsfx08C3 2243 +#define SFXsfx08C4 2244 +#define SFXsfx08C5 2245 +#define SFXsfx08C6 2246 +#define SFXsfx08C7 2247 +#define SFXsfx08C8 2248 +#define SFXsfx08C9 2249 +#define SFXsfx08CA 2250 +#define SFXsfx08CB 2251 +#define SFXsfx08CC 2252 +#define SFXlav_x_gateup_lp_00 2253 +#define SFXsfx08CE 2254 +#define SFXlav_x_refrig_00 2255 +#define SFXlav_x_gatestop_00 2256 +#define SFXsfx08D1 2257 +#define SFXsfx08D2 2258 +#define SFXsfx08D3 2259 +#define SFXsfx08D4 2260 +#define SFXsfx08D5 2261 +#define SFXsfx08D6 2262 +#define SFXlav_landlava_02 2263 +#define SFXsfx08D8 2264 +#define SFXsfx08D9 2265 +#define SFXsfx08DA 2266 +#define SFXsfx08DB 2267 +#define SFXsfx08DC 2268 +#define SFXsfx08DD 2269 +#define SFXsfx08DE 2270 +#define SFXsfx08DF 2271 +#define SFXsfx08E0 2272 +#define SFXsfx08E1 2273 +#define SFXsfx08E2 2274 +#define SFXsfx08E3 2275 +#define SFXsfx08E4 2276 +#define SFXsfx08E5 2277 +#define SFXsfx08E6 2278 +#define SFXsfx08E7 2279 +#define SFXsfx08E8 2280 +#define SFXsfx08E9 2281 +#define SFXsfx08EA 2282 +#define SFXsfx08EB 2283 diff --git a/Runtime/Audio/SFX/Magdolite.h b/Runtime/Audio/SFX/Magdolite.h new file mode 100644 index 000000000..e038dac11 --- /dev/null +++ b/Runtime/Audio/SFX/Magdolite.h @@ -0,0 +1,39 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Magdolite + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPMagdolite 19 + +#define SFXmag_b_alert_00 518 +#define SFXmag_b_idle_00 519 +#define SFXsfx0208 520 +#define SFXmag_r_pain_00 521 +#define SFXmag_a_bite_00 522 +#define SFXmag_r_death_00 523 +#define SFXmag_a_breath_00 524 +#define SFXmag_a_flame_lp_00 525 +#define SFXmag_r_yelp_00 526 +#define SFXsfx020F 527 +#define SFXsfx0210 528 +#define SFXsfx0211 529 +#define SFXsfx0212 530 +#define SFXsfx0213 531 +#define SFXsfx0214 532 +#define SFXsfx0215 533 +#define SFXsfx0216 534 +#define SFXsfx0217 535 +#define SFXsfx0218 536 +#define SFXsfx0219 537 +#define SFXsfx021A 538 +#define SFXsfx021B 539 +#define SFXsfx021C 540 +#define SFXsfx021D 541 +#define SFXsfx021E 542 +#define SFXsfx021F 543 +#define SFXsfx0220 544 +#define SFXsfx0221 545 +#define SFXsfx0222 546 +#define SFXsfx0223 547 diff --git a/Runtime/Audio/SFX/Metaree.h b/Runtime/Audio/SFX/Metaree.h new file mode 100644 index 000000000..96d6964a9 --- /dev/null +++ b/Runtime/Audio/SFX/Metaree.h @@ -0,0 +1,20 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Metaree + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPMetaree 20 + +#define SFXmtr_a_scream_00 548 +#define SFXsfx0225 549 +#define SFXmtr_b_spin_lp_06 550 +#define SFXmtr_b_spin_lp_07 551 +#define SFXsfx0228 552 +#define SFXsfx0229 553 +#define SFXsfx022A 554 +#define SFXsfx022B 555 +#define SFXsfx022C 556 +#define SFXsfx022D 557 +#define SFXsfx022E 558 diff --git a/Runtime/Audio/SFX/Metroid.h b/Runtime/Audio/SFX/Metroid.h new file mode 100644 index 000000000..0810b54f3 --- /dev/null +++ b/Runtime/Audio/SFX/Metroid.h @@ -0,0 +1,74 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Metroid + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPMetroid 21 + +#define SFXsfx022F 559 +#define SFXsfx0230 560 +#define SFXmtd_a_facehug_02 561 +#define SFXmtd_a_swoosh_00 562 +#define SFXmtd_a_swoosh_01 563 +#define SFXmtd_a_thunk_00 564 +#define SFXmtd_b_fadein_00 565 +#define SFXmtd_b_fadeout_00 566 +#define SFXmtd_b_float_lp_00 567 +#define SFXmtd_b_float_lp_01 568 +#define SFXmtd_b_idle_00 569 +#define SFXmtd_b_idle_01 570 +#define SFXsfx023B 571 +#define SFXsfx023C 572 +#define SFXsfx023D 573 +#define SFXsfx023E 574 +#define SFXsfx023F 575 +#define SFXmtd_b_squish_00 576 +#define SFXmtd_b_squish_01 577 +#define SFXsfx0242 578 +#define SFXmtd_b_voxangry_00 579 +#define SFXsfx0244 580 +#define SFXsfx0245 581 +#define SFXmtd_r_impact_00 582 +#define SFXsfx0247 583 +#define SFXsfx0248 584 +#define SFXmt2_a_facehug_02 585 +#define SFXsfx024A 586 +#define SFXsfx024B 587 +#define SFXsfx024C 588 +#define SFXsfx024D 589 +#define SFXmt2_b_float_lp_00 590 +#define SFXmt2_b_float_lp_01 591 +#define SFXsfx0250 592 +#define SFXsfx0251 593 +#define SFXsfx0252 594 +#define SFXmt2_b_idle_02 595 +#define SFXsfx0254 596 +#define SFXsfx0255 597 +#define SFXmt2_b_leech_lp_00 598 +#define SFXsfx0257 599 +#define SFXsfx0258 600 +#define SFXmt2_b_voxangry_00 601 +#define SFXmt2_b_voxangry_01 602 +#define SFXsfx025B 603 +#define SFXmt2_r_impact_00 604 +#define SFXmtd_b_grow_00 605 +#define SFXmtd_b_suck_lp_00 606 +#define SFXmtd_r_death_00 607 +#define SFXmt2_b_float_lp_02 608 +#define SFXsfx0261 609 +#define SFXmtd_b_voxcalm_00 610 +#define SFXsfx0263 611 +#define SFXsfx0264 612 +#define SFXsfx0265 613 +#define SFXsfx0266 614 +#define SFXsfx0267 615 +#define SFXsfx0268 616 +#define SFXsfx0269 617 +#define SFXsfx026A 618 +#define SFXsfx026B 619 +#define SFXsfx026C 620 +#define SFXsfx026D 621 +#define SFXsfx026E 622 +#define SFXsfx026F 623 diff --git a/Runtime/Audio/SFX/MetroidPrime.h b/Runtime/Audio/SFX/MetroidPrime.h new file mode 100644 index 000000000..8542b06d3 --- /dev/null +++ b/Runtime/Audio/SFX/MetroidPrime.h @@ -0,0 +1,90 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: MetroidPrime + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPMetroidPrime 58 + +#define SFXmtb_b_voxtaunt_00 2891 +#define SFXsfx0B4C 2892 +#define SFXmtb_a_claw_00 2893 +#define SFXmtb_a_swoosh 2894 +#define SFXmtb_b_voxattak_00 2895 +#define SFXmtb_b_walk_00 2896 +#define SFXmtb_b_walk_01 2897 +#define SFXmtb_b_walk_02 2898 +#define SFXmtb_b_voxidle_00 2899 +#define SFXsfx0B54 2900 +#define SFXmtb_r_painbig_00 2901 +#define SFXmtb_r_painsm_00 2902 +#define SFXmtb_b_voxattak_01 2903 +#define SFXmtb_a_icewave_lp_00 2904 +#define SFXsfx0B59 2905 +#define SFXsfx0B5A 2906 +#define SFXmtb_b_voxangry_00 2907 +#define SFXmtb_b_voxangry_01 2908 +#define SFXmtb_a_flame_lp_00 2909 +#define SFXmtb_a_mirv_00 2910 +#define SFXsfx0B5F 2911 +#define SFXsfx0B60 2912 +#define SFXmth_b_dash_00 2913 +#define SFXmth_c_painbig_00 2914 +#define SFXmth_b_voxcall_00 2915 +#define SFXmth_b_voxidle_00 2916 +#define SFXmth_b_voxidle_01 2917 +#define SFXmth_b_voxtaunt_00 2918 +#define SFXsfx0B67 2919 +#define SFXmtb_a_hitwall_00 2920 +#define SFXmth_c_painsm_00 2921 +#define SFXsfx0B6A 2922 +#define SFXsfx0B6B 2923 +#define SFXmtb_a_flameup_lp_00 2924 +#define SFXsfx0B6D 2925 +#define SFXsfx0B6E 2926 +#define SFXsfx0B6F 2927 +#define SFXsfx0B70 2928 +#define SFXsfx0B71 2929 +#define SFXmth_b_emerge_00 2930 +#define SFXsfx0B73 2931 +#define SFXmth_b_voxattak_01 2932 +#define SFXsfx0B75 2933 +#define SFXmth_b_float_lp_00 2934 +#define SFXsfx0B77 2935 +#define SFXmth_a_blast_lp_00 2936 +#define SFXsfx0B79 2937 +#define SFXsfx0B7A 2938 +#define SFXsfx0B7B 2939 +#define SFXmth_a_blasthit_00 2940 +#define SFXsfx0B7D 2941 +#define SFXsfx0B7E 2942 +#define SFXmtb_c_cinemove_00 2943 +#define SFXsfx0B80 2944 +#define SFXmtb_c_land_00 2945 +#define SFXmtb_c_wakeup_00 2946 +#define SFXsfx0B83 2947 +#define SFXsfx0B84 2948 +#define SFXsfx0B85 2949 +#define SFXsfx0B86 2950 +#define SFXsfx0B87 2951 +#define SFXmtb_a_tractor_lp_00 2952 +#define SFXmth_a_swing_00 2953 +#define SFXsfx0B8A 2954 +#define SFXsfx0B8B 2955 +#define SFXsfx0B8C 2956 +#define SFXsfx0B8D 2957 +#define SFXsfx0B8E 2958 +#define SFXmtb_b_land_00 2959 +#define SFXmth_c_blur_00 2960 +#define SFXsfx0B91 2961 +#define SFXsfx0B92 2962 +#define SFXsfx0B93 2963 +#define SFXsfx0B94 2964 +#define SFXsfx0B95 2965 +#define SFXsfx0B96 2966 +#define SFXmtb_a_nrgchg_00 2967 +#define SFXsfx0B98 2968 +#define SFXmtb_a_nrgfire_lp_00 2969 +#define SFXsfx0B9A 2970 +#define SFXsfx0B9B 2971 diff --git a/Runtime/Audio/SFX/MinesWorld.h b/Runtime/Audio/SFX/MinesWorld.h new file mode 100644 index 000000000..d10721cc0 --- /dev/null +++ b/Runtime/Audio/SFX/MinesWorld.h @@ -0,0 +1,90 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: MinesWorld + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPMinesWorld 48 + +#define SFXsfx08EC 2284 +#define SFXsfx08ED 2285 +#define SFXsfx08EE 2286 +#define SFXsfx08EF 2287 +#define SFXsfx08F0 2288 +#define SFXsfx08F1 2289 +#define SFXmin_x_cranestop_00 2290 +#define SFXsfx08F3 2291 +#define SFXmin_x_piston_00 2292 +#define SFXsfx08F5 2293 +#define SFXsfx08F6 2294 +#define SFXsfx08F7 2295 +#define SFXsfx08F8 2296 +#define SFXmin_x_crane_lp_00 2297 +#define SFXsfx08FA 2298 +#define SFXsfx08FB 2299 +#define SFXsfx08FC 2300 +#define SFXsfx08FD 2301 +#define SFXsfx08FE 2302 +#define SFXsfx08FF 2303 +#define SFXsfx0900 2304 +#define SFXsfx0901 2305 +#define SFXsfx0902 2306 +#define SFXopr_c_land_00 2307 +#define SFXsfx0904 2308 +#define SFXsfx0905 2309 +#define SFXsfx0906 2310 +#define SFXsfx0907 2311 +#define SFXsfx0908 2312 +#define SFXmin_x_gears_lp_01 2313 +#define SFXsfx090A 2314 +#define SFXsfx090B 2315 +#define SFXsfx090C 2316 +#define SFXsfx090D 2317 +#define SFXsfx090E 2318 +#define SFXsfx090F 2319 +#define SFXsfx0910 2320 +#define SFXsfx0911 2321 +#define SFXsfx0912 2322 +#define SFXsfx0913 2323 +#define SFXsfx0914 2324 +#define SFXsfx0915 2325 +#define SFXsfx0916 2326 +#define SFXmin_x_turbine_lp_00 2327 +#define SFXsfx0918 2328 +#define SFXsfx0919 2329 +#define SFXsfx091A 2330 +#define SFXsfx091B 2331 +#define SFXsfx091C 2332 +#define SFXsfx091D 2333 +#define SFXsfx091E 2334 +#define SFXsfx091F 2335 +#define SFXsfx0920 2336 +#define SFXsfx0921 2337 +#define SFXsfx0922 2338 +#define SFXsfx0923 2339 +#define SFXsfx0924 2340 +#define SFXsfx0925 2341 +#define SFXsfx0926 2342 +#define SFXsfx0927 2343 +#define SFXsfx0928 2344 +#define SFXsfx0929 2345 +#define SFXsfx092A 2346 +#define SFXsfx092B 2347 +#define SFXsfx092C 2348 +#define SFXsfx092D 2349 +#define SFXsfx092E 2350 +#define SFXsfx092F 2351 +#define SFXsfx0930 2352 +#define SFXsfx0931 2353 +#define SFXsfx0932 2354 +#define SFXsfx0933 2355 +#define SFXsfx0934 2356 +#define SFXsfx0935 2357 +#define SFXsfx0936 2358 +#define SFXsfx0937 2359 +#define SFXsfx0938 2360 +#define SFXsfx0939 2361 +#define SFXsfx093A 2362 +#define SFXsfx093B 2363 +#define SFXsfx093C 2364 diff --git a/Runtime/Audio/SFX/Misc.h b/Runtime/Audio/SFX/Misc.h new file mode 100644 index 000000000..eb07c5fa8 --- /dev/null +++ b/Runtime/Audio/SFX/Misc.h @@ -0,0 +1,256 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Misc + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPMisc 39 + +#define SFXdor_x_close_00 1128 +#define SFXdor_x_open_00 1129 +#define SFXsfx046A 1130 +#define SFXpik_x_idle_00 1131 +#define SFXsfx046C 1132 +#define SFXamb_x_rumble_lp_00 1133 +#define SFXsfx046E 1134 +#define SFXpik_x_morphamb_lp_00 1135 +#define SFXpik_x_powerup_00 1136 +#define SFXsfx0471 1137 +#define SFXsfx0472 1138 +#define SFXsfx0473 1139 +#define SFXsfx0474 1140 +#define SFXamb_x_splash_02 1141 +#define SFXsfx0476 1142 +#define SFXsfx0477 1143 +#define SFXsfx0478 1144 +#define SFXsfx0479 1145 +#define SFXsfx047A 1146 +#define SFXpik_x_elevamb_lp_00 1147 +#define SFXsfx047C 1148 +#define SFXeff_x_largeburndeath_lp_00 1149 +#define SFXeff_x_smallburndeath_lp_00 1150 +#define SFXeff_x_fire_lp_00 1151 +#define SFXsfx0480 1152 +#define SFXsfx0481 1153 +#define SFXci2_x_eletric_00 1154 +#define SFXci3_x_electric_lp_00 1155 +#define SFXmac_x_fire_lp_00 1156 +#define SFXsfx0485 1157 +#define SFXci4_x_electric_lp_00 1158 +#define SFXsfx0487 1159 +#define SFXsfx0488 1160 +#define SFXsfx0489 1161 +#define SFXsfx048A 1162 +#define SFXsfx048B 1163 +#define SFXdrn_b_smoke_lp_00 1164 +#define SFXga2_r_explode_00 1165 +#define SFXsfx048E 1166 +#define SFXsfx048F 1167 +#define SFXsfx0490 1168 +#define SFXsfx0491 1169 +#define SFXmag_r_explode_00 1170 +#define SFXsfx0493 1171 +#define SFXsfx0494 1172 +#define SFXsfx0495 1173 +#define SFXsfx0496 1174 +#define SFXsfx0497 1175 +#define SFXeff_x_icebrk_00 1176 +#define SFXeff_x_icebrk_01 1177 +#define SFXsfx049A 1178 +#define SFXsfx049B 1179 +#define SFXsfx049C 1180 +#define SFXsfx049D 1181 +#define SFXsfx049E 1182 +#define SFXsfx049F 1183 +#define SFXsfx04A0 1184 +#define SFXsfx04A1 1185 +#define SFXmac_x_fireup_00 1186 +#define SFXsfx04A3 1187 +#define SFXsfx04A4 1188 +#define SFXsfx04A5 1189 +#define SFXsfx04A6 1190 +#define SFXsfx04A7 1191 +#define SFXsfx04A8 1192 +#define SFXsfx04A9 1193 +#define SFXsfx04AA 1194 +#define SFXsfx04AB 1195 +#define SFXsfx04AC 1196 +#define SFXeff_x_electro_lp_00 1197 +#define SFXeff_x_electro_lp_01 1198 +#define SFXsfx04AF 1199 +#define SFXsfx04B0 1200 +#define SFXsfx04B1 1201 +#define SFXsfx04B2 1202 +#define SFXsfx04B3 1203 +#define SFXsfx04B4 1204 +#define SFXsfx04B5 1205 +#define SFXsfx04B6 1206 +#define SFXsfx04B7 1207 +#define SFXsfx04B8 1208 +#define SFXsfx04B9 1209 +#define SFXsfx04BA 1210 +#define SFXsfx04BB 1211 +#define SFXsfx04BC 1212 +#define SFXsfx04BD 1213 +#define SFXsfx04BE 1214 +#define SFXsfx04BF 1215 +#define SFXsfx04C0 1216 +#define SFXsfx04C1 1217 +#define SFXsfx04C2 1218 +#define SFXocu_b_gas_lp_00 1219 +#define SFXsfx04C4 1220 +#define SFXsfx04C5 1221 +#define SFXsfx04C6 1222 +#define SFXtha_a_electric_00 1223 +#define SFXsfx04C8 1224 +#define SFXdrn_r_empelec_00 1225 +#define SFXeff_x_frozen_00 1226 +#define SFXeff_x_frozen_01 1227 +#define SFXsfx04CC 1228 +#define SFXsfx04CD 1229 +#define SFXsfx04CE 1230 +#define SFXsfx04CF 1231 +#define SFXsfx04D0 1232 +#define SFXsfx04D1 1233 +#define SFXepr_b_elec_lp_00 1234 +#define SFXsfx04D3 1235 +#define SFXsfx04D4 1236 +#define SFXsfx04D5 1237 +#define SFXsfx04D6 1238 +#define SFXsfx04D7 1239 +#define SFXamb_x_gatestop_00 1240 +#define SFXsfx04D9 1241 +#define SFXsfx04DA 1242 +#define SFXsfx04DB 1243 +#define SFXsfx04DC 1244 +#define SFXsfx04DD 1245 +#define SFXsfx04DE 1246 +#define SFXsfx04DF 1247 +#define SFXsfx04E0 1248 +#define SFXsfx04E1 1249 +#define SFXsfx04E2 1250 +#define SFXsfx04E3 1251 +#define SFXsfx04E4 1252 +#define SFXsfx04E5 1253 +#define SFXsfx04E6 1254 +#define SFXsfx04E7 1255 +#define SFXsfx04E8 1256 +#define SFXsfx04E9 1257 +#define SFXsfx04EA 1258 +#define SFXsfx04EB 1259 +#define SFXsfx04EC 1260 +#define SFXsfx04ED 1261 +#define SFXsfx04EE 1262 +#define SFXsfx04EF 1263 +#define SFXsfx04F0 1264 +#define SFXsfx04F1 1265 +#define SFXsfx04F2 1266 +#define SFXsfx04F3 1267 +#define SFXsfx04F4 1268 +#define SFXamb_x_gateup_00 1269 +#define SFXsfx04F6 1270 +#define SFXsfx04F7 1271 +#define SFXsfx04F8 1272 +#define SFXsfx04F9 1273 +#define SFXsfx04FA 1274 +#define SFXrid_r_explode_00 1275 +#define SFXsfx04FC 1276 +#define SFXsfx04FD 1277 +#define SFXsfx04FE 1278 +#define SFXsfx04FF 1279 +#define SFXsfx0500 1280 +#define SFXsfx0501 1281 +#define SFXsfx0502 1282 +#define SFXsfx0503 1283 +#define SFXsfx0504 1284 +#define SFXsfx0505 1285 +#define SFXamb_x_steamsml_lp_00 1286 +#define SFXsfx0507 1287 +#define SFXsfx0508 1288 +#define SFXsfx0509 1289 +#define SFXamb_c_suitlose_lp_00 1290 +#define SFXsfx050B 1291 +#define SFXsfx050C 1292 +#define SFXsfx050D 1293 +#define SFXsfx050E 1294 +#define SFXsfx050F 1295 +#define SFXsfx0510 1296 +#define SFXsfx0511 1297 +#define SFXsfx0512 1298 +#define SFXsfx0513 1299 +#define SFXsfx0514 1300 +#define SFXsfx0515 1301 +#define SFXsfx0516 1302 +#define SFXsfx0517 1303 +#define SFXsfx0518 1304 +#define SFXsfx0519 1305 +#define SFXsfx051A 1306 +#define SFXsfx051B 1307 +#define SFXsfx051C 1308 +#define SFXsfx051D 1309 +#define SFXsfx051E 1310 +#define SFXsfx051F 1311 +#define SFXsfx0520 1312 +#define SFXsfx0521 1313 +#define SFXsfx0522 1314 +#define SFXsfx0523 1315 +#define SFXsfx0524 1316 +#define SFXsfx0525 1317 +#define SFXsfx0526 1318 +#define SFXsfx0527 1319 +#define SFXsfx0528 1320 +#define SFXsfx0529 1321 +#define SFXsfx052A 1322 +#define SFXsfx052B 1323 +#define SFXrid_c_elec_lp_00 1324 +#define SFXsfx052D 1325 +#define SFXsfx052E 1326 +#define SFXsfx052F 1327 +#define SFXsfx0530 1328 +#define SFXsfx0531 1329 +#define SFXsfx0532 1330 +#define SFXsfx0533 1331 +#define SFXsfx0534 1332 +#define SFXsfx0535 1333 +#define SFXsfx0536 1334 +#define SFXsfx0537 1335 +#define SFXsfx0538 1336 +#define SFXsfx0539 1337 +#define SFXsfx053A 1338 +#define SFXsfx053B 1339 +#define SFXsfx053C 1340 +#define SFXsfx053D 1341 +#define SFXsfx053E 1342 +#define SFXsfx053F 1343 +#define SFXsfx0540 1344 +#define SFXsfx0541 1345 +#define SFXsfx0542 1346 +#define SFXsfx0543 1347 +#define SFXsfx0544 1348 +#define SFXsfx0545 1349 +#define SFXsfx0546 1350 +#define SFXsfx0547 1351 +#define SFXsfx0548 1352 +#define SFXsfx0549 1353 +#define SFXsfx054A 1354 +#define SFXsfx054B 1355 +#define SFXsfx054C 1356 +#define SFXsfx054D 1357 +#define SFXsfx054E 1358 +#define SFXsfx054F 1359 +#define SFXsfx0550 1360 +#define SFXsfx0551 1361 +#define SFXsfx0552 1362 +#define SFXsfx0553 1363 +#define SFXsfx0554 1364 +#define SFXsfx0555 1365 +#define SFXsfx0556 1366 +#define SFXsfx0557 1367 +#define SFXsfx0558 1368 +#define SFXsfx0559 1369 +#define SFXsfx055A 1370 +#define SFXsfx055B 1371 +#define SFXsfx055C 1372 +#define SFXsfx055D 1373 +#define SFXsfx055E 1374 diff --git a/Runtime/Audio/SFX/MiscSamus.h b/Runtime/Audio/SFX/MiscSamus.h new file mode 100644 index 000000000..c40e3871b --- /dev/null +++ b/Runtime/Audio/SFX/MiscSamus.h @@ -0,0 +1,268 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: MiscSamus + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPMiscSamus 41 + +#define SFXsam_wlkstone_00 1465 +#define SFXsam_wlkstone_01 1466 +#define SFXsam_suit_damage 1467 +#define SFXsam_ball_jump 1468 +#define SFXsam_b_highland_00 1469 +#define SFXsam_b_jump_00 1470 +#define SFXsam_firstjump 1471 +#define SFXsam_landdirt_00 1472 +#define SFXsfx05C1 1473 +#define SFXsfx05C2 1474 +#define SFXsam_ballland_stone 1475 +#define SFXsam_ball_boost 1476 +#define SFXsam_ball_charge_lp 1477 +#define SFXsam_b_morphin_00 1478 +#define SFXsam_b_morphout_00 1479 +#define SFXsam_ballroll_dirt 1480 +#define SFXsfx05C9 1481 +#define SFXsfx05CA 1482 +#define SFXsfx05CB 1483 +#define SFXsam_wlkwater_00 1484 +#define SFXsam_wlkwater_01 1485 +#define SFXsam_damage_poison_lp 1486 +#define SFXsfx05CF 1487 +#define SFXsfx05D0 1488 +#define SFXsam_vox_damage 1489 +#define SFXsam_landmetl_00 1490 +#define SFXsam_ball_damage 1491 +#define SFXsam_b_movearm_00 1492 +#define SFXsam_wlkgrate_00 1493 +#define SFXsam_wlkgrate_01 1494 +#define SFXsam_wlkmetal_00 1495 +#define SFXsam_wlkmetal_01 1496 +#define SFXsam_wlkdirt_00 1497 +#define SFXsam_ballland_grate 1498 +#define SFXsam_wlkdirt_01 1499 +#define SFXsam_ballroll_grate 1500 +#define SFXsam_ballroll_metal 1501 +#define SFXsam_ballroll_stone 1502 +#define SFXsfx05DF 1503 +#define SFXsam_ballland_metal 1504 +#define SFXsam_b_movearm_01 1505 +#define SFXsfx05E2 1506 +#define SFXsam_landgrate_00 1507 +#define SFXsam_landstone_00 1508 +#define SFXsfx05E5 1509 +#define SFXsfx05E6 1510 +#define SFXsam_vox_damage15 1511 +#define SFXsam_vox_damage30 1512 +#define SFXsam_ball_damage15 1513 +#define SFXsam_ball_damage30 1514 +#define SFXsfx05EB 1515 +#define SFXsam_death 1516 +#define SFXsfx05ED 1517 +#define SFXsfx05EE 1518 +#define SFXsam_b_landmetl_01 1519 +#define SFXsfx05F0 1520 +#define SFXsfx05F1 1521 +#define SFXsfx05F2 1522 +#define SFXsam_spider_lp 1523 +#define SFXsfx05F4 1524 +#define SFXsam_ball_wallhit 1525 +#define SFXsam_grapple_fire 1526 +#define SFXsam_grapple_lp 1527 +#define SFXsam_grapple_swoosh 1528 +#define SFXsam_wlkwood_00 1529 +#define SFXsam_wlkwood_01 1530 +#define SFXsam_landwood_00 1531 +#define SFXsam_b_movefla_00 1532 +#define SFXsam_ballland_wood 1533 +#define SFXsam_ballroll_wood 1534 +#define SFXsfx05FF 1535 +#define SFXsfx0600 1536 +#define SFXsfx0601 1537 +#define SFXsfx0602 1538 +#define SFXsfx0603 1539 +#define SFXsfx0604 1540 +#define SFXsam_b_jumpcine_00 1541 +#define SFXsam_landphazon_00 1542 +#define SFXsfx0607 1543 +#define SFXsfx0608 1544 +#define SFXsam_ballland_phazon 1545 +#define SFXsfx060A 1546 +#define SFXsam_ballroll_phazon 1547 +#define SFXsam_b_voxland_00 1548 +#define SFXsfx060D 1549 +#define SFXsam_voxland_02 1550 +#define SFXsfx060F 1551 +#define SFXsfx0610 1552 +#define SFXsam_wlkphazon_00 1553 +#define SFXsam_wlkphazon_01 1554 +#define SFXpds_b_water_03 1555 +#define SFXsam_b_butpress_00 1556 +#define SFXsam_b_butpress_01 1557 +#define SFXsam_b_panlclos_00 1558 +#define SFXsam_b_panlopen_00 1559 +#define SFXsam_dash 1560 +#define SFXsam_b_move_00 1561 +#define SFXsam_b_move_01 1562 +#define SFXsam_b_voxjump_00 1563 +#define SFXsfx061C 1564 +#define SFXsfx061D 1565 +#define SFXsfx061E 1566 +#define SFXsam_b_wlkmetal_02 1567 +#define SFXsam_b_wlkmetal_03 1568 +#define SFXsam_landgrass_00 1569 +#define SFXsam_b_wlkgrass_00 1570 +#define SFXsam_b_wlkgrass_01 1571 +#define SFXsam_b_spin_lp_00 1572 +#define SFXsam_b_landorg_00 1573 +#define SFXsfx0626 1574 +#define SFXsam_ballland_org 1575 +#define SFXsam_ballroll_org 1576 +#define SFXsam_b_wlkorg_00 1577 +#define SFXsam_b_wlkorg_01 1578 +#define SFXsam_landmud_00 1579 +#define SFXsam_ballland_grass 1580 +#define SFXsam_ballland_mud 1581 +#define SFXsfx062E 1582 +#define SFXsam_ballroll_grass 1583 +#define SFXsam_ballroll_mud 1584 +#define SFXsam_wlkmud_00 1585 +#define SFXsam_wlkmud_01 1586 +#define SFXsam_b_landcine_01 1587 +#define SFXsfx0634 1588 +#define SFXsfx0635 1589 +#define SFXsfx0636 1590 +#define SFXsam_vox_exhausted 1591 +#define SFXsam_landsnow_00 1592 +#define SFXsam_b_landsnow_01 1593 +#define SFXsam_wlksnow_00 1594 +#define SFXsam_wlksnow_01 1595 +#define SFXsam_b_wlksnow_02 1596 +#define SFXsam_b_wlksnow_03 1597 +#define SFXsfx063E 1598 +#define SFXsfx063F 1599 +#define SFXsam_b_landcine_00 1600 +#define SFXgab_b_wlksnow_00 1601 +#define SFXgab_b_wlksnow_01 1602 +#define SFXsfx0643 1603 +#define SFXsam_r_hithelm_00 1604 +#define SFXsfx0645 1605 +#define SFXsfx0646 1606 +#define SFXsam_landgrass_02 1607 +#define SFXsam_landgrate_02 1608 +#define SFXsfx0649 1609 +#define SFXsfx064A 1610 +#define SFXsam_b_landmetl_02 1611 +#define SFXsam_landmud_02 1612 +#define SFXsam_landorg_02 1613 +#define SFXsam_landphazon_02 1614 +#define SFXsam_landdirt_02 1615 +#define SFXsam_landsnow_02 1616 +#define SFXsam_landstone_02 1617 +#define SFXsam_landwood_02 1618 +#define SFXsam_wlkice_00 1619 +#define SFXsam_wlkice_01 1620 +#define SFXsfx0655 1621 +#define SFXsfx0656 1622 +#define SFXsam_b_landgras_01 1623 +#define SFXsam_landice_00 1624 +#define SFXsfx0659 1625 +#define SFXsam_landice_02 1626 +#define SFXsam_ballland_ice 1627 +#define SFXsam_ballland_snow 1628 +#define SFXpar_b_wlksnow_00 1629 +#define SFXpar_b_wlksnow_01 1630 +#define SFXsfx065F 1631 +#define SFXsfx0660 1632 +#define SFXsam_vox_damage_poison 1633 +#define SFXsfx0662 1634 +#define SFXsfx0663 1635 +#define SFXsam_c_suithit_00 1636 +#define SFXsam_c_suithit_01 1637 +#define SFXsam_c_suithitv_00 1638 +#define SFXsam_c_suitmov1_00 1639 +#define SFXsam_r_phazhit_lp_00 1640 +#define SFXsam_c_suitfall_00 1641 +#define SFXsam_c_suitfall_01 1642 +#define SFXsam_c_suitmov2_00 1643 +#define SFXsam_c_suitmov2_01 1644 +#define SFXsfx066D 1645 +#define SFXsfx066E 1646 +#define SFXfpr_b_land_00 1647 +#define SFXfpr_b_land_01 1648 +#define SFXsfx0671 1649 +#define SFXspr_b_land_00 1650 +#define SFXspr_b_land_01 1651 +#define SFXsfx0674 1652 +#define SFXsam_vox_damage_phazon 1653 +#define SFXsfx0676 1654 +#define SFXsfx0677 1655 +#define SFXsam_vox_damage_heat 1656 +#define SFXsfx0679 1657 +#define SFXsfx067A 1658 +#define SFXsfx067B 1659 +#define SFXsam_b_wlkstone_02 1660 +#define SFXsam_b_wlkstone_03 1661 +#define SFXsam_b_wlkdirt_02 1662 +#define SFXsam_b_wlkdirt_03 1663 +#define SFXsam_b_move_02 1664 +#define SFXsam_b_move_03 1665 +#define SFXsfx0682 1666 +#define SFXsam_c_mpwlkorg_00 1667 +#define SFXsam_c_mpwlkorg_01 1668 +#define SFXci7_x_spin_lp_00 1669 +#define SFXsfx0686 1670 +#define SFXsam_c_butpress_00 1671 +#define SFXsam_c_butpress_01 1672 +#define SFXsam_c_intrmove_02 1673 +#define SFXsam_c_intrmove_03 1674 +#define SFXsam_c_intrspin_lp_00 1675 +#define SFXsam_c_iwlkmetal_02 1676 +#define SFXsam_c_iwlkmetal_03 1677 +#define SFXsam_c_movearm_00 1678 +#define SFXsam_c_movearm_01 1679 +#define SFXsam_c_moveend_00 1680 +#define SFXsam_c_moveend_01 1681 +#define SFXsam_c_spinend_lp_00 1682 +#define SFXsfx0693 1683 +#define SFXsam_landlavastone_00 1684 +#define SFXsfx0695 1685 +#define SFXsam_landlavastone_02 1686 +#define SFXsam_ballland_lava 1687 +#define SFXsam_ballroll_lavastone 1688 +#define SFXsam_wlklavastone_00 1689 +#define SFXsam_wlklavastone_01 1690 +#define SFXsfx069B 1691 +#define SFXsfx069C 1692 +#define SFXsfx069D 1693 +#define SFXsfx069E 1694 +#define SFXsfx069F 1695 +#define SFXsfx06A0 1696 +#define SFXsfx06A1 1697 +#define SFXsfx06A2 1698 +#define SFXsfx06A3 1699 +#define SFXsfx06A4 1700 +#define SFXsfx06A5 1701 +#define SFXsfx06A6 1702 +#define SFXsfx06A7 1703 +#define SFXsfx06A8 1704 +#define SFXsfx06A9 1705 +#define SFXsfx06AA 1706 +#define SFXsfx06AB 1707 +#define SFXsfx06AC 1708 +#define SFXsfx06AD 1709 +#define SFXsfx06AE 1710 +#define SFXsfx06AF 1711 +#define SFXsfx06B0 1712 +#define SFXsfx06B1 1713 +#define SFXsfx06B2 1714 +#define SFXsfx06B3 1715 +#define SFXsfx06B4 1716 +#define SFXsfx06B5 1717 +#define SFXsfx06B6 1718 +#define SFXsfx06B7 1719 +#define SFXsfx06B8 1720 +#define SFXsfx06B9 1721 +#define SFXsfx06BA 1722 +#define SFXsfx06BB 1723 diff --git a/Runtime/Audio/SFX/OmegaPirate.h b/Runtime/Audio/SFX/OmegaPirate.h new file mode 100644 index 000000000..e21222ce1 --- /dev/null +++ b/Runtime/Audio/SFX/OmegaPirate.h @@ -0,0 +1,69 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: OmegaPirate + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPOmegaPirate 57 + +#define SFXsfx0B0F 2831 +#define SFXsfx0B10 2832 +#define SFXopr_b_voxcall_00 2833 +#define SFXopr_b_voxcall_01 2834 +#define SFXopr_b_voxlaugh_00 2835 +#define SFXopr_r_moan_00 2836 +#define SFXsfx0B15 2837 +#define SFXsfx0B16 2838 +#define SFXopr_b_run_01 2839 +#define SFXsfx0B18 2840 +#define SFXopr_b_voxalert_00 2841 +#define SFXopr_b_voxalert_01 2842 +#define SFXopr_b_voxattak_00 2843 +#define SFXopr_b_voxattak_01 2844 +#define SFXopr_b_voxblok_00 2845 +#define SFXopr_b_voxidle_00 2846 +#define SFXopr_b_voxidle_01 2847 +#define SFXopr_b_voxpiss_00 2848 +#define SFXopr_b_voxtaunt_00 2849 +#define SFXopr_b_walklite_00 2850 +#define SFXopr_b_walklite_01 2851 +#define SFXopr_b_walk_00 2852 +#define SFXopr_b_walk_01 2853 +#define SFXopr_b_healnrg_lp_00 2854 +#define SFXsfx0B27 2855 +#define SFXsfx0B28 2856 +#define SFXsfx0B29 2857 +#define SFXopr_r_pain_00 2858 +#define SFXopr_r_pain_01 2859 +#define SFXsfx0B2C 2860 +#define SFXopr_b_invis_00 2861 +#define SFXopr_b_voxready_00 2862 +#define SFXsfx0B2F 2863 +#define SFXsfx0B30 2864 +#define SFXopr_r_pain_02 2865 +#define SFXsfx0B32 2866 +#define SFXopr_a_grenchrg_00 2867 +#define SFXsfx0B34 2868 +#define SFXopr_a_grenade_00 2869 +#define SFXsfx0B36 2870 +#define SFXsfx0B37 2871 +#define SFXsfx0B38 2872 +#define SFXsfx0B39 2873 +#define SFXsfx0B3A 2874 +#define SFXsfx0B3B 2875 +#define SFXsfx0B3C 2876 +#define SFXsfx0B3D 2877 +#define SFXopr_r_death_01 2878 +#define SFXsfx0B3F 2879 +#define SFXopr_c_samswoosh_00 2880 +#define SFXsfx0B41 2881 +#define SFXsfx0B42 2882 +#define SFXsfx0B43 2883 +#define SFXsfx0B44 2884 +#define SFXsfx0B45 2885 +#define SFXsfx0B46 2886 +#define SFXsfx0B47 2887 +#define SFXsfx0B48 2888 +#define SFXsfx0B49 2889 +#define SFXsfx0B4A 2890 diff --git a/Runtime/Audio/SFX/OverWorld.h b/Runtime/Audio/SFX/OverWorld.h new file mode 100644 index 000000000..f39633383 --- /dev/null +++ b/Runtime/Audio/SFX/OverWorld.h @@ -0,0 +1,81 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: OverWorld + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPOverWorld 51 + +#define SFXsfx09E0 2528 +#define SFXsfx09E1 2529 +#define SFXsfx09E2 2530 +#define SFXsfx09E3 2531 +#define SFXsfx09E4 2532 +#define SFXsfx09E5 2533 +#define SFXsfx09E6 2534 +#define SFXsfx09E7 2535 +#define SFXsfx09E8 2536 +#define SFXsfx09E9 2537 +#define SFXsfx09EA 2538 +#define SFXsfx09EB 2539 +#define SFXsfx09EC 2540 +#define SFXsfx09ED 2541 +#define SFXsfx09EE 2542 +#define SFXsfx09EF 2543 +#define SFXsfx09F0 2544 +#define SFXsfx09F1 2545 +#define SFXcrb_b_hiss_00 2546 +#define SFXcrb_b_idle_00 2547 +#define SFXsfx09F4 2548 +#define SFXsfx09F5 2549 +#define SFXsfx09F6 2550 +#define SFXsfx09F7 2551 +#define SFXsfx09F8 2552 +#define SFXove_x_spinbars_lp 2553 +#define SFXsfx09FA 2554 +#define SFXsfx09FB 2555 +#define SFXsfx09FC 2556 +#define SFXsfx09FD 2557 +#define SFXsfx09FE 2558 +#define SFXsfx09FF 2559 +#define SFXsfx0A00 2560 +#define SFXsfx0A01 2561 +#define SFXsfx0A02 2562 +#define SFXsfx0A03 2563 +#define SFXsfx0A04 2564 +#define SFXsfx0A05 2565 +#define SFXsfx0A06 2566 +#define SFXsfx0A07 2567 +#define SFXsfx0A08 2568 +#define SFXsfx0A09 2569 +#define SFXsfx0A0A 2570 +#define SFXsfx0A0B 2571 +#define SFXsfx0A0C 2572 +#define SFXsfx0A0D 2573 +#define SFXsfx0A0E 2574 +#define SFXsfx0A0F 2575 +#define SFXsfx0A10 2576 +#define SFXsfx0A11 2577 +#define SFXsfx0A12 2578 +#define SFXsfx0A13 2579 +#define SFXsfx0A14 2580 +#define SFXlbm_c_beam_lp_01 2581 +#define SFXsfx0A16 2582 +#define SFXsfx0A17 2583 +#define SFXsfx0A18 2584 +#define SFXsfx0A19 2585 +#define SFXsfx0A1A 2586 +#define SFXsfx0A1B 2587 +#define SFXsfx0A1C 2588 +#define SFXsfx0A1D 2589 +#define SFXsfx0A1E 2590 +#define SFXsfx0A1F 2591 +#define SFXsfx0A20 2592 +#define SFXsfx0A21 2593 +#define SFXsfx0A22 2594 +#define SFXsfx0A23 2595 +#define SFXsfx0A24 2596 +#define SFXsfx0A25 2597 +#define SFXsfx0A26 2598 +#define SFXsfx0A27 2599 diff --git a/Runtime/Audio/SFX/Parasite.h b/Runtime/Audio/SFX/Parasite.h new file mode 100644 index 000000000..5769165f0 --- /dev/null +++ b/Runtime/Audio/SFX/Parasite.h @@ -0,0 +1,33 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Parasite + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPParasite 22 + +#define SFXpar_a_voxangry_00 624 +#define SFXsfx0271 625 +#define SFXsfx0272 626 +#define SFXsfx0273 627 +#define SFXsfx0274 628 +#define SFXpar_b_idle_02 629 +#define SFXpar_b_munch_00 630 +#define SFXsfx0277 631 +#define SFXpar_b_run_00 632 +#define SFXpar_b_run_01 633 +#define SFXsfx027A 634 +#define SFXpar_b_walk_00 635 +#define SFXpar_b_walk_01 636 +#define SFXsfx027D 637 +#define SFXpar_b_idlelone_02 638 +#define SFXpar_r_impact_00 639 +#define SFXsfx0280 640 +#define SFXsfx0281 641 +#define SFXsfx0282 642 +#define SFXsfx0283 643 +#define SFXsfx0284 644 +#define SFXsfx0285 645 +#define SFXsfx0286 646 +#define SFXsfx0287 647 diff --git a/Runtime/Audio/SFX/Phazon.h b/Runtime/Audio/SFX/Phazon.h new file mode 100644 index 000000000..3c85f44b5 --- /dev/null +++ b/Runtime/Audio/SFX/Phazon.h @@ -0,0 +1,16 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Phazon + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPPhazon 66 + +#define SFXphz_damage_lp 3114 +#define SFXsfx0C2B 3115 +#define SFXsfx0C2C 3116 +#define SFXsfx0C2D 3117 +#define SFXsfx0C2E 3118 +#define SFXsfx0C2F 3119 +#define SFXsfx0C30 3120 diff --git a/Runtime/Audio/SFX/PhazonGun.h b/Runtime/Audio/SFX/PhazonGun.h new file mode 100644 index 000000000..a916967dd --- /dev/null +++ b/Runtime/Audio/SFX/PhazonGun.h @@ -0,0 +1,11 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: PhazonGun + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPPhazonGun 68 + +#define SFXphg_charge_lp 3141 +#define SFXsfx0C46 3142 diff --git a/Runtime/Audio/SFX/PuddleSpore.h b/Runtime/Audio/SFX/PuddleSpore.h new file mode 100644 index 000000000..e949065fd --- /dev/null +++ b/Runtime/Audio/SFX/PuddleSpore.h @@ -0,0 +1,36 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: PuddleSpore + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPPuddleSpore 23 + +#define SFXsfx0288 648 +#define SFXpds_a_voxactive_00 649 +#define SFXpds_b_bubbles_00 650 +#define SFXpds_b_open_00 651 +#define SFXpds_b_slam_00 652 +#define SFXpds_b_voxopen_lp_00 653 +#define SFXpds_b_voxslam_00 654 +#define SFXpds_b_water_00 655 +#define SFXpds_b_water_01 656 +#define SFXpds_lava_damage_lp 657 +#define SFXsfx0292 658 +#define SFXpds_r_voxpain_02 659 +#define SFXsfx0294 660 +#define SFXsfx0295 661 +#define SFXsfx0296 662 +#define SFXsfx0297 663 +#define SFXsfx0298 664 +#define SFXsfx0299 665 +#define SFXsfx029A 666 +#define SFXsfx029B 667 +#define SFXsfx029C 668 +#define SFXsfx029D 669 +#define SFXsfx029E 670 +#define SFXsfx029F 671 +#define SFXsfx02A0 672 +#define SFXsfx02A1 673 +#define SFXsfx02A2 674 diff --git a/Runtime/Audio/SFX/PuddleToad.h b/Runtime/Audio/SFX/PuddleToad.h new file mode 100644 index 000000000..e18b320db --- /dev/null +++ b/Runtime/Audio/SFX/PuddleToad.h @@ -0,0 +1,38 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: PuddleToad + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPPuddleToad 24 + +#define SFXpud_a_suckin_00 675 +#define SFXpud_a_spitout_00 676 +#define SFXsfx02A5 677 +#define SFXpud_b_close_00 678 +#define SFXpud_b_splat_00 679 +#define SFXsfx02A8 680 +#define SFXsfx02A9 681 +#define SFXsfx02AA 682 +#define SFXpud_b_voxclose_00 683 +#define SFXpud_a_suckin_lp_01 684 +#define SFXsfx02AD 685 +#define SFXsfx02AE 686 +#define SFXpud_b_growl_00 687 +#define SFXpud_b_squish_lp_00 688 +#define SFXsfx02B1 689 +#define SFXsfx02B2 690 +#define SFXsfx02B3 691 +#define SFXsfx02B4 692 +#define SFXsfx02B5 693 +#define SFXsfx02B6 694 +#define SFXsfx02B7 695 +#define SFXsfx02B8 696 +#define SFXsfx02B9 697 +#define SFXsfx02BA 698 +#define SFXsfx02BB 699 +#define SFXsfx02BC 700 +#define SFXsfx02BD 701 +#define SFXsfx02BE 702 +#define SFXsfx02BF 703 diff --git a/Runtime/Audio/SFX/Puffer.h b/Runtime/Audio/SFX/Puffer.h new file mode 100644 index 000000000..b34e47e21 --- /dev/null +++ b/Runtime/Audio/SFX/Puffer.h @@ -0,0 +1,16 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Puffer + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPPuffer 25 + +#define SFXpuf_b_fly_lp_00 704 +#define SFXsfx02C1 705 +#define SFXsfx02C2 706 +#define SFXsfx02C3 707 +#define SFXsfx02C4 708 +#define SFXsfx02C5 709 +#define SFXsfx02C6 710 diff --git a/Runtime/Audio/SFX/ReactorDoor.h b/Runtime/Audio/SFX/ReactorDoor.h new file mode 100644 index 000000000..edc49bd02 --- /dev/null +++ b/Runtime/Audio/SFX/ReactorDoor.h @@ -0,0 +1,22 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: ReactorDoor + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPReactorDoor 49 + +#define SFXdor_x_close_01 2365 +#define SFXdor_x_open_01 2366 +#define SFXsfx093F 2367 +#define SFXint_x_reacdoor_01 2368 +#define SFXint_x_reacdoor_02 2369 +#define SFXint_x_reacdoor_03 2370 +#define SFXint_x_reacdoor_04 2371 +#define SFXint_x_reacdoor_lp_00 2372 +#define SFXsfx0945 2373 +#define SFXsfx0946 2374 +#define SFXsfx0947 2375 +#define SFXsfx0948 2376 +#define SFXsfx0949 2377 diff --git a/Runtime/Audio/SFX/Ridley.h b/Runtime/Audio/SFX/Ridley.h new file mode 100644 index 000000000..f51f875e5 --- /dev/null +++ b/Runtime/Audio/SFX/Ridley.h @@ -0,0 +1,69 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Ridley + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPRidley 56 + +#define SFXrid_a_flamerake_00 2771 +#define SFXrid_a_flame_lp_00 2772 +#define SFXsfx0AD5 2773 +#define SFXrid_b_flap_00 2774 +#define SFXrid_b_land_00 2775 +#define SFXrid_b_passby_00 2776 +#define SFXrid_b_popup_00 2777 +#define SFXrid_b_voxangry_00 2778 +#define SFXrid_b_voxangry_01 2779 +#define SFXrid_b_voxattack_00 2780 +#define SFXrid_b_voxattack_01 2781 +#define SFXrid_b_voxidle_00 2782 +#define SFXsfx0ADF 2783 +#define SFXrid_b_voxtaunt_00 2784 +#define SFXrid_b_voxtaunt_01 2785 +#define SFXrid_b_walk_00 2786 +#define SFXrid_b_walk_01 2787 +#define SFXsfx0AE4 2788 +#define SFXrid_b_walksm_00 2789 +#define SFXrid_b_walksm_01 2790 +#define SFXrid_r_chestexp_00 2791 +#define SFXrid_r_death_00 2792 +#define SFXrid_r_painbig_00 2793 +#define SFXrid_r_pain_00 2794 +#define SFXsfx0AEB 2795 +#define SFXrid_a_chestglo_00 2796 +#define SFXrid_a_claw_00 2797 +#define SFXsfx0AEE 2798 +#define SFXrid_a_mirv_00 2799 +#define SFXsfx0AF0 2800 +#define SFXrid_a_tail_00 2801 +#define SFXsfx0AF2 2802 +#define SFXsfx0AF3 2803 +#define SFXsfx0AF4 2804 +#define SFXrid_r_pain_lp_00 2805 +#define SFXsfx0AF6 2806 +#define SFXsfx0AF7 2807 +#define SFXsfx0AF8 2808 +#define SFXrid_c_smallexp_00 2809 +#define SFXrid_c_painbig_00 2810 +#define SFXsfx0AFB 2811 +#define SFXsfx0AFC 2812 +#define SFXsfx0AFD 2813 +#define SFXsfx0AFE 2814 +#define SFXsfx0AFF 2815 +#define SFXsfx0B00 2816 +#define SFXsfx0B01 2817 +#define SFXsfx0B02 2818 +#define SFXsfx0B03 2819 +#define SFXsfx0B04 2820 +#define SFXsfx0B05 2821 +#define SFXsfx0B06 2822 +#define SFXsfx0B07 2823 +#define SFXsfx0B08 2824 +#define SFXsfx0B09 2825 +#define SFXsfx0B0A 2826 +#define SFXsfx0B0B 2827 +#define SFXsfx0B0C 2828 +#define SFXsfx0B0D 2829 +#define SFXsfx0B0E 2830 diff --git a/Runtime/Audio/SFX/Ripper.h b/Runtime/Audio/SFX/Ripper.h new file mode 100644 index 000000000..7bc667f86 --- /dev/null +++ b/Runtime/Audio/SFX/Ripper.h @@ -0,0 +1,19 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Ripper + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPRipper 26 + +#define SFXrip_b_float_lp_00 711 +#define SFXrip_b_scream_00 712 +#define SFXsfx02C9 713 +#define SFXsfx02CA 714 +#define SFXrip_r_impact_00 715 +#define SFXsfx02CC 716 +#define SFXsfx02CD 717 +#define SFXsfx02CE 718 +#define SFXsfx02CF 719 +#define SFXsfx02D0 720 diff --git a/Runtime/Audio/SFX/RuinsWorld.h b/Runtime/Audio/SFX/RuinsWorld.h new file mode 100644 index 000000000..9240cf6bc --- /dev/null +++ b/Runtime/Audio/SFX/RuinsWorld.h @@ -0,0 +1,159 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: RuinsWorld + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPRuinsWorld 50 + +#define SFXsfx094A 2378 +#define SFXsfx094B 2379 +#define SFXsfx094C 2380 +#define SFXsfx094D 2381 +#define SFXeye_b_blink_00 2382 +#define SFXeye_b_impact_00 2383 +#define SFXsfx0950 2384 +#define SFXsfx0951 2385 +#define SFXsfx0952 2386 +#define SFXsfx0953 2387 +#define SFXsfx0954 2388 +#define SFXsfx0955 2389 +#define SFXsfx0956 2390 +#define SFXsfx0957 2391 +#define SFXsfx0958 2392 +#define SFXsfx0959 2393 +#define SFXsfx095A 2394 +#define SFXrui_x_leaves_00 2395 +#define SFXsfx095C 2396 +#define SFXsfx095D 2397 +#define SFXsfx095E 2398 +#define SFXsfx095F 2399 +#define SFXsfx0960 2400 +#define SFXmac_x_stop_00 2401 +#define SFXsfx0962 2402 +#define SFXsfx0963 2403 +#define SFXsfx0964 2404 +#define SFXsfx0965 2405 +#define SFXsfx0966 2406 +#define SFXsfx0967 2407 +#define SFXsfx0968 2408 +#define SFXsfx0969 2409 +#define SFXsfx096A 2410 +#define SFXsfx096B 2411 +#define SFXsfx096C 2412 +#define SFXsfx096D 2413 +#define SFXsfx096E 2414 +#define SFXsfx096F 2415 +#define SFXenc_x_genmove_lp_00 2416 +#define SFXsfx0971 2417 +#define SFXsfx0972 2418 +#define SFXsfx0973 2419 +#define SFXsfx0974 2420 +#define SFXhiv_x_fall_lp_00 2421 +#define SFXsfx0976 2422 +#define SFXsfx0977 2423 +#define SFXhiv_x_open_00 2424 +#define SFXsfx0979 2425 +#define SFXhiv_x_rotate_00 2426 +#define SFXhiv_x_stop_00 2427 +#define SFXsfx097C 2428 +#define SFXsfx097D 2429 +#define SFXrui_x_mapmove_lp_01 2430 +#define SFXsfx097F 2431 +#define SFXsfx0980 2432 +#define SFXsfx0981 2433 +#define SFXsfx0982 2434 +#define SFXsfx0983 2435 +#define SFXhiv_x_closered_lp_00 2436 +#define SFXhiv_x_openred_lp_00 2437 +#define SFXsfx0986 2438 +#define SFXsfx0987 2439 +#define SFXchz_b_balldrop_00 2440 +#define SFXchz_b_balldrop_01 2441 +#define SFXchz_b_release_00 2442 +#define SFXchz_x_down_lp_00 2443 +#define SFXsfx098C 2444 +#define SFXsfx098D 2445 +#define SFXsfx098E 2446 +#define SFXsfx098F 2447 +#define SFXsfx0990 2448 +#define SFXsfx0991 2449 +#define SFXsfx0992 2450 +#define SFXsfx0993 2451 +#define SFXsfx0994 2452 +#define SFXsfx0995 2453 +#define SFXsfx0996 2454 +#define SFXsfx0997 2455 +#define SFXsfx0998 2456 +#define SFXrui_x_mirstop_00 2457 +#define SFXsfx099A 2458 +#define SFXrui_x_slotstop_00 2459 +#define SFXfla_b_bulbopen_00 2460 +#define SFXsfx099D 2461 +#define SFXsfx099E 2462 +#define SFXsfx099F 2463 +#define SFXsfx09A0 2464 +#define SFXsfx09A1 2465 +#define SFXsfx09A2 2466 +#define SFXsfx09A3 2467 +#define SFXsfx09A4 2468 +#define SFXrui_x_flamarmr_00 2469 +#define SFXrui_x_flamarmr_01 2470 +#define SFXrui_x_flamarm_00 2471 +#define SFXrui_x_flamarm_01 2472 +#define SFXrui_x_flamarm_02 2473 +#define SFXrui_x_flamrise_00 2474 +#define SFXrui_x_flamrise_lp_00 2475 +#define SFXrui_x_flamhead_00 2476 +#define SFXrui_x_flamhead_lp_00 2477 +#define SFXrui_x_flamhead_lp_01 2478 +#define SFXsfx09AF 2479 +#define SFXsfx09B0 2480 +#define SFXsfx09B1 2481 +#define SFXsfx09B2 2482 +#define SFXsfx09B3 2483 +#define SFXsfx09B4 2484 +#define SFXsfx09B5 2485 +#define SFXsfx09B6 2486 +#define SFXsfx09B7 2487 +#define SFXsfx09B8 2488 +#define SFXrui_x_mapmove_lp_00 2489 +#define SFXsfx09BA 2490 +#define SFXrui_x_maparm_00 2491 +#define SFXrui_x_mapcover_00 2492 +#define SFXsfx09BD 2493 +#define SFXsfx09BE 2494 +#define SFXsfx09BF 2495 +#define SFXsfx09C0 2496 +#define SFXsfx09C1 2497 +#define SFXsfx09C2 2498 +#define SFXsfx09C3 2499 +#define SFXsfx09C4 2500 +#define SFXmac_x_changed_00 2501 +#define SFXsfx09C6 2502 +#define SFXrui_x_mapstop_00 2503 +#define SFXsfx09C8 2504 +#define SFXrui_x_gatedown_lp_00 2505 +#define SFXsfx09CA 2506 +#define SFXrui_x_gatestop_00 2507 +#define SFXrui_x_gateturn_lp_00 2508 +#define SFXsfx09CD 2509 +#define SFXrui_x_halftrk_00 2510 +#define SFXrui_x_halftrk_lp_00 2511 +#define SFXsfx09D0 2512 +#define SFXsfx09D1 2513 +#define SFXsfx09D2 2514 +#define SFXsfx09D3 2515 +#define SFXdob_x_moveup_lp_00 2516 +#define SFXsfx09D5 2517 +#define SFXsfx09D6 2518 +#define SFXsfx09D7 2519 +#define SFXsfx09D8 2520 +#define SFXsfx09D9 2521 +#define SFXsfx09DA 2522 +#define SFXsfx09DB 2523 +#define SFXsfx09DC 2524 +#define SFXsfx09DD 2525 +#define SFXsfx09DE 2526 +#define SFXsfx09DF 2527 diff --git a/Runtime/Audio/SFX/SFX.h b/Runtime/Audio/SFX/SFX.h new file mode 100644 index 000000000..4bf0e640b --- /dev/null +++ b/Runtime/Audio/SFX/SFX.h @@ -0,0 +1,77 @@ +#ifndef DNAMP1_SFX_H +#define DNAMP1_SFX_H + +#include "Atomic.h" +#include "BetaBeetle.h" +#include "Bird.h" +#include "BloodFlower.h" +#include "Burrower.h" +#include "ChozoGhost.h" +#include "ChubbWeed.h" +#include "CineBoots.h" +#include "CineGeneral.h" +#include "CineGun.h" +#include "CineMorphball.h" +#include "CineSuit.h" +#include "CineVisor.h" +#include "Crater.h" +#include "Crystallite.h" +#include "Drones.h" +#include "EliteSpacePirate.h" +#include "FireFlea.h" +#include "Flaaghra.h" +#include "FlickerBat.h" +#include "FlyingPirate.h" +#include "FrontEnd.h" +#include "GagantuanBeatle.h" +#include "Gnats.h" +#include "Gryzbee.h" +#include "IceCrack.h" +#include "IceWorld.h" +#include "InjuredPirates.h" +#include "IntroBoss.h" +#include "IntroWorld.h" +#include "JellyZap.h" +#include "LavaWorld.h" +#include "Magdolite.h" +#include "Metaree.h" +#include "MetroidPrime.h" +#include "Metroid.h" +#include "MinesWorld.h" +#include "MiscSamus.h" +#include "Misc.h" +#include "OmegaPirate.h" +#include "OverWorld.h" +#include "Parasite.h" +#include "PhazonGun.h" +#include "Phazon.h" +#include "PuddleSpore.h" +#include "PuddleToad.h" +#include "Puffer.h" +#include "ReactorDoor.h" +#include "Ridley.h" +#include "Ripper.h" +#include "RuinsWorld.h" +#include "SFX.h" +#include "SamusShip.h" +#include "Scarab.h" +#include "Seedling.h" +#include "SheeGoth.h" +#include "SnakeWeed.h" +#include "Sova.h" +#include "SpacePirate.h" +#include "SpankWeed.h" +#include "Thardus.h" +#include "TheEnd.h" +#include "Torobyte.h" +#include "Triclops.h" +#include "Turret.h" +#include "UI.h" +#include "WarWasp.h" +#include "Weapons.h" +#include "ZZZ.h" +#include "Zoomer.h" +#include "lumigek.h" +#include "test.h" + +#endif // DNAMP1_SFX_H diff --git a/Runtime/Audio/SFX/SamusShip.h b/Runtime/Audio/SFX/SamusShip.h new file mode 100644 index 000000000..a726becf4 --- /dev/null +++ b/Runtime/Audio/SFX/SamusShip.h @@ -0,0 +1,41 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: SamusShip + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPSamusShip 42 + +#define SFXsas_x_dooropen_00 1724 +#define SFXsas_x_dooropen_01 1725 +#define SFXsas_x_dooropen_02 1726 +#define SFXsas_x_dooropen_03 1727 +#define SFXsas_x_dooropen_04 1728 +#define SFXsas_x_dooropen_05 1729 +#define SFXsfx06C2 1730 +#define SFXsas_x_platrise_lp_01 1731 +#define SFXsas_x_thrusmov_00 1732 +#define SFXsfx06C5 1733 +#define SFXsas_x_thrusmov_02 1734 +#define SFXsas_x_thrusmov_03 1735 +#define SFXsas_x_hover_lp_00 1736 +#define SFXsas_x_thrusfir_lp_01 1737 +#define SFXsas_x_hover_lp_01 1738 +#define SFXsfx06CB 1739 +#define SFXsas_x_thrusfir_lp_04 1740 +#define SFXsfx06CD 1741 +#define SFXsfx06CE 1742 +#define SFXsfx06CF 1743 +#define SFXsfx06D0 1744 +#define SFXsfx06D1 1745 +#define SFXsfx06D2 1746 +#define SFXsfx06D3 1747 +#define SFXsfx06D4 1748 +#define SFXsfx06D5 1749 +#define SFXsfx06D6 1750 +#define SFXsfx06D7 1751 +#define SFXsfx06D8 1752 +#define SFXsfx06D9 1753 +#define SFXsfx06DA 1754 +#define SFXsfx06DB 1755 diff --git a/Runtime/Audio/SFX/Scarab.h b/Runtime/Audio/SFX/Scarab.h new file mode 100644 index 000000000..414bc5194 --- /dev/null +++ b/Runtime/Audio/SFX/Scarab.h @@ -0,0 +1,17 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Scarab + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPScarab 27 + +#define SFXsfx02D1 721 +#define SFXsfx02D2 722 +#define SFXsfx02D3 723 +#define SFXsfx02D4 724 +#define SFXsfx02D5 725 +#define SFXsfx02D6 726 +#define SFXsfx02D7 727 +#define SFXsfx02D8 728 diff --git a/Runtime/Audio/SFX/Seedling.h b/Runtime/Audio/SFX/Seedling.h new file mode 100644 index 000000000..6ce1a1f34 --- /dev/null +++ b/Runtime/Audio/SFX/Seedling.h @@ -0,0 +1,29 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Seedling + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPSeedling 28 + +#define SFXsed_a_spine_00 729 +#define SFXsed_b_idle_lp_00 730 +#define SFXsfx02DB 731 +#define SFXsfx02DC 732 +#define SFXsed_b_alert_00 733 +#define SFXsfx02DE 734 +#define SFXsfx02DF 735 +#define SFXsfx02E0 736 +#define SFXsfx02E1 737 +#define SFXsfx02E2 738 +#define SFXsfx02E3 739 +#define SFXsfx02E4 740 +#define SFXsfx02E5 741 +#define SFXsfx02E6 742 +#define SFXsfx02E7 743 +#define SFXsfx02E8 744 +#define SFXsfx02E9 745 +#define SFXsfx02EA 746 +#define SFXsfx02EB 747 +#define SFXsfx02EC 748 diff --git a/Runtime/Audio/SFX/SheeGoth.h b/Runtime/Audio/SFX/SheeGoth.h new file mode 100644 index 000000000..0445d9ed5 --- /dev/null +++ b/Runtime/Audio/SFX/SheeGoth.h @@ -0,0 +1,66 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: SheeGoth + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPSheeGoth 29 + +#define SFXshe_a_fireball_00 749 +#define SFXshe_b_shake_lp_00 750 +#define SFXsfx02EF 751 +#define SFXshe_a_flame_lp_00 752 +#define SFXshe_a_snap_00 753 +#define SFXshe_a_snap_01 754 +#define SFXshe_a_stomp_00 755 +#define SFXshe_a_stomp_01 756 +#define SFXshe_a_voxangry_00 757 +#define SFXshe_a_voxangry_01 758 +#define SFXshe_a_voxangry_03 759 +#define SFXshe_a_voxangry_04 760 +#define SFXsh2_a_voxangry_00 761 +#define SFXsfx02FA 762 +#define SFXsfx02FB 763 +#define SFXshe_b_idle_02 764 +#define SFXsh2_a_voxangry_01 765 +#define SFXshe_b_land_00 766 +#define SFXsh2_a_flame_lp_00 767 +#define SFXshe_b_roar_00 768 +#define SFXsh2_a_snap_00 769 +#define SFXsh2_a_voxangry_03 770 +#define SFXsh2_a_snap_01 771 +#define SFXshe_b_walk_00 772 +#define SFXshe_b_walk_01 773 +#define SFXshe_r_death_00 774 +#define SFXshe_r_death_01 775 +#define SFXshe_r_pain_00 776 +#define SFXsfx0309 777 +#define SFXsh2_a_voxangry_04 778 +#define SFXsfx030B 779 +#define SFXsfx030C 780 +#define SFXsh2_b_idle_02 781 +#define SFXsh2_b_land_00 782 +#define SFXsh2_b_roar_00 783 +#define SFXsh2_b_shake_lp_00 784 +#define SFXsh2_b_walk_00 785 +#define SFXsh2_b_walk_01 786 +#define SFXsh2_r_death_00 787 +#define SFXsh2_r_death_01 788 +#define SFXsh2_r_pain_00 789 +#define SFXsfx0316 790 +#define SFXsfx0317 791 +#define SFXsh2_b_run_00 792 +#define SFXsh2_b_run_01 793 +#define SFXsfx031A 794 +#define SFXsfx031B 795 +#define SFXsfx031C 796 +#define SFXsfx031D 797 +#define SFXsfx031E 798 +#define SFXsfx031F 799 +#define SFXsfx0320 800 +#define SFXsfx0321 801 +#define SFXsfx0322 802 +#define SFXsfx0323 803 +#define SFXsfx0324 804 +#define SFXsfx0325 805 diff --git a/Runtime/Audio/SFX/SnakeWeed.h b/Runtime/Audio/SFX/SnakeWeed.h new file mode 100644 index 000000000..091564e47 --- /dev/null +++ b/Runtime/Audio/SFX/SnakeWeed.h @@ -0,0 +1,15 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: SnakeWeed + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPSnakeWeed 30 + +#define SFXsfx0326 806 +#define SFXsnk_b_in_00 807 +#define SFXsnk_b_out_00 808 +#define SFXsfx0329 809 +#define SFXsfx032A 810 +#define SFXsfx032B 811 diff --git a/Runtime/Audio/SFX/Sova.h b/Runtime/Audio/SFX/Sova.h new file mode 100644 index 000000000..d293ff7f7 --- /dev/null +++ b/Runtime/Audio/SFX/Sova.h @@ -0,0 +1,28 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Sova + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPSova 31 + +#define SFXfpr_b_walk_00 812 +#define SFXfpr_b_walk_01 813 +#define SFXspr_a_gun_00 814 +#define SFXsfx032F 815 +#define SFXsfx0330 816 +#define SFXspr_b_walk_00 817 +#define SFXspr_b_walk_01 818 +#define SFXspr_b_walk_02 819 +#define SFXspr_b_walk_03 820 +#define SFXsfx0335 821 +#define SFXsfx0336 822 +#define SFXsfx0337 823 +#define SFXsfx0338 824 +#define SFXsfx0339 825 +#define SFXsfx033A 826 +#define SFXsfx033B 827 +#define SFXsfx033C 828 +#define SFXsfx033D 829 +#define SFXsfx033E 830 diff --git a/Runtime/Audio/SFX/SpacePirate.h b/Runtime/Audio/SFX/SpacePirate.h new file mode 100644 index 000000000..d63dc5f22 --- /dev/null +++ b/Runtime/Audio/SFX/SpacePirate.h @@ -0,0 +1,93 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: SpacePirate + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPSpacePirate 32 + +#define SFXsfx033F 831 +#define SFXepr_b_swordin_00 832 +#define SFXepr_b_swordout_00 833 +#define SFXopr_c_movement_00 834 +#define SFXsfx0343 835 +#define SFXsfx0344 836 +#define SFXsfx0345 837 +#define SFXsfx0346 838 +#define SFXsfx0347 839 +#define SFXspr_b_movement_00 840 +#define SFXspr_b_movement_01 841 +#define SFXsfx034A 842 +#define SFXsfx034B 843 +#define SFXsfx034C 844 +#define SFXsfx034D 845 +#define SFXspr_b_voxalert_01 846 +#define SFXsfx034F 847 +#define SFXsfx0350 848 +#define SFXsfx0351 849 +#define SFXsfx0352 850 +#define SFXsfx0353 851 +#define SFXsfx0354 852 +#define SFXsfx0355 853 +#define SFXsfx0356 854 +#define SFXspr_r_impact_02 855 +#define SFXopr_b_swordin_00 856 +#define SFXsfx0359 857 +#define SFXsfx035A 858 +#define SFXsfx035B 859 +#define SFXspr_b_idle_02 860 +#define SFXspr_b_intruder_00 861 +#define SFXsfx035E 862 +#define SFXsfx035F 863 +#define SFXsfx0360 864 +#define SFXsfx0361 865 +#define SFXopr_b_swordout_00 866 +#define SFXspr_r_himpact_00 867 +#define SFXsfx0364 868 +#define SFXspr_b_jump_00 869 +#define SFXsfx0366 870 +#define SFXsfx0367 871 +#define SFXsfx0368 872 +#define SFXspr_b_voxangry_02 873 +#define SFXsfx036A 874 +#define SFXsfx036B 875 +#define SFXsfx036C 876 +#define SFXsfx036D 877 +#define SFXsfx036E 878 +#define SFXsfx036F 879 +#define SFXsfx0370 880 +#define SFXsfx0371 881 +#define SFXsfx0372 882 +#define SFXsfx0373 883 +#define SFXepr_b_movement_00 884 +#define SFXepr_b_movement_01 885 +#define SFXsfx0376 886 +#define SFXsfx0377 887 +#define SFXsfx0378 888 +#define SFXsfx0379 889 +#define SFXsfx037A 890 +#define SFXsfx037B 891 +#define SFXepr_r_die_00 892 +#define SFXsfx037D 893 +#define SFXepr_r_pain_00 894 +#define SFXsfx037F 895 +#define SFXsfx0380 896 +#define SFXsfx0381 897 +#define SFXsfx0382 898 +#define SFXsfx0383 899 +#define SFXsfx0384 900 +#define SFXsfx0385 901 +#define SFXsfx0386 902 +#define SFXsfx0387 903 +#define SFXsfx0388 904 +#define SFXsfx0389 905 +#define SFXsfx038A 906 +#define SFXsfx038B 907 +#define SFXsfx038C 908 +#define SFXsfx038D 909 +#define SFXsfx038E 910 +#define SFXsfx038F 911 +#define SFXsfx0390 912 +#define SFXsfx0391 913 +#define SFXsfx0392 914 diff --git a/Runtime/Audio/SFX/SpankWeed.h b/Runtime/Audio/SFX/SpankWeed.h new file mode 100644 index 000000000..d48e60e36 --- /dev/null +++ b/Runtime/Audio/SFX/SpankWeed.h @@ -0,0 +1,54 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: SpankWeed + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPSpankWeed 33 + +#define SFXspw_a_spank_00 915 +#define SFXsfx0394 916 +#define SFXspw_b_out_00 917 +#define SFXspw_b_swish_02 918 +#define SFXspw_b_swoosh_00 919 +#define SFXsfx0398 920 +#define SFXspw_r_impact_00 921 +#define SFXsfx039A 922 +#define SFXfla_a_tentatak_00 923 +#define SFXsfx039C 924 +#define SFXsfx039D 925 +#define SFXsfx039E 926 +#define SFXsfx039F 927 +#define SFXsfx03A0 928 +#define SFXsfx03A1 929 +#define SFXsfx03A2 930 +#define SFXfla_b_tentmove_01 931 +#define SFXfla_b_tentslid_00 932 +#define SFXfla_b_tentslid_01 933 +#define SFXsfx03A6 934 +#define SFXsfx03A7 935 +#define SFXsfx03A8 936 +#define SFXsfx03A9 937 +#define SFXsfx03AA 938 +#define SFXsfx03AB 939 +#define SFXsfx03AC 940 +#define SFXsfx03AD 941 +#define SFXsfx03AE 942 +#define SFXsfx03AF 943 +#define SFXsfx03B0 944 +#define SFXsfx03B1 945 +#define SFXsfx03B2 946 +#define SFXsfx03B3 947 +#define SFXsfx03B4 948 +#define SFXsfx03B5 949 +#define SFXsfx03B6 950 +#define SFXsfx03B7 951 +#define SFXsfx03B8 952 +#define SFXsfx03B9 953 +#define SFXsfx03BA 954 +#define SFXsfx03BB 955 +#define SFXsfx03BC 956 +#define SFXsfx03BD 957 +#define SFXsfx03BE 958 +#define SFXsfx03BF 959 diff --git a/Runtime/Audio/SFX/Thardus.h b/Runtime/Audio/SFX/Thardus.h new file mode 100644 index 000000000..781b57ef6 --- /dev/null +++ b/Runtime/Audio/SFX/Thardus.h @@ -0,0 +1,77 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Thardus + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPThardus 55 + +#define SFXtha_b_voxangry_02 2703 +#define SFXtha_b_move_00 2704 +#define SFXsfx0A91 2705 +#define SFXtha_b_rocks_00 2706 +#define SFXtha_a_stoneup_lp_00 2707 +#define SFXtha_a_swoosh_00 2708 +#define SFXsfx0A95 2709 +#define SFXtha_a_voxattak_00 2710 +#define SFXtha_a_voxattak_01 2711 +#define SFXtha_b_henshin_lp_00 2712 +#define SFXtha_b_hitgrnd_00 2713 +#define SFXtha_b_hitgrnd_01 2714 +#define SFXtha_b_hitgrnd_02 2715 +#define SFXtha_b_charge_00 2716 +#define SFXtha_a_thunder_00 2717 +#define SFXtha_b_rocks_lp_00 2718 +#define SFXsfx0A9F 2719 +#define SFXtha_b_roll_lp_00 2720 +#define SFXsfx0AA1 2721 +#define SFXtha_b_voxangry_00 2722 +#define SFXtha_b_voxangry_01 2723 +#define SFXtha_b_walk_00 2724 +#define SFXtha_b_walk_01 2725 +#define SFXsfx0AA6 2726 +#define SFXtha_r_pain_00 2727 +#define SFXtha_b_boulder_00 2728 +#define SFXtha_b_boulder_01 2729 +#define SFXsfx0AAA 2730 +#define SFXtha_b_henshin_00 2731 +#define SFXtha_b_henshin_01 2732 +#define SFXsfx0AAD 2733 +#define SFXtha_a_icewave_lp_00 2734 +#define SFXtha_b_chant_00 2735 +#define SFXtha_b_enraged_00 2736 +#define SFXtha_b_charge_01 2737 +#define SFXtha_b_charge_02 2738 +#define SFXtha_b_walk_02 2739 +#define SFXtha_b_walk_03 2740 +#define SFXtha_a_thunder_01 2741 +#define SFXsfx0AB6 2742 +#define SFXsfx0AB7 2743 +#define SFXsfx0AB8 2744 +#define SFXtha_a_icestorm_lp_02 2745 +#define SFXsfx0ABA 2746 +#define SFXsfx0ABB 2747 +#define SFXsfx0ABC 2748 +#define SFXtha_b_idle_00 2749 +#define SFXsfx0ABE 2750 +#define SFXsfx0ABF 2751 +#define SFXsfx0AC0 2752 +#define SFXtha_b_charge_03 2753 +#define SFXtha_r_smpain_00 2754 +#define SFXsfx0AC3 2755 +#define SFXtha_r_pissed_00 2756 +#define SFXsfx0AC5 2757 +#define SFXsfx0AC6 2758 +#define SFXsfx0AC7 2759 +#define SFXsfx0AC8 2760 +#define SFXsfx0AC9 2761 +#define SFXsfx0ACA 2762 +#define SFXsfx0ACB 2763 +#define SFXsfx0ACC 2764 +#define SFXsfx0ACD 2765 +#define SFXsfx0ACE 2766 +#define SFXsfx0ACF 2767 +#define SFXsfx0AD0 2768 +#define SFXsfx0AD1 2769 +#define SFXsfx0AD2 2770 diff --git a/Runtime/Audio/SFX/TheEnd.h b/Runtime/Audio/SFX/TheEnd.h new file mode 100644 index 000000000..3df4c24ae --- /dev/null +++ b/Runtime/Audio/SFX/TheEnd.h @@ -0,0 +1,27 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: TheEnd + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPTheEnd 70 + +#define SFXsfx0C4D 3149 +#define SFXsh2_a_fireball_lp_00 3150 +#define SFXshe_a_fireball_lp_00 3151 +#define SFXend_c_shipthst_00 3152 +#define SFXsfx0C51 3153 +#define SFXsfx0C52 3154 +#define SFXsfx0C53 3155 +#define SFXsfx0C54 3156 +#define SFXsfx0C55 3157 +#define SFXsfx0C56 3158 +#define SFXsfx0C57 3159 +#define SFXsfx0C58 3160 +#define SFXsfx0C59 3161 +#define SFXsfx0C5A 3162 +#define SFXsfx0C5B 3163 +#define SFXsfx0C5C 3164 +#define SFXsfx0C5D 3165 +#define SFXsfx0C5E 3166 diff --git a/Runtime/Audio/SFX/Torobyte.h b/Runtime/Audio/SFX/Torobyte.h new file mode 100644 index 000000000..cea96f914 --- /dev/null +++ b/Runtime/Audio/SFX/Torobyte.h @@ -0,0 +1,28 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Torobyte + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPToroByte 35 + +#define SFXocu_b_idle_00 981 +#define SFXsfx03D6 982 +#define SFXocu_b_blink_00 983 +#define SFXsfx03D8 984 +#define SFXbat_r_voxdeath_00 985 +#define SFXsfx03DA 986 +#define SFXsfx03DB 987 +#define SFXsfx03DC 988 +#define SFXsfx03DD 989 +#define SFXsfx03DE 990 +#define SFXsfx03DF 991 +#define SFXsfx03E0 992 +#define SFXsfx03E1 993 +#define SFXsfx03E2 994 +#define SFXsfx03E3 995 +#define SFXsfx03E4 996 +#define SFXsfx03E5 997 +#define SFXsfx03E6 998 +#define SFXsfx03E7 999 diff --git a/Runtime/Audio/SFX/Triclops.h b/Runtime/Audio/SFX/Triclops.h new file mode 100644 index 000000000..c36824ccc --- /dev/null +++ b/Runtime/Audio/SFX/Triclops.h @@ -0,0 +1,30 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Triclops + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPTriclops 34 + +#define SFXtri_a_attack_00 960 +#define SFXtri_a_attract_00 961 +#define SFXtri_b_idle_00 962 +#define SFXsfx03C3 963 +#define SFXtri_b_walk_00 964 +#define SFXsfx03C5 965 +#define SFXsfx03C6 966 +#define SFXtri_r_impact_00 967 +#define SFXtri_r_impact_01 968 +#define SFXtri_b_run_00 969 +#define SFXsfx03CA 970 +#define SFXsfx03CB 971 +#define SFXsfx03CC 972 +#define SFXsfx03CD 973 +#define SFXsfx03CE 974 +#define SFXsfx03CF 975 +#define SFXsfx03D0 976 +#define SFXsfx03D1 977 +#define SFXsfx03D2 978 +#define SFXsfx03D3 979 +#define SFXsfx03D4 980 diff --git a/Runtime/Audio/SFX/Turret.h b/Runtime/Audio/SFX/Turret.h new file mode 100644 index 000000000..d0fedfb4f --- /dev/null +++ b/Runtime/Audio/SFX/Turret.h @@ -0,0 +1,36 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Turret + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPTurret 36 + +#define SFXsfx03E8 1000 +#define SFXtur_a_laser_00 1001 +#define SFXsfx03EA 1002 +#define SFXsfx03EB 1003 +#define SFXsfx03EC 1004 +#define SFXsfx03ED 1005 +#define SFXsfx03EE 1006 +#define SFXsfx03EF 1007 +#define SFXtur_b_lower_00 1008 +#define SFXsfx03F1 1009 +#define SFXsfx03F2 1010 +#define SFXtur_b_raise_lp_00 1011 +#define SFXtur_b_stop_00 1012 +#define SFXsfx03F5 1013 +#define SFXtur_b_sweep_lp_00 1014 +#define SFXsfx03F7 1015 +#define SFXsfx03F8 1016 +#define SFXsfx03F9 1017 +#define SFXsfx03FA 1018 +#define SFXtur_r_powrdown_lp_00 1019 +#define SFXsfx03FC 1020 +#define SFXsfx03FD 1021 +#define SFXsfx03FE 1022 +#define SFXsfx03FF 1023 +#define SFXsfx0400 1024 +#define SFXsfx0401 1025 +#define SFXsfx0402 1026 diff --git a/Runtime/Audio/SFX/UI.h b/Runtime/Audio/SFX/UI.h new file mode 100644 index 000000000..a2a680eb2 --- /dev/null +++ b/Runtime/Audio/SFX/UI.h @@ -0,0 +1,99 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: UI + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPUI 40 + +#define SFXui_map_rotate 1375 +#define SFXui_map_zoom 1376 +#define SFXui_lockon_poi 1377 +#define SFXui_into_map_screen 1378 +#define SFXsfx0563 1379 +#define SFXui_outof_map_screen 1380 +#define SFXsfx0565 1381 +#define SFXui_outof_visor 1382 +#define SFXui_into_visor 1383 +#define SFXui_visor_xray_lp 1384 +#define SFXui_damage_lp 1385 +#define SFXui_show_local_beacon 1386 +#define SFXui_show_remote_beacon 1387 +#define SFXui_visor_thermal_lp 1388 +#define SFXsfx056D 1389 +#define SFXui_outof_freelook 1390 +#define SFXsfx056F 1391 +#define SFXui_into_freelook 1392 +#define SFXui_lockon_grapple 1393 +#define SFXui_freelook_move_lp 1394 +#define SFXui_select_visor 1395 +#define SFXui_threat_warning 1396 +#define SFXui_missile_warning 1397 +#define SFXui_select_beam 1398 +#define SFXui_threat_damage 1399 +#define SFXui_hud_shutdown 1400 +#define SFXui_hud_reboot 1401 +#define SFXui_static_hi 1402 +#define SFXui_static_lo 1403 +#define SFXui_visor_scan_lp 1404 +#define SFXui_energy_low 1405 +#define SFXui_map_pan 1406 +#define SFXui_scanning_lp 1407 +#define SFXsfx0580 1408 +#define SFXui_outof_scan_window 1409 +#define SFXsfx0582 1410 +#define SFXui_into_scan_window 1411 +#define SFXsfx0584 1412 +#define SFXsfx0585 1413 +#define SFXui_scan_pane_reveal 1414 +#define SFXui_into_hud_message 1415 +#define SFXui_outof_hud_message 1416 +#define SFXui_scan_complete 1417 +#define SFXui_hud_memo_type 1418 +#define SFXsfx058B 1419 +#define SFXsfx058C 1420 +#define SFXui_message_screen_key 1421 +#define SFXui_options_quit_accept 1422 +#define SFXui_options_quit_reject 1423 +#define SFXui_quit_change 1424 +#define SFXui_new_scan_complete 1425 +#define SFXui_map_to_universe 1426 +#define SFXui_map_from_universe 1427 +#define SFXsfx0594 1428 +#define SFXsfx0595 1429 +#define SFXsfx0596 1430 +#define SFXui_table_change_mode 1431 +#define SFXui_advance 1432 +#define SFXui_pause_screen_change 1433 +#define SFXui_pause_screen_exit 1434 +#define SFXui_pause_screen_enter 1435 +#define SFXui_table_selection_change 1436 +#define SFXui_option_enum_change 1437 +#define SFXsfx059E 1438 +#define SFXui_scan_next_page 1439 +#define SFXui_samus_doll_enter 1440 +#define SFXui_samus_doll_exit 1441 +#define SFXui_hud_memo_a_pulse 1442 +#define SFXui_show_hint_memo 1443 +#define SFXui_pause_screen_next_page 1444 +#define SFXsfx05A5 1445 +#define SFXui_map_screen_key2 1446 +#define SFXsfx05A7 1447 +#define SFXsfx05A8 1448 +#define SFXui_hide_hint_memo 1449 +#define SFXsfx05AA 1450 +#define SFXui_options_slider_change_lp 1451 +#define SFXui_map_screen_key1 1452 +#define SFXui_map_screen_key0 1453 +#define SFXsfx05AE 1454 +#define SFXsfx05AF 1455 +#define SFXsfx05B0 1456 +#define SFXsfx05B1 1457 +#define SFXui_frontend_options_slider_change_lp 1458 +#define SFXui_frontend_save_back 1459 +#define SFXui_frontend_save_confirm 1460 +#define SFXui_frontend_save_move 1461 +#define SFXsfx05B6 1462 +#define SFXsfx05B7 1463 +#define SFXsfx05B8 1464 diff --git a/Runtime/Audio/SFX/WarWasp.h b/Runtime/Audio/SFX/WarWasp.h new file mode 100644 index 000000000..138619f46 --- /dev/null +++ b/Runtime/Audio/SFX/WarWasp.h @@ -0,0 +1,72 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: WarWasp + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPWarWasp 37 + +#define SFXwar_b_idle_lp_00 1027 +#define SFXwa2_a_stinger_00 1028 +#define SFXwa2_b_idle_lp_00 1029 +#define SFXwa2_r_diescream_00 1030 +#define SFXwa2_r_hitlight_00 1031 +#define SFXwa2_r_wingbuzz_00 1032 +#define SFXwar_r_diescream_00 1033 +#define SFXwar_r_diescream_01 1034 +#define SFXwar_r_diescream_02 1035 +#define SFXwar_r_diescream_03 1036 +#define SFXwar_r_hitdirt_00 1037 +#define SFXwar_r_hitdirt_01 1038 +#define SFXwar_r_hitlight_00 1039 +#define SFXwar_r_hitlight_01 1040 +#define SFXwar_r_wingbuzz_00 1041 +#define SFXwar_r_wingbuzz_01 1042 +#define SFXwar_r_wingbuzz_02 1043 +#define SFXwar_r_wingbuzz_03 1044 +#define SFXsfx0415 1045 +#define SFXwa2_r_wingbuzz_01 1046 +#define SFXwar_a_stab_00 1047 +#define SFXwar_b_noise_00 1048 +#define SFXwar_b_noise_01 1049 +#define SFXwa3_a_stab_00 1050 +#define SFXwa3_a_stab_01 1051 +#define SFXwa2_b_noise_00 1052 +#define SFXwa2_b_noise_01 1053 +#define SFXwar_a_stab_01 1054 +#define SFXwar_a_stinger_00 1055 +#define SFXwar_r_wingbuzz_04 1056 +#define SFXsfx0421 1057 +#define SFXsfx0422 1058 +#define SFXwa2_b_agitated_lp_00 1059 +#define SFXsfx0424 1060 +#define SFXwa2_b_noise_02 1061 +#define SFXwar_b_agitated_lp_00 1062 +#define SFXwa3_a_voxattak_00 1063 +#define SFXwar_b_noise_02 1064 +#define SFXwa3_b_agitated_lp_00 1065 +#define SFXwa3_b_idle_lp_00 1066 +#define SFXsfx042B 1067 +#define SFXwa3_b_noise_00 1068 +#define SFXsfx042D 1069 +#define SFXwa3_b_noise_02 1070 +#define SFXwa3_r_hitlight_00 1071 +#define SFXwa3_r_wingbuzz_00 1072 +#define SFXglo_b_fly_lp_00 1073 +#define SFXwa3_r_wingbuzz_02 1074 +#define SFXsfx0433 1075 +#define SFXsfx0434 1076 +#define SFXsfx0435 1077 +#define SFXsfx0436 1078 +#define SFXsfx0437 1079 +#define SFXsfx0438 1080 +#define SFXsfx0439 1081 +#define SFXsfx043A 1082 +#define SFXsfx043B 1083 +#define SFXsfx043C 1084 +#define SFXsfx043D 1085 +#define SFXsfx043E 1086 +#define SFXsfx043F 1087 +#define SFXsfx0440 1088 +#define SFXsfx0441 1089 diff --git a/Runtime/Audio/SFX/Weapons.h b/Runtime/Audio/SFX/Weapons.h new file mode 100644 index 000000000..bd30784e0 --- /dev/null +++ b/Runtime/Audio/SFX/Weapons.h @@ -0,0 +1,145 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Weapons + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPWeapons 43 + +#define SFXwpn_bomb_drop 1756 +#define SFXsfx06DD 1757 +#define SFXwpn_bomb_explo 1758 +#define SFXwpn_chargeup_ice 1759 +#define SFXsfx06E0 1760 +#define SFXsfx06E1 1761 +#define SFXwpn_combo_xfer 1762 +#define SFXwpn_empty_action 1763 +#define SFXsfx06E4 1764 +#define SFXsfx06E5 1765 +#define SFXwpn_chargeup_power 1766 +#define SFXwpn_fire_power_charged 1767 +#define SFXwpn_fire_missile 1768 +#define SFXwpn_reload_missile 1769 +#define SFXwpn_fire_power_normal 1770 +#define SFXsfx06EB 1771 +#define SFXsfx06EC 1772 +#define SFXsfx06ED 1773 +#define SFXwpn_morph_out_wipe 1774 +#define SFXwpn_morph_in_wipe_done 1775 +#define SFXwpn_fire_ice_charged 1776 +#define SFXsfx06F1 1777 +#define SFXsfx06F2 1778 +#define SFXsfx06F3 1779 +#define SFXsfx06F4 1780 +#define SFXwpn_invalid_action 1781 +#define SFXsfx06F6 1782 +#define SFXsfx06F7 1783 +#define SFXsfx06F8 1784 +#define SFXsfx06F9 1785 +#define SFXsfx06FA 1786 +#define SFXsfx06FB 1787 +#define SFXsfx06FC 1788 +#define SFXsfx06FD 1789 +#define SFXsfx06FE 1790 +#define SFXsfx06FF 1791 +#define SFXsfx0700 1792 +#define SFXsfx0701 1793 +#define SFXsfx0702 1794 +#define SFXsfx0703 1795 +#define SFXsfx0704 1796 +#define SFXwpn_fire_ice_normal 1797 +#define SFXsfx0706 1798 +#define SFXsfx0707 1799 +#define SFXsfx0708 1800 +#define SFXwpn_fire_wave_normal 1801 +#define SFXsfx070A 1802 +#define SFXwpn_fire_plasma_normal 1803 +#define SFXsfx070C 1804 +#define SFXwpn_fire_phazon_normal 1805 +#define SFXsfx070E 1806 +#define SFXsfx070F 1807 +#define SFXsfx0710 1808 +#define SFXsfx0711 1809 +#define SFXsfx0712 1810 +#define SFXsfx0713 1811 +#define SFXsfx0714 1812 +#define SFXsfx0715 1813 +#define SFXsfx0716 1814 +#define SFXsfx0717 1815 +#define SFXsfx0718 1816 +#define SFXsfx0719 1817 +#define SFXsfx071A 1818 +#define SFXsfx071B 1819 +#define SFXsfx071C 1820 +#define SFXwpn_into_beam_ice 1821 +#define SFXwpn_from_beam_ice 1822 +#define SFXwpn_to_missile_power 1823 +#define SFXwpn_from_missile_power 1824 +#define SFXwpn_into_beam_plasma 1825 +#define SFXwpn_from_beam_plasma 1826 +#define SFXwpn_into_beam_wave 1827 +#define SFXwpn_from_beam_wave 1828 +#define SFXwpn_to_missile_ice 1829 +#define SFXsfx0726 1830 +#define SFXsfx0727 1831 +#define SFXsfx0728 1832 +#define SFXsfx0729 1833 +#define SFXsfx072A 1834 +#define SFXsfx072B 1835 +#define SFXsfx072C 1836 +#define SFXsfx072D 1837 +#define SFXsfx072E 1838 +#define SFXwpn_chargeup_plasma 1839 +#define SFXwpn_fire_plasma_charged 1840 +#define SFXsfx0731 1841 +#define SFXwpn_combo_flamethrower 1842 +#define SFXsfx0733 1843 +#define SFXwpn_chargeup_wave 1844 +#define SFXwpn_fire_wave_charged 1845 +#define SFXsfx0736 1846 +#define SFXwpn_combo_wavebuster 1847 +#define SFXsfx0738 1848 +#define SFXwpn_from_missile_ice 1849 +#define SFXwpn_to_missile_wave 1850 +#define SFXwpn_from_missile_wave 1851 +#define SFXwpn_to_missile_plasma 1852 +#define SFXwpn_from_missile_plasma 1853 +#define SFXsfx073E 1854 +#define SFXsfx073F 1855 +#define SFXsfx0740 1856 +#define SFXsfx0741 1857 +#define SFXsfx0742 1858 +#define SFXsfx0743 1859 +#define SFXsfx0744 1860 +#define SFXsfx0745 1861 +#define SFXsfx0746 1862 +#define SFXsfx0747 1863 +#define SFXsfx0748 1864 +#define SFXsfx0749 1865 +#define SFXsfx074A 1866 +#define SFXsfx074B 1867 +#define SFXsfx074C 1868 +#define SFXsfx074D 1869 +#define SFXsfx074E 1870 +#define SFXsfx074F 1871 +#define SFXsfx0750 1872 +#define SFXsfx0751 1873 +#define SFXsfx0752 1874 +#define SFXsfx0753 1875 +#define SFXsfx0754 1876 +#define SFXsfx0755 1877 +#define SFXsfx0756 1878 +#define SFXsfx0757 1879 +#define SFXsfx0758 1880 +#define SFXsfx0759 1881 +#define SFXsfx075A 1882 +#define SFXsfx075B 1883 +#define SFXsfx075C 1884 +#define SFXsfx075D 1885 +#define SFXsfx075E 1886 +#define SFXsfx075F 1887 +#define SFXsfx0760 1888 +#define SFXsfx0761 1889 +#define SFXsfx0762 1890 +#define SFXsfx0763 1891 diff --git a/Runtime/Audio/SFX/ZZZ.h b/Runtime/Audio/SFX/ZZZ.h new file mode 100644 index 000000000..1b7c2b7fa --- /dev/null +++ b/Runtime/Audio/SFX/ZZZ.h @@ -0,0 +1,29 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: ZZZ + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPZZZ 65 + +#define SFXsfx0C16 3094 +#define SFXsfx0C17 3095 +#define SFXsfx0C18 3096 +#define SFXsfx0C19 3097 +#define SFXsfx0C1A 3098 +#define SFXsfx0C1B 3099 +#define SFXsfx0C1C 3100 +#define SFXsfx0C1D 3101 +#define SFXsfx0C1E 3102 +#define SFXsfx0C1F 3103 +#define SFXsfx0C20 3104 +#define SFXsfx0C21 3105 +#define SFXsfx0C22 3106 +#define SFXsfx0C23 3107 +#define SFXsfx0C24 3108 +#define SFXsfx0C25 3109 +#define SFXsfx0C26 3110 +#define SFXsfx0C27 3111 +#define SFXsfx0C28 3112 +#define SFXsfx0C29 3113 diff --git a/Runtime/Audio/SFX/Zoomer.h b/Runtime/Audio/SFX/Zoomer.h new file mode 100644 index 000000000..99269f336 --- /dev/null +++ b/Runtime/Audio/SFX/Zoomer.h @@ -0,0 +1,31 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: Zoomer + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPZoomer 54 + +#define SFXzom_b_idle_00 2681 +#define SFXsfx0A7A 2682 +#define SFXsfx0A7B 2683 +#define SFXsfx0A7C 2684 +#define SFXsfx0A7D 2685 +#define SFXgem_b_idle_00 2686 +#define SFXsfx0A7F 2687 +#define SFXsfx0A80 2688 +#define SFXsfx0A81 2689 +#define SFXsfx0A82 2690 +#define SFXsfx0A83 2691 +#define SFXsfx0A84 2692 +#define SFXsfx0A85 2693 +#define SFXsfx0A86 2694 +#define SFXsfx0A87 2695 +#define SFXsfx0A88 2696 +#define SFXsfx0A89 2697 +#define SFXsfx0A8A 2698 +#define SFXsfx0A8B 2699 +#define SFXsfx0A8C 2700 +#define SFXsfx0A8D 2701 +#define SFXsfx0A8E 2702 diff --git a/Runtime/Audio/SFX/lumigek.h b/Runtime/Audio/SFX/lumigek.h new file mode 100644 index 000000000..86dc69a74 --- /dev/null +++ b/Runtime/Audio/SFX/lumigek.h @@ -0,0 +1,15 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: lumigek + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPLumigek 69 + +#define SFXlum_b_idle_00 3143 +#define SFXsfx0C48 3144 +#define SFXsfx0C49 3145 +#define SFXsfx0C4A 3146 +#define SFXsfx0C4B 3147 +#define SFXsfx0C4C 3148 diff --git a/Runtime/Audio/SFX/test.h b/Runtime/Audio/SFX/test.h new file mode 100644 index 000000000..0028de793 --- /dev/null +++ b/Runtime/Audio/SFX/test.h @@ -0,0 +1,13 @@ +/* Auto-generated Amuse Defines + * + * Project: Audio + * Subproject: test + * Date: Sat Sep 1 12:32:04 2018 + */ + +#define GRPtest 53 + +#define SNGIntro_Cinema 0 +#define SNGMain_Plaza 1 +#define SNGIntro_Exit 2 +#define SNGEndGame 3 diff --git a/Runtime/CDvdFile.hpp b/Runtime/CDvdFile.hpp index 696b5908e..f4f72c4ee 100644 --- a/Runtime/CDvdFile.hpp +++ b/Runtime/CDvdFile.hpp @@ -11,7 +11,7 @@ #include "Runtime/GCNTypes.hpp" #include "Runtime/RetroTypes.hpp" -#include +//#include #include #include diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index 5d6f163aa..dcf97d62a 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -23,6 +23,21 @@ union BitsToDouble { double doub; }; +/** Word Bitmap reader/writer */ +void WordBitmap::read(athena::io::IStreamReader& reader, size_t bitCount) { + m_bitCount = bitCount; + size_t wordCount = (bitCount + 31) / 32; + m_words.clear(); + m_words.reserve(wordCount); + for (size_t w = 0; w < wordCount; ++w) + m_words.push_back(reader.readUint32Big()); +} +void WordBitmap::write(athena::io::IStreamWriter& writer) const { + for (atUint32 word : m_words) + writer.writeUint32Big(word); +} +void WordBitmap::binarySize(size_t& __isz) const { __isz += m_words.size() * 4; } + CScriptLayerManager::CScriptLayerManager(CInputStream& reader, const CWorldSaveGameInfo& saveWorld) { const u32 bitCount = reader.ReadBits(10); x10_saveLayers.reserve(bitCount); diff --git a/Runtime/CGameState.hpp b/Runtime/CGameState.hpp index 0c411b1ce..aaea9f904 100644 --- a/Runtime/CGameState.hpp +++ b/Runtime/CGameState.hpp @@ -4,8 +4,6 @@ #include #include -#include "DataSpec/DNACommon/DNACommon.hpp" - #include "Runtime/CBasics.hpp" #include "Runtime/CGameOptions.hpp" #include "Runtime/CPlayerState.hpp" @@ -17,10 +15,73 @@ namespace metaforce { class CSaveWorldMemory; +// TODO: copied from DataSpec, should be reimplemented +class WordBitmap { + std::vector m_words; + size_t m_bitCount = 0; + +public: + void read(athena::io::IStreamReader& reader, size_t bitCount); + void write(athena::io::IStreamWriter& writer) const; + void reserve(size_t bitCount) { m_words.reserve((bitCount + 31) / 32); } + void binarySize(size_t& __isz) const; + size_t getBitCount() const { return m_bitCount; } + bool getBit(size_t idx) const { + size_t wordIdx = idx / 32; + if (wordIdx >= m_words.size()) + return false; + size_t wordCur = idx % 32; + return (m_words[wordIdx] >> wordCur) & 0x1; + } + void setBit(size_t idx) { + size_t wordIdx = idx / 32; + while (wordIdx >= m_words.size()) + m_words.push_back(0); + size_t wordCur = idx % 32; + m_words[wordIdx] |= (1 << wordCur); + m_bitCount = std::max(m_bitCount, idx + 1); + } + void unsetBit(size_t idx) { + size_t wordIdx = idx / 32; + while (wordIdx >= m_words.size()) + m_words.push_back(0); + size_t wordCur = idx % 32; + m_words[wordIdx] &= ~(1 << wordCur); + m_bitCount = std::max(m_bitCount, idx + 1); + } + void clear() { + m_words.clear(); + m_bitCount = 0; + } + + class Iterator { + friend class WordBitmap; + const WordBitmap& m_bmp; + size_t m_idx = 0; + Iterator(const WordBitmap& bmp, size_t idx) : m_bmp(bmp), m_idx(idx) {} + + public: + using iterator_category = std::forward_iterator_tag; + using value_type = bool; + using difference_type = std::ptrdiff_t; + using pointer = bool*; + using reference = bool&; + + Iterator& operator++() { + ++m_idx; + return *this; + } + bool operator*() const { return m_bmp.getBit(m_idx); } + bool operator!=(const Iterator& other) const { return m_idx != other.m_idx; } + }; + Iterator begin() const { return Iterator(*this, 0); } + Iterator end() const { return Iterator(*this, m_bitCount); } +}; + class CScriptLayerManager { friend class CSaveWorldIntermediate; std::vector x0_areaLayers; - DataSpec::WordBitmap x10_saveLayers; + WordBitmap x10_saveLayers; public: CScriptLayerManager() = default; diff --git a/Runtime/CMain.cpp b/Runtime/CMain.cpp index b01c8d5b3..a59d5d02a 100644 --- a/Runtime/CMain.cpp +++ b/Runtime/CMain.cpp @@ -14,10 +14,6 @@ #include "../version.h" -/* Static reference to dataspec additions - * (used by MSVC to definitively link DataSpecs) */ -#include "DataSpecRegistry.hpp" - //#include //#pragma STDC FENV_ACCESS ON @@ -543,9 +539,6 @@ public: } // namespace metaforce -static char CwdBuf[1024]; -std::string ExeDir; - static void SetupBasics(bool logging) { auto result = zeus::validateCPU(); if (!result.first) { @@ -613,18 +606,6 @@ int main(int argc, char** argv) { logvisor::RegisterFileLogger(logFilePath.c_str()); } - if (char* cwd = hecl::Getcwd(CwdBuf, 1024)) { - if (hecl::PathRelative(argv[0])) - ExeDir = std::string(cwd) + '/'; - std::string Argv0(argv[0]); - std::string::size_type lastIdx = Argv0.find_last_of("/\\"); - if (lastIdx != std::string::npos) - ExeDir.insert(ExeDir.end(), Argv0.begin(), Argv0.begin() + lastIdx); - } - - /* Handle -j argument */ - hecl::SetCpuCountOverride(argc, argv); - auto app = std::make_unique(fileMgr, cvarMgr, cvarCmns); auto icon = metaforce::GetIcon(); auto data = aurora::Icon{ diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index 93a13e0f0..3b09a7552 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -158,9 +158,8 @@ function(add_runtime_common_library name) endif () endfunction() -set(RUNTIME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -set(RUNTIME_LIBRARIES ${HECL_APPLICATION_REPS_TARGETS_LIST} RetroDataSpec AssetNameMapNull NESEmulator - libjpeg-turbo jbus kabufuda discord-rpc logvisor OptickCore imgui aurora SDL2-static) +set(RUNTIME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) +set(RUNTIME_LIBRARIES amuse zeus nod NESEmulator libjpeg-turbo jbus kabufuda discord-rpc logvisor OptickCore imgui aurora SDL2-static) add_runtime_common_library(RuntimeCommon ${RUNTIME_SOURCES_A}) target_include_directories(RuntimeCommon PUBLIC ${RUNTIME_INCLUDES}) @@ -240,7 +239,7 @@ if (COMMAND add_sanitizers) endif () if (NOT WINDOWS_STORE) - add_dependencies(metaforce hecl) # visigen + #add_dependencies(metaforce hecl) # visigen else () set_property(TARGET metaforce PROPERTY VS_WINRT_COMPONENT TRUE) # This should match the Package.appxmanifest diff --git a/Runtime/CMemoryCardSysNix.cpp b/Runtime/CMemoryCardSysNix.cpp index c7ff75db6..6e0e26a9c 100644 --- a/Runtime/CMemoryCardSysNix.cpp +++ b/Runtime/CMemoryCardSysNix.cpp @@ -2,28 +2,43 @@ #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/IMain.hpp" +#include + namespace metaforce { +static std::optional GetPrefPath(const char* app) { + char* path = SDL_GetPrefPath(nullptr, app); + if (path == nullptr) { + return {}; + } + std::string str{path}; + SDL_free(path); + return str; +} + std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) { if (g_Main->IsUSA() && !g_Main->IsTrilogy()) { - const char* home = getenv("HOME"); - if (!home || home[0] != '/') + const auto dolphinPath = GetPrefPath("dolphin-emu"); + if (!dolphinPath) { return {}; - const char* dataHome = getenv("XDG_DATA_HOME"); + } + auto path = *dolphinPath; + path += fmt::format(FMT_STRING("GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); - /* XDG-selected data path */ - std::string path = - ((dataHome && dataHome[0] == '/') ? dataHome : std::string(home)) + "/.local/share/dolphin-emu"; - path += fmt::format(FMT_STRING("/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); - - hecl::Sstat theStat; - if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode)) { + struct stat64 theStat {}; + if (stat64(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) { /* legacy case for older dolphin versions */ + const char* home = getenv("HOME"); + if (home == nullptr || home[0] != '/') { + return {}; + } + path = home; path += fmt::format(FMT_STRING("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); - if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode)) + if (stat64(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) { return {}; + } } return path; @@ -34,33 +49,39 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) { std::string CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot, bool dolphin) { if (g_Main->IsUSA() && !g_Main->IsTrilogy()) { if (dolphin) { - const char* home = getenv("HOME"); - if (!home || home[0] != '/') + const auto dolphinPath = GetPrefPath("dolphin-emu"); + if (!dolphinPath) { return {}; - const char* dataHome = getenv("XDG_DATA_HOME"); - - /* XDG-selected data path */ - std::string path = - ((dataHome && dataHome[0] == '/') ? dataHome : std::string(home)) + "/.local/share/dolphin-emu/GC"; - - if (hecl::RecursiveMakeDir(path.c_str()) < 0) + } + auto path = *dolphinPath + "GC"; + int ret = mkdir(path.c_str(), 0755); + if (ret != 0 && ret != EEXIST) { return {}; + } path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B'); - const auto fp = hecl::FopenUnique(path.c_str(), "wb"); - if (fp != nullptr) { + auto* file = fopen(path.c_str(), "wbe"); + if (file != nullptr) { + fclose(file); return path; } } else { std::string path = _GetDolphinCardPath(slot); - hecl::SanitizePath(path); if (path.find('/') == std::string::npos) { - path = hecl::GetcwdStr() + "/" + _GetDolphinCardPath(slot); + auto basePath = GetPrefPath("metaforce"); + if (!basePath) { + return {}; + } + path = *basePath + _GetDolphinCardPath(slot); } - std::string tmpPath = path.substr(0, path.find_last_of("/")); - hecl::RecursiveMakeDir(tmpPath.c_str()); - const auto fp = hecl::FopenUnique(path.c_str(), "wb"); - if (fp) { + std::string tmpPath = path.substr(0, path.find_last_of('/')); + int ret = mkdir(tmpPath.c_str(), 0755); + if (ret != 0 && ret != EEXIST) { + return {}; + } + auto* file = fopen(path.c_str(), "wbe"); + if (file != nullptr) { + fclose(file); return path; } } diff --git a/Runtime/CStringExtras.cpp b/Runtime/CStringExtras.cpp index ee2ee01e4..0fb2c9620 100644 --- a/Runtime/CStringExtras.cpp +++ b/Runtime/CStringExtras.cpp @@ -1,6 +1,8 @@ #include "Runtime/CStringExtras.hpp" #include "Runtime/Streams/CInputStream.hpp" +#include + namespace metaforce { std::string CStringExtras::ReadString(CInputStream& in) { u32 strLen = in.ReadLong(); @@ -18,4 +20,78 @@ std::string CStringExtras::ReadString(CInputStream& in) { return ret; } -} \ No newline at end of file + +std::string CStringExtras::ConvertToANSI(std::u16string_view sv) { + std::string out; + out.reserve(sv.size()); + for (const char16_t c : sv) { + out.push_back(static_cast(c)); + } + return out; +} + +std::u16string CStringExtras::ConvertToUNICODE(std::string_view sv) { + std::u16string out; + out.reserve(sv.size()); + for (const char c : sv) { + out.push_back(static_cast(c)); + } + return out; +} + +std::string CStringExtras::ConvertToUTF8(std::u16string_view sv) { + std::string out; + const auto* in = sv.data(); + const auto* end = in + sv.size(); + while (in < end) { + char32_t utf32 = 0; + const char16_t* next = OSUTF16To32(in, &utf32); + // TODO: bug in OSUTF + if (next == nullptr) { + utf32 = *in; + in++; + } else { + in = next; + } + std::array chars8{}; + char8_t* end8 = OSUTF32To8(utf32, chars8.data()); + if (end8 == nullptr) { + continue; + } + const auto* c = chars8.data(); + while (c < end8) { + out.push_back(static_cast(*c)); + c++; + } + } + return out; +} + +std::u16string CStringExtras::ConvertToUTF16(std::string_view sv) { + std::u16string out; + const auto* in = reinterpret_cast(sv.data()); + const auto* end = in + sv.size(); + while (in < end) { + char32_t utf32 = 0; + const char8_t* next = OSUTF8To32(in, &utf32); + // TODO: bug in OSUTF + if (next == nullptr) { + utf32 = *in; + in++; + } else { + in = next; + } + std::array chars16{}; + char16_t* end16 = OSUTF32To16(utf32, chars16.data()); + if (end16 == nullptr) { + continue; + } + const auto* c = chars16.data(); + while (c < end16) { + out.push_back(*c); + c++; + } + } + return out; +} +} // namespace metaforce diff --git a/Runtime/CStringExtras.hpp b/Runtime/CStringExtras.hpp index 03a295cf1..ef6a69090 100644 --- a/Runtime/CStringExtras.hpp +++ b/Runtime/CStringExtras.hpp @@ -8,6 +8,12 @@ namespace metaforce { class CInputStream; class CStringExtras { public: + static std::string ConvertToANSI(std::u16string_view sv); + static std::u16string ConvertToUNICODE(std::string_view sv); + // Metaforce addition: UTF-8/16 compatible versions of the above + static std::string ConvertToUTF8(std::u16string_view sv); + static std::u16string ConvertToUTF16(std::string_view sv); + // Checks if the provided views into string data can be considered equal or not based on // whether or not all their characters are equal to one another in a character insensitive manner. // diff --git a/Runtime/CWorldSaveGameInfo.hpp b/Runtime/CWorldSaveGameInfo.hpp index e8f31f9d0..91f393da8 100644 --- a/Runtime/CWorldSaveGameInfo.hpp +++ b/Runtime/CWorldSaveGameInfo.hpp @@ -2,8 +2,6 @@ #include -#include "DNACommon/SAVWCommon.hpp" - #include "Runtime/CFactoryMgr.hpp" #include "Runtime/RetroTypes.hpp" @@ -11,7 +9,8 @@ namespace metaforce { class CWorldSaveGameInfo { public: - using EScanCategory = DataSpec::SAVWCommon::EScanCategory; + enum class EScanCategory { None, Data, Lore, Creature, Research, Artifact }; + struct SScanState { CAssetId x0_id; EScanCategory x4_category; diff --git a/Runtime/Collision/CAreaOctTree.cpp b/Runtime/Collision/CAreaOctTree.cpp index 7b700b963..b9d29297a 100644 --- a/Runtime/Collision/CAreaOctTree.cpp +++ b/Runtime/Collision/CAreaOctTree.cpp @@ -9,7 +9,6 @@ #include #include -#include #include namespace metaforce { diff --git a/Runtime/Graphics/CBooRenderer.cpp b/Runtime/Graphics/CBooRenderer.cpp index 2c6201f5e..665bab40d 100644 --- a/Runtime/Graphics/CBooRenderer.cpp +++ b/Runtime/Graphics/CBooRenderer.cpp @@ -712,11 +712,11 @@ CBooRenderer::~CBooRenderer() { g_Renderer = nullptr; } void CBooRenderer::AddWorldSurfaces(CBooModel& model) { CBooSurface* surf = model.x3c_firstSortedSurface; while (surf) { - const MaterialSet::Material& mat = model.GetMaterialByIndex(surf->m_data.matIdx); +// const MaterialSet::Material& mat = model.GetMaterialByIndex(surf->m_data.matIdx); zeus::CAABox aabb = surf->GetBounds(); zeus::CVector3f pt = aabb.closestPointAlongVector(xb0_viewPlane.normal()); Buckets::Insert(pt, aabb, EDrawableType::WorldSurface, surf, xb0_viewPlane, - mat.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Alpha); + /*mat.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Alpha*/ false); surf = surf->m_next; } } diff --git a/Runtime/Graphics/CGraphics.hpp b/Runtime/Graphics/CGraphics.hpp index e480ec8f1..b7633f64e 100644 --- a/Runtime/Graphics/CGraphics.hpp +++ b/Runtime/Graphics/CGraphics.hpp @@ -7,13 +7,13 @@ #include "Runtime/RetroTypes.hpp" -#include "DataSpec/DNACommon/GX.hpp" +#include "GX.hpp" //#include //#include #include "ConsoleVariables/CVar.hpp" -#include +//#include #include #include diff --git a/Runtime/Graphics/CMetroidModelInstance.hpp b/Runtime/Graphics/CMetroidModelInstance.hpp index cf0a52f30..a45d835be 100644 --- a/Runtime/Graphics/CMetroidModelInstance.hpp +++ b/Runtime/Graphics/CMetroidModelInstance.hpp @@ -8,7 +8,7 @@ #include "Shaders/CModelShaders.hpp" -#include +//#include #include #include @@ -26,7 +26,7 @@ class CMetroidModelInstance { zeus::CAABox x34_aabb; std::vector m_surfaces; std::unique_ptr m_instance; - hecl::HMDLMeta m_hmdlMeta; +// hecl::HMDLMeta m_hmdlMeta; // std::unordered_map m_shaders; public: @@ -38,7 +38,7 @@ public: x34_aabb = {}; m_surfaces.clear(); m_instance.reset(); - m_hmdlMeta = {}; +// m_hmdlMeta = {}; // m_shaders.clear(); } }; diff --git a/Runtime/Graphics/CModel.hpp b/Runtime/Graphics/CModel.hpp index da99d426a..44b8bffe8 100644 --- a/Runtime/Graphics/CModel.hpp +++ b/Runtime/Graphics/CModel.hpp @@ -5,15 +5,15 @@ #include #include -#include "DataSpec/DNACommon/CMDL.hpp" -#include "DataSpec/DNAMP1/CMDLMaterials.hpp" +//#include "DataSpec/DNACommon/CMDL.hpp" +//#include "DataSpec/DNAMP1/CMDLMaterials.hpp" #include "Runtime/CFactoryMgr.hpp" #include "Runtime/CToken.hpp" #include "Runtime/Graphics/CTexture.hpp" #include "Runtime/Graphics/Shaders/CModelShaders.hpp" #include "Runtime/RetroTypes.hpp" -#include +//#include #include #include @@ -64,20 +64,21 @@ struct CModelFlags { /* metaforce addition: doesn't require hacky stashing of * pointers within loaded CMDL buffer */ struct CBooSurface { - DataSpec::DNACMDL::SurfaceHeader_2 m_data; +// DataSpec::DNACMDL::SurfaceHeader_2 m_data; size_t selfIdx; class CBooModel* m_parent = nullptr; CBooSurface* m_next = nullptr; zeus::CAABox GetBounds() const { - if (!m_data.aabbSz) - return zeus::CAABox(m_data.centroid, m_data.centroid); - else - return zeus::CAABox(m_data.aabb[0], m_data.aabb[1]); +// if (!m_data.aabbSz) +// return zeus::CAABox(m_data.centroid, m_data.centroid); +// else +// return zeus::CAABox(m_data.aabb[0], m_data.aabb[1]); + return {}; } }; -using MaterialSet = DataSpec::DNAMP1::HMDLMaterialSet; +//using MaterialSet = DataSpec::DNAMP1::HMDLMaterialSet; //struct GeometryUniformLayout { // mutable std::vector> m_sharedBuffer; @@ -103,7 +104,7 @@ using MaterialSet = DataSpec::DNAMP1::HMDLMaterialSet; struct SShader { std::unordered_map> x0_textures; // std::unordered_map m_shaders; - MaterialSet m_matSet; +// MaterialSet m_matSet; // std::optional m_geomLayout; int m_matSetIdx; explicit SShader(int idx) : m_matSetIdx(idx) { @@ -135,7 +136,7 @@ private: TToken m_modelTok; CModel* m_model; std::vector* x0_surfaces; - const MaterialSet* x4_matSet; +// const MaterialSet* x4_matSet; // const GeometryUniformLayout* m_geomLayout; int m_matSetIdx = -1; // const std::unordered_map* m_pipelines; @@ -148,11 +149,11 @@ private: u8 x41_mask; u32 x44_areaInstanceIdx = UINT32_MAX; - struct UVAnimationBuffer { - static void ProcessAnimation(u8*& bufOut, const MaterialSet::Material::PASS& anim); - static void PadOutBuffer(u8*& bufStart, u8*& bufOut); - static void Update(u8*& bufOut, const MaterialSet* matSet, const CModelFlags& flags, const CBooModel* parent); - }; +// struct UVAnimationBuffer { +// static void ProcessAnimation(u8*& bufOut, const MaterialSet::Material::PASS& anim); +// static void PadOutBuffer(u8*& bufStart, u8*& bufOut); +// static void Update(u8*& bufOut, const MaterialSet* matSet, const CModelFlags& flags, const CBooModel* parent); +// }; CModelShaders::LightingUniform m_lightingData; @@ -200,8 +201,8 @@ public: // boo::ObjToken vbo, boo::ObjToken ibo, const zeus::CAABox& aabb, u8 renderMask); - static void MakeTexturesFromMats(const MaterialSet& matSet, - std::unordered_map>& toksOut, IObjectStore& store); +// static void MakeTexturesFromMats(const MaterialSet& matSet, +// std::unordered_map>& toksOut, IObjectStore& store); void MakeTexturesFromMats(std::unordered_map>& toksOut, IObjectStore& store); bool IsOpaque() const { return x3c_firstSortedSurface == nullptr; } @@ -224,7 +225,7 @@ public: void LockParent() { m_modelTok.Lock(); } void UnlockParent() { m_modelTok.Unlock(); } - const MaterialSet::Material& GetMaterialByIndex(int idx) const { return x4_matSet->materials.at(idx); } +// const MaterialSet::Material& GetMaterialByIndex(int idx) const { return x4_matSet->materials.at(idx); } void ClearUniformCounter() { m_uniUpdateCount = 0; } static void ClearModelUniformCounters(); @@ -275,12 +276,12 @@ class CModel { /* metaforce addition: boo! */ // boo::ObjToken m_staticVbo; - hecl::HMDLMeta m_hmdlMeta; +// hecl::HMDLMeta m_hmdlMeta; std::unique_ptr m_dynamicVertexData; // boo::ObjToken m_ibo; public: - using MaterialSet = DataSpec::DNAMP1::HMDLMaterialSet; +// using MaterialSet = DataSpec::DNAMP1::HMDLMaterialSet; CModel(std::unique_ptr&& in, u32 dataLen, IObjectStore* store, CObjectReference* selfRef); void DrawSortedParts(const CModelFlags& flags) const; diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index d82c15ad9..0cf0e6b51 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -13,7 +13,7 @@ #include #include "ConsoleVariables/CVarManager.hpp" -#include +//#include #include #include @@ -78,10 +78,10 @@ void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurfa zeus::CVector3f surfPos; float surfSize = 0.f; if (surf) { - zeus::CVector3f surfCenter(surf->m_data.centroid); - zeus::CVector3f surfNormal(surf->m_data.reflectionNormal); - float dotDelta = surfNormal.dot(modelToPlayerLocal) - surfCenter.dot(surfNormal); - surfPos = modelToPlayerLocal - surfNormal * dotDelta; +// zeus::CVector3f surfCenter(surf->m_data.centroid); +// zeus::CVector3f surfNormal(surf->m_data.reflectionNormal); +// float dotDelta = surfNormal.dot(modelToPlayerLocal) - surfCenter.dot(surfNormal); +// surfPos = modelToPlayerLocal - surfNormal * dotDelta; } else { surfPos = model.x20_aabb.center(); surfSize = @@ -156,7 +156,7 @@ CBooModel::CBooModel(TToken& token, CModel* parent, std::vector& token, CModel* parent, std::vectorrbegin(); it != x0_surfaces->rend(); ++it) { - u32 matId = it->m_data.matIdx; - const MaterialSet::Material& matData = GetMaterialByIndex(matId); - if (matData.flags.depthSorting()) { - it->m_next = x3c_firstSortedSurface; - x3c_firstSortedSurface = &*it; - } else { - it->m_next = x38_firstUnsortedSurface; - x38_firstUnsortedSurface = &*it; - } +// u32 matId = it->m_data.matIdx; +// const MaterialSet::Material& matData = GetMaterialByIndex(matId); +// if (matData.flags.depthSorting()) { +// it->m_next = x3c_firstSortedSurface; +// x3c_firstSortedSurface = &*it; +// } else { +// it->m_next = x38_firstUnsortedSurface; +// x38_firstUnsortedSurface = &*it; +// } } // m_instances.reserve(numInsts); @@ -405,21 +405,21 @@ CBooModel::CBooModel(TToken& token, CModel* parent, std::vector>& toksOut, - IObjectStore& store) { - for (const auto& mat : matSet.materials) { - for (const auto& chunk : mat.chunks) { - if (const auto* const pass = chunk.get_if()) { - toksOut.emplace(std::make_pair(pass->texId.toUint32(), store.GetObj({SBIG('TXTR'), pass->texId.toUint32()}))); - } - } - } -} +//void CBooModel::MakeTexturesFromMats(const MaterialSet& matSet, +// std::unordered_map>& toksOut, +// IObjectStore& store) { +// for (const auto& mat : matSet.materials) { +// for (const auto& chunk : mat.chunks) { +// if (const auto* const pass = chunk.get_if()) { +// toksOut.emplace(std::make_pair(pass->texId.toUint32(), store.GetObj({SBIG('TXTR'), pass->texId.toUint32()}))); +// } +// } +// } +//} void CBooModel::MakeTexturesFromMats(std::unordered_map>& toksOut, IObjectStore& store) { - MakeTexturesFromMats(*x4_matSet, toksOut, store); +// MakeTexturesFromMats(*x4_matSet, toksOut, store); } void CBooModel::ActivateLights(const std::vector& lights) { m_lightingData.ActivateLights(lights); } @@ -439,7 +439,7 @@ void CBooModel::RemapMaterialData(SShader& shader) { // TODO what is this checking? // if (!shader.m_geomLayout) // return; - x4_matSet = &shader.m_matSet; +// x4_matSet = &shader.m_matSet; x1c_textures = shader.x0_textures; x40_24_texturesLoaded = false; } @@ -549,74 +549,74 @@ void CBooModel::DrawSurfaces(const CModelFlags& flags) const { } } -static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data, const CModelFlags& flags) { - bool noZWrite = flags.m_noZWrite || !data.flags.depthWrite(); - - /* Ensure cubemap extension shaders fall back to non-cubemap equivalents if necessary */ - EExtendedShader intermediateExtended = flags.m_extendedShader; - if (!com_cubemaps->toBoolean() || g_Renderer->IsThermalVisorHotPass() || g_Renderer->IsThermalVisorActive()) { - if (intermediateExtended == EExtendedShader::LightingCubeReflection) - intermediateExtended = EExtendedShader::Lighting; - else if (intermediateExtended == EExtendedShader::LightingCubeReflectionWorldShadow) - intermediateExtended = EExtendedShader::WorldShadow; - } - - EExtendedShader extended = EExtendedShader::Flat; - if (intermediateExtended == EExtendedShader::Lighting) { - /* Transform lighting into thermal if the thermal visor is active */ - if (g_Renderer->IsThermalVisorHotPass()) - return flags.m_noZTest ? EExtendedShader::LightingAlphaWriteNoZTestNoZWrite - : (noZWrite ? EExtendedShader::ThermalStaticNoZWrite : EExtendedShader::ThermalStatic); - else if (g_Renderer->IsThermalVisorActive()) - return EExtendedShader::ThermalCold; - if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Opaque) { - /* Override shader if originally opaque (typical for FRME models) */ - if (flags.x0_blendMode > 6) { - if (flags.m_depthGreater) - extended = EExtendedShader::ForcedAdditiveNoZWriteDepthGreater; - else - extended = - flags.m_noCull - ? (noZWrite ? EExtendedShader::ForcedAdditiveNoCullNoZWrite : EExtendedShader::ForcedAdditiveNoCull) - : (noZWrite ? EExtendedShader::ForcedAdditiveNoZWrite : EExtendedShader::ForcedAdditive); - } else if (flags.x0_blendMode > 4) { - extended = flags.m_noCull - ? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull) - : (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::ForcedAlpha); - } else { - extended = flags.m_noCull - ? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull) - : (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::Lighting); - } - } else if (flags.m_noCull && noZWrite) { - /* Substitute no-cull,no-zwrite pipeline if available */ - if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Additive) - extended = EExtendedShader::ForcedAdditiveNoCullNoZWrite; - else - extended = EExtendedShader::ForcedAlphaNoCullNoZWrite; - } else if (flags.m_noCull) { - /* Substitute no-cull pipeline if available */ - if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Additive) - extended = EExtendedShader::ForcedAdditiveNoCull; - else - extended = EExtendedShader::ForcedAlphaNoCull; - } else if (noZWrite) { - /* Substitute no-zwrite pipeline if available */ - if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Additive) - extended = EExtendedShader::ForcedAdditiveNoZWrite; - else - extended = EExtendedShader::ForcedAlphaNoZWrite; - } else { - extended = EExtendedShader::Lighting; - } - } else if (intermediateExtended == EExtendedShader::ThermalModel) { - extended = flags.m_noZTest ? EExtendedShader::ThermalModelNoZTestNoZWrite : EExtendedShader::ThermalModel; - } else if (intermediateExtended < EExtendedShader::MAX) { - extended = intermediateExtended; - } - - return extended; -} +//static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data, const CModelFlags& flags) { +// bool noZWrite = flags.m_noZWrite || !data.flags.depthWrite(); +// +// /* Ensure cubemap extension shaders fall back to non-cubemap equivalents if necessary */ +// EExtendedShader intermediateExtended = flags.m_extendedShader; +// if (!com_cubemaps->toBoolean() || g_Renderer->IsThermalVisorHotPass() || g_Renderer->IsThermalVisorActive()) { +// if (intermediateExtended == EExtendedShader::LightingCubeReflection) +// intermediateExtended = EExtendedShader::Lighting; +// else if (intermediateExtended == EExtendedShader::LightingCubeReflectionWorldShadow) +// intermediateExtended = EExtendedShader::WorldShadow; +// } +// +// EExtendedShader extended = EExtendedShader::Flat; +// if (intermediateExtended == EExtendedShader::Lighting) { +// /* Transform lighting into thermal if the thermal visor is active */ +// if (g_Renderer->IsThermalVisorHotPass()) +// return flags.m_noZTest ? EExtendedShader::LightingAlphaWriteNoZTestNoZWrite +// : (noZWrite ? EExtendedShader::ThermalStaticNoZWrite : EExtendedShader::ThermalStatic); +// else if (g_Renderer->IsThermalVisorActive()) +// return EExtendedShader::ThermalCold; +// if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Opaque) { +// /* Override shader if originally opaque (typical for FRME models) */ +// if (flags.x0_blendMode > 6) { +// if (flags.m_depthGreater) +// extended = EExtendedShader::ForcedAdditiveNoZWriteDepthGreater; +// else +// extended = +// flags.m_noCull +// ? (noZWrite ? EExtendedShader::ForcedAdditiveNoCullNoZWrite : EExtendedShader::ForcedAdditiveNoCull) +// : (noZWrite ? EExtendedShader::ForcedAdditiveNoZWrite : EExtendedShader::ForcedAdditive); +// } else if (flags.x0_blendMode > 4) { +// extended = flags.m_noCull +// ? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull) +// : (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::ForcedAlpha); +// } else { +// extended = flags.m_noCull +// ? (noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull) +// : (noZWrite ? EExtendedShader::ForcedAlphaNoZWrite : EExtendedShader::Lighting); +// } +// } else if (flags.m_noCull && noZWrite) { +// /* Substitute no-cull,no-zwrite pipeline if available */ +// if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Additive) +// extended = EExtendedShader::ForcedAdditiveNoCullNoZWrite; +// else +// extended = EExtendedShader::ForcedAlphaNoCullNoZWrite; +// } else if (flags.m_noCull) { +// /* Substitute no-cull pipeline if available */ +// if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Additive) +// extended = EExtendedShader::ForcedAdditiveNoCull; +// else +// extended = EExtendedShader::ForcedAlphaNoCull; +// } else if (noZWrite) { +// /* Substitute no-zwrite pipeline if available */ +// if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Additive) +// extended = EExtendedShader::ForcedAdditiveNoZWrite; +// else +// extended = EExtendedShader::ForcedAlphaNoZWrite; +// } else { +// extended = EExtendedShader::Lighting; +// } +// } else if (intermediateExtended == EExtendedShader::ThermalModel) { +// extended = flags.m_noZTest ? EExtendedShader::ThermalModelNoZTestNoZWrite : EExtendedShader::ThermalModel; +// } else if (intermediateExtended < EExtendedShader::MAX) { +// extended = intermediateExtended; +// } +// +// return extended; +//} void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) const { // if (m_uniUpdateCount == 0 || m_uniUpdateCount > m_instances.size()) @@ -660,194 +660,194 @@ void CBooModel::WarmupDrawSurface(const CBooSurface& surf) const { // } } -void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const MaterialSet::Material::PASS& anim) { - using UVAnimType = MaterialSet::Material::BlendMaterial::UVAnimType; - if (anim.uvAnimType == UVAnimType::Invalid) - return; - zeus::CMatrix4f& texMtxOut = reinterpret_cast(*bufOut); - zeus::CMatrix4f& postMtxOut = reinterpret_cast(*(bufOut + sizeof(zeus::CMatrix4f))); - texMtxOut = zeus::CMatrix4f(); - postMtxOut = zeus::CMatrix4f(); - switch (anim.uvAnimType) { - case UVAnimType::MvInvNoTranslation: { - texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); - texMtxOut[3].w() = 1.f; - postMtxOut[0].x() = 0.5f; - postMtxOut[1].y() = 0.5f; - postMtxOut[3].x() = 0.5f; - postMtxOut[3].y() = 0.5f; - break; - } - case UVAnimType::MvInv: { - texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); - texMtxOut[3] = CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix.origin; - texMtxOut[3].w() = 1.f; - postMtxOut[0].x() = 0.5f; - postMtxOut[1].y() = 0.5f; - postMtxOut[3].x() = 0.5f; - postMtxOut[3].y() = 0.5f; - break; - } - case UVAnimType::Scroll: { - texMtxOut[3].x() = CGraphics::GetSecondsMod900() * anim.uvAnimParms[2] + anim.uvAnimParms[0]; - texMtxOut[3].y() = CGraphics::GetSecondsMod900() * anim.uvAnimParms[3] + anim.uvAnimParms[1]; - break; - } - case UVAnimType::Rotation: { - float angle = CGraphics::GetSecondsMod900() * anim.uvAnimParms[1] + anim.uvAnimParms[0]; - float acos = std::cos(angle); - float asin = std::sin(angle); - texMtxOut[0].x() = acos; - texMtxOut[0].y() = asin; - texMtxOut[1].x() = -asin; - texMtxOut[1].y() = acos; - texMtxOut[3].x() = (1.0f - (acos - asin)) * 0.5f; - texMtxOut[3].y() = (1.0f - (asin + acos)) * 0.5f; - break; - } - case UVAnimType::HStrip: { - float value = anim.uvAnimParms[0] * anim.uvAnimParms[2] * (anim.uvAnimParms[3] + CGraphics::GetSecondsMod900()); - texMtxOut[3].x() = std::trunc(anim.uvAnimParms[1] * fmod(value, 1.0f)) * anim.uvAnimParms[2]; - break; - } - case UVAnimType::VStrip: { - float value = anim.uvAnimParms[0] * anim.uvAnimParms[2] * (anim.uvAnimParms[3] + CGraphics::GetSecondsMod900()); - texMtxOut[3].y() = std::trunc(anim.uvAnimParms[1] * fmod(value, 1.0f)) * anim.uvAnimParms[2]; - break; - } - case UVAnimType::Model: { - texMtxOut = CGraphics::g_GXModelMatrix.toMatrix4f(); - texMtxOut[3] = zeus::CVector4f(0.f, 0.f, 0.f, 1.f); - postMtxOut[0].x() = 0.5f; - postMtxOut[1].y() = 0.f; - postMtxOut[2].y() = 0.5f; - postMtxOut[3].x() = CGraphics::g_GXModelMatrix.origin.x() * 0.05f; - postMtxOut[3].y() = CGraphics::g_GXModelMatrix.origin.y() * 0.05f; - break; - } - case UVAnimType::CylinderEnvironment: { - texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); - - const zeus::CVector3f& viewOrigin = CGraphics::g_ViewMatrix.origin; - float xy = (viewOrigin.x() + viewOrigin.y()) * 0.025f * anim.uvAnimParms[1]; - xy = (xy - std::trunc(xy)); - float z = (viewOrigin.z()) * 0.05f * anim.uvAnimParms[1]; - z = (z - std::trunc(z)); - - float halfA = anim.uvAnimParms[0] * 0.5f; - - postMtxOut = - zeus::CTransform(zeus::CMatrix3f(halfA, 0.0, 0.0, 0.0, 0.0, halfA, 0.0, 0.0, 0.0), zeus::CVector3f(xy, z, 1.0)) - .toMatrix4f(); - break; - } - default: - break; - } - bufOut += sizeof(zeus::CMatrix4f) * 2; -} - -void CBooModel::UVAnimationBuffer::PadOutBuffer(u8*& bufStart, u8*& bufOut) { - bufOut = bufStart + ROUND_UP_256(bufOut - bufStart); -} - -void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet, const CModelFlags& flags, - const CBooModel* parent) { - u8* start = bufOut; - - if (flags.m_extendedShader == EExtendedShader::MorphBallShadow) { - /* Special matrices for MorphBall shadow rendering */ - zeus::CMatrix4f texMtx = (zeus::CTransform::Scale(1.f / (flags.mbShadowBox.max - flags.mbShadowBox.min)) * - zeus::CTransform::Translate(-flags.mbShadowBox.min) * CGraphics::g_GXModelMatrix) - .toMatrix4f(); - for (const MaterialSet::Material& mat : matSet->materials) { - (void)mat; - std::array* mtxs = reinterpret_cast*>(bufOut); - mtxs[0][0] = texMtx; - mtxs[0][1] = MBShadowPost0; - mtxs[1][0] = texMtx; - mtxs[1][1] = MBShadowPost1; - bufOut += sizeof(zeus::CMatrix4f) * 2 * 8; - PadOutBuffer(start, bufOut); - } - return; - } else if (flags.m_extendedShader == EExtendedShader::Disintegrate) { - assert(parent != nullptr && "Parent CBooModel not set"); - zeus::CTransform xf = zeus::CTransform::RotateX(-zeus::degToRad(45.f)); - zeus::CAABox aabb = parent->GetAABB().getTransformedAABox(xf); - xf = zeus::CTransform::Scale(5.f / (aabb.max - aabb.min)) * zeus::CTransform::Translate(-aabb.min) * xf; - zeus::CMatrix4f texMtx = xf.toMatrix4f(); - zeus::CMatrix4f post0 = DisintegratePost; - post0[3].x() = flags.addColor.a(); - post0[3].y() = 6.f * -(1.f - flags.addColor.a()) + 1.f; - zeus::CMatrix4f post1 = DisintegratePost; - post1[3].x() = -0.85f * flags.addColor.a() - 0.15f; - post1[3].y() = float(post0[3].y()); - /* Special matrices for disintegration rendering */ - for (const MaterialSet::Material& mat : matSet->materials) { - (void)mat; - std::array* mtxs = reinterpret_cast*>(bufOut); - mtxs[0][0] = texMtx; - mtxs[0][1] = post0; - mtxs[1][0] = texMtx; - mtxs[1][1] = post1; - bufOut += sizeof(zeus::CMatrix4f) * 2 * 8; - PadOutBuffer(start, bufOut); - } - return; - } - - std::optional> specialMtxOut; - if (flags.m_extendedShader == EExtendedShader::ThermalModel || - flags.m_extendedShader == EExtendedShader::ThermalModelNoZTestNoZWrite || - flags.m_extendedShader == EExtendedShader::ThermalStatic || - flags.m_extendedShader == EExtendedShader::ThermalStaticNoZWrite) { - /* Special Mode0 matrix for exclusive Thermal Visor use */ - specialMtxOut.emplace(); - - zeus::CMatrix4f& texMtxOut = (*specialMtxOut)[0]; - texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); - texMtxOut[3].zeroOut(); - texMtxOut[3].w() = 1.f; - - zeus::CMatrix4f& postMtxOut = (*specialMtxOut)[1]; - postMtxOut[0].x() = 0.5f; - postMtxOut[1].y() = 0.5f; - postMtxOut[3].x() = 0.5f; - postMtxOut[3].y() = 0.5f; - } else if (flags.m_extendedShader == EExtendedShader::WorldShadow || - flags.m_extendedShader == EExtendedShader::LightingCubeReflectionWorldShadow) { - /* Special matrix for mapping world shadow */ - specialMtxOut.emplace(); - - zeus::CMatrix4f mat = g_shadowTexXf.toMatrix4f(); - zeus::CMatrix4f& texMtxOut = (*specialMtxOut)[0]; - texMtxOut[0][0] = float(mat[0][0]); - texMtxOut[1][0] = float(mat[1][0]); - texMtxOut[2][0] = float(mat[2][0]); - texMtxOut[3][0] = float(mat[3][0]); - texMtxOut[0][1] = float(mat[0][2]); - texMtxOut[1][1] = float(mat[1][2]); - texMtxOut[2][1] = float(mat[2][2]); - texMtxOut[3][1] = float(mat[3][2]); - } - - for (const MaterialSet::Material& mat : matSet->materials) { - if (specialMtxOut) { - std::array* mtxs = reinterpret_cast*>(bufOut); - mtxs[7][0] = (*specialMtxOut)[0]; - mtxs[7][1] = (*specialMtxOut)[1]; - } - u8* bufOrig = bufOut; - for (const auto& chunk : mat.chunks) { - if (const auto* const pass = chunk.get_if()) { - ProcessAnimation(bufOut, *pass); - } - } - bufOut = bufOrig + sizeof(zeus::CMatrix4f) * 2 * 8; - PadOutBuffer(start, bufOut); - } -} +//void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const MaterialSet::Material::PASS& anim) { +// using UVAnimType = MaterialSet::Material::BlendMaterial::UVAnimType; +// if (anim.uvAnimType == UVAnimType::Invalid) +// return; +// zeus::CMatrix4f& texMtxOut = reinterpret_cast(*bufOut); +// zeus::CMatrix4f& postMtxOut = reinterpret_cast(*(bufOut + sizeof(zeus::CMatrix4f))); +// texMtxOut = zeus::CMatrix4f(); +// postMtxOut = zeus::CMatrix4f(); +// switch (anim.uvAnimType) { +// case UVAnimType::MvInvNoTranslation: { +// texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); +// texMtxOut[3].w() = 1.f; +// postMtxOut[0].x() = 0.5f; +// postMtxOut[1].y() = 0.5f; +// postMtxOut[3].x() = 0.5f; +// postMtxOut[3].y() = 0.5f; +// break; +// } +// case UVAnimType::MvInv: { +// texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); +// texMtxOut[3] = CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix.origin; +// texMtxOut[3].w() = 1.f; +// postMtxOut[0].x() = 0.5f; +// postMtxOut[1].y() = 0.5f; +// postMtxOut[3].x() = 0.5f; +// postMtxOut[3].y() = 0.5f; +// break; +// } +// case UVAnimType::Scroll: { +// texMtxOut[3].x() = CGraphics::GetSecondsMod900() * anim.uvAnimParms[2] + anim.uvAnimParms[0]; +// texMtxOut[3].y() = CGraphics::GetSecondsMod900() * anim.uvAnimParms[3] + anim.uvAnimParms[1]; +// break; +// } +// case UVAnimType::Rotation: { +// float angle = CGraphics::GetSecondsMod900() * anim.uvAnimParms[1] + anim.uvAnimParms[0]; +// float acos = std::cos(angle); +// float asin = std::sin(angle); +// texMtxOut[0].x() = acos; +// texMtxOut[0].y() = asin; +// texMtxOut[1].x() = -asin; +// texMtxOut[1].y() = acos; +// texMtxOut[3].x() = (1.0f - (acos - asin)) * 0.5f; +// texMtxOut[3].y() = (1.0f - (asin + acos)) * 0.5f; +// break; +// } +// case UVAnimType::HStrip: { +// float value = anim.uvAnimParms[0] * anim.uvAnimParms[2] * (anim.uvAnimParms[3] + CGraphics::GetSecondsMod900()); +// texMtxOut[3].x() = std::trunc(anim.uvAnimParms[1] * fmod(value, 1.0f)) * anim.uvAnimParms[2]; +// break; +// } +// case UVAnimType::VStrip: { +// float value = anim.uvAnimParms[0] * anim.uvAnimParms[2] * (anim.uvAnimParms[3] + CGraphics::GetSecondsMod900()); +// texMtxOut[3].y() = std::trunc(anim.uvAnimParms[1] * fmod(value, 1.0f)) * anim.uvAnimParms[2]; +// break; +// } +// case UVAnimType::Model: { +// texMtxOut = CGraphics::g_GXModelMatrix.toMatrix4f(); +// texMtxOut[3] = zeus::CVector4f(0.f, 0.f, 0.f, 1.f); +// postMtxOut[0].x() = 0.5f; +// postMtxOut[1].y() = 0.f; +// postMtxOut[2].y() = 0.5f; +// postMtxOut[3].x() = CGraphics::g_GXModelMatrix.origin.x() * 0.05f; +// postMtxOut[3].y() = CGraphics::g_GXModelMatrix.origin.y() * 0.05f; +// break; +// } +// case UVAnimType::CylinderEnvironment: { +// texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); +// +// const zeus::CVector3f& viewOrigin = CGraphics::g_ViewMatrix.origin; +// float xy = (viewOrigin.x() + viewOrigin.y()) * 0.025f * anim.uvAnimParms[1]; +// xy = (xy - std::trunc(xy)); +// float z = (viewOrigin.z()) * 0.05f * anim.uvAnimParms[1]; +// z = (z - std::trunc(z)); +// +// float halfA = anim.uvAnimParms[0] * 0.5f; +// +// postMtxOut = +// zeus::CTransform(zeus::CMatrix3f(halfA, 0.0, 0.0, 0.0, 0.0, halfA, 0.0, 0.0, 0.0), zeus::CVector3f(xy, z, 1.0)) +// .toMatrix4f(); +// break; +// } +// default: +// break; +// } +// bufOut += sizeof(zeus::CMatrix4f) * 2; +//} +// +//void CBooModel::UVAnimationBuffer::PadOutBuffer(u8*& bufStart, u8*& bufOut) { +// bufOut = bufStart + ROUND_UP_256(bufOut - bufStart); +//} +// +//void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet, const CModelFlags& flags, +// const CBooModel* parent) { +// u8* start = bufOut; +// +// if (flags.m_extendedShader == EExtendedShader::MorphBallShadow) { +// /* Special matrices for MorphBall shadow rendering */ +// zeus::CMatrix4f texMtx = (zeus::CTransform::Scale(1.f / (flags.mbShadowBox.max - flags.mbShadowBox.min)) * +// zeus::CTransform::Translate(-flags.mbShadowBox.min) * CGraphics::g_GXModelMatrix) +// .toMatrix4f(); +// for (const MaterialSet::Material& mat : matSet->materials) { +// (void)mat; +// std::array* mtxs = reinterpret_cast*>(bufOut); +// mtxs[0][0] = texMtx; +// mtxs[0][1] = MBShadowPost0; +// mtxs[1][0] = texMtx; +// mtxs[1][1] = MBShadowPost1; +// bufOut += sizeof(zeus::CMatrix4f) * 2 * 8; +// PadOutBuffer(start, bufOut); +// } +// return; +// } else if (flags.m_extendedShader == EExtendedShader::Disintegrate) { +// assert(parent != nullptr && "Parent CBooModel not set"); +// zeus::CTransform xf = zeus::CTransform::RotateX(-zeus::degToRad(45.f)); +// zeus::CAABox aabb = parent->GetAABB().getTransformedAABox(xf); +// xf = zeus::CTransform::Scale(5.f / (aabb.max - aabb.min)) * zeus::CTransform::Translate(-aabb.min) * xf; +// zeus::CMatrix4f texMtx = xf.toMatrix4f(); +// zeus::CMatrix4f post0 = DisintegratePost; +// post0[3].x() = flags.addColor.a(); +// post0[3].y() = 6.f * -(1.f - flags.addColor.a()) + 1.f; +// zeus::CMatrix4f post1 = DisintegratePost; +// post1[3].x() = -0.85f * flags.addColor.a() - 0.15f; +// post1[3].y() = float(post0[3].y()); +// /* Special matrices for disintegration rendering */ +// for (const MaterialSet::Material& mat : matSet->materials) { +// (void)mat; +// std::array* mtxs = reinterpret_cast*>(bufOut); +// mtxs[0][0] = texMtx; +// mtxs[0][1] = post0; +// mtxs[1][0] = texMtx; +// mtxs[1][1] = post1; +// bufOut += sizeof(zeus::CMatrix4f) * 2 * 8; +// PadOutBuffer(start, bufOut); +// } +// return; +// } +// +// std::optional> specialMtxOut; +// if (flags.m_extendedShader == EExtendedShader::ThermalModel || +// flags.m_extendedShader == EExtendedShader::ThermalModelNoZTestNoZWrite || +// flags.m_extendedShader == EExtendedShader::ThermalStatic || +// flags.m_extendedShader == EExtendedShader::ThermalStaticNoZWrite) { +// /* Special Mode0 matrix for exclusive Thermal Visor use */ +// specialMtxOut.emplace(); +// +// zeus::CMatrix4f& texMtxOut = (*specialMtxOut)[0]; +// texMtxOut = CGraphics::g_GXModelViewInvXpose.toMatrix4f(); +// texMtxOut[3].zeroOut(); +// texMtxOut[3].w() = 1.f; +// +// zeus::CMatrix4f& postMtxOut = (*specialMtxOut)[1]; +// postMtxOut[0].x() = 0.5f; +// postMtxOut[1].y() = 0.5f; +// postMtxOut[3].x() = 0.5f; +// postMtxOut[3].y() = 0.5f; +// } else if (flags.m_extendedShader == EExtendedShader::WorldShadow || +// flags.m_extendedShader == EExtendedShader::LightingCubeReflectionWorldShadow) { +// /* Special matrix for mapping world shadow */ +// specialMtxOut.emplace(); +// +// zeus::CMatrix4f mat = g_shadowTexXf.toMatrix4f(); +// zeus::CMatrix4f& texMtxOut = (*specialMtxOut)[0]; +// texMtxOut[0][0] = float(mat[0][0]); +// texMtxOut[1][0] = float(mat[1][0]); +// texMtxOut[2][0] = float(mat[2][0]); +// texMtxOut[3][0] = float(mat[3][0]); +// texMtxOut[0][1] = float(mat[0][2]); +// texMtxOut[1][1] = float(mat[1][2]); +// texMtxOut[2][1] = float(mat[2][2]); +// texMtxOut[3][1] = float(mat[3][2]); +// } +// +// for (const MaterialSet::Material& mat : matSet->materials) { +// if (specialMtxOut) { +// std::array* mtxs = reinterpret_cast*>(bufOut); +// mtxs[7][0] = (*specialMtxOut)[0]; +// mtxs[7][1] = (*specialMtxOut)[1]; +// } +// u8* bufOrig = bufOut; +// for (const auto& chunk : mat.chunks) { +// if (const auto* const pass = chunk.get_if()) { +// ProcessAnimation(bufOut, *pass); +// } +// } +// bufOut = bufOrig + sizeof(zeus::CMatrix4f) * 2 * 8; +// PadOutBuffer(start, bufOut); +// } +//} //void GeometryUniformLayout::Update(const CModelFlags& flags, const CSkinRules* cskr, const CPoseAsTransforms* pose, // const MaterialSet* matSet, const boo::ObjToken& buf, @@ -1176,16 +1176,16 @@ CModel::CModel(std::unique_ptr&& in, u32 /* dataLen */, IObjectStore* stor const u32 matSetSz = CBasics::SwapBytes(*secSizeCur); const u8* sec = MemoryFromPartData(dataCur, secSizeCur); SShader& shader = x18_matSets.emplace_back(i); - athena::io::MemoryReader r(sec, matSetSz); - shader.m_matSet.read(r); - CBooModel::MakeTexturesFromMats(shader.m_matSet, shader.x0_textures, *store); +// athena::io::MemoryReader r(sec, matSetSz); +// shader.m_matSet.read(r); +// CBooModel::MakeTexturesFromMats(shader.m_matSet, shader.x0_textures, *store); } { u32 hmdlSz = CBasics::SwapBytes(*secSizeCur); const u8* hmdlMetadata = MemoryFromPartData(dataCur, secSizeCur); - athena::io::MemoryReader r(hmdlMetadata, hmdlSz); - m_hmdlMeta.read(r); +// athena::io::MemoryReader r(hmdlMetadata, hmdlSz); +// m_hmdlMeta.read(r); } const u8* vboData = MemoryFromPartData(dataCur, secSizeCur); @@ -1225,8 +1225,8 @@ CModel::CModel(std::unique_ptr&& in, u32 /* dataLen */, IObjectStore* stor const u8* sec = MemoryFromPartData(dataCur, secSizeCur); CBooSurface& surf = x8_surfaces.emplace_back(); surf.selfIdx = i; - athena::io::MemoryReader r(sec, surfSz); - surf.m_data.read(r); +// athena::io::MemoryReader r(sec, surfSz); +// surf.m_data.read(r); } const float* aabbPtr = reinterpret_cast(data.get() + 0xc); @@ -1270,14 +1270,20 @@ bool CModel::IsLoaded(int shaderIdx) const { return x28_modelInst->TryLockTextures(); } -size_t CModel::GetPoolVertexOffset(size_t idx) const { return m_hmdlMeta.vertStride * idx; } +size_t CModel::GetPoolVertexOffset(size_t idx) const { +// return m_hmdlMeta.vertStride * idx; + return 0; +} zeus::CVector3f CModel::GetPoolVertex(size_t idx) const { const auto* floats = reinterpret_cast(m_dynamicVertexData.get() + GetPoolVertexOffset(idx)); return {floats}; } -size_t CModel::GetPoolNormalOffset(size_t idx) const { return m_hmdlMeta.vertStride * idx + 12; } +size_t CModel::GetPoolNormalOffset(size_t idx) const { +// return m_hmdlMeta.vertStride * idx + 12; + return 0; +} zeus::CVector3f CModel::GetPoolNormal(size_t idx) const { const auto* floats = reinterpret_cast(m_dynamicVertexData.get() + GetPoolNormalOffset(idx)); diff --git a/Runtime/Graphics/CTextureBoo.cpp b/Runtime/Graphics/CTextureBoo.cpp index dae5cbf5f..1924e4790 100644 --- a/Runtime/Graphics/CTextureBoo.cpp +++ b/Runtime/Graphics/CTextureBoo.cpp @@ -9,6 +9,8 @@ #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/Graphics/CGraphics.hpp" +#include + namespace metaforce { namespace { logvisor::Module Log("metaforce::CTextureBoo"); diff --git a/Runtime/Graphics/GX.hpp b/Runtime/Graphics/GX.hpp new file mode 100644 index 000000000..00cb2e0b5 --- /dev/null +++ b/Runtime/Graphics/GX.hpp @@ -0,0 +1,296 @@ +#pragma once + +#include + +namespace GX { +enum AttrType { NONE, DIRECT, INDEX8, INDEX16 }; + +enum TevColorArg { + CC_CPREV = 0, + CC_APREV = 1, + CC_C0 = 2, + CC_A0 = 3, + CC_C1 = 4, + CC_A1 = 5, + CC_C2 = 6, + CC_A2 = 7, + CC_TEXC = 8, + CC_TEXA = 9, + CC_RASC = 10, + CC_RASA = 11, + CC_ONE = 12, + CC_HALF = 13, + CC_KONST = 14, + CC_ZERO = 15, +}; + +enum TevAlphaArg { + CA_APREV = 0, + CA_A0 = 1, + CA_A1 = 2, + CA_A2 = 3, + CA_TEXA = 4, + CA_RASA = 5, + CA_KONST = 6, + CA_ZERO = 7, +}; + +enum TevKColorSel { + TEV_KCSEL_8_8 = 0x00, + TEV_KCSEL_7_8 = 0x01, + TEV_KCSEL_6_8 = 0x02, + TEV_KCSEL_5_8 = 0x03, + TEV_KCSEL_4_8 = 0x04, + TEV_KCSEL_3_8 = 0x05, + TEV_KCSEL_2_8 = 0x06, + TEV_KCSEL_1_8 = 0x07, + + TEV_KCSEL_1 = TEV_KCSEL_8_8, + TEV_KCSEL_3_4 = TEV_KCSEL_6_8, + TEV_KCSEL_1_2 = TEV_KCSEL_4_8, + TEV_KCSEL_1_4 = TEV_KCSEL_2_8, + + TEV_KCSEL_K0 = 0x0C, + TEV_KCSEL_K1 = 0x0D, + TEV_KCSEL_K2 = 0x0E, + TEV_KCSEL_K3 = 0x0F, + TEV_KCSEL_K0_R = 0x10, + TEV_KCSEL_K1_R = 0x11, + TEV_KCSEL_K2_R = 0x12, + TEV_KCSEL_K3_R = 0x13, + TEV_KCSEL_K0_G = 0x14, + TEV_KCSEL_K1_G = 0x15, + TEV_KCSEL_K2_G = 0x16, + TEV_KCSEL_K3_G = 0x17, + TEV_KCSEL_K0_B = 0x18, + TEV_KCSEL_K1_B = 0x19, + TEV_KCSEL_K2_B = 0x1A, + TEV_KCSEL_K3_B = 0x1B, + TEV_KCSEL_K0_A = 0x1C, + TEV_KCSEL_K1_A = 0x1D, + TEV_KCSEL_K2_A = 0x1E, + TEV_KCSEL_K3_A = 0x1F +}; + +enum TevKAlphaSel { + TEV_KASEL_8_8 = 0x00, + TEV_KASEL_7_8 = 0x01, + TEV_KASEL_6_8 = 0x02, + TEV_KASEL_5_8 = 0x03, + TEV_KASEL_4_8 = 0x04, + TEV_KASEL_3_8 = 0x05, + TEV_KASEL_2_8 = 0x06, + TEV_KASEL_1_8 = 0x07, + + TEV_KASEL_1 = TEV_KASEL_8_8, + TEV_KASEL_3_4 = TEV_KASEL_6_8, + TEV_KASEL_1_2 = TEV_KASEL_4_8, + TEV_KASEL_1_4 = TEV_KASEL_2_8, + + TEV_KASEL_K0_R = 0x10, + TEV_KASEL_K1_R = 0x11, + TEV_KASEL_K2_R = 0x12, + TEV_KASEL_K3_R = 0x13, + TEV_KASEL_K0_G = 0x14, + TEV_KASEL_K1_G = 0x15, + TEV_KASEL_K2_G = 0x16, + TEV_KASEL_K3_G = 0x17, + TEV_KASEL_K0_B = 0x18, + TEV_KASEL_K1_B = 0x19, + TEV_KASEL_K2_B = 0x1A, + TEV_KASEL_K3_B = 0x1B, + TEV_KASEL_K0_A = 0x1C, + TEV_KASEL_K1_A = 0x1D, + TEV_KASEL_K2_A = 0x1E, + TEV_KASEL_K3_A = 0x1F +}; + +enum TevOp { + TEV_ADD = 0, + TEV_SUB = 1, + TEV_COMP_R8_GT = 8, + TEV_COMP_R8_EQ = 9, + TEV_COMP_GR16_GT = 10, + TEV_COMP_GR16_EQ = 11, + TEV_COMP_BGR24_GT = 12, + TEV_COMP_BGR24_EQ = 13, + TEV_COMP_RGB8_GT = 14, + TEV_COMP_RGB8_EQ = 15, + TEV_COMP_A8_GT = TEV_COMP_RGB8_GT, + TEV_COMP_A8_EQ = TEV_COMP_RGB8_EQ +}; + +enum TevBias { + TB_ZERO = 0, + TB_ADDHALF = 1, + TB_SUBHALF = 2, +}; + +enum TevScale { CS_SCALE_1 = 0, CS_SCALE_2 = 1, CS_SCALE_4 = 2, CS_DIVIDE_2 = 3 }; + +enum TexGenType { + TG_MTX3x4 = 0, + TG_MTX2x4, + TG_BUMP0, + TG_BUMP1, + TG_BUMP2, + TG_BUMP3, + TG_BUMP4, + TG_BUMP5, + TG_BUMP6, + TG_BUMP7, + TG_SRTG +}; + +enum TexGenSrc { + TG_POS = 0, + TG_NRM, + TG_BINRM, + TG_TANGENT, + TG_TEX0, + TG_TEX1, + TG_TEX2, + TG_TEX3, + TG_TEX4, + TG_TEX5, + TG_TEX6, + TG_TEX7, + TG_TEXCOORD0, + TG_TEXCOORD1, + TG_TEXCOORD2, + TG_TEXCOORD3, + TG_TEXCOORD4, + TG_TEXCOORD5, + TG_TEXCOORD6, + TG_COLOR0, + TG_COLOR1 +}; + +enum TexMtx { + TEXMTX0 = 30, + TEXMTX1 = 33, + TEXMTX2 = 36, + TEXMTX3 = 39, + TEXMTX4 = 42, + TEXMTX5 = 45, + TEXMTX6 = 48, + TEXMTX7 = 51, + TEXMTX8 = 54, + TEXMTX9 = 57, + IDENTITY = 60 +}; + +enum PTTexMtx { + PTTEXMTX0 = 64, + PTTEXMTX1 = 67, + PTTEXMTX2 = 70, + PTTEXMTX3 = 73, + PTTEXMTX4 = 76, + PTTEXMTX5 = 79, + PTTEXMTX6 = 82, + PTTEXMTX7 = 85, + PTTEXMTX8 = 88, + PTTEXMTX9 = 91, + PTTEXMTX10 = 94, + PTTEXMTX11 = 97, + PTTEXMTX12 = 100, + PTTEXMTX13 = 103, + PTTEXMTX14 = 106, + PTTEXMTX15 = 109, + PTTEXMTX16 = 112, + PTTEXMTX17 = 115, + PTTEXMTX18 = 118, + PTTEXMTX19 = 121, + PTIDENTITY = 125 +}; + +enum TevRegID { TEVPREV = 0, TEVREG0 = 1, TEVREG1 = 2, TEVREG2 = 3, TEVLAZY = 5 }; + +enum DiffuseFn { DF_NONE = 0, DF_SIGN, DF_CLAMP }; + +enum AttnFn { AF_SPEC = 0, AF_SPOT = 1, AF_NONE }; + +enum Primitive { + POINTS = 0xb8, + LINES = 0xa8, + LINESTRIP = 0xb0, + TRIANGLES = 0x90, + TRIANGLESTRIP = 0x98, + TRIANGLEFAN = 0xa0, + QUADS = 0x80 +}; + +enum ChannelID { + GX_COLOR0, + GX_COLOR1, + GX_ALPHA0, + GX_ALPHA1, + GX_COLOR0A0, + GX_COLOR1A1, + GX_COLOR_ZERO, + GX_ALPHA_BUMP, + GX_ALPHA_BUMPN, + GX_COLOR_NULL = 0xff +}; + +enum BlendFactor : uint16_t { + BL_ZERO, + BL_ONE, + BL_SRCCLR, + BL_INVSRCCLR, + BL_SRCALPHA, + BL_INVSRCALPHA, + BL_DSTALPHA, + BL_INVDSTALPHA +}; + +//struct Color : athena::io::DNA { +// union { +// uint8_t color[4]; +// uint32_t num = 0; +// }; +// Color() = default; +// Color& operator=(const atVec4f& vec) { +// athena::simd_floats f(vec.simd); +// color[0] = uint8_t(std::min(std::max(f[0] * 255.f, 0.f), 255.f)); +// color[1] = uint8_t(std::min(std::max(f[1] * 255.f, 0.f), 255.f)); +// color[2] = uint8_t(std::min(std::max(f[2] * 255.f, 0.f), 255.f)); +// color[3] = uint8_t(std::min(std::max(f[3] * 255.f, 0.f), 255.f)); +// return *this; +// } +// Color& operator=(const atVec3f& vec) { +// athena::simd_floats f(vec.simd); +// color[0] = uint8_t(std::min(std::max(f[0] * 255.f, 0.f), 255.f)); +// color[1] = uint8_t(std::min(std::max(f[1] * 255.f, 0.f), 255.f)); +// color[2] = uint8_t(std::min(std::max(f[2] * 255.f, 0.f), 255.f)); +// color[3] = 0xff; +// return *this; +// } +// Color& operator=(uint8_t val) { +// color[0] = val; +// color[1] = val; +// color[2] = val; +// color[3] = val; +// return *this; +// } +// atVec4f toVec4f() const { +// atVec4f out; +// athena::simd_floats f; +// f[0] = color[0] / 255.f; +// f[1] = color[1] / 255.f; +// f[2] = color[2] / 255.f; +// f[3] = color[3] / 255.f; +// out.simd.copy_from(f); +// return out; +// } +// Color(const atVec4f& vec) { *this = vec; } +// Color(const atVec3f& vec) { *this = vec; } +// Color(uint8_t val) { *this = val; } +// bool operator==(const Color& other) const { return num == other.num; } +// bool operator!=(const Color& other) const { return num != other.num; } +// uint8_t operator[](size_t idx) const { return color[idx]; } +// uint8_t& operator[](size_t idx) { return color[idx]; } +// AT_DECL_EXPLICIT_DNA +//}; + +} // namespace GX diff --git a/Runtime/Graphics/Shaders/CModelShaders.cpp b/Runtime/Graphics/Shaders/CModelShaders.cpp index 2fc2e2a16..b1d44a829 100644 --- a/Runtime/Graphics/Shaders/CModelShaders.cpp +++ b/Runtime/Graphics/Shaders/CModelShaders.cpp @@ -3,7 +3,7 @@ #include "Runtime/CStopwatch.hpp" #include "Runtime/Graphics/CLight.hpp" -#include +//#include //#include namespace metaforce { @@ -59,26 +59,26 @@ void CModelShaders::LightingUniform::ActivateLights(const std::vector& l } } -using TexCoordSource = hecl::Backend::TexCoordSource; - -constexpr std::array ThermalTextures{{ - {TexCoordSource::Normal, 7, true}, -}}; - -constexpr std::array BallFadeTextures{{ - {TexCoordSource::Position, 0, false}, // ID tex - {TexCoordSource::Position, 0, false}, // Sphere ramp - {TexCoordSource::Position, 1, false}, // TXTR_BallFade -}}; - -constexpr std::array WorldShadowTextures{{ - {TexCoordSource::Position, 7, false}, // Shadow tex -}}; - -constexpr std::array DisintegrateTextures{{ - {TexCoordSource::Position, 0, false}, // Ashy tex - {TexCoordSource::Position, 1, false}, // Ashy tex -}}; +//using TexCoordSource = hecl::Backend::TexCoordSource; +// +//constexpr std::array ThermalTextures{{ +// {TexCoordSource::Normal, 7, true}, +//}}; +// +//constexpr std::array BallFadeTextures{{ +// {TexCoordSource::Position, 0, false}, // ID tex +// {TexCoordSource::Position, 0, false}, // Sphere ramp +// {TexCoordSource::Position, 1, false}, // TXTR_BallFade +//}}; +// +//constexpr std::array WorldShadowTextures{{ +// {TexCoordSource::Position, 7, false}, // Shadow tex +//}}; +// +//constexpr std::array DisintegrateTextures{{ +// {TexCoordSource::Position, 0, false}, // Ashy tex +// {TexCoordSource::Position, 1, false}, // Ashy tex +//}}; //static std::array g_ExtensionSlots{{ // /* Default solid shading */ diff --git a/Runtime/GuiSys/CGuiSys.hpp b/Runtime/GuiSys/CGuiSys.hpp index 01549976e..d14e50246 100644 --- a/Runtime/GuiSys/CGuiSys.hpp +++ b/Runtime/GuiSys/CGuiSys.hpp @@ -8,8 +8,6 @@ #include "Runtime/Streams/IOStreams.hpp" #include "Runtime/GuiSys/CSaveableState.hpp" -#include - namespace metaforce { class CGuiFrame; class CGuiObject; diff --git a/Runtime/GuiSys/CGuiTextSupport.cpp b/Runtime/GuiSys/CGuiTextSupport.cpp index e72cc7a93..7013e1b94 100644 --- a/Runtime/GuiSys/CGuiTextSupport.cpp +++ b/Runtime/GuiSys/CGuiTextSupport.cpp @@ -10,6 +10,7 @@ #include "Runtime/GuiSys/CRasterFont.hpp" #include "Runtime/GuiSys/CTextExecuteBuffer.hpp" #include "Runtime/GuiSys/CTextParser.hpp" +#include "Runtime/CStringExtras.hpp" namespace metaforce { @@ -271,7 +272,9 @@ void CGuiTextSupport::SetText(std::u16string_view str, bool multipage) { x304_pageCounter = 0; } -void CGuiTextSupport::SetText(std::string_view str, bool multipage) { SetText(hecl::UTF8ToChar16(str), multipage); } +void CGuiTextSupport::SetText(std::string_view str, bool multipage) { + SetText(CStringExtras::ConvertToUNICODE(str), multipage); +} bool CGuiTextSupport::_GetIsTextSupportFinishedLoading() { for (CToken& tok : x2bc_assets) { diff --git a/Runtime/ImGuiConsole.cpp b/Runtime/ImGuiConsole.cpp index cf9d9bb66..20a2b87f6 100644 --- a/Runtime/ImGuiConsole.cpp +++ b/Runtime/ImGuiConsole.cpp @@ -54,7 +54,7 @@ std::string ImGuiLoadStringTable(CAssetId stringId, int idx) { if (!stringTables.contains(stringId)) { stringTables[stringId] = g_SimplePool->GetObj(SObjectTag{SBIG('STRG'), stringId}); } - return hecl::Char16ToUTF8(stringTables[stringId].GetObj()->GetString(idx)); + return CStringExtras::ConvertToUTF8(stringTables[stringId].GetObj()->GetString(idx)); } static bool ContainsCaseInsensitive(std::string_view str, std::string_view val) { diff --git a/Runtime/Input/ControlMapper.cpp b/Runtime/Input/ControlMapper.cpp index 167da4991..86df1b840 100644 --- a/Runtime/Input/ControlMapper.cpp +++ b/Runtime/Input/ControlMapper.cpp @@ -2,8 +2,6 @@ #include -#include "DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp" - #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/RetroTypes.hpp" #include "Runtime/Input/CFinalInput.hpp" diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index ff18c425f..1e2af558e 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -64,11 +64,11 @@ #include "Runtime/World/CStateMachine.hpp" #include "Runtime/World/CScriptMazeNode.hpp" -#include -#include -#include -#include -#include +#include "Audio/SFX/Misc.h" +#include "Audio/SFX/MiscSamus.h" +#include "Audio/SFX/UI.h" +#include "Audio/SFX/Weapons.h" +#include "Audio/SFX/ZZZ.h" #include "Runtime/MP1/CCredits.hpp" @@ -619,11 +619,11 @@ void CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, const char* areaIdxStr = (*(it + 2)).c_str(); char* endptr = nullptr; - m_warpWorldIdx = TAreaId(hecl::StrToUl(worldIdxStr, &endptr, 0)); + m_warpWorldIdx = TAreaId(strtoul(worldIdxStr, &endptr, 0)); if (endptr == worldIdxStr) { m_warpWorldIdx = 0; } - m_warpAreaId = TAreaId(hecl::StrToUl(areaIdxStr, &endptr, 0)); + m_warpAreaId = TAreaId(strtoul(areaIdxStr, &endptr, 0)); if (endptr == areaIdxStr) { m_warpAreaId = 0; } @@ -649,7 +649,7 @@ void CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, if (*cur == '1') m_warpLayerBits |= u64(1) << (cur - layerStr); } else if (layerStr[0] == '0' && layerStr[1] == 'x') { - m_warpMemoryRelays.emplace_back(TAreaId(hecl::StrToUl(layerStr + 2, nullptr, 16))); + m_warpMemoryRelays.emplace_back(TAreaId(strtoul(layerStr + 2, nullptr, 16))); } ++it; } diff --git a/Runtime/MP1/World/CDrone.cpp b/Runtime/MP1/World/CDrone.cpp index 9e25349a4..c6a396e1c 100644 --- a/Runtime/MP1/World/CDrone.cpp +++ b/Runtime/MP1/World/CDrone.cpp @@ -17,7 +17,7 @@ #include "Runtime/World/CTeamAiMgr.hpp" #include "Runtime/World/CWorld.hpp" -#include "DataSpec/DNAMP1/SFX/Drones.h" +#include "Audio/SFX/Drones.h" #include "TCastTo.hpp" // Generated file, do not modify include path diff --git a/Runtime/MP1/World/CMetaree.hpp b/Runtime/MP1/World/CMetaree.hpp index cb379eec9..fd1a0e46d 100644 --- a/Runtime/MP1/World/CMetaree.hpp +++ b/Runtime/MP1/World/CMetaree.hpp @@ -1,6 +1,6 @@ #pragma once -#include "DataSpec/DNAMP1/SFX/Metaree.h" +#include "Audio/SFX/Metaree.h" #include "Runtime/World/CDamageInfo.hpp" #include "Runtime/World/CPatterned.hpp" diff --git a/Runtime/MP1/World/CMetroidPrimeEssence.cpp b/Runtime/MP1/World/CMetroidPrimeEssence.cpp index a6a83c692..78c8c8d0e 100644 --- a/Runtime/MP1/World/CMetroidPrimeEssence.cpp +++ b/Runtime/MP1/World/CMetroidPrimeEssence.cpp @@ -14,7 +14,7 @@ #include "Runtime/World/CScriptWaypoint.hpp" #include "Runtime/World/CWorld.hpp" -#include "DataSpec/DNAMP1/SFX/MetroidPrime.h" +#include "Audio/SFX/MetroidPrime.h" #include "TCastTo.hpp" // Generated file, do not modify include path @@ -721,4 +721,4 @@ void CMetroidPrimeEssence::SetupCollisionActorManager(CStateManager& mgr) { AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr); } -} // namespace metaforce::MP1 \ No newline at end of file +} // namespace metaforce::MP1 diff --git a/Runtime/MP1/World/CMetroidPrimeExo.cpp b/Runtime/MP1/World/CMetroidPrimeExo.cpp index bcd13a71e..55b0350db 100644 --- a/Runtime/MP1/World/CMetroidPrimeExo.cpp +++ b/Runtime/MP1/World/CMetroidPrimeExo.cpp @@ -1,7 +1,5 @@ #include "Runtime/MP1/World/CMetroidPrimeExo.hpp" -#include "DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage1.hpp" - #include "Runtime/CSimplePool.hpp" #include "Runtime/CStateManager.hpp" #include "Runtime/Collision/CCollisionActor.hpp" diff --git a/Runtime/MP1/World/CThardus.cpp b/Runtime/MP1/World/CThardus.cpp index d8ea69cbd..ec3c3f3c5 100644 --- a/Runtime/MP1/World/CThardus.cpp +++ b/Runtime/MP1/World/CThardus.cpp @@ -24,8 +24,8 @@ #include "TCastTo.hpp" // Generated file, do not modify include path -#include -#include +#include